var d=typeof window<"u"?window:void 0,H=typeof globalThis<"u"?globalThis:d;typeof self>"u"&&(H.self=H),typeof File>"u"&&(H.File=function(){});var as=Array.prototype,or=as.forEach,ar=as.indexOf,J=H?.navigator,y=H?.document,z=H?.location,wi=H?.fetch,Ei=H!=null&&H.XMLHttpRequest&&"withCredentials"in new H.XMLHttpRequest?H.XMLHttpRequest:void 0,lr=H?.AbortController,G=J?.userAgent,x=d??{},_e={DEBUG:!1,LIB_VERSION:"1.315.0"};function cr(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 ur(r){return function(){var e=this,t=arguments;return new Promise(function(i,s){var n=r.apply(e,t);function o(l){cr(n,i,s,o,a,"next",l)}function a(l){cr(n,i,s,o,a,"throw",l)}o(void 0)})}}function b(){return b=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},b.apply(null,arguments)}function ls(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 En=["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"],hr=function(r,e){if(e===void 0&&(e=[]),!r)return!1;var t=r.toLowerCase();return En.concat(e).some(i=>{var s=i.toLowerCase();return t.indexOf(s)!==-1})},xn=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function S(r,e){return r.indexOf(e)!==-1}var Zt=function(r){return r.trim()},xi=function(r){return r.replace(/^\$/,"")},kn=Array.isArray,cs=Object.prototype,us=cs.hasOwnProperty,Jt=cs.toString,I=kn||function(r){return Jt.call(r)==="[object Array]"},Ie=r=>typeof r=="function",q=r=>r===Object(r)&&!I(r),Ge=r=>{if(q(r)){for(var e in r)if(us.call(r,e))return!1;return!0}return!1},f=r=>r===void 0,j=r=>Jt.call(r)=="[object String]",ki=r=>j(r)&&r.trim().length===0,oe=r=>r===null,F=r=>f(r)||oe(r),pe=r=>Jt.call(r)=="[object Number]",we=r=>Jt.call(r)==="[object Boolean]",Sn=r=>r instanceof FormData,Pn=r=>S(xn,r);function Si(r){return r===null||typeof r!="object"}function Lt(r,e){return Object.prototype.toString.call(r)==="[object "+e+"]"}function hs(r){return!f(Event)&&function(e,t){try{return e instanceof t}catch{return!1}}(r,Event)}var $n=[!0,"true",1,"1","yes"],ri=r=>S($n,r),Rn=[!1,"false",0,"0","no"];function de(r,e,t,i,s){return e>t&&(i.warn("min cannot be greater than max."),e=t),pe(r)?r>t?(i.warn(" cannot be  greater than max: "+t+". Using max value instead."),t):r<e?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):r:(i.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+s),de(s||t,e,t,i))}class Fn{constructor(e){this.t={},this.i=e.i,this.o=de(e.bucketSize,0,100,e.h),this.m=de(e.refillRate,0,this.o,e.h),this.$=de(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={}}}var te="Mobile",Nt="iOS",be="Android",wt="Tablet",ds=be+" "+wt,ps="iPad",vs="Apple",gs=vs+" Watch",Et="Safari",Ke="BlackBerry",_s="Samsung",fs=_s+"Browser",ms=_s+" Internet",De="Chrome",In=De+" OS",ys=De+" "+Nt,Vi="Internet Explorer",bs=Vi+" "+te,Gi="Opera",Cn=Gi+" Mini",zi="Edge",ws="Microsoft "+zi,Ye="Firefox",Es=Ye+" "+Nt,xt="Nintendo",kt="PlayStation",Xe="Xbox",xs=be+" "+te,ks=te+" "+Et,ht="Windows",Pi=ht+" Phone",dr="Nokia",$i="Ouya",Ss="Generic",Tn=Ss+" "+te.toLowerCase(),Ps=Ss+" "+wt.toLowerCase(),Ri="Konqueror",V="(\\d+(\\.\\d+)?)",si=new RegExp("Version/"+V),On=new RegExp(Xe,"i"),Mn=new RegExp(kt+" \\w+","i"),An=new RegExp(xt+" \\w+","i"),Yi=new RegExp(Ke+"|PlayBook|BB10","i"),Ln={"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"},Ft,pr,ni,Nn=(r,e)=>e&&S(e,vs)||function(t){return S(t,Et)&&!S(t,De)&&!S(t,be)}(r),$s=function(r,e){return e=e||"",S(r," OPR/")&&S(r,"Mini")?Cn:S(r," OPR/")?Gi:Yi.test(r)?Ke:S(r,"IE"+te)||S(r,"WPDesktop")?bs:S(r,fs)?ms:S(r,zi)||S(r,"Edg/")?ws:S(r,"FBIOS")?"Facebook "+te:S(r,"UCWEB")||S(r,"UCBrowser")?"UC Browser":S(r,"CriOS")?ys:S(r,"CrMo")||S(r,De)?De:S(r,be)&&S(r,Et)?xs:S(r,"FxiOS")?Es:S(r.toLowerCase(),Ri.toLowerCase())?Ri:Nn(r,e)?S(r,te)?ks:Et:S(r,Ye)?Ye:S(r,"MSIE")||S(r,"Trident/")?Vi:S(r,"Gecko")?Ye:""},Dn={[bs]:[new RegExp("rv:"+V)],[ws]:[new RegExp(zi+"?\\/"+V)],[De]:[new RegExp("("+De+"|CrMo)\\/"+V)],[ys]:[new RegExp("CriOS\\/"+V)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+V)],[Et]:[si],[ks]:[si],[Gi]:[new RegExp("(Opera|OPR)\\/"+V)],[Ye]:[new RegExp(Ye+"\\/"+V)],[Es]:[new RegExp("FxiOS\\/"+V)],[Ri]:[new RegExp("Konqueror[:/]?"+V,"i")],[Ke]:[new RegExp(Ke+" "+V),si],[xs]:[new RegExp("android\\s"+V,"i")],[ms]:[new RegExp(fs+"\\/"+V)],[Vi]:[new RegExp("(rv:|MSIE )"+V)],Mozilla:[new RegExp("rv:"+V)]},jn=function(r,e){var t=$s(r,e),i=Dn[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},vr=[[new RegExp(Xe+"; "+Xe+" (.*?)[);]","i"),r=>[Xe,r&&r[1]||""]],[new RegExp(xt,"i"),[xt,""]],[new RegExp(kt,"i"),[kt,""]],[Yi,[Ke,""]],[new RegExp(ht,"i"),(r,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Pi,""];if(new RegExp(te).test(e)&&!/IEMobile\b/.test(e))return[ht+" "+te,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=t[1],s=Ln[i]||"";return/arm/i.test(e)&&(s="RT"),[ht,s]}return[ht,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,r=>{if(r&&r[3]){var e=[r[3],r[4],r[5]||"0"];return[Nt,e.join(".")]}return[Nt,""]}],[/(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("("+be+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+be+")","i"),r=>{if(r&&r[2]){var e=[r[2],r[3],r[4]||"0"];return[be,e.join(".")]}return[be,""]}],[/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/,[In,""]],[/Linux|debian/i,["Linux",""]]],gr=function(r){return An.test(r)?xt:Mn.test(r)?kt:On.test(r)?Xe:new RegExp($i,"i").test(r)?$i:new RegExp("("+Pi+"|WPDesktop)","i").test(r)?Pi:/iPad/.test(r)?ps:/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(r)?gs:Yi.test(r)?Ke:/(kobo)\s(ereader|touch)/i.test(r)?"Kobo":new RegExp(dr,"i").test(r)?dr:/(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(te).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)?be:ds:new RegExp("(pda|"+te+")","i").test(r)?Tn:new RegExp(wt,"i").test(r)&&!new RegExp(wt+" pc","i").test(r)?Ps:""},qn=r=>r instanceof Error;function Un(r){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return ni&&t.length===pr||(pr=t.length,ni=t.reduce((i,s)=>{Ft||(Ft={});var n=Ft[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,Ft[s]=[u,c];break}}return i},{})),ni}}class Hn{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(),o=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(o,i),$exception_level:"error"}}modifyFrames(e){var t=this;return ur(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&I(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return e.cause!=null&&(i=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),b({},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 ur(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,b({},t,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:Un(this.stackParser)}}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 b({},t,{syntheticException:i==0?t.syntheticException:void 0,mechanism:e,apply:n=>s(n,i),next:n=>s(n,i+1)})}}var Ze="?";function Fi(r,e,t,i,s){var n={platform:r,filename:e,function:t==="<anonymous>"?Ze:t,in_app:!0};return f(i)||(n.lineno=i),f(s)||(n.colno=s),n}var Rs=(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]:Ze,t?"safari-extension:"+e:"safari-web-extension:"+e]:[r,e]},Bn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Wn=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Vn=/\((\S*)(?::(\d+))(?::(\d+))\)/,Gn=(r,e)=>{var t=Bn.exec(r);if(t){var[,i,s,n]=t;return Fi(e,i,Ze,+s,+n)}var o=Wn.exec(r);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=Vn.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Rs(o[1]||Ze,o[2]);return Fi(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},zn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Yn=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Xn=(r,e)=>{var t=zn.exec(r);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var i=Yn.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]||Ze;return[n,s]=Rs(n,s),Fi(e,s,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},_r=/\(error: (.*)\)/,fr=50;function Kn(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(`
`),l=n;l<a.length;l++){var u=a[l];if(!(u.length>1024)){var c=_r.test(u)?u.replace(_r,"$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>=fr)break}}}return function(v){if(!v.length)return[];var g=Array.from(v);return g.reverse(),g.slice(0,fr).map(_=>{return b({},_,{filename:_.filename||(w=g,w[w.length-1]||{}).filename,function:_.function||Ze});var w})}(o)}}class Zn{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=j(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 Lt(e,"DOMException")}isDOMError(e){return Lt(e,"DOMError")}}class Jn{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return i.error&&typeof i.error.message=="string"?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class Qn{constructor(){}match(e){return Lt(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var i,s=t.apply(e.error);return s||{type:"ErrorEvent",value:e.message,stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}var eo=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class to{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(eo);return s&&(t=s[1],i=s[2]),[t,i]}}var io=["fatal","error","warning","log","info","debug"];function Fs(r,e){e===void 0&&(e=40);var t=Object.keys(r);if(t.sort(),!t.length)return"[object has no keys]";for(var i=t.length;i>0;i--){var s=t.slice(0,i).join(", ");if(!(s.length>e))return i===t.length||s.length<=e?s:s.slice(0,e)+"..."}return""}class ro{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 hs(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: "+Fs(e)}isSeverityLevel(e){return j(e)&&!ki(e)&&io.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(qn(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class so{match(e){return hs(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+Fs(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class no{match(e){return Si(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(i=t.syntheticException)==null?void 0:i.stack,synthetic:!0}}}class oo{match(e){return Lt(e,"PromiseRejectionEvent")}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return Si(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(Si(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var Is=function(r,e){var{debugEnabled:t}=e===void 0?{}:e,i={k:function(s){if(d&&(_e.DEBUG||x.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)=>Is(r+" "+s,n)};return i},m=Is("[PostHog.js]"),N=m.createLogger,ao=N("[ExternalScriptsLoader]"),mr=(r,e,t)=>{if(r.config.disable_external_dependency_loading)return ao.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");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)};x.__PosthogExtensions__=x.__PosthogExtensions__||{},x.__PosthogExtensions__.loadExternalDependency=(r,e,t)=>{var i="/static/"+e+".js?v="+r.version;if(e==="remote-config"&&(i="/array/"+r.config.token+"/config.js"),e==="toolbar"){var s=3e5;i=i+"&t="+Math.floor(Date.now()/s)*s}var n=r.requestRouter.endpointFor("assets",i);mr(r,n,t)},x.__PosthogExtensions__.loadSiteApp=(r,e,t)=>{var i=r.requestRouter.endpointFor("api",e);mr(r,i,t)};var Dt={};function Ce(r,e,t){if(I(r)){if(or&&r.forEach===or)r.forEach(e,t);else if("length"in r&&r.length===+r.length){for(var i=0,s=r.length;i<s;i++)if(i in r&&e.call(t,r[i],i)===Dt)return}}}function T(r,e,t){if(!F(r)){if(I(r))return Ce(r,e,t);if(Sn(r)){for(var i of r.entries())if(e.call(t,i[1],i[0])===Dt)return}else for(var s in r)if(us.call(r,s)&&e.call(t,r[s],s)===Dt)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},Qe=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 Mt(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 yr=function(r){try{return r()}catch{return}},lo=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){m.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),m.critical(s)}}},Xi=function(r){var e={};return T(r,function(t,i){(j(t)&&t.length>0||pe(t))&&(e[i]=t)}),e};function co(r,e){return t=r,i=n=>j(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),I(o)?(l=[],Ce(o,u=>{l.push(n(u))})):(l={},T(o,(u,c)=>{s.has(u)||(l[c]=n(u,c))})),l);var l}(t);var t,i,s}var uo=["herokuapp.com","vercel.app","netlify.app"];function ho(r){var e=r?.hostname;if(!j(e))return!1;var t=e.split(".").slice(-2).join(".");for(var i of uo)if(t===i)return!1;return!0}function Cs(r,e){for(var t=0;t<r.length;t++)if(e(r[t]))return r[t]}function D(r,e,t,i){var{capture:s=!1,passive:n=!0}=i??{};r?.addEventListener(e,t,{capture:s,passive:n})}var Ts="$people_distinct_id",dt="__alias",pt="__timers",br="$autocapture_disabled_server_side",Ii="$heatmaps_enabled_server_side",wr="$exception_capture_enabled_server_side",Ci="$error_tracking_suppression_rules",Er="$error_tracking_capture_extension_exceptions",xr="$web_vitals_enabled_server_side",Os="$dead_clicks_enabled_server_side",kr="$product_tours_enabled_server_side",Sr="$web_vitals_allowed_metrics",oi="$session_recording_remote_config",jt="$sesid",Ms="$session_is_sampled",ze="$enabled_feature_flags",vt="$early_access_features",Ti="$feature_flag_details",gt="$stored_person_properties",Ne="$stored_group_properties",Oi="$surveys",qt="$flag_call_reported",fe="$user_state",Mi="$client_session_props",Ai="$capture_rate_limit",Li="$initial_campaign_params",Ni="$initial_referrer_info",Ut="$initial_person_info",Ht="$epp",As="__POSTHOG_TOOLBAR__",tt="$posthog_cookieless",po=[Ts,dt,"__cmpns",pt,"$session_recording_enabled_server_side",Ii,jt,ze,Ci,fe,vt,Ti,Ne,gt,Oi,qt,Mi,Ai,Li,Ni,Ht,Ut,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function Pr(r){return r instanceof Element&&(r.id===As||!(r.closest==null||!r.closest(".toolbar-global-fade-container")))}function Qt(r){return!!r&&r.nodeType===1}function Te(r,e){return!!r&&!!r.tagName&&r.tagName.toLowerCase()===e.toLowerCase()}function Ls(r){return!!r&&r.nodeType===3}function Ns(r){return!!r&&r.nodeType===11}function Ki(r){return r?Zt(r).split(/\s+/):[]}function $r(r){var e=d?.location.href;return!!(e&&r&&r.some(t=>e.match(t)))}function Bt(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 Ki(e)}function Ds(r){return F(r)?null:Zt(r).split(/(\s+)/).filter(e=>St(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Pt(r){var e="";return Di(r)&&!Bs(r)&&r.childNodes&&r.childNodes.length&&T(r.childNodes,function(t){var i;Ls(t)&&t.textContent&&(e+=(i=Ds(t.textContent))!==null&&i!==void 0?i:"")}),Zt(e)}function js(r){return f(r.target)?r.srcElement||null:(e=r.target)!=null&&e.shadowRoot?r.composedPath()[0]||null:r.target||null;var e}var Zi=["a","button","form","input","select","textarea","label"];function qs(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 Us(r){var e=r.parentNode;return!(!e||!Qt(e))&&e}var vo=["next","previous","prev",">","<"],Rr=10,Fr=[".ph-no-rageclick",".ph-no-capture"];function go(r,e){if(!d||Ji(r))return!1;var t,i,s;if(we(e)?(t=!!e&&Fr,i=void 0):(t=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:Fr,i=e?.content_ignorelist),t===!1)return!1;var{targetElementList:n}=Hs(r,!1);return!function(o,a){if(o===!1||f(o))return!1;var l;if(o===!0)l=vo;else{if(!I(o))return!1;if(o.length>Rr)return m.error("[PostHog] content_ignorelist array cannot exceed "+Rr+" 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:Pt(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}}))&&!qs(n,t)}var Ji=r=>!r||Te(r,"html")||!Qt(r),Hs=(r,e)=>{if(!d||Ji(r))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,i=[r],s=r;s.parentNode&&!Te(s,"body");)if(Ns(s.parentNode))i.push(s.parentNode.host),s=s.parentNode.host;else{var n=Us(s);if(!n)break;if(e||Zi.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 _o(r,e,t,i,s){var n,o,a,l;if(t===void 0&&(t=void 0),!d||Ji(r)||(n=t)!=null&&n.url_allowlist&&!$r(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&$r(t.url_ignorelist))return!1;if((a=t)!=null&&a.dom_event_allowlist){var u=t.dom_event_allowlist;if(u&&!u.some(g=>e.type===g))return!1}var{parentIsUsefulElement:c,targetElementList:h}=Hs(r,i);if(!function(g,_){var w=_?.element_allowlist;if(f(w))return!0;var E,k=function(P){if(w.some(O=>P.tagName.toLowerCase()===O))return{v:!0}};for(var R of g)if(E=k(R))return E.v;return!1}(h,t)||!qs(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 v=r.tagName.toLowerCase();switch(v){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&&(Zi.indexOf(v)>-1||r.getAttribute("contenteditable")==="true")}}function Di(r){for(var e=r;e.parentNode&&!Te(e,"body");e=e.parentNode){var t=Bt(e);if(S(t,"ph-sensitive")||S(t,"ph-no-capture"))return!1}if(S(Bt(r),"ph-include"))return!0;var i=r.type||"";if(j(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var s=r.name||r.id||"";return!(j(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 Bs(r){return!!(Te(r,"input")&&!["button","checkbox","submit","reset"].includes(r.type)||Te(r,"select")||Te(r,"textarea")||r.getAttribute("contenteditable")==="true")}var Ws="(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})",fo=new RegExp("^(?:"+Ws+")$"),mo=new RegExp(Ws),Vs="\\d{3}-?\\d{2}-?\\d{4}",yo=new RegExp("^("+Vs+")$"),bo=new RegExp("("+Vs+")");function St(r,e){return e===void 0&&(e=!0),!(F(r)||j(r)&&(r=Zt(r),(e?fo:mo).test((r||"").replace(/[- ]/g,""))||(e?yo:bo).test(r)))}function Gs(r){var e=Pt(r);return St(e=(e+" "+zs(r)).trim())?e:""}function zs(r){var e="";return r&&r.childNodes&&r.childNodes.length&&T(r.childNodes,function(t){var i;if(t&&((i=t.tagName)==null?void 0:i.toLowerCase())==="span")try{var s=Pt(t);e=(e+" "+s).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+zs(t)).trim())}catch(n){m.error("[AutoCapture]",n)}}),e}function wo(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=b({},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 Mt(l).sort((c,h)=>{var[p]=c,[v]=h;return p.localeCompare(v)}).forEach(c=>{var[h,p]=c;return u[Ir(h.toString())]=Ir(p.toString())}),o+=":",o+=Mt(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:Eo(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Mt(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 Ir(r){return r.replace(/"|\\"/g,'\\"')}function Eo(r){var e=r.attr__class;return e?I(e)?e:Ki(e):void 0}class Ys{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}}var Wt=r=>{var e=y?.createElement("a");return f(e)?null:(e.href=r,e)},xo=function(r,e){var t,i;e===void 0&&(e="&");var s=[];return T(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)},Vt=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(!I(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{m.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},$t=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("=");I(p)&&(e.includes(p[0])?c.push(p[0]+"="+t):c.push(u[h]))}var v=l;return a!=null&&(v+="?"+c.join("&")),n!=null&&(v+="#"+n),v},Gt=function(r,e){var t=r.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},ai="$copy_autocapture",Cr=N("[AutoCapture]");function li(r,e){return e.length>r?e.slice(0,r)+"...":e}function ko(r){if(r.previousElementSibling)return r.previousElementSibling;var e=r;do e=e.previousSibling;while(e&&!Qt(e));return e}function So(r,e,t,i){var s=r.tagName.toLowerCase(),n={tag_name:s};Zi.indexOf(s)>-1&&!t&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?n.$el_text=li(1024,Gs(r)):n.$el_text=li(1024,Pt(r)));var o=Bt(r);o.length>0&&(n.classes=o.filter(function(c){return c!==""})),T(r.attributes,function(c){var h;if((!Bs(r)||["name","id","class","aria-label"].indexOf(c.name)!==-1)&&(i==null||!i.includes(c.name))&&!e&&St(c.value)&&(h=c.name,!j(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var p=c.value;c.name==="class"&&(p=Ki(p).join(" ")),n["attr__"+c.name]=li(1024,p)}});for(var a=1,l=1,u=r;u=ko(u);)a++,u.tagName===r.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function Po(r,e){for(var t,i,{e:s,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,u=[r],c=r;c.parentNode&&!Te(c,"body");)Ns(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var h,p=[],v={},g=!1,_=!1;if(T(u,P=>{var O=Di(P);P.tagName.toLowerCase()==="a"&&(g=P.getAttribute("href"),g=O&&g&&St(g)&&g),S(Bt(P),"ph-no-capture")&&(_=!0),p.push(So(P,n,o,a));var re=function(X){if(!Di(X))return{};var $={};return T(X.attributes,function(ae){if(ae.name&&ae.name.indexOf("data-ph-capture-attribute")===0){var K=ae.name.replace("data-ph-capture-attribute-",""),se=ae.value;K&&se&&St(se)&&($[K]=se)}}),$}(P);L(v,re)}),_)return{props:{},explicitNoCapture:_};if(o||(r.tagName.toLowerCase()==="a"||r.tagName.toLowerCase()==="button"?p[0].$el_text=Gs(r):p[0].$el_text=Pt(r)),g){var w,E;p[0].attr__href=g;var k=(w=Wt(g))==null?void 0:w.host,R=d==null||(E=d.location)==null?void 0:E.host;k&&R&&k!==R&&(h=g)}return{props:L({$event_type:s.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:wo(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}:{},v)}}class $o{constructor(e){this.P=!1,this.T=null,this.I=!1,this.instance=e,this.rageclicks=new Ys(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.M(i)}catch(s){Cr.error("Failed to capture event",s)}};if(D(y,"submit",e,{capture:!0}),D(y,"change",e,{capture:!0}),D(y,"click",e,{capture:!0}),this.R.capture_copied_text){var t=i=>{i=i||d?.event,this.M(i,ai)};D(y,"copy",t,{capture:!0}),D(y,"cut",t,{capture:!0})}}}else Cr.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({[br]:!!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[br],s=this.T;if(oe(s)&&!we(i)&&!this.instance.O())return!1;var n=(t=this.T)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!n}M(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i,s=js(e);Ls(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())&&go(s,this.instance.config.rageclick)&&this.M(e,"$rageclick");var n=t===ai;if(s&&_o(s,e,this.R,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=Po(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===ai){var u,c=Ds(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 Ie(y?.querySelectorAll)}}Math.trunc||(Math.trunc=function(r){return r<0?Math.ceil(r):Math.floor(r)}),Number.isInteger||(Number.isInteger=function(r){return pe(r)&&isFinite(r)&&Math.floor(r)===r});var Tr="0123456789abcdef";class zt{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 zt(n)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Tr.charAt(this.bytes[t]>>>4)+Tr.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 zt(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}}class Ro{constructor(){this.A=0,this.D=0,this.j=new Fo}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.D++,this.D>4398046511103&&(this.A++,this.L())}return zt.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var Or,Xs=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&&(Xs=r=>crypto.getRandomValues(r));class Fo{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(Xs(this.N),this.U=0),this.N[this.U++]}}var Fe=()=>Io().toString(),Io=()=>(Or||(Or=new Ro)).generate(),it="",Co=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function To(r,e){if(e){var t=function(s,n){if(n===void 0&&(n=y),it)return it;if(!n||["localhost","127.0.0.1"].includes(s))return"";for(var o=s.split("."),a=Math.min(o.length,8),l="dmn_chk_"+Fe();!it&&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",it=u)}return it}(r);if(!t){var i=(s=>{var n=s.match(Co);return n?n[0]:""})(r);i!==t&&m.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}var he={H:()=>!!y,B:function(r){m.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(he.q(r))||{}}catch{}return e},G:function(r,e,t,i,s){if(y)try{var n="",o="",a=To(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&&m.warn("cookieStore warning: large cookie, len="+u.length),y.cookie=u,u}catch{return}},V:function(r,e){if(y!=null&&y.cookie)try{he.G(r,"",-1,e)}catch{return}}},ci=null,A={H:function(){if(!oe(ci))return ci;var r=!0;if(f(d))r=!1;else try{var e="__mplssupport__";A.G(e,"xyz"),A.q(e)!=='"xyz"'&&(r=!1),A.V(e)}catch{r=!1}return r||m.error("localStorage unsupported; falling back to cookie store"),ci=r,r},B:function(r){m.error("localStorage error: "+r)},q:function(r){try{return d?.localStorage.getItem(r)}catch(e){A.B(e)}return null},W:function(r){try{return JSON.parse(A.q(r))||{}}catch{}return null},G:function(r,e){try{d?.localStorage.setItem(r,JSON.stringify(e))}catch(t){A.B(t)}},V:function(r){try{d?.localStorage.removeItem(r)}catch(e){A.B(e)}}},Oo=["$device_id","distinct_id",jt,Ms,Ht,Ut],It={},Mo={H:function(){return!0},B:function(r){m.error("memoryStorage error: "+r)},q:function(r){return It[r]||null},W:function(r){return It[r]||null},G:function(r,e){It[r]=e},V:function(r){delete It[r]}},Me=null,U={H:function(){if(!oe(Me))return Me;if(Me=!0,f(d))Me=!1;else try{var r="__support__";U.G(r,"xyz"),U.q(r)!=='"xyz"'&&(Me=!1),U.V(r)}catch{Me=!1}return Me},B:function(r){m.error("sessionStorage error: ",r)},q:function(r){try{return d?.sessionStorage.getItem(r)}catch(e){U.B(e)}return null},W:function(r){try{return JSON.parse(U.q(r))||null}catch{}return null},G:function(r,e){try{d?.sessionStorage.setItem(r,JSON.stringify(e))}catch(t){U.B(t)}},V:function(r){try{d?.sessionStorage.removeItem(r)}catch(e){U.B(e)}}},me=function(r){return r[r.PENDING=-1]="PENDING",r[r.DENIED=0]="DENIED",r[r.GRANTED=1]="GRANTED",r}({});class Ao{constructor(e){this._instance=e}get R(){return this._instance.config}get consent(){return this.J()?me.DENIED:this.K}isOptedOut(){return this.R.cookieless_mode==="always"||this.consent===me.DENIED||this.consent===me.PENDING&&(this.R.opt_out_capturing_by_default||this.R.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===me.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 ri(e)?me.GRANTED:S(Rn,e)?me.DENIED:me.PENDING}get Y(){if(!this.Z){var e=this.R.opt_out_capturing_persistence_type;this.Z=e==="localStorage"?A:he;var t=e==="localStorage"?he:A;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(ri(t.q(this.X))),t.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!Cs([J?.doNotTrack,J?.msDoNotTrack,x.doNotTrack],e=>ri(e))}}var Ct=N("[Dead Clicks]"),Lo=()=>!0,No=r=>{var e,t=!((e=r.instance.persistence)==null||!e.get_property(Os)),i=r.instance.config.capture_dead_clicks;return we(i)?i:!!q(i)||t};class Ks{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({[Os]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it(()=>{this.et()})}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",s=>{s?Ct.error("failed to load script",s):e()})}et(){var e;if(y){if(!this.tt&&(e=x.__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=x.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(y),Ct.info("starting...")}}else Ct.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Ct.info("stopping..."))}}var rt=N("[ExceptionAutocapture]");class Do{constructor(e){var t,i,s;this.rt=()=>{var n;if(d&&this.isEnabled&&(n=x.__PosthogExtensions__)!=null&&n.errorWrappingFunctions){var o=x.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=x.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=x.__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){rt.error("failed to start",u),this.ut()}}},this._instance=e,this.ht=!((t=this._instance.persistence)==null||!t.props[wr]),this.dt=new Fn({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:rt}),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=b({},t,e):(f(e)?this.ht:e)&&(t=b({},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?(rt.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",s=>{if(s)return rt.error("failed to load script",s);e()})}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({[wr]: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)?rt.info("Skipping exception capture because of client rate limiting.",{exception:s}):this._instance.exceptions.sendExceptionEvent(e)}}function Mr(r,e,t){try{if(!(e in r))return()=>{};var i=r[e],s=t(i);return Ie(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),r[e]=s,()=>{r[e]=i}}catch{return()=>{}}}class jo{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&&(m.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,m.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(d&&d.history){var i=this;(e=d.history.pushState)!=null&&e.__posthog_wrapped__||Mr(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__||Mr(d.history,"replaceState",s=>function(n,o,a){s.call(this,n,o,a),i._t("replaceState")}),this.yt()}}_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){m.error("Error capturing "+e+" pageview",s)}}yt(){if(!this.ft){var e=()=>{this._t("popstate")};D(d,"popstate",e),this.ft=()=>{d&&d.removeEventListener("popstate",e)}}}}var ui=N("[SegmentIntegration]");function qo(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()||Fe();i.config.get_device_id=u,l.id()&&(i.register({distinct_id:l.id(),$device_id:u()}),i.persistence.set_property(fe,"identified")),s()},a=n.user();"then"in a&&Ie(a.then)?a.then(o):o(a)})(r,()=>{t.register((i=>{Promise&&Promise.resolve||ui.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()||(ui.info("No userId set, resetting PostHog"),i.reset()),n.event.userId&&n.event.userId!==i.get_distinct_id()&&(ui.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 Zs="posthog-js";function Js(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 v=r.requestRouter.endpointFor("ui","/project/"+r.config.token+"/person/"+r.get_distinct_id());a.tags["PostHog Person URL"]=v,r.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=r.get_session_replay_url({withTimestamp:!0}));var g=((l=a.exception)==null?void 0:l.values)||[],_=g.map(E=>b({},E,{stacktrace:E.stacktrace?b({},E.stacktrace,{type:"raw",frames:(E.stacktrace.frames||[]).map(k=>b({},k,{platform:"web:javascript"}))}):void 0})),w={$exception_message:((u=g[0])==null?void 0:u.value)||a.message,$exception_type:(c=g[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=g[0])==null?void 0:h.value)||a.message,$sentry_exception_type:(p=g[0])==null?void 0:p.type,$sentry_tags:a.tags};return t&&i&&(w.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+a.event_id),o&&r.exceptions.sendExceptionEvent(w),a}}class Uo{constructor(e,t,i,s,n,o){this.name=Zs,this.setupOnce=function(a){a(Js(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:o==null||o}))}}}var Ho=d!=null&&d.location?Gt(d.location.hash,"__posthog")||Gt(location.hash,"state"):null,Ar="_postHogToolbarParams",Lr=N("[Toolbar]"),Re=function(r){return r[r.UNINITIALIZED=0]="UNINITIALIZED",r[r.LOADING=1]="LOADING",r[r.LOADED=2]="LOADED",r}(Re||{});class Bo{constructor(e){this.instance=e}bt(e){x.ph_toolbar_state=e}wt(){var e;return(e=x.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),!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=Ho||Gt(e.hash,"__posthog")||Gt(e.hash,"state"),o=n?yr(()=>JSON.parse(atob(decodeURIComponent(n))))||yr(()=>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(Ar)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}xt(e){var t=x.ph_load_toolbar||x.ph_load_editor;!F(t)&&Ie(t)?t(e,this.instance):Lr.warn("No toolbar load function found")}loadToolbar(e){var t=!(y==null||!y.getElementById(As));if(!d||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=b({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(d.localStorage.setItem(Ar,JSON.stringify(b({},s,{source:void 0}))),this.wt()===Re.LOADED)this.xt(s);else if(this.wt()===Re.UNINITIALIZED){var n;this.bt(Re.LOADING),(n=x.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"toolbar",o=>{if(o)return Lr.error("[Toolbar] Failed to load",o),void this.bt(Re.UNINITIALIZED);this.bt(Re.LOADED),this.xt(s)}),D(d,"turbolinks:load",()=>{this.bt(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)}}var Wo=N("[TracingHeaders]");class Vo{constructor(e){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,i;f(this.$t)&&((t=x.__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=x.__PosthogExtensions__)==null||(i=i.tracingHeadersPatchFns)==null||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"tracing-headers",s=>{if(s)return Wo.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)}}var Tt="https?://(.*)",et=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Go=Qe(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],et),Rt="<masked>",zo=["li_fat_id"];function Qs(r,e,t){if(!y)return{};var i,s=e?Qe([],et,t||[]):[],n=en($t(y.URL,s,Rt),r),o=(i={},T(zo,function(a){var l=he.q(a);i[a]=l||null}),i);return L(o,n)}function en(r,e){var t=Go.concat(e||[]),i={};return T(t,function(s){var n=Vt(r,s);i[s]=n||null}),i}function tn(r){var e=function(n){return n?n.search(Tt+"google.([^/?]*)")===0?"google":n.search(Tt+"bing.com")===0?"bing":n.search(Tt+"yahoo.com")===0?"yahoo":n.search(Tt+"duckduckgo.com")===0?"duckduckgo":null:null}(r),t=e!="yahoo"?"q":"p",i={};if(!oe(e)){i.$search_engine=e;var s=y?Vt(y.referrer,t):"";s.length&&(i.ph_keyword=s)}return i}function Nr(){return navigator.language||navigator.userLanguage}function rn(){return y?.referrer||"$direct"}function sn(r,e){var t=r?Qe([],et,e||[]):[],i=z?.href.substring(0,1e3);return{r:rn().substring(0,1e3),u:i?$t(i,t,Rt):void 0}}function nn(r){var e,{r:t,u:i}=r,s={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Wt(t))==null?void 0:e.host};if(i){s.$current_url=i;var n=Wt(i);s.$host=n?.host,s.$pathname=n?.pathname;var o=en(i);L(s,o)}if(t){var a=tn(t);L(s,a)}return s}function on(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Yo(){try{return new Date().getTimezoneOffset()}catch{return}}function Xo(r,e){if(!G)return{};var t,i,s,n=r?Qe([],et,e||[]):[],[o,a]=function(l){for(var u=0;u<vr.length;u++){var[c,h]=vr[u],p=c.exec(l),v=p&&(Ie(h)?h(p,l):h);if(v)return v}return["",""]}(G);return L(Xi({$os:o,$os_version:a,$browser:$s(G,navigator.vendor),$device:gr(G),$device_type:(i=G,s=gr(i),s===ps||s===ds||s==="Kobo"||s==="Kindle Fire"||s===Ps?wt:s===xt||s===Xe||s===kt||s===$i?"Console":s===gs?"Wearable":s?te:"Desktop"),$timezone:on(),$timezone_offset:Yo()}),{$current_url:$t(z?.href,n,Rt),$host:z?.host,$pathname:z?.pathname,$raw_user_agent:G.length>1e3?G.substring(0,997)+"...":G,$browser_version:jn(G,navigator.vendor),$browser_language:Nr(),$browser_language_prefix:(t=Nr(),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:_e.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Pe=N("[Web Vitals]"),Dr=9e5;class Ko{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)=>b({},i,{["$web_vitals_"+s.name+"_event"]:b({},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))Pe.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)||(F(i?.name)||F(i?.value)?Pe.error("Invalid metric received",i):this.Rt&&i.value>=this.Rt?Pe.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(b({},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=()=>{var i,s,n,o,a=x.__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):Pe.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.kt=!((t=this._instance.persistence)==null||!t.props[xr]),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 f(i)?((t=this._instance.persistence)==null?void 0:t.props[Sr])||["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 Rt(){var e=q(this._instance.config.capture_performance)&&pe(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Dr;return 0<e&&e<=6e4?Dr:e}get isEnabled(){var e=z?.protocol;if(e!=="http:"&&e!=="https:")return Pe.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:we(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return we(t)?t:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(Pe.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({[xr]:t}),this._instance.persistence.register({[Sr]:i})),this.kt=t,this.startIfEnabled()}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks&&e(),(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"web-vitals",s=>{s?Pe.error("failed to load script",s):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?Qe([],et,i||[]):[];return $t(e,s,Rt)}Pe.error("Could not determine current URL")}}var Zo=N("[Heatmaps]");function jr(r){return q(r)&&"clientX"in r&&"clientY"in r&&pe(r.clientX)&&pe(r.clientY)}class Jo{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[Ii]),this.rageclicks=new Ys(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 f(this.instance.config.capture_heatmaps)?f(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;Zo.info("starting..."),this.Mt(),this.Ot()}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({[Ii]:t}),this.kt=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}Dt(e){this.jt(e.originalEvent,"deadclick")}Ot(){this.Ft&&clearInterval(this.Ft),this.Ft=function(e){return e?.visibilityState==="visible"}(y)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Mt(){d&&y&&(this.Nt=this.Lt.bind(this),D(d,"beforeunload",this.Nt),this.Ut=e=>this.jt(e||d?.event),D(y,"click",this.Ut,{capture:!0}),this.zt=e=>this.Ht(e||d?.event),D(y,"mousemove",this.zt,{capture:!0}),this.Bt=new Ks(this.instance,Lo,this.Dt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Ot.bind(this),D(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&&Qt(c)&&!Te(c,"body");){if(c===u)return!1;if(S(l,d?.getComputedStyle(c).position))return!0;c=Us(c)}return!1}(js(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:i),target_fixed:o,type:t}}jt(e,t){var i;if(t===void 0&&(t="click"),!Pr(e.target)&&jr(e)){var s=this.Gt(e,t);(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.Vt(b({},s,{type:"rageclick"})),this.Vt(s)}}Ht(e){!Pr(e.target)&&jr(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?Qe([],et,s||[]):[],o=$t(t,n,Rt);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(e)}}Lt(){this.N&&!Ge(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class qr{constructor(e){this.Jt=(t,i,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength)&&(m.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:de(a/o,0,1,m),v=o<=1?1:de(l/o,0,1,m),g=u<=1?1:de(c/u,0,1,m),_=u<=1?1:de(h/u,0,1,m);s=L(s,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:g,$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 ye=function(r){return r.GZipJS="gzip-js",r.Base64="base64",r}({}),Na=["fatal","error","warning","log","info","debug"],ie=Uint8Array,Y=Uint16Array,Je=Uint32Array,Qi=new ie([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]),er=new ie([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]),Ur=new ie([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),an=function(r,e){for(var t=new Y(31),i=0;i<31;++i)t[i]=e+=1<<r[i-1];var s=new Je(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]},ln=an(Qi,2),Qo=ln[0],ji=ln[1];Qo[28]=258,ji[258]=28;for(var Hr=an(er,0)[1],cn=new Y(32768),M=0;M<32768;++M){var Ae=(43690&M)>>>1|(21845&M)<<1;Ae=(61680&(Ae=(52428&Ae)>>>2|(13107&Ae)<<2))>>>4|(3855&Ae)<<4,cn[M]=((65280&Ae)>>>8|(255&Ae)<<8)>>>1}var yt=function(r,e,t){for(var i=r.length,s=0,n=new Y(e);s<i;++s)++n[r[s]-1];var o,a=new Y(e);for(s=0;s<e;++s)a[s]=a[s-1]+n[s-1]<<1;for(o=new Y(i),s=0;s<i;++s)o[s]=cn[a[r[s]-1]++]>>>15-r[s];return o},je=new ie(288);for(M=0;M<144;++M)je[M]=8;for(M=144;M<256;++M)je[M]=9;for(M=256;M<280;++M)je[M]=7;for(M=280;M<288;++M)je[M]=8;var Yt=new ie(32);for(M=0;M<32;++M)Yt[M]=5;var ea=yt(je,9),ta=yt(Yt,5),un=function(r){return(r/8>>0)+(7&r&&1)},hn=function(r,e,t){(t==null||t>r.length)&&(t=r.length);var i=new(r instanceof Y?Y:r instanceof Je?Je:ie)(t-e);return i.set(r.subarray(e,t)),i},ge=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8},st=function(r,e,t){t<<=7&e;var i=e/8>>0;r[i]|=t,r[i+1]|=t>>>8,r[i+2]|=t>>>16},hi=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 ie(0),0];if(s==1){var o=new ie(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort(function(O,re){return O.f-re.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 v=new Y(p+1),g=qi(t[c-1],v,0);if(g>e){i=0;var _=0,w=g-e,E=1<<w;for(n.sort(function(O,re){return v[re.s]-v[O.s]||O.f-re.f});i<s;++i){var k=n[i].s;if(!(v[k]>e))break;_+=E-(1<<g-v[k]),v[k]=e}for(_>>>=w;_>0;){var R=n[i].s;v[R]<e?_-=1<<e-v[R]++-1:++i}for(;i>=0&&_;--i){var P=n[i].s;v[P]==e&&(--v[P],++_)}g=e}return[new ie(v),g]},qi=function(r,e,t){return r.s==-1?Math.max(qi(r.l,e,t+1),qi(r.r,e,t+1)):e[r.s]=t},Br=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new Y(++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]},nt=function(r,e){for(var t=0,i=0;i<e.length;++i)t+=r[i]*e[i];return t},Ui=function(r,e,t){var i=t.length,s=un(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)},Wr=function(r,e,t,i,s,n,o,a,l,u,c){ge(e,c++,t),++s[256];for(var h=hi(s,15),p=h[0],v=h[1],g=hi(n,15),_=g[0],w=g[1],E=Br(p),k=E[0],R=E[1],P=Br(_),O=P[0],re=P[1],X=new Y(19),$=0;$<k.length;++$)X[31&k[$]]++;for($=0;$<O.length;++$)X[31&O[$]]++;for(var ae=hi(X,7),K=ae[0],se=ae[1],Q=19;Q>4&&!K[Ur[Q-1]];--Q);var ve,le,ce,qe,Ee=u+5<<3,Oe=nt(s,je)+nt(n,Yt)+o,ue=nt(s,p)+nt(n,_)+o+14+3*Q+nt(X,K)+(2*X[16]+3*X[17]+7*X[18]);if(Ee<=Oe&&Ee<=ue)return Ui(e,c,r.subarray(l,l+u));if(ge(e,c,1+(ue<Oe)),c+=2,ue<Oe){ve=yt(p,v),le=p,ce=yt(_,w),qe=_;var xe=yt(K,se);for(ge(e,c,R-257),ge(e,c+5,re-1),ge(e,c+10,Q-4),c+=14,$=0;$<Q;++$)ge(e,c+3*$,K[Ur[$]]);c+=3*Q;for(var Ue=[k,O],W=0;W<2;++W){var ee=Ue[W];for($=0;$<ee.length;++$){var Z=31&ee[$];ge(e,c,xe[Z]),c+=K[Z],Z>15&&(ge(e,c,ee[$]>>>5&127),c+=ee[$]>>>12)}}}else ve=ea,le=je,ce=ta,qe=Yt;for($=0;$<a;++$)if(i[$]>255){Z=i[$]>>>18&31,st(e,c,ve[Z+257]),c+=le[Z+257],Z>7&&(ge(e,c,i[$]>>>23&31),c+=Qi[Z]);var He=31&i[$];st(e,c,ce[He]),c+=qe[He],He>3&&(st(e,c,i[$]>>>5&8191),c+=er[He])}else st(e,c,ve[i[$]]),c+=le[i[$]];return st(e,c,ve[256]),c+le[256]},ia=new Je([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ra=function(){for(var r=new Je(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;r[e]=t}return r}(),sa=function(r,e,t,i,s){return function(n,o,a,l,u,c){var h=n.length,p=new ie(l+h+5*(1+Math.floor(h/7e3))+u),v=p.subarray(l,p.length-u),g=0;if(!o||h<8)for(var _=0;_<=h;_+=65535){var w=_+65535;w<h?g=Ui(v,g,n.subarray(_,w)):(v[_]=c,g=Ui(v,g,n.subarray(_,h)))}else{for(var E=ia[o-1],k=E>>>13,R=8191&E,P=(1<<a)-1,O=new Y(32768),re=new Y(P+1),X=Math.ceil(a/3),$=2*X,ae=function(ii){return(n[ii]^n[ii+1]<<X^n[ii+2]<<$)&P},K=new Je(25e3),se=new Y(288),Q=new Y(32),ve=0,le=0,ce=(_=0,0),qe=0,Ee=0;_<h;++_){var Oe=ae(_),ue=32767&_,xe=re[Oe];if(O[ue]=xe,re[Oe]=ue,qe<=_){var Ue=h-_;if((ve>7e3||ce>24576)&&Ue>423){g=Wr(n,v,0,K,se,Q,le,ce,Ee,_-Ee,g),ce=ve=le=0,Ee=_;for(var W=0;W<286;++W)se[W]=0;for(W=0;W<30;++W)Q[W]=0}var ee=2,Z=0,He=R,ke=ue-xe&32767;if(Ue>2&&Oe==ae(_-ke))for(var mn=Math.min(k,Ue)-1,yn=Math.min(32767,_),bn=Math.min(258,Ue);ke<=yn&&--He&&ue!=xe;){if(n[_+ee]==n[_+ee-ke]){for(var Se=0;Se<bn&&n[_+Se]==n[_+Se-ke];++Se);if(Se>ee){if(ee=Se,Z=ke,Se>mn)break;var wn=Math.min(ke,Se-2),ir=0;for(W=0;W<wn;++W){var ti=_-ke+W+32768&32767,rr=ti-O[ti]+32768&32767;rr>ir&&(ir=rr,xe=ti)}}}ke+=(ue=xe)-(xe=O[ue])+32768&32767}if(Z){K[ce++]=268435456|ji[ee]<<18|Hr[Z];var sr=31&ji[ee],nr=31&Hr[Z];le+=Qi[sr]+er[nr],++se[257+sr],++Q[nr],qe=_+ee,++ve}else K[ce++]=n[_],++se[n[_]]}}g=Wr(n,v,c,K,se,Q,le,ce,Ee,_-Ee,g)}return hn(p,0,l+un(g)+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)},di=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function na(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=ra[255&u^l[c]]^u>>>8;a=u},d:function(){return 4294967295^a}}}(),i=r.length;t.p(r);var s,n=sa(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&&di(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),di(n,o-8,t.d()),di(n,o-4,i),n}var oa=function(r){var e,t,i,s,n="";for(e=t=0,i=(r=(r+"").replace(/\r\n/g,`
`).replace(/\r/g,`
`)).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},aa=!!Ei||!!wi,Vr="text/plain",Xt=function(r,e,t){var i;t===void 0&&(t=!0);var[s,n]=r.split("?"),o=b({},e),a=(i=n?.split("&").map(u=>{var c,[h,p]=u.split("="),v=t&&(c=o[h])!==null&&c!==void 0?c:p;return delete o[h],h+"="+v}))!==null&&i!==void 0?i:[],l=xo(o);return l&&a.push(l),s+"?"+a.join("&")},_t=(r,e)=>JSON.stringify(r,(t,i)=>typeof i=="bigint"?i.toString():i,e),pi=r=>{var{data:e,compression:t}=r;if(e){if(t===ye.GZipJS){var i=na(function(l,u){var c=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var h=new ie(l.length+(l.length>>>1)),p=0,v=function(E){h[p++]=E},g=0;g<c;++g){if(p+5>h.length){var _=new ie(p+8+(c-g<<1));_.set(h),h=_}var w=l.charCodeAt(g);w<128||u?v(w):w<2048?(v(192|w>>>6),v(128|63&w)):w>55295&&w<57344?(v(240|(w=65536+(1047552&w)|1023&l.charCodeAt(++g))>>>18),v(128|w>>>12&63),v(128|w>>>6&63),v(128|63&w)):(v(224|w>>>12),v(128|w>>>6&63),v(128|63&w))}return hn(h,0,p)}(_t(e)),{mtime:0}),s=new Blob([i],{type:Vr});return{contentType:Vr,body:s,estimatedSize:s.size}}if(t===ye.Base64){var n=function(l){var u,c,h,p,v,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_=0,w=0,E="",k=[];if(!l)return l;l=oa(l);do u=(v=l.charCodeAt(_++)<<16|l.charCodeAt(_++)<<8|l.charCodeAt(_++))>>18&63,c=v>>12&63,h=v>>6&63,p=63&v,k[w++]=g.charAt(u)+g.charAt(c)+g.charAt(h)+g.charAt(p);while(_<l.length);switch(E=k.join(""),l.length%3){case 1:E=E.slice(0,-2)+"==";break;case 2:E=E.slice(0,-1)+"="}return E}(_t(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:_t(l)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=_t(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},At=[];wi&&At.push({transport:"fetch",method:r=>{var e,t,{contentType:i,body:s,estimatedSize:n}=(e=pi(r))!==null&&e!==void 0?e:{},o=new Headers;T(r.headers,function(c,h){o.append(h,c)}),i&&o.append("Content-Type",i);var a=r.url,l=null;if(lr){var u=new lr;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),r.timeout)}}wi(a,b({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(v){m.error(v)}r.callback==null||r.callback(p)})).catch(c=>{m.error(c),r.callback==null||r.callback({statusCode:0,text:c})}).finally(()=>l?clearTimeout(l.timeout):null)}}),Ei&&At.push({transport:"XHR",method:r=>{var e,t=new Ei;t.open(r.method||"GET",r.url,!0);var{contentType:i,body:s}=(e=pi(r))!==null&&e!==void 0?e:{};T(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)}}),J!=null&&J.sendBeacon&&At.push({transport:"sendBeacon",method:r=>{var e=Xt(r.url,{beacon:"1"});try{var t,{contentType:i,body:s}=(t=pi(r))!==null&&t!==void 0?t:{},n=typeof s=="string"?new Blob([s],{type:i}):s;J.sendBeacon(e,n)}catch{}}});var Kt=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 Gr(r,e,t){return _t({distinct_id:r,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var dn={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=>Kt(t,i))),not_regex:(r,e)=>e.every(t=>r.every(i=>!Kt(t,i))),icontains:(r,e)=>e.map(Ot).some(t=>r.map(Ot).some(i=>t.includes(i))),not_icontains:(r,e)=>e.map(Ot).every(t=>r.map(Ot).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))})},Ot=r=>r.toLowerCase();function pn(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=dn[s.operator];return!!a&&a(s.values,o)})}var vi=N("[Error tracking]");class la{constructor(e){var t,i;this.Zt=[],this.ti=new Hn([new Zn,new oo,new Qn,new Jn,new so,new ro,new to,new no],Kn("web:javascript",Gn,Xn)),this._instance=e,this.Zt=(t=(i=this._instance.persistence)==null?void 0:i.get_property(Ci))!==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({[Ci]:this.Zt,[Er]:o})}get ii(){var e,t=!!this._instance.get_property(Er),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 vi.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(t))return void vi.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(t))return void vi.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 j(n)&&n.length>0&&i.$exception_types.push(n),j(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=dn[n.operator],l=I(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!F(e)&&I(e)}}var ne=N("[FeatureFlags]"),ot=N("[FeatureFlags]",{debugEnabled:!0}),gi="$active_feature_flags",Be="$override_feature_flags",zr="$feature_flag_payloads",at="$override_feature_flag_payloads",Yr="$feature_flag_request_id",Xr="$feature_flag_evaluated_at",Kr=r=>{var e={};for(var[t,i]of Mt(r||{}))i&&(e[t]=i);return e},ca=r=>{var e=r.flags;return e?(r.featureFlags=Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,(i=e[t].variant)!==null&&i!==void 0?i:e[t].enabled]})),r.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return(i=e[t].metadata)==null?void 0:i.payload}).map(t=>{var i;return[t,(i=e[t].metadata)==null?void 0:i.payload]}))):ne.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),r},ua=function(r){return r.FeatureFlags="feature_flags",r.Recordings="recordings",r}({});class ha{constructor(e){this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this._instance=e,this.featureFlagEventHandlers=[]}ci(){var e=this._instance.config.evaluation_environments;return e!=null&&e.length?e.filter(t=>{var i=t&&typeof t=="string"&&t.trim().length>0;return i||ne.error("Invalid evaluation environment found:",t,"Expected non-empty string"),i}):[]}fi(){return this.ci().length>0}flags(){if(this._instance.config.__preview_remote_config)this.di=!0;else{var e=!this.pi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.gi({disableFlags:e})}}get hasLoadedFlags(){return this.ai}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(Ti),t=this._instance.get_property(Be),i=this._instance.get_property(at);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,v=i?.[o],g=b({},u,{enabled:h,variant:h?p??u?.variant:void 0});h!==u?.enabled&&(g.original_enabled=u?.enabled),p!==u?.variant&&(g.original_variant=u?.variant),v&&(g.metadata=b({},u?.metadata,{payload:v,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),s[o]=g}return this.oi||(ne.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.oi=!0),s}getFlagVariants(){var e=this._instance.get_property(ze),t=this._instance.get_property(Be);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||(ne.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.oi=!0),i}getFlagPayloads(){var e=this._instance.get_property(zr),t=this._instance.get_property(at);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||(ne.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.pi||(this.pi=setTimeout(()=>{this.gi()},5))}mi(){clearTimeout(this.pi),this.pi=void 0}ensureFlagsLoaded(){this.ai||this.li||this.pi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ui=e}gi(e){var t;if(this.mi(),!this._instance.O())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:b({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(gt)||{}),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.fi()&&(n.evaluation_environments=this.ci());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=on()),this.li=!0,this._instance._send_request({method:"POST",url:u,data:n,compression:this._instance.config.disable_compression?void 0:ye.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:c=>{var h,p,v=!0;if(c.statusCode===200&&(this.hi||(this.$anon_distinct_id=void 0),v=!1),this.li=!1,this.di||(this.di=!0,this._instance.yi((p=c.json)!==null&&p!==void 0?p:{})),!n.disable_flags||this.hi)if(this.vi=!v,c.json&&(h=c.json.quotaLimited)!=null&&h.includes(ua.FeatureFlags))ne.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset.  Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var g;n.disable_flags||this.receivedFeatureFlags((g=c.json)!==null&&g!==void 0?g:{},v),this.hi&&(this.hi=!1,this.gi())}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),this.ai||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],s=""+i,n=this._instance.get_property(Yr)||void 0,o=this._instance.get_property(Xr)||void 0,a=this._instance.get_property(qt)||{};if((t.send_event||!("send_event"in t))&&(!(e in a)||!a[e].includes(s))){var l,u,c,h,p,v,g,_,w;I(a[e])?a[e].push(s):a[e]=[s],(l=this._instance.persistence)==null||l.register({[qt]:a});var E=this.getFeatureFlagDetails(e),k={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:n,$feature_flag_evaluated_at:o,$feature_flag_bootstrapped_response:((u=this._instance.config.bootstrap)==null||(u=u.featureFlags)==null?void 0:u[e])||null,$feature_flag_bootstrapped_payload:((c=this._instance.config.bootstrap)==null||(c=c.featureFlagPayloads)==null?void 0:c[e])||null,$used_bootstrap_value:!this.vi};f(E==null||(h=E.metadata)==null?void 0:h.version)||(k.$feature_flag_version=E.metadata.version);var R,P=(p=E==null||(v=E.reason)==null?void 0:v.description)!==null&&p!==void 0?p:E==null||(g=E.reason)==null?void 0:g.code;P&&(k.$feature_flag_reason=P),E!=null&&(_=E.metadata)!=null&&_.id&&(k.$feature_flag_id=E.metadata.id),f(E?.original_variant)&&f(E?.original_enabled)||(k.$feature_flag_original_response=f(E.original_variant)?E.original_enabled:E.original_variant),E!=null&&(w=E.metadata)!=null&&w.original_payload&&(k.$feature_flag_original_payload=E==null||(R=E.metadata)==null?void 0:R.original_payload),this._instance.capture("$feature_flag_called",k)}return i}ne.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.fi()&&(s.evaluation_environments=this.ci()),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:ye.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}ne.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this._instance.persistence){this.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=ca(o),p=h.flags,v=h.featureFlags,g=h.featureFlagPayloads;if(v){var _=o.requestId,w=o.evaluatedAt;if(I(v)){ne.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var E={};if(v)for(var k=0;k<v.length;k++)E[v[k]]=!0;a&&a.register({[gi]:v,[ze]:E})}else{var R=v,P=g,O=p;o.errorsWhileComputingFlags&&(R=b({},l,R),P=b({},u,P),O=b({},c,O)),a&&a.register(b({[gi]:Object.keys(Kr(R)),[ze]:R||{},[zr]:P||{},[Ti]:O||{}},_?{[Yr]:_}:{},w?{[Xr]:w}:{}))}}})(e,this._instance.persistence,i,s,n),this.bi(t)}}override(e,t){t===void 0&&(t=!1),ne.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return ne.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Be),this._instance.persistence.unregister(at),this.bi(),ot.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(Be),ot.info("Flag overrides cleared");else if(i.flags){if(I(i.flags)){for(var s={},n=0;n<i.flags.length;n++)s[i.flags[n]]=!0;this._instance.persistence.register({[Be]:s})}else this._instance.persistence.register({[Be]:i.flags});ot.info("Flag overrides set",{flags:i.flags})}}return"payloads"in i&&(i.payloads===!1?(this._instance.persistence.unregister(at),ot.info("Payload overrides cleared")):i.payloads&&(this._instance.persistence.register({[at]:i.payloads}),ot.info("Payload overrides set",{payloads:i.payloads}))),void this.bi()}this.bi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ai){var{flags:t,flagVariants:i}=this.wi();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,n=(this._instance.get_property(vt)||[]).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=b({},this.getFlagVariants(),{[e]:t});(s=this._instance.persistence)==null||s.register({[gi]:Object.keys(Kr(l)),[ze]:l}),this.bi()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var s=this._instance.get_property(vt),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(vt),(l=this._instance.persistence)==null||l.register({[vt]:u}),e(u)}}})}wi(){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),{})}}bi(e){var{flags:t,flagVariants:i}=this.wi();this.featureFlagEventHandlers.forEach(s=>s(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(gt)||{};this._instance.register({[gt]:b({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(gt)}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]=b({},i[s],e[s]),delete e[s]}),this._instance.register({[Ne]:b({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Ne)||{};this._instance.register({[Ne]:b({},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.mi(),this.oi=!1}}var da=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class _i{constructor(e,t){this.R=e,this.props={},this.xi=!1,this.Ei=(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.$i(e),this.load(),e.debug&&m.info("Persistence loaded",e.persistence,b({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.Si}$i(e){da.indexOf(e.persistence.toLowerCase())===-1&&(m.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=[...Oo,...s];return b({},A,{W:function(o){try{var a={};try{a=he.W(o)||{}}catch{}var l=L(a,JSON.parse(A.q(o)||"{}"));return A.G(o,l),l}catch{}return null},G:function(o,a,l,u,c,h){try{A.G(o,a,void 0,void 0,h);var p={};n.forEach(v=>{a[v]&&(p[v]=a[v])}),Object.keys(p).length&&he.G(o,p,l,u,c,h)}catch(v){A.B(v)}},V:function(o,a){try{d?.localStorage.removeItem(o),he.V(o,a)}catch(l){A.B(l)}}})}(e.cookie_persisted_properties||[]),i=e.persistence.toLowerCase();return i==="localstorage"&&A.H()?A:i==="localstorage+cookie"&&t.H()?t:i==="sessionstorage"&&U.H()?U:i==="memory"?Mo:i==="cookie"?he:t.H()?t:he}properties(){var e={};return T(this.props,function(t,i){if(i===ze&&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=po)?l:ar&&o.indexOf===ar?o.indexOf(a)!=-1:(T(o,function(u){if(l||(l=u===a))return Dt}),l))||(e[i]=t);var o,a,l}),e}load(){if(!this.Si){var e=this.Y.W(this.Ei);e&&(this.props=L({},e))}}save(){this.Si||this.Y.G(this.Ei,this.props,this.ki,this.Pi,this.Ti,this.R.debug)}remove(){this.Y.V(this.Ei,!1),this.Y.V(this.Ei,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(q(e)){f(t)&&(t="None"),this.ki=f(i)?this.Ii:i;var s=!1;if(T(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.ki=f(t)?this.Ii:t;var i=!1;if(T(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.xi){var e=Qs(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);Ge(Xi(e))||this.register(e),this.xi=!0}}update_search_keyword(){var e;this.register((e=y?.referrer)?tn(e):{})}update_referrer_info(){var e;this.register_once({$referrer:rn(),$referring_domain:y!=null&&y.referrer&&((e=Wt(y.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[Li]||this.props[Ni]||this.register_once({[Ut]:sn(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};T([Ni,Li],o=>{var a=this.props[o];a&&T(a,function(l,u){e["$initial_"+xi(u)]=l})});var t,i,s=this.props[Ut];if(s){var n=(t=nn(s),i={},T(t,function(o,a){i["$initial_"+xi(a)]=o}),i);L(e,n)}return e}safe_merge(e){return T(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this.Ii=this.ki=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.$i(e),n=this.props;this.clear(),this.Y=s,this.props=n,this.save()}}set_disabled(e){this.Si=e,this.Si?this.remove():this.save()}set_cross_subdomain(e){e!==this.Pi&&(this.Pi=e,this.remove(),this.save())}set_secure(e){e!==this.Ti&&(this.Ti=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[pt]||{};i[e]=t,this.props[pt]=i,this.save()}remove_event_timer(e){var t=(this.props[pt]||{})[e];return f(t)||(delete this.props[pt][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var Zr=N("[Product Tours]"),fi="ph_product_tours";class pa{constructor(e){this.Ci=null,this.Ri=null,this._instance=e}onRemoteConfig(e){this._instance.persistence&&this._instance.persistence.register({[kr]:!(e==null||!e.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var e,t;this.Ci||(e=this._instance).config.disable_product_tours||(t=e.persistence)==null||!t.get_property(kr)||this.it(()=>this.Fi())}it(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.generateProductTours?e():(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"product-tours",s=>{s?Zr.error("Could not load product tours script",s):e()})}Fi(){var e;!this.Ci&&(e=x.__PosthogExtensions__)!=null&&e.generateProductTours&&(this.Ci=x.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(t===void 0&&(t=!1),!I(this.Ri)||t){var i=this._instance.persistence;if(i){var s=i.props[fi];if(I(s)&&!t)return this.Ri=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 Zr.error(a),void e([],{isLoaded:!1,error:a})}var l=I(n.json.product_tours)?n.json.product_tours:[];this.Ri=l,i&&i.register({[fi]:l}),e(l,{isLoaded:!0})}})}else e(this.Ri,{isLoaded:!0})}getActiveProductTours(e){F(this.Ci)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ci.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ci)==null||t.showTourById(e)}previewTour(e){this.Ci?this.Ci.previewTour(e):this.it(()=>{var t;this.Fi(),(t=this.Ci)==null||t.previewTour(e)})}dismissProductTour(){var e;(e=this.Ci)==null||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Ci)==null||e.nextStep()}previousStep(){var e;(e=this.Ci)==null||e.previousStep()}clearCache(){var e;this.Ri=null,(e=this._instance.persistence)==null||e.unregister(fi)}resetTour(e){var t;(t=this.Ci)==null||t.resetTour(e)}resetAllTours(){var e;(e=this.Ci)==null||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Ci)==null||t.cancelPendingTour(e)}}var lt=function(r){return r.Activation="events",r.Cancellation="cancelEvents",r}({}),Da=function(r){return r.Button="button",r.Tab="tab",r.Selector="selector",r}({}),ja=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}({}),qa=function(r){return r.Top="top",r.Left="left",r.Right="right",r.Bottom="bottom",r}({}),mi=function(r){return r.Popover="popover",r.API="api",r.Widget="widget",r.ExternalSurvey="external_survey",r}({}),Ua=function(r){return r.Open="open",r.MultipleChoice="multiple_choice",r.SingleChoice="single_choice",r.Rating="rating",r.Link="link",r}({}),Ha=function(r){return r.NextQuestion="next_question",r.End="end",r.ResponseBased="response_based",r.SpecificQuestion="specific_question",r}({}),Ba=function(r){return r.Once="once",r.Recurring="recurring",r.Always="always",r}({}),ft=function(r){return r.SHOWN="survey shown",r.DISMISSED="survey dismissed",r.SENT="survey sent",r.ABANDONED="survey abandoned",r}({}),yi=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}({}),vn=function(r){return r.Popover="popover",r.Inline="inline",r}({}),C=N("[Surveys]"),gn="seenSurvey_",va=(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},Jr=r=>((e,t)=>{var i=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+e+t.id+"_"+t.current_iteration),i})(gn,r),ga=[mi.Popover,mi.Widget,mi.API],_a={ignoreConditions:!1,ignoreDelay:!1,displayType:vn.Popover};class tr{constructor(){this.Mi={},this.Mi={}}on(e,t){return this.Mi[e]||(this.Mi[e]=[]),this.Mi[e].push(t),()=>{this.Mi[e]=this.Mi[e].filter(i=>i!==t)}}emit(e,t){for(var i of this.Mi[e]||[])i(t);for(var s of this.Mi["*"]||[])s(e,t)}}function We(r,e,t){if(F(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}}class fa{constructor(e){this.Oi=new tr,this.Ai=(t,i)=>this.Di(t,i)&&this.ji(t,i)&&this.Li(t,i)&&this.Ni(t,i),this.Di=(t,i)=>i==null||!i.event||t?.event===i?.event,this._instance=e,this.Ui=new Set,this.zi=new Set}init(){var e;if(!f((e=this._instance)==null?void 0:e.Hi)){var t;(t=this._instance)==null||t.Hi((i,s)=>{this.on(i,s)})}}register(e){var t,i;if(!f((t=this._instance)==null?void 0:t.Hi)&&(e.forEach(o=>{var a,l;(a=this.zi)==null||a.add(o),(l=o.steps)==null||l.forEach(u=>{var c;(c=this.Ui)==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.Ui.has(e)||this.Ui.has(t?.event))&&this.zi&&((i=this.zi)==null?void 0:i.size)>0&&this.zi.forEach(s=>{this.Bi(t,s)&&this.Oi.emit("actionCaptured",s.name)})}qi(e){this.onAction("actionCaptured",t=>e(t))}Bi(e,t){if(t?.steps==null)return!1;for(var i of t.steps)if(this.Ai(e,i))return!0;return!1}onAction(e,t){return this.Oi.on(e,t)}ji(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}Li(e,t){return!!this.Wi(e,t)&&!!this.Gi(e,t)&&!!this.Vi(e,t)}Wi(e,t){var i;if(t==null||!t.href)return!0;var s=this.Ji(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")}Gi(e,t){var i;if(t==null||!t.text)return!0;var s=this.Ji(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;!F(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)))}Vi(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}Ji(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Ni(e,t){return t==null||!t.properties||t.properties.length===0||pn(t.properties.reduce((i,s)=>{var n=I(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)}}class ma{constructor(e){this._instance=e,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(e,t){return!!e&&pn(e.propertyFilters,t?.properties)}Zi(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}te(e,t,i){var s=(i===lt.Activation?this.Ki:this.Yi).get(e),n=[];return this.ie(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.Qi(l,t)})}register(e){var t;f((t=this._instance)==null?void 0:t.Hi)||(this.ee(e),this.re(e))}re(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.se==null&&(this.se=new fa(this._instance),this.se.init(),this.se.qi(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.se)==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.Xi.get(u.name);c&&c.push(i.id),this.Xi.set(u.name,c||[i.id])}}))}))}ee(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.Hi((n,o)=>{this.onEvent(n,o)}),this.Ki=this.Zi(e,lt.Activation),this.Yi=this.Zi(e,lt.Cancellation))}onEvent(e,t){var i,s=this.ne(),n=this.oe(),o=this.ae(),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.le(a))}}else{if(this.Yi.has(e)){var p=this.te(e,t,lt.Cancellation);p.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:p.map(g=>g.id)}),p.forEach(g=>{var _=a.indexOf(g.id);_>=0&&a.splice(_,1),this.ue(g.id)}),this.le(a))}if(this.Ki.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.Ki.get(e)});var v=this.te(e,t,lt.Activation);this.le(a.concat(v.map(g=>g.id)||[]))}}}onAction(e){var t,i=this.oe(),s=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[i])||[];this.Xi.has(e)&&this.le(s.concat(this.Xi.get(e)||[]))}le(e){var t,i=this.ne(),s=this.oe(),n=[...new Set(e)].filter(o=>!this.he(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.oe(),i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return i||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}}class ya extends ma{constructor(e){super(e)}oe(){return"$surveys_activated"}ae(){return ft.SHOWN}ie(e){var t;(t=this._instance)==null||t.getSurveys(e)}ue(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}ne(){return C}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class ba{constructor(e){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(F(t))return C.warn("Flags not loaded yet. Not loading surveys.");var i=I(t);this.ve=i?t.length>0:t,C.info("flags response received, isSurveysEnabled: "+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(i!=null&&i.startsWith(gn)||i!=null&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(s=>localStorage.removeItem(s))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)C.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)C.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())C.info("Not loading surveys in cookieless mode without consent.");else{var e=x?.__PosthogExtensions__;if(e){if(!f(this.ve)||this._instance.config.advanced_enable_surveys){var t=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var i=e.generateSurveys;if(i)return void this.ge(i,t);var s=e.loadExternalDependency;if(!s)return void this._e("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",n=>{n||!e.generateSurveys?this._e("Could not load surveys script",n):this.ge(e.generateSurveys,t)})}catch(n){throw this._e("Error initializing surveys",n),n}finally{this.ce=!1}}}else C.error("PostHog Extensions not found.")}}ge(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new ya(this._instance),C.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(e,t){C.error(e,t),this.me({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.fe.push(e),this._surveyManager&&this.me({isLoaded:!0}),()=>{this.fe=this.fe.filter(t=>t!==e)}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return C.info("Disabled. Not loading surveys."),e([]);var i,s=this._instance.get_property(Oi);if(s&&!t)return e(s,{isLoaded:!0});typeof Promise<"u"&&this.pe?this.pe.then(n=>{var{surveys:o,context:a}=n;return e(o,a)}):(typeof Promise<"u"&&(this.pe=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.pe=null;var a=n.statusCode;if(a!==200||!n.json){var l="Surveys API could not be loaded, status: "+a;C.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(g=>function(_){return!(!_.start_date||_.end_date)}(g)&&(function(_){var w;return!((w=_.conditions)==null||(w=w.events)==null||(w=w.values)==null||!w.length)}(g)||function(_){var w;return!((w=_.conditions)==null||(w=w.actions)==null||(w=w.values)==null||!w.length)}(g)));p.length>0&&((c=this._surveyEventReceiver)==null||c.register(p)),(o=this._instance.persistence)==null||o.register({[Oi]:h});var v={isLoaded:!0};e(h,v),i?.({surveys:h,context:v})}}))}me(e){for(var t of this.fe)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){C.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!F(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);C.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}be(e){if(F(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(F(this._surveyManager))return C.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.be(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return F(this._surveyManager)?(C.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.be(o);i({visible:a.eligible,disabledReason:a.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t){var i;if(F(this._surveyManager))C.warn("init was not called");else{var s=typeof e=="string"?this.ye(e):e;if(s!=null&&s.id)if(ga.includes(s.type)){var n=y?.querySelector(t);if(n)return(i=s.appearance)!=null&&i.surveyPopupDelaySeconds?(C.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;C.info("Rendering survey "+s.id+" with delay of "+((o=s.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(s,n),C.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n);C.warn("Survey element not found")}else C.warn("Surveys of type "+s.type+" cannot be rendered in the app");else C.warn("Survey not found")}}displaySurvey(e,t){var i;if(F(this._surveyManager))C.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=b({},s,{appearance:b({},s.appearance,{surveyPopupDelaySeconds:0})})),t.ignoreConditions===!1){var o=this.canRenderSurvey(s);if(!o.visible)return void C.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==vn.Inline?this._surveyManager.handlePopoverSurvey(n):this.renderSurvey(n,t.selector)}else C.warn("Survey not found")}}cancelPendingSurvey(e){F(this._surveyManager)?C.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}}var ct=N("[Conversations]");class wa{constructor(e){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.Ee=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;F(t)||(we(t)?this.we=t:(this.we=t.enabled,this.Ee=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.we=void 0,this.Ee=null}loadIfEnabled(){if(!this._conversationsManager&&!this.xe&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=x?.__PosthogExtensions__;if(e&&!f(this.we)&&this.we)if(this.Ee&&this.Ee.token){this.xe=!0;try{var t=e.initConversations;if(t)return this.$e(t),void(this.xe=!1);var i=e.loadExternalDependency;if(!i)return void this.Se("PostHog loadExternalDependency extension not found.");i(this._instance,"conversations",s=>{s||!e.initConversations?this.Se("Could not load conversations script",s):this.$e(e.initConversations),this.xe=!1})}catch(s){this.Se("Error initializing conversations",s),this.xe=!1}}else ct.error("Conversations enabled but missing token in remote config.")}}$e(e){if(this.Ee)try{this._conversationsManager=e(this.Ee,this._instance),ct.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else ct.error("Cannot complete initialization: remote config is null")}Se(e,t){ct.error(e,t),this._conversationsManager=null,this.xe=!1}enable(){this._conversationsManager?this._conversationsManager.enable():ct.warn("Conversations not loaded yet.")}disable(){this._conversationsManager&&this._conversationsManager.disable()}isLoaded(){return!oe(this._conversationsManager)}isEnabled(){return this.we===!0}isWidgetEnabled(){var e;return((e=this.Ee)==null?void 0:e.widgetEnabled)===!0}isWidgetVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isWidgetVisible())!==null&&e!==void 0&&e}}var Qr=N("[RateLimiter]");class Ea{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=s=>{var n=s.text;if(n&&n.length)try{(JSON.parse(n).quota_limited||[]).forEach(o=>{Qr.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void Qr.warn('could not rate limit - continuing. Error: "'+o?.message+'"',{text:n})}},this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)==null?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((i=e.config.rate_limiting)==null?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,s;e===void 0&&(e=!1);var n=new Date().getTime(),o=(t=(i=this.instance.persistence)==null?void 0:i.get_property(Ai))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:n};o.tokens+=(n-o.last)/1e3*this.captureEventsPerSecond,o.last=n,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var a=o.tokens<1;return a||e||(o.tokens=Math.max(0,o.tokens-1)),!a||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=a,(s=this.instance.persistence)==null||s.set_property(Ai,o),{isRateLimited:a,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var Le=N("[RemoteConfig]");class xa{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=x._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}ke(e){var t,i;(t=x.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(Le.error("PostHog Extensions not found. Cannot load remote config."),e())}Pe(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 Le.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.O())return void Le.warn("Remote config is disabled. Falling back to local config.");this.ke(e=>{if(!e)return Le.info("No config found after loading remote JS config. Falling back to JSON."),void this.Pe(t=>{this.yi(t)});this.yi(e)})}catch(e){Le.error("Error loading remote config",e)}}yi(e){e?this._instance.config.__preview_remote_config?(this._instance.yi(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):Le.info("__preview_remote_config is disabled. Logging config instead",e):Le.error("Failed to fetch remote config from PostHog.")}}var Hi=3e3;class ka{constructor(e,t){this.Te=!0,this.Ie=[],this.Ce=de(t?.flush_interval_ms||Hi,250,5e3,m.createLogger("flush interval"),Hi),this.Re=e}enqueue(e){this.Ie.push(e),this.Fe||this.Me()}unload(){this.Oe();var e=this.Ie.length>0?this.Ae():{},t=Object.values(e);[...t.filter(i=>i.url.indexOf("/e")===0),...t.filter(i=>i.url.indexOf("/e")!==0)].map(i=>{this.Re(b({},i,{transport:"sendBeacon"}))})}enable(){this.Te=!1,this.Me()}Me(){var e=this;this.Te||(this.Fe=setTimeout(()=>{if(this.Oe(),this.Ie.length>0){var t=this.Ae(),i=function(){var n=t[s],o=new Date().getTime();n.data&&I(n.data)&&T(n.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.Re(n)};for(var s in t)i()}},this.Ce))}Oe(){clearTimeout(this.Fe),this.Fe=void 0}Ae(){var e={};return T(this.Ie,t=>{var i,s=t,n=(s?s.batchKey:null)||s.url;f(e[n])&&(e[n]=b({},s,{data:[]})),(i=e[n].data)==null||i.push(s.data)}),this.Ie=[],e}}var Sa=["retriesPerformedSoFar"];class Pa{constructor(e){this.De=!1,this.je=3e3,this.Ie=[],this._instance=e,this.Ie=[],this.Le=!0,!f(d)&&"onLine"in d.navigator&&(this.Le=d.navigator.onLine,this.Ne=()=>{this.Le=!0,this.Lt()},this.Ue=()=>{this.Le=!1},D(d,"online",this.Ne),D(d,"offline",this.Ue))}get length(){return this.Ie.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=ls(e,Sa);pe(t)&&t>0&&(i.url=Xt(i.url,{retry_count:t})),this._instance._send_request(b({},i,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(t??0)<10?this.ze(b({retriesPerformedSoFar:t},i)):i.callback==null||i.callback(s)}}))}ze(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.Ie.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in "+i;navigator.onLine||(n+=" (Browser is offline)"),m.warn(n),this.De||(this.De=!0,this.He())}He(){if(this.Be&&clearTimeout(this.Be),this.Ie.length===0)return this.De=!1,void(this.Be=void 0);this.Be=setTimeout(()=>{this.Le&&this.Ie.length>0&&this.Lt(),this.He()},this.je)}Lt(){var e=Date.now(),t=[],i=this.Ie.filter(n=>n.retryAt<e||(t.push(n),!1));if(this.Ie=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Be&&(clearTimeout(this.Be),this.Be=void 0),this.De=!1,f(d)||(this.Ne&&(d.removeEventListener("online",this.Ne),this.Ne=void 0),this.Ue&&(d.removeEventListener("offline",this.Ue),this.Ue=void 0)),this.Ie))try{this._instance._send_request(b({},e,{transport:"sendBeacon"}))}catch(t){m.error(t)}this.Ie=[]}}class $a{constructor(e){this.qe=()=>{var t,i,s,n;this.We||(this.We={});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.We.lastScrollY=Math.ceil(a),this.We.maxScrollY=Math.max(a,(t=this.We.maxScrollY)!==null&&t!==void 0?t:0),this.We.maxScrollHeight=Math.max(l,(i=this.We.maxScrollHeight)!==null&&i!==void 0?i:0),this.We.lastContentY=u,this.We.maxContentY=Math.max(u,(s=this.We.maxContentY)!==null&&s!==void 0?s:0),this.We.maxContentHeight=Math.max(c,(n=this.We.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}getContext(){return this.We}resetContext(){var e=this.We;return setTimeout(this.qe,0),e}startMeasuringScrollPosition(){D(d,"scroll",this.qe,{capture:!0}),D(d,"scrollend",this.qe,{capture:!0}),D(d,"resize",this.qe)}scrollElement(){if(!this._instance.config.scroll_root_selector)return d?.document.documentElement;var e=I(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}}var Ra=r=>sn(r?.config.mask_personal_data_properties,r?.config.custom_personal_data_properties);class es{constructor(e,t,i,s){this.Ge=n=>{var o=this.Ve();if(!o||o.sessionId!==n){var a={sessionId:n,props:this.Je(this._instance)};this.Ke.register({[Mi]:a})}},this._instance=e,this.Ye=t,this.Ke=i,this.Je=s||Ra,this.Ye.onSessionId(this.Ge)}Ve(){return this.Ke.props[Mi]}getSetOnceProps(){var e,t=(e=this.Ve())==null?void 0:e.props;return t?"r"in t?nn(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 T(Xi(this.getSetOnceProps()),(t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+xi(i)]=t}),e}}var bi=N("[SessionId]");class ts{on(e,t){return this.Xe.on(e,t)}constructor(e,t,i){var s;if(this.Qe=[],this.Ze=void 0,this.Xe=new tr,this.tr=(c,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.Ke=e.persistence,this.ir=void 0,this.er=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.rr=t||Fe,this.sr=i||Fe;var n=this.R.persistence_name||this.R.token,o=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*de(o,60,36e3,bi.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.nr(),this.ar="ph_"+n+"_window_id",this.lr="ph_"+n+"_primary_window_exists",this.ur()){var a=U.W(this.ar),l=U.W(this.lr);a&&!l?this.ir=a:U.V(this.ar),U.G(this.lr,!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.hr(this.R.bootstrap.sessionID,new Date().getTime(),u)}catch(c){bi.error("Invalid sessionID in bootstrap",c)}this.dr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return f(this.Qe)&&(this.Qe=[]),this.Qe.push(e),this.er&&e(this.er,this.ir),()=>{this.Qe=this.Qe.filter(t=>t!==e)}}ur(){return this.R.persistence!=="memory"&&!this.Ke.Si&&U.H()}vr(e){e!==this.ir&&(this.ir=e,this.ur()&&U.G(this.ar,e))}cr(){return this.ir?this.ir:this.ur()?U.W(this.ar):null}hr(e,t,i){e===this.er&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.er=e,this.Ke.register({[jt]:[t,e,i]}))}pr(){var e=this.Ke.props[jt];return I(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.hr(null,null,null)}destroy(){clearTimeout(this.gr),this.gr=void 0,this.Ze&&d&&(d.removeEventListener("beforeunload",this.Ze,{capture:!1}),this.Ze=void 0),this.Qe=[]}dr(){this.Ze=()=>{this.ur()&&U.V(this.lr)},D(d,"beforeunload",this.Ze,{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.pr(),a=this.cr(),l=pe(o)&&o>0&&Math.abs(i-o)>864e5,u=!1,c=!n,h=!c&&!e&&this.tr(i,s);c||h||l?(n=this.rr(),a=this.sr(),bi.info("new session ID generated",{sessionId:n,windowId:a,changeReason:{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}}),o=i,u=!0):a||(a=this.sr(),u=!0);var p=s===0||!e||l?i:s,v=o===0?new Date().getTime():o;return this.vr(a),this.hr(n,p,v),e||this.nr(),u&&this.Qe.forEach(g=>g(n,a,u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0)),{sessionId:n,windowId:a,sessionStartTimestamp:v,changeReason:u?{noSessionId:c,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}nr(){clearTimeout(this.gr),this.gr=setTimeout(()=>{var[e]=this.pr();if(this.tr(new Date().getTime(),e)){var t=this.er;this.resetSessionId(),this.Xe.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var Fa=["$set_once","$set"],$e=N("[SiteApps]");class Ia{constructor(e){this._instance=e,this._r=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}mr(e,t){if(t){var i=this.globalsForEvent(t);this._r.push(i),this._r.length>1e3&&(this._r=this._r.slice(10))}}get siteAppLoaders(){var e;return(e=x._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Hi(this.mr.bind(this));this.yr=()=>{e(),this._r=[],this.yr=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,v]of Object.entries(h))u[p]={id:c[p],type:p,properties:v};var{$set_once:g,$set:_}=e;return{event:b({},ls(e,Fa),{properties:b({},e.properties,_?{$set:b({},(t=(i=e.properties)==null?void 0:i.$set)!==null&&t!==void 0?t:{},_)}:{},g?{$set_once:b({},(s=(n=e.properties)==null?void 0:n.$set_once)!==null&&s!==void 0?s:{},g)}:{}),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._r.length&&($e.info("Processing "+this._r.length+" events for site app with id "+e.id),this._r.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.yr)==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}}br(){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)}wr(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.br(),void this._instance.on("eventCaptured",u=>this.wr(u))):void $e.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.yr)==null||i.call(this),(s=e.siteApps)!=null&&s.length)if(this.isEnabled){var o=function(u){var c;x["__$$ph_site_app_"+u]=n._instance,(c=x.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(n._instance,l,h=>{if(h)return $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.')}}var _n=function(r,e){if(!r)return!1;var t=r.userAgent;if(t&&hr(t,e))return!0;try{var i=r?.userAgentData;if(i!=null&&i.brands&&i.brands.some(s=>hr(s?.brand,e)))return!0}catch{}return!!r.webdriver},mt=function(r){return r.US="us",r.EU="eu",r.CUSTOM="custom",r}({}),is="i.posthog.com";class Ca{constructor(e){this.Er={},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("."+is,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Er[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Er[this.apiHost]=mt.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Er[this.apiHost]=mt.EU:this.Er[this.apiHost]=mt.CUSTOM),this.Er[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===mt.CUSTOM)return this.apiHost+t;var i=is+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var Ta={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&&Kt(e.href,r),not_regex:(r,e)=>!!d&&!Kt(e.href,r),exact:(r,e)=>e.href===r,is_not:(r,e)=>e.href!==r};class B{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),t.getWebExperiments(s=>{B.$r("retrieved web experiments from the server"),t.Sr=new Map,s.forEach(n=>{if(n.feature_flag_key){var o;t.Sr&&(B.$r("setting flag key ",n.feature_flag_key," to web experiment ",n),(o=t.Sr)==null||o.set(n.feature_flag_key,n));var a=t._instance.getFeatureFlag(n.feature_flag_key);j(a)&&n.variants[a]&&t.kr(n.name,a,n.variants[a].transforms)}else if(n.variants)for(var l in n.variants){var u=n.variants[l];B.Pr(u)&&t.kr(n.name,l,u.transforms)}})},i)},this._instance=e,this._instance.onFeatureFlags(i=>{this.onFeatureFlags(i)})}onFeatureFlags(e){if(this._is_bot())B.$r("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(F(this.Sr))return this.Sr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();B.$r("applying feature flags",e),e.forEach(t=>{var i;if(this.Sr&&(i=this.Sr)!=null&&i.has(t)){var s,n=this._instance.getFeatureFlag(t),o=(s=this.Sr)==null?void 0:s.get(t);n&&o!=null&&o.variants[n]&&this.kr(o.name,n,o.variants[n].transforms)}})}}previewWebExperiment(){var e=B.getWindowLocation();if(e!=null&&e.search){var t=Vt(e?.search,"__experiment_id"),i=Vt(e?.search,"__experiment_variant");t&&i&&(B.$r("previewing web experiments "+t+" && "+i),this.getWebExperiments(s=>{this.Tr(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)}})}Tr(e,t,i){var s=i.filter(n=>n.id===e);s&&s.length>0&&(B.$r("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.kr(s[0].name,t,s[0].variants[t].transforms))}static Pr(e){return!F(e.conditions)&&B.Ir(e)&&B.Cr(e)}static Ir(e){var t;if(F(e.conditions)||F((t=e.conditions)==null?void 0:t.url))return!0;var i,s,n,o=B.getWindowLocation();return!!o&&((i=e.conditions)==null||!i.url||Ta[(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 Cr(e){var t;if(F(e.conditions)||F((t=e.conditions)==null?void 0:t.utm))return!0;var i=Qs();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,v=(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,g=(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&&g&&_&&v}return!1}static $r(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];m.info("[WebExperiments] "+e,i)}kr(e,t,i){this._is_bot()?B.$r("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?i.forEach(s=>{if(s.selector){var n;B.$r("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)})}}):B.$r("Control variants leave the page unmodified.")}_is_bot(){return J&&this._instance?_n(J,this._instance.config.custom_blocked_useragents):void 0}}var Oa=N("[PostHog ExternalIntegrations]"),Ma={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Aa{constructor(e){this._instance=e}it(e,t){var i;(i=x.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,s=>{if(s)return Oa.error("failed to load script",s);t()})}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,u;!s||(a=x.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.it(Ma[o],()=>{var c;(c=x.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)}),!s&&(l=x.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((u=x.__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)}}}var Bi="[SessionRecording]",ut=N(Bi);class rs{get started(){var e;return!((e=this.Rr)==null||!e.isStarted)}get status(){return this.Rr?this.Rr.status:this.Fr&&!this.Mr?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Fr=!1,this.Or=void 0,this._instance=e,!this._instance.sessionManager)throw ut.error("started without valid sessionManager"),new Error(Bi+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Bi+' cannot be used with cookieless_mode="always"')}get Mr(){var e,t=!((e=this._instance.get_property(oi))==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.Mr||(t=this.Rr)==null||!t.isStarted){var i=!f(Object.assign)&&!f(Array.from);this.Mr&&i?(this.Ar(e),ut.info("starting")):this.stopRecording()}}Ar(e){var t,i,s;this.Mr&&(x!=null&&(t=x.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=x.__PosthogExtensions__)!=null&&i.initSessionRecording?this.Dr(e):(s=x.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.jr,n=>{if(n)return ut.error("could not load recorder",n);this.Dr(e)}))}stopRecording(){var e,t;(e=this.Or)==null||e.call(this),this.Or=void 0,(t=this.Rr)==null||t.stop()}Lr(){var e;(e=this._instance.persistence)==null||e.unregister(Ms)}Nr(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=F(a)?null:parseFloat(a);F(l)&&this.Lr();var u=o?.minimumDurationMilliseconds;s.register({[oi]:b({enabled:!!o},o,{networkPayloadCapture:b({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.Or)==null||t.call(this),this.Or=(i=this._instance.sessionManager)==null?void 0:i.onSessionId(n)}}onRemoteConfig(e){"sessionRecording"in e?e.sessionRecording!==!1?(this.Nr(e),this.Fr=!0,this.startIfEnabledOrStop()):this.Fr=!0:ut.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;t===void 0&&(t="log"),(i=this.Rr)!=null&&i.log?this.Rr.log(e,t):ut.warn("log called before recorder was ready")}get jr(){var e,t,i=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(oi);return(i==null||(t=i.scriptConfig)==null?void 0:t.script)||"lazy-recorder"}Dr(e){var t,i;if((t=x.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Rr||(this.Rr=(i=x.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.Rr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Rr.start(e)}onRRwebEmit(e){var t;(t=this.Rr)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Rr||(t=this._instance.persistence)==null||t.register({$replay_override_linked_flag:!0}),(e=this.Rr)==null||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Rr||(t=this._instance.persistence)==null||t.register({$replay_override_sampling:!0}),(e=this.Rr)==null||e.overrideSampling()}overrideTrigger(e){var t,i;this.Rr||(i=this._instance.persistence)==null||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Rr)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Rr)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!((i=this.Rr)==null||!i.tryAddCustomEvent(e,t))}}var bt={},Wi=()=>{},Ve="posthog",fn=!aa&&G?.indexOf("MSIE")===-1&&G?.indexOf("Mozilla")===-1,ss=r=>{var e;return b({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ho(y?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Wi,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:z&&j(z?.search)&&z.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_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;m.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:Hi},error_tracking:{},_onCapture:Wi,__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}:{}}))(r))},ns=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 I(r.property_blacklist)&&(f(r.property_denylist)?t.property_denylist=r.property_blacklist:I(r.property_denylist)?t.property_denylist=[...r.property_blacklist,...r.property_denylist]:m.error("Invalid value for property_denylist config: "+r.property_denylist)),t};class La{constructor(){this.__forceAllowLocalhost=!1}get Ur(){return this.__forceAllowLocalhost}set Ur(e){m.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class ei{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 La,this.zr=!1,this.version=_e.LIB_VERSION,this.Hr=new tr,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ss(),this.SentryIntegration=Uo,this.sentryIntegration=e=>function(t,i){var s=Js(t,i);return{name:Zs,processEvent:n=>s(n)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Br=!1,this.qr=null,this.Wr=null,this.Gr=null,this.featureFlags=new ha(this),this.toolbar=new Bo(this),this.scrollManager=new $a(this),this.pageViewManager=new qr(this),this.surveys=new ba(this),this.conversations=new wa(this),this.experiments=new B(this),this.exceptions=new la(this),this.rateLimiter=new Ea(this),this.requestRouter=new Ca(this),this.consent=new Ao(this),this.externalIntegrations=new Aa(this),this.people={set:(e,t,i)=>{var s=j(e)?{[e]:t}:e;this.setPersonProperties(s),i?.({})},set_once:(e,t,i)=>{var s=j(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),i?.({})}},this.on("eventCaptured",e=>m.info('send "'+e?.event+'"',e))}init(e,t,i){if(i&&i!==Ve){var s,n=(s=bt[i])!==null&&s!==void 0?s:new ei;return n._init(e,t,i),bt[i]=n,bt[Ve][i]=n,n}return this._init(e,t,i)}_init(e,t,i){var s;if(t===void 0&&(t={}),f(e)||ki(e))return m.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.Vr(t.debug),this.Jr=t,this.Kr=[],t.person_profiles&&(this.Wr=t.person_profiles),this.set_config(L({},ss(t.defaults),ns(t),{name:i,token:e})),this.config.on_xhr_error&&m.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:ye.GZipJS;var n=this.Yr();this.persistence=new _i(this.config,n),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new _i(b({},this.config,{persistence:"sessionStorage"}),n);var o=b({},this.persistence.props),a=b({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Xr=new ka(k=>this.Qr(k),this.config.request_queue_config),this.Zr=new Pa(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 ts(this),this.sessionPropsManager=new es(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(m.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.ts(l)},0)):(m.info("Initializing extensions synchronously"),this.ts(l)),_e.DEBUG=_e.DEBUG||this.config.debug,_e.DEBUG&&m.info("Starting in debug mode",{this:this,config:t,thisC:b({},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(Fe()),p=(u=t.bootstrap)!=null&&u.isIdentifiedID?h:t.bootstrap.distinctID;this.persistence.set_property(fe,(c=t.bootstrap)!=null&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:p})}if(this.es()){var v,g,_=Object.keys(((v=t.bootstrap)==null?void 0:v.featureFlags)||{}).filter(k=>{var R;return!((R=t.bootstrap)==null||(R=R.featureFlags)==null||!R[k])}).reduce((k,R)=>{var P;return k[R]=((P=t.bootstrap)==null||(P=P.featureFlags)==null?void 0:P[R])||!1,k},{}),w=Object.keys(((g=t.bootstrap)==null?void 0:g.featureFlagPayloads)||{}).filter(k=>_[k]).reduce((k,R)=>{var P,O;return(P=t.bootstrap)!=null&&(P=P.featureFlagPayloads)!=null&&P[R]&&(k[R]=(O=t.bootstrap)==null||(O=O.featureFlagPayloads)==null?void 0:O[R]),k},{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:w})}if(l)this.register_once({distinct_id:tt,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(Fe());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(fe,"anonymous")}return D(d,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?qo(this,()=>this.rs()):this.rs(),Ie(this.config._onCapture)&&this.config._onCapture!==Wi&&(m.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",k=>this.config._onCapture(k.event,k))),this.config.ip&&m.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}ts(e){var t=performance.now();this.historyAutocapture=new jo(this),this.historyAutocapture.startIfEnabled();var i=[];i.push(()=>{new Vo(this).startIfEnabledOrStop()}),i.push(()=>{var s;this.siteApps=new Ia(this),(s=this.siteApps)==null||s.init()}),e||i.push(()=>{this.sessionRecording=new rs(this),this.sessionRecording.startIfEnabledOrStop()}),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),i.push(()=>{this.autocapture=new $o(this),this.autocapture.startIfEnabled()}),i.push(()=>{this.surveys.loadIfEnabled()}),i.push(()=>{this.conversations.loadIfEnabled()}),i.push(()=>{this.productTours=new pa(this),this.productTours.loadIfEnabled()}),i.push(()=>{this.heatmaps=new Jo(this),this.heatmaps.startIfEnabled()}),i.push(()=>{this.webVitalsAutocapture=new Ko(this)}),i.push(()=>{this.exceptionObserver=new Do(this),this.exceptionObserver.startIfEnabledOrStop()}),i.push(()=>{this.deadClicksAutocapture=new Ks(this,No),this.deadClicksAutocapture.startIfEnabled()}),i.push(()=>{if(this.ss){var s=this.ss;this.ss=void 0,this.yi(s)}}),this.ns(i,t)}ns(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.ns(e,t)},0);var i=e.shift();if(i)try{i()}catch(n){m.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&&m.info("PostHog extensions initialized ("+s+"ms)")}yi(e){var t,i,s,n,o,a,l,u,c;if(!y||!y.body)return m.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.yi(e)},500);this.config.__preview_deferred_init_extensions&&(this.ss=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=S(e.supportedCompression,ye.GZipJS)?ye.GZipJS:S(e.supportedCompression,ye.Base64)?ye.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Wr?this.Wr:"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.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)}rs(){try{this.config.loaded(this)}catch(e){m.critical("`loaded` function failed",e)}this.os(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.ls()},1),new xa(this).load(),this.featureFlags.flags()}os(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Xr)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Ce(this.__request_queue,e=>this.Qr(e)),this.__request_queue=[],this.os()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.us()&&this.capture("$pageleave"),(e=this.Xr)==null||e.unload(),(t=this.Zr)==null||t.unload()):this.us()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(fn?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Xt(e.url,{ip:this.config.ip?1:0}),e.headers=b({},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=b({},t);o.timeout=o.timeout||6e4,o.url=Xt(o.url,{_:new Date().getTime().toString(),ver:_e.LIB_VERSION,compression:o.compression});var a=(i=o.transport)!==null&&i!==void 0?i:"fetch",l=At.filter(c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport)),u=(s=(n=Cs(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)})(b({},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)}}))))}Qr(e){this.Zr?this.Zr.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,i=[],s=[],n=[];Ce(e,a=>{a&&(t=a[0],I(t)?n.push(a):Ie(a)?a.call(this):I(a)&&t==="alias"?i.push(a):I(a)&&t.indexOf("capture")!==-1&&Ie(this[t])?n.push(a):s.push(a))});var o=function(a,l){Ce(a,function(u){if(I(u[0])){var c=l;T(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)}es(){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.Xr){if(this.is_capturing())if(!f(e)&&j(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&&!j(t?.$current_url)&&(m.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=Fe(),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",v=this.hs(i?.$set_once,p);if(v&&(c.$set_once=v),(c=co(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===ft.DISMISSED||e===ft.SENT){var g=t?.[yi.SURVEY_ID],_=t?.[yi.SURVEY_ITERATION];h={id:g,current_iteration:_},localStorage.getItem(Jr(h))||localStorage.setItem(Jr(h),"true"),c.$set=b({},c.$set,{[va({id:g,current_iteration:_},e===ft.SENT?"responded":"dismissed")]:!0})}else e===ft.SHOWN&&(c.$set=b({},c.$set,{[yi.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var w=b({},c.properties.$set,c.$set);if(Ge(w)||this.setPersonPropertiesForFlags(w),!F(this.config.before_send)){var E=this.ds(c);if(!E)return;c=E}this.Hr.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.Qr(k):this.Xr.enqueue(k),c}m.critical("This capture call is ignored due to client rate limiting.")}}else m.error("No event name provided to posthog.capture")}else m.uninitializedWarning("posthog.capture")}Hi(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=b({},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=b({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!j(a.distinct_id)&&!pe(a.distinct_id)||ki(a.distinct_id))&&m.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=Xo(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 v;this.sessionRecording&&L(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(v=this.Zr)==null?void 0:v.length}catch(E){a.$sdk_debug_error_capturing_properties=String(E)}if(this.requestRouter.region===mt.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 g=i.getTime()-o;a.$duration=parseFloat((g/1e3).toFixed(3))}G&&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(),I(this.config.property_denylist)?T(this.config.property_denylist,function(E){delete a[E]}):m.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(m.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,e));var w=this.vs();return a.$process_person_profile=w,w&&!n&&this.cs("_calculate_event_properties"),a}hs(e,t){var i;if(t===void 0&&(t=!0),!this.persistence||!this.vs()||this.zr)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&&(m.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.zr=!0),Ge(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)}fs(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,i){var s=i!=null&&i.merge?this.featureFlags.getFlagVariants():{},n=i!=null&&i.merge?this.featureFlags.getFlagPayloads():{},o=b({},s,e),a=b({},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.Hr.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=_a),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 m.uninitializedWarning("posthog.identify");if(pe(e)&&(e=e.toString(),m.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()))m.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==tt){if(this.cs("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(dt)&&(this.unregister(dt),this.register({distinct_id:e}));var o=(this.persistence.get_property(fe)||"anonymous")==="anonymous";e!==s&&o?(this.persistence.set_property(fe,"identified"),this.setPersonPropertiesForFlags(b({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.Gr=Gr(e,t,i),this.featureFlags.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(qt))}}else m.critical('The string "'+tt+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else m.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.cs("posthog.setPersonProperties")){var i=Gr(this.get_distinct_id(),e,t);this.Gr!==i?(this.setPersonPropertiesForFlags(b({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Gr=i):m.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:b({},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 m.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.cs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,n;if(m.info("reset"),!this.__loaded)return m.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(fe,"anonymous"),(n=this.sessionManager)==null||n.resetSessionId(),this.Gr=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:tt,$device_id:null},"");else{var a=this.config.get_device_id(Fe());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(Ts)?(m.critical("Attempting to create alias for existing People user - aborting."),-2):this.cs("posthog.alias")?(f(t)&&(t=this.get_distinct_id()),e!==t?(this.fs(dt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(m.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=b({},this.config);if(q(e)){var i,s,n,o,a,l,u;L(this.config,ns(e));var c=this.Yr();(i=this.persistence)==null||i.update_config(this.config,t,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new _i(b({},this.config,{persistence:"sessionStorage"}),c);var h=this.Vr(this.config.debug);we(h)&&(this.config.debug=h),we(this.config.debug)&&(this.config.debug?(_e.DEBUG=!0,A.H()&&A.G("ph_debug","true"),m.info("set_config",{config:e,oldConfig:t,newConfig:b({},this.config)})):(_e.DEBUG=!1,A.H()&&A.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.ps(),(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(b({},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:Ve;return t!==Ve&&(t=Ve+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(fe))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(fe))==="identified"}vs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Ge(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[dt])&&((t=this.persistence)==null||(t=t.props)==null||!t[Ht]))}us(){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.vs()||this.cs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}cs(e){return this.config.person_profiles==="never"?(m.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.fs(Ht,!0),!0)}Yr(){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}ps(){var e,t,i,s,n=this.Yr();return((e=this.persistence)==null?void 0:e.Si)!==n&&((i=this.persistence)==null||i.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.Si)!==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 ts(this),this.pageViewManager=new qr(this),this.persistence&&(this.sessionPropsManager=new es(this,this.sessionManager,this.persistence)),this.sessionRecording=new rs(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.ps(),this.os(),(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.ls()}else m.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.ps(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:tt,$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.ls())):m.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===me.GRANTED?"granted":e===me.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.ps()}_is_bot(){return J?_n(J,this.config.custom_blocked_useragents):void 0}ls(){y&&(y.visibilityState==="visible"?this.Br||(this.Br=!0,this.capture("$pageview",{title:y.title},{send_instantly:!0}),this.qr&&(y.removeEventListener("visibilitychange",this.qr),this.qr=null)):this.qr||(this.qr=this.ls.bind(this),D(y,"visibilitychange",this.qr)))}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}))}O(){var e,t,i,s,n,o,a,l=this.Jr||{};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?(m.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=m,o=(t="advanced_disable_flags")in(e=l)&&!f(e[t]),a=i in e&&!f(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)}ds(e){if(F(this.config.before_send))return e;var t=I(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),F(i)){var n="Event '"+e.event+"' was rejected in beforeSend function";return Pn(e.event)?m.warn(n+". This can cause unexpected behavior."):m.info(n),null}i.properties&&!Ge(i.properties)||m.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)})}Vr(e){var t=we(e)&&!e,i=A.H()&&A.q("ph_debug")==="true";return!t&&(!!i||e)}}(function(r,e){for(var t=0;t<e.length;t++)r.prototype[e[t]]=lo(r.prototype[e[t]])})(ei,["identify"]);var os,Wa={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1},Va=(os=bt[Ve]=new ei,function(){function r(){r.done||(r.done=!0,fn=!1,T(bt,function(e){e._dom_loaded()}))}y!=null&&y.addEventListener?y.readyState==="complete"?r():D(y,"DOMContentLoaded",r,{capture:!1}):d&&m.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),os);export{ye as Compression,Wa as DEFAULT_PRODUCT_TOUR_APPEARANCE,vn as DisplaySurveyType,ei as PostHog,ft as SurveyEventName,yi as SurveyEventProperties,lt as SurveyEventType,ja as SurveyPosition,Ha as SurveyQuestionBranchingType,Ua as SurveyQuestionType,Ba as SurveySchedule,qa as SurveyTabPosition,mi as SurveyType,Da as SurveyWidgetType,Va as default,Va as posthog,Na as severityLevels};