posthog-js 1.307.0 → 1.307.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/array.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){"use strict";var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(i.self=i),"undefined"==typeof File&&(i.File=function(){});var e=Array.prototype,r=e.forEach,s=e.indexOf,n=null==i?void 0:i.navigator,o=null==i?void 0:i.document,a=null==i?void 0:i.location,l=null==i?void 0:i.fetch,u=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,h=null==i?void 0:i.AbortController,d=null==n?void 0:n.userAgent,v=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"1.307.0"};function f(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function p(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){f(n,r,s,o,a,"next",t)}function a(t){f(n,r,s,o,a,"throw",t)}o(void 0)}))}}function g(){return g=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},g.apply(null,arguments)}function _(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}var 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(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return m.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))},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(t,i){return-1!==t.indexOf(i)}var x=function(t){return t.trim()},E=function(t){return t.replace(/^\$/,"")};var S=Array.isArray,k=Object.prototype,P=k.hasOwnProperty,T=k.toString,C=S||function(t){return"[object Array]"===T.call(t)},I=t=>"function"==typeof t,R=t=>t===Object(t)&&!C(t),F=t=>{if(R(t)){for(var i in t)if(P.call(t,i))return!1;return!0}return!1},M=t=>void 0===t,O=t=>"[object String]"==T.call(t),A=t=>O(t)&&0===t.trim().length,D=t=>null===t,j=t=>M(t)||D(t),L=t=>"[object Number]"==T.call(t),N=t=>"[object Boolean]"===T.call(t),U=t=>t instanceof FormData,z=t=>w(b,t);function H(t){return null===t||"object"!=typeof t}function B(t,i){return Object.prototype.toString.call(t)==="[object "+i+"]"}function q(t){return!M(Event)&&function(t,i){try{return t instanceof i}catch(t){return!1}}(t,Event)}var W=[!0,"true",1,"1","yes"],G=t=>w(W,t),V=[!1,"false",0,"0","no"];function J(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),L(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):t<i?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),J(s||e,i,e,r))}class K{constructor(t){this.t={},this.i=t.i,this.o=J(t.bucketSize,0,100,t.h),this.m=J(t.refillRate,0,this.o,t.h),this.S=J(t.refillInterval,0,864e5,t.h)}$(t,i){var e=i-t.lastAccess,r=Math.floor(e/this.S);if(r>0){var s=r*this.m;t.tokens=Math.min(t.tokens+s,this.o),t.lastAccess=t.lastAccess+r*this.S}}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.t[r];return s?this.$(s,e):(s={tokens:this.o,lastAccess:e},this.t[r]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.i)||i.call(this,t)),0===s.tokens)}stop(){this.t={}}}var Y,X,Q,Z=t=>t instanceof Error;function tt(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Q&&e.length===X||(X=e.length,Q=e.reduce(((e,r)=>{Y||(Y={});var s=Y[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=i[r];if(l&&u){e[l]=u,Y[r]=[l,u];break}}return e}),{})),Q}}class it{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return p((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&C(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?1:0),i.chunkIdMap)),g({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return p((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,i){var e,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,g({},i,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:tt(this.stackParser)}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(r<=4){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return g({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}var et="?";function rt(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?et:e,in_app:!0};return M(r)||(n.lineno=r),M(s)||(n.colno=s),n}var st=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:et,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},nt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ot=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,at=/\((\S*)(?::(\d+))(?::(\d+))\)/,lt=(t,i)=>{var e=nt.exec(t);if(e){var[,r,s,n]=e;return rt(i,r,et,+s,+n)}var o=ot.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=at.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=st(o[1]||et,o[2]);return rt(i,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},ut=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ht=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,dt=(t,i)=>{var e=ut.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=ht.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||et;return[n,s]=st(n,s),rt(i,s,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},vt=/\(error: (.*)\)/,ct=50;function ft(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return function(i,r){void 0===r&&(r=0);for(var s=[],n=i.split("\n"),o=r;o<n.length;o++){var a=n[o];if(!(a.length>1024)){var l=vt.test(a)?a.replace(vt,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of e){var h=u(l,t);if(h){s.push(h);break}}if(s.length>=ct)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,ct).map((t=>{return g({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||et});var e}))}(s)}}class pt{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=O(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return B(t,"DOMException")}isDOMError(t){return B(t,"DOMError")}}class gt{match(t){return(t=>t instanceof Error)(t)}coerce(t,i){return{type:this.getType(t),value:this.getMessage(t,i),stack:this.getStack(t),cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return e.error&&"string"==typeof e.error.message?String(e.error.message):String(e)}getStack(t){return t.stacktrace||t.stack||void 0}}class _t{constructor(){}match(t){return B(t,"ErrorEvent")&&null!=t.error}coerce(t,i){var e,r=i.apply(t.error);return r||{type:"ErrorEvent",value:t.message,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}var mt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class yt{match(t){return"string"==typeof t}coerce(t,i){var e,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(mt);return r&&(i=r[1],e=r[2]),[i,e]}}var bt=["fatal","error","warning","log","info","debug"];function wt(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(!(s.length>i))return r===e.length||s.length<=i?s:s.slice(0,i)+"..."}return""}class xt{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r=this.getErrorPropertyFromObject(t);return r?i.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(e=i.syntheticException)?void 0:e.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return q(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+wt(t)}isSeverityLevel(t){return O(t)&&!A(t)&&bt.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var e=t[i];if(Z(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class Et{match(t){return q(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+wt(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class St{match(t){return H(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class $t{match(t){return B(t,"PromiseRejectionEvent")}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return H(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){if(H(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var kt=function(i,e){var{debugEnabled:r}=void 0===e?{}:e,s={k:function(e){if(t&&(c.DEBUG||v.POSTHOG_DEBUG||r)&&!M(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[e]?t.console[e].__rrweb_original__:t.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];s(i,...o)}},info:function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];s.k("log",...i)},warn:function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];s.k("warn",...i)},error:function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];s.k("error",...i)},critical:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];console.error(i,...e)},uninitializedWarning:t=>{s.error("You must initialize PostHog before calling "+t)},createLogger:(t,e)=>kt(i+" "+t,e)};return s},Pt=kt("[PostHog.js]"),Tt=Pt.createLogger,Ct=Tt("[ExternalScriptsLoader]"),It=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Ct.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=null==o?void 0:o.querySelectorAll("script");if(r)for(var s,n=function(){if(r[a].src===i){var t=r[a];return t.__posthog_loading_callback_fired?{v:e()}:(t.addEventListener("load",(i=>{t.__posthog_loading_callback_fired=!0,e(void 0,i)})),t.onerror=t=>e(t),{v:void 0})}},a=0;a<r.length;a++)if(s=n())return s.v;var l=()=>{if(!o)return e("document not found");var r=o.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>e(t),t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");var s,n=o.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):o.body.appendChild(r)};null!=o&&o.body?l():null==o||o.addEventListener("DOMContentLoaded",l)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{var r="/static/"+i+".js?v="+t.version;if("remote-config"===i&&(r="/array/"+t.config.token+"/config.js"),"toolbar"===i){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=t.requestRouter.endpointFor("assets",r);It(t,n,e)},v.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);It(t,r,e)};var Rt={};function Ft(t,i,e){if(C(t))if(r&&t.forEach===r)t.forEach(i,e);else if("length"in t&&t.length===+t.length)for(var s=0,n=t.length;s<n;s++)if(s in t&&i.call(e,t[s],s)===Rt)return}function Mt(t,i,e){if(!j(t)){if(C(t))return Ft(t,i,e);if(U(t)){for(var r of t.entries())if(i.call(e,r[1],r[0])===Rt)return}else for(var s in t)if(P.call(t,s)&&i.call(e,t[s],s)===Rt)return}}var Ot=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return Ft(e,(function(i){for(var e in i)void 0!==i[e]&&(t[e]=i[e])})),t},At=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return Ft(e,(function(i){Ft(i,(function(i){t.push(i)}))})),t};function Dt(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var jt=function(t){try{return t()}catch(t){return}},Lt=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;r<i;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){Pt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Pt.critical(t)}}},Nt=function(t){var i={};return Mt(t,(function(t,e){(O(t)&&t.length>0||L(t))&&(i[e]=t)})),i};function Ut(t,i){return e=t,r=t=>O(t)&&!D(i)?t.slice(0,i):t,s=new Set,function t(i,e){return i!==Object(i)?r?r(i,e):i:s.has(i)?void 0:(s.add(i),C(i)?(n=[],Ft(i,(i=>{n.push(t(i))}))):(n={},Mt(i,((i,e)=>{s.has(i)||(n[e]=t(i,e))}))),n);var n}(e);var e,r,s}var zt=["herokuapp.com","vercel.app","netlify.app"];function Ht(t){var i=null==t?void 0:t.hostname;if(!O(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of zt)if(e===r)return!1;return!0}function Bt(t,i){for(var e=0;e<t.length;e++)if(i(t[e]))return t[e]}function qt(t,i,e,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:s,passive:n})}var Wt="$people_distinct_id",Gt="__alias",Vt="__timers",Jt="$autocapture_disabled_server_side",Kt="$heatmaps_enabled_server_side",Yt="$exception_capture_enabled_server_side",Xt="$error_tracking_suppression_rules",Qt="$error_tracking_capture_extension_exceptions",Zt="$web_vitals_enabled_server_side",ti="$dead_clicks_enabled_server_side",ii="$web_vitals_allowed_metrics",ei="$session_recording_remote_config",ri="$sesid",si="$session_is_sampled",ni="$enabled_feature_flags",oi="$early_access_features",ai="$feature_flag_details",li="$stored_person_properties",ui="$stored_group_properties",hi="$surveys",di="$surveys_activated",vi="$flag_call_reported",ci="$user_state",fi="$client_session_props",pi="$capture_rate_limit",gi="$initial_campaign_params",_i="$initial_referrer_info",mi="$initial_person_info",yi="$epp",bi="__POSTHOG_TOOLBAR__",wi="$posthog_cookieless",xi=[Wt,Gt,"__cmpns",Vt,"$session_recording_enabled_server_side",Kt,ri,ni,Xt,ci,oi,ai,ui,li,hi,vi,fi,pi,gi,_i,yi,mi,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function Ei(t){return t instanceof Element&&(t.id===bi||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Si(t){return!!t&&1===t.nodeType}function $i(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function ki(t){return!!t&&3===t.nodeType}function Pi(t){return!!t&&11===t.nodeType}function Ti(t){return t?x(t).split(/\s+/):[]}function Ci(i){var e=null==t?void 0:t.location.href;return!!(e&&i&&i.some((t=>e.match(t))))}function Ii(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return Ti(i)}function Ri(t){return j(t)?null:x(t).split(/(\s+)/).filter((t=>Qi(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Fi(t){var i="";return qi(t)&&!Wi(t)&&t.childNodes&&t.childNodes.length&&Mt(t.childNodes,(function(t){var e;ki(t)&&t.textContent&&(i+=null!==(e=Ri(t.textContent))&&void 0!==e?e:"")})),x(i)}function Mi(t){return M(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null;var i}var Oi=["a","button","form","input","select","textarea","label"];function Ai(t,i){if(M(i))return!0;var e,r=function(t){if(i.some((i=>t.matches(i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function Di(t){var i=t.parentNode;return!(!i||!Si(i))&&i}var ji=["next","previous","prev",">","<"],Li=10;var Ni=[".ph-no-rageclick",".ph-no-capture"];function Ui(i,e){if(!t||zi(i))return!1;var r,s,n;N(e)?(r=!!e&&Ni,s=void 0):(r=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:Ni,s=null==e?void 0:e.content_ignorelist);if(!1===r)return!1;var{targetElementList:o}=Hi(i,!1);return!function(t,i){if(!1===t||M(t))return!1;var e;if(!0===t)e=ji;else{if(!C(t))return!1;if(t.length>Li)return Pt.error("[PostHog] content_ignorelist array cannot exceed "+Li+" items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var{safeText:i,ariaLabel:r}=t;return e.some((t=>i.includes(t)||r.includes(t)))}))}(s,o.map((t=>{var i;return{safeText:Fi(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!Ai(o,r)}var zi=t=>!t||$i(t,"html")||!Si(t),Hi=(i,e)=>{if(!t||zi(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!$i(n,"body");)if(Pi(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=Di(n);if(!o)break;if(e||Oi.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function Bi(i,e,r,s,n){var o,a,l,u;if(void 0===r&&(r=void 0),!t||zi(i))return!1;if(null!=(o=r)&&o.url_allowlist&&!Ci(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&Ci(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var h=r.dom_event_allowlist;if(h&&!h.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:d,targetElementList:v}=Hi(i,s);if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(M(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,r))return!1;if(!Ai(v,null==(u=r)?void 0:u.css_selector_allowlist))return!1;var c=t.getComputedStyle(i);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===e.type)return!0;var f=i.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return d?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(Oi.indexOf(f)>-1||"true"===i.getAttribute("contenteditable"))}}function qi(t){for(var i=t;i.parentNode&&!$i(i,"body");i=i.parentNode){var e=Ii(i);if(w(e,"ph-sensitive")||w(e,"ph-no-capture"))return!1}if(w(Ii(t),"ph-include"))return!0;var r=t.type||"";if(O(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.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 Wi(t){return!!($i(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||$i(t,"select")||$i(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Gi="(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})",Vi=new RegExp("^(?:"+Gi+")$"),Ji=new RegExp(Gi),Ki="\\d{3}-?\\d{2}-?\\d{4}",Yi=new RegExp("^("+Ki+")$"),Xi=new RegExp("("+Ki+")");function Qi(t,i){if(void 0===i&&(i=!0),j(t))return!1;if(O(t)){if(t=x(t),(i?Vi:Ji).test((t||"").replace(/[- ]/g,"")))return!1;if((i?Yi:Xi).test(t))return!1}return!0}function Zi(t){var i=Fi(t);return Qi(i=(i+" "+te(t)).trim())?i:""}function te(t){var i="";return t&&t.childNodes&&t.childNodes.length&&Mt(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Fi(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+te(t)).trim())}catch(t){Pt.error("[AutoCapture]",t)}})),i}function ie(t){return function(t){var i=t.map((t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=g({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Dt(n).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return o[ee(i.toString())]=ee(e.toString())})),r+=":",r+=Dt(o).map((t=>{var[i,e]=t;return i+'="'+e+'"'})).join("")}));return i.join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:re(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Dt(t).filter((t=>{var[i]=t;return 0===i.indexOf("attr__")})).forEach((t=>{var[i,e]=t;return r.attributes[i]=e})),r}))}(t))}function ee(t){return t.replace(/"|\\"/g,'\\"')}function re(t){var i=t.attr__class;return i?C(i)?i:Ti(i):void 0}class se{constructor(t){this.disabled=!1===t;var i=R(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&e-r.timestamp<this.timeoutMs){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var ne="$copy_autocapture",oe=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),ae=t=>{var i=null==o?void 0:o.createElement("a");return M(i)?null:(i.href=t,i)},le=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return Mt(t,(function(t,i){M(t)||M(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)},ue=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!C(e)||e.length<2)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Pt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},he=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],u=(a||"").split("&"),h=[],d=0;d<u.length;d++){var v=u[d].split("=");C(v)&&(i.includes(v[0])?h.push(v[0]+"="+e):h.push(u[d]))}var c=l;return null!=a&&(c+="?"+h.join("&")),null!=n&&(c+="#"+n),c},de=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},ve=Tt("[AutoCapture]");function ce(t,i){return i.length>t?i.slice(0,t)+"...":i}function fe(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Si(i));return i}function pe(t,i,e,r){var s=t.tagName.toLowerCase(),n={tag_name:s};Oi.indexOf(s)>-1&&!e&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=ce(1024,Zi(t)):n.$el_text=ce(1024,Fi(t)));var o=Ii(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),Mt(t.attributes,(function(e){var s;if((!Wi(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&((null==r||!r.includes(e.name))&&!i&&Qi(e.value)&&(s=e.name,!O(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7)))){var o=e.value;"class"===e.name&&(o=Ti(o).join(" ")),n["attr__"+e.name]=ce(1024,o)}}));for(var a=1,l=1,u=t;u=fe(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function ge(i,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=e,h=[i],d=i;d.parentNode&&!$i(d,"body");)Pi(d.parentNode)?(h.push(d.parentNode.host),d=d.parentNode.host):(h.push(d.parentNode),d=d.parentNode);var v,c=[],f={},p=!1,g=!1;if(Mt(h,(t=>{var i=qi(t);"a"===t.tagName.toLowerCase()&&(p=t.getAttribute("href"),p=i&&p&&Qi(p)&&p),w(Ii(t),"ph-no-capture")&&(g=!0),c.push(pe(t,o,a,l));var e=function(t){if(!qi(t))return{};var i={};return Mt(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Qi(r)&&(i[e]=r)}})),i}(t);Ot(f,e)})),g)return{props:{},explicitNoCapture:g};if(a||("a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?c[0].$el_text=Zi(i):c[0].$el_text=Fi(i)),p){var _,m;c[0].attr__href=p;var y=null==(_=ae(p))?void 0:_.host,b=null==t||null==(m=t.location)?void 0:m.host;y&&b&&y!==b&&(v=p)}return{props:Ot({$event_type:n.type,$ce_version:1},u?{}:{$elements:c},{$elements_chain:ie(c)},null!=(r=c[0])&&r.$el_text?{$el_text:null==(s=c[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},f)}}class _e{constructor(t){this.P=!1,this.T=null,this.C=!1,this.instance=t,this.rageclicks=new se(t.config.rageclick),this.I=null}get R(){var t,i,e=R(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=null==(t=e.url_allowlist)?void 0:t.map((t=>new RegExp(t))),e.url_ignorelist=null==(i=e.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),e}F(){if(this.isBrowserSupported()){if(t&&o){var i=i=>{i=i||(null==t?void 0:t.event);try{this.M(i)}catch(t){ve.error("Failed to capture event",t)}};if(qt(o,"submit",i,{capture:!0}),qt(o,"change",i,{capture:!0}),qt(o,"click",i,{capture:!0}),this.R.capture_copied_text){var e=i=>{i=i||(null==t?void 0:t.event),this.M(i,ne)};qt(o,"copy",e,{capture:!0}),qt(o,"cut",e,{capture:!0})}}}else ve.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.C=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Jt]:!!t.autocapture_opt_out}),this.T=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.I=t}getElementSelectors(t){var i,e=[];return null==(i=this.I)||i.forEach((i=>{var r=null==o?void 0:o.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i,e=null==(t=this.instance.persistence)?void 0:t.props[Jt],r=this.T;if(D(r)&&!N(e)&&!this.instance.O())return!1;var s=null!==(i=this.T)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!s}M(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r,s=Mi(i);if(ki(s)&&(s=s.parentNode||null),"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent)this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(i.clientX,i.clientY,i.timeStamp||(new Date).getTime())&&Ui(s,this.instance.config.rageclick)&&this.M(i,"$rageclick");var n=e===ne;if(s&&Bi(s,i,this.R,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=ge(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.C});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),e===ne){var u,h=Ri(null==t||null==(u=t.getSelection())?void 0:u.toString()),d=i.type||"clipboard";if(!h)return!1;o.$selected_content=h,o.$copy_type=d}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return I(null==o?void 0:o.querySelectorAll)}}Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return L(t)&&isFinite(t)&&Math.floor(t)===t});var me="0123456789abcdef";class ye{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||t<0||i<0||e<0||r<0||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new ye(s)}toString(){for(var t="",i=0;i<this.bytes.length;i++)t=t+me.charAt(this.bytes[i]>>>4)+me.charAt(15&this.bytes[i]),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new ye(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;i<16;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class be{constructor(){this.A=0,this.D=0,this.j=new Ee}generate(){var t=this.generateOrAbort();if(M(t)){this.A=0;var i=this.generateOrAbort();if(M(i))throw new Error("Could not generate UUID after timestamp reset");return i}return t}generateOrAbort(){var t=Date.now();if(t>this.A)this.A=t,this.L();else{if(!(t+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return ye.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var we,xe=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;i<t.length;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!M(t.crypto)&&crypto.getRandomValues&&(xe=t=>crypto.getRandomValues(t));class Ee{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(xe(this.N),this.U=0),this.N[this.U++]}}var Se=()=>$e().toString(),$e=()=>(we||(we=new be)).generate(),ke="";var Pe=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Te(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=o),ke)return ke;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Se();!ke&&r--;){var n=e.slice(r).join("."),a=s+"=1;domain=."+n+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(s)&&(i.cookie=a+";max-age=0",ke=n)}return ke}(t);if(!e){var r=(t=>{var i=t.match(Pe);return i?i[0]:""})(t);r!==e&&Pt.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}var Ce={H:()=>!!o,B:function(t){Pt.error("cookieStore error: "+t)},q:function(t){if(o){try{for(var i=t+"=",e=o.cookie.split(";").filter((t=>t.length)),r=0;r<e.length;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}},W:function(t){var i;try{i=JSON.parse(Ce.q(t))||{}}catch(t){}return i},G:function(t,i,e,r,s){if(o)try{var n="",a="",l=Te(o.location.hostname,r);if(e){var u=new Date;u.setTime(u.getTime()+24*e*60*60*1e3),n="; expires="+u.toUTCString()}s&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&Pt.warn("cookieStore warning: large cookie, len="+h.length),o.cookie=h,h}catch(t){return}},V:function(t,i){if(null!=o&&o.cookie)try{Ce.G(t,"",-1,i)}catch(t){return}}},Ie=null,Re={H:function(){if(!D(Ie))return Ie;var i=!0;if(M(t))i=!1;else try{var e="__mplssupport__";Re.G(e,"xyz"),'"xyz"'!==Re.q(e)&&(i=!1),Re.V(e)}catch(t){i=!1}return i||Pt.error("localStorage unsupported; falling back to cookie store"),Ie=i,i},B:function(t){Pt.error("localStorage error: "+t)},q:function(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){Re.B(t)}return null},W:function(t){try{return JSON.parse(Re.q(t))||{}}catch(t){}return null},G:function(i,e){try{null==t||t.localStorage.setItem(i,JSON.stringify(e))}catch(t){Re.B(t)}},V:function(i){try{null==t||t.localStorage.removeItem(i)}catch(t){Re.B(t)}}},Fe=["distinct_id",ri,si,yi,mi],Me=g({},Re,{W:function(t){try{var i={};try{i=Ce.W(t)||{}}catch(t){}var e=Ot(i,JSON.parse(Re.q(t)||"{}"));return Re.G(t,e),e}catch(t){}return null},G:function(t,i,e,r,s,n){try{Re.G(t,i,void 0,void 0,n);var o={};Fe.forEach((t=>{i[t]&&(o[t]=i[t])})),Object.keys(o).length&&Ce.G(t,o,e,r,s,n)}catch(t){Re.B(t)}},V:function(i,e){try{null==t||t.localStorage.removeItem(i),Ce.V(i,e)}catch(t){Re.B(t)}}}),Oe={},Ae={H:function(){return!0},B:function(t){Pt.error("memoryStorage error: "+t)},q:function(t){return Oe[t]||null},W:function(t){return Oe[t]||null},G:function(t,i){Oe[t]=i},V:function(t){delete Oe[t]}},De=null,je={H:function(){if(!D(De))return De;if(De=!0,M(t))De=!1;else try{var i="__support__";je.G(i,"xyz"),'"xyz"'!==je.q(i)&&(De=!1),je.V(i)}catch(t){De=!1}return De},B:function(t){Pt.error("sessionStorage error: ",t)},q:function(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){je.B(t)}return null},W:function(t){try{return JSON.parse(je.q(t))||null}catch(t){}return null},G:function(i,e){try{null==t||t.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){je.B(t)}},V:function(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){je.B(t)}}},Le=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class Ne{constructor(t){this._instance=t}get R(){return this._instance.config}get consent(){return this.J()?Le.DENIED:this.K}isOptedOut(){return"always"===this.R.cookieless_mode||(this.consent===Le.DENIED||this.consent===Le.PENDING&&(this.R.opt_out_capturing_by_default||"on_reject"===this.R.cookieless_mode))}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Le.DENIED}optInOut(t){this.Y.G(this.X,t?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get K(){var t=this.Y.q(this.X);return G(t)?Le.GRANTED:w(V,t)?Le.DENIED:Le.PENDING}get Y(){if(!this.Z){var t=this.R.opt_out_capturing_persistence_type;this.Z="localStorage"===t?Re:Ce;var i="localStorage"===t?Ce:Re;i.q(this.X)&&(this.Z.q(this.X)||this.optInOut(G(i.q(this.X))),i.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!Bt([null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,v.doNotTrack],(t=>G(t)))}}var Ue=Tt("[Dead Clicks]"),ze=()=>!0,He=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(ti)),r=t.instance.config.capture_dead_clicks;return N(r)?r:!!R(r)||e};class Be{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[ti]:null==t?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Ue.error("failed to load script",i):t()}))}et(){var t;if(o){if(!this.tt&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=R(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.tt=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.tt.start(o),Ue.info("starting...")}}else Ue.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Ue.info("stopping..."))}}var qe=Tt("[ExceptionAutocapture]");class We{constructor(i){var e,r,s;this.rt=()=>{var i;if(t&&this.isEnabled&&null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=e(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=r(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=s(this.captureException.bind(this)))}catch(t){qe.error("failed to start",t),this.lt()}}},this._instance=i,this.ut=!(null==(e=this._instance.persistence)||!e.props[Yt]),this.R=this.ht(),this.dt=new K({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,h:qe}),this.startIfEnabled()}ht(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return R(t)?i=g({},i,t):(M(t)?this.ut:t)&&(i=g({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(qe.info("enabled"),this.it(this.rt))}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return qe.error("failed to load script",i);t()}))}lt(){var t,i,e;null==(t=this.st)||t.call(this),this.st=void 0,null==(i=this.nt)||i.call(this),this.nt=void 0,null==(e=this.ot)||e.call(this),this.ot=void 0}onRemoteConfig(t){var i=t.autocaptureExceptions;this.ut=!!i||!1,this.R=this.ht(),this._instance.persistence&&this._instance.persistence.register({[Yt]:this.ut}),this.startIfEnabled()}captureException(t){var i,e,r=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.dt.consumeRateLimit(r)?qe.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(t)}}function Ge(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return I(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}class Ve{constructor(i){var e;this._instance=i,this.vt=(null==t||null==(e=t.location)?void 0:e.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Pt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ct&&this.ct(),this.ct=void 0,Pt.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(t&&t.history){var r=this;null!=(i=t.history.pushState)&&i.__posthog_wrapped__||Ge(t.history,"pushState",(t=>function(i,e,s){t.call(this,i,e,s),r.ft("pushState")})),null!=(e=t.history.replaceState)&&e.__posthog_wrapped__||Ge(t.history,"replaceState",(t=>function(i,e,s){t.call(this,i,e,s),r.ft("replaceState")})),this.gt()}}ft(i){try{var e,r=null==t||null==(e=t.location)?void 0:e.pathname;if(!r)return;r!==this.vt&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:i}),this.vt=r}catch(t){Pt.error("Error capturing "+i+" pageview",t)}}gt(){if(!this.ct){var i=()=>{this.ft("popstate")};qt(t,"popstate",i),this.ct=()=>{t&&t.removeEventListener("popstate",i)}}}}var Je=Tt("[SegmentIntegration]");function Ke(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||Se();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(ci,"identified")),i()},s=e.user();"then"in s&&I(s.then)?s.then((t=>r(t))):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||Je.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Je.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Je.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,"$pageview"),identify:t=>i(t,"$identify"),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}var Ye="posthog-js";function Xe(t,i){var{organization:e,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===i?{}:i;return i=>{var a,l,u,h,d;if(!("*"===n||n.includes(i.level))||!t.__loaded)return i;i.tags||(i.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c=(null==(a=i.exception)?void 0:a.values)||[],f=c.map((t=>g({},t,{stacktrace:t.stacktrace?g({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>g({},t,{platform:"web:javascript"})))}):void 0}))),p={$exception_message:(null==(l=c[0])?void 0:l.value)||i.message,$exception_type:null==(u=c[0])?void 0:u.type,$exception_level:i.level,$exception_list:f,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(h=c[0])?void 0:h.value)||i.message,$sentry_exception_type:null==(d=c[0])?void 0:d.type,$sentry_tags:i.tags};return e&&r&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+e+"/issues/?project="+r+"&query="+i.event_id),o&&t.exceptions.sendExceptionEvent(p),i}}class Qe{constructor(t,i,e,r,s,n){this.name=Ye,this.setupOnce=function(o){o(Xe(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}var Ze=null!=t&&t.location?de(t.location.hash,"__posthog")||de(location.hash,"state"):null,tr="_postHogToolbarParams",ir=Tt("[Toolbar]"),er=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(er||{});class rr{constructor(t){this.instance=t}_t(t){v.ph_toolbar_state=t}yt(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:er.UNINITIALIZED}maybeLoadToolbar(i,e,r){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===r&&(r=void 0),!t||!o)return!1;i=null!=i?i:t.location,r=null!=r?r:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}var s,n=Ze||de(i.hash,"__posthog")||de(i.hash,"state"),a=n?jt((()=>JSON.parse(atob(decodeURIComponent(n)))))||jt((()=>JSON.parse(decodeURIComponent(n)))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?i.hash=a.desiredHash:r?r.replaceState(r.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(tr)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch(t){return!1}}bt(t){var i=v.ph_load_toolbar||v.ph_load_editor;!j(i)&&I(i)?i(t,this.instance):ir.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==o||!o.getElementById(bi));if(!t||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=g({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(t.localStorage.setItem(tr,JSON.stringify(g({},s,{source:void 0}))),this.yt()===er.LOADED)this.bt(s);else if(this.yt()===er.UNINITIALIZED){var n;this._t(er.LOADING),null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return ir.error("[Toolbar] Failed to load",t),void this._t(er.UNINITIALIZED);this._t(er.LOADED),this.bt(s)})),qt(t,"turbolinks:load",(()=>{this._t(er.UNINITIALIZED),this.loadToolbar(s)}))}return!0}wt(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}var sr=Tt("[TracingHeaders]");class nr{constructor(t){this.xt=void 0,this.Et=void 0,this.rt=()=>{var t,i;M(this.xt)&&(null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager));M(this.Et)&&(null==(i=v.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return sr.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.it(this.rt):(null==(t=this.xt)||t.call(this),null==(i=this.Et)||i.call(this),this.xt=void 0,this.Et=void 0)}}var or="Mobile",ar="iOS",lr="Android",ur="Tablet",hr=lr+" "+ur,dr="iPad",vr="Apple",cr=vr+" Watch",fr="Safari",pr="BlackBerry",gr="Samsung",_r=gr+"Browser",mr=gr+" Internet",yr="Chrome",br=yr+" OS",wr=yr+" "+ar,xr="Internet Explorer",Er=xr+" "+or,Sr="Opera",$r=Sr+" Mini",kr="Edge",Pr="Microsoft "+kr,Tr="Firefox",Cr=Tr+" "+ar,Ir="Nintendo",Rr="PlayStation",Fr="Xbox",Mr=lr+" "+or,Or=or+" "+fr,Ar="Windows",Dr=Ar+" Phone",jr="Nokia",Lr="Ouya",Nr="Generic",Ur=Nr+" "+or.toLowerCase(),zr=Nr+" "+ur.toLowerCase(),Hr="Konqueror",Br="(\\d+(\\.\\d+)?)",qr=new RegExp("Version/"+Br),Wr=new RegExp(Fr,"i"),Gr=new RegExp(Rr+" \\w+","i"),Vr=new RegExp(Ir+" \\w+","i"),Jr=new RegExp(pr+"|PlayBook|BB10","i"),Kr={"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=(t,i)=>i&&w(i,vr)||function(t){return w(t,fr)&&!w(t,yr)&&!w(t,lr)}(t),Xr=function(t,i){return i=i||"",w(t," OPR/")&&w(t,"Mini")?$r:w(t," OPR/")?Sr:Jr.test(t)?pr:w(t,"IE"+or)||w(t,"WPDesktop")?Er:w(t,_r)?mr:w(t,kr)||w(t,"Edg/")?Pr:w(t,"FBIOS")?"Facebook "+or:w(t,"UCWEB")||w(t,"UCBrowser")?"UC Browser":w(t,"CriOS")?wr:w(t,"CrMo")||w(t,yr)?yr:w(t,lr)&&w(t,fr)?Mr:w(t,"FxiOS")?Cr:w(t.toLowerCase(),Hr.toLowerCase())?Hr:Yr(t,i)?w(t,or)?Or:fr:w(t,Tr)?Tr:w(t,"MSIE")||w(t,"Trident/")?xr:w(t,"Gecko")?Tr:""},Qr={[Er]:[new RegExp("rv:"+Br)],[Pr]:[new RegExp(kr+"?\\/"+Br)],[yr]:[new RegExp("("+yr+"|CrMo)\\/"+Br)],[wr]:[new RegExp("CriOS\\/"+Br)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Br)],[fr]:[qr],[Or]:[qr],[Sr]:[new RegExp("(Opera|OPR)\\/"+Br)],[Tr]:[new RegExp(Tr+"\\/"+Br)],[Cr]:[new RegExp("FxiOS\\/"+Br)],[Hr]:[new RegExp("Konqueror[:/]?"+Br,"i")],[pr]:[new RegExp(pr+" "+Br),qr],[Mr]:[new RegExp("android\\s"+Br,"i")],[mr]:[new RegExp(_r+"\\/"+Br)],[xr]:[new RegExp("(rv:|MSIE )"+Br)],Mozilla:[new RegExp("rv:"+Br)]},Zr=function(t,i){var e=Xr(t,i),r=Qr[e];if(M(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=t.match(n);if(o)return parseFloat(o[o.length-2])}return null},ts=[[new RegExp(Fr+"; "+Fr+" (.*?)[);]","i"),t=>[Fr,t&&t[1]||""]],[new RegExp(Ir,"i"),[Ir,""]],[new RegExp(Rr,"i"),[Rr,""]],[Jr,[pr,""]],[new RegExp(Ar,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Dr,""];if(new RegExp(or).test(i)&&!/IEMobile\b/.test(i))return[Ar+" "+or,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],s=Kr[r]||"";return/arm/i.test(i)&&(s="RT"),[Ar,s]}return[Ar,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[ar,i.join(".")]}return[ar,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=M(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+lr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+lr+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[lr,i.join(".")]}return[lr,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];if(t&&t[1]){var e=[t[1],t[2],t[3]||"0"];i[1]=e.join(".")}return i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[br,""]],[/Linux|debian/i,["Linux",""]]],is=function(t){return Vr.test(t)?Ir:Gr.test(t)?Rr:Wr.test(t)?Fr:new RegExp(Lr,"i").test(t)?Lr:new RegExp("("+Dr+"|WPDesktop)","i").test(t)?Dr:/iPad/.test(t)?dr:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?cr:Jr.test(t)?pr:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(jr,"i").test(t)?jr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(or).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?lr:hr:lr:new RegExp("(pda|"+or+")","i").test(t)?Ur:new RegExp(ur,"i").test(t)&&!new RegExp(ur+" pc","i").test(t)?zr:""},es="https?://(.*)",rs=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ss=At(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],rs),ns="<masked>",os=["li_fat_id"];function as(t,i,e){if(!o)return{};var r,s=i?At([],rs,e||[]):[],n=ls(he(o.URL,s,ns),t),a=(r={},Mt(os,(function(t){var i=Ce.q(t);r[t]=i||null})),r);return Ot(a,n)}function ls(t,i){var e=ss.concat(i||[]),r={};return Mt(e,(function(i){var e=ue(t,i);r[i]=e||null})),r}function us(t){var i=function(t){return t?0===t.search(es+"google.([^/?]*)")?"google":0===t.search(es+"bing.com")?"bing":0===t.search(es+"yahoo.com")?"yahoo":0===t.search(es+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!D(i)){r.$search_engine=i;var s=o?ue(o.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function hs(){return navigator.language||navigator.userLanguage}function ds(){return(null==o?void 0:o.referrer)||"$direct"}function vs(t,i){var e=t?At([],rs,i||[]):[],r=null==a?void 0:a.href.substring(0,1e3);return{r:ds().substring(0,1e3),u:r?he(r,e,ns):void 0}}function cs(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:"$direct"==e?"$direct":null==(i=ae(e))?void 0:i.host};if(r){s.$current_url=r;var n=ae(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=ls(r);Ot(s,o)}if(e){var a=us(e);Ot(s,a)}return s}function fs(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function ps(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function gs(i,e){if(!d)return{};var r,s,n,o=i?At([],rs,e||[]):[],[l,u]=function(t){for(var i=0;i<ts.length;i++){var[e,r]=ts[i],s=e.exec(t),n=s&&(I(r)?r(s,t):r);if(n)return n}return["",""]}(d);return Ot(Nt({$os:l,$os_version:u,$browser:Xr(d,navigator.vendor),$device:is(d),$device_type:(s=d,n=is(s),n===dr||n===hr||"Kobo"===n||"Kindle Fire"===n||n===zr?ur:n===Ir||n===Fr||n===Rr||n===Lr?"Console":n===cr?"Wearable":n?or:"Desktop"),$timezone:fs(),$timezone_offset:ps()}),{$current_url:he(null==a?void 0:a.href,o,ns),$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:Zr(d,navigator.vendor),$browser_language:hs(),$browser_language_prefix:(r=hs(),"string"==typeof r?r.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:"web",$lib_version:c.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var _s=Tt("[Web Vitals]"),ms=9e5;class ys{constructor(t){var i;this.St=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.$t=()=>{clearTimeout(this.kt),0!==this.N.metrics.length&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((t,i)=>g({},t,{["$web_vitals_"+i.name+"_event"]:g({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Pt=t=>{var i,e=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(M(e))_s.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Tt();if(!M(r))if(j(null==t?void 0:t.name)||j(null==t?void 0:t.value))_s.error("Invalid metric received",t);else if(this.Ct&&t.value>=this.Ct)_s.error("Ignoring metric with value >= "+this.Ct,t);else this.N.url!==r&&(this.$t(),this.kt=setTimeout(this.$t,this.flushToCaptureTimeoutMs)),M(this.N.url)&&(this.N.url=r),this.N.firstMetricTimestamp=M(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.N.metrics.push(g({},t,{$current_url:r,$session_id:e.sessionId,$window_id:e.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.$t()}},this.rt=()=>{var t,i,e,r,s=v.__PosthogExtensions__;M(s)||M(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.Pt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Pt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.Pt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.Pt.bind(this)),this.P=!0):_s.error("web vitals callbacks not loaded - not starting")},this._instance=t,this.St=!(null==(i=this._instance.persistence)||!i.props[Zt]),this.startIfEnabled()}get allowedMetrics(){var t,i,e=R(this._instance.config.capture_performance)?null==(t=this._instance.config.capture_performance)?void 0:t.web_vitals_allowed_metrics:void 0;return M(e)?(null==(i=this._instance.persistence)?void 0:i.props[ii])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Ct(){var t=R(this._instance.config.capture_performance)&&L(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:ms;return 0<t&&t<=6e4?ms:t}get isEnabled(){var t=null==a?void 0:a.protocol;if("http:"!==t&&"https:"!==t)return _s.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:N(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return N(i)?i:this.St}startIfEnabled(){this.isEnabled&&!this.P&&(_s.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(t){var i=R(t.capturePerformance)&&!!t.capturePerformance.web_vitals,e=R(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Zt]:i}),this._instance.persistence.register({[ii]:e})),this.St=i,this.startIfEnabled()}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.postHogWebVitalsCallbacks&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"web-vitals",(i=>{i?_s.error("failed to load script",i):t()}))}Tt(){var i=t?t.location.href:void 0;if(i){var e=this._instance.config.mask_personal_data_properties,r=this._instance.config.custom_personal_data_properties,s=e?At([],rs,r||[]):[];return he(i,s,ns)}_s.error("Could not determine current URL")}}var bs=Tt("[Heatmaps]");function ws(t){return R(t)&&"clientX"in t&&"clientY"in t&&L(t.clientX)&&L(t.clientY)}class xs{constructor(t){var i;this.St=!1,this.P=!1,this.It=null,this.instance=t,this.St=!(null==(i=this.instance.persistence)||!i.props[Kt]),this.rageclicks=new se(t.config.rageclick)}get flushIntervalMilliseconds(){var t=5e3;return R(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return M(this.instance.config.capture_heatmaps)?M(this.instance.config.enable_heatmaps)?this.St:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;bs.info("starting..."),this.Rt(),this.Ft()}else{var t;clearInterval(null!==(t=this.It)&&void 0!==t?t:void 0),this.Mt(),this.getAndClearBuffer()}}onRemoteConfig(t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Kt]:i}),this.St=i,this.startIfEnabled()}getAndClearBuffer(){var t=this.N;return this.N=void 0,t}Ot(t){this.At(t.originalEvent,"deadclick")}Ft(){this.It&&clearInterval(this.It),this.It=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(o)?setInterval(this.Dt.bind(this),this.flushIntervalMilliseconds):null}Rt(){t&&o&&(this.jt=this.Dt.bind(this),qt(t,"beforeunload",this.jt),this.Lt=i=>this.At(i||(null==t?void 0:t.event)),qt(o,"click",this.Lt,{capture:!0}),this.Nt=i=>this.Ut(i||(null==t?void 0:t.event)),qt(o,"mousemove",this.Nt,{capture:!0}),this.zt=new Be(this.instance,ze,this.Ot.bind(this)),this.zt.startIfEnabled(),this.Ht=this.Ft.bind(this),qt(o,"visibilitychange",this.Ht),this.P=!0)}Mt(){var i;t&&o&&(this.jt&&t.removeEventListener("beforeunload",this.jt),this.Lt&&o.removeEventListener("click",this.Lt,{capture:!0}),this.Nt&&o.removeEventListener("mousemove",this.Nt,{capture:!0}),this.Ht&&o.removeEventListener("visibilitychange",this.Ht),clearTimeout(this.Bt),null==(i=this.zt)||i.stop(),this.P=!1)}qt(i,e){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(i,e,r){for(var s=i;s&&Si(s)&&!$i(s,"body");){if(s===r)return!1;if(w(e,null==t?void 0:t.getComputedStyle(s).position))return!0;s=Di(s)}return!1}(Mi(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}At(t,i){var e;if(void 0===i&&(i="click"),!Ei(t.target)&&ws(t)){var r=this.qt(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Wt(g({},r,{type:"rageclick"})),this.Wt(r)}}Ut(t){!Ei(t.target)&&ws(t)&&(clearTimeout(this.Bt),this.Bt=setTimeout((()=>{this.Wt(this.qt(t,"mousemove"))}),500))}Wt(i){if(t){var e=t.location.href,r=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=r?At([],rs,s||[]):[],o=he(e,n,ns);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(i)}}Dt(){this.N&&!F(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Es{constructor(t){this._instance=t}doPageView(i,e){var r,s=this.Gt(i,e);return this.Vt={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.Gt(t,null==(i=this.Vt)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Vt)?void 0:t.pageViewId}}Gt(t,i){var e=this.Vt;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:h}=s;if(!(M(n)||M(o)||M(a)||M(l)||M(u)||M(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n<=1?1:J(o/n,0,1,Pt),v=n<=1?1:J(a/n,0,1,Pt),c=l<=1?1:J(u/l,0,1,Pt),f=l<=1?1:J(h/l,0,1,Pt);r=Ot(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var Ss=Uint8Array,$s=Uint16Array,ks=Uint32Array,Ps=new Ss([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]),Ts=new Ss([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]),Cs=new Ss([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Is=function(t,i){for(var e=new $s(31),r=0;r<31;++r)e[r]=i+=1<<t[r-1];var s=new ks(e[30]);for(r=1;r<30;++r)for(var n=e[r];n<e[r+1];++n)s[n]=n-e[r]<<5|r;return[e,s]},Rs=Is(Ps,2),Fs=Rs[0],Ms=Rs[1];Fs[28]=258,Ms[258]=28;for(var Os=Is(Ts,0)[1],As=new $s(32768),Ds=0;Ds<32768;++Ds){var js=(43690&Ds)>>>1|(21845&Ds)<<1;js=(61680&(js=(52428&js)>>>2|(13107&js)<<2))>>>4|(3855&js)<<4,As[Ds]=((65280&js)>>>8|(255&js)<<8)>>>1}var Ls=function(t,i,e){for(var r=t.length,s=0,n=new $s(i);s<r;++s)++n[t[s]-1];var o,a=new $s(i);for(s=0;s<i;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new $s(1<<i);var l=15-i;for(s=0;s<r;++s)if(t[s])for(var u=s<<4|t[s],h=i-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;d<=v;++d)o[As[d]>>>l]=u}else for(o=new $s(r),s=0;s<r;++s)o[s]=As[a[t[s]-1]++]>>>15-t[s];return o},Ns=new Ss(288);for(Ds=0;Ds<144;++Ds)Ns[Ds]=8;for(Ds=144;Ds<256;++Ds)Ns[Ds]=9;for(Ds=256;Ds<280;++Ds)Ns[Ds]=7;for(Ds=280;Ds<288;++Ds)Ns[Ds]=8;var Us=new Ss(32);for(Ds=0;Ds<32;++Ds)Us[Ds]=5;var zs=Ls(Ns,9,0),Hs=Ls(Us,5,0),Bs=function(t){return(t/8>>0)+(7&t&&1)},qs=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof $s?$s:t instanceof ks?ks:Ss)(e-i);return r.set(t.subarray(i,e)),r},Ws=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8},Gs=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8,t[r+2]|=e>>>16},Vs=function(t,i){for(var e=[],r=0;r<t.length;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Ss(0),0];if(1==s){var o=new Ss(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],u=0,h=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=e[e[u].f<e[d].f?u++:d++],l=e[u!=h&&e[u].f<e[d].f?u++:d++],e[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;r<s;++r)n[r].s>v&&(v=n[r].s);var c=new $s(v+1),f=Js(e[h-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));r<s;++r){var m=n[r].s;if(!(c[m]>i))break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var y=n[r].s;c[y]<i?p-=1<<i-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==i&&(--c[b],++p)}f=i}return[new Ss(c),f]},Js=function(t,i,e){return-1==t.s?Math.max(Js(t.l,i,e+1),Js(t.r,i,e+1)):i[t.s]=e},Ks=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new $s(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;a<=i;++a)if(t[a]==s&&a!=i)++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=t[a]}return[e.subarray(0,r),i]},Ys=function(t,i){for(var e=0,r=0;r<i.length;++r)e+=t[r]*i[r];return e},Xs=function(t,i,e){var r=e.length,s=Bs(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;n<r;++n)t[s+n+4]=e[n];return 8*(s+4+r)},Qs=function(t,i,e,r,s,n,o,a,l,u,h){Ws(i,h++,e),++s[256];for(var d=Vs(s,15),v=d[0],c=d[1],f=Vs(n,15),p=f[0],g=f[1],_=Ks(v),m=_[0],y=_[1],b=Ks(p),w=b[0],x=b[1],E=new $s(19),S=0;S<m.length;++S)E[31&m[S]]++;for(S=0;S<w.length;++S)E[31&w[S]]++;for(var k=Vs(E,7),P=k[0],T=k[1],C=19;C>4&&!P[Cs[C-1]];--C);var I,R,F,M,O=u+5<<3,A=Ys(s,Ns)+Ys(n,Us)+o,D=Ys(s,v)+Ys(n,p)+o+14+3*C+Ys(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(O<=A&&O<=D)return Xs(i,h,t.subarray(l,l+u));if(Ws(i,h,1+(D<A)),h+=2,D<A){I=Ls(v,c,0),R=v,F=Ls(p,g,0),M=p;var j=Ls(P,T,0);Ws(i,h,y-257),Ws(i,h+5,x-1),Ws(i,h+10,C-4),h+=14;for(S=0;S<C;++S)Ws(i,h+3*S,P[Cs[S]]);h+=3*C;for(var L=[m,w],N=0;N<2;++N){var U=L[N];for(S=0;S<U.length;++S){var z=31&U[S];Ws(i,h,j[z]),h+=P[z],z>15&&(Ws(i,h,U[S]>>>5&127),h+=U[S]>>>12)}}}else I=zs,R=Ns,F=Hs,M=Us;for(S=0;S<a;++S)if(r[S]>255){z=r[S]>>>18&31;Gs(i,h,I[z+257]),h+=R[z+257],z>7&&(Ws(i,h,r[S]>>>23&31),h+=Ps[z]);var H=31&r[S];Gs(i,h,F[H]),h+=M[H],H>3&&(Gs(i,h,r[S]>>>5&8191),h+=Ts[H])}else Gs(i,h,I[r[S]]),h+=R[r[S]];return Gs(i,h,I[256]),h+R[256]},Zs=new ks([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tn=function(){for(var t=new ks(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),en=function(t,i,e,r,s){return function(t,i,e,r,s,n){var o=t.length,a=new Ss(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!i||o<8)for(var h=0;h<=o;h+=65535){var d=h+65535;d<o?u=Xs(l,u,t.subarray(h,d)):(l[h]=n,u=Xs(l,u,t.subarray(h,o)))}else{for(var v=Zs[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new $s(32768),_=new $s(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new ks(25e3),x=new $s(288),E=new $s(32),S=0,k=0,P=(h=0,0),T=0,C=0;h<o;++h){var I=b(h),R=32767&h,F=_[I];if(g[R]=F,_[I]=R,T<=h){var M=o-h;if((S>7e3||P>24576)&&M>423){u=Qs(t,l,0,w,x,E,k,P,C,h-C,u),P=S=k=0,C=h;for(var O=0;O<286;++O)x[O]=0;for(O=0;O<30;++O)E[O]=0}var A=2,D=0,j=f,L=R-F&32767;if(M>2&&I==b(h-L))for(var N=Math.min(c,M)-1,U=Math.min(32767,h),z=Math.min(258,M);L<=U&&--j&&R!=F;){if(t[h+A]==t[h+A-L]){for(var H=0;H<z&&t[h+H]==t[h+H-L];++H);if(H>A){if(A=H,D=L,H>N)break;var B=Math.min(L,H-2),q=0;for(O=0;O<B;++O){var W=h-L+O+32768&32767,G=W-g[W]+32768&32767;G>q&&(q=G,F=W)}}}L+=(R=F)-(F=g[R])+32768&32767}if(D){w[P++]=268435456|Ms[A]<<18|Os[D];var V=31&Ms[A],J=31&Os[D];k+=Ps[V]+Ts[J],++x[257+V],++E[J],T=h+A,++S}else w[P++]=t[h],++x[t[h]]}}u=Qs(t,l,n,w,x,E,k,P,C,h-C,u)}return qs(a,0,r+Bs(u)+s)}(t,null==i.level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,e,r,!0)},rn=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function sn(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p:function(i){for(var e=t,r=0;r<i.length;++r)e=tn[255&e^i[r]]^e>>>8;t=e},d:function(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n=en(t,i,10+((s=i).filename&&s.filename.length+1||0),8),o=n.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=i.level<2?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&rn(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;r<=e.length;++r)t[r+10]=e.charCodeAt(r)}}(n,i),rn(n,o-8,e.d()),rn(n,o-4,r),n}var nn=function(t){var i,e,r,s,n="";for(i=e=0,r=(t=(t+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var o=t.charCodeAt(s),a=null;o<128?e++: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),D(a)||(e>i&&(n+=t.substring(i,e)),n+=a,i=e=s+1)}return e>i&&(n+=t.substring(i,t.length)),n},on=!!u||!!l,an="text/plain",ln=function(t,i,e){var r;void 0===e&&(e=!0);var[s,n]=t.split("?"),o=g({},i),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var i,[r,s]=t.split("="),n=e&&null!==(i=o[r])&&void 0!==i?i:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],l=le(o);return l&&a.push(l),s+"?"+a.join("&")},un=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),hn=t=>{var{data:i,compression:e}=t;if(i){if(e===oe.GZipJS){var r=sn(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Ss(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;o<e;++o){if(s+5>r.length){var a=new Ss(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||i?n(l):l<2048?(n(192|l>>>6),n(128|63&l)):l>55295&&l<57344?(n(240|(l=65536+(1047552&l)|1023&t.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 qs(r,0,s)}(un(i)),{mtime:0}),s=new Blob([r],{type:an});return{contentType:an,body:s,estimatedSize:s.size}}if(e===oe.Base64){var n=function(t){var i,e,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,u="",h=[];if(!t)return t;t=nn(t);do{i=(n=t.charCodeAt(a++)<<16|t.charCodeAt(a++)<<8|t.charCodeAt(a++))>>18&63,e=n>>12&63,r=n>>6&63,s=63&n,h[l++]=o.charAt(i)+o.charAt(e)+o.charAt(r)+o.charAt(s)}while(a<t.length);switch(u=h.join(""),t.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u}(un(i)),o=(t=>"data="+encodeURIComponent("string"==typeof t?t:un(t)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=un(i);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},dn=[];l&&dn.push({transport:"fetch",method:t=>{var i,e,{contentType:r,body:s,estimatedSize:n}=null!==(i=hn(t))&&void 0!==i?i:{},o=new Headers;Mt(t.headers,(function(t,i){o.append(i,t)})),r&&o.append("Content-Type",r);var a=t.url,u=null;if(h){var d=new h;u={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}l(a,g({method:(null==t?void 0:t.method)||"GET",headers:o,keepalive:"POST"===t.method&&(n||0)<52428.8,body:s,signal:null==(e=u)?void 0:e.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){Pt.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{Pt.error(i),null==t.callback||t.callback({statusCode:0,text:i})})).finally((()=>u?clearTimeout(u.timeout):null))}}),u&&dn.push({transport:"XHR",method:t=>{var i,e=new u;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=hn(t))&&void 0!==i?i:{};Mt(t.headers,(function(t,i){e.setRequestHeader(i,t)})),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),t.disableXHRCredentials||(e.withCredentials=!0),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(s)}}),null!=n&&n.sendBeacon&&dn.push({transport:"sendBeacon",method:t=>{var i=ln(t.url,{beacon:"1"});try{var e,{contentType:r,body:s}=null!==(e=hn(t))&&void 0!==e?e:{},o="string"==typeof s?new Blob([s],{type:r}):s;n.sendBeacon(i,o)}catch(t){}}});var vn=function(t,i){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}};function cn(t,i,e){return un({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var fn={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>vn(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!vn(i,t))))),icontains:(t,i)=>i.map(pn).some((i=>t.map(pn).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(pn).every((i=>t.map(pn).every((t=>!i.includes(t)))))},pn=t=>t.toLowerCase();function gn(t,i){return!t||Object.entries(t).every((t=>{var[e,r]=t,s=null==i?void 0:i[e];if(M(s)||D(s))return!1;var n=[String(s)],o=fn[r.operator];return!!o&&o(r.values,n)}))}var _n=Tt("[Error tracking]");class mn{constructor(t){var i,e;this.Jt=[],this.Kt=new it([new pt,new $t,new _t,new gt,new Et,new xt,new yt,new St],ft("web:javascript",lt,dt)),this._instance=t,this.Jt=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Xt))&&void 0!==i?i:[]}onRemoteConfig(t){var i,e,r,s=null!==(i=null==(e=t.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.Jt=s,this._instance.persistence&&this._instance.persistence.register({[Xt]:this.Jt,[Qt]:n})}get Yt(){var t,i=!!this._instance.get_property(Qt),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Kt.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}sendExceptionEvent(t){var i=t.$exception_list;if(this.Xt(i)){if(this.Qt(i))return void _n.info("Skipping exception capture because a suppression rule matched");if(!this.Yt&&this.Zt(i))return void _n.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ti(i))return void _n.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}Qt(t){if(0===t.length)return!1;var i=t.reduce(((t,i)=>{var{type:e,value:r}=i;return O(e)&&e.length>0&&t.$exception_types.push(e),O(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Jt.some((t=>{var e=t.values.map((t=>{var e,r=fn[t.operator],s=C(t.value)?t.value:[t.value],n=null!==(e=i[t.key])&&void 0!==e?e:[];return s.length>0&&r(s,n)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}Zt(t){return t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ti(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],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}Xt(t){return!j(t)&&C(t)}}var yn=Tt("[FeatureFlags]"),bn=Tt("[FeatureFlags]",{debugEnabled:!0}),wn="$active_feature_flags",xn="$override_feature_flags",En="$feature_flag_payloads",Sn="$override_feature_flag_payloads",$n="$feature_flag_request_id",kn="$feature_flag_evaluated_at",Pn=t=>{var i={};for(var[e,r]of Dt(t||{}))r&&(i[e]=r);return i},Tn=t=>{var i=t.flags;return i?(t.featureFlags=Object.fromEntries(Object.keys(i).map((t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(i).filter((t=>i[t].enabled)).filter((t=>{var e;return null==(e=i[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=i[t].metadata)?void 0:e.payload]})))):yn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},Cn=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class In{constructor(t){this.ii=!1,this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this._instance=t,this.featureFlagEventHandlers=[]}li(){var t=this._instance.config.evaluation_environments;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||yn.error("Invalid evaluation environment found:",t,"Expected non-empty string"),i})):[]}ui(){return this.li().length>0}flags(){if(this._instance.config.__preview_remote_config)this.oi=!0;else{var t=!this.hi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.di({disableFlags:t})}}get hasLoadedFlags(){return this.ei}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(ai),i=this._instance.get_property(xn),e=this._instance.get_property(Sn);if(!e&&!i)return t||{};var r=Ot({},t||{}),s=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(var n of s){var o,a,l=r[n],u=null==i?void 0:i[n],h=M(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=M(u)?l.variant:"string"==typeof u?u:void 0,v=null==e?void 0:e[n],c=g({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});if(h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v)c.metadata=g({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload});r[n]=c}return this.ii||(yn.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.ii=!0),r}getFlagVariants(){var t=this._instance.get_property(ni),i=this._instance.get_property(xn);if(!i)return t||{};for(var e=Ot({},t),r=Object.keys(i),s=0;s<r.length;s++)e[r[s]]=i[r[s]];return this.ii||(yn.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.ii=!0),e}getFlagPayloads(){var t=this._instance.get_property(En),i=this._instance.get_property(Sn);if(!i)return t||{};for(var e=Ot({},t||{}),r=Object.keys(i),s=0;s<r.length;s++)e[r[s]]=i[r[s]];return this.ii||(yn.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.ii=!0),e}reloadFeatureFlags(){this.si||this._instance.config.advanced_disable_feature_flags||this.hi||(this.hi=setTimeout((()=>{this.di()}),5))}vi(){clearTimeout(this.hi),this.hi=void 0}ensureFlagsLoaded(){this.ei||this.ri||this.hi||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.si=t}di(t){var i;if(this.vi(),!this._instance.O())if(this.ri)this.ni=!0;else{var e={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:g({},(null==(i=this._instance.persistence)?void 0:i.get_initial_props())||{},this._instance.get_property(li)||{}),group_properties:this._instance.get_property(ui)};(null!=t&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(e.disable_flags=!0),this.ui()&&(e.evaluation_environments=this.li());var r=this._instance.config.__preview_remote_config,s=r?"/flags/?v=2":"/flags/?v=2&config=true",n=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",o=this._instance.requestRouter.endpointFor("flags",s+n);r&&(e.timezone=fs()),this.ri=!0,this._instance._send_request({method:"POST",url:o,data:e,compression:this._instance.config.disable_compression?void 0:oe.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:t=>{var i,r,s=!0;(200===t.statusCode&&(this.ni||(this.$anon_distinct_id=void 0),s=!1),this.ri=!1,this.oi)||(this.oi=!0,this._instance.ci(null!==(r=t.json)&&void 0!==r?r:{}));if(!e.disable_flags||this.ni)if(this.ai=!s,t.json&&null!=(i=t.json.quotaLimited)&&i.includes(Cn.FeatureFlags))yn.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(!e.disable_flags)this.receivedFeatureFlags(null!==(n=t.json)&&void 0!==n?n:{},s);this.ni&&(this.ni=!1,this.di())}}})}}getFeatureFlag(t,i){if(void 0===i&&(i={}),this.ei||this.getFlags()&&this.getFlags().length>0){var e=this.getFlagVariants()[t],r=""+e,s=this._instance.get_property($n)||void 0,n=this._instance.get_property(kn)||void 0,o=this._instance.get_property(vi)||{};if((i.send_event||!("send_event"in i))&&(!(t in o)||!o[t].includes(r))){var a,l,u,h,d,v,c,f,p;C(o[t])?o[t].push(r):o[t]=[r],null==(a=this._instance.persistence)||a.register({[vi]:o});var g=this.getFeatureFlagDetails(t),_={$feature_flag:t,$feature_flag_response:e,$feature_flag_payload:this.getFeatureFlagPayload(t)||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[t])||null,$feature_flag_bootstrapped_payload:(null==(u=this._instance.config.bootstrap)||null==(u=u.featureFlagPayloads)?void 0:u[t])||null,$used_bootstrap_value:!this.ai};M(null==g||null==(h=g.metadata)?void 0:h.version)||(_.$feature_flag_version=g.metadata.version);var m,y=null!==(d=null==g||null==(v=g.reason)?void 0:v.description)&&void 0!==d?d:null==g||null==(c=g.reason)?void 0:c.code;if(y&&(_.$feature_flag_reason=y),null!=g&&null!=(f=g.metadata)&&f.id&&(_.$feature_flag_id=g.metadata.id),M(null==g?void 0:g.original_variant)&&M(null==g?void 0:g.original_enabled)||(_.$feature_flag_original_response=M(g.original_variant)?g.original_enabled:g.original_variant),null!=g&&null!=(p=g.metadata)&&p.original_payload)_.$feature_flag_original_payload=null==g||null==(m=g.metadata)?void 0:m.original_payload;this._instance.capture("$feature_flag_called",_)}return e}yn.warn('getFeatureFlag for key "'+t+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,i){var e=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:e};this.ui()&&(r.evaluation_environments=this.li()),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:oe.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var r,s=null==(r=e.json)?void 0:r.featureFlagPayloads;i((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,i){if(void 0===i&&(i={}),this.ei||this.getFlags()&&this.getFlags().length>0){var e=this.getFeatureFlag(t,i);return M(e)?void 0:!!e}yn.warn('isFeatureEnabled for key "'+t+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i){if(this._instance.persistence){this.ei=!0;var e=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(t,i,e,r,s){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={});var n=Tn(t),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var u=t.requestId,h=t.evaluatedAt;if(C(a)){yn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var d={};if(a)for(var v=0;v<a.length;v++)d[a[v]]=!0;i&&i.register({[wn]:a,[ni]:d})}else{var c=a,f=l,p=o;t.errorsWhileComputingFlags&&(c=g({},e,c),f=g({},r,f),p=g({},s,p)),i&&i.register(g({[wn]:Object.keys(Pn(c)),[ni]:c||{},[En]:f||{},[ai]:p||{}},u?{[$n]:u}:{},h?{[kn]:h}:{}))}}}(t,this._instance.persistence,e,r,s),this.fi(i)}}override(t,i){void 0===i&&(i=!1),yn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this._instance.persistence)return yn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this._instance.persistence.unregister(xn),this._instance.persistence.unregister(Sn),this.fi(),bn.info("All overrides cleared");if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;if(this.ii=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i),"flags"in e)if(!1===e.flags)this._instance.persistence.unregister(xn),bn.info("Flag overrides cleared");else if(e.flags){if(C(e.flags)){for(var r={},s=0;s<e.flags.length;s++)r[e.flags[s]]=!0;this._instance.persistence.register({[xn]:r})}else this._instance.persistence.register({[xn]:e.flags});bn.info("Flag overrides set",{flags:e.flags})}return"payloads"in e&&(!1===e.payloads?(this._instance.persistence.unregister(Sn),bn.info("Payload overrides cleared")):e.payloads&&(this._instance.persistence.register({[Sn]:e.payloads}),bn.info("Payload overrides set",{payloads:e.payloads}))),void this.fi()}this.fi()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ei){var{flags:i,flagVariants:e}=this.pi();t(i,e)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,s=(this._instance.get_property(oi)||[]).find((i=>i.flagKey===t)),n={["$feature_enrollment/"+t]:i},o={$feature_flag:t,$feature_enrollment:i,$set:n};s&&(o.$early_access_feature_name=s.name),e&&(o.$feature_enrollment_stage=e),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=g({},this.getFlagVariants(),{[t]:i});null==(r=this._instance.persistence)||r.register({[wn]:Object.keys(Pn(a)),[ni]:a}),this.fi()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this._instance.get_property(oi),s=e?"&"+e.map((t=>"stage="+t)).join("&"):"";if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:i=>{var e,r;if(i.json){var s=i.json.earlyAccessFeatures;return null==(e=this._instance.persistence)||e.unregister(oi),null==(r=this._instance.persistence)||r.register({[oi]:s}),t(s)}}})}pi(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}fi(t){var{flags:i,flagVariants:e}=this.pi();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(li)||{};this._instance.register({[li]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(li)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(ui)||{};0!==Object.keys(e).length&&Object.keys(e).forEach((i=>{e[i]=g({},e[i],t[i]),delete t[i]})),this._instance.register({[ui]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this._instance.get_property(ui)||{};this._instance.register({[ui]:g({},i,{[t]:{}})})}else this._instance.unregister(ui)}reset(){this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.$anon_distinct_id=void 0,this.vi(),this.ii=!1}}var Rn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Fn{constructor(t,i){this.R=t,this.props={},this.gi=!1,this.mi=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.Y=this.yi(t),this.load(),t.debug&&Pt.info("Persistence loaded",t.persistence,g({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.bi}yi(t){-1===Rn.indexOf(t.persistence.toLowerCase())&&(Pt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i=t.persistence.toLowerCase();return"localstorage"===i&&Re.H()?Re:"localstorage+cookie"===i&&Me.H()?Me:"sessionstorage"===i&&je.H()?je:"memory"===i?Ae:"cookie"===i?Ce:Me.H()?Me:Ce}properties(){var t={};return Mt(this.props,(function(i,e){if(e===ni&&R(i))for(var r=Object.keys(i),n=0;n<r.length;n++)t["$feature/"+r[n]]=i[r[n]];else a=e,l=!1,(D(o=xi)?l:s&&o.indexOf===s?-1!=o.indexOf(a):(Mt(o,(function(t){if(l||(l=t===a))return Rt})),l))||(t[e]=i);var o,a,l})),t}load(){if(!this.bi){var t=this.Y.W(this.mi);t&&(this.props=Ot({},t))}}save(){this.bi||this.Y.G(this.mi,this.props,this.wi,this.xi,this.Ei,this.R.debug)}remove(){this.Y.V(this.mi,!1),this.Y.V(this.mi,!0)}clear(){this.remove(),this.props={}}register_once(t,i,e){if(R(t)){M(i)&&(i="None"),this.wi=M(e)?this.Si:e;var r=!1;if(Mt(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.props[e]=t,r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(R(t)){this.wi=M(i)?this.Si:i;var e=!1;if(Mt(t,((i,r)=>{t.hasOwnProperty(r)&&this.props[r]!==i&&(this.props[r]=i,e=!0)})),e)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.gi){var t=as(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);F(Nt(t))||this.register(t),this.gi=!0}}update_search_keyword(){var t;this.register((t=null==o?void 0:o.referrer)?us(t):{})}update_referrer_info(){var t;this.register_once({$referrer:ds(),$referring_domain:null!=o&&o.referrer&&(null==(t=ae(o.referrer))?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[gi]||this.props[_i]||this.register_once({[mi]:vs(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Mt([_i,gi],(i=>{var e=this.props[i];e&&Mt(e,(function(i,e){t["$initial_"+E(e)]=i}))}));var i,e,r=this.props[mi];if(r){var s=(i=cs(r),e={},Mt(i,(function(t,i){e["$initial_"+E(i)]=t})),e);Ot(t,s)}return t}safe_merge(t){return Mt(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this.Si=this.wi=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!e),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==i.persistence){var r=this.yi(t),s=this.props;this.clear(),this.Y=r,this.props=s,this.save()}}set_disabled(t){this.bi=t,this.bi?this.remove():this.save()}set_cross_subdomain(t){t!==this.xi&&(this.xi=t,this.remove(),this.save())}set_secure(t){t!==this.Ei&&(this.Ei=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[Vt]||{};e[t]=i,this.props[Vt]=e,this.save()}remove_event_timer(t){var i=(this.props[Vt]||{})[t];return M(i)||(delete this.props[Vt][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}var Mn=Tt("[Product Tours]"),On="ph_product_tours";class An{constructor(t){this.$i=null,this.ki=null,this.Pi=void 0,this.Ti=!1,this._instance=t}onRemoteConfig(t){if(this._instance.config.disable_product_tours)Mn.info("Product tours disabled via config");else{var i=t.productTours;j(i)?Mn.info("Product tours not enabled in remote config"):(this.Pi=i,Mn.info("Remote config received, isProductToursEnabled: "+this.Pi),this.loadIfEnabled())}}loadIfEnabled(){var t;if(!this.ki)if(this.Ti)Mn.info("Already initializing product tours, skipping...");else if(this._instance.config.disable_product_tours)Mn.info("Product tours disabled via config");else{var i=null==v?void 0:v.__PosthogExtensions__;if(i){var e=null==(t=this._instance.featureFlags)?void 0:t.isFeatureEnabled("product-tours-2025");if(!M(this.Pi)||e){var r=this.Pi||e;if(r){this.Ti=!0;try{var s=i.generateProductTours;if(s)return void this.Ci(s,r);var n=i.loadExternalDependency;if(!n)return Mn.error("PostHog loadExternalDependency extension not found."),void(this.Ti=!1);n(this._instance,"product-tours",(t=>{t||!i.generateProductTours?Mn.error("Could not load product tours script",t):this.Ci(i.generateProductTours,r),this.Ti=!1}))}catch(t){Mn.error("Error initializing product tours",t),this.Ti=!1}}else Mn.info("Product tours not enabled")}else Mn.info("Waiting for remote config or feature flag to enable product tours")}else Mn.error("PostHog Extensions not found.")}}Ci(t,i){this.ki=t(this._instance,i)||null,Mn.info("Product tours loaded successfully")}getProductTours(t,i){if(void 0===i&&(i=!1),!C(this.$i)||i){var e=this._instance.persistence;if(e){var r=e.props[On];if(C(r)&&!i)return this.$i=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:i=>{var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return Mn.error(s),void t([],{isLoaded:!1,error:s})}var n=C(i.json.product_tours)?i.json.product_tours:[];this.$i=n,e&&e.register({[On]:n}),t(n,{isLoaded:!0})}})}else t(this.$i,{isLoaded:!0})}getActiveProductTours(t){if(j(this.ki))return Mn.warn("Product tours not loaded yet"),void t([],{isLoaded:!1,error:"Product tours not loaded"});this.ki.getActiveProductTours(t)}showProductTour(t){var i;Mn.info("showProductTour("+t+")"),null==(i=this.ki)||i.showTourById(t)}dismissProductTour(){var t;null==(t=this.ki)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.ki)||t.nextStep()}previousStep(){var t;null==(t=this.ki)||t.previousStep()}clearCache(){this.$i=null;var t=this._instance.persistence;t&&t.unregister(On)}resetTour(t){var i;null==(i=this.ki)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.ki)||t.resetAllTours()}}var Dn=function(t){return t.Activation="events",t.Cancellation="cancelEvents",t}({}),jn=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({}),Ln=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t}({}),Nn=function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t}({}),Un=function(t){return t.Popover="popover",t.Inline="inline",t}({});class zn{constructor(){this.Ii={},this.Ii={}}on(t,i){return this.Ii[t]||(this.Ii[t]=[]),this.Ii[t].push(i),()=>{this.Ii[t]=this.Ii[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Ii[t]||[])e(i);for(var r of this.Ii["*"]||[])r(t,i)}}function Hn(t,i,e){if(j(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class Bn{constructor(t){this.Ri=new zn,this.Fi=(t,i)=>this.Mi(t,i)&&this.Oi(t,i)&&this.Ai(t,i)&&this.Di(t,i),this.Mi=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.ji=new Set,this.Li=new Set}init(){var t;if(!M(null==(t=this._instance)?void 0:t.Ni)){var i;null==(i=this._instance)||i.Ni(((t,i)=>{this.on(t,i)}))}}register(t){var i,e;if(!M(null==(i=this._instance)?void 0:i.Ni)&&(t.forEach((t=>{var i,e;null==(i=this.Li)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.ji)||i.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r,s=new Set;t.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,i){var e;null!=i&&0!=t.length&&(this.ji.has(t)||this.ji.has(null==i?void 0:i.event))&&this.Li&&(null==(e=this.Li)?void 0:e.size)>0&&this.Li.forEach((t=>{this.Ui(i,t)&&this.Ri.emit("actionCaptured",t.name)}))}zi(t){this.onAction("actionCaptured",(i=>t(i)))}Ui(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Fi(t,e))return!0;return!1}onAction(t,i){return this.Ri.on(t,i)}Oi(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!Hn(r,i.url,i.url_matching||"contains"))return!1}return!0}Ai(t,i){return!!this.Hi(t,i)&&(!!this.Bi(t,i)&&!!this.qi(t,i))}Hi(t,i){var e;if(null==i||!i.href)return!0;var r=this.Wi(t);if(r.length>0)return r.some((t=>Hn(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&Hn((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}Bi(t,i){var e;if(null==i||!i.text)return!0;var r=this.Wi(t);if(r.length>0)return r.some((t=>Hn(t.text,i.text,i.text_matching||"exact")||Hn(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!j(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>Hn(t,n,o))))}qi(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}Wi(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Di(t,i){return null==i||!i.properties||0===i.properties.length||gn(i.properties.reduce(((t,i)=>{var e=C(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}var qn=Tt("[Surveys]");var Wn="seenSurvey_",Gn=(t,i)=>{var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e},Vn=t=>{var i=""+Wn+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+Wn+t.id+"_"+t.current_iteration),i},Jn=[jn.Popover,jn.Widget,jn.API],Kn={ignoreConditions:!1,ignoreDelay:!1,displayType:Un.Popover};class Yn{constructor(t){this._instance=t,this.Gi=new Map,this.Vi=new Map,this.Ji=new Map}Ki(t,i){return!!t&&gn(t.propertyFilters,null==i?void 0:i.properties)}Yi(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}Xi(t,i,e){var r,s=(e===Dn.Activation?this.Gi:this.Vi).get(t),n=[];return null==(r=this._instance)||r.getSurveys((t=>{n=t.filter((t=>null==s?void 0:s.includes(t.id)))})),n.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.Ki(n,i)}))}register(t){var i;M(null==(i=this._instance)?void 0:i.Ni)||(this.Qi(t),this.Zi(t))}Zi(t){var i=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.actions)&&(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length)>0}));if(0!==i.length){if(null==this.te){this.te=new Bn(this._instance),this.te.init();this.te.zi((t=>{this.onAction(t)}))}i.forEach((t=>{var i,e,r,s,n;t.conditions&&null!=(i=t.conditions)&&i.actions&&null!=(e=t.conditions)&&null!=(e=e.actions)&&e.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.te)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((i=>{if(i&&i.name){var e=this.Ji.get(i.name);e&&e.push(t.id),this.Ji.set(i.name,e||[t.id])}})))}))}}Qi(t){var i,e=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),r=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}));if(0!==e.length||0!==r.length){null==(i=this._instance)||i.Ni(((t,i)=>{this.onEvent(t,i)})),this.Gi=this.Yi(t,Dn.Activation),this.Vi=this.Yi(t,Dn.Cancellation)}}onEvent(t,i){var e,r=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[di])||[];if(Ln.SHOWN===t&&i&&r.length>0){var s;qn.info("survey event matched, removing survey from activated surveys",{event:t,eventPayload:i,existingActivatedSurveys:r});var n=null==i||null==(s=i.properties)?void 0:s.$survey_id;if(n){var o=r.indexOf(n);o>=0&&(r.splice(o,1),this.ie(r))}}else{if(this.Vi.has(t)){var a=this.Xi(t,i,Dn.Cancellation);a.length>0&&(qn.info("cancel event matched, cancelling surveys",{event:t,surveysToCancel:a.map((t=>t.id))}),a.forEach((t=>{var i,e=r.indexOf(t.id);e>=0&&r.splice(e,1),null==(i=this._instance)||i.cancelPendingSurvey(t.id)})),this.ie(r))}if(this.Gi.has(t)){qn.info("survey event name matched",{event:t,eventPayload:i,surveys:this.Gi.get(t)});var l=this.Xi(t,i,Dn.Activation);this.ie(r.concat(l.map((t=>t.id))||[]))}}}onAction(t){var i,e=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[di])||[];this.Ji.has(t)&&this.ie(e.concat(this.Ji.get(t)||[]))}ie(t){var i;qn.info("updating activated surveys",{activatedSurveys:t}),null==(i=this._instance)||null==(i=i.persistence)||i.register({[di]:[...new Set(t)]})}getSurveys(){var t,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[di];return i||[]}getEventToSurveys(){return this.Gi}ee(){return this.te}}class Xn{constructor(t){this.re=void 0,this._surveyManager=null,this.se=!1,this.ne=!1,this.oe=[],this._instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){if(!this._instance.config.disable_surveys){var i=t.surveys;if(j(i))return qn.warn("Flags not loaded yet. Not loading surveys.");var e=C(i);this.re=e?i.length>0:i,qn.info("flags response received, isSurveysEnabled: "+this.re),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var e=localStorage.key(i);(null!=e&&e.startsWith(Wn)||null!=e&&e.startsWith("inProgressSurvey_"))&&t.push(e)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.ne)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 t=null==v?void 0:v.__PosthogExtensions__;if(t){if(!M(this.re)||this._instance.config.advanced_enable_surveys){var i=this.re||this._instance.config.advanced_enable_surveys;this.ne=!0;try{var e=t.generateSurveys;if(e)return void this.ae(e,i);var r=t.loadExternalDependency;if(!r)return void this.le("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this.le("Could not load surveys script",e):this.ae(t.generateSurveys,i)}))}catch(t){throw this.le("Error initializing surveys",t),t}finally{this.ne=!1}}}else qn.error("PostHog Extensions not found.")}}ae(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new Yn(this._instance),qn.info("Surveys loaded successfully"),this.ue({isLoaded:!0})}le(t,i){qn.error(t,i),this.ue({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.oe.push(t),this._surveyManager&&this.ue({isLoaded:!0}),()=>{this.oe=this.oe.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this._instance.config.disable_surveys)return qn.info("Disabled. Not loading surveys."),t([]);var e=this._instance.get_property(hi);if(e&&!i)return t(e,{isLoaded:!0});if(this.se)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.se=!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:i=>{var e;this.se=!1;var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return qn.error(s),t([],{isLoaded:!1,error:s})}var n,o=i.json.surveys||[],a=o.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));a.length>0&&(null==(n=this._surveyEventReceiver)||n.register(a));return null==(e=this._instance.persistence)||e.register({[hi]:o}),t(o,{isLoaded:!0})}})}catch(t){throw this.se=!1,t}}ue(t){for(var i of this.oe)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){qn.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!j(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);qn.warn("init was not called")}he(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}de(t){if(j(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var i="string"==typeof t?this.he(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(j(this._surveyManager))return qn.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var i=this.de(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return j(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((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.de(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i){var e;if(j(this._surveyManager))qn.warn("init was not called");else{var r="string"==typeof t?this.he(t):t;if(null!=r&&r.id)if(Jn.includes(r.type)){var s=null==o?void 0:o.querySelector(i);if(s)return null!=(e=r.appearance)&&e.surveyPopupDelaySeconds?(qn.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,i;qn.info("Rendering survey "+r.id+" with delay of "+(null==(t=r.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.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(t,i){var e;if(j(this._surveyManager))qn.warn("init was not called");else{var r=this.he(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),!1===i.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void qn.warn("Survey is not eligible to be displayed: ",n.disabledReason)}i.displayType!==Un.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,i.selector)}else qn.warn("Survey not found")}}cancelPendingSurvey(t){j(this._surveyManager)?qn.warn("init was not called"):this._surveyManager.cancelSurvey(t)}}var Qn=Tt("[Conversations]");class Zn{constructor(t){this.ve=void 0,this._conversationsManager=null,this.Ti=!1,this.ce=null,this._instance=t}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var i=t.conversations;j(i)||(N(i)?this.ve=i:(this.ve=i.enabled,this.ce=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.ve=void 0,this.ce=null}loadIfEnabled(){if(!this._conversationsManager&&!this.Ti&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=null==v?void 0:v.__PosthogExtensions__;if(i&&!M(this.ve)&&this.ve)if(this.ce&&this.ce.token){if(function(i){var e;if(!i||0===i.length)return!0;var r=null==t||null==(e=t.location)?void 0:e.hostname;return!r||i.some((t=>{var i=function(t){var i=t.replace(/^https?:\/\//,"");return(i=i.split("/")[0].split("?")[0].split(":")[0])||null}(t);if(!i)return!1;if(i.startsWith("*.")){var e=i.slice(2);return r.endsWith("."+e)||r===e}return r===i}))}(this.ce.domains)){this.Ti=!0;try{var e=i.initConversations;if(e)return this.Ci(e),void(this.Ti=!1);var r=i.loadExternalDependency;if(!r)return void this.fe("PostHog loadExternalDependency extension not found.");r(this._instance,"conversations",(t=>{t||!i.initConversations?this.fe("Could not load conversations script",t):this.Ci(i.initConversations),this.Ti=!1}))}catch(t){this.fe("Error initializing conversations",t),this.Ti=!1}}}else Qn.error("Conversations enabled but missing token in remote config.")}}Ci(t){if(this.ce)try{this._conversationsManager=t(this.ce,this._instance),Qn.info("Conversations loaded successfully")}catch(t){this.fe("Error completing conversations initialization",t)}else Qn.error("Cannot complete initialization: remote config is null")}fe(t,i){Qn.error(t,i),this._conversationsManager=null,this.Ti=!1}enable(){this._conversationsManager?this._conversationsManager.enable():Qn.warn("Conversations not loaded yet.")}disable(){this._conversationsManager&&this._conversationsManager.disable()}isLoaded(){return!D(this._conversationsManager)}isEnabled(){return!0===this.ve}}var to=Tt("[RateLimiter]");class io{constructor(t){var i,e;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{to.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void to.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.captureEventsPerSecond=(null==(i=t.config.rate_limiting)?void 0:i.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(e=t.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=(new Date).getTime(),n=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(pi))&&void 0!==i?i:{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||t||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||t||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(pi,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var eo=Tt("[RemoteConfig]");class ro{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}pe(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):(eo.error("PostHog Extensions not found. Cannot load remote config."),t())}ge(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:i=>{t(i.json)}})}load(){try{if(this.remoteConfig)return eo.info("Using preloaded remote config",this.remoteConfig),void this.ci(this.remoteConfig);if(this._instance.O())return void eo.warn("Remote config is disabled. Falling back to local config.");this.pe((t=>{if(!t)return eo.info("No config found after loading remote JS config. Falling back to JSON."),void this.ge((t=>{this.ci(t)}));this.ci(t)}))}catch(t){eo.error("Error loading remote config",t)}}ci(t){t?this._instance.config.__preview_remote_config?(this._instance.ci(t),!1!==t.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):eo.info("__preview_remote_config is disabled. Logging config instead",t):eo.error("Failed to fetch remote config from PostHog.")}}var so=3e3;class no{constructor(t,i){this._e=!0,this.me=[],this.ye=J((null==i?void 0:i.flush_interval_ms)||so,250,5e3,Pt.createLogger("flush interval"),so),this.be=t}enqueue(t){this.me.push(t),this.we||this.xe()}unload(){this.Ee();var t=this.me.length>0?this.Se():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.be(g({},t,{transport:"sendBeacon"}))}))}enable(){this._e=!1,this.xe()}xe(){var t=this;this._e||(this.we=setTimeout((()=>{if(this.Ee(),this.me.length>0){var i=this.Se(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&C(e.data)&&Mt(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.be(e)};for(var r in i)e()}}),this.ye))}Ee(){clearTimeout(this.we),this.we=void 0}Se(){var t={};return Mt(this.me,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;M(t[s])&&(t[s]=g({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.me=[],t}}var oo=["retriesPerformedSoFar"];class ao{constructor(i){this.$e=!1,this.ke=3e3,this.me=[],this._instance=i,this.me=[],this.Pe=!0,!M(t)&&"onLine"in t.navigator&&(this.Pe=t.navigator.onLine,this.Te=()=>{this.Pe=!0,this.Dt()},this.Ce=()=>{this.Pe=!1},qt(t,"online",this.Te),qt(t,"offline",this.Ce))}get length(){return this.me.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,e=_(t,oo);L(i)&&i>0&&(e.url=ln(e.url,{retry_count:i})),this._instance._send_request(g({},e,{callback:t=>{200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&(null!=i?i:0)<10?this.Ie(g({retriesPerformedSoFar:i},e)):null==e.callback||e.callback(t)}}))}Ie(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=(Math.random()-.5)*(r-e);return Math.ceil(r+s)}(i),r=Date.now()+e;this.me.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Pt.warn(s),this.$e||(this.$e=!0,this.Re())}Re(){if(this.Fe&&clearTimeout(this.Fe),0===this.me.length)return this.$e=!1,void(this.Fe=void 0);this.Fe=setTimeout((()=>{this.Pe&&this.me.length>0&&this.Dt(),this.Re()}),this.ke)}Dt(){var t=Date.now(),i=[],e=this.me.filter((e=>e.retryAt<t||(i.push(e),!1)));if(this.me=i,e.length>0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:i}of(this.Fe&&(clearTimeout(this.Fe),this.Fe=void 0),this.$e=!1,M(t)||(this.Te&&(t.removeEventListener("online",this.Te),this.Te=void 0),this.Ce&&(t.removeEventListener("offline",this.Ce),this.Ce=void 0)),this.me))try{this._instance._send_request(g({},i,{transport:"sendBeacon"}))}catch(t){Pt.error(t)}this.me=[]}}class lo{constructor(t){this.Me=()=>{var t,i,e,r;this.Oe||(this.Oe={});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.Oe.lastScrollY=Math.ceil(n),this.Oe.maxScrollY=Math.max(n,null!==(t=this.Oe.maxScrollY)&&void 0!==t?t:0),this.Oe.maxScrollHeight=Math.max(o,null!==(i=this.Oe.maxScrollHeight)&&void 0!==i?i:0),this.Oe.lastContentY=a,this.Oe.maxContentY=Math.max(a,null!==(e=this.Oe.maxContentY)&&void 0!==e?e:0),this.Oe.maxContentHeight=Math.max(l,null!==(r=this.Oe.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}getContext(){return this.Oe}resetContext(){var t=this.Oe;return setTimeout(this.Me,0),t}startMeasuringScrollPosition(){qt(t,"scroll",this.Me,{capture:!0}),qt(t,"scrollend",this.Me,{capture:!0}),qt(t,"resize",this.Me)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==t?void 0:t.document.documentElement;var i=C(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var uo=t=>vs(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class ho{constructor(t,i,e,r){this.Ae=t=>{var i=this.De();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.je(this._instance)};this.Le.register({[fi]:e})}},this._instance=t,this.Ne=i,this.Le=e,this.je=r||uo,this.Ne.onSessionId(this.Ae)}De(){return this.Le.props[fi]}getSetOnceProps(){var t,i=null==(t=this.De())?void 0:t.props;return i?"r"in i?cs(i):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return Mt(Nt(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+E(e)]=i})),t}}var vo=Tt("[SessionId]");class co{on(t,i){return this.Ue.on(t,i)}constructor(t,i,e){var r;if(this.ze=[],this.He=void 0,this.Ue=new zn,this.Be=(t,i)=>Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=t.config,this.Le=t.persistence,this.qe=void 0,this.We=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ge=i||Se,this.Ve=e||Se;var s=this.R.persistence_name||this.R.token,n=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*J(n,60,36e3,vo.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Je(),this.Ke="ph_"+s+"_window_id",this.Ye="ph_"+s+"_primary_window_exists",this.Xe()){var o=je.W(this.Ke),a=je.W(this.Ye);o&&!a?this.qe=o:je.V(this.Ke),je.G(this.Ye,!0)}if(null!=(r=this.R.bootstrap)&&r.sessionID)try{var l=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(this.R.bootstrap.sessionID);this.Qe(this.R.bootstrap.sessionID,(new Date).getTime(),l)}catch(t){vo.error("Invalid sessionID in bootstrap",t)}this.Ze()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return M(this.ze)&&(this.ze=[]),this.ze.push(t),this.We&&t(this.We,this.qe),()=>{this.ze=this.ze.filter((i=>i!==t))}}Xe(){return"memory"!==this.R.persistence&&!this.Le.bi&&je.H()}tr(t){t!==this.qe&&(this.qe=t,this.Xe()&&je.G(this.Ke,t))}ir(){return this.qe?this.qe:this.Xe()?je.W(this.Ke):null}Qe(t,i,e){t===this.We&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.We=t,this.Le.register({[ri]:[i,t,e]}))}er(){var t=this.Le.props[ri];return C(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Qe(null,null,null)}destroy(){clearTimeout(this.rr),this.rr=void 0,this.He&&t&&(t.removeEventListener("beforeunload",this.He,{capture:!1}),this.He=void 0),this.ze=[]}Ze(){this.He=()=>{this.Xe()&&je.V(this.Ye)},qt(t,"beforeunload",this.He,{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),"always"===this.R.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.er(),o=this.ir(),a=L(n)&&n>0&&Math.abs(e-n)>864e5,l=!1,u=!s,h=!u&&!t&&this.Be(e,r);u||h||a?(s=this.Ge(),o=this.Ve(),vo.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.Ve(),l=!0);var d=0===r||!t||a?e:r,v=0===n?(new Date).getTime():n;return this.tr(o),this.Qe(s,d,v),t||this.Je(),l&&this.ze.forEach((t=>t(s,o,l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}Je(){clearTimeout(this.rr),this.rr=setTimeout((()=>{var[t]=this.er();if(this.Be((new Date).getTime(),t)){var i=this.We;this.resetSessionId(),this.Ue.emit("forcedIdleReset",{idleSessionId:i})}}),1.1*this.sessionTimeoutMs)}}var fo=["$set_once","$set"],po=Tt("[SiteApps]");class go{constructor(t){this._instance=t,this.sr=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}nr(t,i){if(i){var e=this.globalsForEvent(i);this.sr.push(e),this.sr.length>1e3&&(this.sr=this.sr.slice(10))}}get siteAppLoaders(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance.Ni(this.nr.bind(this));this.ar=()=>{t(),this.sr=[],this.ar=void 0}}}globalsForEvent(t){var i,e,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(h))l[d]={id:u[d],type:d,properties:v};var{$set_once:c,$set:f}=t;return{event:g({},_(t,fo),{properties:g({},t.properties,f?{$set:g({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:g({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;(!i.errored&&this.sr.length&&(po.info("Processing "+this.sr.length+" events for site app with id "+t.id),this.sr.forEach((t=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored)))&&(null==(e=this.ar)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,po.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var{processEvent:n}=t.init({posthog:this._instance,callback:t=>{s(t)}});n&&(i.processEvent=n),r=!0}catch(i){po.error("Error while initializing PostHog app with config id "+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){po.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}lr(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}ur(t){if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t);for(var e of Object.values(this.apps))try{null==e.processEvent||e.processEvent(i)}catch(i){po.error("Error while processing event "+t.event+" for site app "+e.id,i)}}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.lr(),void this._instance.on("eventCaptured",(t=>this.ur(t)))):void po.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.ar)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;v["__$$ph_site_app_"+t]=s._instance,null==(i=v.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return po.error("Error while initializing PostHog app with config id "+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else po.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var _o=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&y(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>y(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver},mo=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),yo="i.posthog.com";class bo{constructor(t){this.hr={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+yo,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.hr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hr[this.apiHost]=mo.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hr[this.apiHost]=mo.EU:this.hr[this.apiHost]=mo.CUSTOM),this.hr[this.apiHost]}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.uiHost+i;if("flags"===t)return this.flagsApiHost+i;if(this.region===mo.CUSTOM)return this.apiHost+i;var e=yo+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var wo={icontains:(i,e)=>!!t&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!t&&-1===e.href.toLowerCase().indexOf(i.toLowerCase()),regex:(i,e)=>!!t&&vn(e.href,i),not_regex:(i,e)=>!!t&&!vn(e.href,i),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class xo{constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{xo.dr("retrieved web experiments from the server"),i.vr=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;if(i.vr)xo.dr("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.vr)||e.set(t.feature_flag_key,t);var r=i._instance.getFeatureFlag(t.feature_flag_key);O(r)&&t.variants[r]&&i.cr(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];xo.pr(n)&&i.cr(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}onFeatureFlags(t){if(this._is_bot())xo.dr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(j(this.vr))return this.vr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();xo.dr("applying feature flags",t),t.forEach((t=>{var i;if(this.vr&&null!=(i=this.vr)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.vr)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.cr(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=xo.getWindowLocation();if(null!=t&&t.search){var i=ue(null==t?void 0:t.search,"__experiment_id"),e=ue(null==t?void 0:t.search,"__experiment_variant");i&&e&&(xo.dr("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.gr(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this._instance.config.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:i=>{if(200!==i.statusCode||!i.json)return t([]);var e=i.json.experiments||[];return t(e)}})}gr(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(xo.dr("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.cr(r[0].name,i,r[0].variants[i].transforms))}static pr(t){return!j(t.conditions)&&(xo._r(t)&&xo.mr(t))}static _r(t){var i;if(j(t.conditions)||j(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=xo.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||wo[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static mr(t){var i;if(j(t.conditions)||j(null==(i=t.conditions)?void 0:i.utm))return!0;var e=as();if(e.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static dr(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];Pt.info("[WebExperiments] "+t,e)}cr(t,i,e){this._is_bot()?xo.dr("Refusing to render web experiment since the viewer is a likely bot"):"control"!==i?e.forEach((e=>{if(e.selector){var r;xo.dr("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):xo.dr("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?_o(n,this._instance.config.custom_blocked_useragents):void 0}}var Eo=Tt("[PostHog ExternalIntegrations]"),So={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class $o{constructor(t){this._instance=t}it(t,i){var e;null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return Eo.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;(!r||null!=(e=v.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.it(So[i],(()=>{var e;null==(e=v.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=v.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i])&&(null==(n=v.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[i])||n.stop())};for(var[e,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;i(e)}}}var ko="[SessionRecording]",Po=Tt(ko);class To{get started(){var t;return!(null==(t=this.yr)||!t.isStarted)}get status(){return this.yr?this.yr.status:this.br&&!this.wr?"disabled":"lazy_loading"}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.br=!1,this.Er=void 0,this._instance=t,!this._instance.sessionManager)throw Po.error("started without valid sessionManager"),new Error(ko+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(ko+' cannot be used with cookieless_mode="always"')}get wr(){var i,e=!(null==(i=this._instance.get_property(ei))||!i.enabled),r=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!this.wr||null==(i=this.yr)||!i.isStarted){var e=!M(Object.assign)&&!M(Array.from);this.wr&&e?(this.Sr(t),Po.info("starting")):this.stopRecording()}}Sr(t){var i,e,r;this.wr&&(null!=v&&null!=(i=v.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=v.__PosthogExtensions__)&&e.initSessionRecording?this.$r(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.kr,(i=>{if(i)return Po.error("could not load recorder",i);this.$r(t)})))}stopRecording(){var t,i;null==(t=this.Er)||t.call(this),this.Er=void 0,null==(i=this.yr)||i.stop()}Pr(){var t;null==(t=this._instance.persistence)||t.unregister(si)}Tr(t){if(this._instance.persistence){var i,e,r=this._instance.persistence,s=()=>{var i=!1===t.sessionRecording?void 0:t.sessionRecording,e=null==i?void 0:i.sampleRate,s=j(e)?null:parseFloat(e);j(s)&&this.Pr();var n=null==i?void 0:i.minimumDurationMilliseconds;r.register({[ei]:g({enabled:!!i},i,{networkPayloadCapture:g({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:s,minimumDurationMilliseconds:M(n)?null:n,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers})})};s(),null==(i=this.Er)||i.call(this),this.Er=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){"sessionRecording"in t?!1!==t.sessionRecording?(this.Tr(t),this.br=!0,this.startIfEnabledOrStop()):this.br=!0:Po.info("skipping remote config with no sessionRecording",t)}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.yr)&&e.log?this.yr.log(t,i):Po.warn("log called before recorder was ready")}get kr(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(ei);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}$r(t){var i,e;if(null==(i=v.__PosthogExtensions__)||!i.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.yr||(this.yr=null==(e=v.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.yr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture);this.yr.start(t)}onRRwebEmit(t){var i;null==(i=this.yr)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.yr||(null==(i=this._instance.persistence)||i.register({$replay_override_linked_flag:!0}));null==(t=this.yr)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.yr||(null==(i=this._instance.persistence)||i.register({$replay_override_sampling:!0}));null==(t=this.yr)||t.overrideSampling()}overrideTrigger(t){var i,e;this.yr||(null==(e=this._instance.persistence)||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}));null==(i=this.yr)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.yr)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.yr)||!e.tryAddCustomEvent(t,i))}}var Co={},Io=()=>{},Ro="posthog",Fo=!on&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),Mo=i=>{var e;return g({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ht(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Io,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",__preview_deferred_init_extensions:!1,debug:a&&O(null==a?void 0:a.search)&&-1!==a.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(e=t.location)?void 0:e.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:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;Pt.error(i)},get_device_id:t=>t,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:so},error_tracking:{},_onCapture:Io,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(i))},Oo=t=>{var i={};M(t.process_person)||(i.person_profiles=t.process_person),M(t.xhr_headers)||(i.request_headers=t.xhr_headers),M(t.cookie_name)||(i.persistence_name=t.cookie_name),M(t.disable_cookie)||(i.disable_persistence=t.disable_cookie),M(t.store_google)||(i.save_campaign_params=t.store_google),M(t.verbose)||(i.debug=t.verbose);var e=Ot({},i,t);return C(t.property_blacklist)&&(M(t.property_denylist)?e.property_denylist=t.property_blacklist:C(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Pt.error("Invalid value for property_denylist config: "+t.property_denylist)),e};class Ao{constructor(){this.__forceAllowLocalhost=!1}get Cr(){return this.__forceAllowLocalhost}set Cr(t){Pt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Do{get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){this.webPerformance=new Ao,this.Ir=!1,this.version=c.LIB_VERSION,this.Rr=new zn,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Mo(),this.SentryIntegration=Qe,this.sentryIntegration=t=>function(t,i){var e=Xe(t,i);return{name:Ye,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fr=!1,this.Mr=null,this.Or=null,this.Ar=null,this.featureFlags=new In(this),this.toolbar=new rr(this),this.scrollManager=new lo(this),this.pageViewManager=new Es(this),this.surveys=new Xn(this),this.conversations=new Zn(this),this.productTours=new An(this),this.experiments=new xo(this),this.exceptions=new mn(this),this.rateLimiter=new io(this),this.requestRouter=new bo(this),this.consent=new Ne(this),this.externalIntegrations=new $o(this),this.people={set:(t,i,e)=>{var r=O(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=O(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>Pt.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==Ro){var r,s=null!==(r=Co[e])&&void 0!==r?r:new Do;return s._init(t,i,e),Co[e]=s,Co[Ro][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s;if(void 0===e&&(e={}),M(i)||A(i))return Pt.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={},e.debug=this.Dr(e.debug),this.jr=e,this.Lr=[],e.person_profiles&&(this.Or=e.person_profiles),this.set_config(Ot({},Mo(e.defaults),Oo(e),{name:r,token:i})),this.config.on_xhr_error&&Pt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:oe.GZipJS;var n=this.Nr();this.persistence=new Fn(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Fn(g({},this.config,{persistence:"sessionStorage"}),n);var o=g({},this.persistence.props),a=g({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ur=new no((t=>this.zr(t)),this.config.request_queue_config),this.Hr=new ao(this),this.__request_queue=[];var l="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new co(this),this.sessionPropsManager=new ho(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Pt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Br(l)}),0)):(Pt.info("Initializing extensions synchronously"),this.Br(l)),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&Pt.info("Starting in debug mode",{this:this,config:e,thisC:g({},this.config),p:o,s:a}),void 0!==(null==(s=e.bootstrap)?void 0:s.distinctID)){var u,h,d=this.config.get_device_id(Se()),v=null!=(u=e.bootstrap)&&u.isIdentifiedID?d:e.bootstrap.distinctID;this.persistence.set_property(ci,null!=(h=e.bootstrap)&&h.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.bootstrap.distinctID,$device_id:v})}if(this.qr()){var f,p,_=Object.keys((null==(f=e.bootstrap)?void 0:f.featureFlags)||{}).filter((t=>{var i;return!(null==(i=e.bootstrap)||null==(i=i.featureFlags)||!i[t])})).reduce(((t,i)=>{var r;return t[i]=(null==(r=e.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,t}),{}),m=Object.keys((null==(p=e.bootstrap)?void 0:p.featureFlagPayloads)||{}).filter((t=>_[t])).reduce(((t,i)=>{var r,s;null!=(r=e.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(t[i]=null==(s=e.bootstrap)||null==(s=s.featureFlagPayloads)?void 0:s[i]);return t}),{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:m})}if(l)this.register_once({distinct_id:wi,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(Se());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(ci,"anonymous")}return qt(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),e.segment?Ke(this,(()=>this.Wr())):this.Wr(),I(this.config._onCapture)&&this.config._onCapture!==Io&&(Pt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Pt.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}Br(t){var i=performance.now();this.historyAutocapture=new Ve(this),this.historyAutocapture.startIfEnabled();var e=[];e.push((()=>{new nr(this).startIfEnabledOrStop()})),e.push((()=>{var t;this.siteApps=new go(this),null==(t=this.siteApps)||t.init()})),t||e.push((()=>{this.sessionRecording=new To(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||e.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),e.push((()=>{this.autocapture=new _e(this),this.autocapture.startIfEnabled()})),e.push((()=>{this.surveys.loadIfEnabled()})),e.push((()=>{this.conversations.loadIfEnabled()})),e.push((()=>{this.productTours.loadIfEnabled()})),e.push((()=>{this.heatmaps=new xs(this),this.heatmaps.startIfEnabled()})),e.push((()=>{this.webVitalsAutocapture=new ys(this)})),e.push((()=>{this.exceptionObserver=new We(this),this.exceptionObserver.startIfEnabled()})),e.push((()=>{this.deadClicksAutocapture=new Be(this,He),this.deadClicksAutocapture.startIfEnabled()})),e.push((()=>{if(this.Gr){var t=this.Gr;this.Gr=void 0,this.ci(t)}})),this.Vr(e,i)}Vr(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions)if(performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.Vr(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){Pt.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);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&&Pt.info("PostHog extensions initialized ("+r+"ms)")}ci(t){var i,e,r,s,n,a,l,u;if(!o||!o.body)return Pt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.ci(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Gr=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=w(t.supportedCompression,oe.GZipJS)?oe.GZipJS:w(t.supportedCompression,oe.Base64)?oe.Base64:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Or?this.Or:"identified_only"}),null==(e=this.siteApps)||e.onRemoteConfig(t),null==(r=this.sessionRecording)||r.onRemoteConfig(t),null==(s=this.autocapture)||s.onRemoteConfig(t),null==(n=this.heatmaps)||n.onRemoteConfig(t),this.surveys.onRemoteConfig(t),this.conversations.onRemoteConfig(t),this.productTours.onRemoteConfig(t),null==(a=this.webVitalsAutocapture)||a.onRemoteConfig(t),null==(l=this.exceptionObserver)||l.onRemoteConfig(t),this.exceptions.onRemoteConfig(t),null==(u=this.deadClicksAutocapture)||u.onRemoteConfig(t)}Wr(){try{this.config.loaded(this)}catch(t){Pt.critical("`loaded` function failed",t)}this.Jr(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.Kr()}),1),new ro(this).load(),this.featureFlags.flags()}Jr(){var t;this.is_capturing()&&(this.config.request_batching&&(null==(t=this.Ur)||t.enable()))}_dom_loaded(){this.is_capturing()&&Ft(this.__request_queue,(t=>this.zr(t))),this.__request_queue=[],this.Jr()}_handle_unload(){var t,i;this.config.request_batching?(this.Yr()&&this.capture("$pageleave"),null==(t=this.Ur)||t.unload(),null==(i=this.Hr)||i.unload()):this.Yr()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(Fo?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=ln(t.url,{ip:this.config.ip?1:0}),t.headers=g({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,s=g({},t);s.timeout=s.timeout||6e4,s.url=ln(s.url,{_:(new Date).getTime().toString(),ver:c.LIB_VERSION,compression:s.compression});var n=null!==(i=s.transport)&&void 0!==i?i:"fetch",o=dn.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(e=null==(r=Bt(o,(t=>t.transport===n)))?void 0:r.method)&&void 0!==e?e:o[0].method;if(!a)throw new Error("No available transport method");a(s)})(g({},t,{callback:i=>{var e,r;(this.rateLimiter.checkForLimiting(i),i.statusCode>=400)&&(null==(e=(r=this.config).on_request_error)||e.call(r,i));null==t.callback||t.callback(i)}}))))}zr(t){this.Hr?this.Hr.retriableRequest(t):this._send_request(t)}_execute_array(t){var i,e=[],r=[],s=[];Ft(t,(t=>{t&&(i=t[0],C(i)?s.push(t):I(t)?t.call(this):C(t)&&"alias"===i?e.push(t):C(t)&&-1!==i.indexOf("capture")&&I(this[i])?s.push(t):r.push(t))}));var n=function(t,i){Ft(t,(function(t){if(C(t[0])){var e=i;Mt(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else this[t[0]].apply(this,t.slice(1))}),i)};n(e,this),n(r,this),n(s,this)}qr(){var t,i;return(null==(t=this.config.bootstrap)?void 0:t.featureFlags)&&Object.keys(null==(i=this.config.bootstrap)?void 0:i.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,i,e){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ur){if(this.is_capturing())if(!M(t)&&O(t)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var n=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==n||!n.isRateLimited){null!=i&&i.$current_url&&!O(null==i?void 0:i.$current_url)&&(Pt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$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 o=new Date,a=(null==e?void 0:e.timestamp)||o,l=Se(),u={uuid:l,event:t,properties:this.calculateEventProperties(t,i||{},a,l)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),n&&(u.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),(null==e?void 0:e.$set)&&(u.$set=null==e?void 0:e.$set);var h,d="$groupidentify"!==t,v=this.Xr(null==e?void 0:e.$set_once,d);if(v&&(u.$set_once=v),(u=Ut(u,null!=e&&e._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,M(null==e?void 0:e.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),t===Ln.DISMISSED||t===Ln.SENT){var c=null==i?void 0:i[Nn.SURVEY_ID],f=null==i?void 0:i[Nn.SURVEY_ITERATION];h={id:c,current_iteration:f},localStorage.getItem(Vn(h))||localStorage.setItem(Vn(h),"true"),u.$set=g({},u.$set,{[Gn({id:c,current_iteration:f},t===Ln.SENT?"responded":"dismissed")]:!0})}var p=g({},u.properties.$set,u.$set);if(F(p)||this.setPersonPropertiesForFlags(p),!j(this.config.before_send)){var _=this.Qr(u);if(!_)return;u=_}this.Rr.emit("eventCaptured",u);var m={method:"POST",url:null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:null==e?void 0:e._batchKey};return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly?this.zr(m):this.Ur.enqueue(m),u}Pt.critical("This capture call is ignored due to client rate limiting.")}}else Pt.error("No event name provided to posthog.capture")}else Pt.uninitializedWarning("posthog.capture")}Ni(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(t,i,e,r,s){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;var n=s?void 0:this.persistence.remove_event_timer(t),a=g({},i);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"===t){var l=g({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!O(a.distinct_id)&&!L(a.distinct_id)||A(a.distinct_id))&&Pt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,h=gs(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(s,e.getTime());a.$session_id=v,a.$window_id=c}this.sessionPropsManager&&Ot(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Ot(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(f=this.Hr)?void 0:f.length}catch(t){a.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===mo.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u="$pageview"!==t||s?"$pageleave"!==t||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,r),a=Ot(a,u),"$pageview"===t&&o&&(a.title=o.title),!M(n)){var p=e.getTime()-n;a.$duration=parseFloat((p/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ot({},h,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),C(this.config.property_denylist)?Mt(this.config.property_denylist,(function(t){delete a[t]})):Pt.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(Pt.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,t));var m=this.Zr();return a.$process_person_profile=m,m&&!s&&this.ts("_calculate_event_properties"),a}Xr(t,i){var e;if(void 0===i&&(i=!0),!this.persistence||!this.Zr())return t;if(this.Ir)return t;var r=this.persistence.get_initial_props(),s=null==(e=this.sessionPropsManager)?void 0:e.getSetOnceProps(),n=Ot({},r,s||{},t||{}),o=this.config.sanitize_properties;return o&&(Pt.error("sanitize_properties is deprecated. Use before_send instead"),n=o(n,"$set_once")),i&&(this.Ir=!0),F(n)?void 0:n}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i;null==(i=this.sessionPersistence)||i.register(t)}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t)}es(t,i){this.register({[t]:i})}getFeatureFlag(t,i){return this.featureFlags.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(i)}catch(t){return i}}isFeatureEnabled(t,i){return this.featureFlags.isFeatureEnabled(t,i)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,i,e){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){return void 0===i&&(i=!1),this.featureFlags.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Rr.on(t,i)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys.getSurveys(t,i)}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys.getActiveMatchingSurveys(t,i)}renderSurvey(t,i){this.surveys.renderSurvey(t,i)}displaySurvey(t,i){void 0===i&&(i=Kn),this.surveys.displaySurvey(t,i)}cancelPendingSurvey(t){this.surveys.cancelPendingSurvey(t)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}canRenderSurveyAsync(t,i){return void 0===i&&(i=!1),this.surveys.canRenderSurveyAsync(t,i)}identify(t,i,e){if(!this.__loaded||!this.persistence)return Pt.uninitializedWarning("posthog.identify");if(L(t)&&(t=t.toString(),Pt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))Pt.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(t!==wi){if(this.ts("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}t!==r&&t!==this.get_property(Gt)&&(this.unregister(Gt),this.register({distinct_id:t}));var n="anonymous"===(this.persistence.get_property(ci)||"anonymous");t!==r&&n?(this.persistence.set_property(ci,"identified"),this.setPersonPropertiesForFlags(g({},e||{},i||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.Ar=cn(t,i,e),this.featureFlags.setAnonymousDistinctId(r)):(i||e)&&this.setPersonProperties(i,e),t!==r&&(this.reloadFeatureFlags(),this.unregister(vi))}}else Pt.critical('The string "'+wi+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Pt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,i){if((t||i)&&this.ts("posthog.setPersonProperties")){var e=cn(this.get_distinct_id(),t,i);this.Ar!==e?(this.setPersonPropertiesForFlags(g({},i||{},t||{})),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Ar=e):Pt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,e){if(t&&i){var r=this.getGroups();r[t]!==i&&this.resetGroupPropertiesForFlags(t),this.register({$groups:g({},r,{[t]:i})}),e&&(this.capture("$groupidentify",{$group_type:t,$group_key:i,$group_set:e}),this.setGroupPropertiesForFlags({[t]:e})),r[t]===i||e||this.reloadFeatureFlags()}else Pt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.featureFlags.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0),this.ts("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,i)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s;if(Pt.info("reset"),!this.__loaded)return Pt.uninitializedWarning("posthog.reset");var n=this.get_property("$device_id");if(this.consent.reset(),null==(i=this.persistence)||i.clear(),null==(e=this.sessionPersistence)||e.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(ci,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this.Ar=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:wi,$device_id:null},"");else{var o=this.config.get_device_id(Se());this.register_once({distinct_id:o,$device_id:t?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 t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(Wt)?(Pt.critical("Attempting to create alias for existing People user - aborting."),-2):this.ts("posthog.alias")?(M(i)&&(i=this.get_distinct_id()),t!==i?(this.es(Gt,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Pt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=g({},this.config);if(R(t)){var e,r,s,n,o;Ot(this.config,Oo(t));var a=this.Nr();null==(e=this.persistence)||e.update_config(this.config,i,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Fn(g({},this.config,{persistence:"sessionStorage"}),a);var l=this.Dr(this.config.debug);N(l)&&(this.config.debug=l),N(this.config.debug)&&(this.config.debug?(c.DEBUG=!0,Re.H()&&Re.G("ph_debug","true"),Pt.info("set_config",{config:t,oldConfig:i,newConfig:g({},this.config)})):(c.DEBUG=!1,Re.H()&&Re.V("ph_debug"))),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(s=this.autocapture)||s.startIfEnabled(),null==(n=this.heatmaps)||n.startIfEnabled(),this.surveys.loadIfEnabled(),this.rs(),null==(o=this.externalIntegrations)||o.startIfEnabledOrStop()}}startSessionRecording(t){var i=!0===t,e={sampling:i||!(null==t||!t.sampling),linked_flag:i||!(null==t||!t.linked_flag),url_trigger:i||!(null==t||!t.url_trigger),event_trigger:i||!(null==t||!t.event_trigger)};if(Object.values(e).some(Boolean)){var r,s,n,o,a;if(null==(r=this.sessionManager)||r.checkAndGetSessionAndWindowId(),e.sampling)null==(s=this.sessionRecording)||s.overrideSampling();if(e.linked_flag)null==(n=this.sessionRecording)||n.overrideLinkedFlag();if(e.url_trigger)null==(o=this.sessionRecording)||o.overrideTrigger("url");if(e.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 t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){var e=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(g({},r,i))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:Ro;return i!==Ro&&(i=Ro+"."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property(ci))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property(ci))}Zr(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&F(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Gt])&&(null==(i=this.persistence)||null==(i=i.props)||!i[yi]))}Yr(){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.Zr()||this.ts("posthog.createPersonProfile")&&this.setPersonProperties({},{})}ts(t){return"never"===this.config.person_profiles?(Pt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.es(yi,!0),!0)}Nr(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut(),i=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||t&&!!i}rs(){var t,i,e,r,s=this.Nr();(null==(t=this.persistence)?void 0:t.bi)!==s&&(null==(e=this.persistence)||e.set_disabled(s));(null==(i=this.sessionPersistence)?void 0:i.bi)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s));return s}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){var e,r;if("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())this.reset(!0),null==(e=this.sessionManager)||e.destroy(),this.sessionManager=new co(this),this.persistence&&(this.sessionPropsManager=new ho(this,this.sessionManager,this.persistence)),this.sessionRecording=new To(this),this.sessionRecording.startIfEnabledOrStop();if(this.consent.optInOut(!0),this.rs(),this.Jr(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),M(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)this.capture(null!==(r=null==t?void 0:t.captureEventName)&&void 0!==r?r:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this.Kr()}else Pt.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t,i;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.rs(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:wi,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.Kr())):Pt.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 t=this.consent.consent;return t===Le.GRANTED?"granted":t===Le.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.rs()}_is_bot(){return n?_o(n,this.config.custom_blocked_useragents):void 0}Kr(){o&&("visible"===o.visibilityState?this.Fr||(this.Fr=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}),this.Mr&&(o.removeEventListener("visibilitychange",this.Mr),this.Mr=null)):this.Mr||(this.Mr=this.Kr.bind(this),qt(o,"visibilitychange",this.Mr)))}debug(i){!1===i?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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}))}O(){var t,i,e,r,s,n,o,a=this.jr||{};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?(Pt.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):(e="advanced_disable_decide",r=!1,s=Pt,n=(i="advanced_disable_flags")in(t=a)&&!M(t[i]),o=e in t&&!M(t[e]),n?t[i]:o?(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e]):r)}Qr(t){if(j(this.config.before_send))return t;var i=C(this.config.before_send)?this.config.before_send:[this.config.before_send],e=t;for(var r of i){if(e=r(e),j(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return z(t.event)?Pt.warn(s+". This can cause unexpected behavior."):Pt.info(s),null}e.properties&&!F(e.properties)||Pt.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return e}getPageViewId(){var t;return null==(t=this.pageViewManager.Vt)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Dr(t){var i=N(t)&&!t,e=Re.H()&&"true"===Re.q("ph_debug");return!i&&(!!e||t)}}!function(t,i){for(var e=0;e<i.length;e++)t.prototype[i[e]]=Lt(t.prototype[i[e]])}(Do,["identify"]);var jo,Lo;jo=Co[Ro]=new Do,(Lo=v.posthog)&&Mt(Lo._i,(function(t){if(t&&C(t)){var i=jo.init(t[0],t[1],t[2]),e=Lo[t[2]]||Lo;i&&(i._execute_array.call(i.people,e.people),i._execute_array(e))}})),v.posthog=jo,function(){function i(){i.done||(i.done=!0,Fo=!1,Mt(Co,(function(t){t._dom_loaded()})))}null!=o&&o.addEventListener?"complete"===o.readyState?i():qt(o,"DOMContentLoaded",i,{capture:!1}):t&&Pt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}();
1
+ !function(){"use strict";var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(i.self=i),"undefined"==typeof File&&(i.File=function(){});var e=Array.prototype,r=e.forEach,s=e.indexOf,n=null==i?void 0:i.navigator,o=null==i?void 0:i.document,a=null==i?void 0:i.location,l=null==i?void 0:i.fetch,u=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,h=null==i?void 0:i.AbortController,d=null==n?void 0:n.userAgent,v=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"1.307.2"};function f(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function p(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){f(n,r,s,o,a,"next",t)}function a(t){f(n,r,s,o,a,"throw",t)}o(void 0)}))}}function g(){return g=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},g.apply(null,arguments)}function _(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}var 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(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return m.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))},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(t,i){return-1!==t.indexOf(i)}var x=function(t){return t.trim()},E=function(t){return t.replace(/^\$/,"")};var S=Array.isArray,k=Object.prototype,P=k.hasOwnProperty,T=k.toString,C=S||function(t){return"[object Array]"===T.call(t)},I=t=>"function"==typeof t,R=t=>t===Object(t)&&!C(t),F=t=>{if(R(t)){for(var i in t)if(P.call(t,i))return!1;return!0}return!1},M=t=>void 0===t,O=t=>"[object String]"==T.call(t),A=t=>O(t)&&0===t.trim().length,D=t=>null===t,j=t=>M(t)||D(t),L=t=>"[object Number]"==T.call(t),N=t=>"[object Boolean]"===T.call(t),U=t=>t instanceof FormData,z=t=>w(b,t);function H(t){return null===t||"object"!=typeof t}function B(t,i){return Object.prototype.toString.call(t)==="[object "+i+"]"}function q(t){return!M(Event)&&function(t,i){try{return t instanceof i}catch(t){return!1}}(t,Event)}var W=[!0,"true",1,"1","yes"],G=t=>w(W,t),V=[!1,"false",0,"0","no"];function J(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),L(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):t<i?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),J(s||e,i,e,r))}class K{constructor(t){this.t={},this.i=t.i,this.o=J(t.bucketSize,0,100,t.h),this.m=J(t.refillRate,0,this.o,t.h),this.S=J(t.refillInterval,0,864e5,t.h)}$(t,i){var e=i-t.lastAccess,r=Math.floor(e/this.S);if(r>0){var s=r*this.m;t.tokens=Math.min(t.tokens+s,this.o),t.lastAccess=t.lastAccess+r*this.S}}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.t[r];return s?this.$(s,e):(s={tokens:this.o,lastAccess:e},this.t[r]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.i)||i.call(this,t)),0===s.tokens)}stop(){this.t={}}}var Y,X,Q,Z=t=>t instanceof Error;function tt(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Q&&e.length===X||(X=e.length,Q=e.reduce(((e,r)=>{Y||(Y={});var s=Y[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=i[r];if(l&&u){e[l]=u,Y[r]=[l,u];break}}return e}),{})),Q}}class it{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return p((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&C(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?1:0),i.chunkIdMap)),g({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return p((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,i){var e,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,g({},i,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:tt(this.stackParser)}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(r<=4){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return g({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}var et="?";function rt(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?et:e,in_app:!0};return M(r)||(n.lineno=r),M(s)||(n.colno=s),n}var st=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:et,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},nt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ot=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,at=/\((\S*)(?::(\d+))(?::(\d+))\)/,lt=(t,i)=>{var e=nt.exec(t);if(e){var[,r,s,n]=e;return rt(i,r,et,+s,+n)}var o=ot.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=at.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=st(o[1]||et,o[2]);return rt(i,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},ut=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ht=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,dt=(t,i)=>{var e=ut.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=ht.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||et;return[n,s]=st(n,s),rt(i,s,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},vt=/\(error: (.*)\)/,ct=50;function ft(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return function(i,r){void 0===r&&(r=0);for(var s=[],n=i.split("\n"),o=r;o<n.length;o++){var a=n[o];if(!(a.length>1024)){var l=vt.test(a)?a.replace(vt,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of e){var h=u(l,t);if(h){s.push(h);break}}if(s.length>=ct)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,ct).map((t=>{return g({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||et});var e}))}(s)}}class pt{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=O(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return B(t,"DOMException")}isDOMError(t){return B(t,"DOMError")}}class gt{match(t){return(t=>t instanceof Error)(t)}coerce(t,i){return{type:this.getType(t),value:this.getMessage(t,i),stack:this.getStack(t),cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return e.error&&"string"==typeof e.error.message?String(e.error.message):String(e)}getStack(t){return t.stacktrace||t.stack||void 0}}class _t{constructor(){}match(t){return B(t,"ErrorEvent")&&null!=t.error}coerce(t,i){var e,r=i.apply(t.error);return r||{type:"ErrorEvent",value:t.message,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}var mt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class yt{match(t){return"string"==typeof t}coerce(t,i){var e,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(mt);return r&&(i=r[1],e=r[2]),[i,e]}}var bt=["fatal","error","warning","log","info","debug"];function wt(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(!(s.length>i))return r===e.length||s.length<=i?s:s.slice(0,i)+"..."}return""}class xt{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r=this.getErrorPropertyFromObject(t);return r?i.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(e=i.syntheticException)?void 0:e.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return q(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+wt(t)}isSeverityLevel(t){return O(t)&&!A(t)&&bt.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var e=t[i];if(Z(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class Et{match(t){return q(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+wt(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class St{match(t){return H(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class $t{match(t){return B(t,"PromiseRejectionEvent")}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return H(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){if(H(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var kt=function(i,e){var{debugEnabled:r}=void 0===e?{}:e,s={k:function(e){if(t&&(c.DEBUG||v.POSTHOG_DEBUG||r)&&!M(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[e]?t.console[e].__rrweb_original__:t.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];s(i,...o)}},info:function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];s.k("log",...i)},warn:function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];s.k("warn",...i)},error:function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];s.k("error",...i)},critical:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];console.error(i,...e)},uninitializedWarning:t=>{s.error("You must initialize PostHog before calling "+t)},createLogger:(t,e)=>kt(i+" "+t,e)};return s},Pt=kt("[PostHog.js]"),Tt=Pt.createLogger,Ct=Tt("[ExternalScriptsLoader]"),It=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Ct.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=null==o?void 0:o.querySelectorAll("script");if(r)for(var s,n=function(){if(r[a].src===i){var t=r[a];return t.__posthog_loading_callback_fired?{v:e()}:(t.addEventListener("load",(i=>{t.__posthog_loading_callback_fired=!0,e(void 0,i)})),t.onerror=t=>e(t),{v:void 0})}},a=0;a<r.length;a++)if(s=n())return s.v;var l=()=>{if(!o)return e("document not found");var r=o.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>e(t),t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");var s,n=o.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):o.body.appendChild(r)};null!=o&&o.body?l():null==o||o.addEventListener("DOMContentLoaded",l)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{var r="/static/"+i+".js?v="+t.version;if("remote-config"===i&&(r="/array/"+t.config.token+"/config.js"),"toolbar"===i){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=t.requestRouter.endpointFor("assets",r);It(t,n,e)},v.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);It(t,r,e)};var Rt={};function Ft(t,i,e){if(C(t))if(r&&t.forEach===r)t.forEach(i,e);else if("length"in t&&t.length===+t.length)for(var s=0,n=t.length;s<n;s++)if(s in t&&i.call(e,t[s],s)===Rt)return}function Mt(t,i,e){if(!j(t)){if(C(t))return Ft(t,i,e);if(U(t)){for(var r of t.entries())if(i.call(e,r[1],r[0])===Rt)return}else for(var s in t)if(P.call(t,s)&&i.call(e,t[s],s)===Rt)return}}var Ot=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return Ft(e,(function(i){for(var e in i)void 0!==i[e]&&(t[e]=i[e])})),t},At=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return Ft(e,(function(i){Ft(i,(function(i){t.push(i)}))})),t};function Dt(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var jt=function(t){try{return t()}catch(t){return}},Lt=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;r<i;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){Pt.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Pt.critical(t)}}},Nt=function(t){var i={};return Mt(t,(function(t,e){(O(t)&&t.length>0||L(t))&&(i[e]=t)})),i};function Ut(t,i){return e=t,r=t=>O(t)&&!D(i)?t.slice(0,i):t,s=new Set,function t(i,e){return i!==Object(i)?r?r(i,e):i:s.has(i)?void 0:(s.add(i),C(i)?(n=[],Ft(i,(i=>{n.push(t(i))}))):(n={},Mt(i,((i,e)=>{s.has(i)||(n[e]=t(i,e))}))),n);var n}(e);var e,r,s}var zt=["herokuapp.com","vercel.app","netlify.app"];function Ht(t){var i=null==t?void 0:t.hostname;if(!O(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of zt)if(e===r)return!1;return!0}function Bt(t,i){for(var e=0;e<t.length;e++)if(i(t[e]))return t[e]}function qt(t,i,e,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:s,passive:n})}var Wt="$people_distinct_id",Gt="__alias",Vt="__timers",Jt="$autocapture_disabled_server_side",Kt="$heatmaps_enabled_server_side",Yt="$exception_capture_enabled_server_side",Xt="$error_tracking_suppression_rules",Qt="$error_tracking_capture_extension_exceptions",Zt="$web_vitals_enabled_server_side",ti="$dead_clicks_enabled_server_side",ii="$web_vitals_allowed_metrics",ei="$session_recording_remote_config",ri="$sesid",si="$session_is_sampled",ni="$enabled_feature_flags",oi="$early_access_features",ai="$feature_flag_details",li="$stored_person_properties",ui="$stored_group_properties",hi="$surveys",di="$surveys_activated",vi="$flag_call_reported",ci="$user_state",fi="$client_session_props",pi="$capture_rate_limit",gi="$initial_campaign_params",_i="$initial_referrer_info",mi="$initial_person_info",yi="$epp",bi="__POSTHOG_TOOLBAR__",wi="$posthog_cookieless",xi=[Wt,Gt,"__cmpns",Vt,"$session_recording_enabled_server_side",Kt,ri,ni,Xt,ci,oi,ai,ui,li,hi,vi,fi,pi,gi,_i,yi,mi,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function Ei(t){return t instanceof Element&&(t.id===bi||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Si(t){return!!t&&1===t.nodeType}function $i(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function ki(t){return!!t&&3===t.nodeType}function Pi(t){return!!t&&11===t.nodeType}function Ti(t){return t?x(t).split(/\s+/):[]}function Ci(i){var e=null==t?void 0:t.location.href;return!!(e&&i&&i.some((t=>e.match(t))))}function Ii(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return Ti(i)}function Ri(t){return j(t)?null:x(t).split(/(\s+)/).filter((t=>Qi(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Fi(t){var i="";return qi(t)&&!Wi(t)&&t.childNodes&&t.childNodes.length&&Mt(t.childNodes,(function(t){var e;ki(t)&&t.textContent&&(i+=null!==(e=Ri(t.textContent))&&void 0!==e?e:"")})),x(i)}function Mi(t){return M(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null;var i}var Oi=["a","button","form","input","select","textarea","label"];function Ai(t,i){if(M(i))return!0;var e,r=function(t){if(i.some((i=>t.matches(i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function Di(t){var i=t.parentNode;return!(!i||!Si(i))&&i}var ji=["next","previous","prev",">","<"],Li=10;var Ni=[".ph-no-rageclick",".ph-no-capture"];function Ui(i,e){if(!t||zi(i))return!1;var r,s,n;N(e)?(r=!!e&&Ni,s=void 0):(r=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:Ni,s=null==e?void 0:e.content_ignorelist);if(!1===r)return!1;var{targetElementList:o}=Hi(i,!1);return!function(t,i){if(!1===t||M(t))return!1;var e;if(!0===t)e=ji;else{if(!C(t))return!1;if(t.length>Li)return Pt.error("[PostHog] content_ignorelist array cannot exceed "+Li+" items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var{safeText:i,ariaLabel:r}=t;return e.some((t=>i.includes(t)||r.includes(t)))}))}(s,o.map((t=>{var i;return{safeText:Fi(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!Ai(o,r)}var zi=t=>!t||$i(t,"html")||!Si(t),Hi=(i,e)=>{if(!t||zi(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!$i(n,"body");)if(Pi(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=Di(n);if(!o)break;if(e||Oi.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function Bi(i,e,r,s,n){var o,a,l,u;if(void 0===r&&(r=void 0),!t||zi(i))return!1;if(null!=(o=r)&&o.url_allowlist&&!Ci(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&Ci(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var h=r.dom_event_allowlist;if(h&&!h.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:d,targetElementList:v}=Hi(i,s);if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(M(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,r))return!1;if(!Ai(v,null==(u=r)?void 0:u.css_selector_allowlist))return!1;var c=t.getComputedStyle(i);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===e.type)return!0;var f=i.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return d?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(Oi.indexOf(f)>-1||"true"===i.getAttribute("contenteditable"))}}function qi(t){for(var i=t;i.parentNode&&!$i(i,"body");i=i.parentNode){var e=Ii(i);if(w(e,"ph-sensitive")||w(e,"ph-no-capture"))return!1}if(w(Ii(t),"ph-include"))return!0;var r=t.type||"";if(O(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.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 Wi(t){return!!($i(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||$i(t,"select")||$i(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Gi="(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})",Vi=new RegExp("^(?:"+Gi+")$"),Ji=new RegExp(Gi),Ki="\\d{3}-?\\d{2}-?\\d{4}",Yi=new RegExp("^("+Ki+")$"),Xi=new RegExp("("+Ki+")");function Qi(t,i){if(void 0===i&&(i=!0),j(t))return!1;if(O(t)){if(t=x(t),(i?Vi:Ji).test((t||"").replace(/[- ]/g,"")))return!1;if((i?Yi:Xi).test(t))return!1}return!0}function Zi(t){var i=Fi(t);return Qi(i=(i+" "+te(t)).trim())?i:""}function te(t){var i="";return t&&t.childNodes&&t.childNodes.length&&Mt(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Fi(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+te(t)).trim())}catch(t){Pt.error("[AutoCapture]",t)}})),i}function ie(t){return function(t){var i=t.map((t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=g({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Dt(n).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return o[ee(i.toString())]=ee(e.toString())})),r+=":",r+=Dt(o).map((t=>{var[i,e]=t;return i+'="'+e+'"'})).join("")}));return i.join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:re(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Dt(t).filter((t=>{var[i]=t;return 0===i.indexOf("attr__")})).forEach((t=>{var[i,e]=t;return r.attributes[i]=e})),r}))}(t))}function ee(t){return t.replace(/"|\\"/g,'\\"')}function re(t){var i=t.attr__class;return i?C(i)?i:Ti(i):void 0}class se{constructor(t){this.disabled=!1===t;var i=R(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&e-r.timestamp<this.timeoutMs){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var ne="$copy_autocapture",oe=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),ae=t=>{var i=null==o?void 0:o.createElement("a");return M(i)?null:(i.href=t,i)},le=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return Mt(t,(function(t,i){M(t)||M(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)},ue=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!C(e)||e.length<2)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Pt.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},he=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],u=(a||"").split("&"),h=[],d=0;d<u.length;d++){var v=u[d].split("=");C(v)&&(i.includes(v[0])?h.push(v[0]+"="+e):h.push(u[d]))}var c=l;return null!=a&&(c+="?"+h.join("&")),null!=n&&(c+="#"+n),c},de=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},ve=Tt("[AutoCapture]");function ce(t,i){return i.length>t?i.slice(0,t)+"...":i}function fe(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Si(i));return i}function pe(t,i,e,r){var s=t.tagName.toLowerCase(),n={tag_name:s};Oi.indexOf(s)>-1&&!e&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=ce(1024,Zi(t)):n.$el_text=ce(1024,Fi(t)));var o=Ii(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),Mt(t.attributes,(function(e){var s;if((!Wi(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&((null==r||!r.includes(e.name))&&!i&&Qi(e.value)&&(s=e.name,!O(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7)))){var o=e.value;"class"===e.name&&(o=Ti(o).join(" ")),n["attr__"+e.name]=ce(1024,o)}}));for(var a=1,l=1,u=t;u=fe(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function ge(i,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=e,h=[i],d=i;d.parentNode&&!$i(d,"body");)Pi(d.parentNode)?(h.push(d.parentNode.host),d=d.parentNode.host):(h.push(d.parentNode),d=d.parentNode);var v,c=[],f={},p=!1,g=!1;if(Mt(h,(t=>{var i=qi(t);"a"===t.tagName.toLowerCase()&&(p=t.getAttribute("href"),p=i&&p&&Qi(p)&&p),w(Ii(t),"ph-no-capture")&&(g=!0),c.push(pe(t,o,a,l));var e=function(t){if(!qi(t))return{};var i={};return Mt(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Qi(r)&&(i[e]=r)}})),i}(t);Ot(f,e)})),g)return{props:{},explicitNoCapture:g};if(a||("a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?c[0].$el_text=Zi(i):c[0].$el_text=Fi(i)),p){var _,m;c[0].attr__href=p;var y=null==(_=ae(p))?void 0:_.host,b=null==t||null==(m=t.location)?void 0:m.host;y&&b&&y!==b&&(v=p)}return{props:Ot({$event_type:n.type,$ce_version:1},u?{}:{$elements:c},{$elements_chain:ie(c)},null!=(r=c[0])&&r.$el_text?{$el_text:null==(s=c[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},f)}}class _e{constructor(t){this.P=!1,this.T=null,this.C=!1,this.instance=t,this.rageclicks=new se(t.config.rageclick),this.I=null}get R(){var t,i,e=R(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=null==(t=e.url_allowlist)?void 0:t.map((t=>new RegExp(t))),e.url_ignorelist=null==(i=e.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),e}F(){if(this.isBrowserSupported()){if(t&&o){var i=i=>{i=i||(null==t?void 0:t.event);try{this.M(i)}catch(t){ve.error("Failed to capture event",t)}};if(qt(o,"submit",i,{capture:!0}),qt(o,"change",i,{capture:!0}),qt(o,"click",i,{capture:!0}),this.R.capture_copied_text){var e=i=>{i=i||(null==t?void 0:t.event),this.M(i,ne)};qt(o,"copy",e,{capture:!0}),qt(o,"cut",e,{capture:!0})}}}else ve.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.C=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Jt]:!!t.autocapture_opt_out}),this.T=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.I=t}getElementSelectors(t){var i,e=[];return null==(i=this.I)||i.forEach((i=>{var r=null==o?void 0:o.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i,e=null==(t=this.instance.persistence)?void 0:t.props[Jt],r=this.T;if(D(r)&&!N(e)&&!this.instance.O())return!1;var s=null!==(i=this.T)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!s}M(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r,s=Mi(i);if(ki(s)&&(s=s.parentNode||null),"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent)this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(i.clientX,i.clientY,i.timeStamp||(new Date).getTime())&&Ui(s,this.instance.config.rageclick)&&this.M(i,"$rageclick");var n=e===ne;if(s&&Bi(s,i,this.R,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=ge(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.C});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),e===ne){var u,h=Ri(null==t||null==(u=t.getSelection())?void 0:u.toString()),d=i.type||"clipboard";if(!h)return!1;o.$selected_content=h,o.$copy_type=d}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return I(null==o?void 0:o.querySelectorAll)}}Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return L(t)&&isFinite(t)&&Math.floor(t)===t});var me="0123456789abcdef";class ye{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||t<0||i<0||e<0||r<0||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new ye(s)}toString(){for(var t="",i=0;i<this.bytes.length;i++)t=t+me.charAt(this.bytes[i]>>>4)+me.charAt(15&this.bytes[i]),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new ye(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;i<16;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class be{constructor(){this.A=0,this.D=0,this.j=new Ee}generate(){var t=this.generateOrAbort();if(M(t)){this.A=0;var i=this.generateOrAbort();if(M(i))throw new Error("Could not generate UUID after timestamp reset");return i}return t}generateOrAbort(){var t=Date.now();if(t>this.A)this.A=t,this.L();else{if(!(t+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return ye.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var we,xe=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;i<t.length;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!M(t.crypto)&&crypto.getRandomValues&&(xe=t=>crypto.getRandomValues(t));class Ee{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(xe(this.N),this.U=0),this.N[this.U++]}}var Se=()=>$e().toString(),$e=()=>(we||(we=new be)).generate(),ke="";var Pe=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Te(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=o),ke)return ke;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Se();!ke&&r--;){var n=e.slice(r).join("."),a=s+"=1;domain=."+n+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(s)&&(i.cookie=a+";max-age=0",ke=n)}return ke}(t);if(!e){var r=(t=>{var i=t.match(Pe);return i?i[0]:""})(t);r!==e&&Pt.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}var Ce={H:()=>!!o,B:function(t){Pt.error("cookieStore error: "+t)},q:function(t){if(o){try{for(var i=t+"=",e=o.cookie.split(";").filter((t=>t.length)),r=0;r<e.length;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}},W:function(t){var i;try{i=JSON.parse(Ce.q(t))||{}}catch(t){}return i},G:function(t,i,e,r,s){if(o)try{var n="",a="",l=Te(o.location.hostname,r);if(e){var u=new Date;u.setTime(u.getTime()+24*e*60*60*1e3),n="; expires="+u.toUTCString()}s&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&Pt.warn("cookieStore warning: large cookie, len="+h.length),o.cookie=h,h}catch(t){return}},V:function(t,i){if(null!=o&&o.cookie)try{Ce.G(t,"",-1,i)}catch(t){return}}},Ie=null,Re={H:function(){if(!D(Ie))return Ie;var i=!0;if(M(t))i=!1;else try{var e="__mplssupport__";Re.G(e,"xyz"),'"xyz"'!==Re.q(e)&&(i=!1),Re.V(e)}catch(t){i=!1}return i||Pt.error("localStorage unsupported; falling back to cookie store"),Ie=i,i},B:function(t){Pt.error("localStorage error: "+t)},q:function(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){Re.B(t)}return null},W:function(t){try{return JSON.parse(Re.q(t))||{}}catch(t){}return null},G:function(i,e){try{null==t||t.localStorage.setItem(i,JSON.stringify(e))}catch(t){Re.B(t)}},V:function(i){try{null==t||t.localStorage.removeItem(i)}catch(t){Re.B(t)}}},Fe=["distinct_id",ri,si,yi,mi],Me=g({},Re,{W:function(t){try{var i={};try{i=Ce.W(t)||{}}catch(t){}var e=Ot(i,JSON.parse(Re.q(t)||"{}"));return Re.G(t,e),e}catch(t){}return null},G:function(t,i,e,r,s,n){try{Re.G(t,i,void 0,void 0,n);var o={};Fe.forEach((t=>{i[t]&&(o[t]=i[t])})),Object.keys(o).length&&Ce.G(t,o,e,r,s,n)}catch(t){Re.B(t)}},V:function(i,e){try{null==t||t.localStorage.removeItem(i),Ce.V(i,e)}catch(t){Re.B(t)}}}),Oe={},Ae={H:function(){return!0},B:function(t){Pt.error("memoryStorage error: "+t)},q:function(t){return Oe[t]||null},W:function(t){return Oe[t]||null},G:function(t,i){Oe[t]=i},V:function(t){delete Oe[t]}},De=null,je={H:function(){if(!D(De))return De;if(De=!0,M(t))De=!1;else try{var i="__support__";je.G(i,"xyz"),'"xyz"'!==je.q(i)&&(De=!1),je.V(i)}catch(t){De=!1}return De},B:function(t){Pt.error("sessionStorage error: ",t)},q:function(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){je.B(t)}return null},W:function(t){try{return JSON.parse(je.q(t))||null}catch(t){}return null},G:function(i,e){try{null==t||t.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){je.B(t)}},V:function(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){je.B(t)}}},Le=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class Ne{constructor(t){this._instance=t}get R(){return this._instance.config}get consent(){return this.J()?Le.DENIED:this.K}isOptedOut(){return"always"===this.R.cookieless_mode||(this.consent===Le.DENIED||this.consent===Le.PENDING&&(this.R.opt_out_capturing_by_default||"on_reject"===this.R.cookieless_mode))}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Le.DENIED}optInOut(t){this.Y.G(this.X,t?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get K(){var t=this.Y.q(this.X);return G(t)?Le.GRANTED:w(V,t)?Le.DENIED:Le.PENDING}get Y(){if(!this.Z){var t=this.R.opt_out_capturing_persistence_type;this.Z="localStorage"===t?Re:Ce;var i="localStorage"===t?Ce:Re;i.q(this.X)&&(this.Z.q(this.X)||this.optInOut(G(i.q(this.X))),i.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!Bt([null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,v.doNotTrack],(t=>G(t)))}}var Ue=Tt("[Dead Clicks]"),ze=()=>!0,He=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(ti)),r=t.instance.config.capture_dead_clicks;return N(r)?r:!!R(r)||e};class Be{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[ti]:null==t?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Ue.error("failed to load script",i):t()}))}et(){var t;if(o){if(!this.tt&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=R(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.tt=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.tt.start(o),Ue.info("starting...")}}else Ue.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Ue.info("stopping..."))}}var qe=Tt("[ExceptionAutocapture]");class We{constructor(i){var e,r,s;this.rt=()=>{var i;if(t&&this.isEnabled&&null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=e(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=r(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=s(this.captureException.bind(this)))}catch(t){qe.error("failed to start",t),this.lt()}}},this._instance=i,this.ut=!(null==(e=this._instance.persistence)||!e.props[Yt]),this.R=this.ht(),this.dt=new K({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,h:qe}),this.startIfEnabled()}ht(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return R(t)?i=g({},i,t):(M(t)?this.ut:t)&&(i=g({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(qe.info("enabled"),this.it(this.rt))}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return qe.error("failed to load script",i);t()}))}lt(){var t,i,e;null==(t=this.st)||t.call(this),this.st=void 0,null==(i=this.nt)||i.call(this),this.nt=void 0,null==(e=this.ot)||e.call(this),this.ot=void 0}onRemoteConfig(t){var i=t.autocaptureExceptions;this.ut=!!i||!1,this.R=this.ht(),this._instance.persistence&&this._instance.persistence.register({[Yt]:this.ut}),this.startIfEnabled()}captureException(t){var i,e,r=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.dt.consumeRateLimit(r)?qe.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(t)}}function Ge(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return I(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}class Ve{constructor(i){var e;this._instance=i,this.vt=(null==t||null==(e=t.location)?void 0:e.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Pt.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ct&&this.ct(),this.ct=void 0,Pt.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(t&&t.history){var r=this;null!=(i=t.history.pushState)&&i.__posthog_wrapped__||Ge(t.history,"pushState",(t=>function(i,e,s){t.call(this,i,e,s),r.ft("pushState")})),null!=(e=t.history.replaceState)&&e.__posthog_wrapped__||Ge(t.history,"replaceState",(t=>function(i,e,s){t.call(this,i,e,s),r.ft("replaceState")})),this.gt()}}ft(i){try{var e,r=null==t||null==(e=t.location)?void 0:e.pathname;if(!r)return;r!==this.vt&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:i}),this.vt=r}catch(t){Pt.error("Error capturing "+i+" pageview",t)}}gt(){if(!this.ct){var i=()=>{this.ft("popstate")};qt(t,"popstate",i),this.ct=()=>{t&&t.removeEventListener("popstate",i)}}}}var Je=Tt("[SegmentIntegration]");function Ke(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||Se();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(ci,"identified")),i()},s=e.user();"then"in s&&I(s.then)?s.then((t=>r(t))):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||Je.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Je.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Je.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,"$pageview"),identify:t=>i(t,"$identify"),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}var Ye="posthog-js";function Xe(t,i){var{organization:e,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===i?{}:i;return i=>{var a,l,u,h,d;if(!("*"===n||n.includes(i.level))||!t.__loaded)return i;i.tags||(i.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c=(null==(a=i.exception)?void 0:a.values)||[],f=c.map((t=>g({},t,{stacktrace:t.stacktrace?g({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>g({},t,{platform:"web:javascript"})))}):void 0}))),p={$exception_message:(null==(l=c[0])?void 0:l.value)||i.message,$exception_type:null==(u=c[0])?void 0:u.type,$exception_level:i.level,$exception_list:f,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(h=c[0])?void 0:h.value)||i.message,$sentry_exception_type:null==(d=c[0])?void 0:d.type,$sentry_tags:i.tags};return e&&r&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+e+"/issues/?project="+r+"&query="+i.event_id),o&&t.exceptions.sendExceptionEvent(p),i}}class Qe{constructor(t,i,e,r,s,n){this.name=Ye,this.setupOnce=function(o){o(Xe(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}var Ze=null!=t&&t.location?de(t.location.hash,"__posthog")||de(location.hash,"state"):null,tr="_postHogToolbarParams",ir=Tt("[Toolbar]"),er=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(er||{});class rr{constructor(t){this.instance=t}_t(t){v.ph_toolbar_state=t}yt(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:er.UNINITIALIZED}maybeLoadToolbar(i,e,r){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===r&&(r=void 0),!t||!o)return!1;i=null!=i?i:t.location,r=null!=r?r:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}var s,n=Ze||de(i.hash,"__posthog")||de(i.hash,"state"),a=n?jt((()=>JSON.parse(atob(decodeURIComponent(n)))))||jt((()=>JSON.parse(decodeURIComponent(n)))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?i.hash=a.desiredHash:r?r.replaceState(r.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(tr)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch(t){return!1}}bt(t){var i=v.ph_load_toolbar||v.ph_load_editor;!j(i)&&I(i)?i(t,this.instance):ir.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==o||!o.getElementById(bi));if(!t||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=g({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(t.localStorage.setItem(tr,JSON.stringify(g({},s,{source:void 0}))),this.yt()===er.LOADED)this.bt(s);else if(this.yt()===er.UNINITIALIZED){var n;this._t(er.LOADING),null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return ir.error("[Toolbar] Failed to load",t),void this._t(er.UNINITIALIZED);this._t(er.LOADED),this.bt(s)})),qt(t,"turbolinks:load",(()=>{this._t(er.UNINITIALIZED),this.loadToolbar(s)}))}return!0}wt(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}var sr=Tt("[TracingHeaders]");class nr{constructor(t){this.xt=void 0,this.Et=void 0,this.rt=()=>{var t,i;M(this.xt)&&(null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager));M(this.Et)&&(null==(i=v.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return sr.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.it(this.rt):(null==(t=this.xt)||t.call(this),null==(i=this.Et)||i.call(this),this.xt=void 0,this.Et=void 0)}}var or="Mobile",ar="iOS",lr="Android",ur="Tablet",hr=lr+" "+ur,dr="iPad",vr="Apple",cr=vr+" Watch",fr="Safari",pr="BlackBerry",gr="Samsung",_r=gr+"Browser",mr=gr+" Internet",yr="Chrome",br=yr+" OS",wr=yr+" "+ar,xr="Internet Explorer",Er=xr+" "+or,Sr="Opera",$r=Sr+" Mini",kr="Edge",Pr="Microsoft "+kr,Tr="Firefox",Cr=Tr+" "+ar,Ir="Nintendo",Rr="PlayStation",Fr="Xbox",Mr=lr+" "+or,Or=or+" "+fr,Ar="Windows",Dr=Ar+" Phone",jr="Nokia",Lr="Ouya",Nr="Generic",Ur=Nr+" "+or.toLowerCase(),zr=Nr+" "+ur.toLowerCase(),Hr="Konqueror",Br="(\\d+(\\.\\d+)?)",qr=new RegExp("Version/"+Br),Wr=new RegExp(Fr,"i"),Gr=new RegExp(Rr+" \\w+","i"),Vr=new RegExp(Ir+" \\w+","i"),Jr=new RegExp(pr+"|PlayBook|BB10","i"),Kr={"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=(t,i)=>i&&w(i,vr)||function(t){return w(t,fr)&&!w(t,yr)&&!w(t,lr)}(t),Xr=function(t,i){return i=i||"",w(t," OPR/")&&w(t,"Mini")?$r:w(t," OPR/")?Sr:Jr.test(t)?pr:w(t,"IE"+or)||w(t,"WPDesktop")?Er:w(t,_r)?mr:w(t,kr)||w(t,"Edg/")?Pr:w(t,"FBIOS")?"Facebook "+or:w(t,"UCWEB")||w(t,"UCBrowser")?"UC Browser":w(t,"CriOS")?wr:w(t,"CrMo")||w(t,yr)?yr:w(t,lr)&&w(t,fr)?Mr:w(t,"FxiOS")?Cr:w(t.toLowerCase(),Hr.toLowerCase())?Hr:Yr(t,i)?w(t,or)?Or:fr:w(t,Tr)?Tr:w(t,"MSIE")||w(t,"Trident/")?xr:w(t,"Gecko")?Tr:""},Qr={[Er]:[new RegExp("rv:"+Br)],[Pr]:[new RegExp(kr+"?\\/"+Br)],[yr]:[new RegExp("("+yr+"|CrMo)\\/"+Br)],[wr]:[new RegExp("CriOS\\/"+Br)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Br)],[fr]:[qr],[Or]:[qr],[Sr]:[new RegExp("(Opera|OPR)\\/"+Br)],[Tr]:[new RegExp(Tr+"\\/"+Br)],[Cr]:[new RegExp("FxiOS\\/"+Br)],[Hr]:[new RegExp("Konqueror[:/]?"+Br,"i")],[pr]:[new RegExp(pr+" "+Br),qr],[Mr]:[new RegExp("android\\s"+Br,"i")],[mr]:[new RegExp(_r+"\\/"+Br)],[xr]:[new RegExp("(rv:|MSIE )"+Br)],Mozilla:[new RegExp("rv:"+Br)]},Zr=function(t,i){var e=Xr(t,i),r=Qr[e];if(M(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=t.match(n);if(o)return parseFloat(o[o.length-2])}return null},ts=[[new RegExp(Fr+"; "+Fr+" (.*?)[);]","i"),t=>[Fr,t&&t[1]||""]],[new RegExp(Ir,"i"),[Ir,""]],[new RegExp(Rr,"i"),[Rr,""]],[Jr,[pr,""]],[new RegExp(Ar,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Dr,""];if(new RegExp(or).test(i)&&!/IEMobile\b/.test(i))return[Ar+" "+or,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],s=Kr[r]||"";return/arm/i.test(i)&&(s="RT"),[Ar,s]}return[Ar,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[ar,i.join(".")]}return[ar,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=M(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+lr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+lr+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[lr,i.join(".")]}return[lr,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];if(t&&t[1]){var e=[t[1],t[2],t[3]||"0"];i[1]=e.join(".")}return i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[br,""]],[/Linux|debian/i,["Linux",""]]],is=function(t){return Vr.test(t)?Ir:Gr.test(t)?Rr:Wr.test(t)?Fr:new RegExp(Lr,"i").test(t)?Lr:new RegExp("("+Dr+"|WPDesktop)","i").test(t)?Dr:/iPad/.test(t)?dr:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?cr:Jr.test(t)?pr:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(jr,"i").test(t)?jr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(or).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?lr:hr:lr:new RegExp("(pda|"+or+")","i").test(t)?Ur:new RegExp(ur,"i").test(t)&&!new RegExp(ur+" pc","i").test(t)?zr:""},es="https?://(.*)",rs=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ss=At(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],rs),ns="<masked>",os=["li_fat_id"];function as(t,i,e){if(!o)return{};var r,s=i?At([],rs,e||[]):[],n=ls(he(o.URL,s,ns),t),a=(r={},Mt(os,(function(t){var i=Ce.q(t);r[t]=i||null})),r);return Ot(a,n)}function ls(t,i){var e=ss.concat(i||[]),r={};return Mt(e,(function(i){var e=ue(t,i);r[i]=e||null})),r}function us(t){var i=function(t){return t?0===t.search(es+"google.([^/?]*)")?"google":0===t.search(es+"bing.com")?"bing":0===t.search(es+"yahoo.com")?"yahoo":0===t.search(es+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!D(i)){r.$search_engine=i;var s=o?ue(o.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function hs(){return navigator.language||navigator.userLanguage}function ds(){return(null==o?void 0:o.referrer)||"$direct"}function vs(t,i){var e=t?At([],rs,i||[]):[],r=null==a?void 0:a.href.substring(0,1e3);return{r:ds().substring(0,1e3),u:r?he(r,e,ns):void 0}}function cs(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:"$direct"==e?"$direct":null==(i=ae(e))?void 0:i.host};if(r){s.$current_url=r;var n=ae(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=ls(r);Ot(s,o)}if(e){var a=us(e);Ot(s,a)}return s}function fs(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function ps(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function gs(i,e){if(!d)return{};var r,s,n,o=i?At([],rs,e||[]):[],[l,u]=function(t){for(var i=0;i<ts.length;i++){var[e,r]=ts[i],s=e.exec(t),n=s&&(I(r)?r(s,t):r);if(n)return n}return["",""]}(d);return Ot(Nt({$os:l,$os_version:u,$browser:Xr(d,navigator.vendor),$device:is(d),$device_type:(s=d,n=is(s),n===dr||n===hr||"Kobo"===n||"Kindle Fire"===n||n===zr?ur:n===Ir||n===Fr||n===Rr||n===Lr?"Console":n===cr?"Wearable":n?or:"Desktop"),$timezone:fs(),$timezone_offset:ps()}),{$current_url:he(null==a?void 0:a.href,o,ns),$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:Zr(d,navigator.vendor),$browser_language:hs(),$browser_language_prefix:(r=hs(),"string"==typeof r?r.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:"web",$lib_version:c.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var _s=Tt("[Web Vitals]"),ms=9e5;class ys{constructor(t){var i;this.St=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.$t=()=>{clearTimeout(this.kt),0!==this.N.metrics.length&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((t,i)=>g({},t,{["$web_vitals_"+i.name+"_event"]:g({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Pt=t=>{var i,e=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(M(e))_s.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Tt();if(!M(r))if(j(null==t?void 0:t.name)||j(null==t?void 0:t.value))_s.error("Invalid metric received",t);else if(this.Ct&&t.value>=this.Ct)_s.error("Ignoring metric with value >= "+this.Ct,t);else this.N.url!==r&&(this.$t(),this.kt=setTimeout(this.$t,this.flushToCaptureTimeoutMs)),M(this.N.url)&&(this.N.url=r),this.N.firstMetricTimestamp=M(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.N.metrics.push(g({},t,{$current_url:r,$session_id:e.sessionId,$window_id:e.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.$t()}},this.rt=()=>{var t,i,e,r,s=v.__PosthogExtensions__;M(s)||M(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.Pt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Pt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.Pt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.Pt.bind(this)),this.P=!0):_s.error("web vitals callbacks not loaded - not starting")},this._instance=t,this.St=!(null==(i=this._instance.persistence)||!i.props[Zt]),this.startIfEnabled()}get allowedMetrics(){var t,i,e=R(this._instance.config.capture_performance)?null==(t=this._instance.config.capture_performance)?void 0:t.web_vitals_allowed_metrics:void 0;return M(e)?(null==(i=this._instance.persistence)?void 0:i.props[ii])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Ct(){var t=R(this._instance.config.capture_performance)&&L(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:ms;return 0<t&&t<=6e4?ms:t}get isEnabled(){var t=null==a?void 0:a.protocol;if("http:"!==t&&"https:"!==t)return _s.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:N(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return N(i)?i:this.St}startIfEnabled(){this.isEnabled&&!this.P&&(_s.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(t){var i=R(t.capturePerformance)&&!!t.capturePerformance.web_vitals,e=R(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Zt]:i}),this._instance.persistence.register({[ii]:e})),this.St=i,this.startIfEnabled()}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.postHogWebVitalsCallbacks&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"web-vitals",(i=>{i?_s.error("failed to load script",i):t()}))}Tt(){var i=t?t.location.href:void 0;if(i){var e=this._instance.config.mask_personal_data_properties,r=this._instance.config.custom_personal_data_properties,s=e?At([],rs,r||[]):[];return he(i,s,ns)}_s.error("Could not determine current URL")}}var bs=Tt("[Heatmaps]");function ws(t){return R(t)&&"clientX"in t&&"clientY"in t&&L(t.clientX)&&L(t.clientY)}class xs{constructor(t){var i;this.St=!1,this.P=!1,this.It=null,this.instance=t,this.St=!(null==(i=this.instance.persistence)||!i.props[Kt]),this.rageclicks=new se(t.config.rageclick)}get flushIntervalMilliseconds(){var t=5e3;return R(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return M(this.instance.config.capture_heatmaps)?M(this.instance.config.enable_heatmaps)?this.St:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;bs.info("starting..."),this.Rt(),this.Ft()}else{var t;clearInterval(null!==(t=this.It)&&void 0!==t?t:void 0),this.Mt(),this.getAndClearBuffer()}}onRemoteConfig(t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Kt]:i}),this.St=i,this.startIfEnabled()}getAndClearBuffer(){var t=this.N;return this.N=void 0,t}Ot(t){this.At(t.originalEvent,"deadclick")}Ft(){this.It&&clearInterval(this.It),this.It=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(o)?setInterval(this.Dt.bind(this),this.flushIntervalMilliseconds):null}Rt(){t&&o&&(this.jt=this.Dt.bind(this),qt(t,"beforeunload",this.jt),this.Lt=i=>this.At(i||(null==t?void 0:t.event)),qt(o,"click",this.Lt,{capture:!0}),this.Nt=i=>this.Ut(i||(null==t?void 0:t.event)),qt(o,"mousemove",this.Nt,{capture:!0}),this.zt=new Be(this.instance,ze,this.Ot.bind(this)),this.zt.startIfEnabled(),this.Ht=this.Ft.bind(this),qt(o,"visibilitychange",this.Ht),this.P=!0)}Mt(){var i;t&&o&&(this.jt&&t.removeEventListener("beforeunload",this.jt),this.Lt&&o.removeEventListener("click",this.Lt,{capture:!0}),this.Nt&&o.removeEventListener("mousemove",this.Nt,{capture:!0}),this.Ht&&o.removeEventListener("visibilitychange",this.Ht),clearTimeout(this.Bt),null==(i=this.zt)||i.stop(),this.P=!1)}qt(i,e){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(i,e,r){for(var s=i;s&&Si(s)&&!$i(s,"body");){if(s===r)return!1;if(w(e,null==t?void 0:t.getComputedStyle(s).position))return!0;s=Di(s)}return!1}(Mi(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}At(t,i){var e;if(void 0===i&&(i="click"),!Ei(t.target)&&ws(t)){var r=this.qt(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Wt(g({},r,{type:"rageclick"})),this.Wt(r)}}Ut(t){!Ei(t.target)&&ws(t)&&(clearTimeout(this.Bt),this.Bt=setTimeout((()=>{this.Wt(this.qt(t,"mousemove"))}),500))}Wt(i){if(t){var e=t.location.href,r=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=r?At([],rs,s||[]):[],o=he(e,n,ns);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(i)}}Dt(){this.N&&!F(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Es{constructor(t){this._instance=t}doPageView(i,e){var r,s=this.Gt(i,e);return this.Vt={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.Gt(t,null==(i=this.Vt)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Vt)?void 0:t.pageViewId}}Gt(t,i){var e=this.Vt;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:h}=s;if(!(M(n)||M(o)||M(a)||M(l)||M(u)||M(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n<=1?1:J(o/n,0,1,Pt),v=n<=1?1:J(a/n,0,1,Pt),c=l<=1?1:J(u/l,0,1,Pt),f=l<=1?1:J(h/l,0,1,Pt);r=Ot(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var Ss=Uint8Array,$s=Uint16Array,ks=Uint32Array,Ps=new Ss([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]),Ts=new Ss([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]),Cs=new Ss([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Is=function(t,i){for(var e=new $s(31),r=0;r<31;++r)e[r]=i+=1<<t[r-1];var s=new ks(e[30]);for(r=1;r<30;++r)for(var n=e[r];n<e[r+1];++n)s[n]=n-e[r]<<5|r;return[e,s]},Rs=Is(Ps,2),Fs=Rs[0],Ms=Rs[1];Fs[28]=258,Ms[258]=28;for(var Os=Is(Ts,0)[1],As=new $s(32768),Ds=0;Ds<32768;++Ds){var js=(43690&Ds)>>>1|(21845&Ds)<<1;js=(61680&(js=(52428&js)>>>2|(13107&js)<<2))>>>4|(3855&js)<<4,As[Ds]=((65280&js)>>>8|(255&js)<<8)>>>1}var Ls=function(t,i,e){for(var r=t.length,s=0,n=new $s(i);s<r;++s)++n[t[s]-1];var o,a=new $s(i);for(s=0;s<i;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new $s(1<<i);var l=15-i;for(s=0;s<r;++s)if(t[s])for(var u=s<<4|t[s],h=i-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;d<=v;++d)o[As[d]>>>l]=u}else for(o=new $s(r),s=0;s<r;++s)o[s]=As[a[t[s]-1]++]>>>15-t[s];return o},Ns=new Ss(288);for(Ds=0;Ds<144;++Ds)Ns[Ds]=8;for(Ds=144;Ds<256;++Ds)Ns[Ds]=9;for(Ds=256;Ds<280;++Ds)Ns[Ds]=7;for(Ds=280;Ds<288;++Ds)Ns[Ds]=8;var Us=new Ss(32);for(Ds=0;Ds<32;++Ds)Us[Ds]=5;var zs=Ls(Ns,9,0),Hs=Ls(Us,5,0),Bs=function(t){return(t/8>>0)+(7&t&&1)},qs=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof $s?$s:t instanceof ks?ks:Ss)(e-i);return r.set(t.subarray(i,e)),r},Ws=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8},Gs=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8,t[r+2]|=e>>>16},Vs=function(t,i){for(var e=[],r=0;r<t.length;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Ss(0),0];if(1==s){var o=new Ss(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],u=0,h=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=e[e[u].f<e[d].f?u++:d++],l=e[u!=h&&e[u].f<e[d].f?u++:d++],e[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;r<s;++r)n[r].s>v&&(v=n[r].s);var c=new $s(v+1),f=Js(e[h-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));r<s;++r){var m=n[r].s;if(!(c[m]>i))break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var y=n[r].s;c[y]<i?p-=1<<i-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==i&&(--c[b],++p)}f=i}return[new Ss(c),f]},Js=function(t,i,e){return-1==t.s?Math.max(Js(t.l,i,e+1),Js(t.r,i,e+1)):i[t.s]=e},Ks=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new $s(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;a<=i;++a)if(t[a]==s&&a!=i)++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=t[a]}return[e.subarray(0,r),i]},Ys=function(t,i){for(var e=0,r=0;r<i.length;++r)e+=t[r]*i[r];return e},Xs=function(t,i,e){var r=e.length,s=Bs(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;n<r;++n)t[s+n+4]=e[n];return 8*(s+4+r)},Qs=function(t,i,e,r,s,n,o,a,l,u,h){Ws(i,h++,e),++s[256];for(var d=Vs(s,15),v=d[0],c=d[1],f=Vs(n,15),p=f[0],g=f[1],_=Ks(v),m=_[0],y=_[1],b=Ks(p),w=b[0],x=b[1],E=new $s(19),S=0;S<m.length;++S)E[31&m[S]]++;for(S=0;S<w.length;++S)E[31&w[S]]++;for(var k=Vs(E,7),P=k[0],T=k[1],C=19;C>4&&!P[Cs[C-1]];--C);var I,R,F,M,O=u+5<<3,A=Ys(s,Ns)+Ys(n,Us)+o,D=Ys(s,v)+Ys(n,p)+o+14+3*C+Ys(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(O<=A&&O<=D)return Xs(i,h,t.subarray(l,l+u));if(Ws(i,h,1+(D<A)),h+=2,D<A){I=Ls(v,c,0),R=v,F=Ls(p,g,0),M=p;var j=Ls(P,T,0);Ws(i,h,y-257),Ws(i,h+5,x-1),Ws(i,h+10,C-4),h+=14;for(S=0;S<C;++S)Ws(i,h+3*S,P[Cs[S]]);h+=3*C;for(var L=[m,w],N=0;N<2;++N){var U=L[N];for(S=0;S<U.length;++S){var z=31&U[S];Ws(i,h,j[z]),h+=P[z],z>15&&(Ws(i,h,U[S]>>>5&127),h+=U[S]>>>12)}}}else I=zs,R=Ns,F=Hs,M=Us;for(S=0;S<a;++S)if(r[S]>255){z=r[S]>>>18&31;Gs(i,h,I[z+257]),h+=R[z+257],z>7&&(Ws(i,h,r[S]>>>23&31),h+=Ps[z]);var H=31&r[S];Gs(i,h,F[H]),h+=M[H],H>3&&(Gs(i,h,r[S]>>>5&8191),h+=Ts[H])}else Gs(i,h,I[r[S]]),h+=R[r[S]];return Gs(i,h,I[256]),h+R[256]},Zs=new ks([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tn=function(){for(var t=new ks(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),en=function(t,i,e,r,s){return function(t,i,e,r,s,n){var o=t.length,a=new Ss(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!i||o<8)for(var h=0;h<=o;h+=65535){var d=h+65535;d<o?u=Xs(l,u,t.subarray(h,d)):(l[h]=n,u=Xs(l,u,t.subarray(h,o)))}else{for(var v=Zs[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new $s(32768),_=new $s(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new ks(25e3),x=new $s(288),E=new $s(32),S=0,k=0,P=(h=0,0),T=0,C=0;h<o;++h){var I=b(h),R=32767&h,F=_[I];if(g[R]=F,_[I]=R,T<=h){var M=o-h;if((S>7e3||P>24576)&&M>423){u=Qs(t,l,0,w,x,E,k,P,C,h-C,u),P=S=k=0,C=h;for(var O=0;O<286;++O)x[O]=0;for(O=0;O<30;++O)E[O]=0}var A=2,D=0,j=f,L=R-F&32767;if(M>2&&I==b(h-L))for(var N=Math.min(c,M)-1,U=Math.min(32767,h),z=Math.min(258,M);L<=U&&--j&&R!=F;){if(t[h+A]==t[h+A-L]){for(var H=0;H<z&&t[h+H]==t[h+H-L];++H);if(H>A){if(A=H,D=L,H>N)break;var B=Math.min(L,H-2),q=0;for(O=0;O<B;++O){var W=h-L+O+32768&32767,G=W-g[W]+32768&32767;G>q&&(q=G,F=W)}}}L+=(R=F)-(F=g[R])+32768&32767}if(D){w[P++]=268435456|Ms[A]<<18|Os[D];var V=31&Ms[A],J=31&Os[D];k+=Ps[V]+Ts[J],++x[257+V],++E[J],T=h+A,++S}else w[P++]=t[h],++x[t[h]]}}u=Qs(t,l,n,w,x,E,k,P,C,h-C,u)}return qs(a,0,r+Bs(u)+s)}(t,null==i.level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,e,r,!0)},rn=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function sn(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p:function(i){for(var e=t,r=0;r<i.length;++r)e=tn[255&e^i[r]]^e>>>8;t=e},d:function(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n=en(t,i,10+((s=i).filename&&s.filename.length+1||0),8),o=n.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=i.level<2?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&rn(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;r<=e.length;++r)t[r+10]=e.charCodeAt(r)}}(n,i),rn(n,o-8,e.d()),rn(n,o-4,r),n}var nn=function(t){var i,e,r,s,n="";for(i=e=0,r=(t=(t+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var o=t.charCodeAt(s),a=null;o<128?e++: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),D(a)||(e>i&&(n+=t.substring(i,e)),n+=a,i=e=s+1)}return e>i&&(n+=t.substring(i,t.length)),n},on=!!u||!!l,an="text/plain",ln=function(t,i,e){var r;void 0===e&&(e=!0);var[s,n]=t.split("?"),o=g({},i),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var i,[r,s]=t.split("="),n=e&&null!==(i=o[r])&&void 0!==i?i:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],l=le(o);return l&&a.push(l),s+"?"+a.join("&")},un=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),hn=t=>{var{data:i,compression:e}=t;if(i){if(e===oe.GZipJS){var r=sn(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Ss(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;o<e;++o){if(s+5>r.length){var a=new Ss(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||i?n(l):l<2048?(n(192|l>>>6),n(128|63&l)):l>55295&&l<57344?(n(240|(l=65536+(1047552&l)|1023&t.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 qs(r,0,s)}(un(i)),{mtime:0}),s=new Blob([r],{type:an});return{contentType:an,body:s,estimatedSize:s.size}}if(e===oe.Base64){var n=function(t){var i,e,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,u="",h=[];if(!t)return t;t=nn(t);do{i=(n=t.charCodeAt(a++)<<16|t.charCodeAt(a++)<<8|t.charCodeAt(a++))>>18&63,e=n>>12&63,r=n>>6&63,s=63&n,h[l++]=o.charAt(i)+o.charAt(e)+o.charAt(r)+o.charAt(s)}while(a<t.length);switch(u=h.join(""),t.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u}(un(i)),o=(t=>"data="+encodeURIComponent("string"==typeof t?t:un(t)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=un(i);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},dn=[];l&&dn.push({transport:"fetch",method:t=>{var i,e,{contentType:r,body:s,estimatedSize:n}=null!==(i=hn(t))&&void 0!==i?i:{},o=new Headers;Mt(t.headers,(function(t,i){o.append(i,t)})),r&&o.append("Content-Type",r);var a=t.url,u=null;if(h){var d=new h;u={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}l(a,g({method:(null==t?void 0:t.method)||"GET",headers:o,keepalive:"POST"===t.method&&(n||0)<52428.8,body:s,signal:null==(e=u)?void 0:e.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){Pt.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{Pt.error(i),null==t.callback||t.callback({statusCode:0,text:i})})).finally((()=>u?clearTimeout(u.timeout):null))}}),u&&dn.push({transport:"XHR",method:t=>{var i,e=new u;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=hn(t))&&void 0!==i?i:{};Mt(t.headers,(function(t,i){e.setRequestHeader(i,t)})),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),t.disableXHRCredentials||(e.withCredentials=!0),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(s)}}),null!=n&&n.sendBeacon&&dn.push({transport:"sendBeacon",method:t=>{var i=ln(t.url,{beacon:"1"});try{var e,{contentType:r,body:s}=null!==(e=hn(t))&&void 0!==e?e:{},o="string"==typeof s?new Blob([s],{type:r}):s;n.sendBeacon(i,o)}catch(t){}}});var vn=function(t,i){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}};function cn(t,i,e){return un({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var fn={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>vn(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!vn(i,t))))),icontains:(t,i)=>i.map(pn).some((i=>t.map(pn).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(pn).every((i=>t.map(pn).every((t=>!i.includes(t)))))},pn=t=>t.toLowerCase();function gn(t,i){return!t||Object.entries(t).every((t=>{var[e,r]=t,s=null==i?void 0:i[e];if(M(s)||D(s))return!1;var n=[String(s)],o=fn[r.operator];return!!o&&o(r.values,n)}))}var _n=Tt("[Error tracking]");class mn{constructor(t){var i,e;this.Jt=[],this.Kt=new it([new pt,new $t,new _t,new gt,new Et,new xt,new yt,new St],ft("web:javascript",lt,dt)),this._instance=t,this.Jt=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Xt))&&void 0!==i?i:[]}onRemoteConfig(t){var i,e,r,s=null!==(i=null==(e=t.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.Jt=s,this._instance.persistence&&this._instance.persistence.register({[Xt]:this.Jt,[Qt]:n})}get Yt(){var t,i=!!this._instance.get_property(Qt),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Kt.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}sendExceptionEvent(t){var i=t.$exception_list;if(this.Xt(i)){if(this.Qt(i))return void _n.info("Skipping exception capture because a suppression rule matched");if(!this.Yt&&this.Zt(i))return void _n.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ti(i))return void _n.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}Qt(t){if(0===t.length)return!1;var i=t.reduce(((t,i)=>{var{type:e,value:r}=i;return O(e)&&e.length>0&&t.$exception_types.push(e),O(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Jt.some((t=>{var e=t.values.map((t=>{var e,r=fn[t.operator],s=C(t.value)?t.value:[t.value],n=null!==(e=i[t.key])&&void 0!==e?e:[];return s.length>0&&r(s,n)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}Zt(t){return t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ti(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],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}Xt(t){return!j(t)&&C(t)}}var yn=Tt("[FeatureFlags]"),bn=Tt("[FeatureFlags]",{debugEnabled:!0}),wn="$active_feature_flags",xn="$override_feature_flags",En="$feature_flag_payloads",Sn="$override_feature_flag_payloads",$n="$feature_flag_request_id",kn="$feature_flag_evaluated_at",Pn=t=>{var i={};for(var[e,r]of Dt(t||{}))r&&(i[e]=r);return i},Tn=t=>{var i=t.flags;return i?(t.featureFlags=Object.fromEntries(Object.keys(i).map((t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(i).filter((t=>i[t].enabled)).filter((t=>{var e;return null==(e=i[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=i[t].metadata)?void 0:e.payload]})))):yn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},Cn=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class In{constructor(t){this.ii=!1,this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this._instance=t,this.featureFlagEventHandlers=[]}li(){var t=this._instance.config.evaluation_environments;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||yn.error("Invalid evaluation environment found:",t,"Expected non-empty string"),i})):[]}ui(){return this.li().length>0}flags(){if(this._instance.config.__preview_remote_config)this.oi=!0;else{var t=!this.hi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.di({disableFlags:t})}}get hasLoadedFlags(){return this.ei}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(ai),i=this._instance.get_property(xn),e=this._instance.get_property(Sn);if(!e&&!i)return t||{};var r=Ot({},t||{}),s=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(var n of s){var o,a,l=r[n],u=null==i?void 0:i[n],h=M(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=M(u)?l.variant:"string"==typeof u?u:void 0,v=null==e?void 0:e[n],c=g({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});if(h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v)c.metadata=g({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload});r[n]=c}return this.ii||(yn.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.ii=!0),r}getFlagVariants(){var t=this._instance.get_property(ni),i=this._instance.get_property(xn);if(!i)return t||{};for(var e=Ot({},t),r=Object.keys(i),s=0;s<r.length;s++)e[r[s]]=i[r[s]];return this.ii||(yn.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.ii=!0),e}getFlagPayloads(){var t=this._instance.get_property(En),i=this._instance.get_property(Sn);if(!i)return t||{};for(var e=Ot({},t||{}),r=Object.keys(i),s=0;s<r.length;s++)e[r[s]]=i[r[s]];return this.ii||(yn.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.ii=!0),e}reloadFeatureFlags(){this.si||this._instance.config.advanced_disable_feature_flags||this.hi||(this.hi=setTimeout((()=>{this.di()}),5))}vi(){clearTimeout(this.hi),this.hi=void 0}ensureFlagsLoaded(){this.ei||this.ri||this.hi||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.si=t}di(t){var i;if(this.vi(),!this._instance.O())if(this.ri)this.ni=!0;else{var e=this._instance.config.token,r=this._instance.get_property("$device_id"),s={token:e,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:g({},(null==(i=this._instance.persistence)?void 0:i.get_initial_props())||{},this._instance.get_property(li)||{}),group_properties:this._instance.get_property(ui)};D(r)||M(r)||(s.$device_id=r),(null!=t&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.ui()&&(s.evaluation_environments=this.li());var n=this._instance.config.__preview_remote_config,o=n?"/flags/?v=2":"/flags/?v=2&config=true",a=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",l=this._instance.requestRouter.endpointFor("flags",o+a);n&&(s.timezone=fs()),this.ri=!0,this._instance._send_request({method:"POST",url:l,data:s,compression:this._instance.config.disable_compression?void 0:oe.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:t=>{var i,e,r=!0;(200===t.statusCode&&(this.ni||(this.$anon_distinct_id=void 0),r=!1),this.ri=!1,this.oi)||(this.oi=!0,this._instance.ci(null!==(e=t.json)&&void 0!==e?e:{}));if(!s.disable_flags||this.ni)if(this.ai=!r,t.json&&null!=(i=t.json.quotaLimited)&&i.includes(Cn.FeatureFlags))yn.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(!s.disable_flags)this.receivedFeatureFlags(null!==(n=t.json)&&void 0!==n?n:{},r);this.ni&&(this.ni=!1,this.di())}}})}}getFeatureFlag(t,i){if(void 0===i&&(i={}),this.ei||this.getFlags()&&this.getFlags().length>0){var e=this.getFlagVariants()[t],r=""+e,s=this._instance.get_property($n)||void 0,n=this._instance.get_property(kn)||void 0,o=this._instance.get_property(vi)||{};if((i.send_event||!("send_event"in i))&&(!(t in o)||!o[t].includes(r))){var a,l,u,h,d,v,c,f,p;C(o[t])?o[t].push(r):o[t]=[r],null==(a=this._instance.persistence)||a.register({[vi]:o});var g=this.getFeatureFlagDetails(t),_={$feature_flag:t,$feature_flag_response:e,$feature_flag_payload:this.getFeatureFlagPayload(t)||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[t])||null,$feature_flag_bootstrapped_payload:(null==(u=this._instance.config.bootstrap)||null==(u=u.featureFlagPayloads)?void 0:u[t])||null,$used_bootstrap_value:!this.ai};M(null==g||null==(h=g.metadata)?void 0:h.version)||(_.$feature_flag_version=g.metadata.version);var m,y=null!==(d=null==g||null==(v=g.reason)?void 0:v.description)&&void 0!==d?d:null==g||null==(c=g.reason)?void 0:c.code;if(y&&(_.$feature_flag_reason=y),null!=g&&null!=(f=g.metadata)&&f.id&&(_.$feature_flag_id=g.metadata.id),M(null==g?void 0:g.original_variant)&&M(null==g?void 0:g.original_enabled)||(_.$feature_flag_original_response=M(g.original_variant)?g.original_enabled:g.original_variant),null!=g&&null!=(p=g.metadata)&&p.original_payload)_.$feature_flag_original_payload=null==g||null==(m=g.metadata)?void 0:m.original_payload;this._instance.capture("$feature_flag_called",_)}return e}yn.warn('getFeatureFlag for key "'+t+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,i){var e=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:e};this.ui()&&(r.evaluation_environments=this.li()),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:oe.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var r,s=null==(r=e.json)?void 0:r.featureFlagPayloads;i((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,i){if(void 0===i&&(i={}),this.ei||this.getFlags()&&this.getFlags().length>0){var e=this.getFeatureFlag(t,i);return M(e)?void 0:!!e}yn.warn('isFeatureEnabled for key "'+t+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i){if(this._instance.persistence){this.ei=!0;var e=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(t,i,e,r,s){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={});var n=Tn(t),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var u=t.requestId,h=t.evaluatedAt;if(C(a)){yn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var d={};if(a)for(var v=0;v<a.length;v++)d[a[v]]=!0;i&&i.register({[wn]:a,[ni]:d})}else{var c=a,f=l,p=o;t.errorsWhileComputingFlags&&(c=g({},e,c),f=g({},r,f),p=g({},s,p)),i&&i.register(g({[wn]:Object.keys(Pn(c)),[ni]:c||{},[En]:f||{},[ai]:p||{}},u?{[$n]:u}:{},h?{[kn]:h}:{}))}}}(t,this._instance.persistence,e,r,s),this.fi(i)}}override(t,i){void 0===i&&(i=!1),yn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this._instance.persistence)return yn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this._instance.persistence.unregister(xn),this._instance.persistence.unregister(Sn),this.fi(),bn.info("All overrides cleared");if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;if(this.ii=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i),"flags"in e)if(!1===e.flags)this._instance.persistence.unregister(xn),bn.info("Flag overrides cleared");else if(e.flags){if(C(e.flags)){for(var r={},s=0;s<e.flags.length;s++)r[e.flags[s]]=!0;this._instance.persistence.register({[xn]:r})}else this._instance.persistence.register({[xn]:e.flags});bn.info("Flag overrides set",{flags:e.flags})}return"payloads"in e&&(!1===e.payloads?(this._instance.persistence.unregister(Sn),bn.info("Payload overrides cleared")):e.payloads&&(this._instance.persistence.register({[Sn]:e.payloads}),bn.info("Payload overrides set",{payloads:e.payloads}))),void this.fi()}this.fi()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ei){var{flags:i,flagVariants:e}=this.pi();t(i,e)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,s=(this._instance.get_property(oi)||[]).find((i=>i.flagKey===t)),n={["$feature_enrollment/"+t]:i},o={$feature_flag:t,$feature_enrollment:i,$set:n};s&&(o.$early_access_feature_name=s.name),e&&(o.$feature_enrollment_stage=e),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=g({},this.getFlagVariants(),{[t]:i});null==(r=this._instance.persistence)||r.register({[wn]:Object.keys(Pn(a)),[ni]:a}),this.fi()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this._instance.get_property(oi),s=e?"&"+e.map((t=>"stage="+t)).join("&"):"";if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:i=>{var e,r;if(i.json){var s=i.json.earlyAccessFeatures;return null==(e=this._instance.persistence)||e.unregister(oi),null==(r=this._instance.persistence)||r.register({[oi]:s}),t(s)}}})}pi(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}fi(t){var{flags:i,flagVariants:e}=this.pi();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(li)||{};this._instance.register({[li]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(li)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(ui)||{};0!==Object.keys(e).length&&Object.keys(e).forEach((i=>{e[i]=g({},e[i],t[i]),delete t[i]})),this._instance.register({[ui]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this._instance.get_property(ui)||{};this._instance.register({[ui]:g({},i,{[t]:{}})})}else this._instance.unregister(ui)}reset(){this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.$anon_distinct_id=void 0,this.vi(),this.ii=!1}}var Rn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Fn{constructor(t,i){this.R=t,this.props={},this.gi=!1,this.mi=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.Y=this.yi(t),this.load(),t.debug&&Pt.info("Persistence loaded",t.persistence,g({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.bi}yi(t){-1===Rn.indexOf(t.persistence.toLowerCase())&&(Pt.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i=t.persistence.toLowerCase();return"localstorage"===i&&Re.H()?Re:"localstorage+cookie"===i&&Me.H()?Me:"sessionstorage"===i&&je.H()?je:"memory"===i?Ae:"cookie"===i?Ce:Me.H()?Me:Ce}properties(){var t={};return Mt(this.props,(function(i,e){if(e===ni&&R(i))for(var r=Object.keys(i),n=0;n<r.length;n++)t["$feature/"+r[n]]=i[r[n]];else a=e,l=!1,(D(o=xi)?l:s&&o.indexOf===s?-1!=o.indexOf(a):(Mt(o,(function(t){if(l||(l=t===a))return Rt})),l))||(t[e]=i);var o,a,l})),t}load(){if(!this.bi){var t=this.Y.W(this.mi);t&&(this.props=Ot({},t))}}save(){this.bi||this.Y.G(this.mi,this.props,this.wi,this.xi,this.Ei,this.R.debug)}remove(){this.Y.V(this.mi,!1),this.Y.V(this.mi,!0)}clear(){this.remove(),this.props={}}register_once(t,i,e){if(R(t)){M(i)&&(i="None"),this.wi=M(e)?this.Si:e;var r=!1;if(Mt(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.props[e]=t,r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(R(t)){this.wi=M(i)?this.Si:i;var e=!1;if(Mt(t,((i,r)=>{t.hasOwnProperty(r)&&this.props[r]!==i&&(this.props[r]=i,e=!0)})),e)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.gi){var t=as(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);F(Nt(t))||this.register(t),this.gi=!0}}update_search_keyword(){var t;this.register((t=null==o?void 0:o.referrer)?us(t):{})}update_referrer_info(){var t;this.register_once({$referrer:ds(),$referring_domain:null!=o&&o.referrer&&(null==(t=ae(o.referrer))?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[gi]||this.props[_i]||this.register_once({[mi]:vs(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Mt([_i,gi],(i=>{var e=this.props[i];e&&Mt(e,(function(i,e){t["$initial_"+E(e)]=i}))}));var i,e,r=this.props[mi];if(r){var s=(i=cs(r),e={},Mt(i,(function(t,i){e["$initial_"+E(i)]=t})),e);Ot(t,s)}return t}safe_merge(t){return Mt(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this.Si=this.wi=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!e),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==i.persistence){var r=this.yi(t),s=this.props;this.clear(),this.Y=r,this.props=s,this.save()}}set_disabled(t){this.bi=t,this.bi?this.remove():this.save()}set_cross_subdomain(t){t!==this.xi&&(this.xi=t,this.remove(),this.save())}set_secure(t){t!==this.Ei&&(this.Ei=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[Vt]||{};e[t]=i,this.props[Vt]=e,this.save()}remove_event_timer(t){var i=(this.props[Vt]||{})[t];return M(i)||(delete this.props[Vt][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}var Mn=Tt("[Product Tours]"),On="ph_product_tours";class An{constructor(t){this.$i=null,this.ki=null,this.Pi=void 0,this.Ti=!1,this._instance=t}onRemoteConfig(t){if(this._instance.config.disable_product_tours)Mn.info("Product tours disabled via config");else{var i=t.productTours;j(i)?Mn.info("Product tours not enabled in remote config"):(this.Pi=i,Mn.info("Remote config received, isProductToursEnabled: "+this.Pi),this.loadIfEnabled())}}loadIfEnabled(){var t;if(!this.ki)if(this.Ti)Mn.info("Already initializing product tours, skipping...");else if(this._instance.config.disable_product_tours)Mn.info("Product tours disabled via config");else{var i=null==v?void 0:v.__PosthogExtensions__;if(i){var e=null==(t=this._instance.featureFlags)?void 0:t.isFeatureEnabled("product-tours-2025");if(!M(this.Pi)||e){var r=this.Pi||e;if(r){this.Ti=!0;try{var s=i.generateProductTours;if(s)return void this.Ci(s,r);var n=i.loadExternalDependency;if(!n)return Mn.error("PostHog loadExternalDependency extension not found."),void(this.Ti=!1);n(this._instance,"product-tours",(t=>{t||!i.generateProductTours?Mn.error("Could not load product tours script",t):this.Ci(i.generateProductTours,r),this.Ti=!1}))}catch(t){Mn.error("Error initializing product tours",t),this.Ti=!1}}else Mn.info("Product tours not enabled")}else Mn.info("Waiting for remote config or feature flag to enable product tours")}else Mn.error("PostHog Extensions not found.")}}Ci(t,i){this.ki=t(this._instance,i)||null,Mn.info("Product tours loaded successfully")}getProductTours(t,i){if(void 0===i&&(i=!1),!C(this.$i)||i){var e=this._instance.persistence;if(e){var r=e.props[On];if(C(r)&&!i)return this.$i=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:i=>{var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return Mn.error(s),void t([],{isLoaded:!1,error:s})}var n=C(i.json.product_tours)?i.json.product_tours:[];this.$i=n,e&&e.register({[On]:n}),t(n,{isLoaded:!0})}})}else t(this.$i,{isLoaded:!0})}getActiveProductTours(t){if(j(this.ki))return Mn.warn("Product tours not loaded yet"),void t([],{isLoaded:!1,error:"Product tours not loaded"});this.ki.getActiveProductTours(t)}showProductTour(t){var i;Mn.info("showProductTour("+t+")"),null==(i=this.ki)||i.showTourById(t)}dismissProductTour(){var t;null==(t=this.ki)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.ki)||t.nextStep()}previousStep(){var t;null==(t=this.ki)||t.previousStep()}clearCache(){this.$i=null;var t=this._instance.persistence;t&&t.unregister(On)}resetTour(t){var i;null==(i=this.ki)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.ki)||t.resetAllTours()}}var Dn=function(t){return t.Activation="events",t.Cancellation="cancelEvents",t}({}),jn=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({}),Ln=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t}({}),Nn=function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t}({}),Un=function(t){return t.Popover="popover",t.Inline="inline",t}({});class zn{constructor(){this.Ii={},this.Ii={}}on(t,i){return this.Ii[t]||(this.Ii[t]=[]),this.Ii[t].push(i),()=>{this.Ii[t]=this.Ii[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Ii[t]||[])e(i);for(var r of this.Ii["*"]||[])r(t,i)}}function Hn(t,i,e){if(j(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class Bn{constructor(t){this.Ri=new zn,this.Fi=(t,i)=>this.Mi(t,i)&&this.Oi(t,i)&&this.Ai(t,i)&&this.Di(t,i),this.Mi=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.ji=new Set,this.Li=new Set}init(){var t;if(!M(null==(t=this._instance)?void 0:t.Ni)){var i;null==(i=this._instance)||i.Ni(((t,i)=>{this.on(t,i)}))}}register(t){var i,e;if(!M(null==(i=this._instance)?void 0:i.Ni)&&(t.forEach((t=>{var i,e;null==(i=this.Li)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.ji)||i.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r,s=new Set;t.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,i){var e;null!=i&&0!=t.length&&(this.ji.has(t)||this.ji.has(null==i?void 0:i.event))&&this.Li&&(null==(e=this.Li)?void 0:e.size)>0&&this.Li.forEach((t=>{this.Ui(i,t)&&this.Ri.emit("actionCaptured",t.name)}))}zi(t){this.onAction("actionCaptured",(i=>t(i)))}Ui(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Fi(t,e))return!0;return!1}onAction(t,i){return this.Ri.on(t,i)}Oi(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!Hn(r,i.url,i.url_matching||"contains"))return!1}return!0}Ai(t,i){return!!this.Hi(t,i)&&(!!this.Bi(t,i)&&!!this.qi(t,i))}Hi(t,i){var e;if(null==i||!i.href)return!0;var r=this.Wi(t);if(r.length>0)return r.some((t=>Hn(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&Hn((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}Bi(t,i){var e;if(null==i||!i.text)return!0;var r=this.Wi(t);if(r.length>0)return r.some((t=>Hn(t.text,i.text,i.text_matching||"exact")||Hn(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!j(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>Hn(t,n,o))))}qi(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}Wi(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Di(t,i){return null==i||!i.properties||0===i.properties.length||gn(i.properties.reduce(((t,i)=>{var e=C(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}var qn=Tt("[Surveys]");var Wn="seenSurvey_",Gn=(t,i)=>{var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e},Vn=t=>{var i=""+Wn+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+Wn+t.id+"_"+t.current_iteration),i},Jn=[jn.Popover,jn.Widget,jn.API],Kn={ignoreConditions:!1,ignoreDelay:!1,displayType:Un.Popover};class Yn{constructor(t){this._instance=t,this.Gi=new Map,this.Vi=new Map,this.Ji=new Map}Ki(t,i){return!!t&&gn(t.propertyFilters,null==i?void 0:i.properties)}Yi(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}Xi(t,i,e){var r,s=(e===Dn.Activation?this.Gi:this.Vi).get(t),n=[];return null==(r=this._instance)||r.getSurveys((t=>{n=t.filter((t=>null==s?void 0:s.includes(t.id)))})),n.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.Ki(n,i)}))}register(t){var i;M(null==(i=this._instance)?void 0:i.Ni)||(this.Qi(t),this.Zi(t))}Zi(t){var i=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.actions)&&(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length)>0}));if(0!==i.length){if(null==this.te){this.te=new Bn(this._instance),this.te.init();this.te.zi((t=>{this.onAction(t)}))}i.forEach((t=>{var i,e,r,s,n;t.conditions&&null!=(i=t.conditions)&&i.actions&&null!=(e=t.conditions)&&null!=(e=e.actions)&&e.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.te)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((i=>{if(i&&i.name){var e=this.Ji.get(i.name);e&&e.push(t.id),this.Ji.set(i.name,e||[t.id])}})))}))}}Qi(t){var i,e=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),r=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}));if(0!==e.length||0!==r.length){null==(i=this._instance)||i.Ni(((t,i)=>{this.onEvent(t,i)})),this.Gi=this.Yi(t,Dn.Activation),this.Vi=this.Yi(t,Dn.Cancellation)}}onEvent(t,i){var e,r=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[di])||[];if(Ln.SHOWN===t&&i&&r.length>0){var s;qn.info("survey event matched, removing survey from activated surveys",{event:t,eventPayload:i,existingActivatedSurveys:r});var n=null==i||null==(s=i.properties)?void 0:s.$survey_id;if(n){var o=r.indexOf(n);o>=0&&(r.splice(o,1),this.ie(r))}}else{if(this.Vi.has(t)){var a=this.Xi(t,i,Dn.Cancellation);a.length>0&&(qn.info("cancel event matched, cancelling surveys",{event:t,surveysToCancel:a.map((t=>t.id))}),a.forEach((t=>{var i,e=r.indexOf(t.id);e>=0&&r.splice(e,1),null==(i=this._instance)||i.cancelPendingSurvey(t.id)})),this.ie(r))}if(this.Gi.has(t)){qn.info("survey event name matched",{event:t,eventPayload:i,surveys:this.Gi.get(t)});var l=this.Xi(t,i,Dn.Activation);this.ie(r.concat(l.map((t=>t.id))||[]))}}}onAction(t){var i,e=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[di])||[];this.Ji.has(t)&&this.ie(e.concat(this.Ji.get(t)||[]))}ie(t){var i;qn.info("updating activated surveys",{activatedSurveys:t}),null==(i=this._instance)||null==(i=i.persistence)||i.register({[di]:[...new Set(t)]})}getSurveys(){var t,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[di];return i||[]}getEventToSurveys(){return this.Gi}ee(){return this.te}}class Xn{constructor(t){this.re=void 0,this._surveyManager=null,this.se=!1,this.ne=!1,this.oe=[],this._instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){if(!this._instance.config.disable_surveys){var i=t.surveys;if(j(i))return qn.warn("Flags not loaded yet. Not loading surveys.");var e=C(i);this.re=e?i.length>0:i,qn.info("flags response received, isSurveysEnabled: "+this.re),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var e=localStorage.key(i);(null!=e&&e.startsWith(Wn)||null!=e&&e.startsWith("inProgressSurvey_"))&&t.push(e)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.ne)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 t=null==v?void 0:v.__PosthogExtensions__;if(t){if(!M(this.re)||this._instance.config.advanced_enable_surveys){var i=this.re||this._instance.config.advanced_enable_surveys;this.ne=!0;try{var e=t.generateSurveys;if(e)return void this.ae(e,i);var r=t.loadExternalDependency;if(!r)return void this.le("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this.le("Could not load surveys script",e):this.ae(t.generateSurveys,i)}))}catch(t){throw this.le("Error initializing surveys",t),t}finally{this.ne=!1}}}else qn.error("PostHog Extensions not found.")}}ae(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new Yn(this._instance),qn.info("Surveys loaded successfully"),this.ue({isLoaded:!0})}le(t,i){qn.error(t,i),this.ue({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.oe.push(t),this._surveyManager&&this.ue({isLoaded:!0}),()=>{this.oe=this.oe.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this._instance.config.disable_surveys)return qn.info("Disabled. Not loading surveys."),t([]);var e=this._instance.get_property(hi);if(e&&!i)return t(e,{isLoaded:!0});if(this.se)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.se=!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:i=>{var e;this.se=!1;var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return qn.error(s),t([],{isLoaded:!1,error:s})}var n,o=i.json.surveys||[],a=o.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));a.length>0&&(null==(n=this._surveyEventReceiver)||n.register(a));return null==(e=this._instance.persistence)||e.register({[hi]:o}),t(o,{isLoaded:!0})}})}catch(t){throw this.se=!1,t}}ue(t){for(var i of this.oe)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){qn.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!j(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);qn.warn("init was not called")}he(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}de(t){if(j(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var i="string"==typeof t?this.he(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(j(this._surveyManager))return qn.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var i=this.de(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return j(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((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.de(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i){var e;if(j(this._surveyManager))qn.warn("init was not called");else{var r="string"==typeof t?this.he(t):t;if(null!=r&&r.id)if(Jn.includes(r.type)){var s=null==o?void 0:o.querySelector(i);if(s)return null!=(e=r.appearance)&&e.surveyPopupDelaySeconds?(qn.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,i;qn.info("Rendering survey "+r.id+" with delay of "+(null==(t=r.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.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(t,i){var e;if(j(this._surveyManager))qn.warn("init was not called");else{var r=this.he(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),!1===i.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void qn.warn("Survey is not eligible to be displayed: ",n.disabledReason)}i.displayType!==Un.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,i.selector)}else qn.warn("Survey not found")}}cancelPendingSurvey(t){j(this._surveyManager)?qn.warn("init was not called"):this._surveyManager.cancelSurvey(t)}}var Qn=Tt("[Conversations]");class Zn{constructor(t){this.ve=void 0,this._conversationsManager=null,this.Ti=!1,this.ce=null,this._instance=t}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var i=t.conversations;j(i)||(N(i)?this.ve=i:(this.ve=i.enabled,this.ce=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.ve=void 0,this.ce=null}loadIfEnabled(){if(!this._conversationsManager&&!this.Ti&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=null==v?void 0:v.__PosthogExtensions__;if(i&&!M(this.ve)&&this.ve)if(this.ce&&this.ce.token){if(function(i){var e;if(!i||0===i.length)return!0;var r=null==t||null==(e=t.location)?void 0:e.hostname;return!r||i.some((t=>{var i=function(t){var i=t.replace(/^https?:\/\//,"");return(i=i.split("/")[0].split("?")[0].split(":")[0])||null}(t);if(!i)return!1;if(i.startsWith("*.")){var e=i.slice(2);return r.endsWith("."+e)||r===e}return r===i}))}(this.ce.domains)){this.Ti=!0;try{var e=i.initConversations;if(e)return this.Ci(e),void(this.Ti=!1);var r=i.loadExternalDependency;if(!r)return void this.fe("PostHog loadExternalDependency extension not found.");r(this._instance,"conversations",(t=>{t||!i.initConversations?this.fe("Could not load conversations script",t):this.Ci(i.initConversations),this.Ti=!1}))}catch(t){this.fe("Error initializing conversations",t),this.Ti=!1}}}else Qn.error("Conversations enabled but missing token in remote config.")}}Ci(t){if(this.ce)try{this._conversationsManager=t(this.ce,this._instance),Qn.info("Conversations loaded successfully")}catch(t){this.fe("Error completing conversations initialization",t)}else Qn.error("Cannot complete initialization: remote config is null")}fe(t,i){Qn.error(t,i),this._conversationsManager=null,this.Ti=!1}enable(){this._conversationsManager?this._conversationsManager.enable():Qn.warn("Conversations not loaded yet.")}disable(){this._conversationsManager&&this._conversationsManager.disable()}isLoaded(){return!D(this._conversationsManager)}isEnabled(){return!0===this.ve}}var to=Tt("[RateLimiter]");class io{constructor(t){var i,e;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{to.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void to.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.captureEventsPerSecond=(null==(i=t.config.rate_limiting)?void 0:i.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(e=t.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=(new Date).getTime(),n=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(pi))&&void 0!==i?i:{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||t||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||t||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(pi,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var eo=Tt("[RemoteConfig]");class ro{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}pe(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):(eo.error("PostHog Extensions not found. Cannot load remote config."),t())}ge(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:i=>{t(i.json)}})}load(){try{if(this.remoteConfig)return eo.info("Using preloaded remote config",this.remoteConfig),void this.ci(this.remoteConfig);if(this._instance.O())return void eo.warn("Remote config is disabled. Falling back to local config.");this.pe((t=>{if(!t)return eo.info("No config found after loading remote JS config. Falling back to JSON."),void this.ge((t=>{this.ci(t)}));this.ci(t)}))}catch(t){eo.error("Error loading remote config",t)}}ci(t){t?this._instance.config.__preview_remote_config?(this._instance.ci(t),!1!==t.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):eo.info("__preview_remote_config is disabled. Logging config instead",t):eo.error("Failed to fetch remote config from PostHog.")}}var so=3e3;class no{constructor(t,i){this._e=!0,this.me=[],this.ye=J((null==i?void 0:i.flush_interval_ms)||so,250,5e3,Pt.createLogger("flush interval"),so),this.be=t}enqueue(t){this.me.push(t),this.we||this.xe()}unload(){this.Ee();var t=this.me.length>0?this.Se():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.be(g({},t,{transport:"sendBeacon"}))}))}enable(){this._e=!1,this.xe()}xe(){var t=this;this._e||(this.we=setTimeout((()=>{if(this.Ee(),this.me.length>0){var i=this.Se(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&C(e.data)&&Mt(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.be(e)};for(var r in i)e()}}),this.ye))}Ee(){clearTimeout(this.we),this.we=void 0}Se(){var t={};return Mt(this.me,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;M(t[s])&&(t[s]=g({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.me=[],t}}var oo=["retriesPerformedSoFar"];class ao{constructor(i){this.$e=!1,this.ke=3e3,this.me=[],this._instance=i,this.me=[],this.Pe=!0,!M(t)&&"onLine"in t.navigator&&(this.Pe=t.navigator.onLine,this.Te=()=>{this.Pe=!0,this.Dt()},this.Ce=()=>{this.Pe=!1},qt(t,"online",this.Te),qt(t,"offline",this.Ce))}get length(){return this.me.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,e=_(t,oo);L(i)&&i>0&&(e.url=ln(e.url,{retry_count:i})),this._instance._send_request(g({},e,{callback:t=>{200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&(null!=i?i:0)<10?this.Ie(g({retriesPerformedSoFar:i},e)):null==e.callback||e.callback(t)}}))}Ie(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=(Math.random()-.5)*(r-e);return Math.ceil(r+s)}(i),r=Date.now()+e;this.me.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Pt.warn(s),this.$e||(this.$e=!0,this.Re())}Re(){if(this.Fe&&clearTimeout(this.Fe),0===this.me.length)return this.$e=!1,void(this.Fe=void 0);this.Fe=setTimeout((()=>{this.Pe&&this.me.length>0&&this.Dt(),this.Re()}),this.ke)}Dt(){var t=Date.now(),i=[],e=this.me.filter((e=>e.retryAt<t||(i.push(e),!1)));if(this.me=i,e.length>0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:i}of(this.Fe&&(clearTimeout(this.Fe),this.Fe=void 0),this.$e=!1,M(t)||(this.Te&&(t.removeEventListener("online",this.Te),this.Te=void 0),this.Ce&&(t.removeEventListener("offline",this.Ce),this.Ce=void 0)),this.me))try{this._instance._send_request(g({},i,{transport:"sendBeacon"}))}catch(t){Pt.error(t)}this.me=[]}}class lo{constructor(t){this.Me=()=>{var t,i,e,r;this.Oe||(this.Oe={});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.Oe.lastScrollY=Math.ceil(n),this.Oe.maxScrollY=Math.max(n,null!==(t=this.Oe.maxScrollY)&&void 0!==t?t:0),this.Oe.maxScrollHeight=Math.max(o,null!==(i=this.Oe.maxScrollHeight)&&void 0!==i?i:0),this.Oe.lastContentY=a,this.Oe.maxContentY=Math.max(a,null!==(e=this.Oe.maxContentY)&&void 0!==e?e:0),this.Oe.maxContentHeight=Math.max(l,null!==(r=this.Oe.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}getContext(){return this.Oe}resetContext(){var t=this.Oe;return setTimeout(this.Me,0),t}startMeasuringScrollPosition(){qt(t,"scroll",this.Me,{capture:!0}),qt(t,"scrollend",this.Me,{capture:!0}),qt(t,"resize",this.Me)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==t?void 0:t.document.documentElement;var i=C(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var uo=t=>vs(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class ho{constructor(t,i,e,r){this.Ae=t=>{var i=this.De();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.je(this._instance)};this.Le.register({[fi]:e})}},this._instance=t,this.Ne=i,this.Le=e,this.je=r||uo,this.Ne.onSessionId(this.Ae)}De(){return this.Le.props[fi]}getSetOnceProps(){var t,i=null==(t=this.De())?void 0:t.props;return i?"r"in i?cs(i):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return Mt(Nt(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+E(e)]=i})),t}}var vo=Tt("[SessionId]");class co{on(t,i){return this.Ue.on(t,i)}constructor(t,i,e){var r;if(this.ze=[],this.He=void 0,this.Ue=new zn,this.Be=(t,i)=>Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=t.config,this.Le=t.persistence,this.qe=void 0,this.We=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Ge=i||Se,this.Ve=e||Se;var s=this.R.persistence_name||this.R.token,n=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*J(n,60,36e3,vo.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Je(),this.Ke="ph_"+s+"_window_id",this.Ye="ph_"+s+"_primary_window_exists",this.Xe()){var o=je.W(this.Ke),a=je.W(this.Ye);o&&!a?this.qe=o:je.V(this.Ke),je.G(this.Ye,!0)}if(null!=(r=this.R.bootstrap)&&r.sessionID)try{var l=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(this.R.bootstrap.sessionID);this.Qe(this.R.bootstrap.sessionID,(new Date).getTime(),l)}catch(t){vo.error("Invalid sessionID in bootstrap",t)}this.Ze()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return M(this.ze)&&(this.ze=[]),this.ze.push(t),this.We&&t(this.We,this.qe),()=>{this.ze=this.ze.filter((i=>i!==t))}}Xe(){return"memory"!==this.R.persistence&&!this.Le.bi&&je.H()}tr(t){t!==this.qe&&(this.qe=t,this.Xe()&&je.G(this.Ke,t))}ir(){return this.qe?this.qe:this.Xe()?je.W(this.Ke):null}Qe(t,i,e){t===this.We&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.We=t,this.Le.register({[ri]:[i,t,e]}))}er(){var t=this.Le.props[ri];return C(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Qe(null,null,null)}destroy(){clearTimeout(this.rr),this.rr=void 0,this.He&&t&&(t.removeEventListener("beforeunload",this.He,{capture:!1}),this.He=void 0),this.ze=[]}Ze(){this.He=()=>{this.Xe()&&je.V(this.Ye)},qt(t,"beforeunload",this.He,{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),"always"===this.R.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.er(),o=this.ir(),a=L(n)&&n>0&&Math.abs(e-n)>864e5,l=!1,u=!s,h=!u&&!t&&this.Be(e,r);u||h||a?(s=this.Ge(),o=this.Ve(),vo.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.Ve(),l=!0);var d=0===r||!t||a?e:r,v=0===n?(new Date).getTime():n;return this.tr(o),this.Qe(s,d,v),t||this.Je(),l&&this.ze.forEach((t=>t(s,o,l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}Je(){clearTimeout(this.rr),this.rr=setTimeout((()=>{var[t]=this.er();if(this.Be((new Date).getTime(),t)){var i=this.We;this.resetSessionId(),this.Ue.emit("forcedIdleReset",{idleSessionId:i})}}),1.1*this.sessionTimeoutMs)}}var fo=["$set_once","$set"],po=Tt("[SiteApps]");class go{constructor(t){this._instance=t,this.sr=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}nr(t,i){if(i){var e=this.globalsForEvent(i);this.sr.push(e),this.sr.length>1e3&&(this.sr=this.sr.slice(10))}}get siteAppLoaders(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance.Ni(this.nr.bind(this));this.ar=()=>{t(),this.sr=[],this.ar=void 0}}}globalsForEvent(t){var i,e,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(h))l[d]={id:u[d],type:d,properties:v};var{$set_once:c,$set:f}=t;return{event:g({},_(t,fo),{properties:g({},t.properties,f?{$set:g({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:g({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;(!i.errored&&this.sr.length&&(po.info("Processing "+this.sr.length+" events for site app with id "+t.id),this.sr.forEach((t=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored)))&&(null==(e=this.ar)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,po.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var{processEvent:n}=t.init({posthog:this._instance,callback:t=>{s(t)}});n&&(i.processEvent=n),r=!0}catch(i){po.error("Error while initializing PostHog app with config id "+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){po.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}lr(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}ur(t){if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t);for(var e of Object.values(this.apps))try{null==e.processEvent||e.processEvent(i)}catch(i){po.error("Error while processing event "+t.event+" for site app "+e.id,i)}}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.lr(),void this._instance.on("eventCaptured",(t=>this.ur(t)))):void po.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.ar)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;v["__$$ph_site_app_"+t]=s._instance,null==(i=v.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return po.error("Error while initializing PostHog app with config id "+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else po.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var _o=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&y(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>y(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver},mo=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),yo="i.posthog.com";class bo{constructor(t){this.hr={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+yo,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.hr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hr[this.apiHost]=mo.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.hr[this.apiHost]=mo.EU:this.hr[this.apiHost]=mo.CUSTOM),this.hr[this.apiHost]}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.uiHost+i;if("flags"===t)return this.flagsApiHost+i;if(this.region===mo.CUSTOM)return this.apiHost+i;var e=yo+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var wo={icontains:(i,e)=>!!t&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!t&&-1===e.href.toLowerCase().indexOf(i.toLowerCase()),regex:(i,e)=>!!t&&vn(e.href,i),not_regex:(i,e)=>!!t&&!vn(e.href,i),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class xo{constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{xo.dr("retrieved web experiments from the server"),i.vr=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;if(i.vr)xo.dr("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.vr)||e.set(t.feature_flag_key,t);var r=i._instance.getFeatureFlag(t.feature_flag_key);O(r)&&t.variants[r]&&i.cr(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];xo.pr(n)&&i.cr(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}onFeatureFlags(t){if(this._is_bot())xo.dr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(j(this.vr))return this.vr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();xo.dr("applying feature flags",t),t.forEach((t=>{var i;if(this.vr&&null!=(i=this.vr)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.vr)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.cr(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=xo.getWindowLocation();if(null!=t&&t.search){var i=ue(null==t?void 0:t.search,"__experiment_id"),e=ue(null==t?void 0:t.search,"__experiment_variant");i&&e&&(xo.dr("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.gr(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this._instance.config.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:i=>{if(200!==i.statusCode||!i.json)return t([]);var e=i.json.experiments||[];return t(e)}})}gr(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(xo.dr("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.cr(r[0].name,i,r[0].variants[i].transforms))}static pr(t){return!j(t.conditions)&&(xo._r(t)&&xo.mr(t))}static _r(t){var i;if(j(t.conditions)||j(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=xo.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||wo[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static mr(t){var i;if(j(t.conditions)||j(null==(i=t.conditions)?void 0:i.utm))return!0;var e=as();if(e.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static dr(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];Pt.info("[WebExperiments] "+t,e)}cr(t,i,e){this._is_bot()?xo.dr("Refusing to render web experiment since the viewer is a likely bot"):"control"!==i?e.forEach((e=>{if(e.selector){var r;xo.dr("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):xo.dr("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?_o(n,this._instance.config.custom_blocked_useragents):void 0}}var Eo=Tt("[PostHog ExternalIntegrations]"),So={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class $o{constructor(t){this._instance=t}it(t,i){var e;null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return Eo.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;(!r||null!=(e=v.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.it(So[i],(()=>{var e;null==(e=v.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=v.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i])&&(null==(n=v.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[i])||n.stop())};for(var[e,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;i(e)}}}var ko="[SessionRecording]",Po=Tt(ko);class To{get started(){var t;return!(null==(t=this.yr)||!t.isStarted)}get status(){return this.yr?this.yr.status:this.br&&!this.wr?"disabled":"lazy_loading"}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.br=!1,this.Er=void 0,this._instance=t,!this._instance.sessionManager)throw Po.error("started without valid sessionManager"),new Error(ko+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(ko+' cannot be used with cookieless_mode="always"')}get wr(){var i,e=!(null==(i=this._instance.get_property(ei))||!i.enabled),r=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!this.wr||null==(i=this.yr)||!i.isStarted){var e=!M(Object.assign)&&!M(Array.from);this.wr&&e?(this.Sr(t),Po.info("starting")):this.stopRecording()}}Sr(t){var i,e,r;this.wr&&(null!=v&&null!=(i=v.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=v.__PosthogExtensions__)&&e.initSessionRecording?this.$r(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.kr,(i=>{if(i)return Po.error("could not load recorder",i);this.$r(t)})))}stopRecording(){var t,i;null==(t=this.Er)||t.call(this),this.Er=void 0,null==(i=this.yr)||i.stop()}Pr(){var t;null==(t=this._instance.persistence)||t.unregister(si)}Tr(t){if(this._instance.persistence){var i,e,r=this._instance.persistence,s=()=>{var i=!1===t.sessionRecording?void 0:t.sessionRecording,e=null==i?void 0:i.sampleRate,s=j(e)?null:parseFloat(e);j(s)&&this.Pr();var n=null==i?void 0:i.minimumDurationMilliseconds;r.register({[ei]:g({enabled:!!i},i,{networkPayloadCapture:g({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:s,minimumDurationMilliseconds:M(n)?null:n,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers})})};s(),null==(i=this.Er)||i.call(this),this.Er=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){"sessionRecording"in t?!1!==t.sessionRecording?(this.Tr(t),this.br=!0,this.startIfEnabledOrStop()):this.br=!0:Po.info("skipping remote config with no sessionRecording",t)}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.yr)&&e.log?this.yr.log(t,i):Po.warn("log called before recorder was ready")}get kr(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(ei);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}$r(t){var i,e;if(null==(i=v.__PosthogExtensions__)||!i.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.yr||(this.yr=null==(e=v.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.yr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture);this.yr.start(t)}onRRwebEmit(t){var i;null==(i=this.yr)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.yr||(null==(i=this._instance.persistence)||i.register({$replay_override_linked_flag:!0}));null==(t=this.yr)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.yr||(null==(i=this._instance.persistence)||i.register({$replay_override_sampling:!0}));null==(t=this.yr)||t.overrideSampling()}overrideTrigger(t){var i,e;this.yr||(null==(e=this._instance.persistence)||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}));null==(i=this.yr)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.yr)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.yr)||!e.tryAddCustomEvent(t,i))}}var Co={},Io=()=>{},Ro="posthog",Fo=!on&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),Mo=i=>{var e;return g({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ht(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Io,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",__preview_deferred_init_extensions:!1,debug:a&&O(null==a?void 0:a.search)&&-1!==a.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(e=t.location)?void 0:e.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:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;Pt.error(i)},get_device_id:t=>t,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:so},error_tracking:{},_onCapture:Io,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(i))},Oo=t=>{var i={};M(t.process_person)||(i.person_profiles=t.process_person),M(t.xhr_headers)||(i.request_headers=t.xhr_headers),M(t.cookie_name)||(i.persistence_name=t.cookie_name),M(t.disable_cookie)||(i.disable_persistence=t.disable_cookie),M(t.store_google)||(i.save_campaign_params=t.store_google),M(t.verbose)||(i.debug=t.verbose);var e=Ot({},i,t);return C(t.property_blacklist)&&(M(t.property_denylist)?e.property_denylist=t.property_blacklist:C(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Pt.error("Invalid value for property_denylist config: "+t.property_denylist)),e};class Ao{constructor(){this.__forceAllowLocalhost=!1}get Cr(){return this.__forceAllowLocalhost}set Cr(t){Pt.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Do{get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){this.webPerformance=new Ao,this.Ir=!1,this.version=c.LIB_VERSION,this.Rr=new zn,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Mo(),this.SentryIntegration=Qe,this.sentryIntegration=t=>function(t,i){var e=Xe(t,i);return{name:Ye,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fr=!1,this.Mr=null,this.Or=null,this.Ar=null,this.featureFlags=new In(this),this.toolbar=new rr(this),this.scrollManager=new lo(this),this.pageViewManager=new Es(this),this.surveys=new Xn(this),this.conversations=new Zn(this),this.productTours=new An(this),this.experiments=new xo(this),this.exceptions=new mn(this),this.rateLimiter=new io(this),this.requestRouter=new bo(this),this.consent=new Ne(this),this.externalIntegrations=new $o(this),this.people={set:(t,i,e)=>{var r=O(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=O(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>Pt.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==Ro){var r,s=null!==(r=Co[e])&&void 0!==r?r:new Do;return s._init(t,i,e),Co[e]=s,Co[Ro][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s;if(void 0===e&&(e={}),M(i)||A(i))return Pt.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={},e.debug=this.Dr(e.debug),this.jr=e,this.Lr=[],e.person_profiles&&(this.Or=e.person_profiles),this.set_config(Ot({},Mo(e.defaults),Oo(e),{name:r,token:i})),this.config.on_xhr_error&&Pt.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:oe.GZipJS;var n=this.Nr();this.persistence=new Fn(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Fn(g({},this.config,{persistence:"sessionStorage"}),n);var o=g({},this.persistence.props),a=g({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ur=new no((t=>this.zr(t)),this.config.request_queue_config),this.Hr=new ao(this),this.__request_queue=[];var l="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new co(this),this.sessionPropsManager=new ho(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Pt.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Br(l)}),0)):(Pt.info("Initializing extensions synchronously"),this.Br(l)),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&Pt.info("Starting in debug mode",{this:this,config:e,thisC:g({},this.config),p:o,s:a}),void 0!==(null==(s=e.bootstrap)?void 0:s.distinctID)){var u,h,d=this.config.get_device_id(Se()),v=null!=(u=e.bootstrap)&&u.isIdentifiedID?d:e.bootstrap.distinctID;this.persistence.set_property(ci,null!=(h=e.bootstrap)&&h.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.bootstrap.distinctID,$device_id:v})}if(this.qr()){var f,p,_=Object.keys((null==(f=e.bootstrap)?void 0:f.featureFlags)||{}).filter((t=>{var i;return!(null==(i=e.bootstrap)||null==(i=i.featureFlags)||!i[t])})).reduce(((t,i)=>{var r;return t[i]=(null==(r=e.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,t}),{}),m=Object.keys((null==(p=e.bootstrap)?void 0:p.featureFlagPayloads)||{}).filter((t=>_[t])).reduce(((t,i)=>{var r,s;null!=(r=e.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(t[i]=null==(s=e.bootstrap)||null==(s=s.featureFlagPayloads)?void 0:s[i]);return t}),{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:m})}if(l)this.register_once({distinct_id:wi,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(Se());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(ci,"anonymous")}return qt(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),e.segment?Ke(this,(()=>this.Wr())):this.Wr(),I(this.config._onCapture)&&this.config._onCapture!==Io&&(Pt.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Pt.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}Br(t){var i=performance.now();this.historyAutocapture=new Ve(this),this.historyAutocapture.startIfEnabled();var e=[];e.push((()=>{new nr(this).startIfEnabledOrStop()})),e.push((()=>{var t;this.siteApps=new go(this),null==(t=this.siteApps)||t.init()})),t||e.push((()=>{this.sessionRecording=new To(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||e.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),e.push((()=>{this.autocapture=new _e(this),this.autocapture.startIfEnabled()})),e.push((()=>{this.surveys.loadIfEnabled()})),e.push((()=>{this.conversations.loadIfEnabled()})),e.push((()=>{this.productTours.loadIfEnabled()})),e.push((()=>{this.heatmaps=new xs(this),this.heatmaps.startIfEnabled()})),e.push((()=>{this.webVitalsAutocapture=new ys(this)})),e.push((()=>{this.exceptionObserver=new We(this),this.exceptionObserver.startIfEnabled()})),e.push((()=>{this.deadClicksAutocapture=new Be(this,He),this.deadClicksAutocapture.startIfEnabled()})),e.push((()=>{if(this.Gr){var t=this.Gr;this.Gr=void 0,this.ci(t)}})),this.Vr(e,i)}Vr(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions)if(performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.Vr(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){Pt.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);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&&Pt.info("PostHog extensions initialized ("+r+"ms)")}ci(t){var i,e,r,s,n,a,l,u;if(!o||!o.body)return Pt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.ci(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Gr=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=w(t.supportedCompression,oe.GZipJS)?oe.GZipJS:w(t.supportedCompression,oe.Base64)?oe.Base64:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Or?this.Or:"identified_only"}),null==(e=this.siteApps)||e.onRemoteConfig(t),null==(r=this.sessionRecording)||r.onRemoteConfig(t),null==(s=this.autocapture)||s.onRemoteConfig(t),null==(n=this.heatmaps)||n.onRemoteConfig(t),this.surveys.onRemoteConfig(t),this.conversations.onRemoteConfig(t),this.productTours.onRemoteConfig(t),null==(a=this.webVitalsAutocapture)||a.onRemoteConfig(t),null==(l=this.exceptionObserver)||l.onRemoteConfig(t),this.exceptions.onRemoteConfig(t),null==(u=this.deadClicksAutocapture)||u.onRemoteConfig(t)}Wr(){try{this.config.loaded(this)}catch(t){Pt.critical("`loaded` function failed",t)}this.Jr(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.Kr()}),1),new ro(this).load(),this.featureFlags.flags()}Jr(){var t;this.is_capturing()&&(this.config.request_batching&&(null==(t=this.Ur)||t.enable()))}_dom_loaded(){this.is_capturing()&&Ft(this.__request_queue,(t=>this.zr(t))),this.__request_queue=[],this.Jr()}_handle_unload(){var t,i;this.config.request_batching?(this.Yr()&&this.capture("$pageleave"),null==(t=this.Ur)||t.unload(),null==(i=this.Hr)||i.unload()):this.Yr()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(Fo?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=ln(t.url,{ip:this.config.ip?1:0}),t.headers=g({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,s=g({},t);s.timeout=s.timeout||6e4,s.url=ln(s.url,{_:(new Date).getTime().toString(),ver:c.LIB_VERSION,compression:s.compression});var n=null!==(i=s.transport)&&void 0!==i?i:"fetch",o=dn.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(e=null==(r=Bt(o,(t=>t.transport===n)))?void 0:r.method)&&void 0!==e?e:o[0].method;if(!a)throw new Error("No available transport method");a(s)})(g({},t,{callback:i=>{var e,r;(this.rateLimiter.checkForLimiting(i),i.statusCode>=400)&&(null==(e=(r=this.config).on_request_error)||e.call(r,i));null==t.callback||t.callback(i)}}))))}zr(t){this.Hr?this.Hr.retriableRequest(t):this._send_request(t)}_execute_array(t){var i,e=[],r=[],s=[];Ft(t,(t=>{t&&(i=t[0],C(i)?s.push(t):I(t)?t.call(this):C(t)&&"alias"===i?e.push(t):C(t)&&-1!==i.indexOf("capture")&&I(this[i])?s.push(t):r.push(t))}));var n=function(t,i){Ft(t,(function(t){if(C(t[0])){var e=i;Mt(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else this[t[0]].apply(this,t.slice(1))}),i)};n(e,this),n(r,this),n(s,this)}qr(){var t,i;return(null==(t=this.config.bootstrap)?void 0:t.featureFlags)&&Object.keys(null==(i=this.config.bootstrap)?void 0:i.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,i,e){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ur){if(this.is_capturing())if(!M(t)&&O(t)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var n=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==n||!n.isRateLimited){null!=i&&i.$current_url&&!O(null==i?void 0:i.$current_url)&&(Pt.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$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 o=new Date,a=(null==e?void 0:e.timestamp)||o,l=Se(),u={uuid:l,event:t,properties:this.calculateEventProperties(t,i||{},a,l)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),n&&(u.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),(null==e?void 0:e.$set)&&(u.$set=null==e?void 0:e.$set);var h,d="$groupidentify"!==t,v=this.Xr(null==e?void 0:e.$set_once,d);if(v&&(u.$set_once=v),(u=Ut(u,null!=e&&e._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,M(null==e?void 0:e.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),t===Ln.DISMISSED||t===Ln.SENT){var c=null==i?void 0:i[Nn.SURVEY_ID],f=null==i?void 0:i[Nn.SURVEY_ITERATION];h={id:c,current_iteration:f},localStorage.getItem(Vn(h))||localStorage.setItem(Vn(h),"true"),u.$set=g({},u.$set,{[Gn({id:c,current_iteration:f},t===Ln.SENT?"responded":"dismissed")]:!0})}var p=g({},u.properties.$set,u.$set);if(F(p)||this.setPersonPropertiesForFlags(p),!j(this.config.before_send)){var _=this.Qr(u);if(!_)return;u=_}this.Rr.emit("eventCaptured",u);var m={method:"POST",url:null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:null==e?void 0:e._batchKey};return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly?this.zr(m):this.Ur.enqueue(m),u}Pt.critical("This capture call is ignored due to client rate limiting.")}}else Pt.error("No event name provided to posthog.capture")}else Pt.uninitializedWarning("posthog.capture")}Ni(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(t,i,e,r,s){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;var n=s?void 0:this.persistence.remove_event_timer(t),a=g({},i);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"===t){var l=g({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!O(a.distinct_id)&&!L(a.distinct_id)||A(a.distinct_id))&&Pt.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,h=gs(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(s,e.getTime());a.$session_id=v,a.$window_id=c}this.sessionPropsManager&&Ot(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Ot(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(f=this.Hr)?void 0:f.length}catch(t){a.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===mo.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u="$pageview"!==t||s?"$pageleave"!==t||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,r),a=Ot(a,u),"$pageview"===t&&o&&(a.title=o.title),!M(n)){var p=e.getTime()-n;a.$duration=parseFloat((p/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ot({},h,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),C(this.config.property_denylist)?Mt(this.config.property_denylist,(function(t){delete a[t]})):Pt.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(Pt.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,t));var m=this.Zr();return a.$process_person_profile=m,m&&!s&&this.ts("_calculate_event_properties"),a}Xr(t,i){var e;if(void 0===i&&(i=!0),!this.persistence||!this.Zr())return t;if(this.Ir)return t;var r=this.persistence.get_initial_props(),s=null==(e=this.sessionPropsManager)?void 0:e.getSetOnceProps(),n=Ot({},r,s||{},t||{}),o=this.config.sanitize_properties;return o&&(Pt.error("sanitize_properties is deprecated. Use before_send instead"),n=o(n,"$set_once")),i&&(this.Ir=!0),F(n)?void 0:n}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i;null==(i=this.sessionPersistence)||i.register(t)}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t)}es(t,i){this.register({[t]:i})}getFeatureFlag(t,i){return this.featureFlags.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(i)}catch(t){return i}}isFeatureEnabled(t,i){return this.featureFlags.isFeatureEnabled(t,i)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,i,e){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){return void 0===i&&(i=!1),this.featureFlags.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Rr.on(t,i)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys.getSurveys(t,i)}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys.getActiveMatchingSurveys(t,i)}renderSurvey(t,i){this.surveys.renderSurvey(t,i)}displaySurvey(t,i){void 0===i&&(i=Kn),this.surveys.displaySurvey(t,i)}cancelPendingSurvey(t){this.surveys.cancelPendingSurvey(t)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}canRenderSurveyAsync(t,i){return void 0===i&&(i=!1),this.surveys.canRenderSurveyAsync(t,i)}identify(t,i,e){if(!this.__loaded||!this.persistence)return Pt.uninitializedWarning("posthog.identify");if(L(t)&&(t=t.toString(),Pt.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))Pt.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(t!==wi){if(this.ts("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}t!==r&&t!==this.get_property(Gt)&&(this.unregister(Gt),this.register({distinct_id:t}));var n="anonymous"===(this.persistence.get_property(ci)||"anonymous");t!==r&&n?(this.persistence.set_property(ci,"identified"),this.setPersonPropertiesForFlags(g({},e||{},i||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.Ar=cn(t,i,e),this.featureFlags.setAnonymousDistinctId(r)):(i||e)&&this.setPersonProperties(i,e),t!==r&&(this.reloadFeatureFlags(),this.unregister(vi))}}else Pt.critical('The string "'+wi+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Pt.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,i){if((t||i)&&this.ts("posthog.setPersonProperties")){var e=cn(this.get_distinct_id(),t,i);this.Ar!==e?(this.setPersonPropertiesForFlags(g({},i||{},t||{})),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Ar=e):Pt.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,e){if(t&&i){var r=this.getGroups();r[t]!==i&&this.resetGroupPropertiesForFlags(t),this.register({$groups:g({},r,{[t]:i})}),e&&(this.capture("$groupidentify",{$group_type:t,$group_key:i,$group_set:e}),this.setGroupPropertiesForFlags({[t]:e})),r[t]===i||e||this.reloadFeatureFlags()}else Pt.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.featureFlags.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0),this.ts("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,i)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s;if(Pt.info("reset"),!this.__loaded)return Pt.uninitializedWarning("posthog.reset");var n=this.get_property("$device_id");if(this.consent.reset(),null==(i=this.persistence)||i.clear(),null==(e=this.sessionPersistence)||e.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(ci,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this.Ar=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:wi,$device_id:null},"");else{var o=this.config.get_device_id(Se());this.register_once({distinct_id:o,$device_id:t?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 t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(Wt)?(Pt.critical("Attempting to create alias for existing People user - aborting."),-2):this.ts("posthog.alias")?(M(i)&&(i=this.get_distinct_id()),t!==i?(this.es(Gt,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Pt.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=g({},this.config);if(R(t)){var e,r,s,n,o;Ot(this.config,Oo(t));var a=this.Nr();null==(e=this.persistence)||e.update_config(this.config,i,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Fn(g({},this.config,{persistence:"sessionStorage"}),a);var l=this.Dr(this.config.debug);N(l)&&(this.config.debug=l),N(this.config.debug)&&(this.config.debug?(c.DEBUG=!0,Re.H()&&Re.G("ph_debug","true"),Pt.info("set_config",{config:t,oldConfig:i,newConfig:g({},this.config)})):(c.DEBUG=!1,Re.H()&&Re.V("ph_debug"))),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(s=this.autocapture)||s.startIfEnabled(),null==(n=this.heatmaps)||n.startIfEnabled(),this.surveys.loadIfEnabled(),this.rs(),null==(o=this.externalIntegrations)||o.startIfEnabledOrStop()}}startSessionRecording(t){var i=!0===t,e={sampling:i||!(null==t||!t.sampling),linked_flag:i||!(null==t||!t.linked_flag),url_trigger:i||!(null==t||!t.url_trigger),event_trigger:i||!(null==t||!t.event_trigger)};if(Object.values(e).some(Boolean)){var r,s,n,o,a;if(null==(r=this.sessionManager)||r.checkAndGetSessionAndWindowId(),e.sampling)null==(s=this.sessionRecording)||s.overrideSampling();if(e.linked_flag)null==(n=this.sessionRecording)||n.overrideLinkedFlag();if(e.url_trigger)null==(o=this.sessionRecording)||o.overrideTrigger("url");if(e.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 t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){var e=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(g({},r,i))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:Ro;return i!==Ro&&(i=Ro+"."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property(ci))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property(ci))}Zr(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&F(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Gt])&&(null==(i=this.persistence)||null==(i=i.props)||!i[yi]))}Yr(){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.Zr()||this.ts("posthog.createPersonProfile")&&this.setPersonProperties({},{})}ts(t){return"never"===this.config.person_profiles?(Pt.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.es(yi,!0),!0)}Nr(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut(),i=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||t&&!!i}rs(){var t,i,e,r,s=this.Nr();(null==(t=this.persistence)?void 0:t.bi)!==s&&(null==(e=this.persistence)||e.set_disabled(s));(null==(i=this.sessionPersistence)?void 0:i.bi)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s));return s}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){var e,r;if("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())this.reset(!0),null==(e=this.sessionManager)||e.destroy(),this.sessionManager=new co(this),this.persistence&&(this.sessionPropsManager=new ho(this,this.sessionManager,this.persistence)),this.sessionRecording=new To(this),this.sessionRecording.startIfEnabledOrStop();if(this.consent.optInOut(!0),this.rs(),this.Jr(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),M(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)this.capture(null!==(r=null==t?void 0:t.captureEventName)&&void 0!==r?r:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this.Kr()}else Pt.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t,i;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.rs(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:wi,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.Kr())):Pt.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 t=this.consent.consent;return t===Le.GRANTED?"granted":t===Le.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.rs()}_is_bot(){return n?_o(n,this.config.custom_blocked_useragents):void 0}Kr(){o&&("visible"===o.visibilityState?this.Fr||(this.Fr=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}),this.Mr&&(o.removeEventListener("visibilitychange",this.Mr),this.Mr=null)):this.Mr||(this.Mr=this.Kr.bind(this),qt(o,"visibilitychange",this.Mr)))}debug(i){!1===i?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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}))}O(){var t,i,e,r,s,n,o,a=this.jr||{};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?(Pt.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):(e="advanced_disable_decide",r=!1,s=Pt,n=(i="advanced_disable_flags")in(t=a)&&!M(t[i]),o=e in t&&!M(t[e]),n?t[i]:o?(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e]):r)}Qr(t){if(j(this.config.before_send))return t;var i=C(this.config.before_send)?this.config.before_send:[this.config.before_send],e=t;for(var r of i){if(e=r(e),j(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return z(t.event)?Pt.warn(s+". This can cause unexpected behavior."):Pt.info(s),null}e.properties&&!F(e.properties)||Pt.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return e}getPageViewId(){var t;return null==(t=this.pageViewManager.Vt)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Dr(t){var i=N(t)&&!t,e=Re.H()&&"true"===Re.q("ph_debug");return!i&&(!!e||t)}}!function(t,i){for(var e=0;e<i.length;e++)t.prototype[i[e]]=Lt(t.prototype[i[e]])}(Do,["identify"]);var jo,Lo;jo=Co[Ro]=new Do,(Lo=v.posthog)&&Mt(Lo._i,(function(t){if(t&&C(t)){var i=jo.init(t[0],t[1],t[2]),e=Lo[t[2]]||Lo;i&&(i._execute_array.call(i.people,e.people),i._execute_array(e))}})),v.posthog=jo,function(){function i(){i.done||(i.done=!0,Fo=!1,Mt(Co,(function(t){t._dom_loaded()})))}null!=o&&o.addEventListener?"complete"===o.readyState?i():qt(o,"DOMContentLoaded",i,{capture:!1}):t&&Pt.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}();
2
2
  //# sourceMappingURL=array.js.map