@deriv-com/analytics 1.41.1 → 1.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +0,0 @@
1
- /* @deriv-com/analytics - Browser ESM Bundle (RudderStack + PostHog) - Built with tsup */
2
- import{d as fr,e as mr,f as yr,g as br,h as wr}from"./chunk-F3U33XPR.mjs";var p=typeof window<"u"?window:void 0,K=typeof globalThis<"u"?globalThis:p;typeof self>"u"&&(K.self=K),typeof File>"u"&&(K.File=function(){});var ce=K?.navigator,b=K?.document,Q=K?.location,es=K?.fetch,ts=K!=null&&K.XMLHttpRequest&&"withCredentials"in new K.XMLHttpRequest?K.XMLHttpRequest:void 0,Er=K?.AbortController,jo=K?.CompressionStream,ae=ce?.userAgent,P=p??{},xr="1.369.0",re={DEBUG:!1,LIB_VERSION:xr,LIB_NAME:"web",JS_SDK_VERSION:xr};function kr(i,e,t,s,r,n,o){try{var a=i[n](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(s,r)}function be(i){return function(){var e=this,t=arguments;return new Promise((function(s,r){var n=i.apply(e,t);function o(l){kr(n,s,r,o,a,"next",l)}function a(l){kr(n,s,r,o,a,"throw",l)}o(void 0)}))}}function m(){return m=Object.assign?Object.assign.bind():function(i){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var s in t)({}).hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},m.apply(null,arguments)}function Tn(i,e){if(i==null)return{};var t={};for(var s in i)if({}.hasOwnProperty.call(i,s)){if(e.indexOf(s)!==-1)continue;t[s]=i[s]}return t}function Fn(){return(Fn=be((function*(i,e,t){e===void 0&&(e=!0);try{var s=new Blob([i],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(s).blob()}catch(r){if(t!=null&&t.rethrow)throw r;return e&&console.error("Failed to gzip compress data",r),null}}))).apply(this,arguments)}var Ho=["$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"],qo=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Sr=function(i,e){if(e===void 0&&(e=[]),!i)return!1;var t=i.toLowerCase();return qo.concat(e).some((s=>{var r=s.toLowerCase();return t.indexOf(r)!==-1}))};function M(i,e){return i.indexOf(e)!==-1}var Ri=function(i){return i.trim()},is=function(i){return i.replace(/^\$/,"")},In=Object.prototype,$n=In.hasOwnProperty,Pi=In.toString,D=Array.isArray||function(i){return Pi.call(i)==="[object Array]"},Ie=i=>typeof i=="function",J=i=>i===Object(i)&&!D(i),nt=i=>{if(J(i)){for(var e in i)if($n.call(i,e))return!1;return!0}return!1},x=i=>i===void 0,X=i=>Pi.call(i)=="[object String]",ei=i=>X(i)&&i.trim().length===0,Oe=i=>i===null,L=i=>x(i)||Oe(i),Ee=i=>Pi.call(i)=="[object Number]"&&i==i,it=i=>Ee(i)&&i>0,Se=i=>Pi.call(i)==="[object Boolean]",zo=i=>i instanceof FormData,Wo=i=>M(Ho,i);function On(i){return i===null||typeof i!="object"}function si(i,e){return{}.toString.call(i)==="[object "+e+"]"}function ir(i){return typeof Event<"u"&&(function(e,t){try{return e instanceof t}catch{return!1}})(i,Event)}var Vo=[!0,"true",1,"1","yes"],Ci=i=>M(Vo,i),Bo=[!1,"false",0,"0","no"];function Re(i,e,t,s,r){return e>t&&(s.warn("min cannot be greater than max."),e=t),Ee(i)?i>t?(s.warn(" cannot be greater than max: "+t+". Using max value instead."),t):e>i?(s.warn(" cannot be less than min: "+e+". Using min value instead."),e):i:(s.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+r),Re(r||t,e,t,s))}var ss=class{constructor(e){this.Pt={},this.Dt=e.Dt,this.jt=Re(e.bucketSize,0,100,e.qt),this.$t=Re(e.refillRate,0,this.jt,e.qt),this.Vt=Re(e.refillInterval,0,864e5,e.qt)}Ht(e,t){var s=Math.floor((t-e.lastAccess)/this.Vt);s>0&&(e.tokens=Math.min(e.tokens+s*this.$t,this.jt),e.lastAccess=e.lastAccess+s*this.Vt)}consumeRateLimit(e){var t,s=Date.now(),r=String(e),n=this.Pt[r];return n?this.Ht(n,s):this.Pt[r]=n={tokens:this.jt,lastAccess:s},n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.Dt)==null||t.call(this,e)),n.tokens===0)}stop(){this.Pt={}}},Wt,Rr,Ai,he="Mobile",ri="iOS",$e="Android",ct="Tablet",Cn=$e+" "+ct,An="iPad",Mn="Apple",Ln=Mn+" Watch",It="Safari",ht="BlackBerry",Dn="Samsung",Nn=Dn+"Browser",Un=Dn+" Internet",Ge="Chrome",Go=Ge+" OS",jn=Ge+" "+ri,sr="Internet Explorer",Hn=sr+" "+he,rr="Opera",Xo=rr+" Mini",nr="Edge",qn="Microsoft "+nr,lt="Firefox",zn=lt+" "+ri,Lt="Nintendo",Dt="PlayStation",ut="Xbox",Wn=$e+" "+he,Vn=he+" "+It,kt="Windows",rs=kt+" Phone",Pr="Nokia",ns="Ouya",Bn="Generic",Yo=Bn+" "+he.toLowerCase(),Gn=Bn+" "+ct.toLowerCase(),os="Konqueror",se="(\\d+(\\.\\d+)?)",Mi=new RegExp("Version/"+se),Jo=new RegExp(ut,"i"),Ko=new RegExp(Dt+" \\w+","i"),Zo=new RegExp(Lt+" \\w+","i"),or=new RegExp(ht+"|PlayBook|BB10","i"),Qo={"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"},Xn=function(i,e){return e=e||"",M(i," OPR/")&&M(i,"Mini")?Xo:M(i," OPR/")?rr:or.test(i)?ht:M(i,"IE"+he)||M(i,"WPDesktop")?Hn:M(i,Nn)?Un:M(i,nr)||M(i,"Edg/")?qn:M(i,"FBIOS")?"Facebook "+he:M(i,"UCWEB")||M(i,"UCBrowser")?"UC Browser":M(i,"CriOS")?jn:M(i,"CrMo")||M(i,Ge)?Ge:M(i,$e)&&M(i,It)?Wn:M(i,"FxiOS")?zn:M(i.toLowerCase(),os.toLowerCase())?os:((t,s)=>s&&M(s,Mn)||(function(r){return M(r,It)&&!M(r,Ge)&&!M(r,$e)})(t))(i,e)?M(i,he)?Vn:It:M(i,lt)?lt:M(i,"MSIE")||M(i,"Trident/")?sr:M(i,"Gecko")?lt:""},ea={[Hn]:[new RegExp("rv:"+se)],[qn]:[new RegExp(nr+"?\\/"+se)],[Ge]:[new RegExp("("+Ge+"|CrMo)\\/"+se)],[jn]:[new RegExp("CriOS\\/"+se)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+se)],[It]:[Mi],[Vn]:[Mi],[rr]:[new RegExp("(Opera|OPR)\\/"+se)],[lt]:[new RegExp(lt+"\\/"+se)],[zn]:[new RegExp("FxiOS\\/"+se)],[os]:[new RegExp("Konqueror[:/]?"+se,"i")],[ht]:[new RegExp(ht+" "+se),Mi],[Wn]:[new RegExp("android\\s"+se,"i")],[Un]:[new RegExp(Nn+"\\/"+se)],[sr]:[new RegExp("(rv:|MSIE )"+se)],Mozilla:[new RegExp("rv:"+se)]},ta=function(i,e){var t=Xn(i,e),s=ea[t];if(x(s))return null;for(var r=0;s.length>r;r++){var n=i.match(s[r]);if(n)return parseFloat(n[n.length-2])}return null},Tr=[[new RegExp(ut+"; "+ut+" (.*?)[);]","i"),i=>[ut,i&&i[1]||""]],[new RegExp(Lt,"i"),[Lt,""]],[new RegExp(Dt,"i"),[Dt,""]],[or,[ht,""]],[new RegExp(kt,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[rs,""];if(new RegExp(he).test(e)&&!/IEMobile\b/.test(e))return[kt+" "+he,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var s=Qo[t[1]]||"";return/arm/i.test(e)&&(s="RT"),[kt,s]}return[kt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>i&&i[3]?[ri,[i[3],i[4],i[5]||"0"].join(".")]:[ri,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=x(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+$e+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+$e+")","i"),i=>i&&i[2]?[$e,[i[2],i[3],i[4]||"0"].join(".")]:[$e,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];return i&&i[1]&&(e[1]=[i[1],i[2],i[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Go,""]],[/Linux|debian/i,["Linux",""]]],Fr=function(i){return Zo.test(i)?Lt:Ko.test(i)?Dt:Jo.test(i)?ut:new RegExp(ns,"i").test(i)?ns:new RegExp("("+rs+"|WPDesktop)","i").test(i)?rs:/iPad/.test(i)?An:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?Ln:or.test(i)?ht:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(Pr,"i").test(i)?Pr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?new RegExp(he).test(i)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)||/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?$e:Cn:new RegExp("(pda|"+he+")","i").test(i)?Yo:new RegExp(ct,"i").test(i)&&!new RegExp(ct+" pc","i").test(i)?Gn:""},ia=i=>i instanceof Error;function sa(i){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return Ai&&t.length===Rr||(Rr=t.length,Ai=t.reduce(((s,r)=>{Wt||(Wt={});var n=Wt[r];if(n)s[n[0]]=n[1];else for(var o=i(r),a=o.length-1;a>=0;a--){var l=o[a],c=l?.filename,u=e[r];if(c&&u){s[c]=u,Wt[r]=[c,u];break}}return s}),{})),Ai}}var as=class{constructor(e,t,s){s===void 0&&(s=[]),this.coercers=e,this.stackParser=t,this.modifiers=s}buildFromUnknown(e,t){t===void 0&&(t={});var s=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(s,t,0).apply(e),n=this.buildParsingContext(t),o=this.parseStacktrace(r,n);return{$exception_list:this.convertToExceptionList(o,s),$exception_level:"error"}}modifyFrames(e){var t=this;return be((function*(){for(var s of e)s.stacktrace&&s.stacktrace.frames&&D(s.stacktrace.frames)&&(s.stacktrace.frames=yield t.applyModifiers(s.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 s,r;return e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),m({},e,{cause:s,stack:r})}applyChunkIds(e,t){return e.map((s=>(s.filename&&t&&(s.chunk_id=t[s.filename]),s)))}applyCoercers(e,t){for(var s of this.coercers)if(s.match(e))return s.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return be((function*(){var s=e;for(var r of t.modifiers)s=yield r(s);return s}))()}convertToExceptionList(e,t){var s,r,n,o={type:e.type,value:e.value,mechanism:{type:(s=t.type)!==null&&s!==void 0?s:"generic",handled:(r=t.handled)===null||r===void 0||r,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,m({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:sa(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,s){s===void 0&&(s=0);var r=(n,o)=>{if(4>=o){var a=this.buildCoercingContext(e,t,o);return this.applyCoercers(n,a)}};return m({},t,{syntheticException:s==0?t.syntheticException:void 0,mechanism:e,apply:n=>r(n,s),next:n=>r(n,s+1)})}},dt="?";function ls(i,e,t,s,r){var n={platform:i,filename:e,function:t==="<anonymous>"?dt:t,in_app:!0};return x(s)||(n.lineno=s),x(r)||(n.colno=r),n}var Yn=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,s=i.indexOf("safari-web-extension")!==-1;return t||s?[i.indexOf("@")!==-1?i.split("@")[0]:dt,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},ra=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,na=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,oa=/\((\S*)(?::(\d+))(?::(\d+))\)/,aa=(i,e)=>{var t=ra.exec(i);if(t){var[,s,r,n]=t;return ls(e,s,dt,+r,+n)}var o=na.exec(i);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=oa.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=Yn(o[1]||dt,o[2]);return ls(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},la=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ua=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ca=(i,e)=>{var t=la.exec(i);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var s=ua.exec(t[3]);s&&(t[1]=t[1]||"eval",t[3]=s[1],t[4]=s[2],t[5]="")}var r=t[3],n=t[1]||dt;return[n,r]=Yn(n,r),ls(e,r,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Ir=/\(error: (.*)\)/,us=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var s=X(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:s?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 si(e,"DOMException")}isDOMError(e){return si(e,"DOMError")}},cs=class{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 s=e.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(e){return e.stacktrace||e.stack||void 0}},hs=class{constructor(){}match(e){return si(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var s;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}},ha=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,ds=class{match(e){return typeof e=="string"}coerce(e,t){var s,[r,n]=this.getInfos(e);return{type:r??"Error",value:n??e,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(e){var t="Error",s=e,r=e.match(ha);return r&&(t=r[1],s=r[2]),[t,s]}},da=["fatal","error","warning","log","info","debug"];function Jn(i,e){e===void 0&&(e=40);var t=Object.keys(i);if(t.sort(),!t.length)return"[object has no keys]";for(var s=t.length;s>0;s--){var r=t.slice(0,s).join(", ");if(e>=r.length)return s===t.length?r:r.length>e?r.slice(0,e)+"...":r}return""}var ps=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var s,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(s=t.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return ir(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 s=this.getObjectClassName(e);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+Jn(e)}isSeverityLevel(e){return X(e)&&!ei(e)&&da.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var s=e[t];if(ia(s))return s}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},gs=class{match(e){return ir(e)}coerce(e,t){var s,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Jn(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}},vs=class{match(e){return On(e)}coerce(e,t){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}},_s=class{match(e){return si(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!ir(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var s,r=this.getUnhandledRejectionReason(e);return On(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},Kn=function(i,e){var{debugEnabled:t}=e===void 0?{}:e,s={C(r){if(p&&(re.DEBUG||P.POSTHOG_DEBUG||t)&&!x(p.console)&&p.console){for(var n=("__rrweb_original__"in p.console[r])?p.console[r].__rrweb_original__:p.console[r],o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];n(i,...a)}},info(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];s.C("log",...n)},warn(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];s.C("warn",...n)},error(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];s.C("error",...n)},critical(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];console.error(i,...n)},uninitializedWarning(r){s.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>Kn(i+" "+r,n)};return s},w=Kn("[PostHog.js]"),z=w.createLogger,pa=z("[ExternalScriptsLoader]"),Vt=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return pa.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var s=b?.querySelectorAll("script");if(s){for(var r,n=function(){if(s[o].src===e){var l=s[o];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(c=>{l.__posthog_loading_callback_fired=!0,t(void 0,c)})),l.onerror=c=>t(c),{v:void 0})}},o=0;s.length>o;o++)if(r=n())return r.v}var a=()=>{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),i.config.prepare_external_dependency_script&&(l=i.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(i.config.external_scripts_inject_target==="head")b.head.appendChild(l);else{var c,u=b.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):b.body.appendChild(l)}};b!=null&&b.body?a():b?.addEventListener("DOMContentLoaded",a)};P.__PosthogExtensions__=P.__PosthogExtensions__||{},P.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{if(e!=="remote-config")if(i._resolvedSdkVersion){var s=i.requestRouter.endpointFor("assets","/static/"+i._resolvedSdkVersion+"/"+e+".js");Vt(i,s,t)}else{var r="/static/"+e+".js?v="+i.version;if(e==="toolbar"){var n=3e5;r=r+"&t="+Math.floor(Date.now()/n)*n}var o=i.requestRouter.endpointFor("assets",r);Vt(i,o,t)}else{var a=i.requestRouter.endpointFor("assets","/array/"+i.config.token+"/config.js");Vt(i,a,t)}},P.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var s=i.requestRouter.endpointFor("api",e);Vt(i,s,t)};var Zn="$people_distinct_id",ni="$device_id",St="__alias",Rt="__timers",$r="$autocapture_disabled_server_side",fs="$heatmaps_enabled_server_side",Or="$exception_capture_enabled_server_side",ms="$error_tracking_suppression_rules",Cr="$error_tracking_capture_extension_exceptions",Ar="$web_vitals_enabled_server_side",Qn="$dead_clicks_enabled_server_side",Mr="$product_tours_enabled_server_side",Lr="$web_vitals_allowed_metrics",Bt="$session_recording_remote_config",oi="$sesid",eo="$session_is_sampled",ot="$enabled_feature_flags",Pt="$early_access_features",ys="$feature_flag_details",Tt="$stored_person_properties",Be="$stored_group_properties",bs="$surveys",$t="$flag_call_reported",ws="$flag_call_reported_session_id",Es="$feature_flag_errors",ai="$feature_flag_evaluated_at",ye="$user_state",xs="$client_session_props",ks="$capture_rate_limit",Ss="$initial_campaign_params",Rs="$initial_referrer_info",li="$initial_person_info",ui="$epp",to="__POSTHOG_TOOLBAR__",Gt="$posthog_cookieless",ga=[Zn,St,"__cmpns",Rt,"$session_recording_enabled_server_side",fs,oi,ot,ms,ye,Pt,ys,Be,Tt,bs,$t,ws,Es,ai,xs,ks,Ss,Rs,ui,li],ar="PostHog loadExternalDependency extension not found.",Fe="on_reject",we="always",Ze="anonymous",Qe="identified",Ps="identified_only",ci="visibilitychange",hi="beforeunload",st="$pageview",Li="$pageleave",Di="$identify",Dr="$groupidentify";function Xt(i,e){D(i)&&i.forEach(e)}function q(i,e){if(!L(i))if(D(i))i.forEach(e);else if(zo(i))i.forEach(((s,r)=>e(s,r)));else for(var t in i)$n.call(i,t)&&e(i[t],t)}var B=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),s=1;e>s;s++)t[s-1]=arguments[s];for(var r of t)for(var n in r)r[n]!==void 0&&(i[n]=r[n]);return i};function ti(i){for(var e=Object.keys(i),t=e.length,s=new Array(t);t--;)s[t]=[e[t],i[e[t]]];return s}var Nr=function(i){try{return i()}catch{return}},va=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),s=0;e>s;s++)t[s]=arguments[s];return i.apply(this,t)}catch(r){w.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),w.critical(r)}}},lr=function(i){var e={};return q(i,(function(t,s){(X(t)&&t.length>0||Ee(t))&&(e[s]=t)})),e},_a=["herokuapp.com","vercel.app","netlify.app"];function fa(i){var e=i?.hostname;if(!X(e))return!1;var t=e.split(".").slice(-2).join(".");for(var s of _a)if(t===s)return!1;return!0}function G(i,e,t,s){var{capture:r=!1,passive:n=!0}=s??{};i?.addEventListener(e,t,{capture:r,passive:n})}function io(i){return i.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(i){return 0>i?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return Ee(i)&&isFinite(i)&&Math.floor(i)===i});var Ts=class i{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,s,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(s)||!Number.isInteger(r)||0>e||0>t||0>s||0>r||e>0xffffffffffff||t>4095||s>1073741823||r>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|s>>>24,n[9]=s>>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new i(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),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 i(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var s=this.bytes[t]-e.bytes[t];if(s!==0)return Math.sign(s)}return 0}},Fs=class{constructor(){this.I=0,this.S=0,this.k=new Is}generate(){var e=this.generateOrAbort();if(x(e)){this.I=0;var t=this.generateOrAbort();if(x(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.I)this.I=e,this.A();else{if(this.I>=e+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Ts.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}},Ur,so=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;i.length>e;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};p&&!x(p.crypto)&&crypto.getRandomValues&&(so=i=>crypto.getRandomValues(i));var Is=class{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(so(this.T),this.N=0),this.T[this.N++]}},Ue=()=>ma().toString(),ma=()=>(Ur||(Ur=new Fs)).generate(),vt="",ya=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ke={Ut:()=>!!b,Yt(i){w.error("cookieStore error: "+i)},Gt(i){if(b){try{for(var e=i+"=",t=b.cookie.split(";").filter((n=>n.length)),s=0;t.length>s;s++){for(var r=t[s];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}}catch{}return null}},Wt(i){var e;try{e=JSON.parse(ke.Gt(i))||{}}catch{}return e},Xt(i,e,t,s,r){if(b)try{var n="",o="",a=(function(u,h){if(h){var d=(function(v,_){if(_===void 0&&(_=b),vt)return vt;if(!_||["localhost","127.0.0.1"].includes(v))return"";for(var C=v.split("."),S=Math.min(C.length,8),$="dmn_chk_"+Ue();!vt&&S--;){var I=C.slice(S).join("."),T=$+"=1;domain=."+I+";path=/";_.cookie=T+";max-age=3",_.cookie.includes($)&&(_.cookie=T+";max-age=0",vt=I)}return vt})(u);if(!d){var g=(v=>{var _=v.match(ya);return _?_[0]:""})(u);g!==d&&w.info("Warning: cookie subdomain discovery mismatch",g,d),d=g}return d?"; domain=."+d:""}return""})(b.location.hostname,s);if(t){var l=new Date;l.setTime(l.getTime()+864e5*t),n="; expires="+l.toUTCString()}r&&(o="; secure");var c=i+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&w.warn("cookieStore warning: large cookie, len="+c.length),b.cookie=c,c}catch{return}},Jt(i,e){if(b!=null&&b.cookie)try{ke.Xt(i,"",-1,e)}catch{return}}},Ni=null,W={Ut(){if(!Oe(Ni))return Ni;var i=!0;if(x(p))i=!1;else try{var e="__mplssupport__";W.Xt(e,"xyz"),W.Gt(e)!=='"xyz"'&&(i=!1),W.Jt(e)}catch{i=!1}return i||w.error("localStorage unsupported; falling back to cookie store"),Ni=i,i},Yt(i){w.error("localStorage error: "+i)},Gt(i){try{return p?.localStorage.getItem(i)}catch(e){W.Yt(e)}return null},Wt(i){try{return JSON.parse(W.Gt(i))||{}}catch{}return null},Xt(i,e){try{p?.localStorage.setItem(i,JSON.stringify(e))}catch(t){W.Yt(t)}},Jt(i){try{p?.localStorage.removeItem(i)}catch(e){W.Yt(e)}}},ba=[ni,"distinct_id",oi,eo,ui,li,ye],Yt={},wa={Ut:()=>!0,Yt(i){w.error("memoryStorage error: "+i)},Gt:i=>Yt[i]||null,Wt:i=>Yt[i]||null,Xt(i,e){Yt[i]=e},Jt(i){delete Yt[i]}},qe=null,ee={Ut(){if(!Oe(qe))return qe;if(qe=!0,x(p))qe=!1;else try{var i="__support__";ee.Xt(i,"xyz"),ee.Gt(i)!=='"xyz"'&&(qe=!1),ee.Jt(i)}catch{qe=!1}return qe},Yt(i){w.error("sessionStorage error: ",i)},Gt(i){try{return p?.sessionStorage.getItem(i)}catch(e){ee.Yt(e)}return null},Wt(i){try{return JSON.parse(ee.Gt(i))||null}catch{}return null},Xt(i,e){try{p?.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){ee.Yt(t)}},Jt(i){try{p?.sessionStorage.removeItem(i)}catch(e){ee.Yt(e)}}},$s=class{constructor(e){this._instance=e}get Rt(){return this._instance.config}get consent(){return this.Kt()?0:this.Qt}isOptedOut(){return this.Rt.cookieless_mode===we||this.consent===0||this.consent===-1&&(this.Rt.opt_out_capturing_by_default||this.Rt.cookieless_mode===Fe)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}optInOut(e){this.ti.Xt(this.ei,e?1:0,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}reset(){this.ti.Jt(this.ei,this.Rt.cross_subdomain_cookie)}get ei(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:s}=this._instance.config;return s||(t?t+e:"__ph_opt_in_out_"+e)}get Qt(){var e=this.ti.Gt(this.ei);return Ci(e)?1:M(Bo,e)?0:-1}get ti(){var e=this.Rt.opt_out_capturing_persistence_type,t=e==="localStorage"?W:ke;if(!this.ii||this.ii!==t){this.ii=t;var s=e==="localStorage"?ke:W;s.Gt(this.ei)&&(this.ii.Gt(this.ei)||this.optInOut(Ci(s.Gt(this.ei))),s.Jt(this.ei,this.Rt.cross_subdomain_cookie))}return this.ii}Kt(){return!!this.Rt.respect_dnt&&[ce?.doNotTrack,ce?.msDoNotTrack,P.doNotTrack].some((e=>Ci(e)))}},Jt=z("[Dead Clicks]"),Ea=()=>!0,xa=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(Qn)),s=i.instance.config.capture_dead_clicks;return Se(s)?s:!!J(s)||t},di=class{get lazyLoadedDeadClicksAutocapture(){return this.ri}constructor(e,t,s){this.instance=e,this.isEnabled=t,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Qn]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ni((()=>{this.si()})):this.stop()}ni(e){var t,s;(t=P.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(s=P.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?Jt.error("failed to load script",r):e()}))}si(){var e;if(b){if(!this.ri&&(e=P.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=J(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ri=P.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ri.start(b),Jt.info("starting...")}}else Jt.error("`document` not found. Cannot start.")}stop(){this.ri&&(this.ri.stop(),this.ri=void 0,Jt.info("stopping..."))}},Ui=z("[SegmentIntegration]"),ro="posthog-js";function no(i,e){var{organization:t,projectId:s,prefix:r,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,c,u,h,d;if(n!=="*"&&!n.includes(a.level)||!i.__loaded)return a;a.tags||(a.tags={});var g=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());a.tags["PostHog Person URL"]=g,i.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var v,_=((l=a.exception)==null?void 0:l.values)||[],C=_.map(($=>m({},$,{stacktrace:$.stacktrace?m({},$.stacktrace,{type:"raw",frames:($.stacktrace.frames||[]).map((I=>m({},I,{platform:"web:javascript"})))}):void 0}))),S={$exception_message:((c=_[0])==null?void 0:c.value)||a.message,$exception_type:(u=_[0])==null?void 0:u.type,$exception_level:a.level,$exception_list:C,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((h=_[0])==null?void 0:h.value)||a.message,$sentry_exception_type:(d=_[0])==null?void 0:d.type,$sentry_tags:a.tags};return t&&s&&(S.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+s+"&query="+a.event_id),o&&((v=i.exceptions)==null||v.sendExceptionEvent(S)),a}}var Os=class{constructor(e,t,s,r,n,o){this.name=ro,this.setupOnce=function(a){a(no(e,{organization:t,projectId:s,prefix:r,severityAllowList:n,sendExceptionsToPostHog:o==null||o}))}}},pi=class{constructor(e){this.oi=(t,s,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength)&&(w.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),this.ai=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.li()}li(){var e;this.ui=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.oi)}destroy(){var e;(e=this.ui)==null||e.call(this),this.ui=void 0}doPageView(e,t){var s,r=this.hi(e,t);return this.ai={pathname:(s=p?.location.pathname)!==null&&s!==void 0?s:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.hi(e,(t=this.ai)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ai)==null?void 0:e.pageViewId}}hi(e,t){var s=this.ai;if(!s)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:s.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:h}=n;if(!(x(o)||x(a)||x(l)||x(c)||x(u)||x(h))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),h=Math.ceil(h);var d=o>1?Re(a/o,0,1,w):1,g=o>1?Re(l/o,0,1,w):1,v=c>1?Re(u/c,0,1,w):1,_=c>1?Re(h/c,0,1,w):1;r=B(r,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:g,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:_})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(e.getTime()-s.timestamp.getTime())/1e3),r}},gi=i=>{var e=b?.createElement("a");return x(e)?null:(e.href=i,e)},vi=function(i,e){for(var t,s=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===e){t=n;break}}if(!D(t)||2>t.length)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{w.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Nt=function(i,e,t){if(!i||!e||!e.length)return i;for(var s=i.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),c=[],u=0;l.length>u;u++){var h=l[u].split("=");D(h)&&(e.includes(h[0])?c.push(h[0]+"="+t):c.push(l[u]))}var d=a;return o!=null&&(d+="?"+c.join("&")),r!=null&&(d+="#"+r),d},_i=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},Kt="https?://(.*)",pt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ka=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...pt],Ut="<masked>",Sa=["li_fat_id"];function oo(i,e,t){if(!b)return{};var s,r=e?[...pt,...t||[]]:[],n=ao(Nt(b.URL,r,Ut),i),o=(s={},q(Sa,(function(a){var l=ke.Gt(a);s[a]=l||null})),s);return B(o,n)}function ao(i,e){var t=ka.concat(e||[]),s={};return q(t,(function(r){var n=vi(i,r);s[r]=n||null})),s}function lo(i){var e=(function(n){return n?n.search(Kt+"google.([^/?]*)")===0?"google":n.search(Kt+"bing.com")===0?"bing":n.search(Kt+"yahoo.com")===0?"yahoo":n.search(Kt+"duckduckgo.com")===0?"duckduckgo":null:null})(i),t=e!="yahoo"?"q":"p",s={};if(!Oe(e)){s.$search_engine=e;var r=b?vi(b.referrer,t):"";r.length&&(s.ph_keyword=r)}return s}function jr(){return navigator.language||navigator.userLanguage}var fi="$direct";function uo(){return b?.referrer||fi}function co(i,e){var t=i?[...pt,...e||[]]:[],s=Q?.href.substring(0,1e3);return{r:uo().substring(0,1e3),u:s?Nt(s,t,Ut):void 0}}function ho(i){var e,{r:t,u:s}=i,r={$referrer:t,$referring_domain:t==null?void 0:t==fi?fi:(e=gi(t))==null?void 0:e.host};if(s){r.$current_url=s;var n=gi(s);r.$host=n?.host,r.$pathname=n?.pathname;var o=ao(s);B(r,o)}if(t){var a=lo(t);B(r,a)}return r}function po(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Ra(){try{return new Date().getTimezoneOffset()}catch{return}}var Pa=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ot=class{constructor(e,t){this.Rt=e,this.props={},this.ci=!1,this.di=(s=>{var r="";return s.token&&(r=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+r+"_posthog"})(e),this.ti=this.vi(e),this.load(),e.debug&&w.info("Persistence loaded",e.persistence,m({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.fi}vi(e){Pa.indexOf(e.persistence.toLowerCase())===-1&&(w.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(r){r===void 0&&(r=[]);var n=[...ba,...r];return m({},W,{Wt(o){try{var a={};try{a=ke.Wt(o)||{}}catch{}var l=B(a,JSON.parse(W.Gt(o)||"{}"));return W.Xt(o,l),l}catch{}return null},Xt(o,a,l,c,u,h){try{W.Xt(o,a,void 0,void 0,h);var d={};n.forEach((g=>{a[g]&&(d[g]=a[g])})),Object.keys(d).length&&ke.Xt(o,d,l,c,u,h)}catch(g){W.Yt(g)}},Jt(o,a){try{p?.localStorage.removeItem(o),ke.Jt(o,a)}catch(l){W.Yt(l)}}})})(e.cookie_persisted_properties||[]),s=e.persistence.toLowerCase();return s==="localstorage"&&W.Ut()?W:s==="localstorage+cookie"&&t.Ut()?t:s==="sessionstorage"&&ee.Ut()?ee:s==="memory"?wa:s==="cookie"?ke:t.Ut()?t:ke}pi(e){var t=e??this.Rt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var s=this.props[ai];return!s||typeof s!="number"||Date.now()-s>t}properties(){var e={};return q(this.props,((t,s)=>{if(s===ot&&J(t)){if(!this.pi())for(var r=Object.keys(t),n=0;r.length>n;n++)e["$feature/"+r[n]]=t[r[n]]}else ga.indexOf(s)===-1&&(e[s]=t)})),e}load(){if(!this.fi){var e=this.ti.Wt(this.di);e&&(this.props=B({},e))}}save(){this.fi||this.ti.Xt(this.di,this.props,this.gi,this.mi,this.yi,this.Rt.debug)}remove(){this.ti.Jt(this.di,!1),this.ti.Jt(this.di,!0)}clear(){this.remove(),this.props={}}register_once(e,t,s){if(J(e)){x(t)&&(t="None"),this.gi=x(s)?this.bi:s;var r=!1;if(q(e,((n,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=n,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(J(e)){this.gi=x(t)?this.bi:t;var s=!1;if(q(e,((r,n)=>{e.hasOwnProperty(n)&&this.props[n]!==r&&(this.props[n]=r,s=!0)})),s)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=oo(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);nt(lr(e))||this.register(e),this.ci=!0}}update_search_keyword(){var e;this.register((e=b?.referrer)?lo(e):{})}update_referrer_info(){var e;this.register_once({$referrer:uo(),$referring_domain:b!=null&&b.referrer&&((e=gi(b.referrer))==null?void 0:e.host)||fi},void 0)}set_initial_person_info(){this.props[Ss]||this.props[Rs]||this.register_once({[li]:co(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};q([Rs,Ss],(o=>{var a=this.props[o];a&&q(a,(function(l,c){e["$initial_"+is(c)]=l}))}));var t,s,r=this.props[li];if(r){var n=(t=ho(r),s={},q(t,(function(o,a){s["$initial_"+is(a)]=o})),s);B(e,n)}return e}safe_merge(e){return q(this.props,(function(t,s){s in e||(e[s]=t)})),e}update_config(e,t,s){if(this.bi=this.gi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!s),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),c=[...a].sort();return l.every(((u,h)=>u===c[h]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var r=this.vi(e),n=this.props;this.clear(),this.ti=r,this.props=n,this.save()}}set_disabled(e){this.fi=e,this.fi?this.remove():this.save()}set_cross_subdomain(e){e!==this.mi&&(this.mi=e,this.remove(),this.save())}set_secure(e){e!==this.yi&&(this.yi=e,this.remove(),this.save())}set_event_timer(e,t){var s=this.props[Rt]||{};s[e]=t,this.props[Rt]=s,this.save()}remove_event_timer(e){var t=(this.props[Rt]||{})[e];return x(t)||(delete this.props[Rt][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},_t={Activation:"events",Cancellation:"cancelEvents"};var ji={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"};var Ft={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Hi={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Cs={Popover:"popover",Inline:"inline"};var Ta={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Hr={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},qr=z("[RateLimiter]"),As=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var s=t.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach((r=>{qr.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){return void qr.warn('could not rate limit - continuing. Error: "'+r?.message+'"',{text:s})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,s,r;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(s=this.instance.persistence)==null?void 0:s.get_property(ks))!==null&&t!==void 0?t:{tokens:n,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>n&&(l.tokens=n);var c=1>l.tokens;return c||e||(l.tokens=Math.max(0,l.tokens-1)),!c||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(r=this.instance.persistence)==null||r.set_property(ks,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},ft=z("[RemoteConfig]"),mi=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=P._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}wi(e){var t,s;(t=P.__PosthogExtensions__)!=null&&t.loadExternalDependency?(s=P.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Ii(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return ft.info("Using preloaded remote config",this.remoteConfig),this.Ci(this.remoteConfig),void this.Si();if(this._instance.ki())return void ft.warn("Remote config is disabled. Falling back to local config.");this.wi((e=>{if(!e)return ft.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ii((t=>{this.Ci(t),this.Si()}));this.Ci(e),this.Si()}))}catch(e){ft.error("Error loading remote config",e)}}stop(){this.xi&&(clearInterval(this.xi),this.xi=void 0)}refresh(){this._instance.ki()||b?.visibilityState==="hidden"||this._instance.reloadFeatureFlags()}Si(){var e;if(!this.xi){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.xi=setInterval((()=>{this.refresh()}),t))}}Ci(e){var t;e||ft.error("Failed to fetch remote config from PostHog."),this._instance.Ci(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(t=this._instance.featureFlags)==null||t.ensureFlagsLoaded())}};var xe={GZipJS:"gzip-js",Base64:"base64"},ve=Uint8Array,ne=Uint16Array,gt=Uint32Array,ur=new ve([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]),cr=new ve([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]),zr=new ve([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),go=function(i,e){for(var t=new ne(31),s=0;31>s;++s)t[s]=e+=1<<i[s-1];var r=new gt(t[30]);for(s=1;30>s;++s)for(var n=t[s];t[s+1]>n;++n)r[n]=n-t[s]<<5|s;return[t,r]},vo=go(ur,2),Ms=vo[1];vo[0][28]=258,Ms[258]=28;for(Ls=go(cr,0)[1],yi=new ne(32768),H=0;32768>H;++H)ze=(43690&H)>>>1|(21845&H)<<1,yi[H]=((65280&(ze=(61680&(ze=(52428&ze)>>>2|(13107&ze)<<2))>>>4|(3855&ze)<<4))>>>8|(255&ze)<<8)>>>1;var ze,Ls,yi,H,Ct=function(i,e,t){for(var s=i.length,r=0,n=new ne(e);s>r;++r)++n[i[r]-1];var o,a=new ne(e);for(r=0;e>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(t){o=new ne(1<<e);var l=15-e;for(r=0;s>r;++r)if(i[r])for(var c=r<<4|i[r],u=e-i[r],h=a[i[r]-1]++<<u,d=h|(1<<u)-1;d>=h;++h)o[yi[h]>>>l]=c}else for(o=new ne(s),r=0;s>r;++r)o[r]=yi[a[i[r]-1]++]>>>15-i[r];return o},Ye=new ve(288);for(H=0;144>H;++H)Ye[H]=8;for(H=144;256>H;++H)Ye[H]=9;for(H=256;280>H;++H)Ye[H]=7;for(H=280;288>H;++H)Ye[H]=8;var bi=new ve(32);for(H=0;32>H;++H)bi[H]=5;var Fa=Ct(Ye,9,0),Ia=Ct(bi,5,0),_o=function(i){return(i/8>>0)+(7&i&&1)},fo=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var s=new(i instanceof ne?ne:i instanceof gt?gt:ve)(t-e);return s.set(i.subarray(e,t)),s},Te=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8},mt=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8,i[s+2]|=t>>>16},qi=function(i,e){for(var t=[],s=0;i.length>s;++s)i[s]&&t.push({s,f:i[s]});var r=t.length,n=t.slice();if(!r)return[new ve(0),0];if(r==1){var o=new ve(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(k,R){return k.f-R.f})),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,u=1,h=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=r-1;)a=t[t[h].f>t[c].f?c++:h++],l=t[c!=u&&t[h].f>t[c].f?c++:h++],t[u++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var g=new ne(d+1),v=Ds(t[u-1],g,0);if(v>e){s=0;var _=0,C=v-e,S=1<<C;for(n.sort((function(k,R){return g[R.s]-g[k.s]||k.f-R.f}));r>s;++s){var $=n[s].s;if(e>=g[$])break;_+=S-(1<<v-g[$]),g[$]=e}for(_>>>=C;_>0;){var I=n[s].s;e>g[I]?_-=1<<e-g[I]++-1:++s}for(;s>=0&&_;--s){var T=n[s].s;g[T]==e&&(--g[T],++_)}v=e}return[new ve(g),v]},Ds=function(i,e,t){return i.s==-1?Math.max(Ds(i.l,e,t+1),Ds(i.r,e,t+1)):e[i.s]=t},Wr=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new ne(++e),s=0,r=i[0],n=1,o=function(l){t[s++]=l},a=1;e>=a;++a)if(i[a]==r&&a!=e)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=i[a]}return[t.subarray(0,s),e]},yt=function(i,e){for(var t=0,s=0;e.length>s;++s)t+=i[s]*e[s];return t},Ns=function(i,e,t){var s=t.length,r=_o(e+2);i[r]=255&s,i[r+1]=s>>>8,i[r+2]=255^i[r],i[r+3]=255^i[r+1];for(var n=0;s>n;++n)i[r+n+4]=t[n];return 8*(r+4+s)},Vr=function(i,e,t,s,r,n,o,a,l,c,u){Te(e,u++,t),++r[256];for(var h=qi(r,15),d=h[0],g=h[1],v=qi(n,15),_=v[0],C=v[1],S=Wr(d),$=S[0],I=S[1],T=Wr(_),k=T[0],R=T[1],E=new ne(19),f=0;$.length>f;++f)E[31&$[f]]++;for(f=0;k.length>f;++f)E[31&k[f]]++;for(var y=qi(E,7),F=y[0],O=y[1],A=19;A>4&&!F[zr[A-1]];--A);var N,U,Y,Z,oe=c+5<<3,V=yt(r,Ye)+yt(n,bi)+o,te=yt(r,d)+yt(n,_)+o+14+3*A+yt(E,F)+(2*E[16]+3*E[17]+7*E[18]);if(V>=oe&&te>=oe)return Ns(e,u,i.subarray(l,l+c));if(Te(e,u,1+(V>te)),u+=2,V>te){N=Ct(d,g,0),U=d,Y=Ct(_,C,0),Z=_;var de=Ct(F,O,0);for(Te(e,u,I-257),Te(e,u+5,R-1),Te(e,u+10,A-4),u+=14,f=0;A>f;++f)Te(e,u+3*f,F[zr[f]]);u+=3*A;for(var pe=[$,k],Pe=0;2>Pe;++Pe){var ue=pe[Pe];for(f=0;ue.length>f;++f)Te(e,u,de[_e=31&ue[f]]),u+=F[_e],_e>15&&(Te(e,u,ue[f]>>>5&127),u+=ue[f]>>>12)}}else N=Fa,U=Ye,Y=Ia,Z=bi;for(f=0;a>f;++f)if(s[f]>255){var _e;mt(e,u,N[257+(_e=s[f]>>>18&31)]),u+=U[_e+257],_e>7&&(Te(e,u,s[f]>>>23&31),u+=ur[_e]);var fe=31&s[f];mt(e,u,Y[fe]),u+=Z[fe],fe>3&&(mt(e,u,s[f]>>>5&8191),u+=cr[fe])}else mt(e,u,N[s[f]]),u+=U[s[f]];return mt(e,u,N[256]),u+U[256]},$a=new gt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Oa=(function(){for(var i=new gt(256),e=0;256>e;++e){for(var t=e,s=9;--s;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i})(),zi=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};function Ca(i,e){e===void 0&&(e={});var t=(function(){var h=4294967295;return{p(d){for(var g=h,v=0;d.length>v;++v)g=Oa[255&g^d[v]]^g>>>8;h=g},d(){return 4294967295^h}}})(),s=i.length;t.p(i);var r,n,o,a,l,c=(a=10+((r=e).filename&&r.filename.length+1||0),l=8,(function(h,d,g,v,_,C){var S=h.length,$=new ve(v+S+5*(1+Math.floor(S/7e3))+_),I=$.subarray(v,$.length-_),T=0;if(!d||8>S)for(var k=0;S>=k;k+=65535){var R=k+65535;S>R?T=Ns(I,T,h.subarray(k,R)):(I[k]=!0,T=Ns(I,T,h.subarray(k,S)))}else{for(var E=$a[d-1],f=E>>>13,y=8191&E,F=(1<<g)-1,O=new ne(32768),A=new ne(F+1),N=Math.ceil(g/3),U=2*N,Y=function(Oi){return(h[Oi]^h[Oi+1]<<N^h[Oi+2]<<U)&F},Z=new gt(25e3),oe=new ne(288),V=new ne(32),te=0,de=0,pe=(k=0,0),Pe=0,ue=0;S>k;++k){var _e=Y(k),fe=32767&k,Ke=A[_e];if(O[fe]=Ke,A[_e]=fe,k>=Pe){var qt=S-k;if((te>7e3||pe>24576)&&qt>423){T=Vr(h,I,0,Z,oe,V,de,pe,ue,k-ue,T),pe=te=de=0,ue=k;for(var me=0;286>me;++me)oe[me]=0;for(me=0;30>me;++me)V[me]=0}var He=2,zt=0,Mo=y,Ce=fe-Ke&32767;if(qt>2&&_e==Y(k-Ce))for(var Lo=Math.min(f,qt)-1,Do=Math.min(32767,k),No=Math.min(258,qt);Do>=Ce&&--Mo&&fe!=Ke;){if(h[k+He]==h[k+He-Ce]){for(var Ae=0;No>Ae&&h[k+Ae]==h[k+Ae-Ce];++Ae);if(Ae>He){if(He=Ae,zt=Ce,Ae>Lo)break;var Uo=Math.min(Ce,Ae-2),pr=0;for(me=0;Uo>me;++me){var $i=k-Ce+me+32768&32767,gr=$i-O[$i]+32768&32767;gr>pr&&(pr=gr,Ke=$i)}}}Ce+=(fe=Ke)-(Ke=O[fe])+32768&32767}if(zt){Z[pe++]=268435456|Ms[He]<<18|Ls[zt];var vr=31&Ms[He],_r=31&Ls[zt];de+=ur[vr]+cr[_r],++oe[257+vr],++V[_r],Pe=k+He,++te}else Z[pe++]=h[k],++oe[h[k]]}}T=Vr(h,I,!0,Z,oe,V,de,pe,ue,k-ue,T)}return fo($,0,v+_o(T)+_)})(n=i,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),u=c.length;return(function(h,d){var g=d.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>d.level?4:d.level==9?2:0,h[9]=3,d.mtime!=0&&zi(h,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),g){h[3]=8;for(var v=0;g.length>=v;++v)h[v+10]=g.charCodeAt(v)}})(c,e),zi(c,u-8,t.d()),zi(c,u-4,s),c}var Aa=!!ts||!!es,mo="text/plain",Br=!1,Ti=function(i,e,t){var s;t===void 0&&(t=!0);var[r,n]=i.split("?"),o=m({},e),a=(s=n?.split("&").map((c=>{var u,[h,d]=c.split("="),g=t&&(u=o[h])!==null&&u!==void 0?u:d;return delete o[h],h+"="+g})))!==null&&s!==void 0?s:[],l=(function(c,u){var h,d;u===void 0&&(u="&");var g=[];return q(c,(function(v,_){x(v)||x(_)||_==="undefined"||(h=encodeURIComponent((C=>C instanceof File)(v)?v.name:v.toString()),d=encodeURIComponent(_),g[g.length]=d+"="+h)})),g.join(u)})(o);return l&&a.push(l),r+"?"+a.join("&")},at=(i,e)=>JSON.stringify(i,((t,s)=>typeof s=="bigint"?s.toString():s),e),Wi=i=>{if(i.zt)return i.zt;var{data:e,compression:t}=i;if(e){if(t===xe.GZipJS){var s=Ca((function(a,l){var c=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var u=new ve(a.length+(a.length>>>1)),h=0,d=function(C){u[h++]=C},g=0;c>g;++g){if(h+5>u.length){var v=new ve(h+8+(c-g<<1));v.set(u),u=v}var _=a.charCodeAt(g);128>_?d(_):2048>_?(d(192|_>>>6),d(128|63&_)):_>55295&&57344>_?(d(240|(_=65536+(1047552&_)|1023&a.charCodeAt(++g))>>>18),d(128|_>>>12&63),d(128|_>>>6&63),d(128|63&_)):(d(224|_>>>12),d(128|_>>>6&63),d(128|63&_))}return fo(u,0,h)})(at(e)),{mtime:0});return{contentType:mo,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(t===xe.Base64){var r=(function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,((l,c)=>String.fromCharCode(parseInt(c,16)))))})(at(e)),n=(a=>"data="+encodeURIComponent(typeof a=="string"?a:at(a)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=at(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Ma=(function(){var i=be((function*(e){var t=at(e.data),s=yield(function(n,o,a){return Fn.apply(this,arguments)})(t,re.DEBUG,{rethrow:!0});if(!s)return e;var r=yield s.arrayBuffer();return m({},e,{zt:{contentType:mo,body:r,estimatedSize:r.byteLength}})}));return function(e){return i.apply(this,arguments)}})(),Gr=(i,e)=>Ti(i,{_:new Date().getTime().toString(),ver:re.JS_SDK_VERSION,compression:e}),ii=[];es&&ii.push({transport:"fetch",method(i){var e,t,{contentType:s,body:r,estimatedSize:n}=(e=Wi(i))!==null&&e!==void 0?e:{},o=new Headers;q(i.headers,(function(u,h){o.append(h,u)})),s&&o.append("Content-Type",s);var a=i.url,l=null;if(Er){var c=new Er;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),i.timeout)}}es(a,m({method:i?.method||"GET",headers:o,keepalive:i.method==="POST"&&52428.8>(n||0),body:r,signal:(t=l)==null?void 0:t.signal},i.fetchOptions)).then((u=>u.text().then((h=>{var d={statusCode:u.status,text:h};if(u.status===200)try{d.json=JSON.parse(h)}catch(g){w.error(g)}i.callback==null||i.callback(d)})))).catch((u=>{w.error(u),i.callback==null||i.callback({statusCode:0,error:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),ts&&ii.push({transport:"XHR",method(i){var e,t=new ts;t.open(i.method||"GET",i.url,!0);var{contentType:s,body:r}=(e=Wi(i))!==null&&e!==void 0?e:{};q(i.headers,(function(n,o){t.setRequestHeader(o,n)})),s&&t.setRequestHeader("Content-Type",s),i.timeout&&(t.timeout=i.timeout),i.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{}i.callback==null||i.callback(n)}},t.send(r)}}),ce!=null&&ce.sendBeacon&&ii.push({transport:"sendBeacon",method(i){var e=Ti(i.url,{beacon:"1"});try{var t,{contentType:s,body:r}=(t=Wi(i))!==null&&t!==void 0?t:{};if(!r)return;var n=r instanceof Blob?r:new Blob([r],{type:s});ce.sendBeacon(e,n)}catch{}}});var Us=3e3,js=class{constructor(e,t){this.Ti=!0,this.Ai=[],this.Ei=Re(t?.flush_interval_ms||Us,250,5e3,w.createLogger("flush interval"),Us),this.Ri=e}enqueue(e){this.Ai.push(e),this.Ni||this.Mi()}unload(){this.Fi();var e=this.Ai.length>0?this.Oi():{},t=Object.values(e);[...t.filter((s=>s.url.indexOf("/e")===0)),...t.filter((s=>s.url.indexOf("/e")!==0))].map((s=>{this.Ri(m({},s,{transport:"sendBeacon"}))}))}enable(){this.Ti=!1,this.Mi()}Mi(){var e=this;this.Ti||(this.Ni=setTimeout((()=>{if(this.Fi(),this.Ai.length>0){var t=this.Oi(),s=function(){var n=t[r],o=new Date().getTime();n.data&&D(n.data)&&q(n.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.Ri(n)};for(var r in t)s()}}),this.Ei))}Fi(){clearTimeout(this.Ni),this.Ni=void 0}Oi(){var e={};return q(this.Ai,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;x(e[n])&&(e[n]=m({},r,{data:[]})),(s=e[n].data)==null||s.push(r.data)})),this.Ai=[],e}},La=["retriesPerformedSoFar"],Hs=class{constructor(e){this.Pi=!1,this.Li=3e3,this.Ai=[],this._instance=e,this.Ai=[],this.Di=!0,!x(p)&&"onLine"in p.navigator&&(this.Di=p.navigator.onLine,this.Bi=()=>{this.Di=!0,this.ji()},this.qi=()=>{this.Di=!1},G(p,"online",this.Bi),G(p,"offline",this.qi))}get length(){return this.Ai.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,s=Tn(e,La);it(t)&&(s.url=Ti(s.url,{retry_count:t})),this._instance._send_request(m({},s,{callback:r=>{r.statusCode===200||r.statusCode>=400&&500>r.statusCode||(t??0)>=10?s.callback==null||s.callback(r):this.Zi(m({retriesPerformedSoFar:t},s))}}))}Zi(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var s=(function(o){var a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),u=Math.random()-.5;return Math.ceil(c+u*(c-l))})(t),r=Date.now()+s;this.Ai.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+s;navigator.onLine||(n+=" (Browser is offline)"),w.warn(n),this.Pi||(this.Pi=!0,this.$i())}$i(){if(this.Vi&&clearTimeout(this.Vi),this.Ai.length===0)return this.Pi=!1,void(this.Vi=void 0);this.Vi=setTimeout((()=>{this.Di&&this.Ai.length>0&&this.ji(),this.$i()}),this.Li)}ji(){var e=Date.now(),t=[],s=this.Ai.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.Ai=t,s.length>0)for(var{requestOptions:r}of s)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Vi&&(clearTimeout(this.Vi),this.Vi=void 0),this.Pi=!1,x(p)||(this.Bi&&(p.removeEventListener("online",this.Bi),this.Bi=void 0),this.qi&&(p.removeEventListener("offline",this.qi),this.qi=void 0)),this.Ai))try{this._instance._send_request(m({},e,{transport:"sendBeacon"}))}catch(t){w.error(t)}this.Ai=[]}},qs=class{constructor(e){this.Hi=()=>{var t,s,r,n;this.zi||(this.zi={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+(o?.clientHeight||0),u=o?.scrollHeight||0;this.zi.lastScrollY=Math.ceil(a),this.zi.maxScrollY=Math.max(a,(t=this.zi.maxScrollY)!==null&&t!==void 0?t:0),this.zi.maxScrollHeight=Math.max(l,(s=this.zi.maxScrollHeight)!==null&&s!==void 0?s:0),this.zi.lastContentY=c,this.zi.maxContentY=Math.max(c,(r=this.zi.maxContentY)!==null&&r!==void 0?r:0),this.zi.maxContentHeight=Math.max(u,(n=this.zi.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}get Ui(){return this._instance.config.scroll_root_selector}getContext(){return this.zi}resetContext(){var e=this.zi;return setTimeout(this.Hi,0),e}startMeasuringScrollPosition(){G(p,"scroll",this.Hi,{capture:!0}),G(p,"scrollend",this.Hi,{capture:!0}),G(p,"resize",this.Hi)}scrollElement(){if(!this.Ui)return p?.document.documentElement;var e=D(this.Ui)?this.Ui:[this.Ui];for(var t of e){var s=p?.document.querySelector(t);if(s)return s}}scrollY(){if(this.Ui){var e=this.scrollElement();return e&&e.scrollTop||0}return p&&(p.scrollY||p.pageYOffset||p.document.documentElement.scrollTop)||0}scrollX(){if(this.Ui){var e=this.scrollElement();return e&&e.scrollLeft||0}return p&&(p.scrollX||p.pageXOffset||p.document.documentElement.scrollLeft)||0}},Da=i=>co(i?.config.mask_personal_data_properties,i?.config.custom_personal_data_properties),wi=class{constructor(e,t,s,r){this.Yi=n=>{var o=this.Gi();if(!o||o.sessionId!==n){var a={sessionId:n,props:this.Wi(this._instance)};this.Xi.register({[xs]:a})}},this._instance=e,this.Ji=t,this.Xi=s,this.Wi=r||Da,this.Ji.onSessionId(this.Yi)}Gi(){return this.Xi.props[xs]}getSetOnceProps(){var e,t=(e=this.Gi())==null?void 0:e.props;return t?"r"in t?ho(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 q(lr(this.getSetOnceProps()),((t,s)=>{s==="$current_url"&&(s="url"),e["$session_entry_"+is(s)]=t})),e}},jt=class{constructor(){this.Ki={}}on(e,t){return this.Ki[e]||(this.Ki[e]=[]),this.Ki[e].push(t),()=>{this.Ki[e]=this.Ki[e].filter((s=>s!==t))}}emit(e,t){for(var s of this.Ki[e]||[])s(t);for(var r of this.Ki["*"]||[])r(e,t)}},Vi=z("[SessionId]"),Ei=class{on(e,t){return this.Qi.on(e,t)}constructor(e,t,s){var r;if(this.tr=[],this.er=void 0,this.Qi=new jt,this.ir=(c,u)=>!(!it(c)||!it(u))&&Math.abs(c-u)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===we)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=e.config,this.Xi=e.persistence,this.rr=void 0,this.nr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.sr=t||Ue,this.ar=s||Ue;var n=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*Re(this.Rt.session_idle_timeout_seconds||1800,60,36e3,Vi.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+n+"_window_id",this.hr="ph_"+n+"_primary_window_exists",this.cr()){var o=ee.Wt(this.ur),a=ee.Wt(this.hr);o&&!a?this.rr=o:ee.Jt(this.ur),ee.Xt(this.hr,!0)}if((r=this.Rt.bootstrap)!=null&&r.sessionID)try{var l=(c=>{var u=this.Rt.bootstrap.sessionID.replace(/-/g,"");if(u.length!==32)throw new Error("Not a valid UUID");if(u[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(u.substring(0,12),16)})();this.dr(this.Rt.bootstrap.sessionID,new Date().getTime(),l)}catch(c){Vi.error("Invalid sessionID in bootstrap",c)}this.vr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return x(this.tr)&&(this.tr=[]),this.tr.push(e),this.nr&&e(this.nr,this.rr),()=>{this.tr=this.tr.filter((t=>t!==e))}}cr(){return this.Rt.persistence!=="memory"&&!this.Xi.fi&&ee.Ut()}pr(e){e!==this.rr&&(this.rr=e,this.cr()&&ee.Xt(this.ur,e))}gr(){return this.rr?this.rr:this.cr()?ee.Wt(this.ur):null}dr(e,t,s){e===this.nr&&t===this._sessionActivityTimestamp&&s===this._sessionStartTimestamp||(this._sessionStartTimestamp=s,this._sessionActivityTimestamp=t,this.nr=e,this.Xi.register({[oi]:[t,e,s]}))}mr(){var e=this.Xi.props[oi];return D(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.dr(null,null,null)}destroy(){clearTimeout(this.yr),this.yr=void 0,this.er&&p&&(p.removeEventListener(hi,this.er,{capture:!1}),this.er=void 0),this.tr=[]}vr(){this.er=()=>{this.cr()&&ee.Jt(this.hr)},G(p,hi,this.er,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.Rt.cookieless_mode===we)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=t||new Date().getTime(),[r,n,o]=this.mr(),a=this.gr(),l=it(o)&&Math.abs(s-o)>864e5,c=!1,u=!n,h=!u&&!e&&this.ir(s,r);u||h||l?(n=this.sr(),a=this.ar(),Vi.info("new session ID generated",{sessionId:n,windowId:a,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}}),o=s,c=!0):a||(a=this.ar(),c=!0);var d=it(r)&&e&&!l?r:s,g=it(o)?o:new Date().getTime();return this.pr(a),this.dr(n,d,g),e||this.lr(),c&&this.tr.forEach((v=>v(n,a,c?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}:void 0))),{sessionId:n,windowId:a,sessionStartTimestamp:g,changeReason:c?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}lr(){clearTimeout(this.yr),this.yr=setTimeout((()=>{var[e]=this.mr();if(this.ir(new Date().getTime(),e)){var t=this.nr;this.resetSessionId(),this.Qi.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},yo=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&Sr(t,e))return!0;try{var s=i?.userAgentData;if(s!=null&&s.brands&&s.brands.some((r=>Sr(r?.brand,e))))return!0}catch{}return!!i.webdriver},xi=function(i,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(i)}catch{return!1}};function Xr(i,e,t){return at({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var bo={exact:(i,e)=>e.some((t=>i.some((s=>t===s)))),is_not:(i,e)=>e.every((t=>i.every((s=>t!==s)))),regex:(i,e)=>e.some((t=>i.some((s=>xi(t,s))))),not_regex:(i,e)=>e.every((t=>i.every((s=>!xi(t,s))))),icontains:(i,e)=>e.map(Zt).some((t=>i.map(Zt).some((s=>t.includes(s))))),not_icontains:(i,e)=>e.map(Zt).every((t=>i.map(Zt).every((s=>!t.includes(s))))),gt:(i,e)=>e.some((t=>{var s=parseFloat(t);return!isNaN(s)&&i.some((r=>s>parseFloat(r)))})),lt:(i,e)=>e.some((t=>{var s=parseFloat(t);return!isNaN(s)&&i.some((r=>s<parseFloat(r)))}))},Zt=i=>i.toLowerCase();function wo(i,e){return!i||Object.entries(i).every((t=>{var[s,r]=t,n=e?.[s];if(x(n)||Oe(n))return!1;var o=[String(n)],a=bo[r.operator];return!!a&&a(r.values,o)}))}var zs="custom",Yr="i.posthog.com",Ws=class{constructor(e){this.br={},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 flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Yr,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.br[this.apiHost]||(this.br[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":zs),this.br[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(this.region===zs)return this.apiHost+t;var s=Yr+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}},j=z("[Surveys]"),Vs="seenSurvey_",Na=(i,e)=>{var t="$survey_"+e+"/"+i.id;return i.current_iteration&&i.current_iteration>0&&(t="$survey_"+e+"/"+i.id+"/"+i.current_iteration),t},Jr=i=>((e,t)=>{var s=""+Vs+t.id;return t.current_iteration&&t.current_iteration>0&&(s=""+Vs+t.id+"_"+t.current_iteration),s})(0,i),Ua=[ji.Popover,ji.Widget,ji.API],ja={ignoreConditions:!1,ignoreDelay:!1,displayType:Cs.Popover},Ha=z("[PostHog ExternalIntegrations]"),qa={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Bs=class{constructor(e){this._instance=e}ni(e,t){var s;(s=P.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,e,(r=>{if(r)return Ha.error("failed to load script",r);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!r||(a=P.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.ni(qa[o],(()=>{var u;(u=P.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)})),!r&&(l=P.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=P.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.stop())};for(var[s,r]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(s)}}},et,At={},Bi=0,Gs=()=>{},Kr='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',bt="Surveys module not available",Zr="sanitize_properties is deprecated. Use before_send instead",Eo="Invalid value for property_denylist config: ",za=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,rt="posthog",xo=!Aa&&ae?.indexOf("MSIE")===-1&&ae?.indexOf("Mozilla")===-1,Qr=i=>{var e;return m({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:fa(b?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Gs,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:i??"unset",__preview_deferred_init_extensions:!1,debug:Q&&X(Q?.search)&&Q.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_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(p==null||(e=p.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,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){w.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Ps,before_send:void 0,request_queue_config:{flush_interval_ms:Us},error_tracking:{},_onCapture:Gs,__preview_eager_load_replay:!1},(t=>({rageclick:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(i))},Wa=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],en=i=>{var e={};for(var[t,s]of Wa)x(i[t])||(e[s]=i[t]);var r=B({},e,i);return D(i.property_blacklist)&&(x(i.property_denylist)?r.property_denylist=i.property_blacklist:D(i.property_denylist)?r.property_denylist=[...i.property_blacklist,...i.property_denylist]:w.error(Eo+i.property_denylist)),r},Xs=class{constructor(){this.__forceAllowLocalhost=!1}get wr(){return this.__forceAllowLocalhost}set wr(e){w.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Xe=class i{_r(e,t){if(e){var s=this.Ir.indexOf(e);s!==-1&&this.Ir.splice(s,1)}return this.Ir.push(t),t.initialize==null||t.initialize(),t}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(){var e;this.webPerformance=new Xs,this.Cr=!1,this.version=re.LIB_VERSION,this.Sr=new jt,this.Ir=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Qr(),this.SentryIntegration=Os,this.sentryIntegration=s=>(function(r,n){var o=no(r,n);return{name:ro,processEvent:a=>o(a)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.kr=!1,this.Tr=null,this.Ar=null,this.Er=null,this.scrollManager=new qs(this),this.pageViewManager=new pi(this),this.rateLimiter=new As(this),this.requestRouter=new Ws(this),this.consent=new $s(this),this.externalIntegrations=new Bs(this);var t=(e=i.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(s,r,n)=>{var o=X(s)?{[s]:r}:s;this.setPersonProperties(o),n?.({})},set_once:(s,r,n)=>{var o=X(s)?{[s]:r}:s;this.setPersonProperties(void 0,o),n?.({})}},this.on("eventCaptured",(s=>w.info('send "'+s?.event+'"',s)))}init(e,t,s){if(s&&s!==rt){var r,n=(r=At[s])!==null&&r!==void 0?r:new i;return n._init(e,t,s),At[s]=n,At[rt][s]=n,n}return this._init(e,t,s)}_init(e,t,s){var r,n,o,a;if(t===void 0&&(t={}),x(e)||ei(e))return w.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Rr(t.debug),this.Nr=t,this.Mr=[],t.person_profiles?this.Ar=t.person_profiles:t.process_person&&(this.Ar=t.process_person),this.set_config(B({},Qr(t.defaults),en(t),{name:s,token:e})),this.config.on_xhr_error&&w.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:xe.GZipJS;var l=this.Fr();this.persistence=new Ot(this.config,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ot(m({},this.config,{persistence:"sessionStorage"}),l);var c=m({},this.persistence.props),u=m({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Or=new js((T=>this.Pr(T)),this.config.request_queue_config),this.Lr=new Hs(this),this.__request_queue=[];var h=this.config.cookieless_mode===we||this.config.cookieless_mode===Fe&&this.consent.isExplicitlyOptedOut();h||(this.sessionManager=new Ei(this),this.sessionPropsManager=new wi(this,this.sessionManager,this.persistence));var d=(r=P._POSTHOG_REMOTE_CONFIG)==null||(r=r[this.config.token])==null?void 0:r.config,g=d==null||(n=d.sdkVersion)==null?void 0:n.resolved;if(g&&(za.test(g)?this._resolvedSdkVersion=g:w.warn("Ignoring invalid preloaded sdkVersion.resolved from remote config: "+g)),this.config.__preview_deferred_init_extensions?(w.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Dr(h)}),0)):(w.info("Initializing extensions synchronously"),this.Dr(h)),re.DEBUG=re.DEBUG||this.config.debug,re.DEBUG&&w.info("Starting in debug mode",{this:this,config:t,thisC:m({},this.config),p:c,s:u}),!this.config.identity_distinct_id||(o=t.bootstrap)!=null&&o.distinctID||(t.bootstrap=m({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((a=t.bootstrap)==null?void 0:a.distinctID)!==void 0){var v=t.bootstrap.distinctID,_=this.get_distinct_id(),C=this.persistence.get_property(ye);if(t.bootstrap.isIdentifiedID&&_!=null&&_!==v&&C===Ze)this.identify(v);else if(t.bootstrap.isIdentifiedID&&_!=null&&_!==v&&C===Qe)w.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var S=this.config.get_device_id(Ue()),$=t.bootstrap.isIdentifiedID?S:v;this.persistence.set_property(ye,t.bootstrap.isIdentifiedID?Qe:Ze),this.register({distinct_id:v,$device_id:$})}}if(h)this.register_once({distinct_id:Gt,$device_id:null},"");else if(!this.get_distinct_id()){var I=this.config.get_device_id(Ue());this.register_once({distinct_id:I,$device_id:I},""),this.persistence.set_property(ye,Ze)}return G(p,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?(function(T,k){var R=T.config.segment;if(!R)return k();(function(E,f){var y=E.config.segment;if(!y)return f();var F=A=>{var N=()=>A.anonymousId()||Ue();E.config.get_device_id=N,A.id()&&(E.register({distinct_id:A.id(),$device_id:N()}),E.persistence.set_property(ye,Qe)),f()},O=y.user();"then"in O&&Ie(O.then)?O.then(F):F(O)})(T,(()=>{R.register((E=>{Promise&&Promise.resolve||Ui.warn("This browser does not have Promise support, and can not use the segment integration");var f=(y,F)=>{if(!F)return y;y.event.userId||y.event.anonymousId===E.get_distinct_id()||(Ui.info("No userId set, resetting PostHog"),E.reset()),y.event.userId&&y.event.userId!==E.get_distinct_id()&&(Ui.info("UserId set, identifying with PostHog"),E.identify(y.event.userId));var O=E.calculateEventProperties(F,y.event.properties);return y.event.properties=Object.assign({},O,y.event.properties),y};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:y=>f(y,y.event.event),page:y=>f(y,st),identify:y=>f(y,Di),screen:y=>f(y,"$screen")}})(T)).then((()=>{k()}))}))})(this,(()=>this.Br())):this.Br(),Ie(this.config._onCapture)&&this.config._onCapture!==Gs&&(w.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(T=>this.config._onCapture(T.event,T)))),this.config.ip&&w.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}Dr(e){var t,s,r,n,o,a,l,c=performance.now(),u=m({},i.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.Ir.push(this.featureFlags=(t=this.featureFlags)!==null&&t!==void 0?t:new u.featureFlags(this)),u.exceptions&&this.Ir.push(this.exceptions=(s=this.exceptions)!==null&&s!==void 0?s:new u.exceptions(this)),u.historyAutocapture&&this.Ir.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Ir.push(new u.tracingHeaders(this)),u.siteApps&&this.Ir.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.Ir.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Ir.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.Ir.push(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new u.surveys(this)),u.logs&&this.Ir.push(this.logs=(n=this.logs)!==null&&n!==void 0?n:new u.logs(this)),u.conversations&&this.Ir.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new u.conversations(this)),u.productTours&&this.Ir.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Ir.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Ir.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Ir.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Ir.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,xa)),u.toolbar&&this.Ir.push(this.toolbar=(a=this.toolbar)!==null&&a!==void 0?a:new u.toolbar(this)),u.experiments&&this.Ir.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new u.experiments(this)),this.Ir.forEach((d=>{d.initialize&&h.push((()=>{d.initialize==null||d.initialize()}))})),h.push((()=>{if(this.jr){var d=this.jr;this.jr=void 0,this.Ci(d)}})),this.qr(h,c)}qr(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.qr(e,t)}),0);var s=e.shift();if(s)try{s()}catch(n){w.error("Error initializing extension:",n)}}var r=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&w.info("PostHog extensions initialized ("+r+"ms)")}Ci(e){var t;if(!b||!b.body)return w.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Ci(e)}),500);this.config.__preview_deferred_init_extensions&&(this.jr=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=M(e.supportedCompression,xe.GZipJS)?xe.GZipJS:M(e.supportedCompression,xe.Base64)?xe.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ar?this.Ar:Ps}),this.Ir.forEach((s=>s.onRemoteConfig==null?void 0:s.onRemoteConfig(e)))}Br(){try{this.config.loaded(this)}catch(s){w.critical("`loaded` function failed",s)}if(this.Zr(),this.config.internal_or_test_user_hostname&&Q!=null&&Q.hostname){var e=Q.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===we)&&this.$r()}),1),this.Vr=new mi(this),this.Vr.load()}Zr(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Or)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Xt(this.__request_queue,(e=>this.Pr(e))),this.__request_queue=[],this.Zr()}_handle_unload(){var e,t,s,r;(e=this.surveys)==null||e.handlePageUnload(),this.config.request_batching?(this.Hr()&&this.capture(Li),(t=this.logs)==null||t.flushLogs("sendBeacon"),(s=this.Or)==null||s.unload(),(r=this.Lr)==null||r.unload()):this.Hr()&&this.capture(Li,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(xo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ti(e.url,{ip:this.config.ip?1:0}),e.headers=m({},this.config.request_headers,e.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 s,r,n,o=m({},t);o.timeout=o.timeout||6e4,o.url=Gr(o.url,o.compression);var a=(s=o.transport)!==null&&s!==void 0?s:"fetch",l=ii.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(r=(n=(function(u,h){for(var d=0;u.length>d;d++)if(u[d].transport===a)return u[d]})(l))==null?void 0:n.method)!==null&&r!==void 0?r:l[0].method;if(!c)throw new Error("No available transport method");a!=="sendBeacon"&&o.data&&o.compression===xe.GZipJS&&jo&&!Br?Ma(o).then((u=>{c(u)})).catch((u=>{if((h=>!(!h||typeof h!="object")&&("name"in h?String(h.name):"")==="NotReadableError")(u))return Br=!0,void c(m({},o,{compression:void 0,url:Gr(t.url,void 0)}));c(o)})):c(o)})(m({},e,{callback:t=>{var s,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||(s=(r=this.config).on_request_error)==null||s.call(r,t),e.callback==null||e.callback(t)}}))))}Pr(e){this.Lr?this.Lr.retriableRequest(e):this._send_request(e)}_execute_array(e){Bi++;try{var t,s=[],r=[],n=[];Xt(e,(a=>{a&&(D(t=a[0])?n.push(a):Ie(a)?a.call(this):D(a)&&t==="alias"?s.push(a):D(a)&&t.indexOf("capture")!==-1&&Ie(this[t])?n.push(a):r.push(a))}));var o=function(a,l){Xt(a,(function(c){if(D(c[0])){var u=l;q(c,(function(h){u=u[h[0]].apply(u,h.slice(1))}))}else l[c[0]].apply(l,c.slice(1))}))};o(s,this),o(r,this),o(n,this)}finally{Bi--}}push(e){if(Bi>0&&D(e)&&X(e[0])){var t=i.prototype[e[0]];Ie(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Or){if(this.is_capturing())if(!x(e)&&X(e)){var c=!this.config.opt_out_useragent_filter&&this._is_bot();if(!c||this.config.__preview_capture_bot_pageviews){var u=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(u==null||!u.isRateLimited){t!=null&&t.$current_url&&!X(t?.$current_url)&&(w.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!=="$exception"||s!=null&&s.zr||w.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&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 h=new Date,d=s?.timestamp||h,g=Ue(),v={uuid:g,event:e,properties:this.calculateEventProperties(e,t||{},d,g)};e===st&&this.config.__preview_capture_bot_pageviews&&c&&(v.event="$bot_pageview",v.properties.$browser_type="bot"),u&&(v.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),s?.$set&&(v.$set=s?.$set);var _,C=this.Ur(s?.$set_once,e!==Dr,e===Di);if(C&&(v.$set_once=C),s!=null&&s._noTruncate||(n=this.config.properties_string_max_length,o=v,a=E=>X(E)?E.slice(0,n):E,l=new Set,v=(function E(f,y){return f!==Object(f)?a?a(f):f:l.has(f)?void 0:(l.add(f),D(f)?(F=[],Xt(f,(O=>{F.push(E(O))}))):(F={},q(f,((O,A)=>{l.has(O)||(F[A]=E(O,A))}))),F);var F})(o)),v.timestamp=d,x(s?.timestamp)||(v.properties.$event_time_override_provided=!0,v.properties.$event_time_override_system_time=h),e===Ft.DISMISSED||e===Ft.SENT){var S=t?.[Hi.SURVEY_ID],$=t?.[Hi.SURVEY_ITERATION];_={id:S,current_iteration:$},localStorage.getItem(Jr(_))||localStorage.setItem(Jr(_),"true"),v.$set=m({},v.$set,{[Na({id:S,current_iteration:$},e===Ft.SENT?"responded":"dismissed")]:!0})}else e===Ft.SHOWN&&(v.$set=m({},v.$set,{[Hi.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Ta.SHOWN){var I=t?.[Hr.TOUR_TYPE];I&&(v.$set=m({},v.$set,{[Hr.TOUR_LAST_SEEN_DATE+"/"+I]:new Date().toISOString()}))}var T=m({},v.properties.$set,v.$set);if(nt(T)||this.setPersonPropertiesForFlags(T),!L(this.config.before_send)){var k=this.Yr(v);if(!k)return;v=k}this.Sr.emit("eventCaptured",v);var R={method:"POST",url:(r=s?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:v,compression:"best-available",batchKey:s?._batchKey};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this.Pr(R):this.Or.enqueue(R),v}w.critical("This capture call is ignored due to client rate limiting.")}}else w.error("No event name provided to posthog.capture")}else w.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var o=n?void 0:this.persistence.remove_event_timer(e),a=m({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode==we||this.config.cookieless_mode==Fe&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=m({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!X(a.distinct_id)&&!Ee(a.distinct_id)||ei(a.distinct_id))&&w.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=(function(S,$){var I,T,k,R;if(!ae)return{};var E,f,y,F,O,A,N,U,Y=S?[...pt,...$||[]]:[],[Z,oe]=(function(V){for(var te=0;Tr.length>te;te++){var[de,pe]=Tr[te],Pe=de.exec(V),ue=Pe&&(Ie(pe)?pe(Pe,V):pe);if(ue)return ue}return["",""]})(ae);return B(lr({$os:Z,$os_version:oe,$browser:Xn(ae,navigator.vendor),$device:Fr(ae),$device_type:(f=ae,y={userAgentDataPlatform:(I=navigator)==null||(I=I.userAgentData)==null?void 0:I.platform,maxTouchPoints:(T=navigator)==null?void 0:T.maxTouchPoints,screenWidth:p==null||(k=p.screen)==null?void 0:k.width,screenHeight:p==null||(R=p.screen)==null?void 0:R.height,devicePixelRatio:p?.devicePixelRatio},U=Fr(f),U===An||U===Cn||U==="Kobo"||U==="Kindle Fire"||U===Gn?ct:U===Lt||U===ut||U===Dt||U===ns?"Console":U===Ln?"Wearable":U?he:y?.userAgentDataPlatform==="Android"&&((F=y?.maxTouchPoints)!==null&&F!==void 0?F:0)>0?600>Math.min((O=y?.screenWidth)!==null&&O!==void 0?O:0,(A=y?.screenHeight)!==null&&A!==void 0?A:0)/((N=y?.devicePixelRatio)!==null&&N!==void 0?N:1)?he:ct:"Desktop"),$timezone:po(),$timezone_offset:Ra()}),{$current_url:Nt(Q?.href,Y,Ut),$host:Q?.host,$pathname:Q?.pathname,$raw_user_agent:ae.length>1e3?ae.substring(0,997)+"...":ae,$browser_version:ta(ae,navigator.vendor),$browser_language:jr(),$browser_language_prefix:(E=jr(),typeof E=="string"?E.split("-")[0]:void 0),$screen_height:p?.screen.height,$screen_width:p?.screen.width,$viewport_height:p?.innerHeight,$viewport_width:p?.innerWidth,$lib:re.LIB_NAME,$lib_version:re.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime());a.$session_id=h,a.$window_id=d}this.sessionPropsManager&&B(a,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&B(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(g=this.Lr)==null?void 0:g.length}catch(S){a.$sdk_debug_error_capturing_properties=String(S)}if(this.requestRouter.region===zs&&(a.$lib_custom_api_host=this.config.api_host),c=e!==st||n?e!==Li||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),a=B(a,c),e===st&&b&&(a.title=b.title),!x(o)){var v=s.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}ae&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=B({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),D(this.config.property_denylist)?q(this.config.property_denylist,(function(S){delete a[S]})):w.error(Eo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(w.error(Zr),a=_(a,e));var C=this.Gr();return a.$process_person_profile=C,C&&!n&&this.Wr("_calculate_event_properties"),a}Ur(e,t,s){var r;if(t===void 0&&(t=!0),s===void 0&&(s=!1),!this.persistence||!this.Gr()||this.Cr&&!s)return e;var n=this.persistence.get_initial_props(),o=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),a=B({},n,o||{},e||{}),l=this.config.sanitize_properties;return l&&(w.error(Zr),a=l(a,"$set_once")),t&&(this.Cr=!0),nt(a)?void 0:a}register(e,t){var s;(s=this.persistence)==null||s.register(e,t)}register_once(e,t,s){var r;(r=this.persistence)==null||r.register_once(e,t,s)}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)}Xr(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return(t=this.featureFlags)==null?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var s;return(s=this.featureFlags)==null?void 0:s.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,s){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,s)}updateEarlyAccessFeatureEnrollment(e,t,s){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,s)}getEarlyAccessFeatures(e,t,s){var r;return t===void 0&&(t=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(e,t,s)}on(e,t){return this.Sr.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:bt}),()=>{})}onSessionId(e){var t,s;return(t=(s=this.sessionManager)==null?void 0:s.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:bt})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:bt})}renderSurvey(e,t){var s;(s=this.surveys)==null||s.renderSurvey(e,t)}displaySurvey(e,t){var s;t===void 0&&(t=ja),(s=this.surveys)==null||s.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,s;return(t=(s=this.surveys)==null?void 0:s.canRenderSurvey(e))!==null&&t!==void 0?t:{visible:!1,disabledReason:bt}}canRenderSurveyAsync(e,t){var s,r;return t===void 0&&(t=!1),(s=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(e,t))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:bt})}Jr(e){return!e||ei(e)?(w.critical("Unique user id has not been set in posthog.identify"),!1):e===Gt?(w.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(w.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,s){if(!this.__loaded||!this.persistence)return w.uninitializedWarning("posthog.identify");if(Ee(e)&&(e=e.toString(),w.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Jr(e)&&this.Wr("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(ni)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(St)&&(this.unregister(St),this.register({distinct_id:e}));var n,o=(this.persistence.get_property(ye)||Ze)===Ze;e!==r&&o?(this.persistence.set_property(ye,Qe),this.setPersonPropertiesForFlags({$set:t||{},$set_once:s||{}},!1),this.capture(Di,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:s||{}}),this.Er=Xr(e,t,s),(n=this.featureFlags)==null||n.setAnonymousDistinctId(r)):(t||s)&&this.setPersonProperties(t,s),e!==r&&(this.reloadFeatureFlags(),this.unregister($t))}}setPersonProperties(e,t){if((e||t)&&this.Wr("posthog.setPersonProperties")){var s=Xr(this.get_distinct_id(),e,t);this.Er!==s?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Er=s):w.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:m({},r,{[e]:t})}),n||s){var o={$group_type:e,$group_key:t};s&&(o.$group_set=s),this.capture(Dr,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else w.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var s;t===void 0&&(t=!0),(s=this.featureFlags)==null||s.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;(e=this.featureFlags)==null||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var s;t===void 0&&(t=!0),this.Wr("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)==null||s.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t,s,r,n,o,a,l,c;if(w.info("reset"),!this.__loaded)return w.uninitializedWarning("posthog.reset");var u=this.get_property(ni);if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(s=this.sessionPersistence)==null||s.clear(),(r=this.surveys)==null||r.reset(),(n=this.Vr)==null||n.stop(),(o=this.featureFlags)==null||o.reset(),(a=this.conversations)==null||a.reset(),(l=this.persistence)==null||l.set_property(ye,Ze),(c=this.sessionManager)==null||c.resetSessionId(),this.Er=null,this.config.cookieless_mode===we)this.register_once({distinct_id:Gt,$device_id:null},"");else{var h=this.config.get_device_id(Ue());this.register_once({distinct_id:h,$device_id:e?h:u},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var s;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(s=this.conversations)==null||s.Kr()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Qr()}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:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&s){var n,o=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!s)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-s)/1e3)-o,0)}return r}alias(e,t){return e===this.get_property(Zn)?(w.critical("Attempting to create alias for existing People user - aborting."),-2):this.Wr("posthog.alias")?(x(t)&&(t=this.get_distinct_id()),e!==t?(this.Xr(St,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(w.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=m({},this.config);if(J(e)){var s,r,n,o,a,l,c,u,h;B(this.config,en(e));var d=this.Fr();(s=this.persistence)==null||s.update_config(this.config,t,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ot(m({},this.config,{persistence:"sessionStorage"}),d);var g=this.Rr(this.config.debug);Se(g)&&(this.config.debug=g),Se(this.config.debug)&&(this.config.debug?(re.DEBUG=!0,W.Ut()&&W.Xt("ph_debug",!0),w.info("set_config",{config:e,oldConfig:t,newConfig:m({},this.config)})):(re.DEBUG=!1,W.Ut()&&W.Jt("ph_debug"))),(r=this.exceptionObserver)==null||r.onConfigChange(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),(c=this.deadClicksAutocapture)==null||c.startIfEnabledOrStop(),(u=this.surveys)==null||u.loadIfEnabled(),this.tn(),(h=this.externalIntegrations)==null||h.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){re.LIB_NAME=e,re.LIB_VERSION=t}startSessionRecording(e){var t,s,r,n,o,a=e===!0,l={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(l).some(Boolean)&&((t=this.sessionManager)==null||t.checkAndGetSessionAndWindowId(),l.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),l.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),l.url_trigger&&((n=this.sessionRecording)==null||n.overrideTrigger("url")),l.event_trigger&&((o=this.sessionRecording)==null||o.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){if(this.exceptions){var s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(m({},r,t))}}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){var e,t;return(e=(t=this.logs)==null?void 0:t.logger)!==null&&e!==void 0?e:i.en}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,s;return(t=(s=this.toolbar)==null?void 0:s.loadToolbar(e))!==null&&t!==void 0&&t}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:rt;return t!==rt&&(t=rt+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(ye))===Qe||((t=this.sessionPersistence)==null?void 0:t.get_property(ye))===Qe}Gr(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles===Ps&&!this._isIdentified()&&nt(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[St])&&((t=this.persistence)==null||(t=t.props)==null||!t[ui]))}Hr(){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.Gr()||this.Wr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Wr("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Wr(e){return this.config.person_profiles==="never"?(w.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Xr(ui,!0),!0)}Fr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Fe)}tn(){var e,t,s,r,n=this.Fr();return((e=this.persistence)==null?void 0:e.fi)!==n&&((s=this.persistence)==null||s.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.fi)!==n&&((r=this.sessionPersistence)==null||r.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==we){if(this.config.cookieless_mode===Fe&&this.consent.isExplicitlyOptedOut()){var s,r,n,o,a;this.reset(!0),(s=this.sessionManager)==null||s.destroy(),(r=this.pageViewManager)==null||r.destroy(),this.sessionManager=new Ei(this),this.pageViewManager=new pi(this),this.persistence&&(this.sessionPropsManager=new wi(this,this.sessionManager,this.persistence));var l=(n=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&n!==void 0?n:(a=i.__defaultExtensionClasses)==null?void 0:a.sessionRecording;l&&(this.sessionRecording=this._r(this.sessionRecording,new l(this)))}var c,u;this.consent.optInOut(!0),this.tn(),this.Zr(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==Fe&&((c=this.surveys)==null||c.loadIfEnabled()),(x(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((u=e?.captureEventName)!==null&&u!==void 0?u:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$r()}else w.warn(Kr)}opt_out_capturing(){var e,t,s;this.config.cookieless_mode!==we?(this.config.cookieless_mode===Fe&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===Fe&&(this.register({distinct_id:Gt,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(s=this.sessionRecording)==null||s.stopRecording(),this.sessionRecording=void 0,this.$r())):w.warn(Kr)}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===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===we||(this.config.cookieless_mode===Fe?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return ce?yo(ce,this.config.custom_blocked_useragents):void 0}$r(){b&&(b.visibilityState==="visible"?this.kr||(this.kr=!0,this.capture(st,{title:b.title},{send_instantly:!0}),this.Tr&&(b.removeEventListener(ci,this.Tr),this.Tr=null)):this.Tr||(this.Tr=this.$r.bind(this),G(b,ci,this.Tr)))}debug(e){e===!1?(p?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(p?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}ki(){var e,t,s,r,n,o,a=this.Nr||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(w.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):(s="advanced_disable_decide",r=w,n=(t="advanced_disable_flags")in(e=a)&&!L(e[t]),o=s in e&&!L(e[s]),n?e[t]:!!o&&(r&&r.warn("Config field '"+s+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[s]))}Yr(e){if(L(this.config.before_send))return e;var t=D(this.config.before_send)?this.config.before_send:[this.config.before_send],s=e;for(var r of t){if(s=r(s),L(s)){var n="Event '"+e.event+"' was rejected in beforeSend function";return Wo(e.event)?w.warn(n+". This can cause unexpected behavior."):w.info(n),null}s.properties&&!nt(s.properties)||w.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return s}getPageViewId(){var e;return(e=this.pageViewManager.ai)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,s){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(s)})}Rr(e){var t=Se(e)&&!e,s=W.Ut()&&W.Gt("ph_debug")==="true";return!t&&(!!s||e)}};function tn(i){return i instanceof Element&&(i.id===to||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function Fi(i){return!!i&&i.nodeType===1}function je(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function ko(i){return!!i&&i.nodeType===3}function So(i){return!!i&&i.nodeType===11}function hr(i){return i?Ri(i).split(/\s+/):[]}function sn(i){var e=p?.location.href;return!!(e&&i&&i.some((t=>e.match(t))))}function ki(i){var e="";switch(typeof i.className){case"string":e=i.className;break;case"object":e=(i.className&&"baseVal"in i.className?i.className.baseVal:null)||i.getAttribute("class")||"";break;default:e=""}return hr(e)}function Ro(i){return L(i)?null:Ri(i).split(/(\s+)/).filter((e=>Mt(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ht(i){var e="";return Js(i)&&!To(i)&&i.childNodes&&i.childNodes.length&&q(i.childNodes,(function(t){var s;ko(t)&&t.textContent&&(e+=(s=Ro(t.textContent))!==null&&s!==void 0?s:"")})),Ri(e)}function rn(i){return x(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null;var e}Xe.__defaultExtensionClasses={},Xe.en={trace:et=()=>{},debug:et,info:et,warn:et,error:et,fatal:et},(function(i,e){for(var t=0;e.length>t;t++)i.prototype[e[t]]=va(i.prototype[e[t]])})(Xe,["identify"]);var dr=["a","button","form","input","select","textarea","label"];function nn(i,e){if(x(e))return!0;var t,s=function(n){if(e.some((o=>n.matches(o))))return{v:!0}};for(var r of i)if(t=s(r))return t.v;return!1}function Po(i){var e=i.parentNode;return!(!e||!Fi(e))&&e}var Va=["next","previous","prev",">","<"],on=[".ph-no-rageclick",".ph-no-capture"],Ys=i=>!i||je(i,"html")||!Fi(i),an=(i,e)=>{if(!p||Ys(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,s=[i],r=i;r.parentNode&&!je(r,"body");)if(So(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=Po(r);if(!n)break;if(e||dr.indexOf(n.tagName.toLowerCase())>-1)t=!0;else{var o=p.getComputedStyle(n);o&&o.getPropertyValue("cursor")==="pointer"&&(t=!0)}s.push(n),r=n}return{parentIsUsefulElement:t,targetElementList:s}};function Js(i){for(var e=i;e.parentNode&&!je(e,"body");e=e.parentNode){var t=ki(e);if(M(t,"ph-sensitive")||M(t,"ph-no-capture"))return!1}if(M(ki(i),"ph-include"))return!0;var s=i.type||"";if(X(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=i.name||i.id||"";return!X(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function To(i){return!!(je(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||je(i,"select")||je(i,"textarea")||i.getAttribute("contenteditable")==="true")}var Fo="(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})",Ba=new RegExp("^(?:"+Fo+")$"),Ga=new RegExp(Fo),Io="\\d{3}-?\\d{2}-?\\d{4}",Xa=new RegExp("^("+Io+")$"),Ya=new RegExp("("+Io+")");function Mt(i,e){return e===void 0&&(e=!0),!(L(i)||X(i)&&(i=Ri(i),(e?Ba:Ga).test((i||"").replace(/[- ]/g,""))||(e?Xa:Ya).test(i)))}function ln(i){var e=Ht(i);return Mt(e=(e+" "+$o(i)).trim())?e:""}function $o(i){var e="";return i&&i.childNodes&&i.childNodes.length&&q(i.childNodes,(function(t){var s;if(t&&((s=t.tagName)==null?void 0:s.toLowerCase())==="span")try{var r=Ht(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+$o(t)).trim())}catch(n){w.error("[AutoCapture]",n)}})),e}function un(i){return i.replace(/"|\\"/g,'\\"')}function Ja(i){var e=i.attr__class;return e?D(e)?e:hr(e):void 0}var Si=class{constructor(e){this.disabled=e===!1;var t=J(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,s){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>s-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:s}];return!1}},Gi="$copy_autocapture",cn=z("[AutoCapture]");function Xi(i,e){return e.length>i?e.slice(0,i)+"...":e}function Ka(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!Fi(e));return e}function Za(i,e){for(var t,s,{e:r,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[i],u=i;u.parentNode&&!je(u,"body");)So(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var h,d,g=[],v={},_=!1,C=!1;if(q(c,(k=>{var R=Js(k);k.tagName.toLowerCase()==="a"&&(_=k.getAttribute("href"),_=R&&_&&Mt(_)&&_),M(ki(k),"ph-no-capture")&&(C=!0),g.push((function(f,y,F,O){var A=f.tagName.toLowerCase(),N={tag_name:A};dr.indexOf(A)>-1&&!F&&(N.$el_text=A.toLowerCase()==="a"||A.toLowerCase()==="button"?Xi(1024,ln(f)):Xi(1024,Ht(f)));var U=ki(f);U.length>0&&(N.classes=U.filter((function(V){return V!==""}))),q(f.attributes,(function(V){var te;if((!To(f)||["name","id","class","aria-label"].indexOf(V.name)!==-1)&&(O==null||!O.includes(V.name))&&!y&&Mt(V.value)&&(!X(te=V.name)||te.substring(0,10)!=="_ngcontent"&&te.substring(0,7)!=="_nghost")){var de=V.value;V.name==="class"&&(de=hr(de).join(" ")),N["attr__"+V.name]=Xi(1024,de)}}));for(var Y=1,Z=1,oe=f;oe=Ka(oe);)Y++,oe.tagName===f.tagName&&Z++;return N.nth_child=Y,N.nth_of_type=Z,N})(k,n,o,a));var E=(function(f){if(!Js(f))return{};var y={};return q(f.attributes,(function(F){if(F.name&&F.name.indexOf("data-ph-capture-attribute")===0){var O=F.name.replace("data-ph-capture-attribute-",""),A=F.value;O&&A&&Mt(A)&&(y[O]=A)}})),y})(k);B(v,E)})),C)return{props:{},explicitNoCapture:C};if(o||(g[0].$el_text=i.tagName.toLowerCase()==="a"||i.tagName.toLowerCase()==="button"?ln(i):Ht(i)),_){var S,$;g[0].attr__href=_;var I=(S=gi(_))==null?void 0:S.host,T=p==null||($=p.location)==null?void 0:$.host;I&&T&&I!==T&&(h=_)}return{props:B({$event_type:r.type,$ce_version:1},l?{}:{$elements:g},{$elements_chain:(d=g,(function(k){return k.map((R=>{var E,f,y="";if(R.tag_name&&(y+=R.tag_name),R.attr_class)for(var F of(R.attr_class.sort(),R.attr_class))y+="."+F.replace(/"/g,"");var O=m({},R.text?{text:R.text}:{},{"nth-child":(E=R.nth_child)!==null&&E!==void 0?E:0,"nth-of-type":(f=R.nth_of_type)!==null&&f!==void 0?f:0},R.href?{href:R.href}:{},R.attr_id?{attr_id:R.attr_id}:{},R.attributes),A={};return ti(O).sort(((N,U)=>{var[Y]=N,[Z]=U;return Y.localeCompare(Z)})).forEach((N=>{var[U,Y]=N;return A[un(U.toString())]=un(Y.toString())})),(y+=":")+ti(A).map((N=>{var[U,Y]=N;return U+'="'+Y+'"'})).join("")})).join(";")})((function(k){return k.map((R=>{var E,f,y={text:(E=R.$el_text)==null?void 0:E.slice(0,400),tag_name:R.tag_name,href:(f=R.attr__href)==null?void 0:f.slice(0,2048),attr_class:Ja(R),attr_id:R.attr__id,nth_child:R.nth_child,nth_of_type:R.nth_of_type,attributes:{}};return ti(R).filter((F=>{var[O]=F;return O.indexOf("attr__")===0})).forEach((F=>{var[O,A]=F;return y.attributes[O]=A})),y}))})(d)))},(t=g[0])!=null&&t.$el_text?{$el_text:(s=g[0])==null?void 0:s.$el_text}:{},h&&r.type==="click"?{$external_click_url:h}:{},v)}}var wt=z("[ExceptionAutocapture]");function hn(i,e,t){try{if(!(e in i))return()=>{};var s=i[e],r=t(s);return Ie(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),i[e]=r,()=>{i[e]=s}}catch{return()=>{}}}var Qa=z("[TracingHeaders]"),Me=z("[Web Vitals]"),dn=9e5,pn="disabled",gn="lazy_loading",Et="awaiting_config",Qt="missing_config";z("[SessionRecording]"),z("[SessionRecording]");var Ks="[SessionRecording]",Le=z(Ks),el=z("[Heatmaps]");function vn(i){return J(i)&&"clientX"in i&&"clientY"in i&&Ee(i.clientX)&&Ee(i.clientY)}var _n=z("[Product Tours]"),Yi="ph_product_tours",tl=["$set_once","$set"],De=z("[SiteApps]"),fn="Error while initializing PostHog app with config id ";function tt(i,e,t){if(L(i))return!1;switch(t){case"exact":return i===e;case"contains":var s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(i);case"regex":try{return new RegExp(e).test(i)}catch{return!1}default:return!1}}var Zs=class{constructor(e){this.rn=new jt,this.nn=(t,s)=>this.sn(t,s)&&this.an(t,s)&&this.ln(t,s)&&this.un(t,s),this.sn=(t,s)=>s==null||!s.event||t?.event===s?.event,this._instance=e,this.hn=new Set,this.cn=new Set}init(){var e,t;x((e=this._instance)==null?void 0:e._addCaptureHook)||(t=this._instance)==null||t._addCaptureHook(((s,r)=>{this.on(s,r)}))}register(e){var t,s;if(!x((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((o=>{var a,l;(a=this.cn)==null||a.add(o),(l=o.steps)==null||l.forEach((c=>{var u;(u=this.hn)==null||u.add(c?.event||"")}))})),(s=this._instance)!=null&&s.autocapture)){var r,n=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((l=>{l!=null&&l.selector&&n.add(l?.selector)}))})),(r=this._instance)==null||r.autocapture.setElementSelectors(n)}}on(e,t){var s;t!=null&&e.length!=0&&(this.hn.has(e)||this.hn.has(t?.event))&&this.cn&&((s=this.cn)==null?void 0:s.size)>0&&this.cn.forEach((r=>{this.dn(t,r)&&this.rn.emit("actionCaptured",r.name)}))}vn(e){this.onAction("actionCaptured",(t=>e(t)))}dn(e,t){if(t?.steps==null)return!1;for(var s of t.steps)if(this.nn(e,s))return!0;return!1}onAction(e,t){return this.rn.on(e,t)}an(e,t){if(t!=null&&t.url){var s,r=e==null||(s=e.properties)==null?void 0:s.$current_url;if(!r||typeof r!="string"||!tt(r,t.url,t.url_matching||"contains"))return!1}return!0}ln(e,t){return!!this.fn(e,t)&&!!this.pn(e,t)&&!!this.gn(e,t)}fn(e,t){var s;if(t==null||!t.href)return!0;var r=this.mn(e);if(r.length>0)return r.some((a=>tt(a.href,t.href,t.href_matching||"exact")));var n,o=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!o&&tt((n=o.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}pn(e,t){var s;if(t==null||!t.text)return!0;var r=this.mn(e);if(r.length>0)return r.some((c=>tt(c.text,t.text,t.text_matching||"exact")||tt(c.$el_text,t.text,t.text_matching||"exact")));var n,o,a,l=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!l&&(n=(function(c){for(var u,h=[],d=/(?::|")text="(.*?)"/g;!L(u=d.exec(c));)h.includes(u[1])||h.push(u[1]);return h})(l),o=t.text,a=t.text_matching||"exact",n.some((c=>tt(c,o,a))))}gn(e,t){var s,r;if(t==null||!t.selector)return!0;var n=e==null||(s=e.properties)==null?void 0:s.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}mn(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}un(e,t){return t==null||!t.properties||t.properties.length===0||wo(t.properties.reduce(((s,r)=>{var n=D(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return s[r.key]={values:n,operator:r.operator||"exact"},s}),{}),e?.properties)}},Qs=class{constructor(e){this._instance=e,this.yn=new Map,this.bn=new Map,this.wn=new Map}_n(e,t){return!!e&&wo(e.propertyFilters,t?.properties)}In(e,t){var s=new Map;return e.forEach((r=>{var n;(n=r.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach((o=>{if(o!=null&&o.name){var a=s.get(o.name)||[];a.push(r.id),s.set(o.name,a)}}))})),s}Cn(e,t,s){var r=(s===_t.Activation?this.yn:this.bn).get(e),n=[];return this.Sn((o=>{n=o.filter((a=>r?.includes(a.id)))})),n.filter((o=>{var a,l=(a=o.conditions)==null||(a=a[s])==null||(a=a.values)==null?void 0:a.find((c=>c.name===e));return this._n(l,t)}))}register(e){var t;x((t=this._instance)==null?void 0:t._addCaptureHook)||(this.kn(e),this.xn(e))}xn(e){var t=e.filter((s=>{var r,n;return((r=s.conditions)==null?void 0:r.actions)&&((n=s.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.Tn==null&&(this.Tn=new Zs(this._instance),this.Tn.init(),this.Tn.vn((s=>{this.onAction(s)}))),t.forEach((s=>{var r,n,o,a,l;s.conditions&&(r=s.conditions)!=null&&r.actions&&(n=s.conditions)!=null&&(n=n.actions)!=null&&n.values&&((o=s.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.Tn)==null||a.register(s.conditions.actions.values),(l=s.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((c=>{if(c&&c.name){var u=this.wn.get(c.name);u&&u.push(s.id),this.wn.set(c.name,u||[s.id])}})))})))}kn(e){var t,s=e.filter((n=>{var o,a;return((o=n.conditions)==null?void 0:o.events)&&((a=n.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),r=e.filter((n=>{var o,a;return((o=n.conditions)==null?void 0:o.cancelEvents)&&((a=n.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));s.length===0&&r.length===0||((t=this._instance)==null||t._addCaptureHook(((n,o)=>{this.onEvent(n,o)})),this.yn=this.In(e,_t.Activation),this.bn=this.In(e,_t.Cancellation))}onEvent(e,t){var s,r=this.re(),n=this.An(),o=this.En(),a=((s=this._instance)==null||(s=s.persistence)==null?void 0:s.props[n])||[];if(o===e&&t&&a.length>0){var l,c;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var u=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(u){var h=a.indexOf(u);0>h||(a.splice(h,1),this.Rn(a))}}else{if(this.bn.has(e)){var d=this.Cn(e,t,_t.Cancellation);d.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map((v=>v.id))}),d.forEach((v=>{var _=a.indexOf(v.id);0>_||a.splice(_,1),this.Nn(v.id)})),this.Rn(a))}if(this.yn.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.yn.get(e)});var g=this.Cn(e,t,_t.Activation);this.Rn(a.concat(g.map((v=>v.id))||[]))}}}onAction(e){var t,s=this.An(),r=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[s])||[];this.wn.has(e)&&this.Rn(r.concat(this.wn.get(e)||[]))}Rn(e){var t,s=this.re(),r=this.An(),n=[...new Set(e)].filter((o=>!this.Mn(o)));s.info("updating activated items",{activatedItems:n}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[r]:n})}getActivatedIds(){var e,t=this.An();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}getEventToItemsMap(){return this.yn}Fn(){return this.Tn}},er=class extends Qs{constructor(e){super(e)}An(){return"$surveys_activated"}En(){return Ft.SHOWN}Sn(e){var t;(t=this._instance)==null||t.getSurveys(e)}Nn(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}re(){return j}Mn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Ji="SDK is not enabled or survey functionality is not yet loaded",mn="Disabled. Not loading surveys.",il=p!=null&&p.location?_i(p.location.hash,"__posthog")||_i(location.hash,"state"):null,yn="_postHogToolbarParams",bn=z("[Toolbar]"),ie=z("[FeatureFlags]"),We=z("[FeatureFlags]",{debugEnabled:!0}),Ki=`" failed. Feature flags didn't load in time.`,Zi="$active_feature_flags",Ne="$override_feature_flags",wn="$feature_flag_payloads",xt="$override_feature_flag_payloads",En="$feature_flag_request_id",xn=i=>{for(var e={},t=0;i.length>t;t++)e[i[t]]=!0;return e},kn=i=>{var e={};for(var[t,s]of ti(i||{}))s&&(e[t]=s);return e},Qi=z("[Error tracking]"),Sn="Refusing to render web experiment since the viewer is a likely bot",sl={icontains:(i,e)=>!!p&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!p&&e.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>!!p&&xi(e.href,i),not_regex:(i,e)=>!!p&&!xi(e.href,i),exact:(i,e)=>e.href===i,is_not:(i,e)=>e.href!==i},tr=class i{get Rt(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(s){s===void 0&&(s=!1),t.getWebExperiments((r=>{i.On("retrieved web experiments from the server"),t.Pn=new Map,r.forEach((n=>{if(n.feature_flag_key){var o;t.Pn&&(i.On("setting flag key ",n.feature_flag_key," to web experiment ",n),(o=t.Pn)==null||o.set(n.feature_flag_key,n));var a=t._instance.getFeatureFlag(n.feature_flag_key);X(a)&&n.variants[a]&&t.Ln(n.name,a,n.variants[a].transforms)}else if(n.variants)for(var l in n.variants){var c=n.variants[l];i.Dn(c)&&t.Ln(n.name,l,c.transforms)}}))}),s)},this._instance=e,this._instance.onFeatureFlags((s=>{this.onFeatureFlags(s)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())i.On(Sn);else if(!this.Rt.disable_web_experiments){if(L(this.Pn))return this.Pn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();i.On("applying feature flags",e),e.forEach((t=>{var s;if(this.Pn&&(s=this.Pn)!=null&&s.has(t)){var r,n=this._instance.getFeatureFlag(t),o=(r=this.Pn)==null?void 0:r.get(t);n&&o!=null&&o.variants[n]&&this.Ln(o.name,n,o.variants[n].transforms)}}))}}previewWebExperiment(){var e=i.getWindowLocation();if(e!=null&&e.search){var t=vi(e?.search,"__experiment_id"),s=vi(e?.search,"__experiment_variant");t&&s&&(i.On("previewing web experiments "+t+" && "+s),this.getWebExperiments((r=>{this.Bn(parseInt(t),s,r)}),!1,!0))}}loadIfEnabled(){this.Rt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,s){if(this.Rt.disable_web_experiments&&!s)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Rt.token),method:"GET",callback:n=>e(n.statusCode===200&&n.json&&n.json.experiments||[])})}Bn(e,t,s){var r=s.filter((n=>n.id===e));r&&r.length>0&&(i.On("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.Ln(r[0].name,t,r[0].variants[t].transforms))}static Dn(e){return!L(e.conditions)&&i.jn(e)&&i.qn(e)}static jn(e){var t;if(L(e.conditions)||L((t=e.conditions)==null?void 0:t.url))return!0;var s,r,n,o=i.getWindowLocation();return!!o&&((s=e.conditions)==null||!s.url||sl[(r=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&r!==void 0?r:"icontains"](e.conditions.url,o))}static getWindowLocation(){return p?.location}static qn(e){var t;if(L(e.conditions)||L((t=e.conditions)==null?void 0:t.utm))return!0;var s=oo();if(s.utm_source){var r,n,o,a,l,c,u,h,d=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==s.utm_campaign,g=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==s.utm_source,v=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==s.utm_medium,_=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==s.utm_term;return d&&v&&_&&g}return!1}static On(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;t>r;r++)s[r-1]=arguments[r];w.info("[WebExperiments] "+e,s)}Ln(e,t,s){this._is_bot()?i.On(Sn):t!=="control"?s.forEach((r=>{if(r.selector){var n;i.On("applying transform of variant "+t+" for experiment "+e+" ",r);var o=(n=document)==null?void 0:n.querySelectorAll(r.selector);o?.forEach((a=>{var l=a;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)}))}})):i.On("Control variants leave the page unmodified.")}_is_bot(){return ce&&this._instance?yo(ce,this.Rt.custom_blocked_useragents):void 0}},ge=z("[Conversations]"),Ve="Conversations not available yet.",Oo={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},rl=Oo.info;function Co(i){if(Se(i))return{boolValue:i};if(Ee(i))return Number.isInteger(i)?{intValue:i}:{doubleValue:i};if(typeof i=="string")return{stringValue:i};if(D(i))return{arrayValue:{values:i.map((e=>Co(e)))}};try{return{stringValue:JSON.stringify(i)}}catch{return{stringValue:String(i)}}}function Rn(i){var e=[];for(var t in i){var s=i[t];Oe(s)||x(s)||e.push({key:t,value:Co(s)})}return e}var Ii={featureFlags:class{constructor(i){this.Zn=!1,this.$n=!1,this.Vn=!1,this.Hn=!1,this.zn=!1,this.Un=!1,this.Yn=!1,this.Gn=!1,this._instance=i,this.featureFlagEventHandlers=[]}get Rt(){return this._instance.config}get Xi(){return this._instance.persistence}Wn(i){return this._instance.get_property(i)}Xn(){var i,e;return(i=(e=this.Xi)==null?void 0:e.pi(this.Rt.feature_flag_cache_ttl_ms))!==null&&i!==void 0&&i}Jn(){return!!this.Xn()&&(this.Gn||this.Vn||(this.Gn=!0,ie.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Kn(){var i,e=(i=this.Rt.evaluation_contexts)!==null&&i!==void 0?i:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Yn||(ie.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yn=!0),e!=null&&e.length?e.filter((t=>{var s=t&&typeof t=="string"&&t.trim().length>0;return s||ie.error("Invalid evaluation context found:",t,"Expected non-empty string"),s})):[]}Qn(){return this.Kn().length>0}initialize(){var i,e,{config:t}=this._instance,s=(i=(e=t.bootstrap)==null?void 0:e.featureFlags)!==null&&i!==void 0?i:{};if(Object.keys(s).length){var r,n,o=(r=(n=t.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},a=Object.keys(s).filter((c=>!!s[c])).reduce(((c,u)=>(c[u]=s[u]||!1,c)),{}),l=Object.keys(o).filter((c=>a[c])).reduce(((c,u)=>(o[u]&&(c[u]=o[u]),c)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(i,e,t){var s=t!=null&&t.merge?this.getFlagVariants():{},r=t!=null&&t.merge?this.getFlagPayloads():{},n=m({},s,i),o=m({},r,e),a={};for(var[l,c]of Object.entries(n)){var u=typeof c=="string";a[l]={key:l,enabled:!!u||!!c,variant:u?c:void 0,reason:void 0,metadata:x(o?.[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.$n}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var i=this.Wn(ys),e=this.Wn(Ne),t=this.Wn(xt);if(!t&&!e)return i||{};var s=B({},i||{}),r=[...new Set([...Object.keys(t||{}),...Object.keys(e||{})])];for(var n of r){var o,a,l=s[n],c=e?.[n],u=x(c)?(o=l?.enabled)!==null&&o!==void 0&&o:!!c,h=x(c)?l.variant:typeof c=="string"?c:void 0,d=t?.[n],g=m({},l,{enabled:u,variant:u?h??l?.variant:void 0});u!==l?.enabled&&(g.original_enabled=l?.enabled),h!==l?.variant&&(g.original_variant=l?.variant),d&&(g.metadata=m({},l?.metadata,{payload:d,original_payload:l==null||(a=l.metadata)==null?void 0:a.payload})),s[n]=g}return this.Zn||(ie.warn(" Overriding feature flag details!",{flagDetails:i,overriddenPayloads:t,finalDetails:s}),this.Zn=!0),s}getFlagVariants(){var i=this.Wn(ot),e=this.Wn(Ne);if(!e)return i||{};for(var t=B({},i),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.Zn||(ie.warn(" Overriding feature flags!",{enabledFlags:i,overriddenFlags:e,finalFlags:t}),this.Zn=!0),t}getFlagPayloads(){var i=this.Wn(wn),e=this.Wn(xt);if(!e)return i||{};for(var t=B({},i||{}),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.Zn||(ie.warn(" Overriding feature flag payloads!",{flagPayloads:i,overriddenPayloads:e,finalPayloads:t}),this.Zn=!0),t}reloadFeatureFlags(){this.Hn||this.Rt.advanced_disable_feature_flags||this.ts||(this._instance.Sr.emit("featureFlagsReloading",!0),this.ts=setTimeout((()=>{this.es()}),5))}rs(){clearTimeout(this.ts),this.ts=void 0}ensureFlagsLoaded(){this.$n||this.Vn||this.ts||this.reloadFeatureFlags()}setAnonymousDistinctId(i){this.$anon_distinct_id=i}setReloadingPaused(i){this.Hn=i}es(i){var e;if(this.rs(),!this._instance.ki())if(this.Vn)this.zn=!0;else{var t=this.Rt.token,s=this.Wn(ni),r={token:t,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:m({},((e=this.Xi)==null?void 0:e.get_initial_props())||{},this.Wn(Tt)||{}),group_properties:this.Wn(Be),timezone:po()};Oe(s)||x(s)||(r.$device_id=s),(i!=null&&i.disableFlags||this.Rt.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Qn()&&(r.evaluation_contexts=this.Kn());var n=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Rt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Vn=!0,this._instance._send_request({method:"POST",url:n,data:r,compression:this.Rt.disable_compression?void 0:xe.Base64,timeout:this.Rt.feature_flag_request_timeout_ms,callback:o=>{var a,l,c,u=!0;if(o.statusCode===200&&(this.zn||(this.$anon_distinct_id=void 0),u=!1),this.Vn=!1,!r.disable_flags||this.zn){this.Un=!u;var h=[];o.error?o.error instanceof Error?h.push(o.error.name==="AbortError"?"timeout":"connection_error"):h.push("unknown_error"):o.statusCode!==200&&h.push("api_error_"+o.statusCode),(a=o.json)!=null&&a.errorsWhileComputingFlags&&h.push("errors_while_computing_flags");var d,g=!((l=o.json)==null||(l=l.quotaLimited)==null||!l.includes("feature_flags"));g&&h.push("quota_limited"),(c=this.Xi)==null||c.register({[Es]:h}),g?ie.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."):(r.disable_flags||this.receivedFeatureFlags((d=o.json)!==null&&d!==void 0?d:{},u,{partialResponse:!!this.Rt.advanced_only_evaluate_survey_feature_flags}),this.zn&&(this.zn=!1,this.es()))}}})}}getFeatureFlag(i,e){var t;if(e===void 0&&(e={}),!e.fresh||this.Un)if(this.$n||this.getFlags()&&this.getFlags().length>0){if(!this.Jn()){var s=this.getFeatureFlagResult(i,e);return(t=s?.variant)!==null&&t!==void 0?t:s?.enabled}}else ie.warn('getFeatureFlag for key "'+i+Ki)}getFeatureFlagDetails(i){return this.getFlagsWithDetails()[i]}getFeatureFlagPayload(i){var e=this.getFeatureFlagResult(i,{send_event:!1});return e?.payload}getFeatureFlagResult(i,e){if(e===void 0&&(e={}),!e.fresh||this.Un)if(this.$n||this.getFlags()&&this.getFlags().length>0){if(!this.Jn()){var t=this.getFlagVariants(),s=i in t,r=t[i],n=this.getFlagPayloads()[i],o=String(r),a=this.Wn(En)||void 0,l=this.Wn(ai)||void 0,c=this.Wn($t)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var u,h=this._instance.get_session_id(),d=this.Wn(ws);h&&h!==d&&(c={},(u=this.Xi)==null||u.register({[$t]:c,[ws]:h}))}if((e.send_event||!("send_event"in e))&&(!(i in c)||!c[i].includes(o))){var g,v,_,C,S,$,I,T,k,R;D(c[i])?c[i].push(o):c[i]=[o],(g=this.Xi)==null||g.register({[$t]:c});var E=this.getFeatureFlagDetails(i),f=[...(v=this.Wn(Es))!==null&&v!==void 0?v:[]];x(r)&&f.push("flag_missing");var y={$feature_flag:i,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((_=this.Rt.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[i])||null,$feature_flag_bootstrapped_payload:((C=this.Rt.bootstrap)==null||(C=C.featureFlagPayloads)==null?void 0:C[i])||null,$used_bootstrap_value:!this.Un};x(E==null||(S=E.metadata)==null?void 0:S.version)||(y.$feature_flag_version=E.metadata.version);var F,O=($=E==null||(I=E.reason)==null?void 0:I.description)!==null&&$!==void 0?$:E==null||(T=E.reason)==null?void 0:T.code;O&&(y.$feature_flag_reason=O),E!=null&&(k=E.metadata)!=null&&k.id&&(y.$feature_flag_id=E.metadata.id),x(E?.original_variant)&&x(E?.original_enabled)||(y.$feature_flag_original_response=x(E.original_variant)?E.original_enabled:E.original_variant),E!=null&&(R=E.metadata)!=null&&R.original_payload&&(y.$feature_flag_original_payload=E==null||(F=E.metadata)==null?void 0:F.original_payload),f.length&&(y.$feature_flag_error=f.join(",")),this._instance.capture("$feature_flag_called",y)}if(s){var A=n;if(!x(n))try{A=JSON.parse(n)}catch{}return{key:i,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:A}}}}else ie.warn('getFeatureFlagResult for key "'+i+Ki)}getRemoteConfigPayload(i,e){var t=this.Rt.token,s={distinct_id:this._instance.get_distinct_id(),token:t};this.Qn()&&(s.evaluation_contexts=this.Kn()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.Rt.disable_compression?void 0:xe.Base64,timeout:this.Rt.feature_flag_request_timeout_ms,callback(r){var n,o=(n=r.json)==null?void 0:n.featureFlagPayloads;e(o?.[i]||void 0)}})}isFeatureEnabled(i,e){if(e===void 0&&(e={}),!e.fresh||this.Un){if(this.$n||this.getFlags()&&this.getFlags().length>0){var t=this.getFeatureFlag(i,e);return x(t)?void 0:!!t}ie.warn('isFeatureEnabled for key "'+i+Ki)}}addFeatureFlagsHandler(i){this.featureFlagEventHandlers.push(i)}removeFeatureFlagsHandler(i){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==i))}receivedFeatureFlags(i,e,t){if(this.Xi){this.$n=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(o,a,l,c,u,h){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var d=(f=>{var y=f.flags;return y?(f.featureFlags=Object.fromEntries(Object.keys(y).map((F=>{var O;return[F,(O=y[F].variant)!==null&&O!==void 0?O:y[F].enabled]}))),f.featureFlagPayloads=Object.fromEntries(Object.keys(y).filter((F=>y[F].enabled)).filter((F=>{var O;return(O=y[F].metadata)==null?void 0:O.payload})).map((F=>{var O;return[F,(O=y[F].metadata)==null?void 0:O.payload]})))):ie.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),f})(o),g=d.flags,v=d.featureFlags,_=d.featureFlagPayloads;if(v){var C=o.requestId,S=o.evaluatedAt;if(D(v)){ie.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var $={};if(v)for(var I=0;v.length>I;I++)$[v[I]]=!0;a&&a.register({[Zi]:v,[ot]:$})}else{var T=v,k=_,R=g;if(h!=null&&h.partialResponse)T=m({},l,T),k=m({},c,k),R=m({},u,R);else if(o.errorsWhileComputingFlags)if(g){var E=new Set(Object.keys(g).filter((f=>{var y;return!((y=g[f])!=null&&y.failed)})));T=m({},l,Object.fromEntries(Object.entries(T).filter((f=>{var[y]=f;return E.has(y)})))),k=m({},c,Object.fromEntries(Object.entries(k||{}).filter((f=>{var[y]=f;return E.has(y)})))),R=m({},u,Object.fromEntries(Object.entries(R||{}).filter((f=>{var[y]=f;return E.has(y)}))))}else T=m({},l,T),k=m({},c,k),R=m({},u,R);a&&a.register(m({[Zi]:Object.keys(kn(T)),[ot]:T||{},[wn]:k||{},[ys]:R||{}},C?{[En]:C}:{},S?{[ai]:S}:{}))}}})(i,this.Xi,s,r,n,t),e||(this.Gn=!1),this.ns(e)}}override(i,e){e===void 0&&(e=!1),ie.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:i,suppressWarning:e})}overrideFeatureFlags(i){if(!this._instance.__loaded||!this.Xi)return ie.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(i===!1)return this.Xi.unregister(Ne),this.Xi.unregister(xt),this.ns(),We.info("All overrides cleared");if(D(i)){var e=xn(i);return this.Xi.register({[Ne]:e}),this.ns(),We.info("Flag overrides set",{flags:i})}if(i&&typeof i=="object"&&("flags"in i||"payloads"in i)){var t,s=i;if(this.Zn=!!((t=s.suppressWarning)!==null&&t!==void 0&&t),"flags"in s){if(s.flags===!1)this.Xi.unregister(Ne),We.info("Flag overrides cleared");else if(s.flags){if(D(s.flags)){var r=xn(s.flags);this.Xi.register({[Ne]:r})}else this.Xi.register({[Ne]:s.flags});We.info("Flag overrides set",{flags:s.flags})}}return"payloads"in s&&(s.payloads===!1?(this.Xi.unregister(xt),We.info("Payload overrides cleared")):s.payloads&&(this.Xi.register({[xt]:s.payloads}),We.info("Payload overrides set",{payloads:s.payloads}))),void this.ns()}if(i&&typeof i=="object")return this.Xi.register({[Ne]:i}),this.ns(),We.info("Flag overrides set",{flags:i});ie.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:i})}onFeatureFlags(i){if(this.addFeatureFlagsHandler(i),this.$n){var{flags:e,flagVariants:t}=this.ss();i(e,t)}return()=>this.removeFeatureFlagsHandler(i)}updateEarlyAccessFeatureEnrollment(i,e,t){var s,r=(this.Wn(Pt)||[]).find((l=>l.flagKey===i)),n={["$feature_enrollment/"+i]:e},o={$feature_flag:i,$feature_enrollment:e,$set:n};r&&(o.$early_access_feature_name=r.name),t&&(o.$feature_enrollment_stage=t),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=m({},this.getFlagVariants(),{[i]:e});(s=this.Xi)==null||s.register({[Zi]:Object.keys(kn(a)),[ot]:a}),this.ns()}getEarlyAccessFeatures(i,e,t){e===void 0&&(e=!1);var s=this.Wn(Pt),r=t?"&"+t.map((n=>"stage="+n)).join("&"):"";if(s&&!e)return i(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Rt.token+r),method:"GET",callback:n=>{var o,a;if(n.json){var l=n.json.earlyAccessFeatures;return(o=this.Xi)==null||o.unregister(Pt),(a=this.Xi)==null||a.register({[Pt]:l}),i(l)}}})}ss(){var i=this.getFlags(),e=this.getFlagVariants();return{flags:i.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,s)=>(t[s]=e[s],t)),{})}}ns(i){var{flags:e,flagVariants:t}=this.ss();this.featureFlagEventHandlers.forEach((s=>s(e,t,{errorsLoading:i})))}setPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.Wn(Tt)||{},s=i?.$set||(i!=null&&i.$set_once?{}:i),r=i?.$set_once,n={};if(r)for(var o in r)({}).hasOwnProperty.call(r,o)&&(o in t||(n[o]=r[o]));this._instance.register({[Tt]:m({},t,n,s)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Tt)}setGroupPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.Wn(Be)||{};Object.keys(t).length!==0&&Object.keys(t).forEach((s=>{t[s]=m({},t[s],i[s]),delete i[s]})),this._instance.register({[Be]:m({},t,i)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(i){if(i){var e=this.Wn(Be)||{};this._instance.register({[Be]:m({},e,{[i]:{}})})}else this._instance.unregister(Be)}reset(){this.$n=!1,this.Vn=!1,this.Hn=!1,this.zn=!1,this.Un=!1,this.$anon_distinct_id=void 0,this.rs(),this.Zn=!1}}},nl={sessionRecording:class{get Rt(){return this._instance.config}get Xi(){return this._instance.persistence}get started(){var i;return!((i=this.os)==null||!i.isStarted)}get status(){var i,e;return this.ls===Et||this.ls===Qt?this.ls:(i=(e=this.os)==null?void 0:e.status)!==null&&i!==void 0?i:this.ls}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.ls=pn,this.us=void 0,this._instance=i,!this._instance.sessionManager)throw Le.error("started without valid sessionManager"),new Error(Ks+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===we)throw new Error(Ks+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get hs(){var i,e=!((i=this._instance.get_property(Bt))==null||!i.enabled),t=!this.Rt.disable_session_recording,s=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return p&&e&&t&&!s}startIfEnabledOrStop(i){var e;if(!this.hs||(e=this.os)==null||!e.isStarted){var t=!x(Object.assign)&&!x(Array.from);this.hs&&t?(this.cs(i),Le.info("starting")):(this.ls=pn,this.stopRecording())}}cs(i){var e,t,s;this.hs&&(this.ls!==Et&&this.ls!==Qt&&(this.ls=gn),P!=null&&(e=P.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=P.__PosthogExtensions__)!=null&&t.initSessionRecording?this.ds(i):(s=P.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.vs,(r=>{if(r)return Le.error("could not load recorder",r);this.ds(i)})))}stopRecording(){var i,e;(i=this.us)==null||i.call(this),this.us=void 0,(e=this.os)==null||e.stop()}fs(){var i,e;(i=this.us)==null||i.call(this),this.us=void 0,(e=this.os)==null||e.discard()}ps(){var i;(i=this.Xi)==null||i.unregister(eo)}gs(i,e){if(L(i))return null;var t,s=Ee(i)?i:parseFloat(i);return typeof(t=s)!="number"||!Number.isFinite(t)||0>t||t>1?(Le.warn(e+" must be between 0 and 1. Ignoring invalid value:",i),null):s}ys(i){if(this.Xi){var e,t,s=this.Xi,r=()=>{var n,o=i.sessionRecording===!1?void 0:i.sessionRecording,a=this.gs((n=this.Rt.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.gs(o?.sampleRate,"remote config sampleRate"),c=a??l;L(c)&&this.ps();var u=o?.minimumDurationMilliseconds;s.register({[Bt]:m({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:m({capturePerformance:i.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:x(u)?null:u,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};r(),(e=this.us)==null||e.call(this),this.us=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(r)}}onRemoteConfig(i){return"sessionRecording"in i?i.sessionRecording===!1?(this.ys(i),void this.fs()):(this.ys(i),void this.startIfEnabledOrStop()):(this.ls===Et&&(this.ls=Qt,Le.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(i,e){var t;e===void 0&&(e="log"),(t=this.os)!=null&&t.log?this.os.log(i,e):Le.warn("log called before recorder was ready")}get vs(){var i,e,t=(i=this._instance)==null||(i=i.persistence)==null?void 0:i.get_property(Bt);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}bs(){var i,e=this._instance.get_property(Bt);if(!e)return!1;var t=(i=(typeof e=="object"?e:JSON.parse(e)).cache_timestamp)!==null&&i!==void 0?i:Date.now();return 36e5>=Date.now()-t}ds(i){var e,t;if((e=P.__PosthogExtensions__)==null||!e.initSessionRecording)return Le.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.os||(this.os=(t=P.__PosthogExtensions__)==null?void 0:t.initSessionRecording(this._instance),this.os._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.bs())return this.ls===Qt||this.ls===Et?void 0:(this.ls=Et,Le.info("persisted remote config is stale, requesting fresh config before starting"),void new mi(this._instance).load());this.ls=gn,this.os.start(i)}onRRwebEmit(i){var e;(e=this.os)==null||e.onRRwebEmit==null||e.onRRwebEmit(i)}overrideLinkedFlag(){var i,e;this.os||(e=this.Xi)==null||e.register({$replay_override_linked_flag:!0}),(i=this.os)==null||i.overrideLinkedFlag()}overrideSampling(){var i,e;this.os||(e=this.Xi)==null||e.register({$replay_override_sampling:!0}),(i=this.os)==null||i.overrideSampling()}overrideTrigger(i){var e,t;this.os||(t=this.Xi)==null||t.register({[i==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.os)==null||e.overrideTrigger(i)}get sdkDebugProperties(){var i;return((i=this.os)==null?void 0:i.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(i,e){var t;return!((t=this.os)==null||!t.tryAddCustomEvent(i,e))}}},ol={autocapture:class{constructor(i){this.ws=!1,this._s=null,this.Is=!1,this.instance=i,this.rageclicks=new Si(i.config.rageclick),this.Cs=null}initialize(){this.startIfEnabled()}get Rt(){var i,e,t=J(this.instance.config.autocapture)?this.instance.config.autocapture:{};return t.url_allowlist=(i=t.url_allowlist)==null?void 0:i.map((s=>new RegExp(s))),t.url_ignorelist=(e=t.url_ignorelist)==null?void 0:e.map((s=>new RegExp(s))),t}Ss(){if(this.isBrowserSupported()){if(p&&b){var i=t=>{t=t||p?.event;try{this.ks(t)}catch(s){cn.error("Failed to capture event",s)}};if(G(b,"submit",i,{capture:!0}),G(b,"change",i,{capture:!0}),G(b,"click",i,{capture:!0}),this.Rt.capture_copied_text){var e=t=>{this.ks(t=t||p?.event,Gi)};G(b,"copy",e,{capture:!0}),G(b,"cut",e,{capture:!0})}}}else cn.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.ws&&(this.Ss(),this.ws=!0)}onRemoteConfig(i){i.elementsChainAsString&&(this.Is=i.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[$r]:!!i.autocapture_opt_out}),this._s=!!i.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(i){this.Cs=i}getElementSelectors(i){var e,t=[];return(e=this.Cs)==null||e.forEach((s=>{var r=b?.querySelectorAll(s);r?.forEach((n=>{i===n&&t.push(s)}))})),t}get isEnabled(){var i,e,t=(i=this.instance.persistence)==null?void 0:i.props[$r];if(Oe(this._s)&&!Se(t)&&!this.instance.ki())return!1;var s=(e=this._s)!==null&&e!==void 0?e:!!t;return!!this.instance.config.autocapture&&!s}ks(i,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var t,s=rn(i);ko(s)&&(s=s.parentNode||null),e==="$autocapture"&&i.type==="click"&&i instanceof MouseEvent&&this.instance.config.rageclick&&(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,i.timeStamp||new Date().getTime())&&(function(h,d){if(!p||Ys(h))return!1;var g,v,_;if(Se(d)?(g=!!d&&on,v=void 0):(g=(_=d?.css_selector_ignorelist)!==null&&_!==void 0?_:on,v=d?.content_ignorelist),g===!1)return!1;var{targetElementList:C}=an(h,!1);return!(function(S,$){if(S===!1||x(S))return!1;var I;if(S===!0)I=Va;else{if(!D(S))return!1;if(S.length>10)return w.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;I=S.map((T=>T.toLowerCase()))}return $.some((T=>{var{safeText:k,ariaLabel:R}=T;return I.some((E=>k.includes(E)||R.includes(E)))}))})(v,C.map((S=>{var $;return{safeText:Ht(S).toLowerCase(),ariaLabel:(($=S.getAttribute("aria-label"))==null?void 0:$.toLowerCase().trim())||""}})))&&!nn(C,g)})(s,this.instance.config.rageclick)&&this.ks(i,"$rageclick");var r=e===Gi;if(s&&(function(h,d,g,v,_){var C,S,$,I;if(g===void 0&&(g=void 0),!p||Ys(h)||(C=g)!=null&&C.url_allowlist&&!sn(g.url_allowlist)||(S=g)!=null&&S.url_ignorelist&&sn(g.url_ignorelist))return!1;if(($=g)!=null&&$.dom_event_allowlist){var T=g.dom_event_allowlist;if(T&&!T.some((y=>d.type===y)))return!1}var{parentIsUsefulElement:k,targetElementList:R}=an(h,v);if(!(function(y,F){var O=F?.element_allowlist;if(x(O))return!0;var A,N=function(Y){if(O.some((Z=>Y.tagName.toLowerCase()===Z)))return{v:!0}};for(var U of y)if(A=N(U))return A.v;return!1})(R,g)||!nn(R,(I=g)==null?void 0:I.css_selector_allowlist))return!1;var E=p.getComputedStyle(h);if(E&&E.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0;var f=h.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(_||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(_||["change","click"]).indexOf(d.type)>=0;default:return k?(_||["click"]).indexOf(d.type)>=0:(_||["click"]).indexOf(d.type)>=0&&(dr.indexOf(f)>-1||h.getAttribute("contenteditable")==="true")}})(s,i,this.Rt,r,r?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=Za(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist,elementsChainAsString:this.Is});if(o)return!1;var a=this.getElementSelectors(s);if(a&&a.length>0&&(n.$element_selectors=a),e===Gi){var l,c=Ro(p==null||(l=p.getSelection())==null?void 0:l.toString()),u=i.type||"clipboard";if(!c)return!1;n.$selected_content=c,n.$copy_type=u}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return Ie(b?.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.xs=(p==null||(e=p.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(w.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ts&&this.Ts(),this.Ts=void 0,w.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(p&&p.history){var t=this;(i=p.history.pushState)!=null&&i.__posthog_wrapped__||hn(p.history,"pushState",(s=>function(r,n,o){s.call(this,r,n,o),t.As("pushState")})),(e=p.history.replaceState)!=null&&e.__posthog_wrapped__||hn(p.history,"replaceState",(s=>function(r,n,o){s.call(this,r,n,o),t.As("replaceState")})),this.Es()}}As(i){try{var e,t=p==null||(e=p.location)==null?void 0:e.pathname;if(!t)return;t!==this.xs&&this.isEnabled&&this._instance.capture(st,{navigation_type:i}),this.xs=t}catch(s){w.error("Error capturing "+i+" pageview",s)}}Es(){if(!this.Ts){var i=()=>{this.As("popstate")};G(p,"popstate",i),this.Ts=()=>{p&&p.removeEventListener("popstate",i)}}}},heatmaps:class{get Rt(){return this.instance.config}constructor(i){var e;this.Rs=!1,this.ws=!1,this.Ns=null,this.instance=i,this.Rs=!((e=this.instance.persistence)==null||!e.props[fs]),this.rageclicks=new Si(i.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var i=5e3;return J(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(i=this.Rt.capture_heatmaps.flush_interval_milliseconds),i}get isEnabled(){return L(this.Rt.capture_heatmaps)?L(this.Rt.enable_heatmaps)?this.Rs:this.Rt.enable_heatmaps:this.Rt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ws)return;el.info("starting..."),this.Ms(),this.Tt()}else{var i;clearInterval((i=this.Ns)!==null&&i!==void 0?i:void 0),this.Fs(),this.getAndClearBuffer()}}onRemoteConfig(i){if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[fs]:e}),this.Rs=e,this.startIfEnabled()}}getAndClearBuffer(){var i=this.T;return this.T=void 0,i}Os(i){this.wt(i.originalEvent,"deadclick")}Tt(){this.Ns&&clearInterval(this.Ns),this.Ns=b?.visibilityState==="visible"?setInterval(this.ji.bind(this),this.flushIntervalMilliseconds):null}Ms(){p&&b&&(this.Ps=this.ji.bind(this),G(p,hi,this.Ps),this.Ls=i=>this.wt(i||p?.event),G(b,"click",this.Ls,{capture:!0}),this.Ds=i=>this.Bs(i||p?.event),G(b,"mousemove",this.Ds,{capture:!0}),this.js=new di(this.instance,Ea,this.Os.bind(this)),this.js.startIfEnabledOrStop(),this.qs=this.Tt.bind(this),G(b,ci,this.qs),this.ws=!0)}Fs(){var i;p&&b&&(this.Ps&&p.removeEventListener(hi,this.Ps),this.Ls&&b.removeEventListener("click",this.Ls,{capture:!0}),this.Ds&&b.removeEventListener("mousemove",this.Ds,{capture:!0}),this.qs&&b.removeEventListener(ci,this.qs),clearTimeout(this.Zs),(i=this.js)==null||i.stop(),this.ws=!1)}$s(i,e){var t=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=(function(o,a,l){for(var c=o;c&&Fi(c)&&!je(c,"body");){if(c===l)return!1;if(M(a,p?.getComputedStyle(c).position))return!0;c=Po(c)}return!1})(rn(i),["fixed","sticky"],r);return{x:i.clientX+(n?0:s),y:i.clientY+(n?0:t),target_fixed:n,type:e}}wt(i,e){var t;if(e===void 0&&(e="click"),!tn(i.target)&&vn(i)){var s=this.$s(i,e);(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,new Date().getTime())&&this.Vs(m({},s,{type:"rageclick"})),this.Vs(s)}}Bs(i){!tn(i.target)&&vn(i)&&(clearTimeout(this.Zs),this.Zs=setTimeout((()=>{this.Vs(this.$s(i,"mousemove"))}),500))}Vs(i){if(p){var e=p.location.href,t=this.Rt.custom_personal_data_properties,s=this.Rt.mask_personal_data_properties?[...pt,...t||[]]:[],r=Nt(e,s,Ut);this.T=this.T||{},this.T[r]||(this.T[r]=[]),this.T[r].push(i)}}ji(){this.T&&!nt(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:di,webVitalsAutocapture:class{constructor(i){var e;this.Rs=!1,this.ws=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hs=()=>{clearTimeout(this.zs),this.T.metrics.length!==0&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((t,s)=>m({},t,{["$web_vitals_"+s.name+"_event"]:m({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.nt=t=>{var s,r=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0);if(x(r))Me.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=this.Us();x(n)||(L(t?.name)||L(t?.value)?Me.error("Invalid metric received",t):!this.Ys||this.Ys>t.value?(this.T.url!==n&&(this.Hs(),this.zs=setTimeout(this.Hs,this.flushToCaptureTimeoutMs)),x(this.T.url)&&(this.T.url=n),this.T.firstMetricTimestamp=x(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.T.metrics.push(m({},t,{$current_url:n,$session_id:r.sessionId,$window_id:r.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Hs()):Me.error("Ignoring metric with value >= "+this.Ys,t))}},this.Gs=()=>{if(!this.ws){var t,s,r,n,o=P.__PosthogExtensions__;x(o)||x(o.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:s,onFCP:r,onINP:n}=o.postHogWebVitalsCallbacks),t&&s&&r&&n?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.nt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.nt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&r(this.nt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.nt.bind(this)),this.ws=!0):Me.error("web vitals callbacks not loaded - not starting")}},this._instance=i,this.Rs=!((e=this._instance.persistence)==null||!e.props[Ar]),this.startIfEnabled()}get Ws(){return this._instance.config.capture_performance}get allowedMetrics(){var i,e,t=J(this.Ws)?(i=this.Ws)==null?void 0:i.web_vitals_allowed_metrics:void 0;return L(t)?((e=this._instance.persistence)==null?void 0:e.props[Lr])||["CLS","FCP","INP","LCP"]:t}get flushToCaptureTimeoutMs(){return(J(this.Ws)?this.Ws.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var i=J(this.Ws)?this.Ws.web_vitals_attribution:void 0;return i!=null&&i}get Ys(){var i=J(this.Ws)&&Ee(this.Ws.__web_vitals_max_value)?this.Ws.__web_vitals_max_value:dn;return i>0&&6e4>=i?dn:i}get isEnabled(){var i=Q?.protocol;if(i!=="http:"&&i!=="https:")return Me.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=J(this.Ws)?this.Ws.web_vitals:Se(this.Ws)?this.Ws:void 0;return Se(e)?e:this.Rs}startIfEnabled(){this.isEnabled&&!this.ws&&(Me.info("enabled, starting..."),this.ni(this.Gs))}onRemoteConfig(i){if("capturePerformance"in i){var e=J(i.capturePerformance)&&!!i.capturePerformance.web_vitals,t=J(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ar]:e}),this._instance.persistence.register({[Lr]:t})),this.Rs=e,this.startIfEnabled()}}ni(i){var e,t;(e=P.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?i():(t=P.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(s=>{s?Me.error("failed to load script",s):i()}))}Us(){var i=p?p.location.href:void 0;if(i){var e=this._instance.config.custom_personal_data_properties,t=this._instance.config.mask_personal_data_properties?[...pt,...e||[]]:[];return Nt(i,t,Ut)}Me.error("Could not determine current URL")}}},al={exceptionObserver:class{constructor(i){var e,t,s;this.Gs=()=>{var r;if(p&&this.isEnabled&&(r=P.__PosthogExtensions__)!=null&&r.errorWrappingFunctions){var n=P.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=P.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=P.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Xs&&this.Rt.capture_unhandled_errors&&(this.Xs=n(this.captureException.bind(this))),!this.Js&&this.Rt.capture_unhandled_rejections&&(this.Js=o(this.captureException.bind(this))),!this.Ks&&this.Rt.capture_console_errors&&(this.Ks=a(this.captureException.bind(this)))}catch(l){wt.error("failed to start",l),this.Qs()}}},this._instance=i,this.eo=!((e=this._instance.persistence)==null||!e.props[Or]),this.io=new ss({refillRate:(t=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&t!==void 0?t:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,qt:wt}),this.Rt=this.ro(),this.startIfEnabledOrStop()}ro(){var i=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return J(i)?e=m({},e,i):(x(i)?this.eo:i)&&(e=m({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Rt.capture_console_errors||this.Rt.capture_unhandled_errors||this.Rt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(wt.info("enabled"),this.Qs(),this.ni(this.Gs)):this.Qs()}ni(i){var e,t;(e=P.__PosthogExtensions__)!=null&&e.errorWrappingFunctions&&i(),(t=P.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return wt.error("failed to load script",s);i()}))}Qs(){var i,e,t;(i=this.Xs)==null||i.call(this),this.Xs=void 0,(e=this.Js)==null||e.call(this),this.Js=void 0,(t=this.Ks)==null||t.call(this),this.Ks=void 0}onRemoteConfig(i){"autocaptureExceptions"in i&&(this.eo=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Or]:this.eo}),this.Rt=this.ro(),this.startIfEnabledOrStop())}onConfigChange(){this.Rt=this.ro()}captureException(i){var e,t,s,r=(e=i==null||(t=i.$exception_list)==null||(t=t[0])==null?void 0:t.type)!==null&&e!==void 0?e:"Exception";this.io.consumeRateLimit(r)?wt.info("Skipping exception capture because of client rate limiting.",{exception:r}):(s=this._instance.exceptions)==null||s.sendExceptionEvent(i)}},exceptions:class{constructor(i){var e,t;this.no=[],this.so=new as([new us,new _s,new hs,new cs,new gs,new ps,new ds,new vs],(function(s){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;r>o;o++)n[o-1]=arguments[o];return function(a,l){l===void 0&&(l=0);for(var c=[],u=a.split(`
3
- `),h=l;u.length>h;h++){var d=u[h];if(1024>=d.length){var g=Ir.test(d)?d.replace(Ir,"$1"):d;if(!g.match(/\S*Error: /)){for(var v of n){var _=v(g,s);if(_){c.push(_);break}}if(c.length>=50)break}}}return(function(C){if(!C.length)return[];var S=Array.from(C);return S.reverse(),S.slice(0,50).map(($=>{return m({},$,{filename:$.filename||(I=S,I[I.length-1]||{}).filename,function:$.function||dt});var I}))})(c)}})("web:javascript",aa,ca)),this._instance=i,this.no=(e=(t=this._instance.persistence)==null?void 0:t.get_property(ms))!==null&&e!==void 0?e:[]}onRemoteConfig(i){var e,t,s;if("errorTracking"in i){var r=(e=(t=i.errorTracking)==null?void 0:t.suppressionRules)!==null&&e!==void 0?e:[],n=(s=i.errorTracking)==null?void 0:s.captureExtensionExceptions;this.no=r,this._instance.persistence&&this._instance.persistence.register({[ms]:this.no,[Cr]:n})}}get oo(){var i,e=!!this._instance.get_property(Cr),t=this._instance.config.error_tracking.captureExtensionExceptions;return(i=t??e)!==null&&i!==void 0&&i}buildProperties(i,e){return this.so.buildFromUnknown(i,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}sendExceptionEvent(i){var e=i.$exception_list;if(this.ao(e)){if(this.lo(e))return void Qi.info("Skipping exception capture because a suppression rule matched");if(!this.oo&&this.uo(e))return void Qi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ho(e))return void Qi.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",zr:!0})}lo(i){if(i.length===0)return!1;var e=i.reduce(((t,s)=>{var{type:r,value:n}=s;return X(r)&&r.length>0&&t.$exception_types.push(r),X(n)&&n.length>0&&t.$exception_values.push(n),t}),{$exception_types:[],$exception_values:[]});return this.no.some((t=>{var s=t.values.map((r=>{var n,o=bo[r.operator],a=D(r.value)?r.value:[r.value],l=(n=e[r.key])!==null&&n!==void 0?n:[];return a.length>0&&o(a,l)}));return t.type==="OR"?s.some(Boolean):s.every(Boolean)}))}uo(i){return i.flatMap((e=>{var t,s;return(t=(s=e.stacktrace)==null?void 0:s.frames)!==null&&t!==void 0?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}ho(i){if(i.length>0){var e,t,s,r,n=(e=(t=i[0].stacktrace)==null?void 0:t.frames)!==null&&e!==void 0?e:[],o=n[n.length-1];return(s=o==null||(r=o.filename)==null?void 0:r.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}ao(i){return!L(i)&&D(i)}}},ll=m({productTours:class{get Xi(){return this._instance.persistence}constructor(i){this.co=null,this.do=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){"productTours"in i&&(this.Xi&&this.Xi.register({[Mr]:!!i.productTours}),this.loadIfEnabled())}loadIfEnabled(){var i,e;this.co||(i=this._instance).config.disable_product_tours||(e=i.persistence)==null||!e.get_property(Mr)||this.ni((()=>this.vo()))}ni(i){var e,t;(e=P.__PosthogExtensions__)!=null&&e.generateProductTours?i():(t=P.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",(s=>{s?_n.error("Could not load product tours script",s):i()}))}vo(){var i;!this.co&&(i=P.__PosthogExtensions__)!=null&&i.generateProductTours&&(this.co=P.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(i,e){if(e===void 0&&(e=!1),!D(this.do)||e){var t=this.Xi;if(t){var s=t.props[Yi];if(D(s)&&!e)return this.do=s,void i(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:r=>{var n=r.statusCode;if(n!==200||!r.json){var o="Product Tours API could not be loaded, status: "+n;return _n.error(o),void i([],{isLoaded:!1,error:o})}var a=D(r.json.product_tours)?r.json.product_tours:[];this.do=a,t&&t.register({[Yi]:a}),i(a,{isLoaded:!0})}})}else i(this.do,{isLoaded:!0})}getActiveProductTours(i){L(this.co)?i([],{isLoaded:!1,error:"Product tours not loaded"}):this.co.getActiveProductTours(i)}showProductTour(i){var e;(e=this.co)==null||e.showTourById(i)}previewTour(i){this.co?this.co.previewTour(i):this.ni((()=>{var e;this.vo(),(e=this.co)==null||e.previewTour(i)}))}dismissProductTour(){var i;(i=this.co)==null||i.dismissTour("user_clicked_skip")}nextStep(){var i;(i=this.co)==null||i.nextStep()}previousStep(){var i;(i=this.co)==null||i.previousStep()}clearCache(){var i;this.do=null,(i=this.Xi)==null||i.unregister(Yi)}resetTour(i){var e;(e=this.co)==null||e.resetTour(i)}resetAllTours(){var i;(i=this.co)==null||i.resetAllTours()}cancelPendingTour(i){var e;(e=this.co)==null||e.cancelPendingTour(i)}}},Ii),ul={siteApps:class{constructor(i){this._instance=i,this.fo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}po(i,e){if(e){var t=this.globalsForEvent(e);this.fo.push(t),this.fo.length>1e3&&(this.fo=this.fo.slice(10))}}get siteAppLoaders(){var i;return(i=P._POSTHOG_REMOTE_CONFIG)==null||(i=i[this._instance.config.token])==null?void 0:i.siteApps}initialize(){if(this.isEnabled){var i=this._instance._addCaptureHook(this.po.bind(this));this.mo=()=>{i(),this.fo=[],this.mo=void 0}}}globalsForEvent(i){var e,t,s,r,n,o,a;if(!i)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(u))l[h]={id:c[h],type:h,properties:d};var{$set_once:g,$set:v}=i;return{event:m({},Tn(i,tl),{properties:m({},i.properties,v?{$set:m({},(e=(t=i.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},v)}:{},g?{$set_once:m({},(s=(r=i.properties)==null?void 0:r.$set_once)!==null&&s!==void 0?s:{},g)}:{}),elements_chain:(n=(o=i.properties)==null?void 0:o.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(a=i.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(i){var e=this.apps[i.id],t=()=>{var o;!e.errored&&this.fo.length&&(De.info("Processing "+this.fo.length+" events for site app with id "+i.id),this.fo.forEach((a=>e.processEvent==null?void 0:e.processEvent(a))),e.processedBuffer=!0),Object.values(this.apps).every((a=>a.processedBuffer||a.errored))&&((o=this.mo)==null||o.call(this))},s=!1,r=o=>{e.errored=!o,e.loaded=!0,De.info("Site app with id "+i.id+" "+(o?"loaded":"errored")),s&&t()};try{var{processEvent:n}=i.init({posthog:this._instance,callback(o){r(o)}});n&&(e.processEvent=n),s=!0}catch(o){De.error(fn+i.id,o),r(!1)}if(s&&e.loaded)try{t()}catch(o){De.error("Error while processing buffered events PostHog app with config id "+i.id,o),e.errored=!0}}yo(){var i=this.siteAppLoaders||[];for(var e of i)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var t of i)this.setupSiteApp(t)}bo(i){if(Object.keys(this.apps).length!==0){var e=this.globalsForEvent(i);for(var t of Object.values(this.apps))try{t.processEvent==null||t.processEvent(e)}catch(s){De.error("Error while processing event "+i.event+" for site app "+t.id,s)}}}onRemoteConfig(i){var e,t,s,r=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.yo(),void this._instance.on("eventCaptured",(l=>this.bo(l)))):void De.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this.mo)==null||t.call(this),(s=i.siteApps)!=null&&s.length)if(this.isEnabled){var n=function(l){var c;P["__$$ph_site_app_"+l]=r._instance,(c=P.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(r._instance,a,(u=>{if(u)return De.error(fn+l,u)}))};for(var{id:o,url:a}of i.siteApps)n(o)}else De.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},cl={tracingHeaders:class{constructor(i){this.wo=void 0,this._o=void 0,this.Gs=()=>{var e,t;x(this.wo)&&((e=P.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),x(this._o)&&((t=P.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=i}initialize(){this.startIfEnabledOrStop()}ni(i){var e,t;(e=P.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns&&i(),(t=P.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return Qa.error("failed to load script",s);i()}))}startIfEnabledOrStop(){var i,e;this._instance.config.__add_tracing_headers?this.ni(this.Gs):((i=this.wo)==null||i.call(this),(e=this._o)==null||e.call(this),this.wo=void 0,this._o=void 0)}}},hl=m({surveys:class{get Rt(){return this._instance.config}constructor(i){this.Io=void 0,this._surveyManager=null,this.Co=!1,this.So=[],this.ko=null,this._instance=i,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this.Rt.disable_surveys){var e=i.surveys;if(L(e))return j.warn("Flags not loaded yet. Not loading surveys.");var t=D(e);this.Io=t?e.length>0:e,j.info("flags response received, isSurveysEnabled: "+this.Io),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var t=localStorage.key(e);(t!=null&&t.startsWith(Vs)||t!=null&&t.startsWith("inProgressSurvey_"))&&i.push(t)}i.forEach((s=>localStorage.removeItem(s)))}loadIfEnabled(){if(!this._surveyManager)if(this.Co)j.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)j.info(mn);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())j.info("Not loading surveys in cookieless mode without consent.");else{var i=P?.__PosthogExtensions__;if(i){if(!x(this.Io)||this.Rt.advanced_enable_surveys){var e=this.Io||this.Rt.advanced_enable_surveys;this.Co=!0;try{var t=i.generateSurveys;if(t)return void this.xo(t,e);var s=i.loadExternalDependency;if(!s)return void this.To(ar);s(this._instance,"surveys",(r=>{r||!i.generateSurveys?this.To("Could not load surveys script",r):this.xo(i.generateSurveys,e)}))}catch(r){throw this.To("Error initializing surveys",r),r}finally{this.Co=!1}}}else j.error("PostHog Extensions not found.")}}xo(i,e){this._surveyManager=i(this._instance,e),this._surveyEventReceiver=new er(this._instance),j.info("Surveys loaded successfully"),this.Ao({isLoaded:!0})}To(i,e){j.error(i,e),this.Ao({isLoaded:!1,error:i})}onSurveysLoaded(i){return this.So.push(i),this._surveyManager&&this.Ao({isLoaded:!0}),()=>{this.So=this.So.filter((e=>e!==i))}}getSurveys(i,e){if(e===void 0&&(e=!1),this.Rt.disable_surveys)return j.info(mn),i([]);var t,s=this._instance.get_property(bs);if(s&&!e)return i(s,{isLoaded:!0});typeof Promise<"u"&&this.ko?this.ko.then((r=>{var{surveys:n,context:o}=r;return i(n,o)})):(typeof Promise<"u"&&(this.ko=new Promise((r=>{t=r}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:r=>{var n;this.ko=null;var o=r.statusCode;if(o!==200||!r.json){var a="Surveys API could not be loaded, status: "+o;j.error(a);var l={isLoaded:!1,error:a};return i([],l),void(t==null||t({surveys:[],context:l}))}var c,u=r.json.surveys||[],h=u.filter((g=>(function(v){return!(!v.start_date||v.end_date)})(g)&&((function(v){var _;return!((_=v.conditions)==null||(_=_.events)==null||(_=_.values)==null||!_.length)})(g)||(function(v){var _;return!((_=v.conditions)==null||(_=_.actions)==null||(_=_.values)==null||!_.length)})(g))));h.length>0&&((c=this._surveyEventReceiver)==null||c.register(h)),(n=this._instance.persistence)==null||n.register({[bs]:u});var d={isLoaded:!0};i(u,d),t?.({surveys:u,context:d})}}))}Ao(i){for(var e of this.So)try{if(!i.isLoaded)return e([],i);this.getSurveys(e)}catch(t){j.error("Error in survey callback",t)}}getActiveMatchingSurveys(i,e){if(e===void 0&&(e=!1),!L(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(i,e);j.warn("init was not called")}Eo(i){var e=null;return this.getSurveys((t=>{var s;e=(s=t.find((r=>r.id===i)))!==null&&s!==void 0?s:null})),e}Ro(i){if(L(this._surveyManager))return{eligible:!1,reason:Ji};var e=typeof i=="string"?this.Eo(i):i;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(i){if(L(this._surveyManager))return j.warn("init was not called"),{visible:!1,disabledReason:Ji};var e=this.Ro(i);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(i,e){return L(this._surveyManager)?(j.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ji})):new Promise((t=>{this.getSurveys((s=>{var r,n=(r=s.find((a=>a.id===i)))!==null&&r!==void 0?r:null;if(n){var o=this.Ro(n);t({visible:o.eligible,disabledReason:o.reason})}else t({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(i,e,t){var s;if(L(this._surveyManager))j.warn("init was not called");else{var r=typeof i=="string"?this.Eo(i):i;if(r!=null&&r.id)if(Ua.includes(r.type)){var n=b?.querySelector(e);if(n)return(s=r.appearance)!=null&&s.surveyPopupDelaySeconds?(j.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var o,a;j.info("Rendering survey "+r.id+" with delay of "+((o=r.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(r,n,t),j.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,t);j.warn("Survey element not found")}else j.warn("Surveys of type "+r.type+" cannot be rendered in the app");else j.warn("Survey not found")}}displaySurvey(i,e){var t;if(L(this._surveyManager))j.warn("init was not called");else{var s=this.Eo(i);if(s){var r=s;if((t=s.appearance)!=null&&t.surveyPopupDelaySeconds&&e.ignoreDelay&&(r=m({},s,{appearance:m({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Cs.Popover&&e.initialResponses&&j.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var n=this.canRenderSurvey(s);if(!n.visible)return void j.warn("Survey is not eligible to be displayed: ",n.disabledReason)}e.displayType!==Cs.Inline?this._surveyManager.handlePopoverSurvey(r,e):this.renderSurvey(r,e.selector,e.properties)}else j.warn("Survey not found")}}cancelPendingSurvey(i){L(this._surveyManager)?j.warn("init was not called"):this._surveyManager.cancelSurvey(i)}handlePageUnload(){var i;(i=this._surveyManager)==null||i.handlePageUnload()}}},Ii),dl={toolbar:class{constructor(i){this.instance=i}No(i){P.ph_toolbar_state=i}Mo(){var i;return(i=P.ph_toolbar_state)!==null&&i!==void 0?i:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,t){if(i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),io(this.instance.config)||!p||!b)return!1;i=i??p.location,t=t??p.history;try{if(!e){try{p.localStorage.setItem("test","test"),p.localStorage.removeItem("test")}catch{return!1}e=p?.localStorage}var s,r=il||_i(i.hash,"__posthog")||_i(i.hash,"state"),n=r?Nr((()=>JSON.parse(atob(decodeURIComponent(r)))))||Nr((()=>JSON.parse(decodeURIComponent(r)))):null;return n&&n.action==="ph_authorize"?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?i.hash=n.desiredHash:t?t.replaceState(t.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(yn)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}Fo(i){var e=P.ph_load_toolbar||P.ph_load_editor;!L(e)&&Ie(e)?e(i,this.instance):bn.warn("No toolbar load function found")}loadToolbar(i){var e=!(b==null||!b.getElementById(to));if(!p||e)return!1;var t=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=m({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},t?{instrument:!1}:{});if(p.localStorage.setItem(yn,JSON.stringify(m({},s,{source:void 0}))),this.Mo()===2)this.Fo(s);else if(this.Mo()===0){var r;this.No(1),(r=P.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return bn.error("[Toolbar] Failed to load",n),void this.No(0);this.No(2),this.Fo(s)})),G(p,"turbolinks:load",(()=>{this.No(0),this.loadToolbar(s)}))}return!0}Oo(i){return this.loadToolbar(i)}maybeLoadEditor(i,e,t){return i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.maybeLoadToolbar(i,e,t)}}},pl=m({experiments:tr},Ii),gl={conversations:class{constructor(i){this.Po=void 0,this._conversationsManager=null,this.Lo=!1,this.Do=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this._instance.config.disable_conversations){var e=i.conversations;L(e)||(Se(e)?this.Po=e:(this.Po=e.enabled,this.Do=e),this.loadIfEnabled())}}reset(){var i;(i=this._conversationsManager)==null||i.reset(),this._conversationsManager=null,this.Po=void 0,this.Do=null}loadIfEnabled(){if(!(this._conversationsManager||this.Lo||this._instance.config.disable_conversations||io(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=P?.__PosthogExtensions__;if(i&&!x(this.Po)&&this.Po)if(this.Do&&this.Do.token){this.Lo=!0;try{var e=i.initConversations;if(e)return this.Bo(e),void(this.Lo=!1);var t=i.loadExternalDependency;if(!t)return void this.jo(ar);t(this._instance,"conversations",(s=>{s||!i.initConversations?this.jo("Could not load conversations script",s):this.Bo(i.initConversations),this.Lo=!1}))}catch(s){this.jo("Error initializing conversations",s),this.Lo=!1}}else ge.error("Conversations enabled but missing token in remote config.")}}Bo(i){if(this.Do)try{this._conversationsManager=i(this.Do,this._instance),ge.info("Conversations loaded successfully")}catch(e){this.jo("Error completing conversations initialization",e)}else ge.error("Cannot complete initialization: remote config is null")}jo(i,e){ge.error(i,e),this._conversationsManager=null,this.Lo=!1}show(){this._conversationsManager?this._conversationsManager.show():ge.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Po===!0&&!Oe(this._conversationsManager)}isVisible(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&i!==void 0&&i}sendMessage(i,e,t){var s=this;return be((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(i,e,t):(ge.warn(Ve),null)}))()}getMessages(i,e){var t=this;return be((function*(){return t._conversationsManager?t._conversationsManager.getMessages(i,e):(ge.warn(Ve),null)}))()}markAsRead(i){var e=this;return be((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(i):(ge.warn(Ve),null)}))()}getTickets(i){var e=this;return be((function*(){return e._conversationsManager?e._conversationsManager.getTickets(i):(ge.warn(Ve),null)}))()}requestRestoreLink(i){var e=this;return be((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(i):(ge.warn(Ve),null)}))()}restoreFromToken(i){var e=this;return be((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(i):(ge.warn(Ve),null)}))()}restoreFromUrlToken(){var i=this;return be((function*(){return i._conversationsManager?i._conversationsManager.restoreFromUrlToken():(ge.warn(Ve),null)}))()}getCurrentTicketId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&i!==void 0?i:null}getWidgetSessionId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&i!==void 0?i:null}Kr(){var i;(i=this._conversationsManager)==null||i.setIdentity()}Qr(){var i;(i=this._conversationsManager)==null||i.clearIdentity()}}},vl={logs:class{constructor(i){var e;this.qo=!1,this.Zo=!1,this.qt=z("[logs]"),this.$o=[],this.Vo=0,this.Ho=0,this.zo=!1,this._instance=i,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.qo=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(i){var e,t=(e=i.logs)==null?void 0:e.captureConsoleLogs;!L(t)&&t&&(this.qo=!0,this.loadIfEnabled())}reset(){this.$o=[],this.Ni&&(clearTimeout(this.Ni),this.Ni=void 0),this.Vo=0,this.Ho=0,this.zo=!1}loadIfEnabled(){if(this.qo&&!this.Zo){var i=P?.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(t=>{var s;t||(s=i.logs)==null||!s.initializeLogs?this.qt.error("Could not load logs script",t):(i.logs.initializeLogs(this._instance),this.Zo=!0)})):this.qt.error(ar)}else this.qt.error("PostHog Extensions not found.")}}captureLog(i){var e,t,s,r,n,o;if(this._instance.is_capturing())if(i&&i.body){var a=(e=(t=this._instance.config.logs)==null?void 0:t.flushIntervalMs)!==null&&e!==void 0?e:3e3,l=(s=(r=this._instance.config.logs)==null?void 0:r.maxLogsPerInterval)!==null&&s!==void 0?s:1e3,c=Date.now();if(a>c-this.Ho||(this.Ho=c,this.Vo=0,this.zo=!1),l>this.Vo){this.Vo++;var u=(function(h,d){var g=h.level||"info",{text:v,number:_}=Oo[g]||rl,C=String(Date.now())+"000000",S={};d.distinctId&&(S.posthogDistinctId=d.distinctId),d.sessionId&&(S.sessionId=d.sessionId),d.currentUrl&&(S["url.full"]=d.currentUrl),d.activeFeatureFlags&&d.activeFeatureFlags.length>0&&(S.feature_flags=d.activeFeatureFlags);var $=m({},S,h.attributes||{}),I={timeUnixNano:C,observedTimeUnixNano:C,severityNumber:_,severityText:v,body:{stringValue:h.body},attributes:Rn($)};return h.trace_id&&(I.traceId=h.trace_id),h.span_id&&(I.spanId=h.span_id),x(h.trace_flags)||(I.flags=h.trace_flags),I})(i,this.Uo());this.$o.push({record:u}),((n=(o=this._instance.config.logs)==null?void 0:o.maxBufferSize)!==null&&n!==void 0?n:100)>this.$o.length?this.Yo():this.flushLogs()}else this.zo||(this.qt.warn("captureLog dropping logs: exceeded "+l+" logs per "+a+"ms"),this.zo=!0)}else this.qt.warn("captureLog requires a body")}get logger(){return this.Go||(this.Go={trace:(i,e)=>this.captureLog({body:i,level:"trace",attributes:e}),debug:(i,e)=>this.captureLog({body:i,level:"debug",attributes:e}),info:(i,e)=>this.captureLog({body:i,level:"info",attributes:e}),warn:(i,e)=>this.captureLog({body:i,level:"warn",attributes:e}),error:(i,e)=>this.captureLog({body:i,level:"error",attributes:e}),fatal:(i,e)=>this.captureLog({body:i,level:"fatal",attributes:e})}),this.Go}flushLogs(i){if(this.Ni&&(clearTimeout(this.Ni),this.Ni=void 0),this.$o.length!==0){var e=this.$o;this.$o=[];var t=this._instance.config.logs,s=m({"service.name":t?.serviceName||"unknown_service"},t?.environment&&{"deployment.environment":t.environment},t?.serviceVersion&&{"service.version":t.serviceVersion},t?.resourceAttributes),r=(function(o,a){return{resourceLogs:[{resource:{attributes:Rn(a)},scopeLogs:[{scope:{name:re.LIB_NAME},logRecords:o}]}]}})(e.map((o=>o.record)),s),n=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Pr({method:"POST",url:n,data:r,compression:"best-available",batchKey:"logs",transport:i})}}Yo(){var i,e;this.Ni||(this.Ni=setTimeout((()=>{this.Ni=void 0,this.flushLogs()}),(i=(e=this._instance.config.logs)==null?void 0:e.flushIntervalMs)!==null&&i!==void 0?i:3e3))}Uo(){var i,e={lib:re.LIB_NAME};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:t}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=t}if(P!=null&&(i=P.location)!=null&&i.href&&(e.currentUrl=P.location.href),this._instance.featureFlags){var s=this._instance.featureFlags.getFlags();s&&s.length>0&&(e.activeFeatureFlags=s)}return e}}},_l=m({},Ii,nl,ol,al,ll,ul,hl,cl,dl,pl,gl,vl);Xe.__defaultExtensionClasses=m({},_l);var Pn,le=(Pn=At[rt]=new Xe,(function(){function i(){i.done||(i.done=!0,xo=!1,q(At,(function(e){e._dom_loaded()})))}b!=null&&b.addEventListener?b.readyState==="complete"?i():G(b,"DOMContentLoaded",i,{capture:!1}):p&&w.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),Pn);var Je=class Je{constructor(e,t=!1){this.has_initialized=!1;this.has_identified=!1;this.debug=!1;this.log=br("[PostHog]",()=>this.debug);this.cleanupStalePosthogCookies=e=>{if(typeof document>"u"||typeof window>"u")return;let t=`ph_${e}_posthog`,s=document.cookie.split(";").map(a=>a.trim().split("=")[0]??"").filter(a=>/^ph_.+_posthog$/.test(a)&&a!==t);if(s.length===0)return;let r=window.location.hostname,n=r.split("."),o=n.length>=2?`.${n.slice(-2).join(".")}`:r;s.forEach(a=>{[o,r,""].forEach(c=>{let u=c?`; Domain=${c}`:"";document.cookie=`${a}=; path=/${u}; max-age=0; SameSite=Lax`});let l=!document.cookie.split(";").some(c=>c.trim().startsWith(`${a}=`));this.log(`cleanupStalePosthogCookies | ${l?"removed":"failed to remove"} stale cookie: ${a}`)})};this.init=()=>{try{let{apiKey:e,api_host:t,config:s={}}=this.options;if(!e){console.warn("Posthog: No API key provided");return}this.cleanupStalePosthogCookies(e);let r=t||mr();this.log("init | loading PostHog SDK",{api_host:r});let n={api_host:r,ui_host:fr,autocapture:!0,capture_pageview:"history_change",session_recording:{recordCrossOriginIframes:!0,minimumDurationMilliseconds:3e4,...s.session_recording},before_send:o=>{if(typeof window>"u")return null;let a=window.location.hostname;if(a==="localhost"||a==="127.0.0.1")return o;let l=yr.some(c=>a.endsWith(`.${c}`)||a===c);return l||this.log("init | before_send blocked event from disallowed host",{currentHost:a}),l?o:null},...s};le.init(e,n),this.has_initialized=!0,this.log("init | PostHog SDK loaded successfully")}catch(e){console.error("Posthog: Failed to initialize",e)}};this.identifyEvent=(e,t={})=>{if(!this.has_initialized){console.warn("Posthog: Cannot identify - not initialized");return}try{let s=this.has_identified&&le.get_distinct_id()===e;e&&!s?(this.log("identifyEvent | identifying user",{user_id:e,traits:t}),le.identify(e,{...t,client_id:e}),this.has_identified=!0):this.log("identifyEvent | skipped \u2014 user already identified",{user_id:e})}catch(s){console.error("Posthog: Failed to identify user",s)}};this.reset=()=>{if(this.has_initialized)try{this.log("reset | resetting PostHog session"),le.reset(),this.has_identified=!1}catch(e){console.error("Posthog: Failed to reset",e)}};this.backfillPersonProperties=({user_id:e,email:t,language:s,country_of_residence:r})=>{if(!(!this.has_initialized||!e))try{let n=le.get_property("$stored_person_properties")??{},o={};n.client_id||(o.client_id=e),t&&n.is_internal===void 0&&(o.is_internal=wr(t)),s&&!n.language&&(o.language=s),r&&!n.country_of_residence&&(o.country_of_residence=r),Object.keys(o).length>0?(this.log("backfillPersonProperties | backfilling person properties",{user_id:e,updates:o}),le.setPersonProperties(o)):this.log("backfillPersonProperties | skipped \u2014 all properties already present",{user_id:e,country_of_residence:r})}catch(n){console.error("Posthog: Failed to backfill person properties",n)}};this.capture=(e,t)=>{if(this.has_initialized)try{this.log("capture | sending event to PostHog",{event_name:e,properties:t}),le.capture(e,t)}catch(s){console.error("Posthog: Failed to capture event",s)}};this.isFeatureEnabled=e=>{if(this.has_initialized)try{let t=le.isFeatureEnabled(e);return this.log("isFeatureEnabled",{key:e,result:t}),t}catch(t){console.error("Posthog: Failed to check feature flag",t);return}};this.getFeatureFlag=e=>{if(this.has_initialized)try{let t=le.getFeatureFlag(e);return this.log("getFeatureFlag",{key:e,result:t}),t}catch(t){console.error("Posthog: Failed to get feature flag",t);return}};this.getFeatureFlagPayload=e=>{if(this.has_initialized)try{let t=le.getFeatureFlagResult(e)?.payload;return this.log("getFeatureFlagPayload",{key:e,result:t}),t}catch(t){console.error("Posthog: Failed to get feature flag payload",t);return}};this.getAllFlags=()=>{if(!this.has_initialized)return{};try{let e=le.featureFlags?.getFlagVariants()??{};return this.log("getAllFlags",{result:e}),e}catch(e){return console.error("Posthog: Failed to get all feature flags",e),{}}};this.onFeatureFlags=e=>{if(!this.has_initialized)return()=>{};try{this.log("onFeatureFlags | subscribing to feature flag changes");let t=le.onFeatureFlags(e);return typeof t=="function"?t:()=>{}}catch(t){return console.error("Posthog: Failed to subscribe to feature flags",t),()=>{}}};this.reloadFeatureFlags=()=>{if(this.has_initialized)try{this.log("reloadFeatureFlags | reloading feature flags"),le.reloadFeatureFlags()}catch(e){console.error("Posthog: Failed to reload feature flags",e)}};this.options=e,this.debug=t,this.init()}};Je.getPosthogInstance=(e,t=!1)=>(Je._instance||(Je._instance=new Je(e,t)),Je._instance);var Ao=Je;export{Ao as Posthog};
4
- //# sourceMappingURL=posthog-AGNFJC2G.mjs.map