@deriv-com/analytics 1.38.7 → 1.38.8

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,6 +1,6 @@
1
1
  /* @deriv-com/analytics - Browser ESM Bundle (RudderStack + PostHog) - Built with tsup */
2
- import{e as ns,f as os,g as as}from"./chunk-HQX3Z7PF.mjs";var d=typeof window<"u"?window:void 0,V=typeof globalThis<"u"?globalThis:d;typeof self>"u"&&(V.self=V),typeof File>"u"&&(V.File=function(){});var sn=Array.prototype,ls=sn.forEach,cs=sn.indexOf,ee=V?.navigator,y=V?.document,G=V?.location,Ti=V?.fetch,Ci=V!=null&&V.XMLHttpRequest&&"withCredentials"in new V.XMLHttpRequest?V.XMLHttpRequest:void 0,us=V?.AbortController,X=ee?.userAgent,E=d??{},ve={DEBUG:!1,LIB_VERSION:"1.345.2"};function hs(r,e,t,i,s,n,o){try{var a=r[n](o),l=a.value}catch(u){return void t(u)}a.done?e(l):Promise.resolve(l).then(i,s)}function Je(r){return function(){var e=this,t=arguments;return new Promise((function(i,s){var n=r.apply(e,t);function o(l){hs(n,i,s,o,a,"next",l)}function a(l){hs(n,i,s,o,a,"throw",l)}o(void 0)}))}}function w(){return w=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},w.apply(null,arguments)}function nn(r,e){if(r==null)return{};var t={};for(var i in r)if({}.hasOwnProperty.call(r,i)){if(e.indexOf(i)!==-1)continue;t[i]=r[i]}return t}var _o=["$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"],fo=["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"],ds=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return fo.concat(e).some((i=>{var s=i.toLowerCase();return t.indexOf(s)!==-1}))};function F(r,e){return r.indexOf(e)!==-1}var ci=function(r){return r.trim()},Oi=function(r){return r.replace(/^\$/,"")},mo=Array.isArray,on=Object.prototype,an=on.hasOwnProperty,ui=on.toString,T=mo||function(r){return ui.call(r)==="[object Array]"},Ce=r=>typeof r=="function",q=r=>r===Object(r)&&!T(r),Xe=r=>{if(q(r)){for(var e in r)if(an.call(r,e))return!1;return!0}return!1},f=r=>r===void 0,U=r=>ui.call(r)=="[object String]",Mi=r=>U(r)&&r.trim().length===0,oe=r=>r===null,I=r=>f(r)||oe(r),we=r=>ui.call(r)=="[object Number]"&&r==r,ze=r=>we(r)&&r>0,be=r=>ui.call(r)==="[object Boolean]",yo=r=>r instanceof FormData,bo=r=>F(_o,r);function Ai(r){return r===null||typeof r!="object"}function qt(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function ln(r){return!f(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(r,Event)}var wo=[!0,"true",1,"1","yes"],gi=r=>F(wo,r),Eo=[!1,"false",0,"0","no"];function he(r,e,t,i,s){return e>t&&(i.warn("min cannot be greater than max."),e=t),we(r)?r>t?(i.warn(" cannot be greater than max: "+t+". Using max value instead."),t):r<e?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):r:(i.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+s),he(s||t,e,t,i))}var Di=class{constructor(e){this.t={},this.i=e.i,this.o=he(e.bucketSize,0,100,e.h),this.m=he(e.refillRate,0,this.o,e.h),this.$=he(e.refillInterval,0,864e5,e.h)}S(e,t){var i=t-e.lastAccess,s=Math.floor(i/this.$);if(s>0){var n=s*this.m;e.tokens=Math.min(e.tokens+n,this.o),e.lastAccess=e.lastAccess+s*this.$}}consumeRateLimit(e){var t,i=Date.now(),s=String(e),n=this.t[s];return n?this.S(n,i):(n={tokens:this.o,lastAccess:i},this.t[s]=n),n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.i)==null||t.call(this,e)),n.tokens===0)}stop(){this.t={}}},se="Mobile",Ut="iOS",ye="Android",Pt="Tablet",cn=ye+" "+Pt,un="iPad",hn="Apple",dn=hn+" Watch",St="Safari",et="BlackBerry",pn="Samsung",gn=pn+"Browser",vn=pn+" Internet",je="Chrome",xo=je+" OS",_n=je+" "+Ut,Vr="Internet Explorer",fn=Vr+" "+se,Wr="Opera",ko=Wr+" Mini",zr="Edge",mn="Microsoft "+zr,Ze="Firefox",yn=Ze+" "+Ut,Ft="Nintendo",$t="PlayStation",Qe="Xbox",bn=ye+" "+se,wn=se+" "+St,gt="Windows",Ni=gt+" Phone",ps="Nokia",Li="Ouya",En="Generic",Po=En+" "+se.toLowerCase(),xn=En+" "+Pt.toLowerCase(),ji="Konqueror",Y="(\\d+(\\.\\d+)?)",vi=new RegExp("Version/"+Y),So=new RegExp(Qe,"i"),Fo=new RegExp($t+" \\w+","i"),$o=new RegExp(Ft+" \\w+","i"),Yr=new RegExp(et+"|PlayBook|BB10","i"),Io={"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"},Mt,gs,_i,Ro=(r,e)=>e&&F(e,hn)||(function(t){return F(t,St)&&!F(t,je)&&!F(t,ye)})(r),kn=function(r,e){return e=e||"",F(r," OPR/")&&F(r,"Mini")?ko:F(r," OPR/")?Wr:Yr.test(r)?et:F(r,"IE"+se)||F(r,"WPDesktop")?fn:F(r,gn)?vn:F(r,zr)||F(r,"Edg/")?mn:F(r,"FBIOS")?"Facebook "+se:F(r,"UCWEB")||F(r,"UCBrowser")?"UC Browser":F(r,"CriOS")?_n:F(r,"CrMo")||F(r,je)?je:F(r,ye)&&F(r,St)?bn:F(r,"FxiOS")?yn:F(r.toLowerCase(),ji.toLowerCase())?ji:Ro(r,e)?F(r,se)?wn:St:F(r,Ze)?Ze:F(r,"MSIE")||F(r,"Trident/")?Vr:F(r,"Gecko")?Ze:""},To={[fn]:[new RegExp("rv:"+Y)],[mn]:[new RegExp(zr+"?\\/"+Y)],[je]:[new RegExp("("+je+"|CrMo)\\/"+Y)],[_n]:[new RegExp("CriOS\\/"+Y)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Y)],[St]:[vi],[wn]:[vi],[Wr]:[new RegExp("(Opera|OPR)\\/"+Y)],[Ze]:[new RegExp(Ze+"\\/"+Y)],[yn]:[new RegExp("FxiOS\\/"+Y)],[ji]:[new RegExp("Konqueror[:/]?"+Y,"i")],[et]:[new RegExp(et+" "+Y),vi],[bn]:[new RegExp("android\\s"+Y,"i")],[vn]:[new RegExp(gn+"\\/"+Y)],[Vr]:[new RegExp("(rv:|MSIE )"+Y)],Mozilla:[new RegExp("rv:"+Y)]},Co=function(r,e){var t=kn(r,e),i=To[t];if(f(i))return null;for(var s=0;s<i.length;s++){var n=i[s],o=r.match(n);if(o)return parseFloat(o[o.length-2])}return null},vs=[[new RegExp(Qe+"; "+Qe+" (.*?)[);]","i"),r=>[Qe,r&&r[1]||""]],[new RegExp(Ft,"i"),[Ft,""]],[new RegExp($t,"i"),[$t,""]],[Yr,[et,""]],[new RegExp(gt,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Ni,""];if(new RegExp(se).test(e)&&!/IEMobile\b/.test(e))return[gt+" "+se,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=t[1],s=Io[i]||"";return/arm/i.test(e)&&(s="RT"),[gt,s]}return[gt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[Ut,e.join(".")]}return[Ut,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=f(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+ye+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ye+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[ye,e.join(".")]}return[ye,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[xo,""]],[/Linux|debian/i,["Linux",""]]],_s=function(r){return $o.test(r)?Ft:Fo.test(r)?$t:So.test(r)?Qe:new RegExp(Li,"i").test(r)?Li:new RegExp("("+Ni+"|WPDesktop)","i").test(r)?Ni:/iPad/.test(r)?un:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?dn:Yr.test(r)?et:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(ps,"i").test(r)?ps:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r)||/(kf[a-z]+)( bui|\)).+silk\//i.test(r)?"Kindle Fire":/(Android|ZTE)/i.test(r)?new RegExp(se).test(r)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r)||/pixel[\daxl ]{1,6}/i.test(r)&&!/pixel c/i.test(r)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r)||/lmy47v/i.test(r)&&!/QTAQZ3/i.test(r)?ye:cn:new RegExp("(pda|"+se+")","i").test(r)?Po:new RegExp(Pt,"i").test(r)&&!new RegExp(Pt+" pc","i").test(r)?xn:""},Oo=r=>r instanceof Error;function Mo(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return _i&&t.length===gs||(gs=t.length,_i=t.reduce(((i,s)=>{Mt||(Mt={});var n=Mt[s];if(n)i[n[0]]=n[1];else for(var o=r(s),a=o.length-1;a>=0;a--){var l=o[a],u=l?.filename,c=e[s];if(u&&c){i[u]=c,Mt[s]=[u,c];break}}return i}),{})),_i}}var Hi=class{constructor(e,t,i){i===void 0&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){t===void 0&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(t),o=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(o,i),$exception_level:"error"}}modifyFrames(e){var t=this;return Je((function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&T(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),w({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map((i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i)))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Je((function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i}))()}convertToExceptionList(e,t){var i,s,n,o={type:e.type,value:e.value,mechanism:{type:(i=t.type)!==null&&i!==void 0?i:"generic",handled:(s=t.handled)===null||s===void 0||s,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,w({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:Mo(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,i){i===void 0&&(i=0);var s=(n,o)=>{if(o<=4){var a=this.buildCoercingContext(e,t,o);return this.applyCoercers(n,a)}};return w({},t,{syntheticException:i==0?t.syntheticException:void 0,mechanism:e,apply:n=>s(n,i),next:n=>s(n,i+1)})}},tt="?";function qi(r,e,t,i,s){var n={platform:r,filename:e,function:t==="<anonymous>"?tt:t,in_app:!0};return f(i)||(n.lineno=i),f(s)||(n.colno=s),n}var Pn=(r,e)=>{var t=r.indexOf("safari-extension")!==-1,i=r.indexOf("safari-web-extension")!==-1;return t||i?[r.indexOf("@")!==-1?r.split("@")[0]:tt,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},Ao=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Do=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,No=/\((\S*)(?::(\d+))(?::(\d+))\)/,Lo=(r,e)=>{var t=Ao.exec(r);if(t){var[,i,s,n]=t;return qi(e,i,tt,+s,+n)}var o=Do.exec(r);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=No.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Pn(o[1]||tt,o[2]);return qi(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},jo=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ho=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,qo=(r,e)=>{var t=jo.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var i=Ho.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}var s=t[3],n=t[1]||tt;return[n,s]=Pn(n,s),qi(e,s,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},fs=/\(error: (.*)\)/,ms=50;function Uo(){return(function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return function(s,n){n===void 0&&(n=0);for(var o=[],a=s.split(`
3
- `),l=n;l<a.length;l++){var u=a[l];if(!(u.length>1024)){var c=fs.test(u)?u.replace(fs,"$1"):u;if(!c.match(/\S*Error: /)){for(var h of t){var p=h(c,r);if(p){o.push(p);break}}if(o.length>=ms)break}}}return(function(g){if(!g.length)return[];var v=Array.from(g);return v.reverse(),v.slice(0,ms).map((_=>{return w({},_,{filename:_.filename||(m=v,m[m.length-1]||{}).filename,function:_.function||tt});var m}))})(o)}})("web:javascript",Lo,qo)}var Ui=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=U(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return qt(e,"DOMException")}isDOMError(e){return qt(e,"DOMError")}},Bi=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 i=e.message;return i.error&&typeof i.error.message=="string"?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}},Gi=class{constructor(){}match(e){return qt(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var i,s=t.apply(e.error);return s||{type:"ErrorEvent",value:e.message,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Bo=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Vi=class{match(e){return typeof e=="string"}coerce(e,t){var i,[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(Bo);return s&&(t=s[1],i=s[2]),[t,i]}},Go=["fatal","error","warning","log","info","debug"];function Sn(r,e){e===void 0&&(e=40);var t=Object.keys(r);if(t.sort(),!t.length)return"[object has no keys]";for(var i=t.length;i>0;i--){var s=t.slice(0,i).join(", ");if(!(s.length>e))return i===t.length||s.length<=e?s:s.slice(0,e)+"..."}return""}var Wi=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(i=t.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return ln(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+Sn(e)}isSeverityLevel(e){return U(e)&&!Mi(e)&&Go.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(Oo(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},zi=class{match(e){return ln(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+Sn(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Yi=class{match(e){return Ai(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Ji=class{match(e){return qt(e,"PromiseRejectionEvent")}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return Ai(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){if(Ai(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}},Fn=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,i={k:function(s){if(d&&(ve.DEBUG||E.POSTHOG_DEBUG||t)&&!f(d.console)&&d.console){for(var n=("__rrweb_original__"in d.console[s])?d.console[s].__rrweb_original__:d.console[s],o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];n(r,...a)}},info:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];i.k("log",...n)},warn:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];i.k("warn",...n)},error:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];i.k("error",...n)},critical:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];console.error(r,...n)},uninitializedWarning:s=>{i.error("You must initialize PostHog before calling "+s)},createLogger:(s,n)=>Fn(r+" "+s,n)};return i},b=Fn("[PostHog.js]"),N=b.createLogger,Vo=N("[ExternalScriptsLoader]"),ys=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return Vo.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var i=y?.querySelectorAll("script");if(i){for(var s,n=function(){if(i[o].src===e){var l=i[o];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(u=>{l.__posthog_loading_callback_fired=!0,t(void 0,u)})),l.onerror=u=>t(u),{v:void 0})}},o=0;o<i.length;o++)if(s=n())return s.v}var a=()=>{if(!y)return t("document not found");var l=y.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),r.config.prepare_external_dependency_script&&(l=r.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(r.config.external_scripts_inject_target==="head")y.head.appendChild(l);else{var u,c=y.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)==null||u.insertBefore(l,c[0]):y.body.appendChild(l)}};y!=null&&y.body?a():y?.addEventListener("DOMContentLoaded",a)};E.__PosthogExtensions__=E.__PosthogExtensions__||{},E.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var i="/static/"+e+".js?v="+r.version;if(e==="remote-config"&&(i="/array/"+r.config.token+"/config.js"),e==="toolbar"){var s=3e5;i=i+"&t="+Math.floor(Date.now()/s)*s}var n=r.requestRouter.endpointFor("assets",i);ys(r,n,t)},E.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var i=r.requestRouter.endpointFor("api",e);ys(r,i,t)};var Bt={};function Oe(r,e,t){if(T(r)){if(ls&&r.forEach===ls)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var i=0,s=r.length;i<s;i++)if(i in r&&e.call(t,r[i],i)===Bt)return}}}function M(r,e,t){if(!I(r)){if(T(r))return Oe(r,e,t);if(yo(r)){for(var i of r.entries())if(e.call(t,i[1],i[0])===Bt)return}else for(var s in r)if(an.call(r,s)&&e.call(t,r[s],s)===Bt)return}}var L=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Oe(t,(function(s){for(var n in s)s[n]!==void 0&&(r[n]=s[n])})),r},rt=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Oe(t,(function(s){Oe(s,(function(n){r.push(n)}))})),r};function jt(r){for(var e=Object.keys(r),t=e.length,i=new Array(t);t--;)i[t]=[e[t],r[e[t]]];return i}var bs=function(r){try{return r()}catch{return}},Wo=function(r){return function(){try{for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r.apply(this,t)}catch(s){b.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),b.critical(s)}}},Jr=function(r){var e={};return M(r,(function(t,i){(U(t)&&t.length>0||we(t))&&(e[i]=t)})),e};function zo(r,e){return t=r,i=n=>U(n)&&!oe(e)?n.slice(0,e):n,s=new Set,(function n(o,a){return o!==Object(o)?i?i(o,a):o:s.has(o)?void 0:(s.add(o),T(o)?(l=[],Oe(o,(u=>{l.push(n(u))}))):(l={},M(o,((u,c)=>{s.has(u)||(l[c]=n(u,c))}))),l);var l})(t);var t,i,s}var Yo=["herokuapp.com","vercel.app","netlify.app"];function Jo(r){var e=r?.hostname;if(!U(e))return!1;var t=e.split(".").slice(-2).join(".");for(var i of Yo)if(t===i)return!1;return!0}function $n(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function j(r,e,t,i){var{capture:s=!1,passive:n=!0}=i??{};r?.addEventListener(e,t,{capture:s,passive:n})}var In="$people_distinct_id",vt="__alias",_t="__timers",ws="$autocapture_disabled_server_side",Xi="$heatmaps_enabled_server_side",Es="$exception_capture_enabled_server_side",Ki="$error_tracking_suppression_rules",xs="$error_tracking_capture_extension_exceptions",ks="$web_vitals_enabled_server_side",Rn="$dead_clicks_enabled_server_side",Ps="$product_tours_enabled_server_side",Ss="$web_vitals_allowed_metrics",fi="$session_recording_remote_config",Gt="$sesid",Tn="$session_is_sampled",Ke="$enabled_feature_flags",ft="$early_access_features",Zi="$feature_flag_details",mt="$stored_person_properties",Le="$stored_group_properties",Qi="$surveys",Vt="$flag_call_reported",er="$feature_flag_errors",_e="$user_state",tr="$client_session_props",ir="$capture_rate_limit",rr="$initial_campaign_params",sr="$initial_referrer_info",Wt="$initial_person_info",zt="$epp",Cn="__POSTHOG_TOOLBAR__",nt="$posthog_cookieless",Xo=[In,vt,"__cmpns",_t,"$session_recording_enabled_server_side",Xi,Gt,Ke,Ki,_e,ft,Zi,Le,mt,Qi,Vt,er,tr,ir,rr,sr,zt,Wt,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function Fs(r){return r instanceof Element&&(r.id===Cn||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function hi(r){return!!r&&r.nodeType===1}function Me(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function On(r){return!!r&&r.nodeType===3}function Mn(r){return!!r&&r.nodeType===11}function Xr(r){return r?ci(r).split(/\s+/):[]}function $s(r){var e=d?.location.href;return!!(e&&r&&r.some((t=>e.match(t))))}function Yt(r){var e="";switch(typeof r.className){case"string":e=r.className;break;case"object":e=(r.className&&"baseVal"in r.className?r.className.baseVal:null)||r.getAttribute("class")||"";break;default:e=""}return Xr(e)}function An(r){return I(r)?null:ci(r).split(/(\s+)/).filter((e=>It(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Tt(r){var e="";return nr(r)&&!Hn(r)&&r.childNodes&&r.childNodes.length&&M(r.childNodes,(function(t){var i;On(t)&&t.textContent&&(e+=(i=An(t.textContent))!==null&&i!==void 0?i:"")})),ci(e)}function Dn(r){return f(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var Kr=["a","button","form","input","select","textarea","label"];function Nn(r,e){if(f(e))return!0;var t,i=function(n){if(e.some((o=>n.matches(o))))return{v:!0}};for(var s of r)if(t=i(s))return t.v;return!1}function Ln(r){var e=r.parentNode;return!(!e||!hi(e))&&e}var Ko=["next","previous","prev",">","<"],Is=10,Rs=[".ph-no-rageclick",".ph-no-capture"];function Zo(r,e){if(!d||Zr(r))return!1;var t,i,s;if(be(e)?(t=!!e&&Rs,i=void 0):(t=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:Rs,i=e?.content_ignorelist),t===!1)return!1;var{targetElementList:n}=jn(r,!1);return!(function(o,a){if(o===!1||f(o))return!1;var l;if(o===!0)l=Ko;else{if(!T(o))return!1;if(o.length>Is)return b.error("[PostHog] content_ignorelist array cannot exceed "+Is+" items. Use css_selector_ignorelist for more complex matching."),!1;l=o.map((u=>u.toLowerCase()))}return a.some((u=>{var{safeText:c,ariaLabel:h}=u;return l.some((p=>c.includes(p)||h.includes(p)))}))})(i,n.map((o=>{var a;return{safeText:Tt(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!Nn(n,t)}var Zr=r=>!r||Me(r,"html")||!hi(r),jn=(r,e)=>{if(!d||Zr(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,i=[r],s=r;s.parentNode&&!Me(s,"body");)if(Mn(s.parentNode))i.push(s.parentNode.host),s=s.parentNode.host;else{var n=Ln(s);if(!n)break;if(e||Kr.indexOf(n.tagName.toLowerCase())>-1)t=!0;else{var o=d.getComputedStyle(n);o&&o.getPropertyValue("cursor")==="pointer"&&(t=!0)}i.push(n),s=n}return{parentIsUsefulElement:t,targetElementList:i}};function Qo(r,e,t,i,s){var n,o,a,l;if(t===void 0&&(t=void 0),!d||Zr(r)||(n=t)!=null&&n.url_allowlist&&!$s(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&$s(t.url_ignorelist))return!1;if((a=t)!=null&&a.dom_event_allowlist){var u=t.dom_event_allowlist;if(u&&!u.some((v=>e.type===v)))return!1}var{parentIsUsefulElement:c,targetElementList:h}=jn(r,i);if(!(function(v,_){var m=_?.element_allowlist;if(f(m))return!0;var P,k=function($){if(m.some((x=>$.tagName.toLowerCase()===x)))return{v:!0}};for(var R of v)if(P=k(R))return P.v;return!1})(h,t)||!Nn(h,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var p=d.getComputedStyle(r);if(p&&p.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var g=r.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return c?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Kr.indexOf(g)>-1||r.getAttribute("contenteditable")==="true")}}function nr(r){for(var e=r;e.parentNode&&!Me(e,"body");e=e.parentNode){var t=Yt(e);if(F(t,"ph-sensitive")||F(t,"ph-no-capture"))return!1}if(F(Yt(r),"ph-include"))return!0;var i=r.type||"";if(U(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var s=r.name||r.id||"";return!(U(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function Hn(r){return!!(Me(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Me(r,"select")||Me(r,"textarea")||r.getAttribute("contenteditable")==="true")}var qn="(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})",ea=new RegExp("^(?:"+qn+")$"),ta=new RegExp(qn),Un="\\d{3}-?\\d{2}-?\\d{4}",ia=new RegExp("^("+Un+")$"),ra=new RegExp("("+Un+")");function It(r,e){return e===void 0&&(e=!0),!(I(r)||U(r)&&(r=ci(r),(e?ea:ta).test((r||"").replace(/[- ]/g,""))||(e?ia:ra).test(r)))}function Bn(r){var e=Tt(r);return It(e=(e+" "+Gn(r)).trim())?e:""}function Gn(r){var e="";return r&&r.childNodes&&r.childNodes.length&&M(r.childNodes,(function(t){var i;if(t&&((i=t.tagName)==null?void 0:i.toLowerCase())==="span")try{var s=Tt(t);e=(e+" "+s).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Gn(t)).trim())}catch(n){b.error("[AutoCapture]",n)}})),e}function sa(r){return(function(e){var t=e.map((i=>{var s,n,o="";if(i.tag_name&&(o+=i.tag_name),i.attr_class)for(var a of(i.attr_class.sort(),i.attr_class))o+="."+a.replace(/"/g,"");var l=w({},i.text?{text:i.text}:{},{"nth-child":(s=i.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(n=i.nth_of_type)!==null&&n!==void 0?n:0},i.href?{href:i.href}:{},i.attr_id?{attr_id:i.attr_id}:{},i.attributes),u={};return jt(l).sort(((c,h)=>{var[p]=c,[g]=h;return p.localeCompare(g)})).forEach((c=>{var[h,p]=c;return u[Ts(h.toString())]=Ts(p.toString())})),o+=":",o+=jt(u).map((c=>{var[h,p]=c;return h+'="'+p+'"'})).join("")}));return t.join(";")})((function(e){return e.map((t=>{var i,s,n={text:(i=t.$el_text)==null?void 0:i.slice(0,400),tag_name:t.tag_name,href:(s=t.attr__href)==null?void 0:s.slice(0,2048),attr_class:na(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return jt(t).filter((o=>{var[a]=o;return a.indexOf("attr__")===0})).forEach((o=>{var[a,l]=o;return n.attributes[a]=l})),n}))})(r))}function Ts(r){return r.replace(/"|\\"/g,'\\"')}function na(r){var e=r.attr__class;return e?T(e)?e:Xr(e):void 0}var Jt=class{constructor(e){this.disabled=e===!1;var t=q(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&i-s.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}},Xt=r=>{var e=y?.createElement("a");return f(e)?null:(e.href=r,e)},oa=function(r,e){var t,i;e===void 0&&(e="&");var s=[];return M(r,(function(n,o){f(n)||f(o)||o==="undefined"||(t=encodeURIComponent((a=>a instanceof File)(n)?n.name:n.toString()),i=encodeURIComponent(o),s[s.length]=i+"="+t)})),s.join(e)},Kt=function(r,e){for(var t,i=((r.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<i.length;s++){var n=i[s].split("=");if(n[0]===e){t=n;break}}if(!T(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{b.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ct=function(r,e,t){if(!r||!e||!e.length)return r;for(var i=r.split("#"),s=i[0]||"",n=i[1],o=s.split("?"),a=o[1],l=o[0],u=(a||"").split("&"),c=[],h=0;h<u.length;h++){var p=u[h].split("=");T(p)&&(e.includes(p[0])?c.push(p[0]+"="+t):c.push(u[h]))}var g=l;return a!=null&&(g+="?"+c.join("&")),n!=null&&(g+="#"+n),g},Zt=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},mi="$copy_autocapture",Cs=N("[AutoCapture]");function yi(r,e){return e.length>r?e.slice(0,r)+"...":e}function aa(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!hi(e));return e}function la(r,e,t,i){var s=r.tagName.toLowerCase(),n={tag_name:s};Kr.indexOf(s)>-1&&!t&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?n.$el_text=yi(1024,Bn(r)):n.$el_text=yi(1024,Tt(r)));var o=Yt(r);o.length>0&&(n.classes=o.filter((function(c){return c!==""}))),M(r.attributes,(function(c){var h;if((!Hn(r)||["name","id","class","aria-label"].indexOf(c.name)!==-1)&&(i==null||!i.includes(c.name))&&!e&&It(c.value)&&(h=c.name,!U(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var p=c.value;c.name==="class"&&(p=Xr(p).join(" ")),n["attr__"+c.name]=yi(1024,p)}}));for(var a=1,l=1,u=r;u=aa(u);)a++,u.tagName===r.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function ca(r,e){for(var t,i,{e:s,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,u=[r],c=r;c.parentNode&&!Me(c,"body");)Mn(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var h,p=[],g={},v=!1,_=!1;if(M(u,($=>{var x=nr($);$.tagName.toLowerCase()==="a"&&(v=$.getAttribute("href"),v=x&&v&&It(v)&&v),F(Yt($),"ph-no-capture")&&(_=!0),p.push(la($,n,o,a));var H=(function(C){if(!nr(C))return{};var S={};return M(C.attributes,(function(K){if(K.name&&K.name.indexOf("data-ph-capture-attribute")===0){var W=K.name.replace("data-ph-capture-attribute-",""),te=K.value;W&&te&&It(te)&&(S[W]=te)}})),S})($);L(g,H)})),_)return{props:{},explicitNoCapture:_};if(o||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?p[0].$el_text=Bn(r):p[0].$el_text=Tt(r)),v){var m,P;p[0].attr__href=v;var k=(m=Xt(v))==null?void 0:m.host,R=d==null||(P=d.location)==null?void 0:P.host;k&&R&&k!==R&&(h=v)}return{props:L({$event_type:s.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:sa(p)},(t=p[0])!=null&&t.$el_text?{$el_text:(i=p[0])==null?void 0:i.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},g)}}var or=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Jt(e.config.rageclick),this.C=null}get R(){var e,t,i=q(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)==null?void 0:e.map((s=>new RegExp(s))),i.url_ignorelist=(t=i.url_ignorelist)==null?void 0:t.map((s=>new RegExp(s))),i}F(){if(this.isBrowserSupported()){if(d&&y){var e=i=>{i=i||d?.event;try{this.O(i)}catch(s){Cs.error("Failed to capture event",s)}};if(j(y,"submit",e,{capture:!0}),j(y,"change",e,{capture:!0}),j(y,"click",e,{capture:!0}),this.R.capture_copied_text){var t=i=>{i=i||d?.event,this.O(i,mi)};j(y,"copy",t,{capture:!0}),j(y,"cut",t,{capture:!0})}}}else Cs.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ws]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,i=[];return(t=this.C)==null||t.forEach((s=>{var n=y?.querySelectorAll(s);n?.forEach((o=>{e===o&&i.push(s)}))})),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)==null?void 0:e.props[ws],s=this.T;if(oe(s)&&!be(i)&&!this.instance.M())return!1;var n=(t=this.T)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!n}O(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i,s=Dn(e);On(s)&&(s=s.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Zo(s,this.instance.config.rageclick)&&this.O(e,"$rageclick");var n=t===mi;if(s&&Qo(s,e,this.R,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=ca(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),t===mi){var u,c=An(d==null||(u=d.getSelection())==null?void 0:u.toString()),h=e.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=h}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return Ce(y?.querySelectorAll)}};Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return we(r)&&isFinite(r)&&Math.floor(r)===r});var Os="0123456789abcdef",ar=class r{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||e<0||t<0||i<0||s<0||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new r(n)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Os.charAt(this.bytes[t]>>>4)+Os.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new r(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}},lr=class{constructor(){this.A=0,this.j=0,this.D=new cr}generate(){var e=this.generateOrAbort();if(f(e)){this.A=0;var t=this.generateOrAbort();if(f(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.j++,this.j>4398046511103&&(this.A++,this.L())}return ar.fromFieldsV7(this.A,Math.trunc(this.j/Math.pow(2,30)),this.j&Math.pow(2,30)-1,this.D.nextUint32())}L(){this.j=1024*this.D.nextUint32()+(1023&this.D.nextUint32())}},Ms,Vn=r=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<r.length;e++)r[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return r};d&&!f(d.crypto)&&crypto.getRandomValues&&(Vn=r=>crypto.getRandomValues(r));var cr=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(Vn(this.N),this.U=0),this.N[this.U++]}},Te=()=>ua().toString(),ua=()=>(Ms||(Ms=new lr)).generate(),ot="",ha=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function da(r,e){if(e){var t=(function(s,n){if(n===void 0&&(n=y),ot)return ot;if(!n||["localhost","127.0.0.1"].includes(s))return"";for(var o=s.split("."),a=Math.min(o.length,8),l="dmn_chk_"+Te();!ot&&a--;){var u=o.slice(a).join("."),c=l+"=1;domain=."+u+";path=/";n.cookie=c+";max-age=3",n.cookie.includes(l)&&(n.cookie=c+";max-age=0",ot=u)}return ot})(r);if(!t){var i=(s=>{var n=s.match(ha);return n?n[0]:""})(r);i!==t&&b.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}var ue={H:()=>!!y,B:function(r){b.error("cookieStore error: "+r)},q:function(r){if(y){try{for(var e=r+"=",t=y.cookie.split(";").filter((n=>n.length)),i=0;i<t.length;i++){for(var s=t[i];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},W:function(r){var e;try{e=JSON.parse(ue.q(r))||{}}catch{}return e},G:function(r,e,t,i,s){if(y)try{var n="",o="",a=da(y.location.hostname,i);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=r+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&b.warn("cookieStore warning: large cookie, len="+u.length),y.cookie=u,u}catch{return}},V:function(r,e){if(y!=null&&y.cookie)try{ue.G(r,"",-1,e)}catch{return}}},bi=null,D={H:function(){if(!oe(bi))return bi;var r=!0;if(f(d))r=!1;else try{var e="__mplssupport__";D.G(e,"xyz"),D.q(e)!=='"xyz"'&&(r=!1),D.V(e)}catch{r=!1}return r||b.error("localStorage unsupported; falling back to cookie store"),bi=r,r},B:function(r){b.error("localStorage error: "+r)},q:function(r){try{return d?.localStorage.getItem(r)}catch(e){D.B(e)}return null},W:function(r){try{return JSON.parse(D.q(r))||{}}catch{}return null},G:function(r,e){try{d?.localStorage.setItem(r,JSON.stringify(e))}catch(t){D.B(t)}},V:function(r){try{d?.localStorage.removeItem(r)}catch(e){D.B(e)}}},pa=["$device_id","distinct_id",Gt,Tn,zt,Wt],At={},ga={H:function(){return!0},B:function(r){b.error("memoryStorage error: "+r)},q:function(r){return At[r]||null},W:function(r){return At[r]||null},G:function(r,e){At[r]=e},V:function(r){delete At[r]}},De=null,B={H:function(){if(!oe(De))return De;if(De=!0,f(d))De=!1;else try{var r="__support__";B.G(r,"xyz"),B.q(r)!=='"xyz"'&&(De=!1),B.V(r)}catch{De=!1}return De},B:function(r){b.error("sessionStorage error: ",r)},q:function(r){try{return d?.sessionStorage.getItem(r)}catch(e){B.B(e)}return null},W:function(r){try{return JSON.parse(B.q(r))||null}catch{}return null},G:function(r,e){try{d?.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){B.B(t)}},V:function(r){try{d?.sessionStorage.removeItem(r)}catch(e){B.B(e)}}},fe=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({}),ur=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?fe.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===fe.DENIED||this.consent===fe.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===fe.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return gi(e)?fe.GRANTED:F(Eo,e)?fe.DENIED:fe.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?D:ue;var t=e==="localStorage"?ue:D;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(gi(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!$n([ee?.doNotTrack,ee?.msDoNotTrack,E.doNotTrack],(e=>gi(e)))}},Dt=N("[Dead Clicks]"),va=()=>!0,_a=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(Rn)),i=r.instance.config.capture_dead_clicks;return be(i)?i:!!q(i)||t},Qt=class{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Rn]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,i;(t=E.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?Dt.error("failed to load script",s):e()}))}et(){var e;if(y){if(!this.tt&&(e=E.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=q(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=E.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(y),Dt.info("starting...")}}else Dt.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Dt.info("stopping..."))}},at=N("[ExceptionAutocapture]"),hr=class{constructor(e){var t,i,s;this.rt=()=>{var n;if(d&&this.isEnabled&&(n=E.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var o=E.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=E.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=E.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=o(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=a(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=l(this.captureException.bind(this)))}catch(u){at.error("failed to start",u),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[Es]),this.dt=new Di({refillRate:(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,h:at}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return q(e)?t=w({},t,e):(f(e)?this.ht:e)&&(t=w({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(at.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,i;(t=E.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return at.error("failed to load script",s);e()}))}ut(){var e,t,i;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(i=this.ot)==null||i.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ht=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[Es]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(e){var t,i,s=(t=e==null||(i=e.$exception_list)==null||(i=i[0])==null?void 0:i.type)!==null&&t!==void 0?t:"Exception";this.dt.consumeRateLimit(s)?at.info("Skipping exception capture because of client rate limiting.",{exception:s}):this._instance.exceptions.sendExceptionEvent(e)}};function As(r,e,t){try{if(!(e in r))return()=>{};var i=r[e],s=t(i);return Ce(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=s,()=>{r[e]=i}}catch{return()=>{}}}var dr=class{constructor(e){var t;this._instance=e,this.ct=(d==null||(t=d.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(b.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,b.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(d&&d.history){var i=this;(e=d.history.pushState)!=null&&e.__posthog_wrapped__||As(d.history,"pushState",(s=>function(n,o,a){s.call(this,n,o,a),i._t("pushState")})),(t=d.history.replaceState)!=null&&t.__posthog_wrapped__||As(d.history,"replaceState",(s=>function(n,o,a){s.call(this,n,o,a),i._t("replaceState")})),this.bt()}}_t(e){try{var t,i=d==null||(t=d.location)==null?void 0:t.pathname;if(!i)return;i!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ct=i}catch(s){b.error("Error capturing "+e+" pageview",s)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};j(d,"popstate",e),this.ft=()=>{d&&d.removeEventListener("popstate",e)}}}},wi=N("[SegmentIntegration]");function fa(r,e){var t=r.config.segment;if(!t)return e();(function(i,s){var n=i.config.segment;if(!n)return s();var o=l=>{var u=()=>l.anonymousId()||Te();i.config.get_device_id=u,l.id()&&(i.register({distinct_id:l.id(),$device_id:u()}),i.persistence.set_property(_e,"identified")),s()},a=n.user();"then"in a&&Ce(a.then)?a.then(o):o(a)})(r,(()=>{t.register((i=>{Promise&&Promise.resolve||wi.warn("This browser does not have Promise support, and can not use the segment integration");var s=(n,o)=>{if(!o)return n;n.event.userId||n.event.anonymousId===i.get_distinct_id()||(wi.info("No userId set, resetting PostHog"),i.reset()),n.event.userId&&n.event.userId!==i.get_distinct_id()&&(wi.info("UserId set, identifying with PostHog"),i.identify(n.event.userId));var a=i.calculateEventProperties(o,n.event.properties);return n.event.properties=Object.assign({},a,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:n=>s(n,n.event.event),page:n=>s(n,"$pageview"),identify:n=>s(n,"$identify"),screen:n=>s(n,"$screen")}})(r)).then((()=>{e()}))}))}var Wn="posthog-js";function zn(r,e){var{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,u,c,h,p;if(!(n==="*"||n.includes(a.level))||!r.__loaded)return a;a.tags||(a.tags={});var g=r.requestRouter.endpointFor("ui","/project/"+r.config.token+"/person/"+r.get_distinct_id());a.tags["PostHog Person URL"]=g,r.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=r.get_session_replay_url({withTimestamp:!0}));var v=((l=a.exception)==null?void 0:l.values)||[],_=v.map((P=>w({},P,{stacktrace:P.stacktrace?w({},P.stacktrace,{type:"raw",frames:(P.stacktrace.frames||[]).map((k=>w({},k,{platform:"web:javascript"})))}):void 0}))),m={$exception_message:((u=v[0])==null?void 0:u.value)||a.message,$exception_type:(c=v[0])==null?void 0:c.type,$exception_level:a.level,$exception_list:_,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((h=v[0])==null?void 0:h.value)||a.message,$sentry_exception_type:(p=v[0])==null?void 0:p.type,$sentry_tags:a.tags};return t&&i&&(m.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+a.event_id),o&&r.exceptions.sendExceptionEvent(m),a}}var pr=class{constructor(e,t,i,s,n,o){this.name=Wn,this.setupOnce=function(a){a(zn(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:o==null||o}))}}},ma=d!=null&&d.location?Zt(d.location.hash,"__posthog")||Zt(location.hash,"state"):null,Ds="_postHogToolbarParams",Ns=N("[Toolbar]"),Re=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(Re||{}),gr=class{constructor(e){this.instance=e}yt(e){E.ph_toolbar_state=e}wt(){var e;return(e=E.ph_toolbar_state)!==null&&e!==void 0?e:Re.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.instance.config.name&&this.instance.config.name==="ph_toolbar_internal"||!d||!y)return!1;e=e??d.location,i=i??d.history;try{if(!t){try{d.localStorage.setItem("test","test"),d.localStorage.removeItem("test")}catch{return!1}t=d?.localStorage}var s,n=ma||Zt(e.hash,"__posthog")||Zt(e.hash,"state"),o=n?bs((()=>JSON.parse(atob(decodeURIComponent(n)))))||bs((()=>JSON.parse(decodeURIComponent(n)))):null;return o&&o.action==="ph_authorize"?((s=o).source="url",s&&Object.keys(s).length>0&&(o.desiredHash?e.hash=o.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(Ds)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}xt(e){var t=E.ph_load_toolbar||E.ph_load_editor;!I(t)&&Ce(t)?t(e,this.instance):Ns.warn("No toolbar load function found")}loadToolbar(e){var t=!(y==null||!y.getElementById(Cn));if(!d||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=w({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(d.localStorage.setItem(Ds,JSON.stringify(w({},s,{source:void 0}))),this.wt()===Re.LOADED)this.xt(s);else if(this.wt()===Re.UNINITIALIZED){var n;this.yt(Re.LOADING),(n=E.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return Ns.error("[Toolbar] Failed to load",o),void this.yt(Re.UNINITIALIZED);this.yt(Re.LOADED),this.xt(s)})),j(d,"turbolinks:load",(()=>{this.yt(Re.UNINITIALIZED),this.loadToolbar(s)}))}return!0}Et(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.maybeLoadToolbar(e,t,i)}},ya=N("[TracingHeaders]"),vr=class{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,i;f(this.$t)&&((t=E.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),f(this.St)&&((i=E.__PosthogExtensions__)==null||(i=i.tracingHeadersPatchFns)==null||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,i;(t=E.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return ya.error("failed to load script",s);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.$t)==null||e.call(this),(t=this.St)==null||t.call(this),this.$t=void 0,this.St=void 0)}},Nt="https?://(.*)",st=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ba=rt(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],st),Ot="<masked>",wa=["li_fat_id"];function Yn(r,e,t){if(!y)return{};var i,s=e?rt([],st,t||[]):[],n=Jn(Ct(y.URL,s,Ot),r),o=(i={},M(wa,(function(a){var l=ue.q(a);i[a]=l||null})),i);return L(o,n)}function Jn(r,e){var t=ba.concat(e||[]),i={};return M(t,(function(s){var n=Kt(r,s);i[s]=n||null})),i}function Xn(r){var e=(function(n){return n?n.search(Nt+"google.([^/?]*)")===0?"google":n.search(Nt+"bing.com")===0?"bing":n.search(Nt+"yahoo.com")===0?"yahoo":n.search(Nt+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",i={};if(!oe(e)){i.$search_engine=e;var s=y?Kt(y.referrer,t):"";s.length&&(i.ph_keyword=s)}return i}function Ls(){return navigator.language||navigator.userLanguage}function Kn(){return y?.referrer||"$direct"}function Zn(r,e){var t=r?rt([],st,e||[]):[],i=G?.href.substring(0,1e3);return{r:Kn().substring(0,1e3),u:i?Ct(i,t,Ot):void 0}}function Qn(r){var e,{r:t,u:i}=r,s={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Xt(t))==null?void 0:e.host};if(i){s.$current_url=i;var n=Xt(i);s.$host=n?.host,s.$pathname=n?.pathname;var o=Jn(i);L(s,o)}if(t){var a=Xn(t);L(s,a)}return s}function eo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Ea(){try{return new Date().getTimezoneOffset()}catch{return}}function xa(r,e){if(!X)return{};var t,i,s,n=r?rt([],st,e||[]):[],[o,a]=(function(l){for(var u=0;u<vs.length;u++){var[c,h]=vs[u],p=c.exec(l),g=p&&(Ce(h)?h(p,l):h);if(g)return g}return["",""]})(X);return L(Jr({$os:o,$os_version:a,$browser:kn(X,navigator.vendor),$device:_s(X),$device_type:(i=X,s=_s(i),s===un||s===cn||s==="Kobo"||s==="Kindle Fire"||s===xn?Pt:s===Ft||s===Qe||s===$t||s===Li?"Console":s===dn?"Wearable":s?se:"Desktop"),$timezone:eo(),$timezone_offset:Ea()}),{$current_url:Ct(G?.href,n,Ot),$host:G?.host,$pathname:G?.pathname,$raw_user_agent:X.length>1e3?X.substring(0,997)+"...":X,$browser_version:Co(X,navigator.vendor),$browser_language:Ls(),$browser_language_prefix:(t=Ls(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:d?.screen.height,$screen_width:d?.screen.width,$viewport_height:d?.innerHeight,$viewport_width:d?.innerWidth,$lib:"web",$lib_version:ve.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Fe=N("[Web Vitals]"),js=9e5,_r=class{constructor(e){var t;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),this.N.metrics.length!==0&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((i,s)=>w({},i,{["$web_vitals_"+s.name+"_event"]:w({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=i=>{var s,n=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0);if(f(n))Fe.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Ct();f(o)||(I(i?.name)||I(i?.value)?Fe.error("Invalid metric received",i):this.Rt&&i.value>=this.Rt?Fe.error("Ignoring metric with value >= "+this.Rt,i):(this.N.url!==o&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),f(this.N.url)&&(this.N.url=o),this.N.firstMetricTimestamp=f(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0),this.N.metrics.push(w({},i,{$current_url:o,$session_id:n.sessionId,$window_id:n.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{if(!this.P){var i,s,n,o,a=E.__PosthogExtensions__;f(a)||f(a.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:s,onFCP:n,onINP:o}=a.postHogWebVitalsCallbacks),i&&s&&n&&o?(this.allowedMetrics.indexOf("LCP")>-1&&i(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.It.bind(this)),this.P=!0):Fe.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[ks]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=q(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return I(i)?((t=this._instance.persistence)==null?void 0:t.props[Ss])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(q(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=q(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=q(this._instance.config.capture_performance)&&we(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:js;return 0<e&&e<=6e4?js:e}get isEnabled(){var e=G?.protocol;if(e!=="http:"&&e!=="https:")return Fe.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=q(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:be(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return be(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Fe.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=q(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=q(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[ks]:t}),this._instance.persistence.register({[Ss]:i})),this.kt=t,this.startIfEnabled()}it(e){var t,i;if((t=E.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var s=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,s,(n=>{n?Fe.error("failed to load script",n):e()}))}}Ct(){var e=d?d.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,s=t?rt([],st,i||[]):[];return Ct(e,s,Ot)}Fe.error("Could not determine current URL")}},ka=N("[Heatmaps]");function Hs(r){return q(r)&&"clientX"in r&&"clientY"in r&&we(r.clientX)&&we(r.clientY)}var fr=class{constructor(e){var t;this.kt=!1,this.P=!1,this.Ft=null,this.instance=e,this.kt=!((t=this.instance.persistence)==null||!t.props[Xi]),this.rageclicks=new Jt(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return q(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return I(this.instance.config.capture_heatmaps)?I(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;ka.info("starting..."),this.Ot(),this.Mt()}else{var e;clearInterval((e=this.Ft)!==null&&e!==void 0?e:void 0),this.At(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Xi]:t}),this.kt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}jt(e){this.Dt(e.originalEvent,"deadclick")}Mt(){this.Ft&&clearInterval(this.Ft),this.Ft=(function(e){return e?.visibilityState==="visible"})(y)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){d&&y&&(this.Nt=this.Lt.bind(this),j(d,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||d?.event),j(y,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||d?.event),j(y,"mousemove",this.zt,{capture:!0}),this.Bt=new Qt(this.instance,va,this.jt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Mt.bind(this),j(y,"visibilitychange",this.qt),this.P=!0)}At(){var e;d&&y&&(this.Nt&&d.removeEventListener("beforeunload",this.Nt),this.Ut&&y.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&y.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&y.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),(e=this.Bt)==null||e.stop(),this.P=!1)}Gt(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=(function(a,l,u){for(var c=a;c&&hi(c)&&!Me(c,"body");){if(c===u)return!1;if(F(l,d?.getComputedStyle(c).position))return!0;c=Ln(c)}return!1})(Dn(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:i),target_fixed:o,type:t}}Dt(e,t){var i;if(t===void 0&&(t="click"),!Fs(e.target)&&Hs(e)){var s=this.Gt(e,t);(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(w({},s,{type:"rageclick"})),this.Vt(s)}}Ht(e){!Fs(e.target)&&Hs(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout((()=>{this.Vt(this.Gt(e,"mousemove"))}),500))}Vt(e){if(d){var t=d.location.href,i=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=i?rt([],st,s||[]):[],o=Ct(t,n,Ot);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!Xe(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},ei=class{constructor(e){this.Jt=(t,i,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength)&&(b.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.Kt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Yt()}Yt(){var e;this.Xt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Jt)}destroy(){var e;(e=this.Xt)==null||e.call(this),this.Xt=void 0}doPageView(e,t){var i,s=this.Qt(e,t);return this.Kt={pathname:(i=d?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Qt(e,(t=this.Kt)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Kt)==null?void 0:e.pageViewId}}Qt(e,t){var i=this.Kt;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:u,lastContentY:c,maxContentY:h}=n;if(!(f(o)||f(a)||f(l)||f(u)||f(c)||f(h))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),h=Math.ceil(h);var p=o<=1?1:he(a/o,0,1,b),g=o<=1?1:he(l/o,0,1,b),v=u<=1?1:he(c/u,0,1,b),_=u<=1?1:he(h/u,0,1,b);s=L(s,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:g,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}};var me=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),ne=Uint8Array,J=Uint16Array,it=Uint32Array,Qr=new ne([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]),es=new ne([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]),qs=new ne([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),to=function(r,e){for(var t=new J(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];var s=new it(t[30]);for(i=1;i<30;++i)for(var n=t[i];n<t[i+1];++n)s[n]=n-t[i]<<5|i;return[t,s]},io=to(Qr,2),Pa=io[0],mr=io[1];Pa[28]=258,mr[258]=28;for(yr=to(es,0)[1],ti=new J(32768),A=0;A<32768;++A)$e=(43690&A)>>>1|(21845&A)<<1,$e=(61680&($e=(52428&$e)>>>2|(13107&$e)<<2))>>>4|(3855&$e)<<4,ti[A]=((65280&$e)>>>8|(255&$e)<<8)>>>1;var $e,yr,ti,A,Et=function(r,e,t){for(var i=r.length,s=0,n=new J(e);s<i;++s)++n[r[s]-1];var o,a=new J(e);for(s=0;s<e;++s)a[s]=a[s-1]+n[s-1]<<1;if(t){o=new J(1<<e);var l=15-e;for(s=0;s<i;++s)if(r[s])for(var u=s<<4|r[s],c=e-r[s],h=a[r[s]-1]++<<c,p=h|(1<<c)-1;h<=p;++h)o[ti[h]>>>l]=u}else for(o=new J(i),s=0;s<i;++s)o[s]=ti[a[r[s]-1]++]>>>15-r[s];return o},He=new ne(288);for(A=0;A<144;++A)He[A]=8;for(A=144;A<256;++A)He[A]=9;for(A=256;A<280;++A)He[A]=7;for(A=280;A<288;++A)He[A]=8;var ii=new ne(32);for(A=0;A<32;++A)ii[A]=5;var Sa=Et(He,9,0),Fa=Et(ii,5,0),ro=function(r){return(r/8>>0)+(7&r&&1)},so=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof J?J:r instanceof it?it:ne)(t-e);return i.set(r.subarray(e,t)),i},pe=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8},lt=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8,r[i+2]|=t>>>16},Ei=function(r,e){for(var t=[],i=0;i<r.length;++i)r[i]&&t.push({s:i,f:r[i]});var s=t.length,n=t.slice();if(!s)return[new ne(0),0];if(s==1){var o=new ne(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(x,H){return x.f-H.f})),t.push({s:-1,f:25001});var a=t[0],l=t[1],u=0,c=1,h=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=s-1;)a=t[t[u].f<t[h].f?u++:h++],l=t[u!=c&&t[u].f<t[h].f?u++:h++],t[c++]={s:-1,f:a.f+l.f,l:a,r:l};var p=n[0].s;for(i=1;i<s;++i)n[i].s>p&&(p=n[i].s);var g=new J(p+1),v=br(t[c-1],g,0);if(v>e){i=0;var _=0,m=v-e,P=1<<m;for(n.sort((function(x,H){return g[H.s]-g[x.s]||x.f-H.f}));i<s;++i){var k=n[i].s;if(!(g[k]>e))break;_+=P-(1<<v-g[k]),g[k]=e}for(_>>>=m;_>0;){var R=n[i].s;g[R]<e?_-=1<<e-g[R]++-1:++i}for(;i>=0&&_;--i){var $=n[i].s;g[$]==e&&(--g[$],++_)}v=e}return[new ne(g),v]},br=function(r,e,t){return r.s==-1?Math.max(br(r.l,e,t+1),br(r.r,e,t+1)):e[r.s]=t},Us=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new J(++e),i=0,s=r[0],n=1,o=function(l){t[i++]=l},a=1;a<=e;++a)if(r[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=r[a]}return[t.subarray(0,i),e]},ct=function(r,e){for(var t=0,i=0;i<e.length;++i)t+=r[i]*e[i];return t},wr=function(r,e,t){var i=t.length,s=ro(e+2);r[s]=255&i,r[s+1]=i>>>8,r[s+2]=255^r[s],r[s+3]=255^r[s+1];for(var n=0;n<i;++n)r[s+n+4]=t[n];return 8*(s+4+i)},Bs=function(r,e,t,i,s,n,o,a,l,u,c){pe(e,c++,t),++s[256];for(var h=Ei(s,15),p=h[0],g=h[1],v=Ei(n,15),_=v[0],m=v[1],P=Us(p),k=P[0],R=P[1],$=Us(_),x=$[0],H=$[1],C=new J(19),S=0;S<k.length;++S)C[31&k[S]]++;for(S=0;S<x.length;++S)C[31&x[S]]++;for(var K=Ei(C,7),W=K[0],te=K[1],ie=19;ie>4&&!W[qs[ie-1]];--ie);var de,ae,le,Ue,xe=u+5<<3,Ae=ct(s,He)+ct(n,ii)+o,ce=ct(s,p)+ct(n,_)+o+14+3*ie+ct(C,W)+(2*C[16]+3*C[17]+7*C[18]);if(xe<=Ae&&xe<=ce)return wr(e,c,r.subarray(l,l+u));if(pe(e,c,1+(ce<Ae)),c+=2,ce<Ae){de=Et(p,g,0),ae=p,le=Et(_,m,0),Ue=_;var ke=Et(W,te,0);for(pe(e,c,R-257),pe(e,c+5,H-1),pe(e,c+10,ie-4),c+=14,S=0;S<ie;++S)pe(e,c+3*S,W[qs[S]]);c+=3*ie;for(var Be=[k,x],z=0;z<2;++z){var re=Be[z];for(S=0;S<re.length;++S){var Z=31&re[S];pe(e,c,ke[Z]),c+=W[Z],Z>15&&(pe(e,c,re[S]>>>5&127),c+=re[S]>>>12)}}}else de=Sa,ae=He,le=Fa,Ue=ii;for(S=0;S<a;++S)if(i[S]>255){Z=i[S]>>>18&31,lt(e,c,de[Z+257]),c+=ae[Z+257],Z>7&&(pe(e,c,i[S]>>>23&31),c+=Qr[Z]);var Ge=31&i[S];lt(e,c,le[Ge]),c+=Ue[Ge],Ge>3&&(lt(e,c,i[S]>>>5&8191),c+=es[Ge])}else lt(e,c,de[i[S]]),c+=ae[i[S]];return lt(e,c,de[256]),c+ae[256]},$a=new it([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ia=(function(){for(var r=new it(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),Ra=function(r,e,t,i,s){return(function(n,o,a,l,u,c){var h=n.length,p=new ne(l+h+5*(1+Math.floor(h/7e3))+u),g=p.subarray(l,p.length-u),v=0;if(!o||h<8)for(var _=0;_<=h;_+=65535){var m=_+65535;m<h?v=wr(g,v,n.subarray(_,m)):(g[_]=c,v=wr(g,v,n.subarray(_,h)))}else{for(var P=$a[o-1],k=P>>>13,R=8191&P,$=(1<<a)-1,x=new J(32768),H=new J($+1),C=Math.ceil(a/3),S=2*C,K=function(pi){return(n[pi]^n[pi+1]<<C^n[pi+2]<<S)&$},W=new it(25e3),te=new J(288),ie=new J(32),de=0,ae=0,le=(_=0,0),Ue=0,xe=0;_<h;++_){var Ae=K(_),ce=32767&_,ke=H[Ae];if(x[ce]=ke,H[Ae]=ce,Ue<=_){var Be=h-_;if((de>7e3||le>24576)&&Be>423){v=Bs(n,g,0,W,te,ie,ae,le,xe,_-xe,v),le=de=ae=0,xe=_;for(var z=0;z<286;++z)te[z]=0;for(z=0;z<30;++z)ie[z]=0}var re=2,Z=0,Ge=R,Pe=ce-ke&32767;if(Be>2&&Ae==K(_-Pe))for(var ho=Math.min(k,Be)-1,po=Math.min(32767,_),go=Math.min(258,Be);Pe<=po&&--Ge&&ce!=ke;){if(n[_+re]==n[_+re-Pe]){for(var Se=0;Se<go&&n[_+Se]==n[_+Se-Pe];++Se);if(Se>re){if(re=Se,Z=Pe,Se>ho)break;var vo=Math.min(Pe,Se-2),ts=0;for(z=0;z<vo;++z){var di=_-Pe+z+32768&32767,is=di-x[di]+32768&32767;is>ts&&(ts=is,ke=di)}}}Pe+=(ce=ke)-(ke=x[ce])+32768&32767}if(Z){W[le++]=268435456|mr[re]<<18|yr[Z];var rs=31&mr[re],ss=31&yr[Z];ae+=Qr[rs]+es[ss],++te[257+rs],++ie[ss],Ue=_+re,++de}else W[le++]=n[_],++te[n[_]]}}v=Bs(n,g,c,W,te,ie,ae,le,xe,_-xe,v)}return so(p,0,l+ro(v)+u)})(r,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+e.mem,t,i,!0)},xi=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function Ta(r,e){e===void 0&&(e={});var t=(function(){var a=4294967295;return{p:function(l){for(var u=a,c=0;c<l.length;++c)u=Ia[255&u^l[c]]^u>>>8;a=u},d:function(){return 4294967295^a}}})(),i=r.length;t.p(r);var s,n=Ra(r,e,10+((s=e).filename&&s.filename.length+1||0),8),o=n.length;return(function(a,l){var u=l.filename;if(a[0]=31,a[1]=139,a[2]=8,a[8]=l.level<2?4:l.level==9?2:0,a[9]=3,l.mtime!=0&&xi(a,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),u){a[3]=8;for(var c=0;c<=u.length;++c)a[c+10]=u.charCodeAt(c)}})(n,e),xi(n,o-8,t.d()),xi(n,o-4,i),n}var Ca=function(r){var e,t,i,s,n="";for(e=t=0,i=(r=(r+"").replace(/\r\n/g,`
2
+ import{e as ns,f as os,g as as}from"./chunk-HQX3Z7PF.mjs";var d=typeof window<"u"?window:void 0,V=typeof globalThis<"u"?globalThis:d;typeof self>"u"&&(V.self=V),typeof File>"u"&&(V.File=function(){});var sn=Array.prototype,ls=sn.forEach,cs=sn.indexOf,ee=V?.navigator,y=V?.document,G=V?.location,Ti=V?.fetch,Ci=V!=null&&V.XMLHttpRequest&&"withCredentials"in new V.XMLHttpRequest?V.XMLHttpRequest:void 0,us=V?.AbortController,X=ee?.userAgent,E=d??{},ve={DEBUG:!1,LIB_VERSION:"1.345.2"};function hs(r,e,t,i,s,n,o){try{var a=r[n](o),l=a.value}catch(u){return void t(u)}a.done?e(l):Promise.resolve(l).then(i,s)}function Je(r){return function(){var e=this,t=arguments;return new Promise((function(i,s){var n=r.apply(e,t);function o(l){hs(n,i,s,o,a,"next",l)}function a(l){hs(n,i,s,o,a,"throw",l)}o(void 0)}))}}function w(){return w=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},w.apply(null,arguments)}function nn(r,e){if(r==null)return{};var t={};for(var i in r)if({}.hasOwnProperty.call(r,i)){if(e.indexOf(i)!==-1)continue;t[i]=r[i]}return t}var _o=["$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"],fo=["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"],ds=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return fo.concat(e).some((i=>{var s=i.toLowerCase();return t.indexOf(s)!==-1}))};function F(r,e){return r.indexOf(e)!==-1}var ci=function(r){return r.trim()},Oi=function(r){return r.replace(/^\$/,"")},mo=Array.isArray,on=Object.prototype,an=on.hasOwnProperty,ui=on.toString,T=mo||function(r){return ui.call(r)==="[object Array]"},Te=r=>typeof r=="function",q=r=>r===Object(r)&&!T(r),Xe=r=>{if(q(r)){for(var e in r)if(an.call(r,e))return!1;return!0}return!1},f=r=>r===void 0,U=r=>ui.call(r)=="[object String]",Mi=r=>U(r)&&r.trim().length===0,oe=r=>r===null,I=r=>f(r)||oe(r),we=r=>ui.call(r)=="[object Number]"&&r==r,ze=r=>we(r)&&r>0,be=r=>ui.call(r)==="[object Boolean]",yo=r=>r instanceof FormData,bo=r=>F(_o,r);function Ai(r){return r===null||typeof r!="object"}function qt(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function ln(r){return!f(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(r,Event)}var wo=[!0,"true",1,"1","yes"],gi=r=>F(wo,r),Eo=[!1,"false",0,"0","no"];function he(r,e,t,i,s){return e>t&&(i.warn("min cannot be greater than max."),e=t),we(r)?r>t?(i.warn(" cannot be greater than max: "+t+". Using max value instead."),t):r<e?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):r:(i.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+s),he(s||t,e,t,i))}var Di=class{constructor(e){this.t={},this.i=e.i,this.o=he(e.bucketSize,0,100,e.h),this.m=he(e.refillRate,0,this.o,e.h),this.$=he(e.refillInterval,0,864e5,e.h)}S(e,t){var i=t-e.lastAccess,s=Math.floor(i/this.$);if(s>0){var n=s*this.m;e.tokens=Math.min(e.tokens+n,this.o),e.lastAccess=e.lastAccess+s*this.$}}consumeRateLimit(e){var t,i=Date.now(),s=String(e),n=this.t[s];return n?this.S(n,i):(n={tokens:this.o,lastAccess:i},this.t[s]=n),n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.i)==null||t.call(this,e)),n.tokens===0)}stop(){this.t={}}},se="Mobile",Ut="iOS",ye="Android",Pt="Tablet",cn=ye+" "+Pt,un="iPad",hn="Apple",dn=hn+" Watch",St="Safari",et="BlackBerry",pn="Samsung",gn=pn+"Browser",vn=pn+" Internet",Le="Chrome",xo=Le+" OS",_n=Le+" "+Ut,Vr="Internet Explorer",fn=Vr+" "+se,Wr="Opera",ko=Wr+" Mini",zr="Edge",mn="Microsoft "+zr,Ze="Firefox",yn=Ze+" "+Ut,Ft="Nintendo",$t="PlayStation",Qe="Xbox",bn=ye+" "+se,wn=se+" "+St,gt="Windows",Ni=gt+" Phone",ps="Nokia",Li="Ouya",En="Generic",Po=En+" "+se.toLowerCase(),xn=En+" "+Pt.toLowerCase(),ji="Konqueror",Y="(\\d+(\\.\\d+)?)",vi=new RegExp("Version/"+Y),So=new RegExp(Qe,"i"),Fo=new RegExp($t+" \\w+","i"),$o=new RegExp(Ft+" \\w+","i"),Yr=new RegExp(et+"|PlayBook|BB10","i"),Io={"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"},Mt,gs,_i,Ro=(r,e)=>e&&F(e,hn)||(function(t){return F(t,St)&&!F(t,Le)&&!F(t,ye)})(r),kn=function(r,e){return e=e||"",F(r," OPR/")&&F(r,"Mini")?ko:F(r," OPR/")?Wr:Yr.test(r)?et:F(r,"IE"+se)||F(r,"WPDesktop")?fn:F(r,gn)?vn:F(r,zr)||F(r,"Edg/")?mn:F(r,"FBIOS")?"Facebook "+se:F(r,"UCWEB")||F(r,"UCBrowser")?"UC Browser":F(r,"CriOS")?_n:F(r,"CrMo")||F(r,Le)?Le:F(r,ye)&&F(r,St)?bn:F(r,"FxiOS")?yn:F(r.toLowerCase(),ji.toLowerCase())?ji:Ro(r,e)?F(r,se)?wn:St:F(r,Ze)?Ze:F(r,"MSIE")||F(r,"Trident/")?Vr:F(r,"Gecko")?Ze:""},To={[fn]:[new RegExp("rv:"+Y)],[mn]:[new RegExp(zr+"?\\/"+Y)],[Le]:[new RegExp("("+Le+"|CrMo)\\/"+Y)],[_n]:[new RegExp("CriOS\\/"+Y)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Y)],[St]:[vi],[wn]:[vi],[Wr]:[new RegExp("(Opera|OPR)\\/"+Y)],[Ze]:[new RegExp(Ze+"\\/"+Y)],[yn]:[new RegExp("FxiOS\\/"+Y)],[ji]:[new RegExp("Konqueror[:/]?"+Y,"i")],[et]:[new RegExp(et+" "+Y),vi],[bn]:[new RegExp("android\\s"+Y,"i")],[vn]:[new RegExp(gn+"\\/"+Y)],[Vr]:[new RegExp("(rv:|MSIE )"+Y)],Mozilla:[new RegExp("rv:"+Y)]},Co=function(r,e){var t=kn(r,e),i=To[t];if(f(i))return null;for(var s=0;s<i.length;s++){var n=i[s],o=r.match(n);if(o)return parseFloat(o[o.length-2])}return null},vs=[[new RegExp(Qe+"; "+Qe+" (.*?)[);]","i"),r=>[Qe,r&&r[1]||""]],[new RegExp(Ft,"i"),[Ft,""]],[new RegExp($t,"i"),[$t,""]],[Yr,[et,""]],[new RegExp(gt,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Ni,""];if(new RegExp(se).test(e)&&!/IEMobile\b/.test(e))return[gt+" "+se,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=t[1],s=Io[i]||"";return/arm/i.test(e)&&(s="RT"),[gt,s]}return[gt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[Ut,e.join(".")]}return[Ut,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,r=>{var e="";return r&&r.length>=3&&(e=f(r[2])?r[3]:r[2]),["watchOS",e]}],[new RegExp("("+ye+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ye+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[ye,e.join(".")]}return[ye,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,r=>{var e=["Mac OS X",""];if(r&&r[1]){var t=[r[1],r[2],r[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[xo,""]],[/Linux|debian/i,["Linux",""]]],_s=function(r){return $o.test(r)?Ft:Fo.test(r)?$t:So.test(r)?Qe:new RegExp(Li,"i").test(r)?Li:new RegExp("("+Ni+"|WPDesktop)","i").test(r)?Ni:/iPad/.test(r)?un:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?dn:Yr.test(r)?et:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(ps,"i").test(r)?ps:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(r)||/(kf[a-z]+)( bui|\)).+silk\//i.test(r)?"Kindle Fire":/(Android|ZTE)/i.test(r)?new RegExp(se).test(r)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(r)||/pixel[\daxl ]{1,6}/i.test(r)&&!/pixel c/i.test(r)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(r)||/lmy47v/i.test(r)&&!/QTAQZ3/i.test(r)?ye:cn:new RegExp("(pda|"+se+")","i").test(r)?Po:new RegExp(Pt,"i").test(r)&&!new RegExp(Pt+" pc","i").test(r)?xn:""},Oo=r=>r instanceof Error;function Mo(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return _i&&t.length===gs||(gs=t.length,_i=t.reduce(((i,s)=>{Mt||(Mt={});var n=Mt[s];if(n)i[n[0]]=n[1];else for(var o=r(s),a=o.length-1;a>=0;a--){var l=o[a],u=l?.filename,c=e[s];if(u&&c){i[u]=c,Mt[s]=[u,c];break}}return i}),{})),_i}}var Hi=class{constructor(e,t,i){i===void 0&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){t===void 0&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(t),o=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(o,i),$exception_level:"error"}}modifyFrames(e){var t=this;return Je((function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&T(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),w({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map((i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i)))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Je((function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i}))()}convertToExceptionList(e,t){var i,s,n,o={type:e.type,value:e.value,mechanism:{type:(i=t.type)!==null&&i!==void 0?i:"generic",handled:(s=t.handled)===null||s===void 0||s,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,w({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:Mo(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,i){i===void 0&&(i=0);var s=(n,o)=>{if(o<=4){var a=this.buildCoercingContext(e,t,o);return this.applyCoercers(n,a)}};return w({},t,{syntheticException:i==0?t.syntheticException:void 0,mechanism:e,apply:n=>s(n,i),next:n=>s(n,i+1)})}},tt="?";function qi(r,e,t,i,s){var n={platform:r,filename:e,function:t==="<anonymous>"?tt:t,in_app:!0};return f(i)||(n.lineno=i),f(s)||(n.colno=s),n}var Pn=(r,e)=>{var t=r.indexOf("safari-extension")!==-1,i=r.indexOf("safari-web-extension")!==-1;return t||i?[r.indexOf("@")!==-1?r.split("@")[0]:tt,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},Ao=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Do=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,No=/\((\S*)(?::(\d+))(?::(\d+))\)/,Lo=(r,e)=>{var t=Ao.exec(r);if(t){var[,i,s,n]=t;return qi(e,i,tt,+s,+n)}var o=Do.exec(r);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=No.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Pn(o[1]||tt,o[2]);return qi(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},jo=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ho=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,qo=(r,e)=>{var t=jo.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var i=Ho.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}var s=t[3],n=t[1]||tt;return[n,s]=Pn(n,s),qi(e,s,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},fs=/\(error: (.*)\)/,ms=50;function Uo(){return(function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return function(s,n){n===void 0&&(n=0);for(var o=[],a=s.split(`
3
+ `),l=n;l<a.length;l++){var u=a[l];if(!(u.length>1024)){var c=fs.test(u)?u.replace(fs,"$1"):u;if(!c.match(/\S*Error: /)){for(var h of t){var p=h(c,r);if(p){o.push(p);break}}if(o.length>=ms)break}}}return(function(g){if(!g.length)return[];var v=Array.from(g);return v.reverse(),v.slice(0,ms).map((_=>{return w({},_,{filename:_.filename||(m=v,m[m.length-1]||{}).filename,function:_.function||tt});var m}))})(o)}})("web:javascript",Lo,qo)}var Ui=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=U(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return qt(e,"DOMException")}isDOMError(e){return qt(e,"DOMError")}},Bi=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 i=e.message;return i.error&&typeof i.error.message=="string"?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}},Gi=class{constructor(){}match(e){return qt(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var i,s=t.apply(e.error);return s||{type:"ErrorEvent",value:e.message,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Bo=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Vi=class{match(e){return typeof e=="string"}coerce(e,t){var i,[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(Bo);return s&&(t=s[1],i=s[2]),[t,i]}},Go=["fatal","error","warning","log","info","debug"];function Sn(r,e){e===void 0&&(e=40);var t=Object.keys(r);if(t.sort(),!t.length)return"[object has no keys]";for(var i=t.length;i>0;i--){var s=t.slice(0,i).join(", ");if(!(s.length>e))return i===t.length||s.length<=e?s:s.slice(0,e)+"..."}return""}var Wi=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(i=t.syntheticException)==null?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return ln(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var i=this.getObjectClassName(e);return(i&&i!=="Object"?"'"+i+"'":"Object")+" captured as exception with keys: "+Sn(e)}isSeverityLevel(e){return U(e)&&!Mi(e)&&Go.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(Oo(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},zi=class{match(e){return ln(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+Sn(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Yi=class{match(e){return Ai(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}},Ji=class{match(e){return qt(e,"PromiseRejectionEvent")}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return Ai(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){if(Ai(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}},Fn=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,i={k:function(s){if(d&&(ve.DEBUG||E.POSTHOG_DEBUG||t)&&!f(d.console)&&d.console){for(var n=("__rrweb_original__"in d.console[s])?d.console[s].__rrweb_original__:d.console[s],o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];n(r,...a)}},info:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];i.k("log",...n)},warn:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];i.k("warn",...n)},error:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];i.k("error",...n)},critical:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];console.error(r,...n)},uninitializedWarning:s=>{i.error("You must initialize PostHog before calling "+s)},createLogger:(s,n)=>Fn(r+" "+s,n)};return i},b=Fn("[PostHog.js]"),N=b.createLogger,Vo=N("[ExternalScriptsLoader]"),ys=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return Vo.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var i=y?.querySelectorAll("script");if(i){for(var s,n=function(){if(i[o].src===e){var l=i[o];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(u=>{l.__posthog_loading_callback_fired=!0,t(void 0,u)})),l.onerror=u=>t(u),{v:void 0})}},o=0;o<i.length;o++)if(s=n())return s.v}var a=()=>{if(!y)return t("document not found");var l=y.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),r.config.prepare_external_dependency_script&&(l=r.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(r.config.external_scripts_inject_target==="head")y.head.appendChild(l);else{var u,c=y.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)==null||u.insertBefore(l,c[0]):y.body.appendChild(l)}};y!=null&&y.body?a():y?.addEventListener("DOMContentLoaded",a)};E.__PosthogExtensions__=E.__PosthogExtensions__||{},E.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var i="/static/"+e+".js?v="+r.version;if(e==="remote-config"&&(i="/array/"+r.config.token+"/config.js"),e==="toolbar"){var s=3e5;i=i+"&t="+Math.floor(Date.now()/s)*s}var n=r.requestRouter.endpointFor("assets",i);ys(r,n,t)},E.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var i=r.requestRouter.endpointFor("api",e);ys(r,i,t)};var Bt={};function Ce(r,e,t){if(T(r)){if(ls&&r.forEach===ls)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var i=0,s=r.length;i<s;i++)if(i in r&&e.call(t,r[i],i)===Bt)return}}}function M(r,e,t){if(!I(r)){if(T(r))return Ce(r,e,t);if(yo(r)){for(var i of r.entries())if(e.call(t,i[1],i[0])===Bt)return}else for(var s in r)if(an.call(r,s)&&e.call(t,r[s],s)===Bt)return}}var L=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Ce(t,(function(s){for(var n in s)s[n]!==void 0&&(r[n]=s[n])})),r},rt=function(r){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return Ce(t,(function(s){Ce(s,(function(n){r.push(n)}))})),r};function jt(r){for(var e=Object.keys(r),t=e.length,i=new Array(t);t--;)i[t]=[e[t],r[e[t]]];return i}var bs=function(r){try{return r()}catch{return}},Wo=function(r){return function(){try{for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return r.apply(this,t)}catch(s){b.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),b.critical(s)}}},Jr=function(r){var e={};return M(r,(function(t,i){(U(t)&&t.length>0||we(t))&&(e[i]=t)})),e};function zo(r,e){return t=r,i=n=>U(n)&&!oe(e)?n.slice(0,e):n,s=new Set,(function n(o,a){return o!==Object(o)?i?i(o,a):o:s.has(o)?void 0:(s.add(o),T(o)?(l=[],Ce(o,(u=>{l.push(n(u))}))):(l={},M(o,((u,c)=>{s.has(u)||(l[c]=n(u,c))}))),l);var l})(t);var t,i,s}var Yo=["herokuapp.com","vercel.app","netlify.app"];function Jo(r){var e=r?.hostname;if(!U(e))return!1;var t=e.split(".").slice(-2).join(".");for(var i of Yo)if(t===i)return!1;return!0}function $n(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function j(r,e,t,i){var{capture:s=!1,passive:n=!0}=i??{};r?.addEventListener(e,t,{capture:s,passive:n})}var In="$people_distinct_id",vt="__alias",_t="__timers",ws="$autocapture_disabled_server_side",Xi="$heatmaps_enabled_server_side",Es="$exception_capture_enabled_server_side",Ki="$error_tracking_suppression_rules",xs="$error_tracking_capture_extension_exceptions",ks="$web_vitals_enabled_server_side",Rn="$dead_clicks_enabled_server_side",Ps="$product_tours_enabled_server_side",Ss="$web_vitals_allowed_metrics",fi="$session_recording_remote_config",Gt="$sesid",Tn="$session_is_sampled",Ke="$enabled_feature_flags",ft="$early_access_features",Zi="$feature_flag_details",mt="$stored_person_properties",Ne="$stored_group_properties",Qi="$surveys",Vt="$flag_call_reported",er="$feature_flag_errors",_e="$user_state",tr="$client_session_props",ir="$capture_rate_limit",rr="$initial_campaign_params",sr="$initial_referrer_info",Wt="$initial_person_info",zt="$epp",Cn="__POSTHOG_TOOLBAR__",nt="$posthog_cookieless",Xo=[In,vt,"__cmpns",_t,"$session_recording_enabled_server_side",Xi,Gt,Ke,Ki,_e,ft,Zi,Ne,mt,Qi,Vt,er,tr,ir,rr,sr,zt,Wt,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function Fs(r){return r instanceof Element&&(r.id===Cn||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function hi(r){return!!r&&r.nodeType===1}function Oe(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function On(r){return!!r&&r.nodeType===3}function Mn(r){return!!r&&r.nodeType===11}function Xr(r){return r?ci(r).split(/\s+/):[]}function $s(r){var e=d?.location.href;return!!(e&&r&&r.some((t=>e.match(t))))}function Yt(r){var e="";switch(typeof r.className){case"string":e=r.className;break;case"object":e=(r.className&&"baseVal"in r.className?r.className.baseVal:null)||r.getAttribute("class")||"";break;default:e=""}return Xr(e)}function An(r){return I(r)?null:ci(r).split(/(\s+)/).filter((e=>It(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Tt(r){var e="";return nr(r)&&!Hn(r)&&r.childNodes&&r.childNodes.length&&M(r.childNodes,(function(t){var i;On(t)&&t.textContent&&(e+=(i=An(t.textContent))!==null&&i!==void 0?i:"")})),ci(e)}function Dn(r){return f(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var Kr=["a","button","form","input","select","textarea","label"];function Nn(r,e){if(f(e))return!0;var t,i=function(n){if(e.some((o=>n.matches(o))))return{v:!0}};for(var s of r)if(t=i(s))return t.v;return!1}function Ln(r){var e=r.parentNode;return!(!e||!hi(e))&&e}var Ko=["next","previous","prev",">","<"],Is=10,Rs=[".ph-no-rageclick",".ph-no-capture"];function Zo(r,e){if(!d||Zr(r))return!1;var t,i,s;if(be(e)?(t=!!e&&Rs,i=void 0):(t=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:Rs,i=e?.content_ignorelist),t===!1)return!1;var{targetElementList:n}=jn(r,!1);return!(function(o,a){if(o===!1||f(o))return!1;var l;if(o===!0)l=Ko;else{if(!T(o))return!1;if(o.length>Is)return b.error("[PostHog] content_ignorelist array cannot exceed "+Is+" items. Use css_selector_ignorelist for more complex matching."),!1;l=o.map((u=>u.toLowerCase()))}return a.some((u=>{var{safeText:c,ariaLabel:h}=u;return l.some((p=>c.includes(p)||h.includes(p)))}))})(i,n.map((o=>{var a;return{safeText:Tt(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!Nn(n,t)}var Zr=r=>!r||Oe(r,"html")||!hi(r),jn=(r,e)=>{if(!d||Zr(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,i=[r],s=r;s.parentNode&&!Oe(s,"body");)if(Mn(s.parentNode))i.push(s.parentNode.host),s=s.parentNode.host;else{var n=Ln(s);if(!n)break;if(e||Kr.indexOf(n.tagName.toLowerCase())>-1)t=!0;else{var o=d.getComputedStyle(n);o&&o.getPropertyValue("cursor")==="pointer"&&(t=!0)}i.push(n),s=n}return{parentIsUsefulElement:t,targetElementList:i}};function Qo(r,e,t,i,s){var n,o,a,l;if(t===void 0&&(t=void 0),!d||Zr(r)||(n=t)!=null&&n.url_allowlist&&!$s(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&$s(t.url_ignorelist))return!1;if((a=t)!=null&&a.dom_event_allowlist){var u=t.dom_event_allowlist;if(u&&!u.some((v=>e.type===v)))return!1}var{parentIsUsefulElement:c,targetElementList:h}=jn(r,i);if(!(function(v,_){var m=_?.element_allowlist;if(f(m))return!0;var P,k=function($){if(m.some((x=>$.tagName.toLowerCase()===x)))return{v:!0}};for(var R of v)if(P=k(R))return P.v;return!1})(h,t)||!Nn(h,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var p=d.getComputedStyle(r);if(p&&p.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var g=r.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return c?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Kr.indexOf(g)>-1||r.getAttribute("contenteditable")==="true")}}function nr(r){for(var e=r;e.parentNode&&!Oe(e,"body");e=e.parentNode){var t=Yt(e);if(F(t,"ph-sensitive")||F(t,"ph-no-capture"))return!1}if(F(Yt(r),"ph-include"))return!0;var i=r.type||"";if(U(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var s=r.name||r.id||"";return!(U(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function Hn(r){return!!(Oe(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Oe(r,"select")||Oe(r,"textarea")||r.getAttribute("contenteditable")==="true")}var qn="(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})",ea=new RegExp("^(?:"+qn+")$"),ta=new RegExp(qn),Un="\\d{3}-?\\d{2}-?\\d{4}",ia=new RegExp("^("+Un+")$"),ra=new RegExp("("+Un+")");function It(r,e){return e===void 0&&(e=!0),!(I(r)||U(r)&&(r=ci(r),(e?ea:ta).test((r||"").replace(/[- ]/g,""))||(e?ia:ra).test(r)))}function Bn(r){var e=Tt(r);return It(e=(e+" "+Gn(r)).trim())?e:""}function Gn(r){var e="";return r&&r.childNodes&&r.childNodes.length&&M(r.childNodes,(function(t){var i;if(t&&((i=t.tagName)==null?void 0:i.toLowerCase())==="span")try{var s=Tt(t);e=(e+" "+s).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Gn(t)).trim())}catch(n){b.error("[AutoCapture]",n)}})),e}function sa(r){return(function(e){var t=e.map((i=>{var s,n,o="";if(i.tag_name&&(o+=i.tag_name),i.attr_class)for(var a of(i.attr_class.sort(),i.attr_class))o+="."+a.replace(/"/g,"");var l=w({},i.text?{text:i.text}:{},{"nth-child":(s=i.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(n=i.nth_of_type)!==null&&n!==void 0?n:0},i.href?{href:i.href}:{},i.attr_id?{attr_id:i.attr_id}:{},i.attributes),u={};return jt(l).sort(((c,h)=>{var[p]=c,[g]=h;return p.localeCompare(g)})).forEach((c=>{var[h,p]=c;return u[Ts(h.toString())]=Ts(p.toString())})),o+=":",o+=jt(u).map((c=>{var[h,p]=c;return h+'="'+p+'"'})).join("")}));return t.join(";")})((function(e){return e.map((t=>{var i,s,n={text:(i=t.$el_text)==null?void 0:i.slice(0,400),tag_name:t.tag_name,href:(s=t.attr__href)==null?void 0:s.slice(0,2048),attr_class:na(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return jt(t).filter((o=>{var[a]=o;return a.indexOf("attr__")===0})).forEach((o=>{var[a,l]=o;return n.attributes[a]=l})),n}))})(r))}function Ts(r){return r.replace(/"|\\"/g,'\\"')}function na(r){var e=r.attr__class;return e?T(e)?e:Xr(e):void 0}var Jt=class{constructor(e){this.disabled=e===!1;var t=q(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&i-s.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}},Xt=r=>{var e=y?.createElement("a");return f(e)?null:(e.href=r,e)},oa=function(r,e){var t,i;e===void 0&&(e="&");var s=[];return M(r,(function(n,o){f(n)||f(o)||o==="undefined"||(t=encodeURIComponent((a=>a instanceof File)(n)?n.name:n.toString()),i=encodeURIComponent(o),s[s.length]=i+"="+t)})),s.join(e)},Kt=function(r,e){for(var t,i=((r.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<i.length;s++){var n=i[s].split("=");if(n[0]===e){t=n;break}}if(!T(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{b.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ct=function(r,e,t){if(!r||!e||!e.length)return r;for(var i=r.split("#"),s=i[0]||"",n=i[1],o=s.split("?"),a=o[1],l=o[0],u=(a||"").split("&"),c=[],h=0;h<u.length;h++){var p=u[h].split("=");T(p)&&(e.includes(p[0])?c.push(p[0]+"="+t):c.push(u[h]))}var g=l;return a!=null&&(g+="?"+c.join("&")),n!=null&&(g+="#"+n),g},Zt=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},mi="$copy_autocapture",Cs=N("[AutoCapture]");function yi(r,e){return e.length>r?e.slice(0,r)+"...":e}function aa(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!hi(e));return e}function la(r,e,t,i){var s=r.tagName.toLowerCase(),n={tag_name:s};Kr.indexOf(s)>-1&&!t&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?n.$el_text=yi(1024,Bn(r)):n.$el_text=yi(1024,Tt(r)));var o=Yt(r);o.length>0&&(n.classes=o.filter((function(c){return c!==""}))),M(r.attributes,(function(c){var h;if((!Hn(r)||["name","id","class","aria-label"].indexOf(c.name)!==-1)&&(i==null||!i.includes(c.name))&&!e&&It(c.value)&&(h=c.name,!U(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var p=c.value;c.name==="class"&&(p=Xr(p).join(" ")),n["attr__"+c.name]=yi(1024,p)}}));for(var a=1,l=1,u=r;u=aa(u);)a++,u.tagName===r.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function ca(r,e){for(var t,i,{e:s,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,u=[r],c=r;c.parentNode&&!Oe(c,"body");)Mn(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var h,p=[],g={},v=!1,_=!1;if(M(u,($=>{var x=nr($);$.tagName.toLowerCase()==="a"&&(v=$.getAttribute("href"),v=x&&v&&It(v)&&v),F(Yt($),"ph-no-capture")&&(_=!0),p.push(la($,n,o,a));var H=(function(C){if(!nr(C))return{};var S={};return M(C.attributes,(function(K){if(K.name&&K.name.indexOf("data-ph-capture-attribute")===0){var W=K.name.replace("data-ph-capture-attribute-",""),te=K.value;W&&te&&It(te)&&(S[W]=te)}})),S})($);L(g,H)})),_)return{props:{},explicitNoCapture:_};if(o||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?p[0].$el_text=Bn(r):p[0].$el_text=Tt(r)),v){var m,P;p[0].attr__href=v;var k=(m=Xt(v))==null?void 0:m.host,R=d==null||(P=d.location)==null?void 0:P.host;k&&R&&k!==R&&(h=v)}return{props:L({$event_type:s.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:sa(p)},(t=p[0])!=null&&t.$el_text?{$el_text:(i=p[0])==null?void 0:i.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},g)}}var or=class{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Jt(e.config.rageclick),this.C=null}get R(){var e,t,i=q(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)==null?void 0:e.map((s=>new RegExp(s))),i.url_ignorelist=(t=i.url_ignorelist)==null?void 0:t.map((s=>new RegExp(s))),i}F(){if(this.isBrowserSupported()){if(d&&y){var e=i=>{i=i||d?.event;try{this.O(i)}catch(s){Cs.error("Failed to capture event",s)}};if(j(y,"submit",e,{capture:!0}),j(y,"change",e,{capture:!0}),j(y,"click",e,{capture:!0}),this.R.capture_copied_text){var t=i=>{i=i||d?.event,this.O(i,mi)};j(y,"copy",t,{capture:!0}),j(y,"cut",t,{capture:!0})}}}else Cs.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.I=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ws]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.C=e}getElementSelectors(e){var t,i=[];return(t=this.C)==null||t.forEach((s=>{var n=y?.querySelectorAll(s);n?.forEach((o=>{e===o&&i.push(s)}))})),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)==null?void 0:e.props[ws],s=this.T;if(oe(s)&&!be(i)&&!this.instance.M())return!1;var n=(t=this.T)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!n}O(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i,s=Dn(e);On(s)&&(s=s.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Zo(s,this.instance.config.rageclick)&&this.O(e,"$rageclick");var n=t===mi;if(s&&Qo(s,e,this.R,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=ca(s,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),t===mi){var u,c=An(d==null||(u=d.getSelection())==null?void 0:u.toString()),h=e.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=h}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return Te(y?.querySelectorAll)}};Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return we(r)&&isFinite(r)&&Math.floor(r)===r});var Os="0123456789abcdef",ar=class r{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||e<0||t<0||i<0||s<0||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new r(n)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Os.charAt(this.bytes[t]>>>4)+Os.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new r(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}},lr=class{constructor(){this.A=0,this.j=0,this.D=new cr}generate(){var e=this.generateOrAbort();if(f(e)){this.A=0;var t=this.generateOrAbort();if(f(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.j++,this.j>4398046511103&&(this.A++,this.L())}return ar.fromFieldsV7(this.A,Math.trunc(this.j/Math.pow(2,30)),this.j&Math.pow(2,30)-1,this.D.nextUint32())}L(){this.j=1024*this.D.nextUint32()+(1023&this.D.nextUint32())}},Ms,Vn=r=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<r.length;e++)r[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return r};d&&!f(d.crypto)&&crypto.getRandomValues&&(Vn=r=>crypto.getRandomValues(r));var cr=class{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(Vn(this.N),this.U=0),this.N[this.U++]}},Re=()=>ua().toString(),ua=()=>(Ms||(Ms=new lr)).generate(),ot="",ha=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function da(r,e){if(e){var t=(function(s,n){if(n===void 0&&(n=y),ot)return ot;if(!n||["localhost","127.0.0.1"].includes(s))return"";for(var o=s.split("."),a=Math.min(o.length,8),l="dmn_chk_"+Re();!ot&&a--;){var u=o.slice(a).join("."),c=l+"=1;domain=."+u+";path=/";n.cookie=c+";max-age=3",n.cookie.includes(l)&&(n.cookie=c+";max-age=0",ot=u)}return ot})(r);if(!t){var i=(s=>{var n=s.match(ha);return n?n[0]:""})(r);i!==t&&b.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}var ue={H:()=>!!y,B:function(r){b.error("cookieStore error: "+r)},q:function(r){if(y){try{for(var e=r+"=",t=y.cookie.split(";").filter((n=>n.length)),i=0;i<t.length;i++){for(var s=t[i];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},W:function(r){var e;try{e=JSON.parse(ue.q(r))||{}}catch{}return e},G:function(r,e,t,i,s){if(y)try{var n="",o="",a=da(y.location.hostname,i);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=r+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&b.warn("cookieStore warning: large cookie, len="+u.length),y.cookie=u,u}catch{return}},V:function(r,e){if(y!=null&&y.cookie)try{ue.G(r,"",-1,e)}catch{return}}},bi=null,D={H:function(){if(!oe(bi))return bi;var r=!0;if(f(d))r=!1;else try{var e="__mplssupport__";D.G(e,"xyz"),D.q(e)!=='"xyz"'&&(r=!1),D.V(e)}catch{r=!1}return r||b.error("localStorage unsupported; falling back to cookie store"),bi=r,r},B:function(r){b.error("localStorage error: "+r)},q:function(r){try{return d?.localStorage.getItem(r)}catch(e){D.B(e)}return null},W:function(r){try{return JSON.parse(D.q(r))||{}}catch{}return null},G:function(r,e){try{d?.localStorage.setItem(r,JSON.stringify(e))}catch(t){D.B(t)}},V:function(r){try{d?.localStorage.removeItem(r)}catch(e){D.B(e)}}},pa=["$device_id","distinct_id",Gt,Tn,zt,Wt],At={},ga={H:function(){return!0},B:function(r){b.error("memoryStorage error: "+r)},q:function(r){return At[r]||null},W:function(r){return At[r]||null},G:function(r,e){At[r]=e},V:function(r){delete At[r]}},Ae=null,B={H:function(){if(!oe(Ae))return Ae;if(Ae=!0,f(d))Ae=!1;else try{var r="__support__";B.G(r,"xyz"),B.q(r)!=='"xyz"'&&(Ae=!1),B.V(r)}catch{Ae=!1}return Ae},B:function(r){b.error("sessionStorage error: ",r)},q:function(r){try{return d?.sessionStorage.getItem(r)}catch(e){B.B(e)}return null},W:function(r){try{return JSON.parse(B.q(r))||null}catch{}return null},G:function(r,e){try{d?.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){B.B(t)}},V:function(r){try{d?.sessionStorage.removeItem(r)}catch(e){B.B(e)}}},fe=(function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r})({}),ur=class{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?fe.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===fe.DENIED||this.consent===fe.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===fe.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return gi(e)?fe.GRANTED:F(Eo,e)?fe.DENIED:fe.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?D:ue;var t=e==="localStorage"?ue:D;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(gi(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!$n([ee?.doNotTrack,ee?.msDoNotTrack,E.doNotTrack],(e=>gi(e)))}},Dt=N("[Dead Clicks]"),va=()=>!0,_a=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(Rn)),i=r.instance.config.capture_dead_clicks;return be(i)?i:!!q(i)||t},Qt=class{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Rn]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(e){var t,i;(t=E.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?Dt.error("failed to load script",s):e()}))}et(){var e;if(y){if(!this.tt&&(e=E.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=q(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=E.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(y),Dt.info("starting...")}}else Dt.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Dt.info("stopping..."))}},at=N("[ExceptionAutocapture]"),hr=class{constructor(e){var t,i,s;this.rt=()=>{var n;if(d&&this.isEnabled&&(n=E.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var o=E.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=E.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=E.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=o(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=a(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=l(this.captureException.bind(this)))}catch(u){at.error("failed to start",u),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[Es]),this.dt=new Di({refillRate:(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,h:at}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return q(e)?t=w({},t,e):(f(e)?this.ht:e)&&(t=w({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(at.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,i;(t=E.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return at.error("failed to load script",s);e()}))}ut(){var e,t,i;(e=this.st)==null||e.call(this),this.st=void 0,(t=this.nt)==null||t.call(this),this.nt=void 0,(i=this.ot)==null||i.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ht=!!t||!1,this._instance.persistence&&this._instance.persistence.register({[Es]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(e){var t,i,s=(t=e==null||(i=e.$exception_list)==null||(i=i[0])==null?void 0:i.type)!==null&&t!==void 0?t:"Exception";this.dt.consumeRateLimit(s)?at.info("Skipping exception capture because of client rate limiting.",{exception:s}):this._instance.exceptions.sendExceptionEvent(e)}};function As(r,e,t){try{if(!(e in r))return()=>{};var i=r[e],s=t(i);return Te(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=s,()=>{r[e]=i}}catch{return()=>{}}}var dr=class{constructor(e){var t;this._instance=e,this.ct=(d==null||(t=d.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(b.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,b.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(d&&d.history){var i=this;(e=d.history.pushState)!=null&&e.__posthog_wrapped__||As(d.history,"pushState",(s=>function(n,o,a){s.call(this,n,o,a),i._t("pushState")})),(t=d.history.replaceState)!=null&&t.__posthog_wrapped__||As(d.history,"replaceState",(s=>function(n,o,a){s.call(this,n,o,a),i._t("replaceState")})),this.bt()}}_t(e){try{var t,i=d==null||(t=d.location)==null?void 0:t.pathname;if(!i)return;i!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ct=i}catch(s){b.error("Error capturing "+e+" pageview",s)}}bt(){if(!this.ft){var e=()=>{this._t("popstate")};j(d,"popstate",e),this.ft=()=>{d&&d.removeEventListener("popstate",e)}}}},wi=N("[SegmentIntegration]");function fa(r,e){var t=r.config.segment;if(!t)return e();(function(i,s){var n=i.config.segment;if(!n)return s();var o=l=>{var u=()=>l.anonymousId()||Re();i.config.get_device_id=u,l.id()&&(i.register({distinct_id:l.id(),$device_id:u()}),i.persistence.set_property(_e,"identified")),s()},a=n.user();"then"in a&&Te(a.then)?a.then(o):o(a)})(r,(()=>{t.register((i=>{Promise&&Promise.resolve||wi.warn("This browser does not have Promise support, and can not use the segment integration");var s=(n,o)=>{if(!o)return n;n.event.userId||n.event.anonymousId===i.get_distinct_id()||(wi.info("No userId set, resetting PostHog"),i.reset()),n.event.userId&&n.event.userId!==i.get_distinct_id()&&(wi.info("UserId set, identifying with PostHog"),i.identify(n.event.userId));var a=i.calculateEventProperties(o,n.event.properties);return n.event.properties=Object.assign({},a,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:n=>s(n,n.event.event),page:n=>s(n,"$pageview"),identify:n=>s(n,"$identify"),screen:n=>s(n,"$screen")}})(r)).then((()=>{e()}))}))}var Wn="posthog-js";function zn(r,e){var{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,u,c,h,p;if(!(n==="*"||n.includes(a.level))||!r.__loaded)return a;a.tags||(a.tags={});var g=r.requestRouter.endpointFor("ui","/project/"+r.config.token+"/person/"+r.get_distinct_id());a.tags["PostHog Person URL"]=g,r.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=r.get_session_replay_url({withTimestamp:!0}));var v=((l=a.exception)==null?void 0:l.values)||[],_=v.map((P=>w({},P,{stacktrace:P.stacktrace?w({},P.stacktrace,{type:"raw",frames:(P.stacktrace.frames||[]).map((k=>w({},k,{platform:"web:javascript"})))}):void 0}))),m={$exception_message:((u=v[0])==null?void 0:u.value)||a.message,$exception_type:(c=v[0])==null?void 0:c.type,$exception_level:a.level,$exception_list:_,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((h=v[0])==null?void 0:h.value)||a.message,$sentry_exception_type:(p=v[0])==null?void 0:p.type,$sentry_tags:a.tags};return t&&i&&(m.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+a.event_id),o&&r.exceptions.sendExceptionEvent(m),a}}var pr=class{constructor(e,t,i,s,n,o){this.name=Wn,this.setupOnce=function(a){a(zn(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:o==null||o}))}}},ma=d!=null&&d.location?Zt(d.location.hash,"__posthog")||Zt(location.hash,"state"):null,Ds="_postHogToolbarParams",Ns=N("[Toolbar]"),Ie=(function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r})(Ie||{}),gr=class{constructor(e){this.instance=e}yt(e){E.ph_toolbar_state=e}wt(){var e;return(e=E.ph_toolbar_state)!==null&&e!==void 0?e:Ie.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.instance.config.name&&this.instance.config.name==="ph_toolbar_internal"||!d||!y)return!1;e=e??d.location,i=i??d.history;try{if(!t){try{d.localStorage.setItem("test","test"),d.localStorage.removeItem("test")}catch{return!1}t=d?.localStorage}var s,n=ma||Zt(e.hash,"__posthog")||Zt(e.hash,"state"),o=n?bs((()=>JSON.parse(atob(decodeURIComponent(n)))))||bs((()=>JSON.parse(decodeURIComponent(n)))):null;return o&&o.action==="ph_authorize"?((s=o).source="url",s&&Object.keys(s).length>0&&(o.desiredHash?e.hash=o.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(Ds)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}xt(e){var t=E.ph_load_toolbar||E.ph_load_editor;!I(t)&&Te(t)?t(e,this.instance):Ns.warn("No toolbar load function found")}loadToolbar(e){var t=!(y==null||!y.getElementById(Cn));if(!d||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=w({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(d.localStorage.setItem(Ds,JSON.stringify(w({},s,{source:void 0}))),this.wt()===Ie.LOADED)this.xt(s);else if(this.wt()===Ie.UNINITIALIZED){var n;this.yt(Ie.LOADING),(n=E.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return Ns.error("[Toolbar] Failed to load",o),void this.yt(Ie.UNINITIALIZED);this.yt(Ie.LOADED),this.xt(s)})),j(d,"turbolinks:load",(()=>{this.yt(Ie.UNINITIALIZED),this.loadToolbar(s)}))}return!0}Et(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.maybeLoadToolbar(e,t,i)}},ya=N("[TracingHeaders]"),vr=class{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,i;f(this.$t)&&((t=E.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),f(this.St)&&((i=E.__PosthogExtensions__)==null||(i=i.tracingHeadersPatchFns)==null||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,i;(t=E.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return ya.error("failed to load script",s);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):((e=this.$t)==null||e.call(this),(t=this.St)==null||t.call(this),this.$t=void 0,this.St=void 0)}},Nt="https?://(.*)",st=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ba=rt(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],st),Ot="<masked>",wa=["li_fat_id"];function Yn(r,e,t){if(!y)return{};var i,s=e?rt([],st,t||[]):[],n=Jn(Ct(y.URL,s,Ot),r),o=(i={},M(wa,(function(a){var l=ue.q(a);i[a]=l||null})),i);return L(o,n)}function Jn(r,e){var t=ba.concat(e||[]),i={};return M(t,(function(s){var n=Kt(r,s);i[s]=n||null})),i}function Xn(r){var e=(function(n){return n?n.search(Nt+"google.([^/?]*)")===0?"google":n.search(Nt+"bing.com")===0?"bing":n.search(Nt+"yahoo.com")===0?"yahoo":n.search(Nt+"duckduckgo.com")===0?"duckduckgo":null:null})(r),t=e!="yahoo"?"q":"p",i={};if(!oe(e)){i.$search_engine=e;var s=y?Kt(y.referrer,t):"";s.length&&(i.ph_keyword=s)}return i}function Ls(){return navigator.language||navigator.userLanguage}function Kn(){return y?.referrer||"$direct"}function Zn(r,e){var t=r?rt([],st,e||[]):[],i=G?.href.substring(0,1e3);return{r:Kn().substring(0,1e3),u:i?Ct(i,t,Ot):void 0}}function Qn(r){var e,{r:t,u:i}=r,s={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Xt(t))==null?void 0:e.host};if(i){s.$current_url=i;var n=Xt(i);s.$host=n?.host,s.$pathname=n?.pathname;var o=Jn(i);L(s,o)}if(t){var a=Xn(t);L(s,a)}return s}function eo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Ea(){try{return new Date().getTimezoneOffset()}catch{return}}function xa(r,e){if(!X)return{};var t,i,s,n=r?rt([],st,e||[]):[],[o,a]=(function(l){for(var u=0;u<vs.length;u++){var[c,h]=vs[u],p=c.exec(l),g=p&&(Te(h)?h(p,l):h);if(g)return g}return["",""]})(X);return L(Jr({$os:o,$os_version:a,$browser:kn(X,navigator.vendor),$device:_s(X),$device_type:(i=X,s=_s(i),s===un||s===cn||s==="Kobo"||s==="Kindle Fire"||s===xn?Pt:s===Ft||s===Qe||s===$t||s===Li?"Console":s===dn?"Wearable":s?se:"Desktop"),$timezone:eo(),$timezone_offset:Ea()}),{$current_url:Ct(G?.href,n,Ot),$host:G?.host,$pathname:G?.pathname,$raw_user_agent:X.length>1e3?X.substring(0,997)+"...":X,$browser_version:Co(X,navigator.vendor),$browser_language:Ls(),$browser_language_prefix:(t=Ls(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:d?.screen.height,$screen_width:d?.screen.width,$viewport_height:d?.innerHeight,$viewport_width:d?.innerWidth,$lib:"web",$lib_version:ve.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Se=N("[Web Vitals]"),js=9e5,_r=class{constructor(e){var t;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),this.N.metrics.length!==0&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((i,s)=>w({},i,{["$web_vitals_"+s.name+"_event"]:w({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=i=>{var s,n=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0);if(f(n))Se.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.Ct();f(o)||(I(i?.name)||I(i?.value)?Se.error("Invalid metric received",i):this.Rt&&i.value>=this.Rt?Se.error("Ignoring metric with value >= "+this.Rt,i):(this.N.url!==o&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),f(this.N.url)&&(this.N.url=o),this.N.firstMetricTimestamp=f(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0),this.N.metrics.push(w({},i,{$current_url:o,$session_id:n.sessionId,$window_id:n.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()))}},this.rt=()=>{if(!this.P){var i,s,n,o,a=E.__PosthogExtensions__;f(a)||f(a.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:s,onFCP:n,onINP:o}=a.postHogWebVitalsCallbacks),i&&s&&n&&o?(this.allowedMetrics.indexOf("LCP")>-1&&i(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&n(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.It.bind(this)),this.P=!0):Se.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[ks]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=q(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return I(i)?((t=this._instance.persistence)==null?void 0:t.props[Ss])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(q(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=q(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return e!=null&&e}get Rt(){var e=q(this._instance.config.capture_performance)&&we(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:js;return 0<e&&e<=6e4?js:e}get isEnabled(){var e=G?.protocol;if(e!=="http:"&&e!=="https:")return Se.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=q(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:be(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return be(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Se.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=q(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=q(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[ks]:t}),this._instance.persistence.register({[Ss]:i})),this.kt=t,this.startIfEnabled()}it(e){var t,i;if((t=E.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks)e();else{var s=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,s,(n=>{n?Se.error("failed to load script",n):e()}))}}Ct(){var e=d?d.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,s=t?rt([],st,i||[]):[];return Ct(e,s,Ot)}Se.error("Could not determine current URL")}},ka=N("[Heatmaps]");function Hs(r){return q(r)&&"clientX"in r&&"clientY"in r&&we(r.clientX)&&we(r.clientY)}var fr=class{constructor(e){var t;this.kt=!1,this.P=!1,this.Ft=null,this.instance=e,this.kt=!((t=this.instance.persistence)==null||!t.props[Xi]),this.rageclicks=new Jt(e.config.rageclick)}get flushIntervalMilliseconds(){var e=5e3;return q(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return I(this.instance.config.capture_heatmaps)?I(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.P)return;ka.info("starting..."),this.Ot(),this.Mt()}else{var e;clearInterval((e=this.Ft)!==null&&e!==void 0?e:void 0),this.At(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Xi]:t}),this.kt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}jt(e){this.Dt(e.originalEvent,"deadclick")}Mt(){this.Ft&&clearInterval(this.Ft),this.Ft=(function(e){return e?.visibilityState==="visible"})(y)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Ot(){d&&y&&(this.Nt=this.Lt.bind(this),j(d,"beforeunload",this.Nt),this.Ut=e=>this.Dt(e||d?.event),j(y,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||d?.event),j(y,"mousemove",this.zt,{capture:!0}),this.Bt=new Qt(this.instance,va,this.jt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Mt.bind(this),j(y,"visibilitychange",this.qt),this.P=!0)}At(){var e;d&&y&&(this.Nt&&d.removeEventListener("beforeunload",this.Nt),this.Ut&&y.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&y.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&y.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),(e=this.Bt)==null||e.stop(),this.P=!1)}Gt(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=(function(a,l,u){for(var c=a;c&&hi(c)&&!Oe(c,"body");){if(c===u)return!1;if(F(l,d?.getComputedStyle(c).position))return!0;c=Ln(c)}return!1})(Dn(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:i),target_fixed:o,type:t}}Dt(e,t){var i;if(t===void 0&&(t="click"),!Fs(e.target)&&Hs(e)){var s=this.Gt(e,t);(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(w({},s,{type:"rageclick"})),this.Vt(s)}}Ht(e){!Fs(e.target)&&Hs(e)&&(clearTimeout(this.Wt),this.Wt=setTimeout((()=>{this.Vt(this.Gt(e,"mousemove"))}),500))}Vt(e){if(d){var t=d.location.href,i=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=i?rt([],st,s||[]):[],o=Ct(t,n,Ot);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!Xe(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},ei=class{constructor(e){this.Jt=(t,i,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength)&&(b.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.Kt=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Yt()}Yt(){var e;this.Xt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.Jt)}destroy(){var e;(e=this.Xt)==null||e.call(this),this.Xt=void 0}doPageView(e,t){var i,s=this.Qt(e,t);return this.Kt={pathname:(i=d?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Qt(e,(t=this.Kt)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Kt)==null?void 0:e.pageViewId}}Qt(e,t){var i=this.Kt;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:u,lastContentY:c,maxContentY:h}=n;if(!(f(o)||f(a)||f(l)||f(u)||f(c)||f(h))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),h=Math.ceil(h);var p=o<=1?1:he(a/o,0,1,b),g=o<=1?1:he(l/o,0,1,b),v=u<=1?1:he(c/u,0,1,b),_=u<=1?1:he(h/u,0,1,b);s=L(s,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:g,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:v,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}};var me=(function(r){return r.GZipJS="gzip-js",r.Base64="base64",r})({}),ne=Uint8Array,J=Uint16Array,it=Uint32Array,Qr=new ne([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]),es=new ne([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]),qs=new ne([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),to=function(r,e){for(var t=new J(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];var s=new it(t[30]);for(i=1;i<30;++i)for(var n=t[i];n<t[i+1];++n)s[n]=n-t[i]<<5|i;return[t,s]},io=to(Qr,2),Pa=io[0],mr=io[1];Pa[28]=258,mr[258]=28;for(yr=to(es,0)[1],ti=new J(32768),A=0;A<32768;++A)Fe=(43690&A)>>>1|(21845&A)<<1,Fe=(61680&(Fe=(52428&Fe)>>>2|(13107&Fe)<<2))>>>4|(3855&Fe)<<4,ti[A]=((65280&Fe)>>>8|(255&Fe)<<8)>>>1;var Fe,yr,ti,A,Et=function(r,e,t){for(var i=r.length,s=0,n=new J(e);s<i;++s)++n[r[s]-1];var o,a=new J(e);for(s=0;s<e;++s)a[s]=a[s-1]+n[s-1]<<1;if(t){o=new J(1<<e);var l=15-e;for(s=0;s<i;++s)if(r[s])for(var u=s<<4|r[s],c=e-r[s],h=a[r[s]-1]++<<c,p=h|(1<<c)-1;h<=p;++h)o[ti[h]>>>l]=u}else for(o=new J(i),s=0;s<i;++s)o[s]=ti[a[r[s]-1]++]>>>15-r[s];return o},je=new ne(288);for(A=0;A<144;++A)je[A]=8;for(A=144;A<256;++A)je[A]=9;for(A=256;A<280;++A)je[A]=7;for(A=280;A<288;++A)je[A]=8;var ii=new ne(32);for(A=0;A<32;++A)ii[A]=5;var Sa=Et(je,9,0),Fa=Et(ii,5,0),ro=function(r){return(r/8>>0)+(7&r&&1)},so=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof J?J:r instanceof it?it:ne)(t-e);return i.set(r.subarray(e,t)),i},pe=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8},lt=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8,r[i+2]|=t>>>16},Ei=function(r,e){for(var t=[],i=0;i<r.length;++i)r[i]&&t.push({s:i,f:r[i]});var s=t.length,n=t.slice();if(!s)return[new ne(0),0];if(s==1){var o=new ne(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(x,H){return x.f-H.f})),t.push({s:-1,f:25001});var a=t[0],l=t[1],u=0,c=1,h=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=s-1;)a=t[t[u].f<t[h].f?u++:h++],l=t[u!=c&&t[u].f<t[h].f?u++:h++],t[c++]={s:-1,f:a.f+l.f,l:a,r:l};var p=n[0].s;for(i=1;i<s;++i)n[i].s>p&&(p=n[i].s);var g=new J(p+1),v=br(t[c-1],g,0);if(v>e){i=0;var _=0,m=v-e,P=1<<m;for(n.sort((function(x,H){return g[H.s]-g[x.s]||x.f-H.f}));i<s;++i){var k=n[i].s;if(!(g[k]>e))break;_+=P-(1<<v-g[k]),g[k]=e}for(_>>>=m;_>0;){var R=n[i].s;g[R]<e?_-=1<<e-g[R]++-1:++i}for(;i>=0&&_;--i){var $=n[i].s;g[$]==e&&(--g[$],++_)}v=e}return[new ne(g),v]},br=function(r,e,t){return r.s==-1?Math.max(br(r.l,e,t+1),br(r.r,e,t+1)):e[r.s]=t},Us=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new J(++e),i=0,s=r[0],n=1,o=function(l){t[i++]=l},a=1;a<=e;++a)if(r[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=r[a]}return[t.subarray(0,i),e]},ct=function(r,e){for(var t=0,i=0;i<e.length;++i)t+=r[i]*e[i];return t},wr=function(r,e,t){var i=t.length,s=ro(e+2);r[s]=255&i,r[s+1]=i>>>8,r[s+2]=255^r[s],r[s+3]=255^r[s+1];for(var n=0;n<i;++n)r[s+n+4]=t[n];return 8*(s+4+i)},Bs=function(r,e,t,i,s,n,o,a,l,u,c){pe(e,c++,t),++s[256];for(var h=Ei(s,15),p=h[0],g=h[1],v=Ei(n,15),_=v[0],m=v[1],P=Us(p),k=P[0],R=P[1],$=Us(_),x=$[0],H=$[1],C=new J(19),S=0;S<k.length;++S)C[31&k[S]]++;for(S=0;S<x.length;++S)C[31&x[S]]++;for(var K=Ei(C,7),W=K[0],te=K[1],ie=19;ie>4&&!W[qs[ie-1]];--ie);var de,ae,le,Ue,Ee=u+5<<3,Me=ct(s,je)+ct(n,ii)+o,ce=ct(s,p)+ct(n,_)+o+14+3*ie+ct(C,W)+(2*C[16]+3*C[17]+7*C[18]);if(Ee<=Me&&Ee<=ce)return wr(e,c,r.subarray(l,l+u));if(pe(e,c,1+(ce<Me)),c+=2,ce<Me){de=Et(p,g,0),ae=p,le=Et(_,m,0),Ue=_;var xe=Et(W,te,0);for(pe(e,c,R-257),pe(e,c+5,H-1),pe(e,c+10,ie-4),c+=14,S=0;S<ie;++S)pe(e,c+3*S,W[qs[S]]);c+=3*ie;for(var Be=[k,x],z=0;z<2;++z){var re=Be[z];for(S=0;S<re.length;++S){var Z=31&re[S];pe(e,c,xe[Z]),c+=W[Z],Z>15&&(pe(e,c,re[S]>>>5&127),c+=re[S]>>>12)}}}else de=Sa,ae=je,le=Fa,Ue=ii;for(S=0;S<a;++S)if(i[S]>255){Z=i[S]>>>18&31,lt(e,c,de[Z+257]),c+=ae[Z+257],Z>7&&(pe(e,c,i[S]>>>23&31),c+=Qr[Z]);var Ge=31&i[S];lt(e,c,le[Ge]),c+=Ue[Ge],Ge>3&&(lt(e,c,i[S]>>>5&8191),c+=es[Ge])}else lt(e,c,de[i[S]]),c+=ae[i[S]];return lt(e,c,de[256]),c+ae[256]},$a=new it([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ia=(function(){for(var r=new it(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r})(),Ra=function(r,e,t,i,s){return(function(n,o,a,l,u,c){var h=n.length,p=new ne(l+h+5*(1+Math.floor(h/7e3))+u),g=p.subarray(l,p.length-u),v=0;if(!o||h<8)for(var _=0;_<=h;_+=65535){var m=_+65535;m<h?v=wr(g,v,n.subarray(_,m)):(g[_]=c,v=wr(g,v,n.subarray(_,h)))}else{for(var P=$a[o-1],k=P>>>13,R=8191&P,$=(1<<a)-1,x=new J(32768),H=new J($+1),C=Math.ceil(a/3),S=2*C,K=function(pi){return(n[pi]^n[pi+1]<<C^n[pi+2]<<S)&$},W=new it(25e3),te=new J(288),ie=new J(32),de=0,ae=0,le=(_=0,0),Ue=0,Ee=0;_<h;++_){var Me=K(_),ce=32767&_,xe=H[Me];if(x[ce]=xe,H[Me]=ce,Ue<=_){var Be=h-_;if((de>7e3||le>24576)&&Be>423){v=Bs(n,g,0,W,te,ie,ae,le,Ee,_-Ee,v),le=de=ae=0,Ee=_;for(var z=0;z<286;++z)te[z]=0;for(z=0;z<30;++z)ie[z]=0}var re=2,Z=0,Ge=R,ke=ce-xe&32767;if(Be>2&&Me==K(_-ke))for(var ho=Math.min(k,Be)-1,po=Math.min(32767,_),go=Math.min(258,Be);ke<=po&&--Ge&&ce!=xe;){if(n[_+re]==n[_+re-ke]){for(var Pe=0;Pe<go&&n[_+Pe]==n[_+Pe-ke];++Pe);if(Pe>re){if(re=Pe,Z=ke,Pe>ho)break;var vo=Math.min(ke,Pe-2),ts=0;for(z=0;z<vo;++z){var di=_-ke+z+32768&32767,is=di-x[di]+32768&32767;is>ts&&(ts=is,xe=di)}}}ke+=(ce=xe)-(xe=x[ce])+32768&32767}if(Z){W[le++]=268435456|mr[re]<<18|yr[Z];var rs=31&mr[re],ss=31&yr[Z];ae+=Qr[rs]+es[ss],++te[257+rs],++ie[ss],Ue=_+re,++de}else W[le++]=n[_],++te[n[_]]}}v=Bs(n,g,c,W,te,ie,ae,le,Ee,_-Ee,v)}return so(p,0,l+ro(v)+u)})(r,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+e.mem,t,i,!0)},xi=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function Ta(r,e){e===void 0&&(e={});var t=(function(){var a=4294967295;return{p:function(l){for(var u=a,c=0;c<l.length;++c)u=Ia[255&u^l[c]]^u>>>8;a=u},d:function(){return 4294967295^a}}})(),i=r.length;t.p(r);var s,n=Ra(r,e,10+((s=e).filename&&s.filename.length+1||0),8),o=n.length;return(function(a,l){var u=l.filename;if(a[0]=31,a[1]=139,a[2]=8,a[8]=l.level<2?4:l.level==9?2:0,a[9]=3,l.mtime!=0&&xi(a,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),u){a[3]=8;for(var c=0;c<=u.length;++c)a[c+10]=u.charCodeAt(c)}})(n,e),xi(n,o-8,t.d()),xi(n,o-4,i),n}var Ca=function(r){var e,t,i,s,n="";for(e=t=0,i=(r=(r+"").replace(/\r\n/g,`
4
4
  `).replace(/\r/g,`
5
- `)).length,s=0;s<i;s++){var o=r.charCodeAt(s),a=null;o<128?t++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),oe(a)||(t>e&&(n+=r.substring(e,t)),n+=a,e=t=s+1)}return t>e&&(n+=r.substring(e,r.length)),n},Oa=!!Ci||!!Ti,Gs="text/plain",ri=function(r,e,t){var i;t===void 0&&(t=!0);var[s,n]=r.split("?"),o=w({},e),a=(i=n?.split("&").map((u=>{var c,[h,p]=u.split("="),g=t&&(c=o[h])!==null&&c!==void 0?c:p;return delete o[h],h+"="+g})))!==null&&i!==void 0?i:[],l=oa(o);return l&&a.push(l),s+"?"+a.join("&")},yt=(r,e)=>JSON.stringify(r,((t,i)=>typeof i=="bigint"?i.toString():i),e),ki=r=>{var{data:e,compression:t}=r;if(e){if(t===me.GZipJS){var i=Ta((function(l,u){var c=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var h=new ne(l.length+(l.length>>>1)),p=0,g=function(P){h[p++]=P},v=0;v<c;++v){if(p+5>h.length){var _=new ne(p+8+(c-v<<1));_.set(h),h=_}var m=l.charCodeAt(v);m<128||u?g(m):m<2048?(g(192|m>>>6),g(128|63&m)):m>55295&&m<57344?(g(240|(m=65536+(1047552&m)|1023&l.charCodeAt(++v))>>>18),g(128|m>>>12&63),g(128|m>>>6&63),g(128|63&m)):(g(224|m>>>12),g(128|m>>>6&63),g(128|63&m))}return so(h,0,p)})(yt(e)),{mtime:0}),s=new Blob([i],{type:Gs});return{contentType:Gs,body:s,estimatedSize:s.size}}if(t===me.Base64){var n=(function(l){var u,c,h,p,g,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_=0,m=0,P="",k=[];if(!l)return l;l=Ca(l);do u=(g=l.charCodeAt(_++)<<16|l.charCodeAt(_++)<<8|l.charCodeAt(_++))>>18&63,c=g>>12&63,h=g>>6&63,p=63&g,k[m++]=v.charAt(u)+v.charAt(c)+v.charAt(h)+v.charAt(p);while(_<l.length);switch(P=k.join(""),l.length%3){case 1:P=P.slice(0,-2)+"==";break;case 2:P=P.slice(0,-1)+"="}return P})(yt(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:yt(l)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=yt(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Ht=[];Ti&&Ht.push({transport:"fetch",method:r=>{var e,t,{contentType:i,body:s,estimatedSize:n}=(e=ki(r))!==null&&e!==void 0?e:{},o=new Headers;M(r.headers,(function(c,h){o.append(h,c)})),i&&o.append("Content-Type",i);var a=r.url,l=null;if(us){var u=new us;l={signal:u.signal,timeout:setTimeout((()=>u.abort()),r.timeout)}}Ti(a,w({method:r?.method||"GET",headers:o,keepalive:r.method==="POST"&&(n||0)<52428.8,body:s,signal:(t=l)==null?void 0:t.signal},r.fetchOptions)).then((c=>c.text().then((h=>{var p={statusCode:c.status,text:h};if(c.status===200)try{p.json=JSON.parse(h)}catch(g){b.error(g)}r.callback==null||r.callback(p)})))).catch((c=>{b.error(c),r.callback==null||r.callback({statusCode:0,error:c})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Ci&&Ht.push({transport:"XHR",method:r=>{var e,t=new Ci;t.open(r.method||"GET",r.url,!0);var{contentType:i,body:s}=(e=ki(r))!==null&&e!==void 0?e:{};M(r.headers,(function(n,o){t.setRequestHeader(o,n)})),i&&t.setRequestHeader("Content-Type",i),r.timeout&&(t.timeout=r.timeout),r.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}r.callback==null||r.callback(n)}},t.send(s)}}),ee!=null&&ee.sendBeacon&&Ht.push({transport:"sendBeacon",method:r=>{var e=ri(r.url,{beacon:"1"});try{var t,{contentType:i,body:s}=(t=ki(r))!==null&&t!==void 0?t:{},n=typeof s=="string"?new Blob([s],{type:i}):s;ee.sendBeacon(e,n)}catch{}}});var si=function(r,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}};function Vs(r,e,t){return yt({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var no={exact:(r,e)=>e.some((t=>r.some((i=>t===i)))),is_not:(r,e)=>e.every((t=>r.every((i=>t!==i)))),regex:(r,e)=>e.some((t=>r.some((i=>si(t,i))))),not_regex:(r,e)=>e.every((t=>r.every((i=>!si(t,i))))),icontains:(r,e)=>e.map(Lt).some((t=>r.map(Lt).some((i=>t.includes(i))))),not_icontains:(r,e)=>e.map(Lt).every((t=>r.map(Lt).every((i=>!t.includes(i))))),gt:(r,e)=>e.some((t=>{var i=parseFloat(t);return!isNaN(i)&&r.some((s=>i>parseFloat(s)))})),lt:(r,e)=>e.some((t=>{var i=parseFloat(t);return!isNaN(i)&&r.some((s=>i<parseFloat(s)))}))},Lt=r=>r.toLowerCase();function oo(r,e){return!r||Object.entries(r).every((t=>{var[i,s]=t,n=e?.[i];if(f(n)||oe(n))return!1;var o=[String(n)],a=no[s.operator];return!!a&&a(s.values,o)}))}var Pi=N("[Error tracking]"),Er=class{constructor(e){var t,i;this.Zt=[],this.ti=new Hi([new Ui,new Ji,new Gi,new Bi,new zi,new Wi,new Vi,new Yi],Uo()),this._instance=e,this.Zt=(t=(i=this._instance.persistence)==null?void 0:i.get_property(Ki))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,i,s,n=(t=(i=e.errorTracking)==null?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],o=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Zt=n,this._instance.persistence&&this._instance.persistence.register({[Ki]:this.Zt,[xs]:o})}get ii(){var e,t=!!this._instance.get_property(xs),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void Pi.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void Pi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void Pi.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ri(e){if(e.length===0)return!1;var t=e.reduce(((i,s)=>{var{type:n,value:o}=s;return U(n)&&n.length>0&&i.$exception_types.push(n),U(o)&&o.length>0&&i.$exception_values.push(o),i}),{$exception_types:[],$exception_values:[]});return this.Zt.some((i=>{var s=i.values.map((n=>{var o,a=no[n.operator],l=T(n.value)?n.value:[n.value],u=(o=t[n.key])!==null&&o!==void 0?o:[];return l.length>0&&a(l,u)}));return i.type==="OR"?s.some(Boolean):s.every(Boolean)}))}si(e){return e.flatMap((t=>{var i,s;return(i=(s=t.stacktrace)==null?void 0:s.frames)!==null&&i!==void 0?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ni(e){if(e.length>0){var t,i,s,n,o=(t=(i=e[0].stacktrace)==null?void 0:i.frames)!==null&&t!==void 0?t:[],a=o[o.length-1];return(s=a==null||(n=a.filename)==null?void 0:n.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}ei(e){return!I(e)&&T(e)}},Q=N("[FeatureFlags]"),ut=N("[FeatureFlags]",{debugEnabled:!0}),Ma="errors_while_computing_flags",Aa="flag_missing",Da="quota_limited",Na="timeout",La="connection_error",ja="unknown_error",Ha=r=>"api_error_"+r,Si="$active_feature_flags",Ve="$override_feature_flags",Ws="$feature_flag_payloads",ht="$override_feature_flag_payloads",zs="$feature_flag_request_id",Ys="$feature_flag_evaluated_at",Js=r=>{var e={};for(var[t,i]of jt(r||{}))i&&(e[t]=i);return e},qa=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,(i=e[t].variant)!==null&&i!==void 0?i:e[t].enabled]}))),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return(i=e[t].metadata)==null?void 0:i.payload})).map((t=>{var i;return[t,(i=e[t].metadata)==null?void 0:i.payload]})))):Q.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},Ua=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({}),xr=class{constructor(e){this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.ci=!1,this._instance=e,this.featureFlagEventHandlers=[]}fi(){var e,t=(e=this._instance.config.evaluation_contexts)!==null&&e!==void 0?e:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.ci||(Q.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ci=!0),t!=null&&t.length?t.filter((i=>{var s=i&&typeof i=="string"&&i.trim().length>0;return s||Q.error("Invalid evaluation context found:",i,"Expected non-empty string"),s})):[]}pi(){return this.fi().length>0}flags(){if(this._instance.config.__preview_remote_config)this.di=!0;else{var e=!this.gi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.mi({disableFlags:e})}}get hasLoadedFlags(){return this.ai}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(Zi),t=this._instance.get_property(Ve),i=this._instance.get_property(ht);if(!i&&!t)return e||{};var s=L({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var o of n){var a,l,u=s[o],c=t?.[o],h=f(c)?(a=u?.enabled)!==null&&a!==void 0&&a:!!c,p=f(c)?u.variant:typeof c=="string"?c:void 0,g=i?.[o],v=w({},u,{enabled:h,variant:h?p??u?.variant:void 0});h!==u?.enabled&&(v.original_enabled=u?.enabled),p!==u?.variant&&(v.original_variant=u?.variant),g&&(v.metadata=w({},u?.metadata,{payload:g,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),s[o]=v}return this.oi||(Q.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.oi=!0),s}getFlagVariants(){var e=this._instance.get_property(Ke),t=this._instance.get_property(Ve);if(!t)return e||{};for(var i=L({},e),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.oi||(Q.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.oi=!0),i}getFlagPayloads(){var e=this._instance.get_property(Ws),t=this._instance.get_property(ht);if(!t)return e||{};for(var i=L({},e||{}),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.oi||(Q.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.oi=!0),i}reloadFeatureFlags(){this.ui||this._instance.config.advanced_disable_feature_flags||this.gi||(this._instance.bi.emit("featureFlagsReloading",!0),this.gi=setTimeout((()=>{this.mi()}),5))}yi(){clearTimeout(this.gi),this.gi=void 0}ensureFlagsLoaded(){this.ai||this.li||this.gi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ui=e}mi(e){var t;if(this.yi(),!this._instance.M())if(this.li)this.hi=!0;else{var i=this._instance.config.token,s=this._instance.get_property("$device_id"),n={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:w({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(mt)||{}),group_properties:this._instance.get_property(Le)};oe(s)||f(s)||(n.$device_id=s),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.pi()&&(n.evaluation_contexts=this.fi());var o=this._instance.config.__preview_remote_config,a=o?"/flags/?v=2":"/flags/?v=2&config=true",l=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",u=this._instance.requestRouter.endpointFor("flags",a+l);o&&(n.timezone=eo()),this.li=!0,this._instance._send_request({method:"POST",url:u,data:n,compression:this._instance.config.disable_compression?void 0:me.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:c=>{var h,p,g,v,_=!0;if(c.statusCode===200&&(this.hi||(this.$anon_distinct_id=void 0),_=!1),this.li=!1,this.di||(this.di=!0,this._instance.wi((v=c.json)!==null&&v!==void 0?v:{})),!n.disable_flags||this.hi){this.vi=!_;var m=[];c.error?c.error instanceof Error?m.push(c.error.name==="AbortError"?Na:La):m.push(ja):c.statusCode!==200&&m.push(Ha(c.statusCode)),(h=c.json)!=null&&h.errorsWhileComputingFlags&&m.push(Ma);var P=!((p=c.json)==null||(p=p.quotaLimited)==null||!p.includes(Ua.FeatureFlags));if(P&&m.push(Da),(g=this._instance.persistence)==null||g.register({[er]:m}),P)Q.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var k;n.disable_flags||this.receivedFeatureFlags((k=c.json)!==null&&k!==void 0?k:{},_),this.hi&&(this.hi=!1,this.mi())}}}})}}getFeatureFlag(e,t){var i;if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var s=this.getFeatureFlagResult(e,t);return(i=s?.variant)!==null&&i!==void 0?i:s?.enabled}Q.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants(),s=e in i,n=i[e],o=this.getFlagPayloads()[e],a=String(n),l=this._instance.get_property(zs)||void 0,u=this._instance.get_property(Ys)||void 0,c=this._instance.get_property(Vt)||{};if((t.send_event||!("send_event"in t))&&(!(e in c)||!c[e].includes(a))){var h,p,g,v,_,m,P,k,R,$;T(c[e])?c[e].push(a):c[e]=[a],(h=this._instance.persistence)==null||h.register({[Vt]:c});var x=this.getFeatureFlagDetails(e),H=[...(p=this._instance.get_property(er))!==null&&p!==void 0?p:[]];f(n)&&H.push(Aa);var C={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:o||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((g=this._instance.config.bootstrap)==null||(g=g.featureFlags)==null?void 0:g[e])||null,$feature_flag_bootstrapped_payload:((v=this._instance.config.bootstrap)==null||(v=v.featureFlagPayloads)==null?void 0:v[e])||null,$used_bootstrap_value:!this.vi};f(x==null||(_=x.metadata)==null?void 0:_.version)||(C.$feature_flag_version=x.metadata.version);var S,K=(m=x==null||(P=x.reason)==null?void 0:P.description)!==null&&m!==void 0?m:x==null||(k=x.reason)==null?void 0:k.code;K&&(C.$feature_flag_reason=K),x!=null&&(R=x.metadata)!=null&&R.id&&(C.$feature_flag_id=x.metadata.id),f(x?.original_variant)&&f(x?.original_enabled)||(C.$feature_flag_original_response=f(x.original_variant)?x.original_enabled:x.original_variant),x!=null&&($=x.metadata)!=null&&$.original_payload&&(C.$feature_flag_original_payload=x==null||(S=x.metadata)==null?void 0:S.original_payload),H.length&&(C.$feature_flag_error=H.join(",")),this._instance.capture("$feature_flag_called",C)}if(s){var W=o;if(!f(o))try{W=JSON.parse(o)}catch{}return{key:e,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:W}}}else Q.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var i=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.pi()&&(s.evaluation_contexts=this.fi()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:s,compression:this._instance.config.disable_compression?void 0:me.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var o,a=(o=n.json)==null?void 0:o.featureFlagPayloads;t(a?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return f(i)?void 0:!!i}Q.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ai=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(o,a,l,u,c){l===void 0&&(l={}),u===void 0&&(u={}),c===void 0&&(c={});var h=qa(o),p=h.flags,g=h.featureFlags,v=h.featureFlagPayloads;if(g){var _=o.requestId,m=o.evaluatedAt;if(T(g)){Q.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var P={};if(g)for(var k=0;k<g.length;k++)P[g[k]]=!0;a&&a.register({[Si]:g,[Ke]:P})}else{var R=g,$=v,x=p;if(o.errorsWhileComputingFlags)if(p){var H=new Set(Object.keys(p).filter((C=>{var S;return!((S=p[C])!=null&&S.failed)})));R=w({},l,Object.fromEntries(Object.entries(R).filter((C=>{var[S]=C;return H.has(S)})))),$=w({},u,Object.fromEntries(Object.entries($||{}).filter((C=>{var[S]=C;return H.has(S)})))),x=w({},c,Object.fromEntries(Object.entries(x||{}).filter((C=>{var[S]=C;return H.has(S)}))))}else R=w({},l,R),$=w({},u,$),x=w({},c,x);a&&a.register(w({[Si]:Object.keys(Js(R)),[Ke]:R||{},[Ws]:$||{},[Zi]:x||{}},_?{[zs]:_}:{},m?{[Ys]:m}:{}))}}})(e,this._instance.persistence,i,s,n),this.xi(t)}}override(e,t){t===void 0&&(t=!1),Q.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Q.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Ve),this._instance.persistence.unregister(ht),this.xi(),ut.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,i=e;if(this.oi=!!((t=i.suppressWarning)!==null&&t!==void 0&&t),"flags"in i){if(i.flags===!1)this._instance.persistence.unregister(Ve),ut.info("Flag overrides cleared");else if(i.flags){if(T(i.flags)){for(var s={},n=0;n<i.flags.length;n++)s[i.flags[n]]=!0;this._instance.persistence.register({[Ve]:s})}else this._instance.persistence.register({[Ve]:i.flags});ut.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this._instance.persistence.unregister(ht),ut.info("Payload overrides cleared")):i.payloads&&(this._instance.persistence.register({[ht]:i.payloads}),ut.info("Payload overrides set",{payloads:i.payloads}))),void this.xi()}this.xi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:i}=this.Ei();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,n=(this._instance.get_property(ft)||[]).find((u=>u.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};n&&(a.$early_access_feature_name=n.name),i&&(a.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=w({},this.getFlagVariants(),{[e]:t});(s=this._instance.persistence)==null||s.register({[Si]:Object.keys(Js(l)),[Ke]:l}),this.xi()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var s=this._instance.get_property(ft),n=i?"&"+i.map((o=>"stage="+o)).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+n),method:"GET",callback:o=>{var a,l;if(o.json){var u=o.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(ft),(l=this._instance.persistence)==null||l.register({[ft]:u}),e(u)}}})}Ei(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((i=>t[i])),flagVariants:Object.keys(t).filter((i=>t[i])).reduce(((i,s)=>(i[s]=t[s],i)),{})}}xi(e){var{flags:t,flagVariants:i}=this.Ei();this.featureFlagEventHandlers.forEach((s=>s(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(mt)||{};this._instance.register({[mt]:w({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(mt)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(Le)||{};Object.keys(i).length!==0&&Object.keys(i).forEach((s=>{i[s]=w({},i[s],e[s]),delete e[s]})),this._instance.register({[Le]:w({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Le)||{};this._instance.register({[Le]:w({},t,{[e]:{}})})}else this._instance.unregister(Le)}reset(){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.yi(),this.oi=!1}},Ba=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],xt=class{constructor(e,t){this.R=e,this.props={},this.$i=!1,this.Si=(i=>{var s="";return i.token&&(s=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+s+"_posthog"})(e),this.Y=this.ki(e),this.load(),e.debug&&b.info("Persistence loaded",e.persistence,w({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.Pi}ki(e){Ba.indexOf(e.persistence.toLowerCase())===-1&&(b.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(s){s===void 0&&(s=[]);var n=[...pa,...s];return w({},D,{W:function(o){try{var a={};try{a=ue.W(o)||{}}catch{}var l=L(a,JSON.parse(D.q(o)||"{}"));return D.G(o,l),l}catch{}return null},G:function(o,a,l,u,c,h){try{D.G(o,a,void 0,void 0,h);var p={};n.forEach((g=>{a[g]&&(p[g]=a[g])})),Object.keys(p).length&&ue.G(o,p,l,u,c,h)}catch(g){D.B(g)}},V:function(o,a){try{d?.localStorage.removeItem(o),ue.V(o,a)}catch(l){D.B(l)}}})})(e.cookie_persisted_properties||[]),i=e.persistence.toLowerCase();return i==="localstorage"&&D.H()?D:i==="localstorage+cookie"&&t.H()?t:i==="sessionstorage"&&B.H()?B:i==="memory"?ga:i==="cookie"?ue:t.H()?t:ue}properties(){var e={};return M(this.props,(function(t,i){if(i===Ke&&q(t))for(var s=Object.keys(t),n=0;n<s.length;n++)e["$feature/"+s[n]]=t[s[n]];else a=i,l=!1,(oe(o=Xo)?l:cs&&o.indexOf===cs?o.indexOf(a)!=-1:(M(o,(function(u){if(l||(l=u===a))return Bt})),l))||(e[i]=t);var o,a,l})),e}load(){if(!this.Pi){var e=this.Y.W(this.Si);e&&(this.props=L({},e))}}save(){this.Pi||this.Y.G(this.Si,this.props,this.Ti,this.Ii,this.Ci,this.R.debug)}remove(){this.Y.V(this.Si,!1),this.Y.V(this.Si,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(q(e)){f(t)&&(t="None"),this.Ti=f(i)?this.Ri:i;var s=!1;if(M(e,((n,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=n,s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(q(e)){this.Ti=f(t)?this.Ri:t;var i=!1;if(M(e,((s,n)=>{e.hasOwnProperty(n)&&this.props[n]!==s&&(this.props[n]=s,i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.$i){var e=Yn(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);Xe(Jr(e))||this.register(e),this.$i=!0}}update_search_keyword(){var e;this.register((e=y?.referrer)?Xn(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Kn(),$referring_domain:y!=null&&y.referrer&&((e=Xt(y.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[rr]||this.props[sr]||this.register_once({[Wt]:Zn(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};M([sr,rr],(o=>{var a=this.props[o];a&&M(a,(function(l,u){e["$initial_"+Oi(u)]=l}))}));var t,i,s=this.props[Wt];if(s){var n=(t=Qn(s),i={},M(t,(function(o,a){i["$initial_"+Oi(a)]=o})),i);L(e,n)}return e}safe_merge(e){return M(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this.Ri=this.Ti=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),u=[...a].sort();return l.every(((c,h)=>c===u[h]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var s=this.ki(e),n=this.props;this.clear(),this.Y=s,this.props=n,this.save()}}set_disabled(e){this.Pi=e,this.Pi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ii&&(this.Ii=e,this.remove(),this.save())}set_secure(e){e!==this.Ci&&(this.Ci=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[_t]||{};i[e]=t,this.props[_t]=i,this.save()}remove_event_timer(e){var t=(this.props[_t]||{})[e];return f(t)||(delete this.props[_t][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},Xs=N("[Product Tours]"),Fi="ph_product_tours",kr=class{constructor(e){this.Fi=null,this.Oi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[Ps]:!(e==null||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,t;this.Fi||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(Ps)||this.it((()=>this.Mi()))}it(e){var t,i;(t=E.__PosthogExtensions__)!=null&&t.generateProductTours?e():(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"product-tours",(s=>{s?Xs.error("Could not load product tours script",s):e()}))}Mi(){var e;!this.Fi&&(e=E.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Fi=E.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!T(this.Oi)||t){var i=this._instance.persistence;if(i){var s=i.props[Fi];if(T(s)&&!t)return this.Oi=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:n=>{var o=n.statusCode;if(o!==200||!n.json){var a="Product Tours API could not be loaded, status: "+o;return Xs.error(a),void e([],{isLoaded:!1,error:a})}var l=T(n.json.product_tours)?n.json.product_tours:[];this.Oi=l,i&&i.register({[Fi]:l}),e(l,{isLoaded:!0})}})}else e(this.Oi,{isLoaded:!0})}getActiveProductTours(e){I(this.Fi)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Fi.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Fi)==null||t.showTourById(e)}previewTour(e){this.Fi?this.Fi.previewTour(e):this.it((()=>{var t;this.Mi(),(t=this.Fi)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Fi)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Fi)==null||e.nextStep()}previousStep(){var e;(e=this.Fi)==null||e.previousStep()}clearCache(){var e;this.Oi=null,(e=this._instance.persistence)==null||e.unregister(Fi)}resetTour(e){var t;(t=this.Fi)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Fi)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Fi)==null||t.cancelPendingTour(e)}},dt=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),Qa=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),el=(function(r){return r.TopLeft="top_left",r.TopRight="top_right",r.TopCenter="top_center",r.MiddleLeft="middle_left",r.MiddleRight="middle_right",r.MiddleCenter="middle_center",r.Left="left",r.Center="center",r.Right="right",r.NextToTrigger="next_to_trigger",r})({}),tl=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),$i=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),il=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),rl=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),sl=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),bt=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),Ii=(function(r){return r.SURVEY_ID="$survey_id",r.SURVEY_NAME="$survey_name",r.SURVEY_RESPONSE="$survey_response",r.SURVEY_ITERATION="$survey_iteration",r.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",r.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",r.SURVEY_SUBMISSION_ID="$survey_submission_id",r.SURVEY_QUESTIONS="$survey_questions",r.SURVEY_COMPLETED="$survey_completed",r.PRODUCT_TOUR_ID="$product_tour_id",r.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",r})({}),Pr=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),O=N("[Surveys]"),ao="seenSurvey_",Ga=(r,e)=>{var t="$survey_"+e+"/"+r.id;return r.current_iteration&&r.current_iteration>0&&(t="$survey_"+e+"/"+r.id+"/"+r.current_iteration),t},Ks=r=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})(ao,r),Va=[$i.Popover,$i.Widget,$i.API],Wa={ignoreConditions:!1,ignoreDelay:!1,displayType:Pr.Popover},Rt=class{constructor(){this.Ai={},this.Ai={}}on(e,t){return this.Ai[e]||(this.Ai[e]=[]),this.Ai[e].push(t),()=>{this.Ai[e]=this.Ai[e].filter((i=>i!==t))}}emit(e,t){for(var i of this.Ai[e]||[])i(t);for(var s of this.Ai["*"]||[])s(e,t)}};function We(r,e,t){if(I(r))return!1;switch(t){case"exact":return r===e;case"contains":var i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(r);case"regex":try{return new RegExp(e).test(r)}catch{return!1}default:return!1}}var Sr=class{constructor(e){this.ji=new Rt,this.Di=(t,i)=>this.Li(t,i)&&this.Ni(t,i)&&this.Ui(t,i)&&this.zi(t,i),this.Li=(t,i)=>i==null||!i.event||t?.event===i?.event,this._instance=e,this.Hi=new Set,this.Bi=new Set}init(){var e;if(!f((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook(((i,s)=>{this.on(i,s)}))}}register(e){var t,i;if(!f((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((o=>{var a,l;(a=this.Bi)==null||a.add(o),(l=o.steps)==null||l.forEach((u=>{var c;(c=this.Hi)==null||c.add(u?.event||"")}))})),(i=this._instance)!=null&&i.autocapture)){var s,n=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((l=>{l!=null&&l.selector&&n.add(l?.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(n)}}on(e,t){var i;t!=null&&e.length!=0&&(this.Hi.has(e)||this.Hi.has(t?.event))&&this.Bi&&((i=this.Bi)==null?void 0:i.size)>0&&this.Bi.forEach((s=>{this.qi(t,s)&&this.ji.emit("actionCaptured",s.name)}))}Wi(e){this.onAction("actionCaptured",(t=>e(t)))}qi(e,t){if(t?.steps==null)return!1;for(var i of t.steps)if(this.Di(e,i))return!0;return!1}onAction(e,t){return this.ji.on(e,t)}Ni(e,t){if(t!=null&&t.url){var i,s=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!s||typeof s!="string"||!We(s,t.url,t.url_matching||"contains"))return!1}return!0}Ui(e,t){return!!this.Gi(e,t)&&!!this.Vi(e,t)&&!!this.Ji(e,t)}Gi(e,t){var i;if(t==null||!t.href)return!0;var s=this.Ki(e);if(s.length>0)return s.some((a=>We(a.href,t.href,t.href_matching||"exact")));var n,o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!o&&We((n=o.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}Vi(e,t){var i;if(t==null||!t.text)return!0;var s=this.Ki(e);if(s.length>0)return s.some((u=>We(u.text,t.text,t.text_matching||"exact")||We(u.$el_text,t.text,t.text_matching||"exact")));var n,o,a,l=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!l&&(n=(function(u){for(var c,h=[],p=/(?::|")text="(.*?)"/g;!I(c=p.exec(u));)h.includes(c[1])||h.push(c[1]);return h})(l),o=t.text,a=t.text_matching||"exact",n.some((u=>We(u,o,a))))}Ji(e,t){var i,s;if(t==null||!t.selector)return!0;var n=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var o=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}Ki(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}zi(e,t){return t==null||!t.properties||t.properties.length===0||oo(t.properties.reduce(((i,s)=>{var n=T(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return i[s.key]={values:n,operator:s.operator||"exact"},i}),{}),e?.properties)}},Fr=class{constructor(e){this._instance=e,this.Yi=new Map,this.Xi=new Map,this.Qi=new Map}Zi(e,t){return!!e&&oo(e.propertyFilters,t?.properties)}te(e,t){var i=new Map;return e.forEach((s=>{var n;(n=s.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach((o=>{if(o!=null&&o.name){var a=i.get(o.name)||[];a.push(s.id),i.set(o.name,a)}}))})),i}ie(e,t,i){var s=(i===dt.Activation?this.Yi:this.Xi).get(e),n=[];return this.ee((o=>{n=o.filter((a=>s?.includes(a.id)))})),n.filter((o=>{var a,l=(a=o.conditions)==null||(a=a[i])==null||(a=a.values)==null?void 0:a.find((u=>u.name===e));return this.Zi(l,t)}))}register(e){var t;f((t=this._instance)==null?void 0:t._addCaptureHook)||(this.re(e),this.se(e))}se(e){var t=e.filter((i=>{var s,n;return((s=i.conditions)==null?void 0:s.actions)&&((n=i.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.ne==null&&(this.ne=new Sr(this._instance),this.ne.init(),this.ne.Wi((i=>{this.onAction(i)}))),t.forEach((i=>{var s,n,o,a,l;i.conditions&&(s=i.conditions)!=null&&s.actions&&(n=i.conditions)!=null&&(n=n.actions)!=null&&n.values&&((o=i.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.ne)==null||a.register(i.conditions.actions.values),(l=i.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((u=>{if(u&&u.name){var c=this.Qi.get(u.name);c&&c.push(i.id),this.Qi.set(u.name,c||[i.id])}})))})))}re(e){var t,i=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})),s=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}));(i.length!==0||s.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((n,o)=>{this.onEvent(n,o)})),this.Yi=this.te(e,dt.Activation),this.Xi=this.te(e,dt.Cancellation))}onEvent(e,t){var i,s=this.oe(),n=this.ae(),o=this.le(),a=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[n])||[];if(o===e&&t&&a.length>0){var l,u;s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var c=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(u=t.properties)==null?void 0:u.$product_tour_id);if(c){var h=a.indexOf(c);h>=0&&(a.splice(h,1),this.ue(a))}}else{if(this.Xi.has(e)){var p=this.ie(e,t,dt.Cancellation);p.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:p.map((v=>v.id))}),p.forEach((v=>{var _=a.indexOf(v.id);_>=0&&a.splice(_,1),this.he(v.id)})),this.ue(a))}if(this.Yi.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.Yi.get(e)});var g=this.ie(e,t,dt.Activation);this.ue(a.concat(g.map((v=>v.id))||[]))}}}onAction(e){var t,i=this.ae(),s=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[i])||[];this.Qi.has(e)&&this.ue(s.concat(this.Qi.get(e)||[]))}ue(e){var t,i=this.oe(),s=this.ae(),n=[...new Set(e)].filter((o=>!this.de(o)));i.info("updating activated items",{activatedItems:n}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[s]:n})}getActivatedIds(){var e,t=this.ae(),i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return i||[]}getEventToItemsMap(){return this.Yi}ve(){return this.ne}},$r=class extends Fr{constructor(e){super(e)}ae(){return"$surveys_activated"}le(){return bt.SHOWN}ee(e){var t;(t=this._instance)==null||t.getSurveys(e)}he(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}oe(){return O}de(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Ir=class{constructor(e){this.ce=void 0,this._surveyManager=null,this.fe=!1,this.pe=[],this.ge=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(I(t))return O.warn("Flags not loaded yet. Not loading surveys.");var i=T(t);this.ce=i?t.length>0:t,O.info("flags response received, isSurveysEnabled: "+this.ce),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(i!=null&&i.startsWith(ao)||i!=null&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((s=>localStorage.removeItem(s)))}loadIfEnabled(){if(!this._surveyManager)if(this.fe)O.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)O.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())O.info("Not loading surveys in cookieless mode without consent.");else{var e=E?.__PosthogExtensions__;if(e){if(!f(this.ce)||this._instance.config.advanced_enable_surveys){var t=this.ce||this._instance.config.advanced_enable_surveys;this.fe=!0;try{var i=e.generateSurveys;if(i)return void this._e(i,t);var s=e.loadExternalDependency;if(!s)return void this.me("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",(n=>{n||!e.generateSurveys?this.me("Could not load surveys script",n):this._e(e.generateSurveys,t)}))}catch(n){throw this.me("Error initializing surveys",n),n}finally{this.fe=!1}}}else O.error("PostHog Extensions not found.")}}_e(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new $r(this._instance),O.info("Surveys loaded successfully"),this.be({isLoaded:!0})}me(e,t){O.error(e,t),this.be({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.pe.push(e),this._surveyManager&&this.be({isLoaded:!0}),()=>{this.pe=this.pe.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return O.info("Disabled. Not loading surveys."),e([]);var i,s=this._instance.get_property(Qi);if(s&&!t)return e(s,{isLoaded:!0});typeof Promise<"u"&&this.ge?this.ge.then((n=>{var{surveys:o,context:a}=n;return e(o,a)})):(typeof Promise<"u"&&(this.ge=new Promise((n=>{i=n}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:n=>{var o;this.ge=null;var a=n.statusCode;if(a!==200||!n.json){var l="Surveys API could not be loaded, status: "+a;O.error(l);var u={isLoaded:!1,error:l};return e([],u),void(i==null||i({surveys:[],context:u}))}var c,h=n.json.surveys||[],p=h.filter((v=>(function(_){return!(!_.start_date||_.end_date)})(v)&&((function(_){var m;return!((m=_.conditions)==null||(m=m.events)==null||(m=m.values)==null||!m.length)})(v)||(function(_){var m;return!((m=_.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)})(v))));p.length>0&&((c=this._surveyEventReceiver)==null||c.register(p)),(o=this._instance.persistence)==null||o.register({[Qi]:h});var g={isLoaded:!0};e(h,g),i?.({surveys:h,context:g})}}))}be(e){for(var t of this.pe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){O.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!I(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);O.warn("init was not called")}ye(e){var t=null;return this.getSurveys((i=>{var s;t=(s=i.find((n=>n.id===e)))!==null&&s!==void 0?s:null})),t}we(e){if(I(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.ye(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(I(this._surveyManager))return O.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.we(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return I(this._surveyManager)?(O.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((i=>{this.getSurveys((s=>{var n,o=(n=s.find((l=>l.id===e)))!==null&&n!==void 0?n:null;if(o){var a=this.we(o);i({visible:a.eligible,disabledReason:a.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,i){var s;if(I(this._surveyManager))O.warn("init was not called");else{var n=typeof e=="string"?this.ye(e):e;if(n!=null&&n.id)if(Va.includes(n.type)){var o=y?.querySelector(t);if(o)return(s=n.appearance)!=null&&s.surveyPopupDelaySeconds?(O.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;O.info("Rendering survey "+n.id+" with delay of "+((a=n.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(n,o,i),O.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,o,i);O.warn("Survey element not found")}else O.warn("Surveys of type "+n.type+" cannot be rendered in the app");else O.warn("Survey not found")}}displaySurvey(e,t){var i;if(I(this._surveyManager))O.warn("init was not called");else{var s=this.ye(e);if(s){var n=s;if((i=s.appearance)!=null&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=w({},s,{appearance:w({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Pr.Popover&&t.initialResponses&&O.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.canRenderSurvey(s);if(!o.visible)return void O.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Pr.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else O.warn("Survey not found")}}cancelPendingSurvey(e){I(this._surveyManager)?O.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},ge=N("[Conversations]"),Rr=class{constructor(e){this.xe=void 0,this._conversationsManager=null,this.Ee=!1,this.$e=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;I(t)||(be(t)?this.xe=t:(this.xe=t.enabled,this.$e=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.xe=void 0,this.$e=null}loadIfEnabled(){if(!this._conversationsManager&&!this.Ee&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=E?.__PosthogExtensions__;if(e&&!f(this.xe)&&this.xe)if(this.$e&&this.$e.token){this.Ee=!0;try{var t=e.initConversations;if(t)return this.Se(t),void(this.Ee=!1);var i=e.loadExternalDependency;if(!i)return void this.ke("PostHog loadExternalDependency extension not found.");i(this._instance,"conversations",(s=>{s||!e.initConversations?this.ke("Could not load conversations script",s):this.Se(e.initConversations),this.Ee=!1}))}catch(s){this.ke("Error initializing conversations",s),this.Ee=!1}}else ge.error("Conversations enabled but missing token in remote config.")}}Se(e){if(this.$e)try{this._conversationsManager=e(this.$e,this._instance),ge.info("Conversations loaded successfully")}catch(t){this.ke("Error completing conversations initialization",t)}else ge.error("Cannot complete initialization: remote config is null")}ke(e,t){ge.error(e,t),this._conversationsManager=null,this.Ee=!1}show(){this._conversationsManager?this._conversationsManager.show():ge.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.xe===!0&&!oe(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,i){var s=this;return Je((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(ge.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var i=this;return Je((function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(ge.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return Je((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(ge.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return Je((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(ge.warn("Conversations not available yet."),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}},Tr=class{constructor(e){var t;this.Pe=!1,this.Te=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Pe=!0)}onRemoteConfig(e){var t,i=(t=e.logs)==null?void 0:t.captureConsoleLogs;!I(i)&&i&&(this.Pe=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Pe&&!this.Te){var e=N("[logs]"),t=E?.__PosthogExtensions__;if(t){var i=t.loadExternalDependency;i?i(this._instance,"logs",(s=>{var n;s||(n=t.logs)==null||!n.initializeLogs?e.error("Could not load logs script",s):(t.logs.initializeLogs(this._instance),this.Te=!0)})):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}},Zs=N("[RateLimiter]"),Cr=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((s=>{Zs.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4}))}catch(s){return void Zs.warn('could not rate limit - continuing. Error: "'+s?.message+'"',{text:i})}},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,i,s;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(i=this.instance.persistence)==null?void 0:i.get_property(ir))!==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 u=l.tokens<1;return u||e||(l.tokens=Math.max(0,l.tokens-1)),!u||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=u,(s=this.instance.persistence)==null||s.set_property(ir,l),{isRateLimited:u,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},Ne=N("[RemoteConfig]"),Or=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=E._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Ie(e){var t,i;(t=E.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(Ne.error("PostHog Extensions not found. Cannot load remote config."),e())}Ce(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 Ne.info("Using preloaded remote config",this.remoteConfig),void this.wi(this.remoteConfig);if(this._instance.M())return void Ne.warn("Remote config is disabled. Falling back to local config.");this.Ie((e=>{if(!e)return Ne.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ce((t=>{this.wi(t)}));this.wi(e)}))}catch(e){Ne.error("Error loading remote config",e)}}wi(e){e?this._instance.config.__preview_remote_config?(this._instance.wi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):Ne.info("__preview_remote_config is disabled. Logging config instead",e):Ne.error("Failed to fetch remote config from PostHog.")}},Mr=3e3,Ar=class{constructor(e,t){this.Re=!0,this.Fe=[],this.Oe=he(t?.flush_interval_ms||Mr,250,5e3,b.createLogger("flush interval"),Mr),this.Me=e}enqueue(e){this.Fe.push(e),this.Ae||this.je()}unload(){this.De();var e=this.Fe.length>0?this.Le():{},t=Object.values(e);[...t.filter((i=>i.url.indexOf("/e")===0)),...t.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.Me(w({},i,{transport:"sendBeacon"}))}))}enable(){this.Re=!1,this.je()}je(){var e=this;this.Re||(this.Ae=setTimeout((()=>{if(this.De(),this.Fe.length>0){var t=this.Le(),i=function(){var n=t[s],o=new Date().getTime();n.data&&T(n.data)&&M(n.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.Me(n)};for(var s in t)i()}}),this.Oe))}De(){clearTimeout(this.Ae),this.Ae=void 0}Le(){var e={};return M(this.Fe,(t=>{var i,s=t,n=(s?s.batchKey:null)||s.url;f(e[n])&&(e[n]=w({},s,{data:[]})),(i=e[n].data)==null||i.push(s.data)})),this.Fe=[],e}},za=["retriesPerformedSoFar"],Dr=class{constructor(e){this.Ne=!1,this.Ue=3e3,this.Fe=[],this._instance=e,this.Fe=[],this.ze=!0,!f(d)&&"onLine"in d.navigator&&(this.ze=d.navigator.onLine,this.He=()=>{this.ze=!0,this.Lt()},this.Be=()=>{this.ze=!1},j(d,"online",this.He),j(d,"offline",this.Be))}get length(){return this.Fe.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=nn(e,za);ze(t)&&(i.url=ri(i.url,{retry_count:t})),this._instance._send_request(w({},i,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(t??0)<10?this.qe(w({retriesPerformedSoFar:t},i)):i.callback==null||i.callback(s)}}))}qe(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=(function(o){var a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),c=(Math.random()-.5)*(u-l);return Math.ceil(u+c)})(t),s=Date.now()+i;this.Fe.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in "+i;navigator.onLine||(n+=" (Browser is offline)"),b.warn(n),this.Ne||(this.Ne=!0,this.We())}We(){if(this.Ge&&clearTimeout(this.Ge),this.Fe.length===0)return this.Ne=!1,void(this.Ge=void 0);this.Ge=setTimeout((()=>{this.ze&&this.Fe.length>0&&this.Lt(),this.We()}),this.Ue)}Lt(){var e=Date.now(),t=[],i=this.Fe.filter((n=>n.retryAt<e||(t.push(n),!1)));if(this.Fe=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Ge&&(clearTimeout(this.Ge),this.Ge=void 0),this.Ne=!1,f(d)||(this.He&&(d.removeEventListener("online",this.He),this.He=void 0),this.Be&&(d.removeEventListener("offline",this.Be),this.Be=void 0)),this.Fe))try{this._instance._send_request(w({},e,{transport:"sendBeacon"}))}catch(t){b.error(t)}this.Fe=[]}},Nr=class{constructor(e){this.Ve=()=>{var t,i,s,n;this.Je||(this.Je={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=a+(o?.clientHeight||0),c=o?.scrollHeight||0;this.Je.lastScrollY=Math.ceil(a),this.Je.maxScrollY=Math.max(a,(t=this.Je.maxScrollY)!==null&&t!==void 0?t:0),this.Je.maxScrollHeight=Math.max(l,(i=this.Je.maxScrollHeight)!==null&&i!==void 0?i:0),this.Je.lastContentY=u,this.Je.maxContentY=Math.max(u,(s=this.Je.maxContentY)!==null&&s!==void 0?s:0),this.Je.maxContentHeight=Math.max(c,(n=this.Je.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}getContext(){return this.Je}resetContext(){var e=this.Je;return setTimeout(this.Ve,0),e}startMeasuringScrollPosition(){j(d,"scroll",this.Ve,{capture:!0}),j(d,"scrollend",this.Ve,{capture:!0}),j(d,"resize",this.Ve)}scrollElement(){if(!this._instance.config.scroll_root_selector)return d?.document.documentElement;var e=T(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=d?.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return d&&(d.scrollY||d.pageYOffset||d.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return d&&(d.scrollX||d.pageXOffset||d.document.documentElement.scrollLeft)||0}},Ya=r=>Zn(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties),ni=class{constructor(e,t,i,s){this.Ke=n=>{var o=this.Ye();if(!o||o.sessionId!==n){var a={sessionId:n,props:this.Xe(this._instance)};this.Qe.register({[tr]:a})}},this._instance=e,this.Ze=t,this.Qe=i,this.Xe=s||Ya,this.Ze.onSessionId(this.Ke)}Ye(){return this.Qe.props[tr]}getSetOnceProps(){var e,t=(e=this.Ye())==null?void 0:e.props;return t?"r"in t?Qn(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 M(Jr(this.getSetOnceProps()),((t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+Oi(i)]=t})),e}},Ri=N("[SessionId]"),oi=class{on(e,t){return this.tr.on(e,t)}constructor(e,t,i){var s;if(this.ir=[],this.er=void 0,this.tr=new Rt,this.rr=(c,h)=>!(!ze(c)||!ze(h))&&Math.abs(c-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=e.config,this.Qe=e.persistence,this.sr=void 0,this.nr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ar=t||Te,this.lr=i||Te;var n=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*he(o,60,36e3,Ri.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ur(),this.hr="ph_"+n+"_window_id",this.dr="ph_"+n+"_primary_window_exists",this.vr()){var a=B.W(this.hr),l=B.W(this.dr);a&&!l?this.sr=a:B.V(this.hr),B.G(this.dr,!0)}if((s=this.R.bootstrap)!=null&&s.sessionID)try{var u=(c=>{var h=c.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.R.bootstrap.sessionID);this.cr(this.R.bootstrap.sessionID,new Date().getTime(),u)}catch(c){Ri.error("Invalid sessionID in bootstrap",c)}this.pr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return f(this.ir)&&(this.ir=[]),this.ir.push(e),this.nr&&e(this.nr,this.sr),()=>{this.ir=this.ir.filter((t=>t!==e))}}vr(){return this.R.persistence!=="memory"&&!this.Qe.Pi&&B.H()}gr(e){e!==this.sr&&(this.sr=e,this.vr()&&B.G(this.hr,e))}_r(){return this.sr?this.sr:this.vr()?B.W(this.hr):null}cr(e,t,i){e===this.nr&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.nr=e,this.Qe.register({[Gt]:[t,e,i]}))}mr(){var e=this.Qe.props[Gt];return T(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.cr(null,null,null)}destroy(){clearTimeout(this.br),this.br=void 0,this.er&&d&&(d.removeEventListener("beforeunload",this.er,{capture:!1}),this.er=void 0),this.ir=[]}pr(){this.er=()=>{this.vr()&&B.V(this.dr)},j(d,"beforeunload",this.er,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.R.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||new Date().getTime(),[s,n,o]=this.mr(),a=this._r(),l=ze(o)&&Math.abs(i-o)>864e5,u=!1,c=!n,h=!c&&!e&&this.rr(i,s);c||h||l?(n=this.ar(),a=this.lr(),Ri.info("new session ID generated",{sessionId:n,windowId:a,changeReason:{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}}),o=i,u=!0):a||(a=this.lr(),u=!0);var p=ze(s)&&e&&!l?s:i,g=ze(o)?o:new Date().getTime();return this.gr(a),this.cr(n,p,g),e||this.ur(),u&&this.ir.forEach((v=>v(n,a,u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0))),{sessionId:n,windowId:a,sessionStartTimestamp:g,changeReason:u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}ur(){clearTimeout(this.br),this.br=setTimeout((()=>{var[e]=this.mr();if(this.rr(new Date().getTime(),e)){var t=this.nr;this.resetSessionId(),this.tr.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},Ja=["$set_once","$set"],Ie=N("[SiteApps]"),Lr=class{constructor(e){this._instance=e,this.yr=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}wr(e,t){if(t){var i=this.globalsForEvent(t);this.yr.push(i),this.yr.length>1e3&&(this.yr=this.yr.slice(10))}}get siteAppLoaders(){var e;return(e=E._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.wr.bind(this));this.Er=()=>{e(),this.yr=[],this.Er=void 0}}}globalsForEvent(e){var t,i,s,n,o,a,l;if(!e)throw new Error("Event payload is required");var u={},c=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[p,g]of Object.entries(h))u[p]={id:c[p],type:p,properties:g};var{$set_once:v,$set:_}=e;return{event:w({},nn(e,Ja),{properties:w({},e.properties,_?{$set:w({},(t=(i=e.properties)==null?void 0:i.$set)!==null&&t!==void 0?t:{},_)}:{},v?{$set_once:w({},(s=(n=e.properties)==null?void 0:n.$set_once)!==null&&s!==void 0?s:{},v)}:{}),elements_chain:(o=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var a;!t.errored&&this.yr.length&&(Ie.info("Processing "+this.yr.length+" events for site app with id "+e.id),this.yr.forEach((l=>t.processEvent==null?void 0:t.processEvent(l))),t.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((a=this.Er)==null||a.call(this))},s=!1,n=a=>{t.errored=!a,t.loaded=!0,Ie.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),s&&i()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{n(a)}});o&&(t.processEvent=o),s=!0}catch(a){Ie.error("Error while initializing PostHog app with config id "+e.id,a),n(!1)}if(s&&t.loaded)try{i()}catch(a){Ie.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}$r(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}Sr(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{i.processEvent==null||i.processEvent(t)}catch(s){Ie.error("Error while processing event "+e.event+" for site app "+i.id,s)}}}onRemoteConfig(e){var t,i,s,n=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.$r(),void this._instance.on("eventCaptured",(u=>this.Sr(u)))):void Ie.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.Er)==null||i.call(this),(s=e.siteApps)!=null&&s.length)if(this.isEnabled){var o=function(u){var c;E["__$$ph_site_app_"+u]=n._instance,(c=E.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(n._instance,l,(h=>{if(h)return Ie.error("Error while initializing PostHog app with config id "+u,h)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else Ie.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},lo=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&ds(t,e))return!0;try{var i=r?.userAgentData;if(i!=null&&i.brands&&i.brands.some((s=>ds(s?.brand,e))))return!0}catch{}return!!r.webdriver},wt=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),Qs="i.posthog.com",jr=class{constructor(e){this.kr={},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("."+Qs,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.kr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.kr[this.apiHost]=wt.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.kr[this.apiHost]=wt.EU:this.kr[this.apiHost]=wt.CUSTOM),this.kr[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===wt.CUSTOM)return this.apiHost+t;var i=Qs+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}},Xa={icontains:(r,e)=>!!d&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!d&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!d&&si(e.href,r),not_regex:(r,e)=>!!d&&!si(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r},Hr=class r{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),t.getWebExperiments((s=>{r.Pr("retrieved web experiments from the server"),t.Tr=new Map,s.forEach((n=>{if(n.feature_flag_key){var o;t.Tr&&(r.Pr("setting flag key ",n.feature_flag_key," to web experiment ",n),(o=t.Tr)==null||o.set(n.feature_flag_key,n));var a=t._instance.getFeatureFlag(n.feature_flag_key);U(a)&&n.variants[a]&&t.Ir(n.name,a,n.variants[a].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];r.Cr(u)&&t.Ir(n.name,l,u.transforms)}}))}),i)},this._instance=e,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}onFeatureFlags(e){if(this._is_bot())r.Pr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(I(this.Tr))return this.Tr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();r.Pr("applying feature flags",e),e.forEach((t=>{var i;if(this.Tr&&(i=this.Tr)!=null&&i.has(t)){var s,n=this._instance.getFeatureFlag(t),o=(s=this.Tr)==null?void 0:s.get(t);n&&o!=null&&o.variants[n]&&this.Ir(o.name,n,o.variants[n].transforms)}}))}}previewWebExperiment(){var e=r.getWindowLocation();if(e!=null&&e.search){var t=Kt(e?.search,"__experiment_id"),i=Kt(e?.search,"__experiment_variant");t&&i&&(r.Pr("previewing web experiments "+t+" && "+i),this.getWebExperiments((s=>{this.Rr(parseInt(t),i,s)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:n=>{if(n.statusCode!==200||!n.json)return e([]);var o=n.json.experiments||[];return e(o)}})}Rr(e,t,i){var s=i.filter((n=>n.id===e));s&&s.length>0&&(r.Pr("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.Ir(s[0].name,t,s[0].variants[t].transforms))}static Cr(e){return!I(e.conditions)&&r.Fr(e)&&r.Or(e)}static Fr(e){var t;if(I(e.conditions)||I((t=e.conditions)==null?void 0:t.url))return!0;var i,s,n,o=r.getWindowLocation();return!!o&&((i=e.conditions)==null||!i.url||Xa[(s=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,o))}static getWindowLocation(){return d?.location}static Or(e){var t;if(I(e.conditions)||I((t=e.conditions)==null?void 0:t.utm))return!0;var i=Yn();if(i.utm_source){var s,n,o,a,l,u,c,h,p=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==i.utm_campaign,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)==i.utm_source,v=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==i.utm_medium,_=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==i.utm_term;return p&&v&&_&&g}return!1}static Pr(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];b.info("[WebExperiments] "+e,i)}Ir(e,t,i){this._is_bot()?r.Pr("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?i.forEach((s=>{if(s.selector){var n;r.Pr("applying transform of variant "+t+" for experiment "+e+" ",s);var o=(n=document)==null?void 0:n.querySelectorAll(s.selector);o?.forEach((a=>{var l=a;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)}))}})):r.Pr("Control variants leave the page unmodified.")}_is_bot(){return ee&&this._instance?lo(ee,this._instance.config.custom_blocked_useragents):void 0}},Ka=N("[PostHog ExternalIntegrations]"),Za={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},qr=class{constructor(e){this._instance=e}it(e,t){var i;(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,(s=>{if(s)return Ka.error("failed to load script",s);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,u;!s||(a=E.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(Za[o],(()=>{var c;(c=E.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)})),!s&&(l=E.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((u=E.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.stop())};for(var[i,s]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(i)}}},Ur="[SessionRecording]",pt=N(Ur),ai=class{get started(){var e;return!((e=this.Mr)==null||!e.isStarted)}get status(){return this.Mr?this.Mr.status:this.Ar&&!this.jr?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Ar=!1,this.Dr=void 0,this._instance=e,!this._instance.sessionManager)throw pt.error("started without valid sessionManager"),new Error(Ur+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Ur+' cannot be used with cookieless_mode="always"')}get jr(){var e,t=!((e=this._instance.get_property(fi))==null||!e.enabled),i=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return d&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this.jr||(t=this.Mr)==null||!t.isStarted){var i=!f(Object.assign)&&!f(Array.from);this.jr&&i?(this.Lr(e),pt.info("starting")):this.stopRecording()}}Lr(e){var t,i,s;this.jr&&(E!=null&&(t=E.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=E.__PosthogExtensions__)!=null&&i.initSessionRecording?this.Nr(e):(s=E.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.Ur,(n=>{if(n)return pt.error("could not load recorder",n);this.Nr(e)})))}stopRecording(){var e,t;(e=this.Dr)==null||e.call(this),this.Dr=void 0,(t=this.Mr)==null||t.stop()}zr(){var e;(e=this._instance.persistence)==null||e.unregister(Tn)}Hr(e){if(this._instance.persistence){var t,i,s=this._instance.persistence,n=()=>{var o=e.sessionRecording===!1?void 0:e.sessionRecording,a=o?.sampleRate,l=I(a)?null:parseFloat(a);I(l)&&this.zr();var u=o?.minimumDurationMilliseconds;s.register({[fi]:w({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:w({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:f(u)?null:u,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers})})};n(),(t=this.Dr)==null||t.call(this),this.Dr=(i=this._instance.sessionManager)==null?void 0:i.onSessionId(n)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.Hr(e),this.Ar=!0,this.startIfEnabledOrStop()):this.Ar=!0:pt.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;t===void 0&&(t="log"),(i=this.Mr)!=null&&i.log?this.Mr.log(e,t):pt.warn("log called before recorder was ready")}get Ur(){var e,t,i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(fi);return(i==null||(t=i.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Nr(e){var t,i;if((t=E.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Mr||(this.Mr=(i=E.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.Mr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Mr.start(e)}onRRwebEmit(e){var t;(t=this.Mr)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Mr||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.Mr)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Mr||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.Mr)==null||e.overrideSampling()}overrideTrigger(e){var t,i;this.Mr||(i=this._instance.persistence)==null||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Mr)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Mr)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!((i=this.Mr)==null||!i.tryAddCustomEvent(e,t))}},kt={},Br=()=>{},Ye="posthog",co=!Oa&&X?.indexOf("MSIE")===-1&&X?.indexOf("Mozilla")===-1,en=r=>{var e;return w({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Jo(y?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Br,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:r??"unset",__preview_deferred_init_extensions:!1,debug:G&&U(G?.search)&&G.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:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(d==null||(e=d.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;b.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Mr},error_tracking:{},_onCapture:Br,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},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}))(r))},tn=r=>{var e={};f(r.process_person)||(e.person_profiles=r.process_person),f(r.xhr_headers)||(e.request_headers=r.xhr_headers),f(r.cookie_name)||(e.persistence_name=r.cookie_name),f(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),f(r.store_google)||(e.save_campaign_params=r.store_google),f(r.verbose)||(e.debug=r.verbose);var t=L({},e,r);return T(r.property_blacklist)&&(f(r.property_denylist)?t.property_denylist=r.property_blacklist:T(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:b.error("Invalid value for property_denylist config: "+r.property_denylist)),t},Gr=class{constructor(){this.__forceAllowLocalhost=!1}get Br(){return this.__forceAllowLocalhost}set Br(e){b.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},li=class r{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new Gr,this.qr=!1,this.version=ve.LIB_VERSION,this.bi=new Rt,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=en(),this.SentryIntegration=pr,this.sentryIntegration=e=>(function(t,i){var s=zn(t,i);return{name:Wn,processEvent:n=>s(n)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Wr=!1,this.Gr=null,this.Vr=null,this.Jr=null,this.featureFlags=new xr(this),this.toolbar=new gr(this),this.scrollManager=new Nr(this),this.pageViewManager=new ei(this),this.surveys=new Ir(this),this.conversations=new Rr(this),this.logs=new Tr(this),this.experiments=new Hr(this),this.exceptions=new Er(this),this.rateLimiter=new Cr(this),this.requestRouter=new jr(this),this.consent=new ur(this),this.externalIntegrations=new qr(this),this.people={set:(e,t,i)=>{var s=U(e)?{[e]:t}:e;this.setPersonProperties(s),i?.({})},set_once:(e,t,i)=>{var s=U(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),i?.({})}},this.on("eventCaptured",(e=>b.info('send "'+e?.event+'"',e)))}init(e,t,i){if(i&&i!==Ye){var s,n=(s=kt[i])!==null&&s!==void 0?s:new r;return n._init(e,t,i),kt[i]=n,kt[Ye][i]=n,n}return this._init(e,t,i)}_init(e,t,i){var s;if(t===void 0&&(t={}),f(e)||Mi(e))return b.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.Kr(t.debug),this.Yr=t,this.Xr=[],t.person_profiles&&(this.Vr=t.person_profiles),this.set_config(L({},en(t.defaults),tn(t),{name:i,token:e})),this.config.on_xhr_error&&b.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:me.GZipJS;var n=this.Qr();this.persistence=new xt(this.config,n),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new xt(w({},this.config,{persistence:"sessionStorage"}),n);var o=w({},this.persistence.props),a=w({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new Ar((k=>this.ts(k)),this.config.request_queue_config),this.es=new Dr(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new oi(this),this.sessionPropsManager=new ni(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(b.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(b.info("Initializing extensions synchronously"),this.rs(l)),ve.DEBUG=ve.DEBUG||this.config.debug,ve.DEBUG&&b.info("Starting in debug mode",{this:this,config:t,thisC:w({},this.config),p:o,s:a}),((s=t.bootstrap)==null?void 0:s.distinctID)!==void 0){var u,c,h=this.config.get_device_id(Te()),p=(u=t.bootstrap)!=null&&u.isIdentifiedID?h:t.bootstrap.distinctID;this.persistence.set_property(_e,(c=t.bootstrap)!=null&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:p})}if(this.ss()){var g,v,_=Object.keys(((g=t.bootstrap)==null?void 0:g.featureFlags)||{}).filter((k=>{var R;return!((R=t.bootstrap)==null||(R=R.featureFlags)==null||!R[k])})).reduce(((k,R)=>{var $;return k[R]=(($=t.bootstrap)==null||($=$.featureFlags)==null?void 0:$[R])||!1,k}),{}),m=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter((k=>_[k])).reduce(((k,R)=>{var $,x;return($=t.bootstrap)!=null&&($=$.featureFlagPayloads)!=null&&$[R]&&(k[R]=(x=t.bootstrap)==null||(x=x.featureFlagPayloads)==null?void 0:x[R]),k}),{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:m})}if(l)this.register_once({distinct_id:nt,$device_id:null},"");else if(!this.get_distinct_id()){var P=this.config.get_device_id(Te());this.register_once({distinct_id:P,$device_id:P},""),this.persistence.set_property(_e,"anonymous")}return j(d,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?fa(this,(()=>this.ns())):this.ns(),Ce(this.config._onCapture)&&this.config._onCapture!==Br&&(b.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&b.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}rs(e){var t=performance.now();this.historyAutocapture=new dr(this),this.historyAutocapture.startIfEnabled();var i=[];i.push((()=>{new vr(this).startIfEnabledOrStop()})),i.push((()=>{var s;this.siteApps=new Lr(this),(s=this.siteApps)==null||s.init()})),e||i.push((()=>{this.sessionRecording=new ai(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||i.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),i.push((()=>{this.autocapture=new or(this),this.autocapture.startIfEnabled()})),i.push((()=>{this.surveys.loadIfEnabled()})),i.push((()=>{this.logs.loadIfEnabled()})),i.push((()=>{this.conversations.loadIfEnabled()})),i.push((()=>{this.productTours=new kr(this),this.productTours.loadIfEnabled()})),i.push((()=>{this.heatmaps=new fr(this),this.heatmaps.startIfEnabled()})),i.push((()=>{this.webVitalsAutocapture=new _r(this)})),i.push((()=>{this.exceptionObserver=new hr(this),this.exceptionObserver.startIfEnabledOrStop()})),i.push((()=>{this.deadClicksAutocapture=new Qt(this,_a),this.deadClicksAutocapture.startIfEnabled()})),i.push((()=>{if(this.os){var s=this.os;this.os=void 0,this.wi(s)}})),this.ls(i,t)}ls(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.ls(e,t)}),0);var i=e.shift();if(i)try{i()}catch(n){b.error("Error initializing extension:",n)}}var s=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:s}),this.config.__preview_deferred_init_extensions&&b.info("PostHog extensions initialized ("+s+"ms)")}wi(e){var t,i,s,n,o,a,l,u,c;if(!y||!y.body)return b.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.wi(e)}),500);this.config.__preview_deferred_init_extensions&&(this.os=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=F(e.supportedCompression,me.GZipJS)?me.GZipJS:F(e.supportedCompression,me.Base64)?me.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Vr?this.Vr:"identified_only"}),(i=this.siteApps)==null||i.onRemoteConfig(e),(s=this.sessionRecording)==null||s.onRemoteConfig(e),(n=this.autocapture)==null||n.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),(a=this.productTours)==null||a.onRemoteConfig(e),(l=this.webVitalsAutocapture)==null||l.onRemoteConfig(e),(u=this.exceptionObserver)==null||u.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(c=this.deadClicksAutocapture)==null||c.onRemoteConfig(e)}ns(){try{this.config.loaded(this)}catch(i){b.critical("`loaded` function failed",i)}if(this.us(),this.config.internal_or_test_user_hostname&&G!=null&&G.hostname){var e=G.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==="always")&&this.hs()}),1),new Or(this).load(),this.featureFlags.flags()}us(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Zr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Oe(this.__request_queue,(e=>this.ts(e))),this.__request_queue=[],this.us()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.ds()&&this.capture("$pageleave"),(e=this.Zr)==null||e.unload(),(t=this.es)==null||t.unload()):this.ds()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(co?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=ri(e.url,{ip:this.config.ip?1:0}),e.headers=w({},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 i,s,n,o=w({},t);o.timeout=o.timeout||6e4,o.url=ri(o.url,{_:new Date().getTime().toString(),ver:ve.LIB_VERSION,compression:o.compression});var a=(i=o.transport)!==null&&i!==void 0?i:"fetch",l=Ht.filter((c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport))),u=(s=(n=$n(l,(c=>c.transport===a)))==null?void 0:n.method)!==null&&s!==void 0?s:l[0].method;if(!u)throw new Error("No available transport method");u(o)})(w({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((i=(s=this.config).on_request_error)==null||i.call(s,t)),e.callback==null||e.callback(t)}}))))}ts(e){this.es?this.es.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],s=[],n=[];Oe(e,(a=>{a&&(t=a[0],T(t)?n.push(a):Ce(a)?a.call(this):T(a)&&t==="alias"?i.push(a):T(a)&&t.indexOf("capture")!==-1&&Ce(this[t])?n.push(a):s.push(a))}));var o=function(a,l){Oe(a,(function(u){if(T(u[0])){var c=l;M(u,(function(h){c=c[h[0]].apply(c,h.slice(1))}))}else this[u[0]].apply(this,u.slice(1))}),l)};o(i,this),o(s,this),o(n,this)}ss(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zr){if(this.is_capturing())if(!f(e)&&U(e)){var n=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(n&&!this.config.__preview_capture_bot_pageviews)){var o=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!U(t?.$current_url)&&(b.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,l=i?.timestamp||a,u=Te(),c={uuid:u,event:e,properties:this.calculateEventProperties(e,t||{},l,u)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&n&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),o&&(c.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),i?.$set&&(c.$set=i?.$set);var h,p=e!=="$groupidentify",g=this.vs(i?.$set_once,p);if(g&&(c.$set_once=g),(c=zo(c,i!=null&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,f(i?.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a),e===bt.DISMISSED||e===bt.SENT){var v=t?.[Ii.SURVEY_ID],_=t?.[Ii.SURVEY_ITERATION];h={id:v,current_iteration:_},localStorage.getItem(Ks(h))||localStorage.setItem(Ks(h),"true"),c.$set=w({},c.$set,{[Ga({id:v,current_iteration:_},e===bt.SENT?"responded":"dismissed")]:!0})}else e===bt.SHOWN&&(c.$set=w({},c.$set,{[Ii.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var m=w({},c.properties.$set,c.$set);if(Xe(m)||this.setPersonPropertiesForFlags(m),!I(this.config.before_send)){var P=this.cs(c);if(!P)return;c=P}this.bi.emit("eventCaptured",c);var k={method:"POST",url:(s=i?._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:i?._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.ts(k):this.Zr.enqueue(k),c}b.critical("This capture call is ignored due to client rate limiting.")}}else b.error("No event name provided to posthog.capture")}else b.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,i,s,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var o=n?void 0:this.persistence.remove_event_timer(e),a=w({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=w({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!U(a.distinct_id)&&!we(a.distinct_id)||Mi(a.distinct_id))&&b.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=xa(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime());a.$session_id=h,a.$window_id=p}this.sessionPropsManager&&L(a,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&L(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(g=this.es)==null?void 0:g.length}catch(P){a.$sdk_debug_error_capturing_properties=String(P)}if(this.requestRouter.region===wt.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||n?e!=="$pageleave"||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),a=L(a,u),e==="$pageview"&&y&&(a.title=y.title),!f(o)){var v=i.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}X&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=L({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),T(this.config.property_denylist)?M(this.config.property_denylist,(function(P){delete a[P]})):b.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(b.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,e));var m=this.fs();return a.$process_person_profile=m,m&&!n&&this.ps("_calculate_event_properties"),a}vs(e,t){var i;if(t===void 0&&(t=!0),!this.persistence||!this.fs()||this.qr)return e;var s=this.persistence.get_initial_props(),n=(i=this.sessionPropsManager)==null?void 0:i.getSetOnceProps(),o=L({},s,n||{},e||{}),a=this.config.sanitize_properties;return a&&(b.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.qr=!0),Xe(o)?void 0:o}register(e,t){var i;(i=this.persistence)==null||i.register(e,t)}register_once(e,t,i){var s;(s=this.persistence)==null||s.register_once(e,t,i)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}gs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,i){var s=i!=null&&i.merge?this.featureFlags.getFlagVariants():{},n=i!=null&&i.merge?this.featureFlags.getFlagPayloads():{},o=w({},s,e),a=w({},n,t),l={};for(var[u,c]of Object.entries(o)){var h=typeof c=="string";l[u]={key:u,enabled:!!h||!!c,variant:h?c:void 0,reason:void 0,metadata:f(a?.[u])?void 0:{id:0,version:void 0,description:void 0,payload:a[u]}}}this.featureFlags.receivedFeatureFlags({flags:l})}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.bi.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=Wa),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return b.uninitializedWarning("posthog.identify");if(we(e)&&(e=e.toString(),b.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))b.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==nt){if(this.ps("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(vt)&&(this.unregister(vt),this.register({distinct_id:e}));var o=(this.persistence.get_property(_e)||"anonymous")==="anonymous";e!==s&&o?(this.persistence.set_property(_e,"identified"),this.setPersonPropertiesForFlags(w({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.Jr=Vs(e,t,i),this.featureFlags.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(Vt))}}else b.critical('The string "'+nt+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else b.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var i=Vs(this.get_distinct_id(),e,t);this.Jr!==i?(this.setPersonPropertiesForFlags(w({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=i):b.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:w({},s,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),s[e]===t||i||this.reloadFeatureFlags()}else b.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.ps("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,n;if(b.info("reset"),!this.__loaded)return b.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(i=this.sessionPersistence)==null||i.clear(),this.surveys.reset(),this.featureFlags.reset(),(s=this.persistence)==null||s.set_property(_e,"anonymous"),(n=this.sessionManager)==null||n.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:nt,$device_id:null},"");else{var a=this.config.get_device_id(Te());this.register_once({distinct_id:a,$device_id:e?a:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&i){var n,o=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!i)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-o,0)}return s}alias(e,t){return e===this.get_property(In)?(b.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(f(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(vt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(b.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=w({},this.config);if(q(e)){var i,s,n,o,a,l,u;L(this.config,tn(e));var c=this.Qr();(i=this.persistence)==null||i.update_config(this.config,t,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new xt(w({},this.config,{persistence:"sessionStorage"}),c);var h=this.Kr(this.config.debug);be(h)&&(this.config.debug=h),be(this.config.debug)&&(this.config.debug?(ve.DEBUG=!0,D.H()&&D.G("ph_debug","true"),b.info("set_config",{config:e,oldConfig:t,newConfig:w({},this.config)})):(ve.DEBUG=!1,D.H()&&D.V("ph_debug"))),(s=this.exceptionObserver)==null||s.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(),this.surveys.loadIfEnabled(),this._s(),(u=this.externalIntegrations)==null||u.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,i={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(i).some(Boolean)){var s,n,o,a,l;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),i.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),i.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),i.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),i.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(w({},s,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Ye;return t!==Ye&&(t=Ye+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(_e))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(_e))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Xe(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[vt])&&((t=this.persistence)==null||(t=t.props)==null||!t[zt]))}ds(){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.fs()||this.ps("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ps("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ps(e){return this.config.person_profiles==="never"?(b.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(zt,!0),!0)}Qr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}_s(){var e,t,i,s,n=this.Qr();return((e=this.persistence)==null?void 0:e.Pi)!==n&&((i=this.persistence)==null||i.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.Pi)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!=="always"){var i,s,n;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new oi(this),this.pageViewManager=new ei(this),this.persistence&&(this.sessionPropsManager=new ni(this,this.sessionManager,this.persistence)),this.sessionRecording=new ai(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this._s(),this.us(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(f(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((n=e?.captureEventName)!==null&&n!==void 0?n:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hs()}else b.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._s(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:nt,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(i=this.sessionRecording)==null||i.stopRecording(),this.sessionRecording=void 0,this.hs())):b.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===fe.GRANTED?"granted":e===fe.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._s()}_is_bot(){return ee?lo(ee,this.config.custom_blocked_useragents):void 0}hs(){y&&(y.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:y.title},{send_instantly:!0}),this.Gr&&(y.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),j(y,"visibilitychange",this.Gr)))}debug(e){e===!1?(d?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(d?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}M(){var e,t,i,s,n,o,a,l=this.Yr||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(b.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",s=!1,n=b,o=(t="advanced_disable_flags")in(e=l)&&!I(e[t]),a=i in e&&!I(e[i]),o?e[t]:a?(n&&n.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]):s)}cs(e){if(I(this.config.before_send))return e;var t=T(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),I(i)){var n="Event '"+e.event+"' was rejected in beforeSend function";return bo(e.event)?b.warn(n+". This can cause unexpected behavior."):b.info(n),null}i.properties&&!Xe(i.properties)||b.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return(e=this.pageViewManager.Kt)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Kr(e){var t=be(e)&&!e,i=D.H()&&D.q("ph_debug")==="true";return!t&&(!!i||e)}};(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=Wo(r.prototype[e[t]])})(li,["identify"]);var rn;var Ee=(rn=kt[Ye]=new li,(function(){function r(){r.done||(r.done=!0,co=!1,M(kt,(function(e){e._dom_loaded()})))}y!=null&&y.addEventListener?y.readyState==="complete"?r():j(y,"DOMContentLoaded",r,{capture:!1}):d&&b.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),rn);var qe=class qe{constructor(e){this.has_initialized=!1;this.has_identified=!1;this.init=()=>{try{let{apiKey:e,api_host:t,config:i={}}=this.options;if(!e){console.warn("Posthog: No API key provided");return}let s={api_host:t||ns,ui_host:os,autocapture:!0,capture_pageview:"history_change",session_recording:{recordCrossOriginIframes:!0,minimumDurationMilliseconds:3e4,...i.session_recording},before_send:n=>{if(typeof window>"u")return null;let o=window.location.hostname;return o==="localhost"||o==="127.0.0.1"||as.some(l=>o.endsWith(`.${l}`)||o===l)?n:null},...i};Ee.init(e,s),this.has_initialized=!0}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 i=typeof Ee._isIdentified=="function"?Ee._isIdentified():this.has_identified;if(e&&!i){let s=Ee.get_distinct_id();s&&s!==e&&Ee.alias(e,s)}Ee.identify(e,t),this.has_identified=!0}catch(i){console.error("Posthog: Failed to identify user",i)}};this.reset=()=>{if(this.has_initialized)try{Ee.reset(),this.has_identified=!1}catch(e){console.error("Posthog: Failed to reset",e)}};this.capture=(e,t)=>{if(this.has_initialized)try{Ee.capture(e,t)}catch(i){console.error("Posthog: Failed to capture event",i)}};this.options=e,this.init()}};qe.getPosthogInstance=e=>(qe._instance||(qe._instance=new qe(e)),qe._instance);var uo=qe;export{uo as Posthog};
6
- //# sourceMappingURL=posthog-ZJSIYY5Q.mjs.map
5
+ `)).length,s=0;s<i;s++){var o=r.charCodeAt(s),a=null;o<128?t++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),oe(a)||(t>e&&(n+=r.substring(e,t)),n+=a,e=t=s+1)}return t>e&&(n+=r.substring(e,r.length)),n},Oa=!!Ci||!!Ti,Gs="text/plain",ri=function(r,e,t){var i;t===void 0&&(t=!0);var[s,n]=r.split("?"),o=w({},e),a=(i=n?.split("&").map((u=>{var c,[h,p]=u.split("="),g=t&&(c=o[h])!==null&&c!==void 0?c:p;return delete o[h],h+"="+g})))!==null&&i!==void 0?i:[],l=oa(o);return l&&a.push(l),s+"?"+a.join("&")},yt=(r,e)=>JSON.stringify(r,((t,i)=>typeof i=="bigint"?i.toString():i),e),ki=r=>{var{data:e,compression:t}=r;if(e){if(t===me.GZipJS){var i=Ta((function(l,u){var c=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var h=new ne(l.length+(l.length>>>1)),p=0,g=function(P){h[p++]=P},v=0;v<c;++v){if(p+5>h.length){var _=new ne(p+8+(c-v<<1));_.set(h),h=_}var m=l.charCodeAt(v);m<128||u?g(m):m<2048?(g(192|m>>>6),g(128|63&m)):m>55295&&m<57344?(g(240|(m=65536+(1047552&m)|1023&l.charCodeAt(++v))>>>18),g(128|m>>>12&63),g(128|m>>>6&63),g(128|63&m)):(g(224|m>>>12),g(128|m>>>6&63),g(128|63&m))}return so(h,0,p)})(yt(e)),{mtime:0}),s=new Blob([i],{type:Gs});return{contentType:Gs,body:s,estimatedSize:s.size}}if(t===me.Base64){var n=(function(l){var u,c,h,p,g,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_=0,m=0,P="",k=[];if(!l)return l;l=Ca(l);do u=(g=l.charCodeAt(_++)<<16|l.charCodeAt(_++)<<8|l.charCodeAt(_++))>>18&63,c=g>>12&63,h=g>>6&63,p=63&g,k[m++]=v.charAt(u)+v.charAt(c)+v.charAt(h)+v.charAt(p);while(_<l.length);switch(P=k.join(""),l.length%3){case 1:P=P.slice(0,-2)+"==";break;case 2:P=P.slice(0,-1)+"="}return P})(yt(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:yt(l)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=yt(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Ht=[];Ti&&Ht.push({transport:"fetch",method:r=>{var e,t,{contentType:i,body:s,estimatedSize:n}=(e=ki(r))!==null&&e!==void 0?e:{},o=new Headers;M(r.headers,(function(c,h){o.append(h,c)})),i&&o.append("Content-Type",i);var a=r.url,l=null;if(us){var u=new us;l={signal:u.signal,timeout:setTimeout((()=>u.abort()),r.timeout)}}Ti(a,w({method:r?.method||"GET",headers:o,keepalive:r.method==="POST"&&(n||0)<52428.8,body:s,signal:(t=l)==null?void 0:t.signal},r.fetchOptions)).then((c=>c.text().then((h=>{var p={statusCode:c.status,text:h};if(c.status===200)try{p.json=JSON.parse(h)}catch(g){b.error(g)}r.callback==null||r.callback(p)})))).catch((c=>{b.error(c),r.callback==null||r.callback({statusCode:0,error:c})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Ci&&Ht.push({transport:"XHR",method:r=>{var e,t=new Ci;t.open(r.method||"GET",r.url,!0);var{contentType:i,body:s}=(e=ki(r))!==null&&e!==void 0?e:{};M(r.headers,(function(n,o){t.setRequestHeader(o,n)})),i&&t.setRequestHeader("Content-Type",i),r.timeout&&(t.timeout=r.timeout),r.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}r.callback==null||r.callback(n)}},t.send(s)}}),ee!=null&&ee.sendBeacon&&Ht.push({transport:"sendBeacon",method:r=>{var e=ri(r.url,{beacon:"1"});try{var t,{contentType:i,body:s}=(t=ki(r))!==null&&t!==void 0?t:{},n=typeof s=="string"?new Blob([s],{type:i}):s;ee.sendBeacon(e,n)}catch{}}});var si=function(r,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(r)}catch{return!1}};function Vs(r,e,t){return yt({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var no={exact:(r,e)=>e.some((t=>r.some((i=>t===i)))),is_not:(r,e)=>e.every((t=>r.every((i=>t!==i)))),regex:(r,e)=>e.some((t=>r.some((i=>si(t,i))))),not_regex:(r,e)=>e.every((t=>r.every((i=>!si(t,i))))),icontains:(r,e)=>e.map(Lt).some((t=>r.map(Lt).some((i=>t.includes(i))))),not_icontains:(r,e)=>e.map(Lt).every((t=>r.map(Lt).every((i=>!t.includes(i))))),gt:(r,e)=>e.some((t=>{var i=parseFloat(t);return!isNaN(i)&&r.some((s=>i>parseFloat(s)))})),lt:(r,e)=>e.some((t=>{var i=parseFloat(t);return!isNaN(i)&&r.some((s=>i<parseFloat(s)))}))},Lt=r=>r.toLowerCase();function oo(r,e){return!r||Object.entries(r).every((t=>{var[i,s]=t,n=e?.[i];if(f(n)||oe(n))return!1;var o=[String(n)],a=no[s.operator];return!!a&&a(s.values,o)}))}var Pi=N("[Error tracking]"),Er=class{constructor(e){var t,i;this.Zt=[],this.ti=new Hi([new Ui,new Ji,new Gi,new Bi,new zi,new Wi,new Vi,new Yi],Uo()),this._instance=e,this.Zt=(t=(i=this._instance.persistence)==null?void 0:i.get_property(Ki))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,i,s,n=(t=(i=e.errorTracking)==null?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],o=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.Zt=n,this._instance.persistence&&this._instance.persistence.register({[Ki]:this.Zt,[xs]:o})}get ii(){var e,t=!!this._instance.get_property(xs),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.ti.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ei(t)){if(this.ri(t))return void Pi.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void Pi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void Pi.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ri(e){if(e.length===0)return!1;var t=e.reduce(((i,s)=>{var{type:n,value:o}=s;return U(n)&&n.length>0&&i.$exception_types.push(n),U(o)&&o.length>0&&i.$exception_values.push(o),i}),{$exception_types:[],$exception_values:[]});return this.Zt.some((i=>{var s=i.values.map((n=>{var o,a=no[n.operator],l=T(n.value)?n.value:[n.value],u=(o=t[n.key])!==null&&o!==void 0?o:[];return l.length>0&&a(l,u)}));return i.type==="OR"?s.some(Boolean):s.every(Boolean)}))}si(e){return e.flatMap((t=>{var i,s;return(i=(s=t.stacktrace)==null?void 0:s.frames)!==null&&i!==void 0?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ni(e){if(e.length>0){var t,i,s,n,o=(t=(i=e[0].stacktrace)==null?void 0:i.frames)!==null&&t!==void 0?t:[],a=o[o.length-1];return(s=a==null||(n=a.filename)==null?void 0:n.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}ei(e){return!I(e)&&T(e)}},Q=N("[FeatureFlags]"),ut=N("[FeatureFlags]",{debugEnabled:!0}),Ma="errors_while_computing_flags",Aa="flag_missing",Da="quota_limited",Na="timeout",La="connection_error",ja="unknown_error",Ha=r=>"api_error_"+r,Si="$active_feature_flags",Ve="$override_feature_flags",Ws="$feature_flag_payloads",ht="$override_feature_flag_payloads",zs="$feature_flag_request_id",Ys="$feature_flag_evaluated_at",Js=r=>{var e={};for(var[t,i]of jt(r||{}))i&&(e[t]=i);return e},qa=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,(i=e[t].variant)!==null&&i!==void 0?i:e[t].enabled]}))),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return(i=e[t].metadata)==null?void 0:i.payload})).map((t=>{var i;return[t,(i=e[t].metadata)==null?void 0:i.payload]})))):Q.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},Ua=(function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r})({}),xr=class{constructor(e){this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.ci=!1,this._instance=e,this.featureFlagEventHandlers=[]}fi(){var e,t=(e=this._instance.config.evaluation_contexts)!==null&&e!==void 0?e:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.ci||(Q.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ci=!0),t!=null&&t.length?t.filter((i=>{var s=i&&typeof i=="string"&&i.trim().length>0;return s||Q.error("Invalid evaluation context found:",i,"Expected non-empty string"),s})):[]}pi(){return this.fi().length>0}flags(){if(this._instance.config.__preview_remote_config)this.di=!0;else{var e=!this.gi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.mi({disableFlags:e})}}get hasLoadedFlags(){return this.ai}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(Zi),t=this._instance.get_property(Ve),i=this._instance.get_property(ht);if(!i&&!t)return e||{};var s=L({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var o of n){var a,l,u=s[o],c=t?.[o],h=f(c)?(a=u?.enabled)!==null&&a!==void 0&&a:!!c,p=f(c)?u.variant:typeof c=="string"?c:void 0,g=i?.[o],v=w({},u,{enabled:h,variant:h?p??u?.variant:void 0});h!==u?.enabled&&(v.original_enabled=u?.enabled),p!==u?.variant&&(v.original_variant=u?.variant),g&&(v.metadata=w({},u?.metadata,{payload:g,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),s[o]=v}return this.oi||(Q.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.oi=!0),s}getFlagVariants(){var e=this._instance.get_property(Ke),t=this._instance.get_property(Ve);if(!t)return e||{};for(var i=L({},e),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.oi||(Q.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.oi=!0),i}getFlagPayloads(){var e=this._instance.get_property(Ws),t=this._instance.get_property(ht);if(!t)return e||{};for(var i=L({},e||{}),s=Object.keys(t),n=0;n<s.length;n++)i[s[n]]=t[s[n]];return this.oi||(Q.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.oi=!0),i}reloadFeatureFlags(){this.ui||this._instance.config.advanced_disable_feature_flags||this.gi||(this._instance.bi.emit("featureFlagsReloading",!0),this.gi=setTimeout((()=>{this.mi()}),5))}yi(){clearTimeout(this.gi),this.gi=void 0}ensureFlagsLoaded(){this.ai||this.li||this.gi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ui=e}mi(e){var t;if(this.yi(),!this._instance.M())if(this.li)this.hi=!0;else{var i=this._instance.config.token,s=this._instance.get_property("$device_id"),n={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:w({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(mt)||{}),group_properties:this._instance.get_property(Ne)};oe(s)||f(s)||(n.$device_id=s),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.pi()&&(n.evaluation_contexts=this.fi());var o=this._instance.config.__preview_remote_config,a=o?"/flags/?v=2":"/flags/?v=2&config=true",l=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",u=this._instance.requestRouter.endpointFor("flags",a+l);o&&(n.timezone=eo()),this.li=!0,this._instance._send_request({method:"POST",url:u,data:n,compression:this._instance.config.disable_compression?void 0:me.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:c=>{var h,p,g,v,_=!0;if(c.statusCode===200&&(this.hi||(this.$anon_distinct_id=void 0),_=!1),this.li=!1,this.di||(this.di=!0,this._instance.wi((v=c.json)!==null&&v!==void 0?v:{})),!n.disable_flags||this.hi){this.vi=!_;var m=[];c.error?c.error instanceof Error?m.push(c.error.name==="AbortError"?Na:La):m.push(ja):c.statusCode!==200&&m.push(Ha(c.statusCode)),(h=c.json)!=null&&h.errorsWhileComputingFlags&&m.push(Ma);var P=!((p=c.json)==null||(p=p.quotaLimited)==null||!p.includes(Ua.FeatureFlags));if(P&&m.push(Da),(g=this._instance.persistence)==null||g.register({[er]:m}),P)Q.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var k;n.disable_flags||this.receivedFeatureFlags((k=c.json)!==null&&k!==void 0?k:{},_),this.hi&&(this.hi=!1,this.mi())}}}})}}getFeatureFlag(e,t){var i;if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var s=this.getFeatureFlagResult(e,t);return(i=s?.variant)!==null&&i!==void 0?i:s?.enabled}Q.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants(),s=e in i,n=i[e],o=this.getFlagPayloads()[e],a=String(n),l=this._instance.get_property(zs)||void 0,u=this._instance.get_property(Ys)||void 0,c=this._instance.get_property(Vt)||{};if((t.send_event||!("send_event"in t))&&(!(e in c)||!c[e].includes(a))){var h,p,g,v,_,m,P,k,R,$;T(c[e])?c[e].push(a):c[e]=[a],(h=this._instance.persistence)==null||h.register({[Vt]:c});var x=this.getFeatureFlagDetails(e),H=[...(p=this._instance.get_property(er))!==null&&p!==void 0?p:[]];f(n)&&H.push(Aa);var C={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:o||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((g=this._instance.config.bootstrap)==null||(g=g.featureFlags)==null?void 0:g[e])||null,$feature_flag_bootstrapped_payload:((v=this._instance.config.bootstrap)==null||(v=v.featureFlagPayloads)==null?void 0:v[e])||null,$used_bootstrap_value:!this.vi};f(x==null||(_=x.metadata)==null?void 0:_.version)||(C.$feature_flag_version=x.metadata.version);var S,K=(m=x==null||(P=x.reason)==null?void 0:P.description)!==null&&m!==void 0?m:x==null||(k=x.reason)==null?void 0:k.code;K&&(C.$feature_flag_reason=K),x!=null&&(R=x.metadata)!=null&&R.id&&(C.$feature_flag_id=x.metadata.id),f(x?.original_variant)&&f(x?.original_enabled)||(C.$feature_flag_original_response=f(x.original_variant)?x.original_enabled:x.original_variant),x!=null&&($=x.metadata)!=null&&$.original_payload&&(C.$feature_flag_original_payload=x==null||(S=x.metadata)==null?void 0:S.original_payload),H.length&&(C.$feature_flag_error=H.join(",")),this._instance.capture("$feature_flag_called",C)}if(s){var W=o;if(!f(o))try{W=JSON.parse(o)}catch{}return{key:e,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:W}}}else Q.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var i=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.pi()&&(s.evaluation_contexts=this.fi()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:s,compression:this._instance.config.disable_compression?void 0:me.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var o,a=(o=n.json)==null?void 0:o.featureFlagPayloads;t(a?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return f(i)?void 0:!!i}Q.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ai=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(o,a,l,u,c){l===void 0&&(l={}),u===void 0&&(u={}),c===void 0&&(c={});var h=qa(o),p=h.flags,g=h.featureFlags,v=h.featureFlagPayloads;if(g){var _=o.requestId,m=o.evaluatedAt;if(T(g)){Q.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var P={};if(g)for(var k=0;k<g.length;k++)P[g[k]]=!0;a&&a.register({[Si]:g,[Ke]:P})}else{var R=g,$=v,x=p;if(o.errorsWhileComputingFlags)if(p){var H=new Set(Object.keys(p).filter((C=>{var S;return!((S=p[C])!=null&&S.failed)})));R=w({},l,Object.fromEntries(Object.entries(R).filter((C=>{var[S]=C;return H.has(S)})))),$=w({},u,Object.fromEntries(Object.entries($||{}).filter((C=>{var[S]=C;return H.has(S)})))),x=w({},c,Object.fromEntries(Object.entries(x||{}).filter((C=>{var[S]=C;return H.has(S)}))))}else R=w({},l,R),$=w({},u,$),x=w({},c,x);a&&a.register(w({[Si]:Object.keys(Js(R)),[Ke]:R||{},[Ws]:$||{},[Zi]:x||{}},_?{[zs]:_}:{},m?{[Ys]:m}:{}))}}})(e,this._instance.persistence,i,s,n),this.xi(t)}}override(e,t){t===void 0&&(t=!1),Q.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Q.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Ve),this._instance.persistence.unregister(ht),this.xi(),ut.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,i=e;if(this.oi=!!((t=i.suppressWarning)!==null&&t!==void 0&&t),"flags"in i){if(i.flags===!1)this._instance.persistence.unregister(Ve),ut.info("Flag overrides cleared");else if(i.flags){if(T(i.flags)){for(var s={},n=0;n<i.flags.length;n++)s[i.flags[n]]=!0;this._instance.persistence.register({[Ve]:s})}else this._instance.persistence.register({[Ve]:i.flags});ut.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this._instance.persistence.unregister(ht),ut.info("Payload overrides cleared")):i.payloads&&(this._instance.persistence.register({[ht]:i.payloads}),ut.info("Payload overrides set",{payloads:i.payloads}))),void this.xi()}this.xi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:i}=this.Ei();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,n=(this._instance.get_property(ft)||[]).find((u=>u.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};n&&(a.$early_access_feature_name=n.name),i&&(a.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=w({},this.getFlagVariants(),{[e]:t});(s=this._instance.persistence)==null||s.register({[Si]:Object.keys(Js(l)),[Ke]:l}),this.xi()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var s=this._instance.get_property(ft),n=i?"&"+i.map((o=>"stage="+o)).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+n),method:"GET",callback:o=>{var a,l;if(o.json){var u=o.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(ft),(l=this._instance.persistence)==null||l.register({[ft]:u}),e(u)}}})}Ei(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((i=>t[i])),flagVariants:Object.keys(t).filter((i=>t[i])).reduce(((i,s)=>(i[s]=t[s],i)),{})}}xi(e){var{flags:t,flagVariants:i}=this.Ei();this.featureFlagEventHandlers.forEach((s=>s(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(mt)||{};this._instance.register({[mt]:w({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(mt)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(Ne)||{};Object.keys(i).length!==0&&Object.keys(i).forEach((s=>{i[s]=w({},i[s],e[s]),delete e[s]})),this._instance.register({[Ne]:w({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Ne)||{};this._instance.register({[Ne]:w({},t,{[e]:{}})})}else this._instance.unregister(Ne)}reset(){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.yi(),this.oi=!1}},Ba=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],xt=class{constructor(e,t){this.R=e,this.props={},this.$i=!1,this.Si=(i=>{var s="";return i.token&&(s=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+s+"_posthog"})(e),this.Y=this.ki(e),this.load(),e.debug&&b.info("Persistence loaded",e.persistence,w({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.Pi}ki(e){Ba.indexOf(e.persistence.toLowerCase())===-1&&(b.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(s){s===void 0&&(s=[]);var n=[...pa,...s];return w({},D,{W:function(o){try{var a={};try{a=ue.W(o)||{}}catch{}var l=L(a,JSON.parse(D.q(o)||"{}"));return D.G(o,l),l}catch{}return null},G:function(o,a,l,u,c,h){try{D.G(o,a,void 0,void 0,h);var p={};n.forEach((g=>{a[g]&&(p[g]=a[g])})),Object.keys(p).length&&ue.G(o,p,l,u,c,h)}catch(g){D.B(g)}},V:function(o,a){try{d?.localStorage.removeItem(o),ue.V(o,a)}catch(l){D.B(l)}}})})(e.cookie_persisted_properties||[]),i=e.persistence.toLowerCase();return i==="localstorage"&&D.H()?D:i==="localstorage+cookie"&&t.H()?t:i==="sessionstorage"&&B.H()?B:i==="memory"?ga:i==="cookie"?ue:t.H()?t:ue}properties(){var e={};return M(this.props,(function(t,i){if(i===Ke&&q(t))for(var s=Object.keys(t),n=0;n<s.length;n++)e["$feature/"+s[n]]=t[s[n]];else a=i,l=!1,(oe(o=Xo)?l:cs&&o.indexOf===cs?o.indexOf(a)!=-1:(M(o,(function(u){if(l||(l=u===a))return Bt})),l))||(e[i]=t);var o,a,l})),e}load(){if(!this.Pi){var e=this.Y.W(this.Si);e&&(this.props=L({},e))}}save(){this.Pi||this.Y.G(this.Si,this.props,this.Ti,this.Ii,this.Ci,this.R.debug)}remove(){this.Y.V(this.Si,!1),this.Y.V(this.Si,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(q(e)){f(t)&&(t="None"),this.Ti=f(i)?this.Ri:i;var s=!1;if(M(e,((n,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=n,s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(q(e)){this.Ti=f(t)?this.Ri:t;var i=!1;if(M(e,((s,n)=>{e.hasOwnProperty(n)&&this.props[n]!==s&&(this.props[n]=s,i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.$i){var e=Yn(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);Xe(Jr(e))||this.register(e),this.$i=!0}}update_search_keyword(){var e;this.register((e=y?.referrer)?Xn(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Kn(),$referring_domain:y!=null&&y.referrer&&((e=Xt(y.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[rr]||this.props[sr]||this.register_once({[Wt]:Zn(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};M([sr,rr],(o=>{var a=this.props[o];a&&M(a,(function(l,u){e["$initial_"+Oi(u)]=l}))}));var t,i,s=this.props[Wt];if(s){var n=(t=Qn(s),i={},M(t,(function(o,a){i["$initial_"+Oi(a)]=o})),i);L(e,n)}return e}safe_merge(e){return M(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this.Ri=this.Ti=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),u=[...a].sort();return l.every(((c,h)=>c===u[h]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var s=this.ki(e),n=this.props;this.clear(),this.Y=s,this.props=n,this.save()}}set_disabled(e){this.Pi=e,this.Pi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ii&&(this.Ii=e,this.remove(),this.save())}set_secure(e){e!==this.Ci&&(this.Ci=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[_t]||{};i[e]=t,this.props[_t]=i,this.save()}remove_event_timer(e){var t=(this.props[_t]||{})[e];return f(t)||(delete this.props[_t][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},Xs=N("[Product Tours]"),Fi="ph_product_tours",kr=class{constructor(e){this.Fi=null,this.Oi=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[Ps]:!(e==null||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,t;this.Fi||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(Ps)||this.it((()=>this.Mi()))}it(e){var t,i;(t=E.__PosthogExtensions__)!=null&&t.generateProductTours?e():(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"product-tours",(s=>{s?Xs.error("Could not load product tours script",s):e()}))}Mi(){var e;!this.Fi&&(e=E.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Fi=E.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!T(this.Oi)||t){var i=this._instance.persistence;if(i){var s=i.props[Fi];if(T(s)&&!t)return this.Oi=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:n=>{var o=n.statusCode;if(o!==200||!n.json){var a="Product Tours API could not be loaded, status: "+o;return Xs.error(a),void e([],{isLoaded:!1,error:a})}var l=T(n.json.product_tours)?n.json.product_tours:[];this.Oi=l,i&&i.register({[Fi]:l}),e(l,{isLoaded:!0})}})}else e(this.Oi,{isLoaded:!0})}getActiveProductTours(e){I(this.Fi)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Fi.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Fi)==null||t.showTourById(e)}previewTour(e){this.Fi?this.Fi.previewTour(e):this.it((()=>{var t;this.Mi(),(t=this.Fi)==null||t.previewTour(e)}))}dismissProductTour(){var e;(e=this.Fi)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Fi)==null||e.nextStep()}previousStep(){var e;(e=this.Fi)==null||e.previousStep()}clearCache(){var e;this.Oi=null,(e=this._instance.persistence)==null||e.unregister(Fi)}resetTour(e){var t;(t=this.Fi)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Fi)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Fi)==null||t.cancelPendingTour(e)}},dt=(function(r){return r.Activation="events",r.Cancellation="cancelEvents",r})({}),Qa=(function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r})({}),el=(function(r){return r.TopLeft="top_left",r.TopRight="top_right",r.TopCenter="top_center",r.MiddleLeft="middle_left",r.MiddleRight="middle_right",r.MiddleCenter="middle_center",r.Left="left",r.Center="center",r.Right="right",r.NextToTrigger="next_to_trigger",r})({}),tl=(function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r})({}),$i=(function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r})({}),il=(function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r})({}),rl=(function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r})({}),sl=(function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r})({}),bt=(function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r})({}),Ii=(function(r){return r.SURVEY_ID="$survey_id",r.SURVEY_NAME="$survey_name",r.SURVEY_RESPONSE="$survey_response",r.SURVEY_ITERATION="$survey_iteration",r.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",r.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",r.SURVEY_SUBMISSION_ID="$survey_submission_id",r.SURVEY_QUESTIONS="$survey_questions",r.SURVEY_COMPLETED="$survey_completed",r.PRODUCT_TOUR_ID="$product_tour_id",r.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",r})({}),Pr=(function(r){return r.Popover="popover",r.Inline="inline",r})({}),O=N("[Surveys]"),ao="seenSurvey_",Ga=(r,e)=>{var t="$survey_"+e+"/"+r.id;return r.current_iteration&&r.current_iteration>0&&(t="$survey_"+e+"/"+r.id+"/"+r.current_iteration),t},Ks=r=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})(ao,r),Va=[$i.Popover,$i.Widget,$i.API],Wa={ignoreConditions:!1,ignoreDelay:!1,displayType:Pr.Popover},Rt=class{constructor(){this.Ai={},this.Ai={}}on(e,t){return this.Ai[e]||(this.Ai[e]=[]),this.Ai[e].push(t),()=>{this.Ai[e]=this.Ai[e].filter((i=>i!==t))}}emit(e,t){for(var i of this.Ai[e]||[])i(t);for(var s of this.Ai["*"]||[])s(e,t)}};function We(r,e,t){if(I(r))return!1;switch(t){case"exact":return r===e;case"contains":var i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(r);case"regex":try{return new RegExp(e).test(r)}catch{return!1}default:return!1}}var Sr=class{constructor(e){this.ji=new Rt,this.Di=(t,i)=>this.Li(t,i)&&this.Ni(t,i)&&this.Ui(t,i)&&this.zi(t,i),this.Li=(t,i)=>i==null||!i.event||t?.event===i?.event,this._instance=e,this.Hi=new Set,this.Bi=new Set}init(){var e;if(!f((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook(((i,s)=>{this.on(i,s)}))}}register(e){var t,i;if(!f((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((o=>{var a,l;(a=this.Bi)==null||a.add(o),(l=o.steps)==null||l.forEach((u=>{var c;(c=this.Hi)==null||c.add(u?.event||"")}))})),(i=this._instance)!=null&&i.autocapture)){var s,n=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((l=>{l!=null&&l.selector&&n.add(l?.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(n)}}on(e,t){var i;t!=null&&e.length!=0&&(this.Hi.has(e)||this.Hi.has(t?.event))&&this.Bi&&((i=this.Bi)==null?void 0:i.size)>0&&this.Bi.forEach((s=>{this.qi(t,s)&&this.ji.emit("actionCaptured",s.name)}))}Wi(e){this.onAction("actionCaptured",(t=>e(t)))}qi(e,t){if(t?.steps==null)return!1;for(var i of t.steps)if(this.Di(e,i))return!0;return!1}onAction(e,t){return this.ji.on(e,t)}Ni(e,t){if(t!=null&&t.url){var i,s=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!s||typeof s!="string"||!We(s,t.url,t.url_matching||"contains"))return!1}return!0}Ui(e,t){return!!this.Gi(e,t)&&!!this.Vi(e,t)&&!!this.Ji(e,t)}Gi(e,t){var i;if(t==null||!t.href)return!0;var s=this.Ki(e);if(s.length>0)return s.some((a=>We(a.href,t.href,t.href_matching||"exact")));var n,o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!o&&We((n=o.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}Vi(e,t){var i;if(t==null||!t.text)return!0;var s=this.Ki(e);if(s.length>0)return s.some((u=>We(u.text,t.text,t.text_matching||"exact")||We(u.$el_text,t.text,t.text_matching||"exact")));var n,o,a,l=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";return!!l&&(n=(function(u){for(var c,h=[],p=/(?::|")text="(.*?)"/g;!I(c=p.exec(u));)h.includes(c[1])||h.push(c[1]);return h})(l),o=t.text,a=t.text_matching||"exact",n.some((u=>We(u,o,a))))}Ji(e,t){var i,s;if(t==null||!t.selector)return!0;var n=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var o=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}Ki(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}zi(e,t){return t==null||!t.properties||t.properties.length===0||oo(t.properties.reduce(((i,s)=>{var n=T(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return i[s.key]={values:n,operator:s.operator||"exact"},i}),{}),e?.properties)}},Fr=class{constructor(e){this._instance=e,this.Yi=new Map,this.Xi=new Map,this.Qi=new Map}Zi(e,t){return!!e&&oo(e.propertyFilters,t?.properties)}te(e,t){var i=new Map;return e.forEach((s=>{var n;(n=s.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach((o=>{if(o!=null&&o.name){var a=i.get(o.name)||[];a.push(s.id),i.set(o.name,a)}}))})),i}ie(e,t,i){var s=(i===dt.Activation?this.Yi:this.Xi).get(e),n=[];return this.ee((o=>{n=o.filter((a=>s?.includes(a.id)))})),n.filter((o=>{var a,l=(a=o.conditions)==null||(a=a[i])==null||(a=a.values)==null?void 0:a.find((u=>u.name===e));return this.Zi(l,t)}))}register(e){var t;f((t=this._instance)==null?void 0:t._addCaptureHook)||(this.re(e),this.se(e))}se(e){var t=e.filter((i=>{var s,n;return((s=i.conditions)==null?void 0:s.actions)&&((n=i.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.ne==null&&(this.ne=new Sr(this._instance),this.ne.init(),this.ne.Wi((i=>{this.onAction(i)}))),t.forEach((i=>{var s,n,o,a,l;i.conditions&&(s=i.conditions)!=null&&s.actions&&(n=i.conditions)!=null&&(n=n.actions)!=null&&n.values&&((o=i.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.ne)==null||a.register(i.conditions.actions.values),(l=i.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((u=>{if(u&&u.name){var c=this.Qi.get(u.name);c&&c.push(i.id),this.Qi.set(u.name,c||[i.id])}})))})))}re(e){var t,i=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})),s=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}));(i.length!==0||s.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((n,o)=>{this.onEvent(n,o)})),this.Yi=this.te(e,dt.Activation),this.Xi=this.te(e,dt.Cancellation))}onEvent(e,t){var i,s=this.oe(),n=this.ae(),o=this.le(),a=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[n])||[];if(o===e&&t&&a.length>0){var l,u;s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var c=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(u=t.properties)==null?void 0:u.$product_tour_id);if(c){var h=a.indexOf(c);h>=0&&(a.splice(h,1),this.ue(a))}}else{if(this.Xi.has(e)){var p=this.ie(e,t,dt.Cancellation);p.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:p.map((v=>v.id))}),p.forEach((v=>{var _=a.indexOf(v.id);_>=0&&a.splice(_,1),this.he(v.id)})),this.ue(a))}if(this.Yi.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.Yi.get(e)});var g=this.ie(e,t,dt.Activation);this.ue(a.concat(g.map((v=>v.id))||[]))}}}onAction(e){var t,i=this.ae(),s=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[i])||[];this.Qi.has(e)&&this.ue(s.concat(this.Qi.get(e)||[]))}ue(e){var t,i=this.oe(),s=this.ae(),n=[...new Set(e)].filter((o=>!this.de(o)));i.info("updating activated items",{activatedItems:n}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[s]:n})}getActivatedIds(){var e,t=this.ae(),i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return i||[]}getEventToItemsMap(){return this.Yi}ve(){return this.ne}},$r=class extends Fr{constructor(e){super(e)}ae(){return"$surveys_activated"}le(){return bt.SHOWN}ee(e){var t;(t=this._instance)==null||t.getSurveys(e)}he(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}oe(){return O}de(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Ir=class{constructor(e){this.ce=void 0,this._surveyManager=null,this.fe=!1,this.pe=[],this.ge=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(I(t))return O.warn("Flags not loaded yet. Not loading surveys.");var i=T(t);this.ce=i?t.length>0:t,O.info("flags response received, isSurveysEnabled: "+this.ce),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(i!=null&&i.startsWith(ao)||i!=null&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((s=>localStorage.removeItem(s)))}loadIfEnabled(){if(!this._surveyManager)if(this.fe)O.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)O.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())O.info("Not loading surveys in cookieless mode without consent.");else{var e=E?.__PosthogExtensions__;if(e){if(!f(this.ce)||this._instance.config.advanced_enable_surveys){var t=this.ce||this._instance.config.advanced_enable_surveys;this.fe=!0;try{var i=e.generateSurveys;if(i)return void this._e(i,t);var s=e.loadExternalDependency;if(!s)return void this.me("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",(n=>{n||!e.generateSurveys?this.me("Could not load surveys script",n):this._e(e.generateSurveys,t)}))}catch(n){throw this.me("Error initializing surveys",n),n}finally{this.fe=!1}}}else O.error("PostHog Extensions not found.")}}_e(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new $r(this._instance),O.info("Surveys loaded successfully"),this.be({isLoaded:!0})}me(e,t){O.error(e,t),this.be({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.pe.push(e),this._surveyManager&&this.be({isLoaded:!0}),()=>{this.pe=this.pe.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return O.info("Disabled. Not loading surveys."),e([]);var i,s=this._instance.get_property(Qi);if(s&&!t)return e(s,{isLoaded:!0});typeof Promise<"u"&&this.ge?this.ge.then((n=>{var{surveys:o,context:a}=n;return e(o,a)})):(typeof Promise<"u"&&(this.ge=new Promise((n=>{i=n}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:n=>{var o;this.ge=null;var a=n.statusCode;if(a!==200||!n.json){var l="Surveys API could not be loaded, status: "+a;O.error(l);var u={isLoaded:!1,error:l};return e([],u),void(i==null||i({surveys:[],context:u}))}var c,h=n.json.surveys||[],p=h.filter((v=>(function(_){return!(!_.start_date||_.end_date)})(v)&&((function(_){var m;return!((m=_.conditions)==null||(m=m.events)==null||(m=m.values)==null||!m.length)})(v)||(function(_){var m;return!((m=_.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)})(v))));p.length>0&&((c=this._surveyEventReceiver)==null||c.register(p)),(o=this._instance.persistence)==null||o.register({[Qi]:h});var g={isLoaded:!0};e(h,g),i?.({surveys:h,context:g})}}))}be(e){for(var t of this.pe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){O.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!I(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);O.warn("init was not called")}ye(e){var t=null;return this.getSurveys((i=>{var s;t=(s=i.find((n=>n.id===e)))!==null&&s!==void 0?s:null})),t}we(e){if(I(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.ye(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(I(this._surveyManager))return O.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.we(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return I(this._surveyManager)?(O.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((i=>{this.getSurveys((s=>{var n,o=(n=s.find((l=>l.id===e)))!==null&&n!==void 0?n:null;if(o){var a=this.we(o);i({visible:a.eligible,disabledReason:a.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,i){var s;if(I(this._surveyManager))O.warn("init was not called");else{var n=typeof e=="string"?this.ye(e):e;if(n!=null&&n.id)if(Va.includes(n.type)){var o=y?.querySelector(t);if(o)return(s=n.appearance)!=null&&s.surveyPopupDelaySeconds?(O.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;O.info("Rendering survey "+n.id+" with delay of "+((a=n.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(n,o,i),O.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,o,i);O.warn("Survey element not found")}else O.warn("Surveys of type "+n.type+" cannot be rendered in the app");else O.warn("Survey not found")}}displaySurvey(e,t){var i;if(I(this._surveyManager))O.warn("init was not called");else{var s=this.ye(e);if(s){var n=s;if((i=s.appearance)!=null&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=w({},s,{appearance:w({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Pr.Popover&&t.initialResponses&&O.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.canRenderSurvey(s);if(!o.visible)return void O.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Pr.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else O.warn("Survey not found")}}cancelPendingSurvey(e){I(this._surveyManager)?O.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},ge=N("[Conversations]"),Rr=class{constructor(e){this.xe=void 0,this._conversationsManager=null,this.Ee=!1,this.$e=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;I(t)||(be(t)?this.xe=t:(this.xe=t.enabled,this.$e=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.xe=void 0,this.$e=null}loadIfEnabled(){if(!this._conversationsManager&&!this.Ee&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=E?.__PosthogExtensions__;if(e&&!f(this.xe)&&this.xe)if(this.$e&&this.$e.token){this.Ee=!0;try{var t=e.initConversations;if(t)return this.Se(t),void(this.Ee=!1);var i=e.loadExternalDependency;if(!i)return void this.ke("PostHog loadExternalDependency extension not found.");i(this._instance,"conversations",(s=>{s||!e.initConversations?this.ke("Could not load conversations script",s):this.Se(e.initConversations),this.Ee=!1}))}catch(s){this.ke("Error initializing conversations",s),this.Ee=!1}}else ge.error("Conversations enabled but missing token in remote config.")}}Se(e){if(this.$e)try{this._conversationsManager=e(this.$e,this._instance),ge.info("Conversations loaded successfully")}catch(t){this.ke("Error completing conversations initialization",t)}else ge.error("Cannot complete initialization: remote config is null")}ke(e,t){ge.error(e,t),this._conversationsManager=null,this.Ee=!1}show(){this._conversationsManager?this._conversationsManager.show():ge.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.xe===!0&&!oe(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,i){var s=this;return Je((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(ge.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var i=this;return Je((function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(ge.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return Je((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(ge.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return Je((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(ge.warn("Conversations not available yet."),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}},Tr=class{constructor(e){var t;this.Pe=!1,this.Te=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Pe=!0)}onRemoteConfig(e){var t,i=(t=e.logs)==null?void 0:t.captureConsoleLogs;!I(i)&&i&&(this.Pe=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Pe&&!this.Te){var e=N("[logs]"),t=E?.__PosthogExtensions__;if(t){var i=t.loadExternalDependency;i?i(this._instance,"logs",(s=>{var n;s||(n=t.logs)==null||!n.initializeLogs?e.error("Could not load logs script",s):(t.logs.initializeLogs(this._instance),this.Te=!0)})):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}},Zs=N("[RateLimiter]"),Cr=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((s=>{Zs.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4}))}catch(s){return void Zs.warn('could not rate limit - continuing. Error: "'+s?.message+'"',{text:i})}},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,i,s;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(i=this.instance.persistence)==null?void 0:i.get_property(ir))!==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 u=l.tokens<1;return u||e||(l.tokens=Math.max(0,l.tokens-1)),!u||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=u,(s=this.instance.persistence)==null||s.set_property(ir,l),{isRateLimited:u,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},De=N("[RemoteConfig]"),Or=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=E._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Ie(e){var t,i;(t=E.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(De.error("PostHog Extensions not found. Cannot load remote config."),e())}Ce(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 De.info("Using preloaded remote config",this.remoteConfig),void this.wi(this.remoteConfig);if(this._instance.M())return void De.warn("Remote config is disabled. Falling back to local config.");this.Ie((e=>{if(!e)return De.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ce((t=>{this.wi(t)}));this.wi(e)}))}catch(e){De.error("Error loading remote config",e)}}wi(e){e?this._instance.config.__preview_remote_config?(this._instance.wi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):De.info("__preview_remote_config is disabled. Logging config instead",e):De.error("Failed to fetch remote config from PostHog.")}},Mr=3e3,Ar=class{constructor(e,t){this.Re=!0,this.Fe=[],this.Oe=he(t?.flush_interval_ms||Mr,250,5e3,b.createLogger("flush interval"),Mr),this.Me=e}enqueue(e){this.Fe.push(e),this.Ae||this.je()}unload(){this.De();var e=this.Fe.length>0?this.Le():{},t=Object.values(e);[...t.filter((i=>i.url.indexOf("/e")===0)),...t.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.Me(w({},i,{transport:"sendBeacon"}))}))}enable(){this.Re=!1,this.je()}je(){var e=this;this.Re||(this.Ae=setTimeout((()=>{if(this.De(),this.Fe.length>0){var t=this.Le(),i=function(){var n=t[s],o=new Date().getTime();n.data&&T(n.data)&&M(n.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.Me(n)};for(var s in t)i()}}),this.Oe))}De(){clearTimeout(this.Ae),this.Ae=void 0}Le(){var e={};return M(this.Fe,(t=>{var i,s=t,n=(s?s.batchKey:null)||s.url;f(e[n])&&(e[n]=w({},s,{data:[]})),(i=e[n].data)==null||i.push(s.data)})),this.Fe=[],e}},za=["retriesPerformedSoFar"],Dr=class{constructor(e){this.Ne=!1,this.Ue=3e3,this.Fe=[],this._instance=e,this.Fe=[],this.ze=!0,!f(d)&&"onLine"in d.navigator&&(this.ze=d.navigator.onLine,this.He=()=>{this.ze=!0,this.Lt()},this.Be=()=>{this.ze=!1},j(d,"online",this.He),j(d,"offline",this.Be))}get length(){return this.Fe.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=nn(e,za);ze(t)&&(i.url=ri(i.url,{retry_count:t})),this._instance._send_request(w({},i,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(t??0)<10?this.qe(w({retriesPerformedSoFar:t},i)):i.callback==null||i.callback(s)}}))}qe(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=(function(o){var a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),c=(Math.random()-.5)*(u-l);return Math.ceil(u+c)})(t),s=Date.now()+i;this.Fe.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in "+i;navigator.onLine||(n+=" (Browser is offline)"),b.warn(n),this.Ne||(this.Ne=!0,this.We())}We(){if(this.Ge&&clearTimeout(this.Ge),this.Fe.length===0)return this.Ne=!1,void(this.Ge=void 0);this.Ge=setTimeout((()=>{this.ze&&this.Fe.length>0&&this.Lt(),this.We()}),this.Ue)}Lt(){var e=Date.now(),t=[],i=this.Fe.filter((n=>n.retryAt<e||(t.push(n),!1)));if(this.Fe=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Ge&&(clearTimeout(this.Ge),this.Ge=void 0),this.Ne=!1,f(d)||(this.He&&(d.removeEventListener("online",this.He),this.He=void 0),this.Be&&(d.removeEventListener("offline",this.Be),this.Be=void 0)),this.Fe))try{this._instance._send_request(w({},e,{transport:"sendBeacon"}))}catch(t){b.error(t)}this.Fe=[]}},Nr=class{constructor(e){this.Ve=()=>{var t,i,s,n;this.Je||(this.Je={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=a+(o?.clientHeight||0),c=o?.scrollHeight||0;this.Je.lastScrollY=Math.ceil(a),this.Je.maxScrollY=Math.max(a,(t=this.Je.maxScrollY)!==null&&t!==void 0?t:0),this.Je.maxScrollHeight=Math.max(l,(i=this.Je.maxScrollHeight)!==null&&i!==void 0?i:0),this.Je.lastContentY=u,this.Je.maxContentY=Math.max(u,(s=this.Je.maxContentY)!==null&&s!==void 0?s:0),this.Je.maxContentHeight=Math.max(c,(n=this.Je.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}getContext(){return this.Je}resetContext(){var e=this.Je;return setTimeout(this.Ve,0),e}startMeasuringScrollPosition(){j(d,"scroll",this.Ve,{capture:!0}),j(d,"scrollend",this.Ve,{capture:!0}),j(d,"resize",this.Ve)}scrollElement(){if(!this._instance.config.scroll_root_selector)return d?.document.documentElement;var e=T(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=d?.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return d&&(d.scrollY||d.pageYOffset||d.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return d&&(d.scrollX||d.pageXOffset||d.document.documentElement.scrollLeft)||0}},Ya=r=>Zn(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties),ni=class{constructor(e,t,i,s){this.Ke=n=>{var o=this.Ye();if(!o||o.sessionId!==n){var a={sessionId:n,props:this.Xe(this._instance)};this.Qe.register({[tr]:a})}},this._instance=e,this.Ze=t,this.Qe=i,this.Xe=s||Ya,this.Ze.onSessionId(this.Ke)}Ye(){return this.Qe.props[tr]}getSetOnceProps(){var e,t=(e=this.Ye())==null?void 0:e.props;return t?"r"in t?Qn(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 M(Jr(this.getSetOnceProps()),((t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+Oi(i)]=t})),e}},Ri=N("[SessionId]"),oi=class{on(e,t){return this.tr.on(e,t)}constructor(e,t,i){var s;if(this.ir=[],this.er=void 0,this.tr=new Rt,this.rr=(c,h)=>!(!ze(c)||!ze(h))&&Math.abs(c-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=e.config,this.Qe=e.persistence,this.sr=void 0,this.nr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ar=t||Re,this.lr=i||Re;var n=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*he(o,60,36e3,Ri.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ur(),this.hr="ph_"+n+"_window_id",this.dr="ph_"+n+"_primary_window_exists",this.vr()){var a=B.W(this.hr),l=B.W(this.dr);a&&!l?this.sr=a:B.V(this.hr),B.G(this.dr,!0)}if((s=this.R.bootstrap)!=null&&s.sessionID)try{var u=(c=>{var h=c.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.R.bootstrap.sessionID);this.cr(this.R.bootstrap.sessionID,new Date().getTime(),u)}catch(c){Ri.error("Invalid sessionID in bootstrap",c)}this.pr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return f(this.ir)&&(this.ir=[]),this.ir.push(e),this.nr&&e(this.nr,this.sr),()=>{this.ir=this.ir.filter((t=>t!==e))}}vr(){return this.R.persistence!=="memory"&&!this.Qe.Pi&&B.H()}gr(e){e!==this.sr&&(this.sr=e,this.vr()&&B.G(this.hr,e))}_r(){return this.sr?this.sr:this.vr()?B.W(this.hr):null}cr(e,t,i){e===this.nr&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.nr=e,this.Qe.register({[Gt]:[t,e,i]}))}mr(){var e=this.Qe.props[Gt];return T(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.cr(null,null,null)}destroy(){clearTimeout(this.br),this.br=void 0,this.er&&d&&(d.removeEventListener("beforeunload",this.er,{capture:!1}),this.er=void 0),this.ir=[]}pr(){this.er=()=>{this.vr()&&B.V(this.dr)},j(d,"beforeunload",this.er,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.R.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||new Date().getTime(),[s,n,o]=this.mr(),a=this._r(),l=ze(o)&&Math.abs(i-o)>864e5,u=!1,c=!n,h=!c&&!e&&this.rr(i,s);c||h||l?(n=this.ar(),a=this.lr(),Ri.info("new session ID generated",{sessionId:n,windowId:a,changeReason:{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}}),o=i,u=!0):a||(a=this.lr(),u=!0);var p=ze(s)&&e&&!l?s:i,g=ze(o)?o:new Date().getTime();return this.gr(a),this.cr(n,p,g),e||this.ur(),u&&this.ir.forEach((v=>v(n,a,u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0))),{sessionId:n,windowId:a,sessionStartTimestamp:g,changeReason:u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}ur(){clearTimeout(this.br),this.br=setTimeout((()=>{var[e]=this.mr();if(this.rr(new Date().getTime(),e)){var t=this.nr;this.resetSessionId(),this.tr.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},Ja=["$set_once","$set"],$e=N("[SiteApps]"),Lr=class{constructor(e){this._instance=e,this.yr=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}wr(e,t){if(t){var i=this.globalsForEvent(t);this.yr.push(i),this.yr.length>1e3&&(this.yr=this.yr.slice(10))}}get siteAppLoaders(){var e;return(e=E._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.wr.bind(this));this.Er=()=>{e(),this.yr=[],this.Er=void 0}}}globalsForEvent(e){var t,i,s,n,o,a,l;if(!e)throw new Error("Event payload is required");var u={},c=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[p,g]of Object.entries(h))u[p]={id:c[p],type:p,properties:g};var{$set_once:v,$set:_}=e;return{event:w({},nn(e,Ja),{properties:w({},e.properties,_?{$set:w({},(t=(i=e.properties)==null?void 0:i.$set)!==null&&t!==void 0?t:{},_)}:{},v?{$set_once:w({},(s=(n=e.properties)==null?void 0:n.$set_once)!==null&&s!==void 0?s:{},v)}:{}),elements_chain:(o=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var a;!t.errored&&this.yr.length&&($e.info("Processing "+this.yr.length+" events for site app with id "+e.id),this.yr.forEach((l=>t.processEvent==null?void 0:t.processEvent(l))),t.processedBuffer=!0),Object.values(this.apps).every((l=>l.processedBuffer||l.errored))&&((a=this.Er)==null||a.call(this))},s=!1,n=a=>{t.errored=!a,t.loaded=!0,$e.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),s&&i()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{n(a)}});o&&(t.processEvent=o),s=!0}catch(a){$e.error("Error while initializing PostHog app with config id "+e.id,a),n(!1)}if(s&&t.loaded)try{i()}catch(a){$e.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}$r(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}Sr(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{i.processEvent==null||i.processEvent(t)}catch(s){$e.error("Error while processing event "+e.event+" for site app "+i.id,s)}}}onRemoteConfig(e){var t,i,s,n=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.$r(),void this._instance.on("eventCaptured",(u=>this.Sr(u)))):void $e.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.Er)==null||i.call(this),(s=e.siteApps)!=null&&s.length)if(this.isEnabled){var o=function(u){var c;E["__$$ph_site_app_"+u]=n._instance,(c=E.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(n._instance,l,(h=>{if(h)return $e.error("Error while initializing PostHog app with config id "+u,h)}))};for(var{id:a,url:l}of e.siteApps)o(a)}else $e.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},lo=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&ds(t,e))return!0;try{var i=r?.userAgentData;if(i!=null&&i.brands&&i.brands.some((s=>ds(s?.brand,e))))return!0}catch{}return!!r.webdriver},wt=(function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r})({}),Qs="i.posthog.com",jr=class{constructor(e){this.kr={},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("."+Qs,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.kr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.kr[this.apiHost]=wt.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.kr[this.apiHost]=wt.EU:this.kr[this.apiHost]=wt.CUSTOM),this.kr[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===wt.CUSTOM)return this.apiHost+t;var i=Qs+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}},Xa={icontains:(r,e)=>!!d&&e.href.toLowerCase().indexOf(r.toLowerCase())>-1,not_icontains:(r,e)=>!!d&&e.href.toLowerCase().indexOf(r.toLowerCase())===-1,regex:(r,e)=>!!d&&si(e.href,r),not_regex:(r,e)=>!!d&&!si(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r},Hr=class r{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),t.getWebExperiments((s=>{r.Pr("retrieved web experiments from the server"),t.Tr=new Map,s.forEach((n=>{if(n.feature_flag_key){var o;t.Tr&&(r.Pr("setting flag key ",n.feature_flag_key," to web experiment ",n),(o=t.Tr)==null||o.set(n.feature_flag_key,n));var a=t._instance.getFeatureFlag(n.feature_flag_key);U(a)&&n.variants[a]&&t.Ir(n.name,a,n.variants[a].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];r.Cr(u)&&t.Ir(n.name,l,u.transforms)}}))}),i)},this._instance=e,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}onFeatureFlags(e){if(this._is_bot())r.Pr("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(I(this.Tr))return this.Tr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();r.Pr("applying feature flags",e),e.forEach((t=>{var i;if(this.Tr&&(i=this.Tr)!=null&&i.has(t)){var s,n=this._instance.getFeatureFlag(t),o=(s=this.Tr)==null?void 0:s.get(t);n&&o!=null&&o.variants[n]&&this.Ir(o.name,n,o.variants[n].transforms)}}))}}previewWebExperiment(){var e=r.getWindowLocation();if(e!=null&&e.search){var t=Kt(e?.search,"__experiment_id"),i=Kt(e?.search,"__experiment_variant");t&&i&&(r.Pr("previewing web experiments "+t+" && "+i),this.getWebExperiments((s=>{this.Rr(parseInt(t),i,s)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:n=>{if(n.statusCode!==200||!n.json)return e([]);var o=n.json.experiments||[];return e(o)}})}Rr(e,t,i){var s=i.filter((n=>n.id===e));s&&s.length>0&&(r.Pr("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.Ir(s[0].name,t,s[0].variants[t].transforms))}static Cr(e){return!I(e.conditions)&&r.Fr(e)&&r.Or(e)}static Fr(e){var t;if(I(e.conditions)||I((t=e.conditions)==null?void 0:t.url))return!0;var i,s,n,o=r.getWindowLocation();return!!o&&((i=e.conditions)==null||!i.url||Xa[(s=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,o))}static getWindowLocation(){return d?.location}static Or(e){var t;if(I(e.conditions)||I((t=e.conditions)==null?void 0:t.utm))return!0;var i=Yn();if(i.utm_source){var s,n,o,a,l,u,c,h,p=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==i.utm_campaign,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)==i.utm_source,v=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==i.utm_medium,_=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==i.utm_term;return p&&v&&_&&g}return!1}static Pr(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];b.info("[WebExperiments] "+e,i)}Ir(e,t,i){this._is_bot()?r.Pr("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?i.forEach((s=>{if(s.selector){var n;r.Pr("applying transform of variant "+t+" for experiment "+e+" ",s);var o=(n=document)==null?void 0:n.querySelectorAll(s.selector);o?.forEach((a=>{var l=a;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)}))}})):r.Pr("Control variants leave the page unmodified.")}_is_bot(){return ee&&this._instance?lo(ee,this._instance.config.custom_blocked_useragents):void 0}},Ka=N("[PostHog ExternalIntegrations]"),Za={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},qr=class{constructor(e){this._instance=e}it(e,t){var i;(i=E.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,(s=>{if(s)return Ka.error("failed to load script",s);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,u;!s||(a=E.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(Za[o],(()=>{var c;(c=E.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)})),!s&&(l=E.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((u=E.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.stop())};for(var[i,s]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(i)}}},Ur="[SessionRecording]",pt=N(Ur),ai=class{get started(){var e;return!((e=this.Mr)==null||!e.isStarted)}get status(){return this.Mr?this.Mr.status:this.Ar&&!this.jr?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Ar=!1,this.Dr=void 0,this._instance=e,!this._instance.sessionManager)throw pt.error("started without valid sessionManager"),new Error(Ur+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Ur+' cannot be used with cookieless_mode="always"')}get jr(){var e,t=!((e=this._instance.get_property(fi))==null||!e.enabled),i=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return d&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this.jr||(t=this.Mr)==null||!t.isStarted){var i=!f(Object.assign)&&!f(Array.from);this.jr&&i?(this.Lr(e),pt.info("starting")):this.stopRecording()}}Lr(e){var t,i,s;this.jr&&(E!=null&&(t=E.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=E.__PosthogExtensions__)!=null&&i.initSessionRecording?this.Nr(e):(s=E.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.Ur,(n=>{if(n)return pt.error("could not load recorder",n);this.Nr(e)})))}stopRecording(){var e,t;(e=this.Dr)==null||e.call(this),this.Dr=void 0,(t=this.Mr)==null||t.stop()}zr(){var e;(e=this._instance.persistence)==null||e.unregister(Tn)}Hr(e){if(this._instance.persistence){var t,i,s=this._instance.persistence,n=()=>{var o=e.sessionRecording===!1?void 0:e.sessionRecording,a=o?.sampleRate,l=I(a)?null:parseFloat(a);I(l)&&this.zr();var u=o?.minimumDurationMilliseconds;s.register({[fi]:w({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:w({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:f(u)?null:u,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers})})};n(),(t=this.Dr)==null||t.call(this),this.Dr=(i=this._instance.sessionManager)==null?void 0:i.onSessionId(n)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.Hr(e),this.Ar=!0,this.startIfEnabledOrStop()):this.Ar=!0:pt.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;t===void 0&&(t="log"),(i=this.Mr)!=null&&i.log?this.Mr.log(e,t):pt.warn("log called before recorder was ready")}get Ur(){var e,t,i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(fi);return(i==null||(t=i.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Nr(e){var t,i;if((t=E.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Mr||(this.Mr=(i=E.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.Mr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Mr.start(e)}onRRwebEmit(e){var t;(t=this.Mr)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Mr||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.Mr)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Mr||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.Mr)==null||e.overrideSampling()}overrideTrigger(e){var t,i;this.Mr||(i=this._instance.persistence)==null||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Mr)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Mr)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!((i=this.Mr)==null||!i.tryAddCustomEvent(e,t))}},kt={},Br=()=>{},Ye="posthog",co=!Oa&&X?.indexOf("MSIE")===-1&&X?.indexOf("Mozilla")===-1,en=r=>{var e;return w({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Jo(y?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Br,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:r??"unset",__preview_deferred_init_extensions:!1,debug:G&&U(G?.search)&&G.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:!0,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(d==null||(e=d.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;b.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Mr},error_tracking:{},_onCapture:Br,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},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}))(r))},tn=r=>{var e={};f(r.process_person)||(e.person_profiles=r.process_person),f(r.xhr_headers)||(e.request_headers=r.xhr_headers),f(r.cookie_name)||(e.persistence_name=r.cookie_name),f(r.disable_cookie)||(e.disable_persistence=r.disable_cookie),f(r.store_google)||(e.save_campaign_params=r.store_google),f(r.verbose)||(e.debug=r.verbose);var t=L({},e,r);return T(r.property_blacklist)&&(f(r.property_denylist)?t.property_denylist=r.property_blacklist:T(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:b.error("Invalid value for property_denylist config: "+r.property_denylist)),t},Gr=class{constructor(){this.__forceAllowLocalhost=!1}get Br(){return this.__forceAllowLocalhost}set Br(e){b.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},li=class r{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new Gr,this.qr=!1,this.version=ve.LIB_VERSION,this.bi=new Rt,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=en(),this.SentryIntegration=pr,this.sentryIntegration=e=>(function(t,i){var s=zn(t,i);return{name:Wn,processEvent:n=>s(n)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Wr=!1,this.Gr=null,this.Vr=null,this.Jr=null,this.featureFlags=new xr(this),this.toolbar=new gr(this),this.scrollManager=new Nr(this),this.pageViewManager=new ei(this),this.surveys=new Ir(this),this.conversations=new Rr(this),this.logs=new Tr(this),this.experiments=new Hr(this),this.exceptions=new Er(this),this.rateLimiter=new Cr(this),this.requestRouter=new jr(this),this.consent=new ur(this),this.externalIntegrations=new qr(this),this.people={set:(e,t,i)=>{var s=U(e)?{[e]:t}:e;this.setPersonProperties(s),i?.({})},set_once:(e,t,i)=>{var s=U(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),i?.({})}},this.on("eventCaptured",(e=>b.info('send "'+e?.event+'"',e)))}init(e,t,i){if(i&&i!==Ye){var s,n=(s=kt[i])!==null&&s!==void 0?s:new r;return n._init(e,t,i),kt[i]=n,kt[Ye][i]=n,n}return this._init(e,t,i)}_init(e,t,i){var s;if(t===void 0&&(t={}),f(e)||Mi(e))return b.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.Kr(t.debug),this.Yr=t,this.Xr=[],t.person_profiles&&(this.Vr=t.person_profiles),this.set_config(L({},en(t.defaults),tn(t),{name:i,token:e})),this.config.on_xhr_error&&b.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:me.GZipJS;var n=this.Qr();this.persistence=new xt(this.config,n),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new xt(w({},this.config,{persistence:"sessionStorage"}),n);var o=w({},this.persistence.props),a=w({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Zr=new Ar((k=>this.ts(k)),this.config.request_queue_config),this.es=new Dr(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new oi(this),this.sessionPropsManager=new ni(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(b.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.rs(l)}),0)):(b.info("Initializing extensions synchronously"),this.rs(l)),ve.DEBUG=ve.DEBUG||this.config.debug,ve.DEBUG&&b.info("Starting in debug mode",{this:this,config:t,thisC:w({},this.config),p:o,s:a}),((s=t.bootstrap)==null?void 0:s.distinctID)!==void 0){var u,c,h=this.config.get_device_id(Re()),p=(u=t.bootstrap)!=null&&u.isIdentifiedID?h:t.bootstrap.distinctID;this.persistence.set_property(_e,(c=t.bootstrap)!=null&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:p})}if(this.ss()){var g,v,_=Object.keys(((g=t.bootstrap)==null?void 0:g.featureFlags)||{}).filter((k=>{var R;return!((R=t.bootstrap)==null||(R=R.featureFlags)==null||!R[k])})).reduce(((k,R)=>{var $;return k[R]=(($=t.bootstrap)==null||($=$.featureFlags)==null?void 0:$[R])||!1,k}),{}),m=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter((k=>_[k])).reduce(((k,R)=>{var $,x;return($=t.bootstrap)!=null&&($=$.featureFlagPayloads)!=null&&$[R]&&(k[R]=(x=t.bootstrap)==null||(x=x.featureFlagPayloads)==null?void 0:x[R]),k}),{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:m})}if(l)this.register_once({distinct_id:nt,$device_id:null},"");else if(!this.get_distinct_id()){var P=this.config.get_device_id(Re());this.register_once({distinct_id:P,$device_id:P},""),this.persistence.set_property(_e,"anonymous")}return j(d,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?fa(this,(()=>this.ns())):this.ns(),Te(this.config._onCapture)&&this.config._onCapture!==Br&&(b.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&b.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}rs(e){var t=performance.now();this.historyAutocapture=new dr(this),this.historyAutocapture.startIfEnabled();var i=[];i.push((()=>{new vr(this).startIfEnabledOrStop()})),i.push((()=>{var s;this.siteApps=new Lr(this),(s=this.siteApps)==null||s.init()})),e||i.push((()=>{this.sessionRecording=new ai(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||i.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),i.push((()=>{this.autocapture=new or(this),this.autocapture.startIfEnabled()})),i.push((()=>{this.surveys.loadIfEnabled()})),i.push((()=>{this.logs.loadIfEnabled()})),i.push((()=>{this.conversations.loadIfEnabled()})),i.push((()=>{this.productTours=new kr(this),this.productTours.loadIfEnabled()})),i.push((()=>{this.heatmaps=new fr(this),this.heatmaps.startIfEnabled()})),i.push((()=>{this.webVitalsAutocapture=new _r(this)})),i.push((()=>{this.exceptionObserver=new hr(this),this.exceptionObserver.startIfEnabledOrStop()})),i.push((()=>{this.deadClicksAutocapture=new Qt(this,_a),this.deadClicksAutocapture.startIfEnabled()})),i.push((()=>{if(this.os){var s=this.os;this.os=void 0,this.wi(s)}})),this.ls(i,t)}ls(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.ls(e,t)}),0);var i=e.shift();if(i)try{i()}catch(n){b.error("Error initializing extension:",n)}}var s=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:s}),this.config.__preview_deferred_init_extensions&&b.info("PostHog extensions initialized ("+s+"ms)")}wi(e){var t,i,s,n,o,a,l,u,c;if(!y||!y.body)return b.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.wi(e)}),500);this.config.__preview_deferred_init_extensions&&(this.os=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=F(e.supportedCompression,me.GZipJS)?me.GZipJS:F(e.supportedCompression,me.Base64)?me.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Vr?this.Vr:"identified_only"}),(i=this.siteApps)==null||i.onRemoteConfig(e),(s=this.sessionRecording)==null||s.onRemoteConfig(e),(n=this.autocapture)==null||n.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),(a=this.productTours)==null||a.onRemoteConfig(e),(l=this.webVitalsAutocapture)==null||l.onRemoteConfig(e),(u=this.exceptionObserver)==null||u.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(c=this.deadClicksAutocapture)==null||c.onRemoteConfig(e)}ns(){try{this.config.loaded(this)}catch(i){b.critical("`loaded` function failed",i)}if(this.us(),this.config.internal_or_test_user_hostname&&G!=null&&G.hostname){var e=G.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==="always")&&this.hs()}),1),new Or(this).load(),this.featureFlags.flags()}us(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Zr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Ce(this.__request_queue,(e=>this.ts(e))),this.__request_queue=[],this.us()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.ds()&&this.capture("$pageleave"),(e=this.Zr)==null||e.unload(),(t=this.es)==null||t.unload()):this.ds()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(co?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=ri(e.url,{ip:this.config.ip?1:0}),e.headers=w({},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 i,s,n,o=w({},t);o.timeout=o.timeout||6e4,o.url=ri(o.url,{_:new Date().getTime().toString(),ver:ve.LIB_VERSION,compression:o.compression});var a=(i=o.transport)!==null&&i!==void 0?i:"fetch",l=Ht.filter((c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport))),u=(s=(n=$n(l,(c=>c.transport===a)))==null?void 0:n.method)!==null&&s!==void 0?s:l[0].method;if(!u)throw new Error("No available transport method");u(o)})(w({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((i=(s=this.config).on_request_error)==null||i.call(s,t)),e.callback==null||e.callback(t)}}))))}ts(e){this.es?this.es.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],s=[],n=[];Ce(e,(a=>{a&&(t=a[0],T(t)?n.push(a):Te(a)?a.call(this):T(a)&&t==="alias"?i.push(a):T(a)&&t.indexOf("capture")!==-1&&Te(this[t])?n.push(a):s.push(a))}));var o=function(a,l){Ce(a,(function(u){if(T(u[0])){var c=l;M(u,(function(h){c=c[h[0]].apply(c,h.slice(1))}))}else this[u[0]].apply(this,u.slice(1))}),l)};o(i,this),o(s,this),o(n,this)}ss(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zr){if(this.is_capturing())if(!f(e)&&U(e)){var n=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(n&&!this.config.__preview_capture_bot_pageviews)){var o=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!U(t?.$current_url)&&(b.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,l=i?.timestamp||a,u=Re(),c={uuid:u,event:e,properties:this.calculateEventProperties(e,t||{},l,u)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&n&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),o&&(c.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),i?.$set&&(c.$set=i?.$set);var h,p=e!=="$groupidentify",g=this.vs(i?.$set_once,p);if(g&&(c.$set_once=g),(c=zo(c,i!=null&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,f(i?.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a),e===bt.DISMISSED||e===bt.SENT){var v=t?.[Ii.SURVEY_ID],_=t?.[Ii.SURVEY_ITERATION];h={id:v,current_iteration:_},localStorage.getItem(Ks(h))||localStorage.setItem(Ks(h),"true"),c.$set=w({},c.$set,{[Ga({id:v,current_iteration:_},e===bt.SENT?"responded":"dismissed")]:!0})}else e===bt.SHOWN&&(c.$set=w({},c.$set,{[Ii.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var m=w({},c.properties.$set,c.$set);if(Xe(m)||this.setPersonPropertiesForFlags(m),!I(this.config.before_send)){var P=this.cs(c);if(!P)return;c=P}this.bi.emit("eventCaptured",c);var k={method:"POST",url:(s=i?._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:i?._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.ts(k):this.Zr.enqueue(k),c}b.critical("This capture call is ignored due to client rate limiting.")}}else b.error("No event name provided to posthog.capture")}else b.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,i,s,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var o=n?void 0:this.persistence.remove_event_timer(e),a=w({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=w({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!U(a.distinct_id)&&!we(a.distinct_id)||Mi(a.distinct_id))&&b.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=xa(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime());a.$session_id=h,a.$window_id=p}this.sessionPropsManager&&L(a,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&L(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(g=this.es)==null?void 0:g.length}catch(P){a.$sdk_debug_error_capturing_properties=String(P)}if(this.requestRouter.region===wt.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||n?e!=="$pageleave"||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),a=L(a,u),e==="$pageview"&&y&&(a.title=y.title),!f(o)){var v=i.getTime()-o;a.$duration=parseFloat((v/1e3).toFixed(3))}X&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=L({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),T(this.config.property_denylist)?M(this.config.property_denylist,(function(P){delete a[P]})):b.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(b.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,e));var m=this.fs();return a.$process_person_profile=m,m&&!n&&this.ps("_calculate_event_properties"),a}vs(e,t){var i;if(t===void 0&&(t=!0),!this.persistence||!this.fs()||this.qr)return e;var s=this.persistence.get_initial_props(),n=(i=this.sessionPropsManager)==null?void 0:i.getSetOnceProps(),o=L({},s,n||{},e||{}),a=this.config.sanitize_properties;return a&&(b.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.qr=!0),Xe(o)?void 0:o}register(e,t){var i;(i=this.persistence)==null||i.register(e,t)}register_once(e,t,i){var s;(s=this.persistence)==null||s.register_once(e,t,i)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}gs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,i){var s=i!=null&&i.merge?this.featureFlags.getFlagVariants():{},n=i!=null&&i.merge?this.featureFlags.getFlagPayloads():{},o=w({},s,e),a=w({},n,t),l={};for(var[u,c]of Object.entries(o)){var h=typeof c=="string";l[u]={key:u,enabled:!!h||!!c,variant:h?c:void 0,reason:void 0,metadata:f(a?.[u])?void 0:{id:0,version:void 0,description:void 0,payload:a[u]}}}this.featureFlags.receivedFeatureFlags({flags:l})}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.bi.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=Wa),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return b.uninitializedWarning("posthog.identify");if(we(e)&&(e=e.toString(),b.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))b.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==nt){if(this.ps("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(vt)&&(this.unregister(vt),this.register({distinct_id:e}));var o=(this.persistence.get_property(_e)||"anonymous")==="anonymous";e!==s&&o?(this.persistence.set_property(_e,"identified"),this.setPersonPropertiesForFlags(w({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.Jr=Vs(e,t,i),this.featureFlags.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(Vt))}}else b.critical('The string "'+nt+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else b.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.ps("posthog.setPersonProperties")){var i=Vs(this.get_distinct_id(),e,t);this.Jr!==i?(this.setPersonPropertiesForFlags(w({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Jr=i):b.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:w({},s,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),s[e]===t||i||this.reloadFeatureFlags()}else b.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.ps("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,n;if(b.info("reset"),!this.__loaded)return b.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(i=this.sessionPersistence)==null||i.clear(),this.surveys.reset(),this.featureFlags.reset(),(s=this.persistence)==null||s.set_property(_e,"anonymous"),(n=this.sessionManager)==null||n.resetSessionId(),this.Jr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:nt,$device_id:null},"");else{var a=this.config.get_device_id(Re());this.register_once({distinct_id:a,$device_id:e?a:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&i){var n,o=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!i)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-o,0)}return s}alias(e,t){return e===this.get_property(In)?(b.critical("Attempting to create alias for existing People user - aborting."),-2):this.ps("posthog.alias")?(f(t)&&(t=this.get_distinct_id()),e!==t?(this.gs(vt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(b.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=w({},this.config);if(q(e)){var i,s,n,o,a,l,u;L(this.config,tn(e));var c=this.Qr();(i=this.persistence)==null||i.update_config(this.config,t,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new xt(w({},this.config,{persistence:"sessionStorage"}),c);var h=this.Kr(this.config.debug);be(h)&&(this.config.debug=h),be(this.config.debug)&&(this.config.debug?(ve.DEBUG=!0,D.H()&&D.G("ph_debug","true"),b.info("set_config",{config:e,oldConfig:t,newConfig:w({},this.config)})):(ve.DEBUG=!1,D.H()&&D.V("ph_debug"))),(s=this.exceptionObserver)==null||s.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(),this.surveys.loadIfEnabled(),this._s(),(u=this.externalIntegrations)==null||u.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,i={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(i).some(Boolean)){var s,n,o,a,l;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),i.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),i.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),i.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),i.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(w({},s,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Ye;return t!==Ye&&(t=Ye+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(_e))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(_e))==="identified"}fs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Xe(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[vt])&&((t=this.persistence)==null||(t=t.props)==null||!t[zt]))}ds(){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.fs()||this.ps("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ps("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ps(e){return this.config.person_profiles==="never"?(b.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gs(zt,!0),!0)}Qr(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}_s(){var e,t,i,s,n=this.Qr();return((e=this.persistence)==null?void 0:e.Pi)!==n&&((i=this.persistence)==null||i.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.Pi)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!=="always"){var i,s,n;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),(i=this.sessionManager)==null||i.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new oi(this),this.pageViewManager=new ei(this),this.persistence&&(this.sessionPropsManager=new ni(this,this.sessionManager,this.persistence)),this.sessionRecording=new ai(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this._s(),this.us(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(f(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((n=e?.captureEventName)!==null&&n!==void 0?n:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.hs()}else b.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._s(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:nt,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(i=this.sessionRecording)==null||i.stopRecording(),this.sessionRecording=void 0,this.hs())):b.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===fe.GRANTED?"granted":e===fe.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._s()}_is_bot(){return ee?lo(ee,this.config.custom_blocked_useragents):void 0}hs(){y&&(y.visibilityState==="visible"?this.Wr||(this.Wr=!0,this.capture("$pageview",{title:y.title},{send_instantly:!0}),this.Gr&&(y.removeEventListener("visibilitychange",this.Gr),this.Gr=null)):this.Gr||(this.Gr=this.hs.bind(this),j(y,"visibilitychange",this.Gr)))}debug(e){e===!1?(d?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(d?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}M(){var e,t,i,s,n,o,a,l=this.Yr||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(b.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",s=!1,n=b,o=(t="advanced_disable_flags")in(e=l)&&!I(e[t]),a=i in e&&!I(e[i]),o?e[t]:a?(n&&n.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]):s)}cs(e){if(I(this.config.before_send))return e;var t=T(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),I(i)){var n="Event '"+e.event+"' was rejected in beforeSend function";return bo(e.event)?b.warn(n+". This can cause unexpected behavior."):b.info(n),null}i.properties&&!Xe(i.properties)||b.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return(e=this.pageViewManager.Kt)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Kr(e){var t=be(e)&&!e,i=D.H()&&D.q("ph_debug")==="true";return!t&&(!!i||e)}};(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=Wo(r.prototype[e[t]])})(li,["identify"]);var rn;var He=(rn=kt[Ye]=new li,(function(){function r(){r.done||(r.done=!0,co=!1,M(kt,(function(e){e._dom_loaded()})))}y!=null&&y.addEventListener?y.readyState==="complete"?r():j(y,"DOMContentLoaded",r,{capture:!1}):d&&b.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),rn);var qe=class qe{constructor(e){this.has_initialized=!1;this.has_identified=!1;this.init=()=>{try{let{apiKey:e,api_host:t,config:i={}}=this.options;if(!e){console.warn("Posthog: No API key provided");return}let s={api_host:t||ns,ui_host:os,autocapture:!0,capture_pageview:"history_change",session_recording:{recordCrossOriginIframes:!0,minimumDurationMilliseconds:3e4,...i.session_recording},before_send:n=>{if(typeof window>"u")return null;let o=window.location.hostname;return o==="localhost"||o==="127.0.0.1"||as.some(l=>o.endsWith(`.${l}`)||o===l)?n:null},...i};He.init(e,s),this.has_initialized=!0}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 i=typeof He._isIdentified=="function"?He._isIdentified():this.has_identified;e&&!i&&(He.identify(e,{...t,client_id:e}),this.has_identified=!0)}catch(i){console.error("Posthog: Failed to identify user",i)}};this.reset=()=>{if(this.has_initialized)try{He.reset(),this.has_identified=!1}catch(e){console.error("Posthog: Failed to reset",e)}};this.capture=(e,t)=>{if(this.has_initialized)try{He.capture(e,t)}catch(i){console.error("Posthog: Failed to capture event",i)}};this.options=e,this.init()}};qe.getPosthogInstance=e=>(qe._instance||(qe._instance=new qe(e)),qe._instance);var uo=qe;export{uo as Posthog};
6
+ //# sourceMappingURL=posthog-72HGN74H.mjs.map