1var d=typeof window<"u"?window:void 0,Y=typeof globalThis<"u"?globalThis:d,ts=Array.prototype,rr=ts.forEach,sr=ts.indexOf,Z=Y==null?void 0:Y.navigator,b=Y==null?void 0:Y.document,z=Y==null?void 0:Y.location,_i=Y==null?void 0:Y.fetch,mi=Y!=null&&Y.XMLHttpRequest&&"withCredentials"in new Y.XMLHttpRequest?Y.XMLHttpRequest:void 0,nr=Y==null?void 0:Y.AbortController,V=Z==null?void 0:Z.userAgent,x=d??{},$e={DEBUG:!1,LIB_VERSION:"1.275.2"};function ar(r,e,t,i,s,n,a){try{var o=r[n](a),l=o.value}catch(u){return void t(u)}o.done?e(l):Promise.resolve(l).then(i,s)}function or(r){return function(){var e=this,t=arguments;return new Promise((function(i,s){var n=r.apply(e,t);function a(l){ar(n,i,s,a,o,"next",l)}function o(l){ar(n,i,s,a,o,"throw",l)}a(void 0)}))}}function w(){return w=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},w.apply(null,arguments)}function is(r,e){if(r==null)return{};var t={};for(var i in r)if({}.hasOwnProperty.call(r,i)){if(e.indexOf(i)!==-1)continue;t[i]=r[i]}return t}var fn=["$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 k(r,e){return r.indexOf(e)!==-1}var Xt=function(r){return r.trim()},yi=function(r){return r.replace(/^\$/,"")},gn=Array.isArray,rs=Object.prototype,ss=rs.hasOwnProperty,Jt=rs.toString,T=gn||function(r){return Jt.call(r)==="[object Array]"},Ie=r=>typeof r=="function",G=r=>r===Object(r)&&!T(r),We=r=>{if(G(r)){for(var e in r)if(ss.call(r,e))return!1;return!0}return!1},_=r=>r===void 0,L=r=>Jt.call(r)=="[object String]",bi=r=>L(r)&&r.trim().length===0,ye=r=>r===null,O=r=>_(r)||ye(r),pe=r=>Jt.call(r)=="[object Number]",_t=r=>Jt.call(r)==="[object Boolean]",vn=r=>r instanceof FormData,_n=r=>k(fn,r);function wi(r){return r===null||typeof r!="object"}function Mt(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function ns(r){return!_(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(r,Event)}var mn=[!0,"true",1,"1","yes"],ii=r=>k(mn,r),yn=[!1,"false",0,"0","no"];function ce(r,e,t,i,s){return e>t&&(i.warn("min cannot be greater than max."),e=t),pe(r)?r>t?(i.warn(" cannot be greater than max: "+t+". Using max value instead."),t):r<e?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):r:(i.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+s),ce(s||t,e,t,i))}class bn{constructor(e){this.t=e,this.i={},this.o=()=>{Object.keys(this.i).forEach((t=>{var i=this.h(t)+this.m;i>=this.S?delete this.i[t]:this.$(t,i)}))},this.h=t=>this.i[String(t)],this.$=(t,i)=>{this.i[String(t)]=i},this.consumeRateLimit=t=>{var i,s,n=(i=this.h(t))!==null&&i!==void 0?i:this.S;if((n=Math.max(n-1,0))===0)return!0;this.$(t,n);var a=n===0;return a&&((s=this.k)==null||s.call(this,t)),a},this.k=this.t.k,this.S=ce(this.t.bucketSize,0,100,this.t.P),this.m=ce(this.t.refillRate,0,this.S,this.t.P),this.T=ce(this.t.refillInterval,0,864e5,this.t.P),this.I=setInterval((()=>{this.o()}),this.T)}stop(){this.I&&(clearInterval(this.I),this.I=void 0)}}var St,lr,ri,wn=r=>r instanceof Error;function En(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return ri&&t.length===lr||(lr=t.length,ri=t.reduce(((i,s)=>{St||(St={});var n=St[s];if(n)i[n[0]]=n[1];else for(var a=r(s),o=a.length-1;o>=0;o--){var l=a[o],u=l==null?void 0:l.filename,c=e[s];if(u&&c){i[u]=c,St[s]=[u,c];break}}return i}),{})),ri}}var Xe="?";function Ei(r,e,t,i){var s={platform:"web:javascript",filename:r,function:e==="<anonymous>"?Xe:e,in_app:!0};return _(t)||(s.lineno=t),_(i)||(s.colno=i),s}var as=(r,e)=>{var t=r.indexOf("safari-extension")!==-1,i=r.indexOf("safari-web-extension")!==-1;return t||i?[r.indexOf("@")!==-1?r.split("@")[0]:Xe,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},xn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,kn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Sn=/\((\S*)(?::(\d+))(?::(\d+))\)/,Pn=r=>{var e=xn.exec(r);if(e){var[,t,i,s]=e;return Ei(t,Xe,+i,+s)}var n=kn.exec(r);if(n){if(n[2]&&n[2].indexOf("eval")===0){var a=Sn.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}var[o,l]=as(n[1]||Xe,n[2]);return Ei(l,o,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},$n=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Fn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,In=r=>{var e=$n.exec(r);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var t=Fn.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}var i=e[3],s=e[1]||Xe;return[s,i]=as(s,i),Ei(i,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ur=/\(error: (.*)\)/,cr=50;function Rn(){for(var r=arguments.length,e=new Array(r),t=0;t<r;t++)e[t]=arguments[t];return function(i,s){s===void 0&&(s=0);for(var n=[],a=i.split(` 2`),o=s;o<a.length;o++){var l=a[o];if(!(l.length>1024)){var u=ur.test(l)?l.replace(ur,"$1"):l;if(!u.match(/\S*Error: /)){for(var c of e){var h=c(u);if(h){n.push(h);break}}if(n.length>=cr)break}}}return(function(f){if(!f.length)return[];var p=Array.from(f);return p.reverse(),p.slice(0,cr).map((v=>{return w({},v,{filename:v.filename||(g=p,g[g.length-1]||{}).filename,function:v.function||Xe});var g}))})(n)}}class Cn{constructor(e,t,i){e===void 0&&(e=[]),t===void 0&&(t=[]),i===void 0&&(i=[]),this.coercers=e,this.modifiers=i,this.stackParser=Rn(...t)}buildFromUnknown(e,t){t===void 0&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(),a=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(a,i),$exception_level:"error"}}modifyFrames(e){var t=this;return or((function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&T(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),w({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map((i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i)))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return or((function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i}))()}convertToExceptionList(e,t){var i,s,n,a={type:e.type,value:e.value,mechanism:{type:(i=t.type)!==null&&i!==void 0?i:"generic",handled:(s=t.handled)===null||s===void 0||s,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,w({},t,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:En(this.stackParser)}}buildCoercingContext(e,t,i){i===void 0&&(i=0);var s=(n,a)=>
2{if(a<=4){var o=this.buildCoercingContext(e,t,a);return this.applyCoercers(n,o)}};return w({},t,{syntheticException:i==0?t.syntheticException:void 0,mechanism:e,apply:n=>s(n,i),next:n=>s(n,i+1)})}}class Tn{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=L(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Mt(e,"DOMException")}isDOMError(e){return Mt(e,"DOMError")}}class An{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return i.error&&typeof i.error.message=="string"?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class On{constructor(){}match(e){return Mt(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var i,s=t.apply(e.error);return s||{type:"ErrorEvent",value:e.message,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}var Mn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Dn{match(e){return typeof e=="string"}coerce(e,t){var i,[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(Mn);return s&&(t=s[1],i=s[2]),[t,i]}}var Ln=["fatal","error","warning","log","info","debug"];function os(r,e){e===void 0&&(e=40);var t=Object.keys(r);if(t.sort(),!t.length)return"[object has no keys]";for(var i=t.length;i>0;i--){var s=t.slice(0,i).join(", ");if(!(s.length>e))return i===t.length||s.length<=e?s:s.slice(0,e)+"..."}return""}class Nn{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(i=t.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return ns(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+os(e)}isSeverityLevel(e){return L(e)&&!bi(e)&&Ln.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(wn(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class jn{match(e){return ns(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+os(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class qn{match(e){return wi(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class Un{match(e){return Mt(e,"PromiseRejectionEvent")}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return wi(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){if(wi(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var ls=r=>{var e={R:function(t){if(d&&($e.DEBUG||x.POSTHOG_DEBUG)&&!_(d.console)&&d.console){for(var i=("__rrweb_original__"in d.console[t])?d.console[t].__rrweb_original__:d.console[t],s=arguments.length,n=new Array(s>1?s-1:0),a=1;a<s;a++)n[a-1]=arguments[a];i(r,...n)}},info:function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];e.R("log",...i)},warn:function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];e.R("warn",...i)},error:function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];e.R("error",...i)},critical:function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];console.error(r,...i)},uninitializedWarning:t=>{e.error("You must initialize PostHog before calling "+t)},createLogger:t=>ls(r+" "+t)};return e},y=ls("[PostHog.js]"),j=y.createLogger,Hn=j("[ExternalScriptsLoader]"),hr=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return Hn.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var i=b==null?void 0:b.querySelectorAll("script");
2if(i){for(var s,n=function(){if(i[a].src===e){var l=i[a];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(u=>{l.__posthog_loading_callback_fired=!0,t(void 0,u)})),l.onerror=u=>t(u),{v:void 0})}},a=0;a<i.length;a++)if(s=n())return s.v}var o=()=>{if(!b)return t("document not found");var l=b.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),r.config.prepare_external_dependency_script&&(l=r.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");var u,c=b.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)==null||u.insertBefore(l,c[0]):b.body.appendChild(l)};b!=null&&b.body?o():b==null||b.addEventListener("DOMContentLoaded",o)};x.__PosthogExtensions__=x.__PosthogExtensions__||{},x.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var i="/static/"+e+".js?v="+r.version;if(e==="remote-config"&&(i="/array/"+r.config.token+"/config.js"),e==="toolbar"){var s=3e5;i=i+"&t="+Math.floor(Date.now()/s)*s}var n=r.requestRouter.endpointFor("assets",i);hr(r,n,t)},x.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var i=r.requestRouter.endpointFor("api",e);hr(r,i,t)};var Dt={};function Re(r,e,t){if(T(r)){if(rr&&r.forEach===rr)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var i=0,s=r.length;i<s;i++)if(i in r&&e.call(t,r[i],i)===Dt)return}}}function C(r,e,t){if(!O(r)){if(T(r))return Re(r,e,t);if(vn(r)){for(var i of r.entries())if(e.call(t,i[1],i[0])===Dt)return}else for(var s in r)if(ss.call(r,s)&&e.call(t,r[s],s)===Dt)return}}var M=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Re(t,(function(s){for(var n in s)s[n]!==void 0&&(r[n]=s[n])})),r},Ze=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Re(t,(function(s){Re(s,(function(n){r.push(n)}))})),r};function Tt(r){for(var e=Object.keys(r),t=e.length,i=new Array(t);t--;)i[t]=[e[t],r[e[t]]];return i}var dr=function(r){try{return r()}catch{return}},Gn=function(r){return function(){try{for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r.apply(this,t)}catch(s){y.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),y.critical(s)}}},Hi=function(r){var e={};return C(r,(function(t,i){(L(t)&&t.length>0||pe(t))&&(e[i]=t)})),e};function Bn(r,e){return t=r,i=n=>L(n)&&!ye(e)?n.slice(0,e):n,s=new Set,(function n(a,o){return a!==Object(a)?i?i(a,o):a:s.has(a)?void 0:(s.add(a),T(a)?(l=[],Re(a,(u=>{l.push(n(u))}))):(l={},C(a,((u,c)=>{s.has(u)||(l[c]=n(u,c))}))),l);var l})(t);var t,i,s}var Wn=["herokuapp.com","vercel.app","netlify.app"];function Vn(r){var e=r==null?void 0:r.hostname;if(!L(e))return!1;var t=e.split(".").slice(-2).join(".");for(var i of Wn)if(t===i)return!1;return!0}function us(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function N(r,e,t,i){var{capture:s=!1,passive:n=!0}=i??{};r==null||r.addEventListener(e,t,{capture:s,passive:n})}var cs="$people_distinct_id",lt="__alias",ut="__timers",pr="$autocapture_disabled_server_side",xi="$heatmaps_enabled_server_side",fr="$exception_capture_enabled_server_side",ki="$error_tracking_suppression_rules",gr="$error_tracking_capture_extension_exceptions",vr="$web_vitals_enabled_server_side",hs="$dead_clicks_enabled_server_side",_r="$web_vitals_allowed_metrics",si="$session_recording_remote_config",Lt="$sesid",ds="$session_is_sampled",Ve="$enabled_feature_flags",ct="$early_access_features",Si="$feature_flag_details",ht="$stored_person_properties",De="$stored_group_properties",Pi="$surveys",Pt="$surveys_activated",Nt="$flag_call_reported",ve="$user_state",$i="$client_session_props",Fi="$capture_rate_limit",Ii="$initial_campaign_params",Ri="$initial_referrer_info",jt="$initial_person_info",qt="$epp",ps="__POSTHOG_TOOLBAR__",tt="$posthog_cookieless",zn=[cs,lt,"__cmpns",ut,"$session_recording_enabled_server_side",xi,Lt,Ve,ki,ve,ct,Si,De,ht,Pi,Nt,$
2i,Fi,Ii,Ri,qt,jt];function mr(r){return r instanceof Element&&(r.id===ps||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function Kt(r){return!!r&&r.nodeType===1}function Ce(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function fs(r){return!!r&&r.nodeType===3}function gs(r){return!!r&&r.nodeType===11}function Gi(r){return r?Xt(r).split(/\s+/):[]}function yr(r){var e=d==null?void 0:d.location.href;return!!(e&&r&&r.some((t=>e.match(t))))}function Ut(r){var e="";switch(typeof r.className){case"string":e=r.className;break;case"object":e=(r.className&&"baseVal"in r.className?r.className.baseVal:null)||r.getAttribute("class")||"";break;default:e=""}return Gi(e)}function vs(r){return O(r)?null:Xt(r).split(/(\s+)/).filter((e=>mt(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Qt(r){var e="";return Ci(r)&&!ws(r)&&r.childNodes&&r.childNodes.length&&C(r.childNodes,(function(t){var i;fs(t)&&t.textContent&&(e+=(i=vs(t.textContent))!==null&&i!==void 0?i:"")})),Xt(e)}function _s(r){return _(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var Bi=["a","button","form","input","select","textarea","label"];function ms(r,e){if(_(e))return!0;var t,i=function(n){if(e.some((a=>n.matches(a))))return{v:!0}};for(var s of r)if(t=i(s))return t.v;return!1}function ys(r){var e=r.parentNode;return!(!e||!Kt(e))&&e}var br=[".ph-no-rageclick",".ph-no-capture"],Wi=r=>!r||Ce(r,"html")||!Kt(r),bs=(r,e)=>{if(!d||Wi(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,i=[r],s=r;s.parentNode&&!Ce(s,"body");)if(gs(s.parentNode))i.push(s.parentNode.host),s=s.parentNode.host;else{var n=ys(s);if(!n)break;if(e||Bi.indexOf(n.tagName.toLowerCase())>-1)t=!0;else{var a=d.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(t=!0)}i.push(n),s=n}return{parentIsUsefulElement:t,targetElementList:i}};function Yn(r,e,t,i,s){var n,a,o,l;if(t===void 0&&(t=void 0),!d||Wi(r)||(n=t)!=null&&n.url_allowlist&&!yr(t.url_allowlist)||(a=t)!=null&&a.url_ignorelist&&yr(t.url_ignorelist))return!1;if((o=t)!=null&&o.dom_event_allowlist){var u=t.dom_event_allowlist;if(u&&!u.some((v=>e.type===v)))return!1}var{parentIsUsefulElement:c,targetElementList:h}=bs(r,i);if(!(function(v,g){var m=g==null?void 0:g.element_allowlist;if(_(m))return!0;var E,$=function(S){if(m.some((R=>S.tagName.toLowerCase()===R)))return{v:!0}};for(var P of v)if(E=$(P))return E.v;return!1})(h,t)||!ms(h,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var f=d.getComputedStyle(r);if(f&&f.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var p=r.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return c?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Bi.indexOf(p)>-1||r.getAttribute("contenteditable")==="true")}}function Ci(r){for(var e=r;e.parentNode&&!Ce(e,"body");e=e.parentNode){var t=Ut(e);if(k(t,"ph-sensitive")||k(t,"ph-no-capture"))return!1}if(k(Ut(r),"ph-include"))return!0;var i=r.type||"";if(L(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var s=r.name||r.id||"";return!(L(s)&&/^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,"")))}function ws(r){return!!(Ce(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Ce(r,"select")||Ce(r,"textarea")||r.getAttribute("contenteditable")==="true")}var Es="(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})",Xn=new RegExp("^(?:"+Es+")$"),Jn=new RegExp(Es),xs="\\d{3}-?\\d{2}-?\\d{4}",Kn=new RegExp("^("+xs+")$"),Qn=new RegExp("("+xs+")");function mt(r,e){return e===void 0&&(e=!0),!(O(r)||L(r)&&(r=Xt(r),(e?Xn:Jn).test((r||"").replace(/[- ]/g,""))||(e?Kn:Qn).test(r)))}function ks(r){var e=Qt(r);return mt(e=(e+" "+Ss(r)).trim())?e:""}function Ss(r){var e="";return r&&r.childNodes&&r.childNodes.length&&C(r.childNodes,(function(t){var i;if(t&&((i=t.tagName)==null?void 0:i.toLowerCase())==="span")try{var s=Qt(t);e=(e+" "+s).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Ss(t)).trim())}catch(n){y.error("[AutoCapture]",n)}})),e}function Zn(r){return(function(e){var t=e.map((i=>{var s,n,a="";if(i.tag_name&&(a+=i.tag_name),i.attr_class)for(var o of(i.attr_class.sort(),i.attr_class))a+="."+o.replace(/"/g,"");var l=w({},i.text?{text:i.text}:{},{"nth-child":(s=i.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(n=i.nth_of_type)!==null&&n!==void 0?n:0},i.href?{href:i.href}:{},i.attr_id?{attr_id:i.attr_id}:{},i.attributes),u={};return Tt(l).sort(((c,h)=>{var[f]=c,[p]=h;return f.localeCompare(p)}
2)).forEach((c=>{var[h,f]=c;return u[wr(h.toString())]=wr(f.toString())})),a+=":",a+=Tt(u).map((c=>{var[h,f]=c;return h+'="'+f+'"'})).join("")}));return t.join(";")})((function(e){return e.map((t=>{var i,s,n={text:(i=t.$el_text)==null?void 0:i.slice(0,400),tag_name:t.tag_name,href:(s=t.attr__href)==null?void 0:s.slice(0,2048),attr_class:ea(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Tt(t).filter((a=>{var[o]=a;return o.indexOf("attr__")===0})).forEach((a=>{var[o,l]=a;return n.attributes[o]=l})),n}))})(r))}function wr(r){return r.replace(/"|\\"/g,'\\"')}function ea(r){var e=r.attr__class;return e?T(e)?e:Gi(e):void 0}class Ps{constructor(){this.clicks=[]}isRageClick(e,t,i){var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<30&&i-s.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var ni="$copy_autocapture",me=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),Ht=r=>{var e=b==null?void 0:b.createElement("a");return _(e)?null:(e.href=r,e)},ta=function(r,e){var t,i;e===void 0&&(e="&");var s=[];return C(r,(function(n,a){_(n)||_(a)||a==="undefined"||(t=encodeURIComponent((o=>o instanceof File)(n)?n.name:n.toString()),i=encodeURIComponent(a),s[s.length]=i+"="+t)})),s.join(e)},Gt=function(r,e){for(var t,i=((r.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<i.length;s++){var n=i[s].split("=");if(n[0]===e){t=n;break}}if(!T(t)||t.length<2)return"";var a=t[1];try{a=decodeURIComponent(a)}catch{y.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},xt=function(r,e,t){if(!r||!e||!e.length)return r;for(var i=r.split("#"),s=i[0]||"",n=i[1],a=s.split("?"),o=a[1],l=a[0],u=(o||"").split("&"),c=[],h=0;h<u.length;h++){var f=u[h].split("=");T(f)&&(e.includes(f[0])?c.push(f[0]+"="+t):c.push(u[h]))}var p=l;return o!=null&&(p+="?"+c.join("&")),n!=null&&(p+="#"+n),p},Bt=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Er=j("[AutoCapture]");function ai(r,e){return e.length>r?e.slice(0,r)+"...":e}function ia(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!Kt(e));return e}function ra(r,e,t,i){var s=r.tagName.toLowerCase(),n={tag_name:s};Bi.indexOf(s)>-1&&!t&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?n.$el_text=ai(1024,ks(r)):n.$el_text=ai(1024,Qt(r)));var a=Ut(r);a.length>0&&(n.classes=a.filter((function(c){return c!==""}))),C(r.attributes,(function(c){var h;if((!ws(r)||["name","id","class","aria-label"].indexOf(c.name)!==-1)&&(i==null||!i.includes(c.name))&&!e&&mt(c.value)&&(h=c.name,!L(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var f=c.value;c.name==="class"&&(f=Gi(f).join(" ")),n["attr__"+c.name]=ai(1024,f)}}));for(var o=1,l=1,u=r;u=ia(u);)o++,u.tagName===r.tagName&&l++;return n.nth_child=o,n.nth_of_type=l,n}function sa(r,e){for(var t,i,{e:s,maskAllElementAttributes:n,maskAllText:a,elementAttributeIgnoreList:o,elementsC
2hainAsString:l}=e,u=[r],c=r;c.parentNode&&!Ce(c,"body");)gs(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var h,f=[],p={},v=!1,g=!1;if(C(u,(S=>{var R=Ci(S);S.tagName.toLowerCase()==="a"&&(v=S.getAttribute("href"),v=R&&v&&mt(v)&&v),k(Ut(S),"ph-no-capture")&&(g=!0),f.push(ra(S,n,a,o));var U=(function(J){if(!Ci(J))return{};var F={};return C(J.attributes,(function(ae){if(ae.name&&ae.name.indexOf("data-ph-capture-attribute")===0){var K=ae.name.replace("data-ph-capture-attribute-",""),se=ae.value;K&&se&&mt(se)&&(F[K]=se)}})),F})(S);M(p,U)})),g)return{props:{},explicitNoCapture:g};if(a||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?f[0].$el_text=ks(r):f[0].$el_text=Qt(r)),v){var m,E;f[0].attr__href=v;var $=(m=Ht(v))==null?void 0:m.host,P=d==null||(E=d.location)==null?void 0:E.host;$&&P&&$!==P&&(h=v)}return{props:M({$event_type:s.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:Zn(f)},(t=f[0])!=null&&t.$el_text?{$el_text:(i=f[0])==null?void 0:i.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},p)}}class na{constructor(e){this.C=!1,this.O=null,this.rageclicks=new Ps,this.F=!1,this.instance=e,this.M=null}get A(){var e,t,i=G(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)==null?void 0:e.map((s=>new RegExp(s))),i.url_ignorelist=(t=i.url_ignorelist)==null?void 0:t.map((s=>new RegExp(s))),i}j(){if(this.isBrowserSupported()){if(d&&b){var e=i=>{i=i||(d==null?void 0:d.event);try{this.D(i)}catch(s){Er.error("Failed to capture event",s)}};if(N(b,"submit",e,{capture:!0}),N(b,"change",e,{capture:!0}),N(b,"click",e,{capture:!0}),this.A.capture_copied_text){var t=i=>{i=i||(d==null?void 0:d.event),this.D(i,ni)};N(b,"copy",t,{capture:!0}),N(b,"cut",t,{capture:!0})}}}else Er.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.C&&(this.j(),this.C=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.F=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[pr]:!!e.autocapture_opt_out}),this.O=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.M=e}getElementSelectors(e){var t,i=[];return(t=this.M)==null||t.forEach((s=>{var n=b==null?void 0:b.querySelectorAll(s);n==null||n.forEach((a=>{e===a&&i.push(s)}))})),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)==null?void 0:e.props[pr],s=this.O;if(ye(s)&&!_t(i)&&!this.instance.L())return!1;var n=(t=this.O)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!n}D(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i,s=_s(e);fs(s)&&(s=s.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&(function(f,p){if(!d||Wi(f))return!1;var v,g;if((v=_t(p)?!!p&&br:(g=p==null?void 0:p.css_selector_ignorelist)!==null&&g!==void 0?g:br)===!1)return!1;var{targetElementList:m}=bs(f,!1);return!ms(m,v)})(s,this.instance.config.rageclick)&&this.D(e,"$rageclick");var n=t===ni;if(s&&Yn(s,e,this.A,n,n?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=sa(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.A.element_attribute_ignorelist,elementsChainAsString:this.F});if(o)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(a.$element_selectors=l),t===ni){var u,c=vs(d==null||(u=d.getSelection())==null?void 0:u.toString()),h=e.type||"clipboard";if(!c)return!1;a.$selected_content=c,a.$copy_type=h}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return Ie(b==null?void 0:b.querySelectorAll)}}Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return pe(r)&&isFinite(r)&&Math.floor(r)===r});var xr="0123456789abcdef";class Wt{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||e<0||t<0||i<0||s<0||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new Wt(n)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+xr.charAt(this.bytes[t]>>>4)+xr.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Wt(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}}class aa{constructor(){this.N=0,this.U=0,this.H=new oa}generate(){var e=this.generateOrAbort();if(_(e)){this.N=0;var t=this.generateOrAbort();if(_(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.N)this.N=e,this.B();else{if(!(e+1e4>this.N))return;this.U++,this.U>4398046511103&&(this.N++,this.B())}return Wt.fromFieldsV7(this.N,Math.trunc(this.U/Math.pow(2,30)),this.U&Math.pow(2,30)-1,this.H.nextUint32())}B(){this.U=1024*this.H.nextUint32()+(1023&this.H.nextUint32())}}var kr,$s=r=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<r.length;
2e++)r[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return r};d&&!_(d.crypto)&&crypto.getRandomValues&&($s=r=>crypto.getRandomValues(r));class oa{constructor(){this.q=new Uint32Array(8),this.W=1/0}nextUint32(){return this.W>=this.q.length&&($s(this.q),this.W=0),this.q[this.W++]}}var Fe=()=>la().toString(),la=()=>(kr||(kr=new aa)).generate(),it="",ua=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function ca(r,e){if(e){var t=(function(s,n){if(n===void 0&&(n=b),it)return it;if(!n||["localhost","127.0.0.1"].includes(s))return"";for(var a=s.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Fe();!it&&o--;){var u=a.slice(o).join("."),c=l+"=1;domain=."+u+";path=/";n.cookie=c+";max-age=3",n.cookie.includes(l)&&(n.cookie=c+";max-age=0",it=u)}return it})(r);if(!t){var i=(s=>{var n=s.match(ua);return n?n[0]:""})(r);i!==t&&y.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}var de={G:()=>!!b,V:function(r){y.error("cookieStore error: "+r)},J:function(r){if(b){try{for(var e=r+"=",t=b.cookie.split(";").filter((n=>n.length)),i=0;i<t.length;i++){for(var s=t[i];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},K:function(r){var e;try{e=JSON.parse(de.J(r))||{}}catch{}return e},Y:function(r,e,t,i,s){if(b)try{var n="",a="",o=ca(b.location.hostname,i);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),n="; expires="+l.toUTCString()}s&&(a="; secure");var u=r+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return u.length>3686.4&&y.warn("cookieStore warning: large cookie, len="+u.length),b.cookie=u,u}catch{return}},X:function(r,e){if(b!=null&&b.cookie)try{de.Y(r,"",-1,e)}catch{return}}},oi=null,D={G:function(){if(!ye(oi))return oi;var r=!0;if(_(d))r=!1;else try{var e="__mplssupport__";D.Y(e,"xyz"),D.J(e)!=='"xyz"'&&(r=!1),D.X(e)}catch{r=!1}return r||y.error("localStorage unsupported; falling back to cookie store"),oi=r,r},V:function(r){y.error("localStorage error: "+r)},J:function(r){try{return d==null?void 0:d.localStorage.getItem(r)}catch(e){D.V(e)}return null},K:function(r){try{return JSON.parse(D.J(r))||{}}catch{}return null},Y:function(r,e){try{d==null||d.localStorage.setItem(r,JSON.stringify(e))}catch(t){D.V(t)}},X:function(r){try{d==null||d.localStorage.removeItem(r)}catch(e){D.V(e)}}},ha=["distinct_id",Lt,ds,qt,jt],$t=w({},D,{K:function(r){try{var e={};try{e=de.K(r)||{}}catch{}var t=M(e,JSON.parse(D.J(r)||"{}"));return D.Y(r,t),t}catch{}return null},Y:function(r,e,t,i,s,n){try{D.Y(r,e,void 0,void 0,n);var a={};ha.forEach((o=>{e[o]&&(a[o]=e[o])})),Object.keys(a).length&&de.Y(r,a,t,i,s,n)}catch(o){D.V(o)}},X:function(r,e){try{d==null||d.localStorage.removeItem(r),de.X(r,e)}catch(t){D.V(t)}}}),Ft={},da={G:function(){return!0},V:function(r){y.error("memoryStorage error: "+r)},J:function(r){return Ft[r]||null},K:function(r){return Ft[r]||null},Y:function(r,e){Ft[r]=e},X:function(r){delete Ft[r]}},Ae=null,q={G:function(){if(!ye(Ae))return Ae;if(Ae=!0,_(d))Ae=!1;else try{var r="__support__";q.Y(r,"xyz"),q.J(r)!=='"xyz"'&&(Ae=!1),q.X(r)}catch{Ae=!1}return Ae},V:function(r){y.error("sessionStorage error: ",r)},J:function(r){try{return d==null?void 0:d.sessionStorage.getItem(r)}catch(e){q.V(e)}return null},K:function(r){try{return JSON.parse(q.J(r))||null}catch{}return null},Y:function(r,e){try{d==null||d.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){q.V(t)}},X:function(r){try{d==null||d.sessionStorage.removeItem(r)}catch(e){q.V(e)}}},_e=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({});class pa{constructor(e){this._instance=e}get A(){return this._instance.config}get consent(){return this.Z()?_e.DENIED:this.tt}isOptedOut(){return this.A.cookieless_mode==="always"||this.consent===_e.DENIED||this.consent===_e.PENDING&&(this.A.opt_out_capturing_by_default||this.A.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===_e.DENIED}optInOut(e){this.it.Y(this.et,e?1:0,this.A.cookie_expiration,this.A.cross_subdomain_cookie,this.A.secure_cookie)}reset(){this.it.X(this.et,this.A.cross_subdomain_cookie)}get et(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;
2return i||(t?t+e:"__ph_opt_in_out_"+e)}get tt(){var e=this.it.J(this.et);return ii(e)?_e.GRANTED:k(yn,e)?_e.DENIED:_e.PENDING}get it(){if(!this.rt){var e=this.A.opt_out_capturing_persistence_type;this.rt=e==="localStorage"?D:de;var t=e==="localStorage"?de:D;t.J(this.et)&&(this.rt.J(this.et)||this.optInOut(ii(t.J(this.et))),t.X(this.et,this.A.cross_subdomain_cookie))}return this.rt}Z(){return!!this.A.respect_dnt&&!!us([Z==null?void 0:Z.doNotTrack,Z==null?void 0:Z.msDoNotTrack,x.doNotTrack],(e=>ii(e)))}}var It=j("[Dead Clicks]"),fa=()=>!0,ga=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(hs)),i=r.instance.config.capture_dead_clicks;return _t(i)?i:t};class Fs{get lazyLoadedDeadClicksAutocapture(){return this.st}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[hs]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.nt((()=>{this.ot()}))}nt(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?It.error("failed to load script",s):e()}))}ot(){var e;if(b){if(!this.st&&(e=x.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=G(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.st=x.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.st.start(b),It.info("starting...")}}else It.error("`document` not found. Cannot start.")}stop(){this.st&&(this.st.stop(),this.st=void 0,It.info("stopping..."))}}var rt=j("[ExceptionAutocapture]");class va{constructor(e){var t,i,s;this.lt=()=>{var n;if(d&&this.isEnabled&&(n=x.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var a=x.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=x.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=x.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ut&&this.A.capture_unhandled_errors&&(this.ut=a(this.captureException.bind(this))),!this.ht&&this.A.capture_unhandled_rejections&&(this.ht=o(this.captureException.bind(this))),!this.dt&&this.A.capture_console_errors&&(this.dt=l(this.captureException.bind(this)))}catch(u){rt.error("failed to start",u),this.vt()}}},this._instance=e,this.ct=!((t=this._instance.persistence)==null||!t.props[fr]),this.A=this.ft(),this.gt=new bn({refillRate:(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,P:rt}),this.startIfEnabled()}ft(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return G(e)?t=w({},t,e):(_(e)?this.ct:e)&&(t=w({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.A.capture_console_errors||this.A.capture_unhandled_errors||this.A.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(rt.info("enabled"),this.nt(this.lt))}nt(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return rt.error("failed to load script",s);e()}))}vt(){var e,t,i;(e=this.ut)==null||e.call(this),this.ut=void 0,(t=this.ht)==null||t.call(this),this.ht=void 0,(i=this.dt)==null||i.call(this),this.dt=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ct=!!t||!1,this.A=this.ft(),this._instance.persistence&&this._instance.persistence.register({[fr]:this.ct}),this.startIfEnabled()}captureException(e){var t,i,s=(t=e==null||(i=e.$exception_list)==null||(i=i[0])==null?void 0:i.type)!==null&&t!==void 0?t:"Exception";this.gt.consumeRateLimit(s)?rt.info("Skipping exception capture because of client rate limiting.",{exception:s}):this._instance.exceptions.sendExceptionEvent(e)}}function Sr(r,e,t){try{if(!(e in r))return()=>{};var i=r[e],s=t(i);return Ie(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=s,()=>{r[e]=i}}catch{return()=>{}}}class _a{constructor(e){var t;this._instance=e,this._t=(d==null||(t=d.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(y.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.yt&&this.yt(),this.yt=void 0,y.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(d&&d.history){var i=this;(e=d.history.pushState)!=null&&e.__posthog_wrapped__||Sr(d.history,"pushState",(s=>
2function(n,a,o){s.call(this,n,a,o),i.bt("pushState")})),(t=d.history.replaceState)!=null&&t.__posthog_wrapped__||Sr(d.history,"replaceState",(s=>function(n,a,o){s.call(this,n,a,o),i.bt("replaceState")})),this.wt()}}bt(e){try{var t,i=d==null||(t=d.location)==null?void 0:t.pathname;if(!i)return;i!==this._t&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this._t=i}catch(s){y.error("Error capturing "+e+" pageview",s)}}wt(){if(!this.yt){var e=()=>{this.bt("popstate")};N(d,"popstate",e),this.yt=()=>{d&&d.removeEventListener("popstate",e)}}}}var li=j("[SegmentIntegration]");function ma(r,e){var t=r.config.segment;if(!t)return e();(function(i,s){var n=i.config.segment;if(!n)return s();var a=l=>{var u=()=>l.anonymousId()||Fe();i.config.get_device_id=u,l.id()&&(i.register({distinct_id:l.id(),$device_id:u()}),i.persistence.set_property(ve,"identified")),s()},o=n.user();"then"in o&&Ie(o.then)?o.then((l=>a(l))):a(o)})(r,(()=>{t.register((i=>{Promise&&Promise.resolve||li.warn("This browser does not have Promise support, and can not use the segment integration");var s=(n,a)=>{if(!a)return n;n.event.userId||n.event.anonymousId===i.get_distinct_id()||(li.info("No userId set, resetting PostHog"),i.reset()),n.event.userId&&n.event.userId!==i.get_distinct_id()&&(li.info("UserId set, identifying with PostHog"),i.identify(n.event.userId));var o=i.calculateEventProperties(a,n.event.properties);return n.event.properties=Object.assign({},o,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:n=>s(n,n.event.event),page:n=>s(n,"$pageview"),identify:n=>s(n,"$identify"),screen:n=>s(n,"$screen")}})(r)).then((()=>{e()}))}))}var Is="posthog-js";function Rs(r,e){var{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}=e===void 0?{}:e;return o=>{var l,u,c,h,f;if(!(n==="*"||n.includes(o.level))||!r.__loaded)return o;o.tags||(o.tags={});var p=r.requestRouter.endpointFor("ui","/project/"+r.config.token+"/person/"+r.get_distinct_id());o.tags["PostHog Person URL"]=p,r.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=r.get_session_replay_url({withTimestamp:!0}));var v=((l=o.exception)==null?void 0:l.values)||[],g=v.map((E=>w({},E,{stacktrace:E.stacktrace?w({},E.stacktrace,{type:"raw",frames:(E.stacktrace.frames||[]).map(($=>w({},$,{platform:"web:javascript"})))}):void 0}))),m={$exception_message:((u=v[0])==null?void 0:u.value)||o.message,$exception_type:(c=v[0])==null?void 0:c.type,$exception_level:o.level,$exception_list:g,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((h=v[0])==null?void 0:h.value)||o.message,$sentry_exception_type:(f=v[0])==null?void 0:f.type,$sentry_tags:o.tags};return t&&i&&(m.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),a&&r.exceptions.sendExceptionEvent(m),o}}class ya{constructor(e,t,i,s,n,a){this.name=Is,this.setupOnce=function(o){o(Rs(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}}var ba=d!=null&&d.location?Bt(d.location.hash,"__posthog")||Bt(location.hash,"state"):null,Pr="_postHogToolbarParams",$r=j("[Toolbar]"),Pe=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(Pe||{});class wa{constructor(e){this.instance=e}St(e){x.ph_toolbar_state=e}xt(){var e;return(e=x.ph_toolbar_state)!==null&&e!==void 0?e:Pe.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),!d||!b)return!1;e=e??d.location,i=i??d.history;try{if(!t){try{d.localStorage.setItem("test","test"),d.localStorage.removeItem("test")}catch{return!1}t=d==null?void 0:d.localStorage}var s,n=ba||Bt(e.hash,"__posthog")||Bt(e.hash,"state"),a=n?dr((()=>JSON.parse(atob(decodeURIComponent(n)))))||dr((()=>JSON.parse(decodeURIComponent(n)))):null;return a&&a.action==="ph_authorize"?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(Pr)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}Et(e){var t=x.ph_load_toolbar||x.ph_load_editor;!O(t)&&Ie(t)?t(e,this.instance):$r.warn("No toolbar load function found")}loadToolbar(e){var t=!(b==null||!b.getElementById(ps));if(!d||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=w({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(d.localStorage.setItem(Pr,JSON.stringify(w({},s,{source:void 0}))),this.xt()===Pe.LOADED)this.Et(s);else if(this.xt()===Pe.UNINITIALIZED){var n;this.St(Pe.LOADING),(n=x.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"toolbar",(a=>{if(a)return $r.error("[Toolbar] Failed to load",a),void this.St(Pe.UNINITIALIZED);this.St(Pe.LOADED),this.Et(s)})),N(d,"turbolinks:load",(()=>{this.St(Pe.UNINITIALIZED),this.loadToolbar(s)}))}return!0}$t(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}var Ea=j("[TracingHeaders]");class xa{constructor(e){this.kt=void 0,this.Pt=void 0,this.lt=()=>{var t,i;_(this.kt)&&((t=x.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),_(this.Pt)&&((i=x.__PosthogExtensions__)==null||(i=i.tracingHeadersPatchFns)==null||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}nt(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return Ea.error("failed to load script",s);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.nt(this.lt):((e=this.kt)==null||e.call(this),(t=this.Pt)==null||t.call(this),this.kt=void 0,this.Pt=void 0)}}var ie="Mobile",Vt="iOS",he="Android",yt="Tablet",Cs=he+" "+yt,Ts="iPad",As="Apple",Os=As+" Watch",bt="Safari",Je="BlackBerry",Ms="Samsung",Ds=Ms+"Browser",Ls=Ms+" Internet",Ne="Chrome",ka=Ne+" OS",Ns=Ne+" "+Vt,Vi="Internet Explorer",js=Vi+" "+ie,zi="Opera",Sa=zi+" Mini",Yi="Edge",qs="Microsoft "+Yi,ze="Firefox",Us=ze+" "+Vt,wt="Nintendo",Et="PlayStation",Ye="Xbox",Hs=he+" "+ie,Gs=ie+" "+bt,dt="Windows",Ti=dt+" Phone",Fr="Nokia",Ai="Ouya",Bs="Generic",Pa=Bs+" "+ie.toLowerCase(),Ws=Bs+" "+yt.toLowerCase(),Oi="Konqueror",W="(\\d+(\\.\\d+)?)",ui=new RegExp("Version/"+W),$a=new RegExp(Ye,"i"),Fa=new RegExp(Et+" \\w+","i"),Ia=new RegExp(wt+" \\w+","i"),Xi=new RegExp(Je+"|PlayBook|BB10","i"),Ra={"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"},Ca=(r,e)=>e&&k(e,As)||(function(t){return k(t,bt)&&!k(t,Ne)&&!k(t,he)})(r),Vs=function(r,e){return e=e||"",k(r," OPR/")&&k(r,"Mini")?Sa:k(r," OPR/")?zi:Xi.test(r)?Je:k(r,"IE"+ie)||k(r,"WPDesktop")?js:k(r,Ds)?Ls:k(r,Yi)||k(r,"Edg/")?qs:k(r,"FBIOS")?"Facebook "+ie:k(r,"UCWEB")||k(r,"UCBrowser")?"UC Browser":k(r,"CriOS")?Ns:k(r,"CrMo")||k(r,Ne)?Ne:k(r,he)&&k(r,bt)?Hs:k(r,"FxiOS")?Us:k(r.toLowerCase(),Oi.toLowerCase())?Oi:Ca(r,e)?k(r,ie)?Gs:bt:k(r,ze)?ze:k(r,"MSIE")||k(r,"Trident/")?Vi:k(r,"Gecko")?ze:""},Ta={[js]:[new RegExp("rv:"+W)],[qs]:[new RegExp(Yi+"?\\/"+W)],[Ne]:[new RegExp("("+Ne+"|CrMo)\\/"+W)],[Ns]:[new RegExp("CriOS\\/"+W)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+W)],[bt]:[ui],[Gs]:[ui],[zi]:[new RegExp("(Opera|OPR)\\/"+W)],[ze]:[new RegExp(ze+"\\/"+W)],[Us]:[new RegExp("FxiOS\\/"+W)],[Oi]:[new RegExp("Konqueror[:/]?"+W,"i")],[Je]:[new RegExp(Je+" "+W),ui],[Hs
2]:[new RegExp("android\\s"+W,"i")],[Ls]:[new RegExp(Ds+"\\/"+W)],[Vi]:[new RegExp("(rv:|MSIE )"+W)],Mozilla:[new RegExp("rv:"+W)]},Aa=function(r,e){var t=Vs(r,e),i=Ta[t];if(_(i))return null;for(var s=0;s<i.length;s++){var n=i[s],a=r.match(n);if(a)return parseFloat(a[a.length-2])}return null},Ir=[[new RegExp(Ye+"; "+Ye+" (.*?)[);]","i"),r=>[Ye,r&&r[1]||""]],[new RegExp(wt,"i"),[wt,""]],[new RegExp(Et,"i"),[Et,""]],[Xi,[Je,""]],[new RegExp(dt,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Ti,""];if(new RegExp(ie).test(e)&&!/IEMobile\b/.test(e))return[dt+" "+ie,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=t[1],s=Ra[i]||"";return/arm/i.test(e)&&(s="RT"),[dt,s]}return[dt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[Vt,e.join(".")]}return[Vt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=_(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+he+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+he+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[he,e.join(".")]}return[he,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ka,""]],[/Linux|debian/i,["Linux",""]]],Rr=function(r){return Ia.test(r)?wt:Fa.test(r)?Et:$a.test(r)?Ye:new RegExp(Ai,"i").test(r)?Ai:new RegExp("("+Ti+"|WPDesktop)","i").test(r)?Ti:/iPad/.test(r)?Ts:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?Os:Xi.test(r)?Je:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(Fr,"i").test(r)?Fr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r)||/(kf[a-z]+)( bui|\)).+silk\//i.test(r)?"Kindle Fire":/(Android|ZTE)/i.test(r)?!new RegExp(ie).test(r)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r)?/pixel[\daxl ]{1,6}/i.test(r)&&!/pixel c/i.test(r)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r)||/lmy47v/i.test(r)&&!/QTAQZ3/i.test(r)?he:Cs:he:new RegExp("(pda|"+ie+")","i").test(r)?Pa:new RegExp(yt,"i").test(r)&&!new RegExp(yt+" pc","i").test(r)?Ws:""},Rt="https?://(.*)",et=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Oa=Ze(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],et),kt="<masked>",Ma=["li_fat_id"];function zs(r,e,t){if(!b)return{};var i,s=e?Ze([],et,t||[]):[],n=Ys(xt(b.URL,s,kt),r),a=(i={},C(Ma,(function(o){var l=de.J(o);i[o]=l||null})),i);return M(a,n)}function Ys(r,e){var t=Oa.concat(e||[]),i={};return C(t,(function(s){var n=Gt(r,s);i[s]=n||null})),i}function Xs(r){var e=(function(n){return n?n.search(Rt+"google.([^/?]*)")===0?"google":n.search(Rt+"bing.com")===0?"bing":n.search(Rt+"yahoo.com")===0?"yahoo":n.search(Rt+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",i={};if(!ye(e)){i.$search_engine=e;var s=b?Gt(b.referrer,t):"";s.length&&(i.ph_keyword=s)}return i}function Cr(){return navigator.language||navigator.userLanguage}function Js(){return(b==null?void 0:b.referrer)||"$direct"}function Ks(r,e){var t=r?Ze([],et,e||[]):[],i=z==null?void 0:z.href.substring(0,1e3);return{r:Js().substring(0,1e3),u:i?xt(i,t,kt):void 0}}function Qs(r){var e,{r:t,u:i}=r,s={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Ht(t))==null?void 0:e.host};if(i){s.$current_url=i;var n=Ht(i);s.$host=n==null?void 0:n.host,s.$pathname=n==null?void 0:n.pathname;var a=Ys(i);M(s,a)}if(t){var o=Xs(t);M(s,o)}return s}function Zs(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Da(){try{return new Date().getTimezoneOffset()}catch{return}}function La(r,e){if(!V)return{};var t,i,s,n=r?Ze([],et,e||[]):[],[a,o]=(function(l){for(var u=0;u<Ir.length;u++){var[c,h]=Ir[u],f=c.exec(l),p=f&&(Ie(h)?h(f,l):h);if(p)return p}return["",""]})(V);return M(Hi({$os:a,$os_version:o,$browser:Vs(V,navigator.vendor),$device:Rr(V),$device_type:(i=V,s=Rr(i),s===Ts||s===Cs||s==="Kobo"||s==="Kindle Fire"||s===Ws?yt:s===wt||s===Ye||s===Et||s===Ai?"Console":s===Os?"Wearable":s?ie:"Desktop"),$timezone:Zs(),$timezone_offset:Da()}),{$current_url:xt(z==null?void 0:z.href,n,kt),$host:z==null?void 0:z.host,$pathname:z==null?void 0:z.pathname,$raw_user_agent:V.length>1e3?V.substring(0,997)+"...":V,$browser_version:Aa(V,navigator.vendor),$browser_language:Cr(),$browser_language_prefix:(t=Cr(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:d==null?void 0:d.screen.height,$screen_width:d==null?void 0:d.screen.width,$viewport_height:d==null?void 0:d.innerHeight,$viewport_width:d==null?void 0:d.innerWidth,$lib:"web",$lib_version:$e.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var ke=j("[Web Vitals]"),Tr=9e5;class Na{constructor(e){var t;this.Tt=!1,this.C=!1,this.q={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.It=()=>{clearTimeout(this.Rt),this.q.metrics.length!==0&&(this._instance.capture("$web_vitals",this.q.metrics.reduce(((i,s)=>w({},i,{["$web_vitals_"+s.name+"_event"]:w({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.q={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Ct=i=>{var s,n=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0);if(_(n))ke.error("Could not read session ID. Dropping metrics!");else{this.q=this.q||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this.Ot();_(a)||(O(i==null?void 0:i.name)||O(i==null?void 0:i.value)?ke.error("Invalid metric received",i):this.Ft&&i.value>=this.Ft?ke.error("Ignoring metric with value >= "+this.Ft,i):(this.q.url!==a&&(this.It(),this.Rt=setTimeout(this.It,this.flushToCaptureTimeoutMs)),_(this.q.url)&&(this.q.url=a),this.q.firstMetricTimestamp=_(this.q.firstMetricTimestamp)?Date.now():this.q.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0),this.q.metrics.push(w({},i,{$current_url:a,$session_id:n.sessionId,$window_id:n.windowId,timestamp:Date.now()})),this.q.metrics.length===this.allowedMetrics.length&&this.It()))}},this.lt=()=>{var i,s,n,a,o=x.__PosthogExtensions__;_(o)||_(o.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:s,onFCP:n,onINP:a}=o.postHogWebVitalsCallbacks),i&&s&&n&&a?(this.allowedMetrics.indexOf("LCP")>-1&&i(this.Ct.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Ct.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this.Ct.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&a(this.Ct.bind(this)),this.C=!0):ke.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Tt=!((t=this._instance.persistence)==null||!t.props[vr]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=G(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return _(i)?((t=this._instance.persistence)==null?void 0:t.props[_r])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(G(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}
2get Ft(){var e=G(this._instance.config.capture_performance)&&pe(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Tr;return 0<e&&e<=6e4?Tr:e}get isEnabled(){var e=z==null?void 0:z.protocol;if(e!=="http:"&&e!=="https:")return ke.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=G(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:_t(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return _t(t)?t:this.Tt}startIfEnabled(){this.isEnabled&&!this.C&&(ke.info("enabled, starting..."),this.nt(this.lt))}onRemoteConfig(e){var t=G(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=G(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[vr]:t}),this._instance.persistence.register({[_r]:i})),this.Tt=t,this.startIfEnabled()}nt(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"web-vitals",(s=>{s?ke.error("failed to load script",s):e()}))}Ot(){var e=d?d.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,s=t?Ze([],et,i||[]):[];return xt(e,s,kt)}ke.error("Could not determine current URL")}}var ja=j("[Heatmaps]");function Ar(r){return G(r)&&"clientX"in r&&"clientY"in r&&pe(r.clientX)&&pe(r.clientY)}class qa{constructor(e){var t;this.rageclicks=new Ps,this.Tt=!1,this.C=!1,this.Mt=null,this.instance=e,this.Tt=!((t=this.instance.persistence)==null||!t.props[xi])}get flushIntervalMilliseconds(){var e=5e3;return G(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return _(this.instance.config.capture_heatmaps)?_(this.instance.config.enable_heatmaps)?this.Tt:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.C)return;ja.info("starting..."),this.At(),this.Mt=setInterval(this.jt.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval((e=this.Mt)!==null&&e!==void 0?e:void 0),(t=this.Dt)==null||t.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[xi]:t}),this.Tt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.q;return this.q=void 0,e}Lt(e){this.Nt(e.originalEvent,"deadclick")}At(){d&&b&&(N(d,"beforeunload",this.jt.bind(this)),N(b,"click",(e=>this.Nt(e||(d==null?void 0:d.event))),{capture:!0}),N(b,"mousemove",(e=>this.Ut(e||(d==null?void 0:d.event))),{capture:!0}),this.Dt=new Fs(this.instance,fa,this.Lt.bind(this)),this.Dt.startIfEnabled(),this.C=!0)}zt(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),a=(function(o,l,u){for(var c=o;c&&Kt(c)&&!Ce(c,"body");){if(c===u)return!1;if(k(l,d==null?void 0:d.getComputedStyle(c).position))return!0;c=ys(c)}return!1})(_s(e),["fixed","sticky"],n);return{x:e.clientX+(a?0:s),y:e.clientY+(a?0:i),target_fixed:a,type:t}}Nt(e,t){var i;if(t===void 0&&(t="click"),!mr(e.target)&&Ar(e)){var s=this.zt(e,t);(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Ht(w({},s,{type:"rageclick"})),this.Ht(s)}}Ut(e){!mr(e.target)&&Ar(e)&&(clearTimeout(this.Bt),this.Bt=setTimeout((()=>{this.Ht(this.zt(e,"mousemove"))}),500))}Ht(e){if(d){var t=d.location.href,i=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=i?Ze([],et,s||[]):[],a=xt(t,n,kt);this.q=this.q||{},this.q[a]||(this.q[a]=[]),this.q[a].push(e)}}jt(){this.q&&!We(this.q)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class Ua{constructor(e){this._instance=e}doPageView(e,t){var i,s=this.qt(e,t);return this.Wt={pathname:(i=d==null?void 0:d.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.qt(e,(t=this.Wt)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Wt)==null?void 0:e.pageViewId}}qt(e,t){var i=this.Wt;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:l,maxContentHeight:u,last
vendor: 4,199 bytes, line 2
2ContentY:c,maxContentY:h}=n;if(!(_(a)||_(o)||_(l)||_(u)||_(c)||_(h))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),h=Math.ceil(h);var f=a<=1?1:ce(o/a,0,1,y),p=a<=1?1:ce(l/a,0,1,y),v=u<=1?1:ce(c/u,0,1,y),g=u<=1?1:ce(h/u,0,1,y);s=M(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:f,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:p,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:g})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var re=Uint8Array,X=Uint16Array,Ke=Uint32Array,Ji=new re([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]),Ki=new re([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]),Or=new re([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),en=function(r,e){for(var t=new X(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];var s=new Ke(t[30]);for(i=1;i<30;++i)for(var n=t[i];n<t[i+1];++n)s[n]=n-t[i]<<5|i;return[t,s]},tn=en(Ji,2),Ha=tn[0],Mi=tn[1];Ha[28]=258,Mi[258]=28;for(var Mr=en(Ki,0)[1],rn=new X(32768),A=0;A<32768;++A){var Oe=(43690&A)>>>1|(21845&A)<<1;Oe=(61680&(Oe=(52428&Oe)>>>2|(13107&Oe)<<2))>>>4|(3855&Oe)<<4,rn[A]=((65280&Oe)>>>8|(255&Oe)<<8)>>>1}var gt=function(r,e,t){for(var i=r.length,s=0,n=new X(e);s<i;++s)++n[r[s]-1];var a,o=new X(e);for(s=0;s<e;++s)o[s]=o[s-1]+n[s-1]<<1;for(a=new X(i),s=0;s<i;++s)a[s]=rn[o[r[s]-1]++]>>>15-r[s];return a},je=new re(288);for(A=0;A<144;++A)je[A]=8;for(A=144;A<256;++A)je[A]=9;for(A=256;A<280;++A)je[A]=7;for(A=280;A<288;++A)je[A]=8;var zt=new re(32);for(A=0;A<32;++A)zt[A]=5;var Ga=gt(je,9),Ba=gt(zt,5),sn=function(r){return(r/8>>0)+(7&r&&1)},nn=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof X?X:r instanceof Ke?Ke:re)(t-e);return i.set(r.subarray(e,t)),i},ge=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8},st=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8,r[i+2]|=t>>>16},ci=function(r,e){for(var t=[],i=0;i<r.length;++i)r[i]&&t.push({s:i,f:r[i]});var s=t.length,n=t.slice();if(!s)return[new re(0),0];if(s==1){var a=new re(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort((function(R,U){return R.f-U.f})),t.push({s:-1,f:25001});var o=t[0],l=t[1],u=0,c=1,h=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};c!=s-1;)o=t[t[u].f<t[h].f?u++:h++],l=t[u!=c&&t[u].f<t[h].f?u++:h++],t[c++]={s:-1,f:o.f+l.f,l:o,r:l};var f=n[0].s;for(i=1;i<s;++i)n[i].s>f&&(f=n[i].s);var p=new X(f+1),v=Di(t[c-1],p,0);if(v>e){i=0;var g=0,m=v-e,E=1<<m;for(n.sort((function(R,U){return p[U.s]-p[R.s]||R.f-U.f}));i<s;++i){var $=n[i].s;if(!(p[$]>e))break;g+=E-(1<<v-p[$]),p[$]=e}for(g>>>=m;g>0;){var P=n[i].s;p[P]<e?g-=1<<e-p[P]++-1:++i}for(;i>=0&&g;--i){var S=n[i].s;p[S]==e&&(--p[S],++g)}v=e}return[new re(p),v]},Di=function(r,e,t){return r.s==-1?Math.max(Di(r.l,e,t+1),Di(r.r,e,t+1)):e[r.s]=t},Dr=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new X(++e),i=0,s=r[0],n=1,a=function(l){t[i++]=l},o=1;o<=e;++o)if(r[o]==s&&o!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(s),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(s);n=1,s=r[o]}return[t.subarray(0,i),e]},nt=function(r,e){for(var t=0,i=0;i<e.length;++i)t+=r[i]*e[i];return t},Li=function(r,e,t){var i=t.length,s=sn(e+2);r[s]=255&i,r[s+1]=i>>>8,r[s+2]=255^r[s],r[s+3]=255^r[s+1];for(var n=0;n<i;++n)r[s+n+4]=t[n];return 8*(s+4+i)},Lr=function(r,e,t,i,s,n,a,o,l,u,c){ge(e,c++,t),++s[256];for(var h=ci(s,15),f=h[0],p=h[1],v=ci(n,15),g=v[0],m=v[1],E=Dr(f),$=E[0],P=E[1],S=Dr(g),R=S[0],U=S[1],J=new X(19),F=0;F<$.length;++F)J[31&$[F]]++;for(F=0;F<R.length;++F)J[31&R[F]]++;for(var ae=ci(J,7),K=ae[0],se=ae[1],ee=19;ee>4&&!K[Or[ee-1]];--ee);var fe,oe,le,qe,be=u+5<<3,Te=nt(s,je)+nt(n,zt)+a,ue=nt(s,f)+nt(n,g)+a+14+3*ee+nt(J,K)+(2*J[16]+3*J[17]+7*J[18]);if(be<=Te&&be<=ue)return Li(e,c,r.subarray(l,l+u));if(ge(e,c,1+(ue<Te)),c+=2,ue<Te){fe=gt(f,p),oe=f,le=gt(g,m),qe=g;var we=gt(K,se);for(ge(e,c,P-257),ge(e,c+5,U-1),ge(e,c+10,ee-4),c+=14,F=0;F<ee;++F)ge(e,c+3*F,K[Or[F]]);c+=3*ee;for(var Ue=[$,R],B=0;B<2;
2++B){var te=Ue[B];for(F=0;F<te.length;++F){var Q=31&te[F];ge(e,c,we[Q]),c+=K[Q],Q>15&&(ge(e,c,te[F]>>>5&127),c+=te[F]>>>12)}}}else fe=Ga,oe=je,le=Ba,qe=zt;for(F=0;F<o;++F)if(i[F]>255){Q=i[F]>>>18&31,st(e,c,fe[Q+257]),c+=oe[Q+257],Q>7&&(ge(e,c,i[F]>>>23&31),c+=Ji[Q]);var He=31&i[F];st(e,c,le[He]),c+=qe[He],He>3&&(st(e,c,i[F]>>>5&8191),c+=Ki[He])}else st(e,c,fe[i[F]]),c+=oe[i[F]];return st(e,c,fe[256]),c+oe[256]},Wa=new Ke([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Va=(function(){for(var r=new Ke(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),za=function(r,e,t,i,s){return(function(n,a,o,l,u,c){var h=n.length,f=new re(l+h+5*(1+Math.floor(h/7e3))+u),p=f.subarray(l,f.length-u),v=0;if(!a||h<8)for(var g=0;g<=h;g+=65535){var m=g+65535;m<h?v=Li(p,v,n.subarray(g,m)):(p[g]=c,v=Li(p,v,n.subarray(g,h)))}else{for(var E=Wa[a-1],$=E>>>13,P=8191&E,S=(1<<o)-1,R=new X(32768),U=new X(S+1),J=Math.ceil(o/3),F=2*J,ae=function(ti){return(n[ti]^n[ti+1]<<J^n[ti+2]<<F)&S},K=new Ke(25e3),se=new X(288),ee=new X(32),fe=0,oe=0,le=(g=0,0),qe=0,be=0;g<h;++g){var Te=ae(g),ue=32767&g,we=U[Te];if(R[ue]=we,U[Te]=ue,qe<=g){var Ue=h-g;if((fe>7e3||le>24576)&&Ue>423){v=Lr(n,p,0,K,se,ee,oe,le,be,g-be,v),le=fe=oe=0,be=g;for(var B=0;B<286;++B)se[B]=0;for(B=0;B<30;++B)ee[B]=0}var te=2,Q=0,He=P,Ee=ue-we&32767;if(Ue>2&&Te==ae(g-Ee))for(var cn=Math.min($,Ue)-1,hn=Math.min(32767,g),dn=Math.min(258,Ue);Ee<=hn&&--He&&ue!=we;){if(n[g+te]==n[g+te-Ee]){for(var xe=0;xe<dn&&n[g+xe]==n[g+xe-Ee];++xe);if(xe>te){if(te=xe,Q=Ee,xe>cn)break;var pn=Math.min(Ee,xe-2),Zi=0;for(B=0;B<pn;++B){var ei=g-Ee+B+32768&32767,er=ei-R[ei]+32768&32767;er>Zi&&(Zi=er,we=ei)}}}Ee+=(ue=we)-(we=R[ue])+32768&32767}if(Q){K[le++]=268435456|Mi[te]<<18|Mr[Q];var tr=31&Mi[te],ir=31&Mr[Q];oe+=Ji[tr]+Ki[ir],++se[257+tr],++ee[ir],qe=g+te,++fe}else K[le++]=n[g],++se[n[g]]}}v=Lr(n,p,c,K,se,ee,oe,le,be,g-be,v)}return nn(f,0,l+sn(v)+u)})(r,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+e.mem,t,i,!0)},hi=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function Ya(r,e){e===void 0&&(e={});var t=(function(){var o=4294967295;return{p:function(l){for(var u=o,c=0;c<l.length;++c)u=Va[255&u^l[c]]^u>>>8;o=u},d:function(){return 4294967295^o}}})(),i=r.length;t.p(r);var s,n=za(r,e,10+((s=e).filename&&s.filename.length+1||0),8),a=n.length;return(function(o,l){var u=l.filename;if(o[0]=31,o[1]=139,o[2]=8,o[8]=l.level<2?4:l.level==9?2:0,o[9]=3,l.mtime!=0&&hi(o,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),u){o[3]=8;for(var c=0;c<=u.length;++c)o[c+10]=u.charCodeAt(c)}})(n,e),hi(n,a-8,t.d()),hi(n,a-4,i),n}var Xa=function(r){var e,t,i,s,n="";for(e=t=0,i=(r=(r+"").replace(/\r\n/g,` 3`).replace(/\r/g,` 4`)).length,s=0;s<i;s++){var a=r.charCodeAt(s),o=null;a<128?t++:o=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),ye(o)||(t>e&&(n+=r.substring(e,t)),n+=o,e=t=s+1)}return t>e&&(n+=r.substring(e,r.length)),n},Ja=!!mi||!!_i,Nr="text/plain",Yt=(r,e)=>{var[t,i]=r.split("?"),s=w({},e);i==null||i.split("&").forEach((a=>{var[o]=a.split("=");delete s[o]}));var n=ta(s);return t+"?"+(n=n?(i?i+"&":"")+n:i)},pt=(r,e)=>JSON.stringify(r,((t,i)=>typeof i=="bigint"?i.toString():i),e),di=r=>{var{data:e,compression:t}=r;if(e){if(t===me.GZipJS){var i=Ya((function(l,u){var c=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var h=new re(l.length+(l.length>>>1)),f=0,p=function(E){h[f++]=E},v=0;v<c;++v){if(f+5>h.length){var g=new re(f+8+(c-v<<1));g.set(h),h=g}var m=l.charCodeAt(v);m<128||u?p(m):m<2048?(p(192|m>>>6),p(128|63&m)):m>55295&&m<57344?(p(240|(m=65536+(1047552&m)|1023&l.charCodeAt(++v))>>>18),p(128|m>>>12&63),p(128|m>>>6&63),p(128|63&m)):(p(224|m>>>12),p(128|m>>>6&63),p(128|63&m))}return nn(h,0,f)})(pt(e)),{mtime:0}),s=new Blob([i],{type:Nr});return{contentType:Nr,body:s,estimatedSize:s.size}}if(t===me.Base64){var n=(function(l){var u,c,h,f,p,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,m=0,E="",$=[];if(!l)return l;l=Xa(l);do u=(p=l.charCodeAt(g++)<<16|l.charCodeAt(g++)<<8|l.charCodeAt(g++))>>18&63,c=p>>12&63,h=p>>
46&63,f=63&p,$[m++]=v.charAt(u)+v.charAt(c)+v.charAt(h)+v.charAt(f);while(g<l.length);switch(E=$.join(""),l.length%3){case 1:E=E.slice(0,-2)+"==";break;case 2:E=E.slice(0,-1)+"="}return E})(pt(e)),a=(l=>"data="+encodeURIComponent(typeof l=="string"?l:pt(l)))(n);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var o=pt(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},At=[];_i&&At.push({transport:"fetch",method:r=>{var e,t,{contentType:i,body:s,estimatedSize:n}=(e=di(r))!==null&&e!==void 0?e:{},a=new Headers;C(r.headers,(function(c,h){a.append(h,c)})),i&&a.append("Content-Type",i);var o=r.url,l=null;if(nr){var u=new nr;l={signal:u.signal,timeout:setTimeout((()=>u.abort()),r.timeout)}}_i(o,w({method:(r==null?void 0:r.method)||"GET",headers:a,keepalive:r.method==="POST"&&(n||0)<52428.8,body:s,signal:(t=l)==null?void 0:t.signal},r.fetchOptions)).then((c=>c.text().then((h=>{var f={statusCode:c.status,text:h};if(c.status===200)try{f.json=JSON.parse(h)}catch(p){y.error(p)}r.callback==null||r.callback(f)})))).catch((c=>{y.error(c),r.callback==null||r.callback({statusCode:0,text:c})})).finally((()=>l?clearTimeout(l.timeout):null))}}),mi&&At.push({transport:"XHR",method:r=>{var e,t=new mi;t.open(r.method||"GET",r.url,!0);var{contentType:i,body:s}=(e=di(r))!==null&&e!==void 0?e:{};C(r.headers,(function(n,a){t.setRequestHeader(a,n)})),i&&t.setRequestHeader("Content-Type",i),r.timeout&&(t.timeout=r.timeout),r.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}r.callback==null||r.callback(n)}},t.send(s)}}),Z!=null&&Z.sendBeacon&&At.push({transport:"sendBeacon",method:r=>{var e=Yt(r.url,{beacon:"1"});try{var t,{contentType:i,body:s}=(t=di(r))!==null&&t!==void 0?t:{},n=typeof s=="string"?new Blob([s],{type:i}):s;Z.sendBeacon(e,n)}catch{}}});var Qe=function(r,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}};function jr(r,e,t){return pt({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var an={exact:(r,e)=>e.some((t=>r.some((i=>t===i)))),is_not:(r,e)=>e.every((t=>r.every((i=>t!==i)))),regex:(r,e)=>e.some((t=>r.some((i=>Qe(t,i))))),not_regex:(r,e)=>e.every((t=>r.every((i=>!Qe(t,i))))),icontains:(r,e)=>e.map(Ct).some((t=>r.map(Ct).some((i=>t.includes(i))))),not_icontains:(r,e)=>e.map(Ct).every((t=>r.map(Ct).every((i=>!t.includes(i)))))},Ct=r=>r.toLowerCase(),qr=j("[Error tracking]");class Ka{constructor(e){var t,i;this.Gt=[],this.Vt=new Cn([new Tn,new Un,new On,new An,new jn,new Nn,new Dn,new qn],[Pn,In]),this._instance=e,this.Gt=(t=(i=this._instance.persistence)==null?void 0:i.get_property(ki))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,i,s,n=(t=(i=e.errorTracking)==null?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],a=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Gt=n,this._instance.persistence&&this._instance.persistence.register({[ki]:this.Gt,[gr]:a})}get Jt(){var e,t=!!this._instance.get_property(gr),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Vt.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}sendExceptionEvent(e){if(this.Kt(e))qr.info("Skipping exception capture because a suppression rule matched");else{if(this.Jt||!this.Yt(e))return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"});qr.info("Skipping exception capture because it was thrown by an extension")}}Kt(e){var t=e.$exception_list;if(!t||!T(t)||t.length===0)return!1;var i=t.reduce(((s,n)=>{var{type:a,value:o}=n;return L(a)&&a.length>0&&s.$exception_types.push(a),L(o)&&o.length>0&&s.$exception_values.push(o),s}),{$exception_types:[],$exception_values:[]});return this.Gt.some((s=>{var n=s.values.map((a=>{var o,l=an[a.operator],u=T(a.value)?a.value:[a.value],c=(o=i[a.key])!==null&&o!==void 0?o:[];return u.length>0&&l(u,c)}));return s.type==="OR"?n.some(Boolean):n.every(Boolean)}))}Yt(e){var t=e.$exception_list;return!(!t||!T(t))&&t.flatMap((i=>{var s,n;return(s=(n=i.stacktrace)==null?void 0:n.frames)!==null&&s!==void 0?s:[]})).some((i=>i.filename&&i.filename.startsWith("chrome-extension://")))}}var ne=j("[FeatureFlags]"),pi="$active_feature_flags",Ge="$override_feature_flags",Ur="$feature_flag_payloads",at="$override_feature_flag_payloads",Hr="$feature_flag_request_id",Gr=r=>{var e={};for(var[t,i]of Tt(r||{}))i&&(e[t]=i);return e},Qa=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,(i=e[t].variant)!==null&&i!==void 0?i:e[t].enabled]}))),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return(i=e[t].metadata)==null?void 0:i.payload})).map((t=>{var i;return[t,(i=e[t].metadata)==null?void 0:i.payload]})))):ne.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},Za=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({});class eo{constructor(e){this.Xt=!1,this.Qt=!1,this.Zt=!1,this.ti=!1,this.ii=!1,this.ei=!1,this.ri=!1,this._instance=e,this.featureFlagEventHandlers=[]}si(){var e=this._instance.config.evaluation_environments;return e!=null&&e.length?e.filter((t=>{var i=t&&typeof t=="string"&&t.trim().length>0;return i||ne.error("Invalid evaluation environment found:",t,"Expected non-empty string"),i})):[]}ni(){return this.si().length>0}flags(){if(this._instance.config.__preview_remote_config)this.ei=!0;else{var e=!this.oi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.ai({disableFlags:e})}}get hasLoadedFlags(){return this.Qt}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(Si),t=this._instance.get_property(Ge),i=this._instance.get_property(at);if(!i&&!t)return e||{};var s=M({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var a of n){var o,l,u=s[a],c=t==null?void 0:t[a],h=_(c)?(o=u==null?void 0:u.enabled)!==null&&o!==void 0&&o:!!c,f=_(c)?u.variant:typeof c=="string"?c:void 0,p=i==null?void 0:i[a],v=w({},u,{enabled:h,variant:h?f??(u==null?void 0:u.variant):void 0});h!==(u==null?void 0:u.enabled)&&(v.original_enabled=u==null?void 0:u.enabled),f!==(u==null?void 0:u.variant)&&(v.original_variant=u==null?void 0:u.variant),p&&(v.metadata=w({},u==null?void 0:u.metadata,{payload:p,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),s[a]=v}return this.Xt||(ne.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.Xt=!0),s}getFlagVariants(){var e=this._instance.get_property(Ve),t=this._instance.get_property(Ge);
4if(!t)return e||{};for(var i=M({},e),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.Xt||(ne.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Xt=!0),i}getFlagPayloads(){var e=this._instance.get_property(Ur),t=this._instance.get_property(at);if(!t)return e||{};for(var i=M({},e||{}),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.Xt||(ne.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Xt=!0),i}reloadFeatureFlags(){this.ti||this._instance.config.advanced_disable_feature_flags||this.oi||(this.oi=setTimeout((()=>{this.ai()}),5))}li(){clearTimeout(this.oi),this.oi=void 0}ensureFlagsLoaded(){this.Qt||this.Zt||this.oi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ti=e}ai(e){var t;if(this.li(),!this._instance.L())if(this.Zt)this.ii=!0;else{var i={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:w({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(ht)||{}),group_properties:this._instance.get_property(De)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.ni()&&(i.evaluation_environments=this.si());var s=this._instance.config.__preview_remote_config,n=s?"/flags/?v=2":"/flags/?v=2&config=true",a=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",o=this._instance.requestRouter.endpointFor("api",n+a);s&&(i.timezone=Zs()),this.Zt=!0,this._instance.ui({method:"POST",url:o,data:i,compression:this._instance.config.disable_compression?void 0:me.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var u,c,h=!0;if(l.statusCode===200&&(this.ii||(this.$anon_distinct_id=void 0),h=!1),this.Zt=!1,this.ei||(this.ei=!0,this._instance.hi((c=l.json)!==null&&c!==void 0?c:{})),!i.disable_flags||this.ii)if(this.ri=!h,l.json&&(u=l.json.quotaLimited)!=null&&u.includes(Za.FeatureFlags))ne.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 f;i.disable_flags||this.receivedFeatureFlags((f=l.json)!==null&&f!==void 0?f:{},h),this.ii&&(this.ii=!1,this.ai())}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),this.Qt||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],s=""+i,n=this._instance.get_property(Hr)||void 0,a=this._instance.get_property(Nt)||{};if((t.send_event||!("send_event"in t))&&(!(e in a)||!a[e].includes(s))){var o,l,u,c,h,f,p,v,g;T(a[e])?a[e].push(s):a[e]=[s],(o=this._instance.persistence)==null||o.register({[Nt]:a});var m=this.getFeatureFlagDetails(e),E={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:n,$feature_flag_bootstrapped_response:((l=this._instance.config.bootstrap)==null||(l=l.featureFlags)==null?void 0:l[e])||null,$feature_flag_bootstrapped_payload:((u=this._instance.config.bootstrap)==null||(u=u.featureFlagPayloads)==null?void 0:u[e])||null,$used_bootstrap_value:!this.ri};_(m==null||(c=m.metadata)==null?void 0:c.version)||(E.$feature_flag_version=m.metadata.version);var $,P=(h=m==null||(f=m.reason)==null?void 0:f.description)!==null&&h!==void 0?h:m==null||(p=m.reason)==null?void 0:p.code;P&&(E.$feature_flag_reason=P),m!=null&&(v=m.metadata)!=null&&v.id&&(E.$feature_flag_id=m.metadata.id),_(m==null?void 0:m.original_variant)&&_(m==null?void 0:m.original_enabled)||(E.$feature_flag_original_response=_(m.original_variant)?m.original_enabled:m.original_variant),m!=null&&(g=m.metadata)!=null&&g.original_payload&&(E.$feature_flag_original_payload=m==null||($=m.metadata)==null?void 0:$.original_payload),this._instance.capture("$feature_flag_called",E)}return i}ne.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.ni()&&(s.evaluation_environments=this.si()),this._instance.ui({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:s,compression:this._instance.config.disable_compression?void 0:me.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var a,o=(a=n.json)==null?void 0:a.featureFlagPayloads;t((o==null?void 0:o[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.Qt||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return _(i)?void 0:!!i}ne.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.Qt=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,u,c){l===void 0&&(l={}),u===void 0&&(u={}),c===void 0&&(c={});var h=Qa(a),f=h.flags,p=h.featureFlags,v=h.featureFlagPayloads;if(p){var g=a.requestId;if(T(p)){ne.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var m={};if(p)for(var E=0;E<p.length;E++)m[p[E]]=!0;o&&o.register({[pi]:p,[Ve]:m})}else{var $=p,P=v,S=f;a.errorsWhileComputingFlags&&($=w({},l,$),P=w({},u,P),S=w({},c,S)),o&&o.register(w({[pi]:Object.keys(Gr($)),[Ve]:$||{},[Ur]:P||{},[Si]:S||{}},g?{[Hr]:g}:{}))}}})(e,this._instance.persistence,i,s,n),this.di(t)}}override(e,t){t===void 0&&(t=!1),ne.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return ne.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Ge),this._instance.persistence.unregister(at),void this.di();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,i=e;if(this.Xt=!!((t=i.suppressWarning)!==null&&t!==void 0&&t),"flags"in i){if(i.flags===!1)this._instance.persistence.unregister(Ge);else if(i.flags)if(T(i.flags)){for(var s={},n=0;n<i.flags.length;n++)s[i.flags[n]]=!0;this._instance.persistence.register({[Ge]:s})}else this._instance.persistence.register({[Ge]:i.flags})}return"payloads"in i&&(i.payloads===!1?this._instance.persistence.unregister(at):i.payloads&&this._instance.persistence.register({[at]:i.payloads})),void this.di()}this.di()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Qt){var{flags:t,flagVariants:i}=this.vi();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,n=(this._instance.get_property(ct)||[]).find((u=>u.flagKey===e)),a={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(a,!1);var l=w({},this.getFlagVariants(),{[e]:t});(s=this._instance.persistence)==null||s.register({[pi]:Object.keys(Gr(l)),[Ve]:l}),this.di()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var s=this._instance.get_property(ct),n=i?"&"+i.map((a=>"stage="+a)).join("&"):"";if(s&&!t)return e(s);this._instance.ui({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+n),method:"GET",callback:a=>{var o,l;if(a.json){var u=a.json.earlyAccessFeatures;return(o=this._instance.persistence)==null||o.unregister(ct),(l=this._instance.persistence)==null||l.register({[ct]:u}),e(u)}}})}vi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((i=>t[i])),flagVariants:Object.keys(t).filter((i=>t[i])).reduce(((i,s)=>(i[s]=t[s],i)),{})}}di(e){var{flags:t,flagVariants:i}=this.vi();
4this.featureFlagEventHandlers.forEach((s=>s(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(ht)||{};this._instance.register({[ht]:w({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ht)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(De)||{};Object.keys(i).length!==0&&Object.keys(i).forEach((s=>{i[s]=w({},i[s],e[s]),delete e[s]})),this._instance.register({[De]:w({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(De)||{};this._instance.register({[De]:w({},t,{[e]:{}})})}else this._instance.unregister(De)}reset(){this.Qt=!1,this.Zt=!1,this.ti=!1,this.ii=!1,this.ei=!1,this.ri=!1,this.$anon_distinct_id=void 0,this.li(),this.Xt=!1}}var to=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class fi{constructor(e,t){this.A=e,this.props={},this.ci=!1,this.fi=(i=>{var s="";return i.token&&(s=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+s+"_posthog"})(e),this.it=this.pi(e),this.load(),e.debug&&y.info("Persistence loaded",e.persistence,w({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.gi}pi(e){to.indexOf(e.persistence.toLowerCase())===-1&&(y.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&D.G()?D:t==="localstorage+cookie"&&$t.G()?$t:t==="sessionstorage"&&q.G()?q:t==="memory"?da:t==="cookie"?de:$t.G()?$t:de}properties(){var e={};return C(this.props,(function(t,i){if(i===Ve&&G(t))for(var s=Object.keys(t),n=0;n<s.length;n++)e["$feature/"+s[n]]=t[s[n]];else o=i,l=!1,(ye(a=zn)?l:sr&&a.indexOf===sr?a.indexOf(o)!=-1:(C(a,(function(u){if(l||(l=u===o))return Dt})),l))||(e[i]=t);var a,o,l})),e}load(){if(!this.gi){var e=this.it.K(this.fi);e&&(this.props=M({},e))}}save(){this.gi||this.it.Y(this.fi,this.props,this.mi,this.yi,this.bi,this.A.debug)}remove(){this.it.X(this.fi,!1),this.it.X(this.fi,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(G(e)){_(t)&&(t="None"),this.mi=_(i)?this.wi:i;var s=!1;if(C(e,((n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.props[a]=n,s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(G(e)){this.mi=_(t)?this.wi:t;var i=!1;if(C(e,((s,n)=>{e.hasOwnProperty(n)&&this.props[n]!==s&&(this.props[n]=s,i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.ci){var e=zs(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);We(Hi(e))||this.register(e),this.ci=!0}}update_search_keyword(){var e;this.register((e=b==null?void 0:b.referrer)?Xs(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Js(),$referring_domain:b!=null&&b.referrer&&((e=Ht(b.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Ii]||this.props[Ri]||this.register_once({[jt]:Ks(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};C([Ri,Ii],(a=>{var o=this.props[a];o&&C(o,(function(l,u){e["$initial_"+yi(u)]=l}))}));var t,i,s=this.props[jt];if(s){var n=(t=Qs(s),i={},C(t,(function(a,o){i["$initial_"+yi(o)]=a})),i);M(e,n)}return e}safe_merge(e){return C(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this.wi=this.mi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var s=this.pi(e),n=this.props;this.clear(),this.it=s,this.props=n,this.save()}}set_disabled(e){this.gi=e,this.gi?this.remove():this.save()}set_cross_subdomain(e){e!==this.yi&&(this.yi=e,this.remove(),this.save())}set_secure(e){e!==this.bi&&(this.bi=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[ut]||{};i[e]=t,this.props[ut]=i,this.save()}remove_event_timer(e){var t=(this.props[ut]||{})[e];return _(t)||(delete this.props[ut][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({});(function(r){return r.TopLeft="top_left",r.TopRight="top_right",r.TopCenter="top_center",r.MiddleLeft="middle_left",r.MiddleRight="middle_right",r.MiddleCenter="middle_center",r.Left="left",r.Center="center",r.Right="right",r.NextToTrigger="next_to_trigger",r})({});var gi=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({});(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({});
4(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({});(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({});var Ot=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r})({}),Br=(function(r){return r.SURVEY_ID="$survey_id",r.SURVEY_NAME="$survey_name",r.SURVEY_RESPONSE="$survey_response",r.SURVEY_ITERATION="$survey_iteration",r.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",r.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",r.SURVEY_SUBMISSION_ID="$survey_submission_id",r.SURVEY_QUESTIONS="$survey_questions",r.SURVEY_COMPLETED="$survey_completed",r})({}),on=(function(r){return r.Popover="popover",r.Inline="inline",r})({});class Qi{constructor(){this.Si={},this.Si={}}on(e,t){return this.Si[e]||(this.Si[e]=[]),this.Si[e].push(t),()=>{this.Si[e]=this.Si[e].filter((i=>i!==t))}}emit(e,t){for(var i of this.Si[e]||[])i(t);for(var s of this.Si["*"]||[])s(e,t)}}class Le{constructor(e){this.xi=new Qi,this.Ei=(t,i)=>this.$i(t,i)&&this.ki(t,i)&&this.Pi(t,i),this.$i=(t,i)=>i==null||!i.event||(t==null?void 0:t.event)===(i==null?void 0:i.event),this._instance=e,this.Ti=new Set,this.Ii=new Set}init(){var e;if(!_((e=this._instance)==null?void 0:e.Ri)){var t;(t=this._instance)==null||t.Ri(((i,s)=>{this.on(i,s)}))}}register(e){var t,i;if(!_((t=this._instance)==null?void 0:t.Ri)&&(e.forEach((a=>{var o,l;(o=this.Ii)==null||o.add(a),(l=a.steps)==null||l.forEach((u=>{var c;(c=this.Ti)==null||c.add((u==null?void 0:u.event)||"")}))})),(i=this._instance)!=null&&i.autocapture)){var s,n=new Set;e.forEach((a=>{var o;(o=a.steps)==null||o.forEach((l=>{l!=null&&l.selector&&n.add(l==null?void 0:l.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(n)}}on(e,t){var i;t!=null&&e.length!=0&&(this.Ti.has(e)||this.Ti.has(t==null?void 0:t.event))&&this.Ii&&((i=this.Ii)==null?void 0:i.size)>0&&this.Ii.forEach((s=>{this.Ci(t,s)&&this.xi.emit("actionCaptured",s.name)}))}Oi(e){this.onAction("actionCaptured",(t=>e(t)))}Ci(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var i of t.steps)if(this.Ei(e,i))return!0;return!1}onAction(e,t){return this.xi.on(e,t)}ki(e,t){if(t!=null&&t.url){var i,s=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!s||typeof s!="string"||!Le.Fi(s,t==null?void 0:t.url,(t==null?void 0:t.url_matching)||"contains"))return!1}return!0}static Fi(e,t,i){switch(i){case"regex":return!!d&&Qe(e,t);case"exact":return t===e;case"contains":var s=Le.Mi(t).replace(/_/g,".").replace(/%/g,".*");return Qe(e,s);default:return!1}}static Mi(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Pi(e,t){if((t!=null&&t.href||t!=null&&t.tag_name||t!=null&&t.text)&&!this.Ai(e).some((n=>!(t!=null&&t.href&&!Le.Fi(n.href||"",t==null?void 0:t.href,(t==null?void 0:t.href_matching)||"exact"))&&(t==null||!t.tag_name||n.tag_name===(t==null?void 0:t.tag_name))&&!(t!=null&&t.text&&!Le.Fi(n.text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact")&&!Le.Fi(n.$el_text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact")))))return!1;if(t!=null&&t.selector){var i,s=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(!s||!s.includes(t==null?void 0:t.selector))return!1}return!0}Ai(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}var I=j("[Surveys]"),Ni="seenSurvey_",io=(r,e)=>{var t="$survey_"+e+"/"+r.id;return r.current_iteration&&r.current_iteration>0&&(t="$survey_"+e+"/"+r.id+"/"+r.current_iteration),t},Wr=r=>{var e=""+Ni+r.id;return r.current_iteration&&r.current_iteration>0&&(e=""+Ni+r.id+"_"+r.current_iteration),e},ro=[gi.Popover,gi.Widget,gi.API],so={ignoreConditions:!1,ignoreDelay:!1,displayType:on.Popover};class no{constructor(e){this._instance=e,this.ji=new Map,this.Di=new Map}register(e){var t;_((t=this._instance)==null?void 0:t.Ri)||(this.Li(e),this.Ni(e))}Ni(e){var t=e.filter((i=>{var s,n;return((s=i.conditions)==null?void 0:s.actions)&&((n=i.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.Ui==null&&(this.Ui=new Le(this._instance),this.Ui.init(),this.Ui.Oi((i=>{this.onAction(i)}))),t.forEach((i=>{var s,n,a,o,l;i.conditions&&(s=i.conditions)!=null&&s.actions&&(n=i.conditions)!=null&&(n=n.actions)!=null&&n.values&&((a=i.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((o=this.Ui)==null||o.register(i.conditions.actions.values),(l=i.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((u=>{if(u&&u.name){var c=this.Di.get(u.name);c&&c.push(i.id),this.Di.set(u.name,c||[i.id])}})))})))}Li(e){var t;e.filter((i=>{var s,n;return((s=i.conditions)==null?void 0:s.events)&&((n=i.conditions)==null||(n=n.events)==null||(n=n.values)==null?void 0:n.length)>0})).length!==0&&((t=this._instance)==null||t.Ri(((i,s)=>{this.onEvent(i,s)})),e.forEach((i=>{var s;(s=i.conditions)==null||(s=s.events)==null||(s=s.values)==null||s.forEac
4h((n=>{if(n&&n.name){var a=this.ji.get(n.name);a&&a.push(i.id),this.ji.set(n.name,a||[i.id])}}))})))}onEvent(e,t){var i,s,n=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[Pt])||[];if(Ot.SHOWN===e&&t&&n.length>0){var a;I.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:n});var o=t==null||(a=t.properties)==null?void 0:a.$survey_id;if(o){var l=n.indexOf(o);l>=0&&(n.splice(l,1),this.zi(n))}}else if(this.ji.has(e)){I.info("survey event name matched",{event:e,eventPayload:t,surveys:this.ji.get(e)});var u=[];(s=this._instance)==null||s.getSurveys((h=>{u=h.filter((f=>{var p;return(p=this.ji.get(e))==null?void 0:p.includes(f.id)}))}));var c=u.filter((h=>{var f,p=(f=h.conditions)==null||(f=f.events)==null||(f=f.values)==null?void 0:f.find((v=>v.name===e));return!!p&&(!p.propertyFilters||Object.entries(p.propertyFilters).every((v=>{var g,[m,E]=v,$=t==null||(g=t.properties)==null?void 0:g[m];if(_($)||ye($))return!1;var P=[String($)],S=an[E.operator];return S?S(E.values,P):(I.warn("Unknown property comparison operator: "+E.operator),!1)})))}));this.zi(n.concat(c.map((h=>h.id))||[]))}}onAction(e){var t,i=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[Pt])||[];this.Di.has(e)&&this.zi(i.concat(this.Di.get(e)||[]))}zi(e){var t;I.info("updating activated surveys",{activatedSurveys:e}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[Pt]:[...new Set(e)]})}getSurveys(){var e,t=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[Pt];return t||[]}getEventToSurveys(){return this.ji}Hi(){return this.Ui}}class ao{constructor(e){this.Bi=void 0,this._surveyManager=null,this.qi=!1,this.Wi=!1,this.Gi=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(O(t))return I.warn("Flags not loaded yet. Not loading surveys.");var i=T(t);this.Bi=i?t.length>0:t,I.info("flags response received, isSurveysEnabled: "+this.Bi),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(i!=null&&i.startsWith(Ni)||i!=null&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((s=>localStorage.removeItem(s)))}loadIfEnabled(){if(!this._surveyManager)if(this.Wi)I.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)I.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())I.info("Not loading surveys in cookieless mode without consent.");else{var e=x==null?void 0:x.__PosthogExtensions__;if(e){if(!_(this.Bi)||this._instance.config.advanced_enable_surveys){var t=this.Bi||this._instance.config.advanced_enable_surveys;this.Wi=!0;try{var i=e.generateSurveys;if(i)return void this.Vi(i,t);var s=e.loadExternalDependency;if(!s)return void this.Ji("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",(n=>{n||!e.generateSurveys?this.Ji("Could not load surveys script",n):this.Vi(e.generateSurveys,t)}))}catch(n){throw this.Ji("Error initializing surveys",n),n}finally{this.Wi=!1}}}else I.error("PostHog Extensions not found.")}}Vi(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new no(this._instance),I.info("Surveys loaded successfully"),this.Ki({isLoaded:!0})}Ji(e,t){I.error(e,t),this.Ki({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Gi.push(e),this._surveyManager&&this.Ki({isLoaded:!0}),()=>{this.Gi=this.Gi.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return I.info("Disabled. Not loading surveys."),e([]);var i=this._instance.get_property(Pi);if(i&&!t)return e(i,{isLoaded:!0});if(this.qi)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.qi=!0,this._instance.ui({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:s=>{var n;this.qi=!1;var a=s.statusCode;if(a!==200||!s.json){var o="Surveys API could not be loaded, status: "+a;return I.error(o),e([],{isLoaded:!1,error:o})}var l,u=s.json.surveys||[],c=u.filter((h=>(function(f){return!(!f.start_date||f.end_date)}
4)(h)&&((function(f){var p;return!((p=f.conditions)==null||(p=p.events)==null||(p=p.values)==null||!p.length)})(h)||(function(f){var p;return!((p=f.conditions)==null||(p=p.actions)==null||(p=p.values)==null||!p.length)})(h))));return c.length>0&&((l=this._surveyEventReceiver)==null||l.register(c)),(n=this._instance.persistence)==null||n.register({[Pi]:u}),e(u,{isLoaded:!0})}})}catch(s){throw this.qi=!1,s}}Ki(e){for(var t of this.Gi)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){I.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!O(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);I.warn("init was not called")}Yi(e){var t=null;return this.getSurveys((i=>{var s;t=(s=i.find((n=>n.id===e)))!==null&&s!==void 0?s:null})),t}Xi(e){if(O(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.Yi(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(O(this._surveyManager))return I.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.Xi(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return O(this._surveyManager)?(I.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((i=>{this.getSurveys((s=>{var n,a=(n=s.find((l=>l.id===e)))!==null&&n!==void 0?n:null;if(a){var o=this.Xi(a);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t){var i;if(O(this._surveyManager))I.warn("init was not called");else{var s=typeof e=="string"?this.Yi(e):e;if(s!=null&&s.id)if(ro.includes(s.type)){var n=b==null?void 0:b.querySelector(t);if(n)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(I.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,o;I.info("Rendering survey "+s.id+" with delay of "+((a=s.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(o=this._surveyManager)==null||o.renderSurvey(s,n),I.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n);I.warn("Survey element not found")}else I.warn("Surveys of type "+s.type+" cannot be rendered in the app");else I.warn("Survey not found")}}displaySurvey(e,t){var i;if(O(this._surveyManager))I.warn("init was not called");else{var s=this.Yi(e);if(s){var n=s;if((i=s.appearance)!=null&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=w({},s,{appearance:w({},s.appearance,{surveyPopupDelaySeconds:0})})),t.ignoreConditions===!1){var a=this.canRenderSurvey(s);if(!a.visible)return void I.warn("Survey is not eligible to be displayed: ",a.disabledReason)}t.displayType!==on.Inline?this._surveyManager.handlePopoverSurvey(n):this.renderSurvey(n,t.selector)}else I.warn("Survey not found")}}}var Vr=j("[RateLimiter]");class oo{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=s=>{var n=s.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach((a=>{Vr.info((a||"events")+" is quota limited."),this.serverLimits[a]=new Date().getTime()+6e4}))}catch(a){return void Vr.warn('could not rate limit - continuing. Error: "'+(a==null?void 0:a.message)+'"',{text:n})}},this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)==null?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((i=e.config.rate_limiting)==null?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,s;e===void 0&&(e=!1);var n=new Date().getTime(),a=(t=(i=this.instance.persistence)==null?void 0:i.get_property(Fi))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:n};a.tokens+=(n-a.last)/1e3*this.captureEventsPerSecond,a.last=n,a.tokens>this.captureEventsBurstLimit&&(a.tokens=this.captureEventsBurstLimit);var o=a.tokens<1;return o||e||(a.tokens=Math.max(0,a.tokens-1)),!o||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,(s=this.instance.persistence)==null||s.set_property(Fi,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var Me=j("[RemoteConfig]");class lo{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=x._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Qi(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(Me.error("PostHog Extensions not found. Cannot load remote config."),e())}Zi(e){this._instance.ui({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return Me.info("Using preloaded remote config",this.remoteConfig),void this.hi(this.remoteConfig);if(this._instance.L())return void Me.warn("Remote config is disabled. Falling back to local config.");this.Qi((e=>{if(!e)return Me.info("No config found after loading remote JS config. Falling back to JSON."),void this.Zi((t=>{this.hi(t)}));this.hi(e)}))}catch(e){Me.error("Error loading remote config",e)}}hi(e){e?this._instance.config.__preview_remote_config?(this._instance.hi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):Me.info("__preview_remote_config is disabled. Logging config instead",e):Me.error("Failed to fetch remote config from PostHog.")}}var ji=3e3;class uo{constructor(e,t){this.te=!0,this.ie=[],this.ee=ce((t==null?void 0:t.flush_interval_ms)||ji,250,5e3,y.createLogger("flush interval"),ji),this.re=e}
4enqueue(e){this.ie.push(e),this.se||this.ne()}unload(){this.oe();var e=this.ie.length>0?this.ae():{},t=Object.values(e);[...t.filter((i=>i.url.indexOf("/e")===0)),...t.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.re(w({},i,{transport:"sendBeacon"}))}))}enable(){this.te=!1,this.ne()}ne(){var e=this;this.te||(this.se=setTimeout((()=>{if(this.oe(),this.ie.length>0){var t=this.ae(),i=function(){var n=t[s],a=new Date().getTime();n.data&&T(n.data)&&C(n.data,(o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp})),e.re(n)};for(var s in t)i()}}),this.ee))}oe(){clearTimeout(this.se),this.se=void 0}ae(){var e={};return C(this.ie,(t=>{var i,s=t,n=(s?s.batchKey:null)||s.url;_(e[n])&&(e[n]=w({},s,{data:[]})),(i=e[n].data)==null||i.push(s.data)})),this.ie=[],e}}var co=["retriesPerformedSoFar"];class ho{constructor(e){this.le=!1,this.ue=3e3,this.ie=[],this._instance=e,this.ie=[],this.he=!0,!_(d)&&"onLine"in d.navigator&&(this.he=d.navigator.onLine,N(d,"online",(()=>{this.he=!0,this.jt()})),N(d,"offline",(()=>{this.he=!1})))}get length(){return this.ie.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=is(e,co);pe(t)&&t>0&&(i.url=Yt(i.url,{retry_count:t})),this._instance.ui(w({},i,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(t??0)<10?this.de(w({retriesPerformedSoFar:t},i)):i.callback==null||i.callback(s)}}))}de(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=(function(a){var o=3e3*Math.pow(2,a),l=o/2,u=Math.min(18e5,o),c=(Math.random()-.5)*(u-l);return Math.ceil(u+c)})(t),s=Date.now()+i;this.ie.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in "+i;navigator.onLine||(n+=" (Browser is offline)"),y.warn(n),this.le||(this.le=!0,this.ve())}ve(){this.ce&&clearTimeout(this.ce),this.ce=setTimeout((()=>{this.he&&this.ie.length>0&&this.jt(),this.ve()}),this.ue)}jt(){var e=Date.now(),t=[],i=this.ie.filter((n=>n.retryAt<e||(t.push(n),!1)));if(this.ie=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.ce&&(clearTimeout(this.ce),this.ce=void 0),this.ie))try{this._instance.ui(w({},e,{transport:"sendBeacon"}))}catch(t){y.error(t)}this.ie=[]}}class po{constructor(e){this.fe=()=>{var t,i,s,n;this.pe||(this.pe={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,u=o+((a==null?void 0:a.clientHeight)||0),c=(a==null?void 0:a.scrollHeight)||0;this.pe.lastScrollY=Math.ceil(o),this.pe.maxScrollY=Math.max(o,(t=this.pe.maxScrollY)!==null&&t!==void 0?t:0),this.pe.maxScrollHeight=Math.max(l,(i=this.pe.maxScrollHeight)!==null&&i!==void 0?i:0),this.pe.lastContentY=u,this.pe.maxContentY=Math.max(u,(s=this.pe.maxContentY)!==null&&s!==void 0?s:0),this.pe.maxContentHeight=Math.max(c,(n=this.pe.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}getContext(){return this.pe}resetContext(){var e=this.pe;return setTimeout(this.fe,0),e}startMeasuringScrollPosition(){N(d,"scroll",this.fe,{capture:!0}),N(d,"scrollend",this.fe,{capture:!0}),N(d,"resize",this.fe)}scrollElement(){if(!this._instance.config.scroll_root_selector)return d==null?void 0:d.document.documentElement;var e=T(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=d==null?void 0:d.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return d&&(d.scrollY||d.pageYOffset||d.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return d&&(d.scrollX||d.pageXOffset||d.document.documentElement.scrollLeft)||0}}var fo=r=>Ks(r==null?void 0:r.config.mask_personal_data_properties,r==null?void 0:r.config.custom_personal_data_properties);class zr{constructor(e,t,i,s){this.ge=n=>{var a=this._e();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.me(this._instance)};this.ye.register({[$i]:o})}},this._instance=e,this.be=t,this.ye=i,this.me=s||fo,this.be.onSessionId(this.ge)}_e(){return this.ye.props[$i]}getSetOnceProps(){var e,t=(e=this._e())==null?void 0:e.props;return t?"r"in t?Qs(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return C(Hi(this.getSetOnceProps()),((t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+yi(i)]=t})),e}}var vi=j("[SessionId]");class Yr{on(e,t){return this.we.on(e,t)}constructor(e,t,i){var s;if(this.Se=[],this.xe=void 0,this.we=new Qi,this.Ee=(c,h)=>Math.abs(c-h)>
4this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.A=e.config,this.ye=e.persistence,this.$e=void 0,this.ke=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Pe=t||Fe,this.Te=i||Fe;var n=this.A.persistence_name||this.A.token,a=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*ce(a,60,36e3,vi.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ie(),this.Re="ph_"+n+"_window_id",this.Ce="ph_"+n+"_primary_window_exists",this.Oe()){var o=q.K(this.Re),l=q.K(this.Ce);o&&!l?this.$e=o:q.X(this.Re),q.Y(this.Ce,!0)}if((s=this.A.bootstrap)!=null&&s.sessionID)try{var u=(c=>{var h=c.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.A.bootstrap.sessionID);this.Fe(this.A.bootstrap.sessionID,new Date().getTime(),u)}catch(c){vi.error("Invalid sessionID in bootstrap",c)}this.Me()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return _(this.Se)&&(this.Se=[]),this.Se.push(e),this.ke&&e(this.ke,this.$e),()=>{this.Se=this.Se.filter((t=>t!==e))}}Oe(){return this.A.persistence!=="memory"&&!this.ye.gi&&q.G()}Ae(e){e!==this.$e&&(this.$e=e,this.Oe()&&q.Y(this.Re,e))}je(){return this.$e?this.$e:this.Oe()?q.K(this.Re):null}Fe(e,t,i){e===this.ke&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.ke=e,this.ye.register({[Lt]:[t,e,i]}))}De(){if(this.ke&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.ke,this._sessionStartTimestamp];var e=this.ye.props[Lt];return T(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Fe(null,null,null)}destroy(){clearTimeout(this.Le),this.Le=void 0,this.xe&&d&&(d.removeEventListener("beforeunload",this.xe,{capture:!1}),this.xe=void 0),this.Se=[]}Me(){this.xe=()=>{this.Oe()&&q.X(this.Ce)},N(d,"beforeunload",this.xe,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.A.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||new Date().getTime(),[s,n,a]=this.De(),o=this.je(),l=pe(a)&&a>0&&Math.abs(i-a)>864e5,u=!1,c=!n,h=!e&&this.Ee(i,s);c||h||l?(n=this.Pe(),o=this.Te(),vi.info("new session ID generated",{sessionId:n,windowId:o,changeReason:{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}}),a=i,u=!0):o||(o=this.Te(),u=!0);var f=s===0||!e||l?i:s,p=a===0?new Date().getTime():a;return this.Ae(o),this.Fe(n,f,p),e||this.Ie(),u&&this.Se.forEach((v=>v(n,o,u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0))),{sessionId:n,windowId:o,sessionStartTimestamp:p,changeReason:u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}Ie(){clearTimeout(this.Le),this.Le=setTimeout((()=>{var[e]=this.De();if(this.Ee(new Date().getTime(),e)){var t=this.ke;this.resetSessionId(),this.we.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var go=["$set_once","$set"],Se=j("[SiteApps]");class vo{constructor(e){this._instance=e,this.Ne=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ue(e,t){if(t){var i=this.globalsForEvent(t);this.Ne.push(i),this.Ne.length>1e3&&(this.Ne=this.Ne.slice(10))}}get siteAppLoaders(){var e;return(e=x._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ri(this.Ue.bind(this));this.ze=()=>{e(),this.Ne=[],this.ze=void 0}}}globalsForEvent(e){var t,i,s,n,a,o,l;if(!e)throw new Error("Event payload is required");var u={},c=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[f,p]of Object.entries(h))u[f]={id:c[f],type:f,properties:p};var{$set_once:v,$set:g}=e;return{event:w({},is(e,go),{properties:w({},e.properties,g?{$set:w({},(t=(i=e.properties)==null?void 0:i.$set)!==null&&t!==void 0?t:{},g)}:{},v?{$set_once:w({},(s=(n=e.properties)==null?void 0:n.$set_once)!==null&&s!==void 0?s:{},v)}:{}),elements_chain:(a=(o=e.properties)==null?void 0:o.$elements_chain)!==null&&a!==void 0?a:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var o;!t.errored&&this.Ne.length&&(Se.info("Processing "+this.Ne.length+" events for site app with id "+e.id),this.Ne.forEach((l=>t.processEvent==null?void 0:t.processEvent(l))),t.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((o=this.ze)==null||o.call(this))},s=!1,n=o=>{t.errored=!o,t.loaded=!0,Se.info("Site app with id "+e.id+" "+(o?"loaded":"errored")),s&&i()};try{var{processEvent:a}=e.init({posthog:this._instance,callback:o=>{n(o)}});a&&(t.processEvent=a),s=!0}catch(o){Se.error("Error while initializing PostHog app with config id "+e.id,o),n(!1)}if(s&&t.loaded)try{i()}catch(o){Se.error("Error while processing buffered events PostHog app with config id "+e.id,o),t.errored=!0}}He(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}Be(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{i.processEvent==null||i.processEvent(t)}catch(s){Se.error("Error while processing event "+e.event+" for site app "+i.id,s)}}}onRemoteConfig(e){var t,i,s,n=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.He(),void this._instance.on("eventCaptured",(u=>this.Be(u)))):void Se.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.ze)==null||i.call(this),(s=e.siteApps)!=null&&s.length)if(this.isEnabled){var a=function(u){var c;x["__$$ph_site_app_"+u]=n._instance,(c=x.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(n._instance,l,(h=>{if(h)return Se.error("Error while initializing PostHog app with config id "+u,h)}))};for(var{id:o,url:l}of e.siteApps)a(o)}else Se.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var _o=["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","hub
4spot","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"],Xr=function(r,e){if(!r)return!1;var t=r.toLowerCase();return _o.concat(e||[]).some((i=>{var s=i.toLowerCase();return t.indexOf(s)!==-1}))},ln=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&Xr(t,e))return!0;try{var i=r==null?void 0:r.userAgentData;if(i!=null&&i.brands&&i.brands.some((s=>Xr(s==null?void 0:s.brand,e))))return!0}catch{}return!!r.webdriver},ft=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),Jr="i.posthog.com";class mo{constructor(e){this.qe={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Jr,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.qe[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.qe[this.apiHost]=ft.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.qe[this.apiHost]=ft.EU:this.qe[this.apiHost]=ft.CUSTOM),this.qe[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(this.region===ft.CUSTOM)return this.apiHost+t;var i=Jr+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var yo={icontains:(r,e)=>!!d&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!d&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!d&&Qe(e.href,r),not_regex:(r,e)=>!!d&&!Qe(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r};class H{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),t.getWebExperiments((s=>{H.We("retrieved web experiments from the server"),t.Ge=new Map,s.forEac
4h((n=>{if(n.feature_flag_key){var a;t.Ge&&(H.We("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.Ge)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);L(o)&&n.variants[o]&&t.Ve(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];H.Je(u)&&t.Ve(n.name,l,u.transforms)}}))}),i)},this._instance=e,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}onFeatureFlags(e){if(this._is_bot())H.We("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(O(this.Ge))return this.Ge=new Map,this.loadIfEnabled(),void this.previewWebExperiment();H.We("applying feature flags",e),e.forEach((t=>{var i;if(this.Ge&&(i=this.Ge)!=null&&i.has(t)){var s,n=this._instance.getFeatureFlag(t),a=(s=this.Ge)==null?void 0:s.get(t);n&&a!=null&&a.variants[n]&&this.Ve(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var e=H.getWindowLocation();if(e!=null&&e.search){var t=Gt(e==null?void 0:e.search,"__experiment_id"),i=Gt(e==null?void 0:e.search,"__experiment_variant");t&&i&&(H.We("previewing web experiments "+t+" && "+i),this.getWebExperiments((s=>{this.Ke(parseInt(t),i,s)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance.ui({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:n=>{if(n.statusCode!==200||!n.json)return e([]);var a=n.json.experiments||[];return e(a)}})}Ke(e,t,i){var s=i.filter((n=>n.id===e));s&&s.length>0&&(H.We("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.Ve(s[0].name,t,s[0].variants[t].transforms))}static Je(e){return!O(e.conditions)&&H.Ye(e)&&H.Xe(e)}static Ye(e){var t;if(O(e.conditions)||O((t=e.conditions)==null?void 0:t.url))return!0;var i,s,n,a=H.getWindowLocation();return!!a&&((i=e.conditions)==null||!i.url||yo[(s=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,a))}
4static getWindowLocation(){return d==null?void 0:d.location}static Xe(e){var t;if(O(e.conditions)||O((t=e.conditions)==null?void 0:t.utm))return!0;var i=zs();if(i.utm_source){var s,n,a,o,l,u,c,h,f=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==i.utm_campaign,p=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==i.utm_source,v=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==i.utm_medium,g=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==i.utm_term;return f&&v&&g&&p}return!1}static We(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];y.info("[WebExperiments] "+e,i)}Ve(e,t,i){this._is_bot()?H.We("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?i.forEach((s=>{if(s.selector){var n;H.We("applying transform of variant "+t+" for experiment "+e+" ",s);var a=(n=document)==null?void 0:n.querySelectorAll(s.selector);a==null||a.forEach((o=>{var l=o;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)}))}})):H.We("Control variants leave the page unmodified.")}_is_bot(){return Z&&this._instance?ln(Z,this._instance.config.custom_blocked_useragents):void 0}}var bo=j("[PostHog ExternalIntegrations]"),wo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Eo{constructor(e){this._instance=e}nt(e,t){var i;(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,(s=>{if(s)return bo.error("failed to load script",s);t()}))}startIfEnabledOrStop(){var e=this,t=function(a){var o,l,u;!s||(o=x.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[a]||e.nt(wo[a],(()=>{var c;(c=x.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[a])==null||c.start(e._instance)})),!s&&(l=x.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[a]&&((u=x.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[a])==null||u.stop())};for(var[i,s]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(i)}}}var qi="[SessionRecording]",ot=j(qi);class Kr{get started(){var e;return!((e=this.Qe)==null||!e.isStarted)}get status(){return this.Qe?this.Qe.status:this.Ze&&!this.tr?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Ze=!1,this.ir=void 0,this._instance=e,!this._instance.sessionManager)throw ot.error("started without valid sessionManager"),new Error(qi+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(qi+' cannot be used with cookieless_mode="always"')}get tr(){var e,t=!((e=this._instance.get_property(si))==null||!e.enabled),i=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return d&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this.tr||(t=this.Qe)==null||!t.isStarted){var i=!_(Object.assign)&&!_(Array.from);this.tr&&i?(this.er(e),ot.info("starting")):this.stopRecording()}}er(e){var t,i,s;this.tr&&(x!=null&&(t=x.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=x.__PosthogExtensions__)!=null&&i.initSessionRecording?this.rr(e):(s=x.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.sr,(n=>{if(n)return ot.error("could not load recorder",n);this.rr(e)})))}stopRecording(){var e,t;(e=this.ir)==null||e.call(this),this.ir=void 0,(t=this.Qe)==null||t.stop()}nr(){var e;(e=this._instance.persistence)==null||e.unregister(ds)}ar(e){if(this._instance.persistence){var t,i,s=this._instance.persistence,n=()=>{var a=e.sessionRecording===!1?void 0:e.sessionRecording,o=a==null?void 0:a.sampleRate,l=O(o)?null:parseFloat(o);O(l)&&this.nr();var u=a==null?void 0:a.minimumDurationMilliseconds;s.register({[si]:w({enabled:!!a},a,{networkPayloadCapture:w({capturePerformance:e.capturePerformance},a==null?void 0:a.networkPayloadCapture),canvasRecording:{enabled:a==null?void 0:a.recordCanvas,fps:a==null?void 0:a.canvasFps,quality:a==null?void 0:a.canvasQuality},sampleRate:l,minimumDurationMilliseconds:_(u)?null:u,endpoint:a==null?void 0:a.endpoint,triggerMatchType:a==null?void 0:a.triggerMatchType,masking:a==null?void 0:a.masking,urlTriggers:a==null?void 0:a.urlTriggers})})};n(),(t=this.ir)==null||t.call(this),this.ir=(i=this._instance.sessionManager)==null?void 0:i.onSessionId(n)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.ar(e),this.Ze=!0,this.startIfEnabledOrStop()):this.Ze=!0:ot.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;t===void 0&&(t="log"),(i=this.Qe)!=null&&i.log?this.Qe.log(e,t):ot.warn("log called before recorder was ready")}get sr(){var e,t,i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(si);return(i==null||(t=i.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}rr(e){var t,i;if((t=x.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Qe||(this.Qe=(i=x.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.Qe._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Qe.start(e)}onRRwebEmit(e){var t;(t=this.Qe)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e;(e=this.Qe)==null||e.overrideLinkedFlag()}overrideSampling(){var e;(e=this.Qe)==null||e.overrideSampling()}overrideTrigger(e){var t;(t=this.Qe)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Qe)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!((i=this.Qe)==null||!i.tryAddCustomEvent(e,t))}}var vt={},Ui=()=>{},Be="posthog",un=!Ja&&(V==null?void 0:V.indexOf("MSIE"))===-1&&(V==null?void 0:V.indexOf("Mozilla"))===-1,Qr=r=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:Vn(b==null?void 0:b.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Ui,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:r!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:r??"unset",debug:z&&L(z==null?void 0:z.search)&&z.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(d==null||(e=d.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},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;y.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:ji},error_tracking:{},_onCapture:Ui,__preview_eager_load_replay:!1}},Zr=r=>{var e={};_(r.process_person)||(e.person_profiles=r.process_person),_(r.xhr_headers)||(e.request_headers=r.xhr_headers),_(r.cookie_name)||(e.persistence_name=r.cookie_name),_(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),_(r.store_google)||(e.save_campaign_params=r.store_google),_(r.verbose)||(e.debug=r.verbose);var t=M({},e,r);return T(r.property_blacklist)&&(_(r.property_denylist)?t.property_denylist=r.property_blacklist:T(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:y.error("Invalid value for property_denylist config: "+r.property_denylist)),t};class xo{constructor(){this.__forceAllowLocalhost=!1}get lr(){return this.__forceAllowLocalhost}set lr(e){y.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Zt{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new xo,this.ur=!1,this.version=$e.LIB_VERSION,this.hr=new Qi,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Qr(),this.SentryIntegration=ya,this.sentryIntegration=e=>(function(t,i){var s=Rs(t,i);return{name:Is,processEvent:n=>s(n)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.dr=!1,this.vr=null,this.cr=null,this.pr=null,this.featureFlags=new eo(this),this.toolbar=ne
4w wa(this),this.scrollManager=new po(this),this.pageViewManager=new Ua(this),this.surveys=new ao(this),this.experiments=new H(this),this.exceptions=new Ka(this),this.rateLimiter=new oo(this),this.requestRouter=new mo(this),this.consent=new pa(this),this.externalIntegrations=new Eo(this),this.people={set:(e,t,i)=>{var s=L(e)?{[e]:t}:e;this.setPersonProperties(s),i==null||i({})},set_once:(e,t,i)=>{var s=L(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),i==null||i({})}},this.on("eventCaptured",(e=>y.info('send "'+(e==null?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==Be){var s,n=(s=vt[i])!==null&&s!==void 0?s:new Zt;return n._init(e,t,i),vt[i]=n,vt[Be][i]=n,n}return this._init(e,t,i)}_init(e,t,i){var s,n;if(t===void 0&&(t={}),_(e)||bi(e))return y.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return y.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.gr=t,this._r=[],t.person_profiles&&(this.cr=t.person_profiles),this.set_config(M({},Qr(t.defaults),Zr(t),{name:i,token:e})),this.config.on_xhr_error&&y.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:me.GZipJS;var a=this.mr();this.persistence=new fi(this.config,a),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new fi(w({},this.config,{persistence:"sessionStorage"}),a);var o=w({},this.persistence.props),l=w({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.yr=new uo((P=>this.br(P)),this.config.request_queue_config),this.wr=new ho(this),this.__request_queue=[];var u=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(u||(this.sessionManager=new Yr(this),this.sessionPropsManager=new zr(this,this.sessionManager,this.persistence)),new xa(this).startIfEnabledOrStop(),this.siteApps=new vo(this),(s=this.siteApps)==null||s.init(),u||(this.sessionRecording=new Kr(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new na(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new qa(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new Na(this),this.exceptionObserver=new va(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Fs(this,ga),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new _a(this),this.historyAutocapture.startIfEnabled(),$e.DEBUG=$e.DEBUG||this.config.debug,$e.DEBUG&&y.info("Starting in debug mode",{this:this,config:t,thisC:w({},this.config),p:o,s:l}),((n=t.bootstrap)==null?void 0:n.distinctID)!==void 0){var c,h,f=this.config.get_device_id(Fe()),p=(c=t.bootstrap)!=null&&c.isIdentifiedID?f:t.bootstrap.distinctID;this.persistence.set_property(ve,(h=t.bootstrap)!=null&&h.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:p})}if(this.Sr()){var v,g,m=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlags)||{}).filter((P=>{var S;return!((S=t.bootstrap)==null||(S=S.featureFlags)==null||!S[P])})).reduce(((P,S)=>{var R;return P[S]=((R=t.bootstrap)==null||(R=R.featureFlags)==null?void 0:R[S])||!1,P}),{}),E=Object.keys(((g=t.bootstrap)==null?void 0:g.featureFlagPayloads)||{}).filter((P=>m[P])).reduce(((P,S)=>{var R,U;return(R=t.bootstrap)!=null&&(R=R.featureFlagPayloads)!=null&&R[S]&&(P[S]=(U=t.bootstrap)==null||(U=U.featureFlagPayloads)==null?void 0:U[S]),P}),{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:E})}if(u)this.register_once({distinct_id:tt,$device_id:null},"");else if(!this.get_distinct_id()){var $=this.config.get_device_id(Fe());this.register_once({distinct_id:$,$device_id:$},""),this.persistence.set_property(ve,"anonymous")}return N(d,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?ma(this,(()=>this.Er())):this.Er(),Ie(this.config._onCapture)&&this.config._onCapture!==Ui&&(y.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(P=>this.config._onCapture(P.event,P)))),this.config.ip&&y.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}hi(e){var t,i,s,n,a,o,l,u;if(!b||!b.body)return y.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.hi(e)}),500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=k(e.supportedCompression,me.GZipJS)?me.GZipJS:k(e.supportedCompression,me.Base64)?me.Base64:void 0),(t=e.anal
4ytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.cr?this.cr:"identified_only"}),(i=this.siteApps)==null||i.onRemoteConfig(e),(s=this.sessionRecording)==null||s.onRemoteConfig(e),(n=this.autocapture)==null||n.onRemoteConfig(e),(a=this.heatmaps)==null||a.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(o=this.webVitalsAutocapture)==null||o.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}Er(){try{this.config.loaded(this)}catch(e){y.critical("`loaded` function failed",e)}this.$r(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.kr()}),1),new lo(this).load(),this.featureFlags.flags()}$r(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.yr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Re(this.__request_queue,(e=>this.br(e))),this.__request_queue=[],this.$r()}_handle_unload(){var e,t;this.config.request_batching?(this.Pr()&&this.capture("$pageleave"),(e=this.yr)==null||e.unload(),(t=this.wr)==null||t.unload()):this.Pr()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}ui(e){this.__loaded&&(un?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Yt(e.url,{ip:this.config.ip?1:0}),e.headers=w({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var i,s,n,a=w({},t);a.timeout=a.timeout||6e4,a.url=Yt(a.url,{_:new Date().getTime().toString(),ver:$e.LIB_VERSION,compression:a.compression});var o=(i=a.transport)!==null&&i!==void 0?i:"fetch",l=At.filter((c=>!a.disableTransport||!c.transport||!a.disableTransport.includes(c.transport))),u=(s=(n=us(l,(c=>c.transport===o)))==null?void 0:n.method)!==null&&s!==void 0?s:l[0].method;if(!u)throw new Error("No available transport method");u(a)})(w({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((i=(s=this.config).on_request_error)==null||i.call(s,t)),e.callback==null||e.callback(t)}}))))}br(e){this.wr?this.wr.retriableRequest(e):this.ui(e)}_execute_array(e){var t,i=[],s=[],n=[];Re(e,(o=>{o&&(t=o[0],T(t)?n.push(o):Ie(o)?o.call(this):T(o)&&t==="alias"?i.push(o):T(o)&&t.indexOf("capture")!==-1&&Ie(this[t])?n.push(o):s.push(o))}));var a=function(o,l){Re(o,(function(u){if(T(u[0])){var c=l;C(u,(function(h){c=c[h[0]].apply(c,h.slice(1))}))}else this[u[0]].apply(this,u.slice(1))}),l)};a(i,this),a(s,this),a(n,this)}Sr(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.yr){if(this.is_capturing())if(!_(e)&&L(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var n=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(n==null||!n.isRateLimited){t!=null&&t.$current_url&&!L(t==null?void 0:t.$current_url)&&(y.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,o=(i==null?void 0:i.timestamp)||a,l=Fe(),u={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},o,l)};n&&(u.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),i!=null&&i.$set&&(u.$set=i==null?void 0:i.$set);var c,h=this.Tr(i==null?void 0:i.$set_once);if(h&&(u.$set_once=h),(u=Bn(u,i!=null&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,_(i==null?void 0:i.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===Ot.DISMISSED||e===Ot.SENT){var f=t==null?void 0:t[Br.SURVEY_ID],p=t==null?void 0:t[Br.SURVEY_ITERATION];c={id:f,current_iteration:p},localStorage.getItem(Wr(c))||localStorage.setItem(Wr(c),"true"),u.$set=w({},u.$set,{[io({id:f,current_iteration:p},e===Ot.SENT?"responded":"dismissed")]:!0})}var v=w({},u.properties.$set,u.$set);if(We(v)||this.setPersonPropertiesForFlags(v),!O(this.config.before_send)){var g=this.Ir(u);if(!g)return;u=g}this.hr.emit("eventCaptured",u);var m={method:"POST",url:(s=i==null?void 0:i._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:i==null?void 0:i._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.br(m):this.yr.enqueue(m),u}y.critical("This capture call is ignored due to client rate limiting.")}}else y.error("No event name provided to posthog.capture")}else y.uninitializedWarning("posthog.capture")}Ri(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,i,s,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var a=n?void 0:this.persistence.remove_event_timer(e),o=w({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(o.$cookieless_mode=!0),e==="$snapshot"){var l=w({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!L(o.distinct_id)&&!pe(o.distinct_id)||bi(o.distinct_id))&&y.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var u,c=La(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime());o.$session_id=h,o.$window_id=f}this.sessionPropsManager&&M(o,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&M(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(p=this.wr)==null?void 0:p.length}catch(E){o.$sdk_debug_error_capturing_properties=String(E)}if(this.requestRouter.region===ft.CUSTOM&&(o.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||n?e!=="$pageleave"||n?this.pageViewM
vendor: 10,155 bytes, line 4
4anager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),o=M(o,u),e==="$pageview"&&b&&(o.title=b.title),!_(a)){var v=i.getTime()-a;o.$duration=parseFloat((v/1e3).toFixed(3))}V&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=M({},c,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),T(this.config.property_denylist)?C(this.config.property_denylist,(function(E){delete o[E]})):y.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(y.error("sanitize_properties is deprecated. Use before_send instead"),o=g(o,e));var m=this.Rr();return o.$process_person_profile=m,m&&!n&&this.Cr("_calculate_event_properties"),o}Tr(e){var t;if(!this.persistence||!this.Rr()||this.ur)return e;var i=this.persistence.get_initial_props(),s=(t=this.sessionPropsManager)==null?void 0:t.getSetOnceProps(),n=M({},i,s||{},e||{}),a=this.config.sanitize_properties;return a&&(y.error("sanitize_properties is deprecated. Use before_send instead"),n=a(n,"$set_once")),this.ur=!0,We(n)?void 0:n}register(e,t){var i;(i=this.persistence)==null||i.register(e,t)}register_once(e,t,i){var s;(s=this.persistence)==null||s.register_once(e,t,i)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}Or(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.hr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=so),this.surveys.displaySurvey(e,t)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return y.uninitializedWarning("posthog.identify");if(pe(e)&&(e=e.toString(),y.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))y.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==tt){if(this.Cr("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(lt)&&(this.unregister(lt),this.register({distinct_id:e}));var a=(this.persistence.get_property(ve)||"anonymous")==="anonymous";e!==s&&a?(this.persistence.set_property(ve,"identified"),this.setPersonPropertiesForFlags(w({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.pr=jr(e,t,i),this.featureFlags.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(Nt))}}else y.critical('The string "'+tt+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else y.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Cr("posthog.setPersonProperties")){var i=jr(this.get_distinct_id(),e,t);this.pr!==i?(this.setPersonPropertiesForFlags(w({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.pr=i):y.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){if(this.Cr("posthog.group")){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:w({},s,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),s[e]===t||i||this.reloadFeatureFlags()}}else y.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.Cr("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,n;if(y.info("reset"),!this.__loaded)return y.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(i=this.sessionPersistence)==null||i.clear(),this.surveys.reset(),this.featureFlags.reset(),(s=this.persistence)==null||s.set_property(ve,"anonymous"),(n=this.sessionManager)==null||n.resetSessionId(),this.pr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:tt,$device_id:null},"");else{var o=this.config.get_device_id(Fe());this.register_once({distinct_id:o,$device_id:e?o:a},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&i){var n,a=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!i)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-a,0)}return s}alias(e,t){return e===this.get_property(cs)?(y.critical("Attempting to create alias for existing People user - aborting."),-2):this.Cr("posthog.alias")?(_(t)&&(t=this.get_distinct_id()),e!==t?(this.Or(lt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(y.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=w({},this.config);if(G(e)){var i,s,n,a,o;M(this.config,Zr(e));var l=this.mr();(i=this.persistence)==null||i.update_config(this.config,t,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new fi(w({},this.config,{persistence:"sessionStorage"}),l),D.G()&&D.J("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&($e.DEBUG=!0,y.info("set_config",{config:e,oldConfig:t,newConfig:w({},this.config)})),(s=this.sessionRecording)==null||s.startIfEnabledOrStop(),(n=this.autocapture)==null||n.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),this.surveys.loadIfEnabled(),this.Fr(),(o=this.externalIntegrations)==null||o.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,i={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(i).some(Boolean)){var s,n,a,o,l;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),i.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),i.linked_flag&&((a=this.sessionRecording)==null||a.overrideLinkedFlag()),i.url_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("url")),i.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(w({},s,t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Be;return t!==Be&&(t=Be+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(ve))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(ve))==="identified"}Rr(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&We(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[lt])&&((t=this.persistence)==null||(t=t.props)==null||!t[qt]))}Pr(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Rr()||this.Cr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Cr(e){return this.config.person_profiles==="never"?(y.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Or(qt,!0),!0)}
4mr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}Fr(){var e,t,i,s,n=this.mr();return((e=this.persistence)==null?void 0:e.gi)!==n&&((i=this.persistence)==null||i.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.gi)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n}opt_in_capturing(e){if(this.config.cookieless_mode!=="always"){var t,i;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(t=this.sessionManager)==null||t.destroy(),this.sessionManager=new Yr(this),this.persistence&&(this.sessionPropsManager=new zr(this,this.sessionManager,this.persistence)),this.sessionRecording=new Kr(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Fr(),this.$r(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(_(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((i=e==null?void 0:e.captureEventName)!==null&&i!==void 0?i:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.kr()}else y.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Fr(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:tt,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(t=this.sessionRecording)==null||t.stopRecording(),this.sessionRecording=void 0,this.kr())):y.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===_e.GRANTED?"granted":e===_e.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Fr()}_is_bot(){return Z?ln(Z,this.config.custom_blocked_useragents):void 0}kr(){b&&(b.visibilityState==="visible"?this.dr||(this.dr=!0,this.capture("$pageview",{title:b.title},{send_instantly:!0}),this.vr&&(b.removeEventListener("visibilitychange",this.vr),this.vr=null)):this.vr||(this.vr=this.kr.bind(this),N(b,"visibilitychange",this.vr)))}debug(e){e===!1?(d==null||d.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(d==null||d.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}L(){var e,t,i,s,n,a,o,l=this.gr||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(y.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",s=!1,n=y,a=(t="advanced_disable_flags")in(e=l)&&!_(e[t]),o=i in e&&!_(e[i]),a?e[t]:o?(n&&n.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]):s)}Ir(e){if(O(this.config.before_send))return e;var t=T(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),O(i)){var n="Event '"+e.event+"' was rejected in beforeSend function";return _n(e.event)?y.warn(n+". This can cause unexpected behavior."):y.info(n),null}i.properties&&!We(i.properties)||y.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;
4return(e=this.pageViewManager.Wt)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}}(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=Gn(r.prototype[e[t]])})(Zt,["identify"]);var es,ko=(es=vt[Be]=new Zt,(function(){function r(){r.done||(r.done=!0,un=!1,C(vt,(function(e){e._dom_loaded()})))}b!=null&&b.addEventListener?b.readyState==="complete"?r():N(b,"DOMContentLoaded",r,{capture:!1}):d&&y.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),es);export{ni as COPY_AUTOCAPTURE_EVENT,me as Compression,on as DisplaySurveyType,Zt as PostHog,Ot as SurveyEventName,Br as SurveyEventProperties,gi as SurveyType,ko as default,ko as posthog};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.