PageSourceSearch

https://www.umph.ai/_next/static/chunks/9da6db1e-c122762125b0c419.js

js umph.ai collected 2026-10-05 13:48:33 UTC 174,317 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8229],{26614:(e,t,i)=>{i.d(t,{Ay:()=>nR});var s="undefined"!=typeof window?window:void 0,r="undefined"!=typeof globalThis?globalThis:s;"undefined"==typeof self&&(r.self=r),"undefined"==typeof File&&(r.File=function(){});var n=null==r?void 0:r.navigator,a=null==r?void 0:r.document,o=null==r?void 0:r.location,l=null==r?void 0:r.fetch,u=null!=r&&r.XMLHttpRequest&&"withCredentials"in new r.XMLHttpRequest?r.XMLHttpRequest:void 0,c=null==r?void 0:r.AbortController,h=null==r?void 0:r.CompressionStream,d=null==n?void 0:n.userAgent,p=null!=s?s:{},g="1.364.1",v={DEBUG:!1,LIB_VERSION:g,LIB_NAME:"web",JS_SDK_VERSION:g};function _(e,t,i,s,r,n,a){try{var o=e[n](a),l=o.value}catch(e){return void i(e)}o.done?t(l):Promise.resolve(l).then(s,r)}function f(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function a(e){_(n,s,r,a,o,"next",e)}function o(e){_(n,s,r,a,o,"throw",e)}a(void 0)})}}function m(){return(m=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e}).apply(null,arguments)}function y(e,t){if(null==e)return{};var i={};for(var s in e)if(({}).hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}function b(){return(b=f(function*(e,t){void 0===t&&(t=!0);try{var i=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(i).blob()}catch(e){return t&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}var w=["$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"],x=["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"],E=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return x.concat(t).some(e=>{var t=e.toLowerCase();return -1!==i.indexOf(t)})};function k(e,t){return -1!==e.indexOf(t)}var S=function(e){return e.trim()},P=function(e){return e.replace(/^\$/,"")},F=Object.prototype,I=F.hasOwnProperty,$=F.toString,C=Array.isArray||function(e){return"[object Array]"===$.call(e)},O=e=>"function"==typeof e,T=e=>e===Object(e)&&!C(e),R=e=>{if(T(e)){for(var t in e)if(I.call(e,t))return!1;return!0}return!1},M=e=>void 0===e,A=e=>"[object String]"==$.call(e),N=e=>A(e)&&0===e.trim().length,L=e=>M(e)||null===e,D=e=>"[object Number]"==$.call(e)&&e==e,j=e=>D(e)&&e>0,U=e=>"[object Boolean]"===$.call(e),H=e=>k(w,e);function W(e){return null===e||"object"!=typeof e}function q(e,t){return({}).toString.call(e)==="[object "+t+"]"}function z(e){return!M(Event)&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var B=[!0,"true",1,"1","yes"],V=e=>k(B,e),G=[!1,"false",0,"0","no"];function Y(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),D(e)?e>i?(s.warn(" cannot be  greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),Y(r||i,t,i,s))}class J{constructor(e){this.t={},this.i=e.i,this.o=Y(e.bucketSize,0,100,e.h),this.m=Y(e.refillRate,0,this.o,e.h),this.S=Y(e.refillInterval,0,864e5,e.h)}T(e,t){var i=Math.floor((t-e.lastAccess)/this.S);i>0&&(e.tokens=Math.min(e.tokens+i*this.m,this.o),e.lastAccess=e.lastAccess+i*this.S)}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this.t[s];return r?this.T(r,i):this.t[s]=r={tokens:this.o,lastAccess:i},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.i)||t.call(this,e)),0===r.tokens)}stop(){this.t={}}}var K,X,Z,Q="Mobile",ee="Android",et="Tablet",ei=ee+" "+et,es="iPad",er="Apple",en=er+" Watch",ea="Safari",eo="BlackBerry",el="Samsung",eu=el+"Browser",ec=el+" Internet",eh="Chrome",ed=eh+" OS",ep=eh+" iOS",eg="Internet Explorer",ev=eg+" "+Q,e_="Opera",ef=e_+" Mini",em="Edge",ey="Microsoft "+em,eb="Firefox",ew=eb+" iOS",ex="Nintendo",eE="PlayStation",ek="Xbox",eS=ee+" "+Q,eP=Q+" "+ea,eF="Windows",eI=eF+" Phone",e$="Nokia",eC="Ouya",eO="Generic",eT=eO+" "+Q.toLowerCase(),eR=eO+" "+et.toLowerCase(),eM="Konqueror",eA="(\\d+(\\.\\d+)?)",eN=RegExp("Version/"+eA),eL=RegExp(ek,"i"),eD=RegExp(eE+" \\w+","i"),ej=RegExp(ex+" \\w+","i"),eU=RegExp(eo+"|PlayBook|BB10","i"),eH={"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"},eW=function(e,t){var i;return t=t||"",k(e," OPR/")&&k(e,"Mini")?ef:k(e," OPR/")?e_:eU.test(e)?eo:k(e,"IE"+Q)||k(e,"WPDesktop")?ev:k(e,eu)?ec:k(e,em)||k(e,"Edg/")?ey:k(e,"FBIOS")?"Facebook "+Q:k(e,"UCWEB")||k(e,"UCBrowser")?"UC Browser":k(e,"CriOS")?ep:k(e,"CrMo")||k(e,eh)?eh:k(e,ee)&&k(e,ea)?eS:k(e,"FxiOS")?ew:k(e.toLowerCase(),eM.toLowerCase())?eM:(i=t)&&k(i,er)||k(e,ea)&&!k(e,eh)&&!k(e,ee)?k(e,Q)?eP:ea:k(e,eb)?eb:k(e,"MSIE")||k(e,"Trident/")?eg:k(e,"Gecko")?eb:""},eq={[ev]:[RegExp("rv:"+eA)],[ey]:[RegExp(em+"?\\/"+eA)],[eh]:[RegExp("("+eh+"|CrMo)\\/"+eA)],[ep]:[RegExp("CriOS\\/"+eA)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+eA)],[ea]:[eN],[eP]:[eN],[e_]:[RegExp("(Opera|OPR)\\/"+eA)],[eb]:[RegExp(eb+"\\/"+eA)],[ew]:[RegExp("FxiOS\\/"+eA)],[eM]:[RegExp("Konqueror[:/]?"+eA,"i")],[eo]:[RegExp(eo+" "+eA),eN],[eS]:[RegExp("android\\s"+eA,"i")],[ec]:[RegExp(eu+"\\/"+eA)],[eg]:[RegExp("(rv:|MSIE )"+eA)],Mozilla:[RegExp("rv:"+eA)]},ez=function(e,t){var i=eq[eW(e,t)];if(M(i))return null;for(var s=0;i.length>s;s++){var r=e.match(i[s]);if(r)return parseFloat(r[r.length-2])}return null},eB=[[RegExp(ek+"; "+ek+" (.*?)[);]","i"),e=>[ek,e&&e[1]||""]],[RegExp(ex,"i"),[ex,""]],[RegExp(eE,"i"),[eE,""]],[eU,[eo,""]],[RegExp(eF,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eI,""];if(new RegExp(Q).test(t)&&!/IEMobile\b/.test(t))return[eF+" "+Q,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=eH[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[eF,s]}return[eF,""]}
1],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=M(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+ee+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ee+")","i"),e=>e&&e[2]?[ee,[e[2],e[3],e[4]||"0"].join(".")]:[ee,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ed,""]],[/Linux|debian/i,["Linux",""]]],eV=function(e){return ej.test(e)?ex:eD.test(e)?eE:eL.test(e)?ek:RegExp(eC,"i").test(e)?eC:RegExp("("+eI+"|WPDesktop)","i").test(e)?eI:/iPad/.test(e)?es:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?en:eU.test(e)?eo:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(e$,"i").test(e)?e$:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Q).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ee:ei:RegExp("(pda|"+Q+")","i").test(e)?eT:RegExp(et,"i").test(e)&&!RegExp(et+" pc","i").test(e)?eR:""},eG=e=>e instanceof Error;class eY{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return f(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&C(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:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,s;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),m({},e,{cause:i,stack:s})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}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 f(function*(){var i=e;for(var s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){var i,s,r,n={type:e.type,value:e.value,mechanism:{type:null!=(i=t.type)?i:"generic",handled:null==(s=t.handled)||s,synthetic:null!=(r=e.synthetic)&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var a=[n];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,m({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:function(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return Z&&i.length===X||(X=i.length,Z=i.reduce((i,s)=>{K||(K={});var r=K[s];if(r)i[r[0]]=r[1];else for(var n=e(s),a=n.length-1;a>=0;a--){var o=n[a],l=null==o?void 0:o.filename,u=t[s];if(l&&u){i[l]=u,K[s]=[l,u];break}}return i},{})),Z}}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var s=(i,s)=>{if(4>=s){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return m({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}}function eJ(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:!0};return M(s)||(n.lineno=s),M(r)||(n.colno=r),n}var eK=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},eX=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,eZ=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,eQ=/\((\S*)(?::(\d+))(?::(\d+))\)/,e0=(e,t)=>{var i=eX.exec(e);if(i){var[,s,r,n]=i;return eJ(t,s,"?",+r,+n)}var a=eZ.exec(e);if(a){if(a[2]&&0===a[2].indexOf("eval")){var o=eQ.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,u]=eK(a[1]||"?",a[2]);return eJ(t,u,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},e1=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,e2=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,e3=(e,t)=>
1{var i=e1.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=e2.exec(i[3]);s&&(i[1]=i[1]||"eval",i[3]=s[1],i[4]=s[2],i[5]="")}var r=i[3],n=i[1]||"?";return[n,r]=eK(n,r),eJ(t,r,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},e5=/\(error: (.*)\)/;class e6{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=A(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 q(e,"DOMException")}isDOMError(e){return q(e,"DOMError")}}class e8{match(e){return e instanceof Error}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 String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}}class e4{constructor(){}match(e){return q(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}var e7=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class e9{match(e){return"string"==typeof e}coerce(e,t){var i,[s,r]=this.getInfos(e);return{type:null!=s?s:"Error",value:null!=r?r:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(e7);return s&&(t=s[1],i=s[2]),[t,i]}}var te=["fatal","error","warning","log","info","debug"];function tt(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var s=i.length;s>0;s--){var r=i.slice(0,s).join(", ");if(t>=r.length)return s===i.length?r:r.length>t?r.slice(0,t)+"...":r}return""}class ti{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return z(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+tt(e)}isSeverityLevel(e){return A(e)&&!N(e)&&te.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(({}).hasOwnProperty.call(e,t)){var i=e[t];if(eG(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class ts{match(e){return z(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+tt(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class tr{match(e){return W(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class tn{match(e){return q(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!z(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return W(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var ta=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,r={$(t){if(s&&(v.DEBUG||p.POSTHOG_DEBUG||i)&&!M(s.console)&&s.console){for(var r=("__rrweb_original__"in s.console[t])?s.console[t].__rrweb_original__:s.console[t],n=arguments.length,a=Array(n>1?n-1:0),o=1;n>o;o++)a[o-1]=arguments[o];r(e,...a)}},info(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.$("log",...t)},warn(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.$("warn",...t)},error(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];r.$("error",...t)},critical(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){r.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>ta(e+" "+t,i)};return r},to=ta("[PostHog.js]"),tl=to.createLogger,tu=tl("[ExternalScriptsLoader]"),tc=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return tu.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==a?void 0:a.querySelectorAll("script");
1if(s){for(var r,n=0;s.length>n;n++)if(r=function(){if(s[n].src===t){var e=s[n];return e.__posthog_loading_callback_fired?{v:i()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,i(void 0,t)}),e.onerror=e=>i(e),{v:void 0})}}())return r.v}var o=()=>{if(!a)return i("document not found");var s=a.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)},s.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)a.head.appendChild(s);else{var r,n=a.querySelectorAll("body > script");n.length>0?null==(r=n[0].parentNode)||r.insertBefore(s,n[0]):a.body.appendChild(s)}};null!=a&&a.body?o():null==a||a.addEventListener("DOMContentLoaded",o)};p.__PosthogExtensions__=p.__PosthogExtensions__||{},p.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{var s="/static/"+t+".js?v="+e.version;"remote-config"===t&&(s="/array/"+e.config.token+"/config.js"),"toolbar"===t&&(s=s+"&t="+3e5*Math.floor(Date.now()/3e5));var r=e.requestRouter.endpointFor("assets",s);tc(e,r,i)},p.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var s=e.requestRouter.endpointFor("api",t);tc(e,s,i)};var th="$people_distinct_id",td="$device_id",tp="__alias",tg="__timers",tv="$autocapture_disabled_server_side",t_="$heatmaps_enabled_server_side",tf="$exception_capture_enabled_server_side",tm="$error_tracking_suppression_rules",ty="$error_tracking_capture_extension_exceptions",tb="$web_vitals_enabled_server_side",tw="$dead_clicks_enabled_server_side",tx="$product_tours_enabled_server_side",tE="$web_vitals_allowed_metrics",tk="$session_recording_remote_config",tS="$sesid",tP="$session_is_sampled",tF="$enabled_feature_flags",tI="$early_access_features",t$="$feature_flag_details",tC="$stored_person_properties",tO="$stored_group_properties",tT="$surveys",tR="$flag_call_reported",tM="$flag_call_reported_session_id",tA="$feature_flag_errors",tN="$feature_flag_evaluated_at",tL="$user_state",tD="$client_session_props",tj="$capture_rate_limit",tU="$initial_campaign_params",tH="$initial_referrer_info",tW="$initial_person_info",tq="$epp",tz="__POSTHOG_TOOLBAR__",tB="$posthog_cookieless",tV=[th,tp,"__cmpns",tg,"$session_recording_enabled_server_side",t_,tS,tF,tm,tL,tI,t$,tO,tC,tT,tR,tM,tA,tN,tD,tj,tU,tH,tq,tW],tG="PostHog loadExternalDependency extension not found.",tY="on_reject",tJ="always",tK="anonymous",tX="identified",tZ="identified_only",tQ="visibilitychange",t0="beforeunload",t1="$pageview",t2="$pageleave",t3="$identify",t5="$groupidentify";function t6(e,t){C(e)&&e.forEach(t)}function t8(e,t){if(!L(e))if(C(e))e.forEach(t);else if(e instanceof FormData)e.forEach((e,i)=>t(e,i));else for(var i in e)I.call(e,i)&&t(e[i],i)}var t4=function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e};function t7(e){for(var t=Object.keys(e),i=t.length,s=Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var t9=function(e){try{return e()}catch(e){return}},ie=function(e){return function(){try{for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){to.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),to.critical(e)}}},it=function(e){var t={};return t8(e,function(e,i){(A(e)&&e.length>0||D(e))&&(t[i]=e)}),t},ii=["herokuapp.com","vercel.app","netlify.app"];function is(e,t,i,s){var{capture:r=!1,passive:n=!0}=null!=s?s:{};null==e||e.addEventListener(t,i,{capture:r,passive:n})}function ir(e){return"ph_toolbar_internal"===e.name}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return D(e)&&isFinite(e)&&Math.floor(e)===e});class ia{constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>0x3fffffff||s>0xffffffff)throw RangeError("invalid field value");
1var r=new Uint8Array(16);return r[0]=e/0x10000000000,r[1]=e/0x100000000,r[2]=e/0x1000000,r[3]=e/65536,r[4]=e/256,r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new ia(r)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}clone(){return new ia(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class io{constructor(){this.k=0,this.R=0,this.P=new ic}generate(){var e=this.generateOrAbort();if(M(e)){this.k=0;var t=this.generateOrAbort();if(M(t))throw Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.k)this.k=e,this.O();else{if(this.k>=e+1e4)return;this.R++,this.R>0x3ffffffffff&&(this.k++,this.O())}return ia.fromFieldsV7(this.k,Math.trunc(this.R/0x40000000),0x3fffffff&this.R,this.P.nextUint32())}O(){this.R=1024*this.P.nextUint32()+(1023&this.P.nextUint32())}}var il,iu=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};s&&!M(s.crypto)&&crypto.getRandomValues&&(iu=e=>crypto.getRandomValues(e));class ic{constructor(){this.I=new Uint32Array(8),this.C=1/0}nextUint32(){return this.I.length>this.C||(iu(this.I),this.C=0),this.I[this.C++]}}var ih=()=>id().toString(),id=()=>(il||(il=new io)).generate(),ip="",ig=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,iv={F:()=>!!a,A(e){to.error("cookieStore error: "+e)},M(e){if(a){try{for(var t=e+"=",i=a.cookie.split(";").filter(e=>e.length),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}},D(e){var t;try{t=JSON.parse(iv.M(e))||{}}catch(e){}return t},L(e,t,i,s,r){if(a)try{var n="",o="",l=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=a),ip)return ip;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+ih();!ip&&s--;){var n=i.slice(s).join("."),o=r+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(r)&&(t.cookie=o+";max-age=0",ip=n)}return ip}(e);if(!i){var s,r=(s=e.match(ig))?s[0]:"";r!==i&&to.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(a.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),n="; expires="+u.toUTCString()}r&&(o="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+l+o;return c.length>3686.4&&to.warn("cookieStore warning: large cookie, len="+c.length),a.cookie=c,c}catch(e){return}},U(e,t){if(null!=a&&a.cookie)try{iv.L(e,"",-1,t)}catch(e){return}}},i_=null,im={F(){if(null!==i_)return i_;var e=!0;if(M(s))e=!1;else try{var t="__mplssupport__";im.L(t,"xyz"),'"xyz"'!==im.M(t)&&(e=!1),im.U(t)}catch(t){e=!1}return e||to.error("localStorage unsupported; falling back to cookie store"),i_=e,e},A(e){to.error("localStorage error: "+e)},M(e){try{return null==s?void 0:s.localStorage.getItem(e)}catch(e){im.A(e)}return null},D(e){try{return JSON.parse(im.M(e))||{}}catch(e){}return null},L(e,t){try{null==s||s.localStorage.setItem(e,JSON.stringify(t))}catch(e){im.A(e)}},U(e){try{null==s||s.localStorage.removeItem(e)}catch(e){im.A(e)}}},iy=[td,"distinct_id",tS,tP,tq,tW,tL],ib={},iw={F:()=>!0,A(e){to.error("memoryStorage error: "+e)},M:e=>ib[e]||null,D:e=>ib[e]||null,L(e,t){ib[e]=t},U(e){delete ib[e]}},ix=null,iE={F(){if(null!==ix)return ix;if(ix=!0,M(s))ix=!1;else try{var e="__support__";iE.L(e,"xyz"),'"xyz"'!==iE.M(e)&&(ix=!1),iE.U(e)}catch(e){ix=!1}return ix},A(e){to.error("sessionStorage error: ",e)},M(e){try{return null==s?void 0:s.sessionStorage.getItem(e)}catch(e){iE.A(e)}return null},D(e){try{return JSON.parse(iE.M(e))||null}catch(e){}return null},L(e,t){try{null==s||s.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){iE.A(e)}},U(e){try{null==s||s.sessionStorage.removeItem(e)}catch(e){iE.A(e)}}};class ik{constructor(e){this._instance=e}get N(){return this._instance.config}get consent(){return this.j()?0:this.B}isOptedOut(){return this.N.cookieless_mode===tJ||0===this.consent||-1===this.consent&&(this.N.opt_out_capturing_by_default||this.N.cookieless_mode===tY)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}optInOut(e){this.H.L(this.q,+!!e,this.N.cookie_expiration,this.N.cross_subdomain_cookie,this.N.secure_cookie)}reset(){this.H.U(this.q,this.N.cross_subdomain_cookie)}get q(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;
1return i||(t?t+e:"__ph_opt_in_out_"+e)}get B(){var e=this.H.M(this.q);return V(e)?1:k(G,e)?0:-1}get H(){if(!this.W){var e=this.N.opt_out_capturing_persistence_type;this.W="localStorage"===e?im:iv;var t="localStorage"===e?iv:im;t.M(this.q)&&(this.W.M(this.q)||this.optInOut(V(t.M(this.q))),t.U(this.q,this.N.cross_subdomain_cookie))}return this.W}j(){return!!this.N.respect_dnt&&[null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,p.doNotTrack].some(e=>V(e))}}var iS=tl("[Dead Clicks]"),iP=()=>!0,iF=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(tw)),s=e.instance.config.capture_dead_clicks;return U(s)?s:!!T(s)||i};class iI{get lazyLoadedDeadClicksAutocapture(){return this.V}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[tw]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Y(()=>{this.G()}):this.stop()}Y(e){var t,i;null!=(t=p.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?iS.error("failed to load script",t):e()})}G(){var e;if(a){if(!this.V&&null!=(e=p.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=T(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.V=p.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.V.start(a),iS.info("starting...")}}else iS.error("`document` not found. Cannot start.")}stop(){this.V&&(this.V.stop(),this.V=void 0,iS.info("stopping..."))}}var i$=tl("[SegmentIntegration]"),iC="posthog-js";function iO(e,t){var{organization:i,projectId:s,prefix:r,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{if("*"!==n&&!n.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var o=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=o,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var l,u,c,h,d,p,g=(null==(l=t.exception)?void 0:l.values)||[],v=g.map(e=>m({},e,{stacktrace:e.stacktrace?m({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>m({},e,{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null==(u=g[0])?void 0:u.value)||t.message,$exception_type:null==(c=g[0])?void 0:c.type,$exception_level:t.level,$exception_list:v,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(h=g[0])?void 0:h.value)||t.message,$sentry_exception_type:null==(d=g[0])?void 0:d.type,$sentry_tags:t.tags};return i&&s&&(_.$sentry_url=(r||"https://sentry.io/organizations/")+i+"/issues/?project="+s+"&query="+t.event_id),a&&(null==(p=e.exceptions)||p.sendExceptionEvent(_)),t}}class iT{constructor(e,t,i,s,r,n){this.name=iC,this.setupOnce=function(a){a(iO(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class iR{constructor(e){this.J=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(to.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.K=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.X()}X(){var e;this.Z=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.J)}destroy(){var e;null==(e=this.Z)||e.call(this),this.Z=void 0}doPageView(e,t){var i,r=this.tt(e,t);return this.K={pathname:null!=(i=null==s?void 0:s.location.pathname)?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.tt(e,null==(t=this.K)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.K)?void 0:e.pageViewId}}tt(e,t){var i=this.K;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:a,maxScrollY:o,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(M(n)||M(a)||M(o)||M(l)||M(u)||M(c))){n=Math.ceil(n),a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var h=n>1?Y(a/n,0,1,to):1,d=n>1?Y(o/n,0,1,to):1,p=l>1?Y(u/l,0,1,to):1,g=l>1?Y(c/l,0,1,to):1;s=t4(s,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:o,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:g})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var iM=e=>{var t=null==a?void 0:a.createElement("a");return M(t)?null:(t.href=e,t)},iA=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!C(i)||2>i.length)return"";var a=i[1];try{a=decodeURIComponent(a)}catch(e){to.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},iN=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");C(h)&&(t.includes(h[0])?u.push(h[0]+"="+i):u.push(l[c]))}var d=o;return null!=a&&(d+="?"+u.join("&")),null!=r&&(d+="#"+r),d},iL=function(e,t){var i=e.match(RegExp(t+"=([^&]*)"));return i?i[1]:null},iD="https?://(.*)",ij=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],iU=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ij],iH="<masked>",iW=["li_fat_id"];function iq(e,t,i){if(!a)return{};var s,r=t?[...ij,...i||[]]:[],n=iz(iN(a.URL,r,iH),e);return t4((s={},t8(iW,function(e){var t=iv.M(e);s[e]=t||null}),s),n)}function iz(e,t){var i=iU.concat(t||[]),s={};return t8(i,function(t){var i=iA(e,t);
1s[t]=i||null}),s}function iB(e){var t=e?0===e.search(iD+"google.([^/?]*)")?"google":0===e.search(iD+"bing.com")?"bing":0===e.search(iD+"yahoo.com")?"yahoo":0===e.search(iD+"duckduckgo.com")?"duckduckgo":null:null,i={};if(null!==t){i.$search_engine=t;var s=a?iA(a.referrer,"yahoo"!=t?"q":"p"):"";s.length&&(i.ph_keyword=s)}return i}function iV(){return navigator.language||navigator.userLanguage}var iG="$direct";function iY(){return(null==a?void 0:a.referrer)||iG}function iJ(e,t){var i=e?[...ij,...t||[]]:[],s=null==o?void 0:o.href.substring(0,1e3);return{r:iY().substring(0,1e3),u:s?iN(s,i,iH):void 0}}function iK(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==iG?iG:null==(t=iM(i))?void 0:t.host};if(s){r.$current_url=s;var n=iM(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname,t4(r,iz(s))}return i&&t4(r,iB(i)),r}function iX(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var iZ=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class iQ{constructor(e,t){this.N=e,this.props={},this.it=!1,this.et=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.H=this.rt(e),this.load(),e.debug&&to.info("Persistence loaded",e.persistence,m({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.st}rt(e){-1===iZ.indexOf(e.persistence.toLowerCase())&&(to.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,i,r=(void 0===(t=e.cookie_persisted_properties||[])&&(t=[]),i=[...iy,...t],m({},im,{D(e){try{var t={};try{t=iv.D(e)||{}}catch(e){}var i=t4(t,JSON.parse(im.M(e)||"{}"));return im.L(e,i),i}catch(e){}return null},L(e,t,s,r,n,a){try{im.L(e,t,void 0,void 0,a);var o={};i.forEach(e=>{t[e]&&(o[e]=t[e])}),Object.keys(o).length&&iv.L(e,o,s,r,n,a)}catch(e){im.A(e)}},U(e,t){try{null==s||s.localStorage.removeItem(e),iv.U(e,t)}catch(e){im.A(e)}}})),n=e.persistence.toLowerCase();return"localstorage"===n&&im.F()?im:"localstorage+cookie"===n&&r.F()?r:"sessionstorage"===n&&iE.F()?iE:"memory"===n?iw:"cookie"===n?iv:r.F()?r:iv}nt(e){var t=null!=e?e:this.N.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[tN];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return t8(this.props,(t,i)=>{if(i===tF&&T(t)){if(!this.nt())for(var s=Object.keys(t),r=0;s.length>r;r++)e["$feature/"+s[r]]=t[s[r]]}else -1===tV.indexOf(i)&&(e[i]=t)}),e}load(){if(!this.st){var e=this.H.D(this.et);e&&(this.props=t4({},e))}}save(){this.st||this.H.L(this.et,this.props,this.ot,this.ut,this.ht,this.N.debug)}remove(){this.H.U(this.et,!1),this.H.U(this.et,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(T(e)){M(t)&&(t="None"),this.ot=M(i)?this.dt:i;var s=!1;if(t8(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(T(e)){this.ot=M(t)?this.dt:t;var i=!1;if(t8(e,(t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this.props[s]=t,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.it){var e=iq(this.N.custom_campaign_params,this.N.mask_personal_data_properties,this.N.custom_personal_data_properties);R(it(e))||this.register(e),this.it=!0}}update_search_keyword(){var e;this.register((e=null==a?void 0:a.referrer)?iB(e):{})}update_referrer_info(){var e;this.register_once({$referrer:iY(),$referring_domain:null!=a&&a.referrer&&(null==(e=iM(a.referrer))?void 0:e.host)||iG},void 0)}set_initial_person_info(){this.props[tU]||this.props[tH]||this.register_once({[tW]:iJ(this.N.mask_personal_data_properties,this.N.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};t8([tH,tU],t=>{var i=this.props[t];i&&t8(i,function(t,i){e["$initial_"+P(i)]=t})});var t,i,s=this.props[tW];return s&&t4(e,(t=iK(s),i={},t8(t,function(e,t){i["$initial_"+P(t)]=e}),i)),e}safe_merge(e){return t8(this.props,function(t,i){i in e||(e[i]=t)}),e}
1update_config(e,t,i){if(this.dt=this.ot=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||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var s=this.rt(e),r=this.props;this.clear(),this.H=s,this.props=r,this.save()}}set_disabled(e){this.st=e,this.st?this.remove():this.save()}set_cross_subdomain(e){e!==this.ut&&(this.ut=e,this.remove(),this.save())}set_secure(e){e!==this.ht&&(this.ht=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[tg]||{};i[e]=t,this.props[tg]=i,this.save()}remove_event_timer(e){var t=(this.props[tg]||{})[e];return M(t)||(delete this.props[tg][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var i0={Activation:"events",Cancellation:"cancelEvents"},i1={Popover:"popover",API:"api",Widget:"widget"},i2={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},i3={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},i5={Popover:"popover",Inline:"inline"},i6={SHOWN:"product tour shown"},i8={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},i4=tl("[RateLimiter]");class i7{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{i4.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void i4.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){void 0===e&&(e=!1);var t,i,s,{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,a=(new Date).getTime(),o=null!=(t=null==(i=this.instance.persistence)?void 0:i.get_property(tj))?t:{tokens:r,last:a};o.tokens+=(a-o.last)/1e3*n,o.last=a,o.tokens>r&&(o.tokens=r);var l=1>o.tokens;return l||e||(o.tokens=Math.max(0,o.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(tj,o),{isRateLimited:l,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var i9=tl("[RemoteConfig]");class se{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=p._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}vt(e){var t,i;null!=(t=p.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}ct(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 i9.info("Using preloaded remote config",this.remoteConfig),this.ft(this.remoteConfig),void this._t();if(this._instance.bt())return void i9.warn("Remote config is disabled. Falling back to local config.");this.vt(e=>{if(!e)return i9.info("No config found after loading remote JS config. Falling back to JSON."),void this.ct(e=>{this.ft(e),this._t()});this.ft(e),this._t()})}catch(e){i9.error("Error loading remote config",e)}}stop(){this.yt&&(clearInterval(this.yt),this.yt=void 0)}refresh(){this._instance.bt()||"hidden"===(null==a?void 0:a.visibilityState)||this._instance.reloadFeatureFlags()}_t(){var e;if(!this.yt){var t=null!=(e=this._instance.config.remote_config_refresh_interval_ms)?e:3e5;0!==t&&(this.yt=setInterval(()=>{this.refresh()},t))}}ft(e){var t;e||i9.error("Failed to fetch remote config from PostHog."),this._instance.ft(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var st={GZipJS:"gzip-js",Base64:"base64"},si=Uint8Array,ss=Uint16Array,sr=Uint32Array,sn=new si([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]),sa=new si([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]),so=new si([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sl=function(e,t){for(var i=new ss(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new sr(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},su=sl(sn,2),sc=su[1];su[0][28]=258,sc[258]=28;for(var sh=sl(sa,0)[1],sd=new ss(32768),sp=0;32768>sp;++sp){var sg=(43690&sp)>>>1|(21845&sp)<<1;sd[sp]=((65280&(sg=(61680&(sg=(52428&sg)>>>2|(13107&sg)<<2))>>>4|(3855&sg)<<4))>>>8|(255&sg)<<8)>>>1}var sv=function(e,t,i){for(var s=e.length,r=0,n=new ss(t);s>r;++r)++n[e[r]-1];var a,o=new ss(t);for(r=0;t>r;++r)o[r]=o[r-1]+n[r-1]<<1;if(i){a=new ss(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],c=t-e[r],h=o[e[r]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)a[sd[h]>>>l]=u}else for(a=new ss(s),r=0;s>r;++r)a[r]=sd[o[e[r]-1]++]>>>15-e[r];return a},s_=new si(288);for(sp=0;144>sp;++sp)s_[sp]=8;for(sp=144;256>sp;++sp)s_[sp]=9;for(sp=256;280>sp;++sp)s_[sp]=7;for(sp=280;288>sp;
1++sp)s_[sp]=8;var sf=new si(32);for(sp=0;32>sp;++sp)sf[sp]=5;var sm=sv(s_,9,0),sy=sv(sf,5,0),sb=function(e){return(e/8|0)+(7&e&&1)},sw=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof ss?ss:e instanceof sr?sr:si)(i-t);return s.set(e.subarray(t,i)),s},sx=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},sE=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},sk=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new si(0),0];if(1==r){var a=new si(i[0].s+1);return a[i[0].s]=1,[a,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var o=i[0],l=i[1],u=0,c=1,h=2;for(i[0]={s:-1,f:o.f+l.f,l:o,r:l};c!=r-1;)o=i[i[h].f>i[u].f?u++:h++],l=i[u!=c&&i[h].f>i[u].f?u++:h++],i[c++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var p=new ss(d+1),g=sS(i[c-1],p,0);if(g>t){s=0;var v=0,_=g-t,f=1<<_;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=p[m])break;v+=f-(1<<g-p[m]),p[m]=t}for(v>>>=_;v>0;){var y=n[s].s;t>p[y]?v-=1<<t-p[y]++-1:++s}for(;s>=0&&v;--s){var b=n[s].s;p[b]==t&&(--p[b],++v)}g=t}return[new si(p),g]},sS=function(e,t,i){return -1==e.s?Math.max(sS(e.l,t,i+1),sS(e.r,t,i+1)):t[e.s]=i},sP=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new ss(++t),s=0,r=e[0],n=1,a=function(e){i[s++]=e},o=1;t>=o;++o)if(e[o]==r&&o!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(r),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(r);n=1,r=e[o]}return[i.subarray(0,s),t]},sF=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},sI=function(e,t,i){var s=i.length,r=sb(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},s$=function(e,t,i,s,r,n,a,o,l,u,c){sx(t,c++,i),++r[256];for(var h=sk(r,15),d=h[0],p=h[1],g=sk(n,15),v=g[0],_=g[1],f=sP(d),m=f[0],y=f[1],b=sP(v),w=b[0],x=b[1],E=new ss(19),k=0;m.length>k;++k)E[31&m[k]]++;for(k=0;w.length>k;++k)E[31&w[k]]++;for(var S=sk(E,7),P=S[0],F=S[1],I=19;I>4&&!P[so[I-1]];--I);var $,C,O,T,R=u+5<<3,M=sF(r,s_)+sF(n,sf)+a,A=sF(r,d)+sF(n,v)+a+14+3*I+sF(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(M>=R&&A>=R)return sI(t,c,e.subarray(l,l+u));if(sx(t,c,1+(M>A)),c+=2,M>A){$=sv(d,p,0),C=d,O=sv(v,_,0),T=v;var N=sv(P,F,0);for(sx(t,c,y-257),sx(t,c+5,x-1),sx(t,c+10,I-4),c+=14,k=0;I>k;++k)sx(t,c+3*k,P[so[k]]);c+=3*I;for(var L=[m,w],D=0;2>D;++D){var j=L[D];for(k=0;j.length>k;++k)sx(t,c,N[U=31&j[k]]),c+=P[U],U>15&&(sx(t,c,j[k]>>>5&127),c+=j[k]>>>12)}}else $=sm,C=s_,O=sy,T=sf;for(k=0;o>k;++k)if(s[k]>255){sE(t,c,$[257+(U=s[k]>>>18&31)]),c+=C[U+257],U>7&&(sx(t,c,s[k]>>>23&31),c+=sn[U]);var U,H=31&s[k];sE(t,c,O[H]),c+=T[H],H>3&&(sE(t,c,s[k]>>>5&8191),c+=sa[H])}else sE(t,c,$[s[k]]),c+=C[s[k]];return sE(t,c,$[256]),c+C[256]},sC=new sr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),sO=function(){for(var e=new sr(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&0xedb88320)^i>>>1;e[t]=i}return e}(),sT=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},sR=!!u||!!l,sM="text/plain",sA=function(e,t,i){void 0===i&&(i=!0);var s,r,n,a,o,[l,u]=e.split("?"),c=m({},t),h=null!=(o=null==u?void 0:u.split("&").map(e=>{var t,[s,r]=e.split("="),n=i&&null!=(t=c[s])?t:r;return delete c[s],s+"="+n}))?o:[],d=(void 0===s&&(s="&"),a=[],t8(c,function(e,t){M(e)||M(t)||"undefined"===t||(r=encodeURIComponent(e instanceof File?e.name:e.toString()),n=encodeURIComponent(t),a[a.length]=n+"="+r)}),a.join(s));return d&&h.push(d),l+"?"+h.join("&")},sN=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),sL=e=>{if(e.wt)return e.wt;var{data:t,compression:i}=e;if(t){if(i===st.GZipJS){var s=function(e,t){void 0===t&&(t={});var i=(r=0xffffffff,{p(e){for(var t=r,i=0;e.length>i;++i)t=sO[255&t^e[i]]^t>>>8;r=t},d:()=>0xffffffff^r}),s=e.length;i.p(e);var r,n,a,o,l=(o=10+((n=t).filename&&n.filename.length+1||0),function(e,t,i,s,r,n){var a=e.length,o=new si(s+a+5*(1+Math.floor(a/7e3))+8),l=o.subarray(s,o.length-8),u=0;if(!t||8>a)for(var c=0;a>=c;c+=65535){var h=c+65535;a>h?u=sI(l,u,e.subarray(c,h)):(l[c]=!0,u=sI(l,u,e.subarray(c,a)))}else{for(var d=sC[t-1],p=d>>>13,g=8191&d,v=(1<<i)-1,_=new ss(32768),f=new ss(v+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&v},w=new sr(25e3),x=new ss(288),E=new ss(32),k=0,S=0,P=(c=0,0),F=0,I=0;a>c;++c){var $=b(c),C=32767&c,O=f[$];if(_[C]=O,f[$]=C,c>=F){var T=a-c;if((k>7e3||P>24576)&&T>423){u=s$(e,l,0,w,x,E,S,P,I,c-I,u),P=k=S=0,I=c;for(var R=0;286>R;++R)x[R]=0;for(R=0;30>R;++R)E[R]=0}var M=2,A=0,N=g,L=C-O&32767;if(T>2&&$==b(c-L))for(var D=Math.min(p,T)-1,j=Math.min(32767,c),U=Math.min(258,T);j>=L&&--N&&C!=O;){if(e[c+M]==e[c+M-L]){for(var H=0;U>H&&e[c+H]==e[c+H-L];++H);if(H>M){if(M=H,A=L,H>D)break;var W=Math.min(L,H-2),q=0;for(R=0;W>R;++R){var z=c-L+R+32768&32767,B=z-_[z]+32768&32767;B>q&&(q=B,O=z)}}}L+=(C=O)-(O=_[C])+32768&32767}if(A){w[P++]=0x10000000|sc[M]<<18|sh[A];var V=31&sc[M],G=31&sh[A];S+=sn[V]+sa[G],++x[257+V],++E[G],F=c+M,++k}else w[P++]=e[c],++x[e[c]]}}u=s$(e,l,!0,w,x,E,S,P,I,c-I,u)}return sw(o,0,s+sb(u)+r)}(e,null==(a=t).level?6:a.level,null==a.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+a.mem,o,8)),u=l.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:2*(9==t.level),e[9]=3,0!=t.mtime&&sT(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(l,t),sT(l,u-8,i.d()),sT(l,u-4,s),l}(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new si(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},a=0;i>a;++a){if(r+5>s.length){var o=new si(r+8+(i-a<<1));o.set(s),s=o}var l=e.charCodeAt(a);128>l?n(l):(2048>l?n(192|l>>>6):(l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++a))>>>18),n(128|l>>>12&63)):n(224|l>>>12),n(128|l>>>6&63)),n(128|63&l))}return sw(s,0,r)}(sN(t)),{mtime:0});return{contentType:sM,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===st.Base64){var r=(e=>"data="+encodeURIComponent("string"==typeof e?e:sN(e)))(function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,(e,t)=>
1String.fromCharCode(parseInt(t,16)))):e}(sN(t)));return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}var n=sN(t);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},sD=function(){var e=f(function*(e){var t=sN(e.data),i=yield function(e,t){return b.apply(this,arguments)}(t,v.DEBUG);if(!i)return e;var s=yield i.arrayBuffer();return m({},e,{wt:{contentType:sM,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}}(),sj=[];l&&sj.push({transport:"fetch",method(e){var t,i,{contentType:s,body:r,estimatedSize:n}=null!=(t=sL(e))?t:{},a=new Headers;t8(e.headers,function(e,t){a.append(t,e)}),s&&a.append("Content-Type",s);var o=e.url,u=null;if(c){var h=new c;u={signal:h.signal,timeout:setTimeout(()=>h.abort(),e.timeout)}}l(o,m({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&52428.8>(n||0),body:r,signal:null==(i=u)?void 0:i.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){to.error(e)}null==e.callback||e.callback(s)})).catch(t=>{to.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(()=>u?clearTimeout(u.timeout):null)}}),u&&sj.push({transport:"XHR",method(e){var t,i=new u;i.open(e.method||"GET",e.url,!0);var{contentType:s,body:r}=null!=(t=sL(e))?t:{};t8(e.headers,function(e,t){i.setRequestHeader(t,e)}),s&&i.setRequestHeader("Content-Type",s),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(r)}}),null!=n&&n.sendBeacon&&sj.push({transport:"sendBeacon",method(e){var t=sA(e.url,{beacon:"1"});try{var i,{contentType:s,body:r}=null!=(i=sL(e))?i:{},a="string"==typeof r?new Blob([r],{type:s}):r;n.sendBeacon(t,a)}catch(e){}}});class sU{constructor(e,t){this.Et=!0,this.St=[],this.xt=Y((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,to.createLogger("flush interval"),3e3),this.Tt=e}enqueue(e){this.St.push(e),this.$t||this.kt()}unload(){this.Rt();var e=Object.values(this.St.length>0?this.Pt():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.Tt(m({},e,{transport:"sendBeacon"}))})}enable(){this.Et=!1,this.kt()}kt(){var e=this;this.Et||(this.$t=setTimeout(()=>{if(this.Rt(),this.St.length>0){var t=this.Pt();for(var i in t)!function(){var s=t[i],r=(new Date).getTime();s.data&&C(s.data)&&t8(s.data,e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp}),e.Tt(s)}()}},this.xt))}Rt(){clearTimeout(this.$t),this.$t=void 0}Pt(){var e={};return t8(this.St,t=>{var i,s=(t?t.batchKey:null)||t.url;M(e[s])&&(e[s]=m({},t,{data:[]})),null==(i=e[s].data)||i.push(t.data)}),this.St=[],e}}var sH=["retriesPerformedSoFar"];class sW{constructor(e){this.Ot=!1,this.It=3e3,this.St=[],this._instance=e,this.St=[],this.Ct=!0,!M(s)&&"onLine"in s.navigator&&(this.Ct=s.navigator.onLine,this.Ft=()=>{this.Ct=!0,this.At()},this.Mt=()=>{this.Ct=!1},is(s,"online",this.Ft),is(s,"offline",this.Mt))}get length(){return this.St.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=y(e,sH);j(t)&&(i.url=sA(i.url,{retry_count:t})),this._instance._send_request(m({},i,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==i.callback||i.callback(e):this.Dt(m({retriesPerformedSoFar:t},i))}}))}Dt(e){var t,i,s=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=s+1;var r=Math.ceil((i=Math.min(18e5,t=3e3*Math.pow(2,s)))+(Math.random()-.5)*(i-t/2)),n=Date.now()+r;this.St.push({retryAt:n,requestOptions:e});var a="Enqueued failed request for retry in "+r;navigator.onLine||(a+=" (Browser is offline)"),to.warn(a),this.Ot||(this.Ot=!0,this.Lt())}Lt(){if(this.Ut&&clearTimeout(this.Ut),0===this.St.length)return this.Ot=!1,void(this.Ut=void 0);this.Ut=setTimeout(()=>{this.Ct&&this.St.length>0&&this.At(),this.Lt()},this.It)}At(){var e=Date.now(),t=[],i=this.St.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.St=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Ut&&(clearTimeout(this.Ut),this.Ut=void 0),this.Ot=!1,M(s)||(this.Ft&&(s.removeEventListener("online",this.Ft),this.Ft=void 0),this.Mt&&(s.removeEventListener("offline",this.Mt),this.Mt=void 0)),this.St))try{this._instance._send_request(m({},e,{transport:"sendBeacon"}))}catch(e){to.error(e)}this.St=[]}}class sq{constructor(e){this.Nt=()=>{this.jt||(this.jt={});var e,t,i,s,r=this.scrollElement(),n=this.scrollY(),a=r?Math.max(0,r.scrollHeight-r.clientHeight):0,o=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this.jt.lastScrollY=Math.ceil(n),this.jt.maxScrollY=Math.max(n,null!=(e=this.jt.maxScrollY)?e:0),this.jt.maxScrollHeight=Math.max(a,null!=(t=this.jt.maxScrollHeight)?t:0),this.jt.lastContentY=o,this.jt.maxContentY=Math.max(o,null!=(i=this.jt.maxContentY)?i:0),this.jt.maxContentHeight=Math.max(l,null!=(s=this.jt.maxContentHeight)?s:0)},this._instance=e}get zt(){return this._instance.config.scroll_root_selector}getContext(){return this.jt}resetContext(){var e=this.jt;return setTimeout(this.Nt,0),e}startMeasuringScrollPosition(){is(s,"scroll",this.Nt,{capture:!0}),is(s,"scrollend",this.Nt,{capture:!0}),is(s,"resize",this.Nt)}scrollElement(){if(!this.zt)return null==s?void 0:s.document.documentElement;for(var e of C(this.zt)?this.zt:[this.zt]){var t=null==s?void 0:s.document.querySelector(e);
1if(t)return t}}scrollY(){if(this.zt){var e=this.scrollElement();return e&&e.scrollTop||0}return s&&(s.scrollY||s.pageYOffset||s.document.documentElement.scrollTop)||0}scrollX(){if(this.zt){var e=this.scrollElement();return e&&e.scrollLeft||0}return s&&(s.scrollX||s.pageXOffset||s.document.documentElement.scrollLeft)||0}}var sz=e=>iJ(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class sB{constructor(e,t,i,s){this.Bt=e=>{var t=this.Ht();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.qt(this._instance)};this.Wt.register({[tD]:i})}},this._instance=e,this.Vt=t,this.Wt=i,this.qt=s||sz,this.Vt.onSessionId(this.Bt)}Ht(){return this.Wt.props[tD]}getSetOnceProps(){var e,t=null==(e=this.Ht())?void 0:e.props;return t?"r"in t?iK(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 t8(it(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+P(i)]=t}),e}}class sV{constructor(){this.Yt={}}on(e,t){return this.Yt[e]||(this.Yt[e]=[]),this.Yt[e].push(t),()=>{this.Yt[e]=this.Yt[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.Yt[e]||[])i(t);for(var s of this.Yt["*"]||[])s(e,t)}}var sG=tl("[SessionId]");class sY{on(e,t){return this.Gt.on(e,t)}constructor(e,t,i){if(this.Jt=[],this.Kt=void 0,this.Gt=new sV,this.Xt=(e,t)=>!(!j(e)||!j(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===tJ)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.N=e.config,this.Wt=e.persistence,this.Qt=void 0,this.Zt=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ti=t||ih,this.ii=i||ih;var s,r=this.N.persistence_name||this.N.token;if(this._sessionTimeoutMs=1e3*Y(this.N.session_idle_timeout_seconds||1800,60,36e3,sG.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ei(),this.ri="ph_"+r+"_window_id",this.si="ph_"+r+"_primary_window_exists",this.ni()){var n=iE.D(this.ri),a=iE.D(this.si);n&&!a?this.Qt=n:iE.U(this.ri),iE.L(this.si,!0)}if(null!=(s=this.N.bootstrap)&&s.sessionID)try{var o=(e=>{var t=this.N.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this.oi(this.N.bootstrap.sessionID,(new Date).getTime(),o)}catch(e){sG.error("Invalid sessionID in bootstrap",e)}this.ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return M(this.Jt)&&(this.Jt=[]),this.Jt.push(e),this.Zt&&e(this.Zt,this.Qt),()=>{this.Jt=this.Jt.filter(t=>t!==e)}}ni(){return"memory"!==this.N.persistence&&!this.Wt.st&&iE.F()}li(e){e!==this.Qt&&(this.Qt=e,this.ni()&&iE.L(this.ri,e))}ui(){return this.Qt?this.Qt:this.ni()?iE.D(this.ri):null}oi(e,t,i){e===this.Zt&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Zt=e,this.Wt.register({[tS]:[t,e,i]}))}hi(){var e=this.Wt.props[tS];return C(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.oi(null,null,null)}destroy(){clearTimeout(this.di),this.di=void 0,this.Kt&&s&&(s.removeEventListener(t0,this.Kt,{capture:!1}),this.Kt=void 0),this.Jt=[]}ai(){this.Kt=()=>{this.ni()&&iE.U(this.si)},is(s,t0,this.Kt,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.N.cookieless_mode===tJ)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[s,r,n]=this.hi(),a=this.ui(),o=j(n)&&Math.abs(i-n)>864e5,l=!1,u=!r,c=!u&&!e&&this.Xt(i,s);u||c||o?(r=this.ti(),a=this.ii(),sG.info("new session ID generated",{sessionId:r,windowId:a,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:o}}),n=i,l=!0):a||(a=this.ii(),l=!0);var h=j(s)&&e&&!o?s:i,d=j(n)?n:(new Date).getTime();return this.li(a),this.oi(r,h,d),e||this.ei(),l&&this.Jt.forEach(e
1=>e(r,a,l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:o}:void 0)),{sessionId:r,windowId:a,sessionStartTimestamp:d,changeReason:l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:o}:void 0,lastActivityTimestamp:s}}ei(){clearTimeout(this.di),this.di=setTimeout(()=>{var[e]=this.hi();if(this.Xt((new Date).getTime(),e)){var t=this.Zt;this.resetSessionId(),this.Gt.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var sJ=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&E(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>E(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},sK=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function sX(e,t,i){return sN({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var sZ={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>sK(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!sK(t,e))),icontains:(e,t)=>t.map(sQ).some(t=>e.map(sQ).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(sQ).every(t=>e.map(sQ).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})},sQ=e=>e.toLowerCase();function s0(e,t){return!e||Object.entries(e).every(e=>{var[i,s]=e,r=null==t?void 0:t[i];if(M(r)||null===r)return!1;var n=[String(r)],a=sZ[s.operator];return!!a&&a(s.values,n)})}var s1="custom",s2="i.posthog.com";class s3{constructor(e){this.vi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"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=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+s2,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.vi[this.apiHost]||(this.vi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":s1),this.vi[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if(this.region===s1)return this.apiHost+t;var i=s2+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var s5=tl("[Surveys]"),s6="seenSurvey_",s8=e=>((e,t)=>{var i=""+s6+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+s6+t.id+"_"+t.current_iteration),i})(0,e),s4=[i1.Popover,i1.Widget,i1.API],s7={ignoreConditions:!1,ignoreDelay:!1,displayType:i5.Popover},s9=tl("[PostHog ExternalIntegrations]"),re={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class rt{constructor(e){this._instance=e}Y(e,t){var i;null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return s9.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e,t=this,i=function(e){var i,s,n;!r||null!=(i=p.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.Y(re[e],()=>{var i;null==(i=p.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)}),!r&&null!=(s=p.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=p.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[s,r]of Object.entries(null!=(e=this._instance.config.integrations)?e:{}))i(s)}}var ri={},rs=0,rr=()=>{},rn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ra="Surveys module not available",ro="sanitize_properties is deprecated. Use before_send instead",rl="Invalid value for property_denylist config: ",ru="posthog",rc=!sR&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),rh=e=>{var t;return m({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){var t=null==e?void 0:e.hostname;if(!A(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of ii)if(i===s)return!1;return!0}(null==a?void 0:a.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:rr,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,debug:o&&A(null==o?void 0:o.search)&&-1!==o.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==s||null==(t=s.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){to.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:tZ,before_send:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:rr,__preview_eager_load_replay:!1},(e=>({rageclick:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(e))},rd=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],rp=e=>{var t={};
1for(var[i,s]of rd)M(e[i])||(t[s]=e[i]);var r=t4({},t,e);return C(e.property_blacklist)&&(M(e.property_denylist)?r.property_denylist=e.property_blacklist:C(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:to.error(rl+e.property_denylist)),r};class rg{constructor(){this.__forceAllowLocalhost=!1}get ci(){return this.__forceAllowLocalhost}set ci(e){to.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class rv{fi(e,t){if(e){var i=this.pi.indexOf(e);-1!==i&&this.pi.splice(i,1)}return this.pi.push(t),null==t.initialize||t.initialize(),t}get decideEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}get flagsEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}constructor(){this.webPerformance=new rg,this.gi=!1,this.version=v.LIB_VERSION,this.mi=new sV,this.pi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=rh(),this.SentryIntegration=iT,this.sentryIntegration=e=>(function(e,t){var i=iO(e,t);return{name:iC,processEvent:e=>i(e)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.bi=!1,this.yi=null,this.wi=null,this.Ei=null,this.scrollManager=new sq(this),this.pageViewManager=new iR(this),this.rateLimiter=new i7(this),this.requestRouter=new s3(this),this.consent=new ik(this),this.externalIntegrations=new rt(this);var e,t=null!=(e=rv.__defaultExtensionClasses)?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=A(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=A(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>to.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==ru){var s,r=null!=(s=ri[i])?s:new rv;return r._init(e,t,i),ri[i]=r,ri[ru][i]=r,r}return this._init(e,t,i)}_init(e,t,i){if(void 0===t&&(t={}),M(e)||N(e))return to.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.Si(t.debug),this.xi=t,this.Ti=[],t.person_profiles?this.wi=t.person_profiles:t.process_person&&(this.wi=t.process_person),this.set_config(t4({},rh(t.defaults),rp(t),{name:i,token:e})),this.config.on_xhr_error&&to.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:st.GZipJS;var r,n=this.$i();this.persistence=new iQ(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new iQ(m({},this.config,{persistence:"sessionStorage"}),n);var a=m({},this.persistence.props),o=m({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.ki=new sU(e=>this.Ri(e),this.config.request_queue_config),this.Pi=new sW(this),this.__request_queue=[];var l=this.config.cookieless_mode===tJ||this.config.cookieless_mode===tY&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new sY(this),this.sessionPropsManager=new sB(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(to.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Oi(l)},0)):(to.info("Initializing extensions synchronously"),this.Oi(l)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&to.info("Starting in debug mode",{this:this,config:t,thisC:m({},this.config),p:a,s:o}
1),void 0!==(null==(r=t.bootstrap)?void 0:r.distinctID)){var u=t.bootstrap.distinctID,c=this.get_distinct_id(),h=this.persistence.get_property(tL);if(t.bootstrap.isIdentifiedID&&null!=c&&c!==u&&h===tK)this.identify(u);else if(t.bootstrap.isIdentifiedID&&null!=c&&c!==u&&h===tX)to.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var d=this.config.get_device_id(ih()),p=t.bootstrap.isIdentifiedID?d:u;this.persistence.set_property(tL,t.bootstrap.isIdentifiedID?tX:tK),this.register({distinct_id:u,$device_id:p})}}if(l)this.register_once({distinct_id:tB,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(ih());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(tL,tK)}return is(s,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var s=i=>{var s=()=>i.anonymousId()||ih();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(tL,tX)),t()},r=i.user();"then"in r&&O(r.then)?r.then(s):s(r)}(e,()=>{var s;i.register((Promise&&Promise.resolve||i$.warn("This browser does not have Promise support, and can not use the segment integration"),s=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(i$.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(i$.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>s(e,e.event.event),page:e=>s(e,t1),identify:e=>s(e,t3),screen:e=>s(e,"$screen")})).then(()=>{t()})})}(this,()=>this.Ii()):this.Ii(),O(this.config._onCapture)&&this.config._onCapture!==rr&&(to.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&to.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}Oi(e){var t,i,s,r,n,a,o,l=performance.now(),u=m({},rv.__defaultExtensionClasses,this.config.__extensionClasses),c=[];u.featureFlags&&this.pi.push(this.featureFlags=null!=(t=this.featureFlags)?t:new u.featureFlags(this)),u.exceptions&&this.pi.push(this.exceptions=null!=(i=this.exceptions)?i:new u.exceptions(this)),u.historyAutocapture&&this.pi.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.pi.push(new u.tracingHeaders(this)),u.siteApps&&this.pi.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.pi.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),u.autocapture&&this.pi.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.pi.push(this.surveys=null!=(s=this.surveys)?s:new u.surveys(this)),u.logs&&this.pi.push(this.logs=null!=(r=this.logs)?r:new u.logs(this)),u.conversations&&this.pi.push(this.conversations=null!=(n=this.conversations)?n:new u.conversations(this)),u.productTours&&this.pi.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.pi.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.pi.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.pi.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.pi.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,iF)),u.toolbar&&this.pi.push(this.toolbar=null!=(a=this.toolbar)?a:new u.toolbar(this)),u.experiments&&this.pi.push(this.experiments=null!=(o=this.experiments)?o:new u.experiments(this)),this.pi.forEach(e
1=>{e.initialize&&c.push(()=>{null==e.initialize||e.initialize()})}),c.push(()=>{if(this.Ci){var e=this.Ci;this.Ci=void 0,this.ft(e)}}),this.Fi(c,l)}Fi(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.Fi(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){to.error("Error initializing extension:",e)}}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&&to.info("PostHog extensions initialized ("+s+"ms)")}ft(e){var t;if(!a||!a.body)return to.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.ft(e)},500);this.config.__preview_deferred_init_extensions&&(this.Ci=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=k(e.supportedCompression,st.GZipJS)?st.GZipJS:k(e.supportedCompression,st.Base64)?st.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.wi?this.wi:tZ}),this.pi.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}Ii(){try{this.config.loaded(this)}catch(e){to.critical("`loaded` function failed",e)}if(this.Ai(),this.config.internal_or_test_user_hostname&&null!=o&&o.hostname){var e=o.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===tJ)&&this.Mi()},1),this.Di=new se(this),this.Di.load()}Ai(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.ki)||e.enable())}_dom_loaded(){this.is_capturing()&&t6(this.__request_queue,e=>this.Ri(e)),this.__request_queue=[],this.Ai()}_handle_unload(){var e,t,i;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this.Li()&&this.capture(t2),null==(t=this.ki)||t.unload(),null==(i=this.Pi)||i.unload()):this.Li()&&this.capture(t2,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(rc?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=sA(e.url,{ip:+!!this.config.ip}),e.headers=m({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?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,(e=>{var t,i,s,r=m({},e);r.timeout=r.timeout||6e4,r.url=sA(r.url,{_:(new Date).getTime().toString(),ver:v.JS_SDK_VERSION,compression:r.compression});var n=null!=(t=r.transport)?t:"fetch",a=sj.filter(e=>!r.disableTransport||!e.transport||!r.disableTransport.includes(e.transport)),o=null!=(i=null==(s=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===n)return e[i]}(a))?void 0:s.method)?i:a[0].method;if(!o)throw Error("No available transport method");"sendBeacon"!==n&&r.data&&r.compression===st.GZipJS&&h?sD(r).then(e=>{o(e)}).catch(()=>{o(r)}):o(r)})(m({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))))}Ri(e){this.Pi?this.Pi.retriableRequest(e):this._send_request(e)}_execute_array(e){rs++;try{var t,i=[],s=[],r=[];t6(e,e=>{e&&(C(t=e[0])?r.push(e):O(e)?e.call(this):C(e)&&"alias"===t?i.push(e):C(e)&&-1!==t.indexOf("capture")&&O(this[t])?r.push(e):s.push(e))});var n=function(e,t){t6(e,function(e){if(C(e[0])){var i=t;t8(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))})};n(i,this),n(s,this),n(r,this)}finally{rs--}}push(e){if(rs>0&&C(e)&&A(e[0])){var t=rv.prototype[e[0]];O(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,i){var s,r,n,a,o;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.ki){if(this.is_capturing())if(!M(e)&&A(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!A(null==t?void 0:t.$current_url)&&(to.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=i&&i.Ui||to.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,h=(null==i?void 0:i.timestamp)||c,d=ih(),p={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},h,d)};e===t1&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),u&&(p.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==i?void 0:i.$set)&&(p.$set=null==i?void 0:i.$set);var g,v=this.Ni(null==i?void 0:i.$set_once,e!==t5,e===t3);if(v&&(p.$set_once=v),(r=p,n=null!=i&&i._noTruncate?null:this.config.properties_string_max_length,a=e=>A(e)&&null!==n?e.slice(0,n):e,o=new Set,p=function e(t,i){var s;return t!==Object(t)?a?a(t):t:o.has(t)?void 0:(o.add(t),C(t)?(s=[],t6(t,t=>{s.push(e(t))})):(s={}
1,t8(t,(t,i)=>{o.has(t)||(s[i]=e(t,i))})),s)}(r)).timestamp=h,M(null==i?void 0:i.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=c),e===i2.DISMISSED||e===i2.SENT){var _,f,y,b=null==t?void 0:t[i3.SURVEY_ID],w=null==t?void 0:t[i3.SURVEY_ITERATION];g={id:b,current_iteration:w},localStorage.getItem(s8(g))||localStorage.setItem(s8(g),"true"),p.$set=m({},p.$set,{[(_={id:b,current_iteration:w},y="$survey_"+(f=e===i2.SENT?"responded":"dismissed")+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(y="$survey_"+f+"/"+_.id+"/"+_.current_iteration),y)]:!0})}else e===i2.SHOWN&&(p.$set=m({},p.$set,{[i3.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===i6.SHOWN){var x=null==t?void 0:t[i8.TOUR_TYPE];x&&(p.$set=m({},p.$set,{[i8.TOUR_LAST_SEEN_DATE+"/"+x]:(new Date).toISOString()}))}var E=m({},p.properties.$set,p.$set);if(R(E)||this.setPersonPropertiesForFlags(E),!L(this.config.before_send)){var k=this.ji(p);if(!k)return;p=k}this.mi.emit("eventCaptured",p);var S={method:"POST",url:null!=(s=null==i?void 0:i._url)?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Ri(S):this.ki.enqueue(S),p}to.critical("This capture call is ignored due to client rate limiting.")}}else to.error("No event name provided to posthog.capture")}else to.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,r,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var l,u=n?void 0:this.persistence.remove_event_timer(e),c=m({},t);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,(this.config.cookieless_mode==tJ||this.config.cookieless_mode==tY&&this.consent.isExplicitlyOptedOut())&&(c.$cookieless_mode=!0),"$snapshot"===e){var h=m({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=h.distinct_id,(!A(c.distinct_id)&&!D(c.distinct_id)||N(c.distinct_id))&&to.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var p,g=function(e,t){if(!d)return{};var i,r,n,a,l,u,c,h,p,g,_,f=e?[...ij,...t||[]]:[],[m,y]=function(e){for(var t=0;eB.length>t;t++){var[i,s]=eB[t],r=i.exec(e),n=r&&(O(s)?s(r,e):s);if(n)return n}return["",""]}(d);return t4(it({$os:m,$os_version:y,$browser:eW(d,navigator.vendor),$device:eV(d),$device_type:(u={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==s||null==(n=s.screen)?void 0:n.width,screenHeight:null==s||null==(a=s.screen)?void 0:a.height,devicePixelRatio:null==s?void 0:s.devicePixelRatio},(_=eV(d))===es||_===ei||"Kobo"===_||"Kindle Fire"===_||_===eR?et:_===ex||_===ek||_===eE||_===eC?"Console":_===en?"Wearable":_?Q:"Android"===(null==u?void 0:u.userAgentDataPlatform)&&(null!=(c=null==u?void 0:u.maxTouchPoints)?c:0)>0?600>Math.min(null!=(h=null==u?void 0:u.screenWidth)?h:0,null!=(p=null==u?void 0:u.screenHeight)?p:0)/(null!=(g=null==u?void 0:u.devicePixelRatio)?g:1)?Q:et:"Desktop"),$timezone:iX(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:iN(null==o?void 0:o.href,f,iH),$host:null==o?void 0:o.host,$pathname:null==o?void 0:o.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:ez(d,navigator.vendor),$browser_language:iV(),$browser_language_prefix:"string"==typeof(l=iV())?l.split("-")[0]:void 0,$screen_height:null==s?void 0:s.screen.height,$screen_width:null==s?void 0:s.screen.width,$viewport_height:null==s?void 0:s.innerHeight,$viewport_width:null==s?void 0:s.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:_,windowId:f}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime());c.$session_id=_,c.$window_id=f}this.sessionPropsManager&&t4(c,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&t4(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=null==(l=this.Pi)?void 0:l.length}catch(e){c.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===s1&&(c.$lib_custom_api_host=this.config.api_host),p=e!==t1||n?e!==t2||n?this.pageViewM
1anager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),c=t4(c,p),e===t1&&a&&(c.title=a.title),!M(u)){var y=i.getTime()-u;c.$duration=parseFloat((y/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser"),(c=t4({},g,this.persistence.properties(),this.sessionPersistence.properties(),c)).$is_identified=this._isIdentified(),C(this.config.property_denylist)?t8(this.config.property_denylist,function(e){delete c[e]}):to.error(rl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(to.error(ro),c=b(c,e));var w=this.zi();return c.$process_person_profile=w,w&&!n&&this.Bi("_calculate_event_properties"),c}Ni(e,t,i){if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this.zi()||this.gi&&!i)return e;var s,r=t4({},this.persistence.get_initial_props(),(null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(to.error(ro),r=n(r,"$set_once")),t&&(this.gi=!0),R(r)?void 0:r}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}Hi(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.mi.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:ra}),()=>{})}onSessionId(e){var t,i;return null!=(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:ra})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:ra})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=s7),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!=(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))?t:{visible:!1,disabledReason:ra}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!=(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))?i:Promise.resolve({visible:!1,disabledReason:ra})}qi(e){return!e||N(e)?(to.critical("Unique user id has not been set in posthog.identify"),!1):e===tB?(to.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(to.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return to.uninitializedWarning("posthog.identify");if(D(e)&&(e=e.toString(),to.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.qi(e)&&this.Bi("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(td)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(tp)&&(this.unregister(tp),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(tL)||tK)===tK;e!==s&&n?(this.persistence.set_property(tL,tX),this.setPersonPropertiesForFlags(m({},i||{},t||{}),!1),this.capture(t3,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.Ei=sX(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(tR))}}setPersonProperties(e,t){if((e||t)&&this.Bi("posthog.setPersonProperties")){var i=sX(this.get_distinct_id(),e,t);this.Ei!==i?(this.setPersonPropertiesForFlags(m({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ei=i):to.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:m({},s,{[e]:t})}),i&&(this.capture(t5,{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),s[e]===t||i||this.reloadFeatureFlags()}else to.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this.Bi("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){if(to.info("reset"),!this.__loaded)return to.uninitializedWarning("posthog.reset");var t,i,s,r,n,a,o,l=this.get_property(td);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),null==(s=this.surveys)||s.reset(),null==(r=this.Di)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(a=this.persistence)||a.set_property(tL,tK),null==(o=this.sessionManager)||o.resetSessionId(),this.Ei=null,this.config.cookieless_mode===tJ)this.register_once({distinct_id:tB,$device_id:null},"");else{var u=this.config.get_device_id(ih());this.register_once({distinct_id:u,$device_id:e?u:l},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),this.reloadFeatureFlags()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!=(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)?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(null!=e&&e.withTimestamp&&i){var r,n=null!=(r=e.timestampLookBack)?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(th)?(to.critical("Attempting to create alias for existing People user - aborting."),-2):this.Bi("posthog.alias")?(M(t)&&(t=this.get_distinct_id()),e!==t?(this.Hi(tp,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(to.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=m({},this.config);if(T(e)){t4(this.config,rp(e));var i,s,r,n,a,o,l,u,c,h=this.$i();null==(i=this.persistence)||i.update_config(this.config,t,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new iQ(m({},this.config,{persistence:"sessionStorage"}),h);var d=this.Si(this.config.debug);U(d)&&(this.config.debug=d),U(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,im.F()&&im.L("ph_debug",!0),to.info("set_config",{config:e,oldConfig:t,newConfig:m({},this.config)})):(v.DEBUG=!1,im.F()&&im.U("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(n=this.autocapture)||n.startIfEnabled(),null==(a=this.heatmaps)||a.startIfEnabled(),null==(o=this.exceptionObserver)||o.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(u=this.surveys)||u.loadIfEnabled(),this.Wi(),null==(c=this.externalIntegrations)||c.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){v.LIB_NAME=e,v.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,a=!0===e,o={sampling:a||!(null==e||!e.sampling),linked_flag:a||!(null==e||!e.linked_flag),url_trigger:a||!(null==e||!e.url_trigger),event_trigger:a||!(null==e||!e.event_trigger)};Object.values(o).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),o.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),o.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),o.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),o.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var i=Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(m({},s,t))}}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!=(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!=(e=this.config.name)?e:ru;return t!==ru&&(t=ru+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(tL))===tX||
1(null==(t=this.sessionPersistence)?void 0:t.get_property(tL))===tX}zi(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===tZ&&!this._isIdentified()&&R(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[tp])&&(null==(t=this.persistence)||null==(t=t.props)||!t[tq]))}Li(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.zi()||this.Bi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Bi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Bi(e){return"never"===this.config.person_profiles?(to.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Hi(tq,!0),!0)}$i(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==tY)}Wi(){var e,t,i,s,r=this.$i();return(null==(e=this.persistence)?void 0:e.st)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t.st)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==tJ){if(this.config.cookieless_mode===tY&&this.consent.isExplicitlyOptedOut()){this.reset(!0),null==(r=this.sessionManager)||r.destroy(),null==(n=this.pageViewManager)||n.destroy(),this.sessionManager=new sY(this),this.pageViewManager=new iR(this),this.persistence&&(this.sessionPropsManager=new sB(this,this.sessionManager,this.persistence));var i,s,r,n,a,o,l,u=null!=(a=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)?a:null==(l=rv.__defaultExtensionClasses)?void 0:l.sessionRecording;u&&(this.sessionRecording=this.fi(this.sessionRecording,new u(this)))}this.consent.optInOut(!0),this.Wi(),this.Ai(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==tY&&(null==(i=this.surveys)||i.loadIfEnabled()),(M(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!=(s=null==e?void 0:e.captureEventName)?s:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Mi()}else to.warn(rn)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==tJ?(this.config.cookieless_mode===tY&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Wi(),this.config.cookieless_mode===tY&&(this.register({distinct_id:tB,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),null==(t=this.pageViewManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.Mi())):to.warn(rn)}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 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===tJ||(this.config.cookieless_mode===tY?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Wi()}_is_bot(){return n?sJ(n,this.config.custom_blocked_useragents):void 0}Mi(){a&&("visible"===a.visibilityState?this.bi||(this.bi=!0,this.capture(t1,{title:a.title},{send_instantly:!0}),this.yi&&(a.removeEventListener(tQ,this.yi),this.yi=null)):this.yi||(this.yi=this.Mi.bind(this),is(a,tQ,this.yi)))}debug(e){!1===e?(null==s||s.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==s||s.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}))}bt(){var e,t,i,s,r=this.xi||{};return"advanced_disable_flags"in r?!!r.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(to.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):(t="advanced_disable_decide",i=(e="advanced_disable_flags")in r&&!L(r[e]),s=t in r&&!L(r[t]),i?r[e]:!!s&&(to&&to.warn("Config field '"+t+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),r[t]))}ji(e){if(L(this.config.before_send))return e;var t=C(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(L(i=s(i))){var r="Event '"+e.event+"' was rejected in beforeSend function";return H(e.event)?to.warn(r+". This can cause unexpected behavior."):to.info(r),null}i.properties&&!R(i.properties)||to.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;
1return null==(e=this.pageViewManager.K)?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)})}Si(e){var t=U(e)&&!e,i=im.F()&&"true"===im.M("ph_debug");return!t&&(!!i||e)}}function r_(e){return e instanceof Element&&(e.id===tz||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function rf(e){return!!e&&1===e.nodeType}function rm(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function ry(e){return!!e&&3===e.nodeType}function rb(e){return!!e&&11===e.nodeType}function rw(e){return e?S(e).split(/\s+/):[]}function rx(e){var t=null==s?void 0:s.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function rE(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return rw(t)}function rk(e){return L(e)?null:S(e).split(/(\s+)/).filter(e=>rW(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function rS(e){var t="";return rM(e)&&!rA(e)&&e.childNodes&&e.childNodes.length&&t8(e.childNodes,function(e){var i;ry(e)&&e.textContent&&(t+=null!=(i=rk(e.textContent))?i:"")}),S(t)}function rP(e){var t;return M(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}rv.__defaultExtensionClasses={},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=ie(e.prototype[t[i]])}(rv,["identify"]);var rF=["a","button","form","input","select","textarea","label"];function rI(e,t){if(M(t))return!0;var i,s=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var r of e)if(i=s(r))return i.v;return!1}function r$(e){var t=e.parentNode;return!(!t||!rf(t))&&t}var rC=["next","previous","prev",">","<"],rO=[".ph-no-rageclick",".ph-no-capture"],rT=e=>!e||rm(e,"html")||!rf(e),rR=(e,t)=>{if(!s||rT(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],n=e;n.parentNode&&!rm(n,"body");)if(rb(n.parentNode))r.push(n.parentNode.host),n=n.parentNode.host;else{var a=r$(n);if(!a)break;if(t||rF.indexOf(a.tagName.toLowerCase())>-1)i=!0;else{var o=s.getComputedStyle(a);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}r.push(a),n=a}return{parentIsUsefulElement:i,targetElementList:r}};function rM(e){for(var t=e;t.parentNode&&!rm(t,"body");t=t.parentNode){var i=rE(t);if(k(i,"ph-sensitive")||k(i,"ph-no-capture"))return!1}if(k(rE(e),"ph-include"))return!0;var s=e.type||"";if(A(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!A(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function rA(e){return!!(rm(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||rm(e,"select")||rm(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var rN="(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})",rL=RegExp("^(?:"+rN+")$"),rD=new RegExp(rN),rj="\\d{3}-?\\d{2}-?\\d{4}",rU=RegExp("^("+rj+")$"),rH=RegExp("("+rj+")");function rW(e,t){return void 0===t&&(t=!0),!(L(e)||A(e)&&(e=S(e),(t?rL:rD).test((e||"").replace(/[- ]/g,""))||(t?rU:rH).test(e)))&&!0}function rq(e){var t=rS(e);return rW(t=(t+" "+function e(t){var i="";return t&&t.childNodes&&t.childNodes.length&&t8(t.childNodes,function(t){var s;if(t&&"span"===(null==(s=t.tagName)?void 0:s.toLowerCase()))try{var r=rS(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+e(t)).trim())}catch(e){to.error("[AutoCapture]",e)}}),i}(e)).trim())?t:""}function rz(e){return e.replace(/"|\\"/g,'\\"')}class rB{constructor(e){this.disabled=!1===e;var t=T(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&&this.timeoutMs>i-s.timestamp){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 rV="$copy_autocapture",rG=tl("[AutoCapture]");function rY(e,t){return t.length>e?t.slice(0,e)+"...":t}var rJ=tl("[ExceptionAutocapture]");function rK(e,t,i){try{if(!(t in e))return()=>{};var s=e[t],r=i(s);return O(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]=s}}catch(e){return()=>{}}}var rX=tl("[TracingHeaders]"),rZ=tl("[Web Vitals]"),rQ="disabled",r0="lazy_loading",r1="awaiting_config",r2="missing_config";tl("[SessionRecording]");var r3="[SessionRecording]",r5=tl(r3),r6=tl("[Heatmaps]");function r8(e){return T(e)&&"clientX"in e&&"clientY"in e&&D(e.clientX)&&D(e.clientY)}var r4=tl("[Product Tours]"),r7="ph_product_tours",r9=["$set_once","$set"],ne=tl("[SiteApps]"),nt="Error while initializing PostHog app with config id ";function ni(e,t,i){if(L(e))return!1;switch(i){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class ns{constructor(e){this.Vi=new sV,this.Yi=(e,t)=>this.Gi(e,t)&&this.Ji(e,t)&&this.Ki(e,t)&&this.Xi(e,t),this.Gi=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.Qi=new Set,this.Zi=new Set}init(){var e,t;M(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!M(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e
vendor: 4,515 bytes, line 1
1=>{var t,i;null==(t=this.Zi)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.Qi)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var s,r=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&r.add(null==e?void 0:e.selector)})}),null==(s=this._instance)||s.autocapture.setElementSelectors(r)}}on(e,t){var i;null!=t&&0!=e.length&&(this.Qi.has(e)||this.Qi.has(null==t?void 0:t.event))&&this.Zi&&(null==(i=this.Zi)?void 0:i.size)>0&&this.Zi.forEach(e=>{this.te(t,e)&&this.Vi.emit("actionCaptured",e.name)})}ie(e){this.onAction("actionCaptured",t=>e(t))}te(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.Yi(e,i))return!0;return!1}onAction(e,t){return this.Vi.on(e,t)}Ji(e,t){if(null!=t&&t.url){var i,s=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!s||"string"!=typeof s||!ni(s,t.url,t.url_matching||"contains"))return!1}return!0}Ki(e,t){return!!this.ee(e,t)&&!!this.re(e,t)&&!!this.se(e,t)}ee(e,t){if(null==t||!t.href)return!0;var i=this.ne(e);if(i.length>0)return i.some(e=>ni(e.href,t.href,t.href_matching||"exact"));var s,r,n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!n&&ni((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}re(e,t){if(null==t||!t.text)return!0;var i=this.ne(e);if(i.length>0)return i.some(e=>ni(e.text,t.text,t.text_matching||"exact")||ni(e.$el_text,t.text,t.text_matching||"exact"));var s,r,n,a,o=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!o&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!L(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(o),n=t.text,a=t.text_matching||"exact",r.some(e=>ni(e,n,a)))}se(e,t){if(null==t||!t.selector)return!0;var i,s,r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){}return!1}ne(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}Xi(e,t){return null==t||!t.properties||0===t.properties.length||s0(t.properties.reduce((e,t)=>{var i=C(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}class nr{constructor(e){this._instance=e,this.oe=new Map,this.ae=new Map,this.le=new Map}ue(e,t){return!!e&&s0(e.propertyFilters,null==t?void 0:t.properties)}he(e,t){var i=new Map;return e.forEach(e=>{var s;null==(s=e.conditions)||null==(s=s[t])||null==(s=s.values)||s.forEach(t=>{if(null!=t&&t.name){var s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}de(e,t,i){var s=(i===i0.Activation?this.oe:this.ae).get(e),r=[];return this.ve(e=>{r=e.filter(e=>null==s?void 0:s.includes(e.id))}),r.filter(s=>{var r,n=null==(r=s.conditions)||null==(r=r[i])||null==(r=r.values)?void 0:r.find(t=>t.name===e);return this.ue(n,t)})}register(e){var t;M(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.ce(e),this.fe(e))}fe(e){var t=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0});0!==t.length&&(null==this.pe&&(this.pe=new ns(this._instance),this.pe.init(),this.pe.ie(e=>{this.onAction(e)})),t.forEach(e=>{var t,i,s,r,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)?void 0:s.length)>0&&(null==(r=this.pe)||r.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach(t=>{if(t&&t.name){var i=this.le.get(t.name);i&&i.push(e.id),this.le.set(t.name,i||[e.id])}}))}))}ce(e){var t,i=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}),s=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0});0===i.length&&0===s.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.oe=this.he(e,i0.Activation),this.ae=this.he(e,i0.Cancellation))}onEvent(e,t){var i,s=this._e(),r=this.ge(),n=this.me(),a=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[r])||[];
1if(n===e&&t&&a.length>0){s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var o,l,u=(null==t||null==(o=t.properties)?void 0:o.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(u){var c=a.indexOf(u);0>c||(a.splice(c,1),this.be(a))}}else{if(this.ae.has(e)){var h=this.de(e,t,i0.Cancellation);h.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(e=>e.id)}),h.forEach(e=>{var t=a.indexOf(e.id);0>t||a.splice(t,1),this.ye(e.id)}),this.be(a))}if(this.oe.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.oe.get(e)});var d=this.de(e,t,i0.Activation);this.be(a.concat(d.map(e=>e.id)||[]))}}}onAction(e){var t,i=this.ge(),s=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this.le.has(e)&&this.be(s.concat(this.le.get(e)||[]))}be(e){var t,i=this._e(),s=this.ge(),r=[...new Set(e)].filter(e=>!this.we(e));i.info("updating activated items",{activatedItems:r}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[s]:r})}getActivatedIds(){var e,t=this.ge();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this.oe}Ee(){return this.pe}}class nn extends nr{constructor(e){super(e)}ge(){return"$surveys_activated"}me(){return i2.SHOWN}ve(e){var t;null==(t=this._instance)||t.getSurveys(e)}ye(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_e(){return s5}we(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var na="SDK is not enabled or survey functionality is not yet loaded",no="Disabled. Not loading surveys.",nl=null!=s&&s.location?iL(s.location.hash,"__posthog")||iL(location.hash,"state"):null,nu="_postHogToolbarParams",nc=tl("[Toolbar]"),nh=tl("[FeatureFlags]"),nd=tl("[FeatureFlags]",{debugEnabled:!0}),np="\" failed. Feature flags didn't load in time.",ng="$active_feature_flags",nv="$override_feature_flags",n_="$feature_flag_payloads",nf="$override_feature_flag_payloads",nm="$feature_flag_request_id",ny=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},nb=e=>{var t={};for(var[i,s]of t7(e||{}))s&&(t[i]=s);return t},nw=tl("[Error tracking]"),nx="Refusing to render web experiment since the viewer is a likely bot",nE={icontains:(e,t)=>!!s&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!s&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!s&&sK(t.href,e),not_regex:(e,t)=>!!s&&!sK(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class nk{get N(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{nk.Se("retrieved web experiments from the server"),t.xe=new Map,e.forEach(e=>{if(e.feature_flag_key){t.xe&&(nk.Se("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.xe)||i.set(e.feature_flag_key,e));var i,s=t._instance.getFeatureFlag(e.feature_flag_key);A(s)&&e.variants[s]&&t.Te(e.name,s,e.variants[s].transforms)}else if(e.variants)for(var r in e.variants){var n=e.variants[r];nk.$e(n)&&t.Te(e.name,r,n.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())nk.Se(nx);else if(!this.N.disable_web_experiments){if(L(this.xe))return this.xe=new Map,this.loadIfEnabled(),void this.previewWebExperiment();nk.Se("applying feature flags",e),e.forEach(e=>{var t;if(this.xe&&null!=(t=this.xe)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this.xe)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this.Te(r.name,s,r.variants[s].transforms)}})}}previewWebExperiment(){var e=nk.getWindowLocation();if(null!=e&&e.search){var t=iA(null==e?void 0:e.search,"__experiment_id"),i=iA(null==e?void 0:e.search,"__experiment_variant");t&&i&&(nk.Se("previewing web experiments "+t+" && "+i),this.getWebExperiments(e=>{this.ke(parseInt(t),i,e)},!1,!0))}}loadIfEnabled(){this.N.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.N.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.N.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}ke(e,t,i){var s=i.filter(t=>t.id===e);s&&s.length>0&&(nk.Se("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.Te(s[0].name,t,s[0].variants[t].transforms))}static $e(e){return!L(e.conditions)&&nk.Re(e)&&nk.Pe(e)}static Re(e){if(L(e.conditions)||L(null==(t=e.conditions)?void 0:t.url))return!0;var t,i,s,r,n=nk.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||nE[null!=(s=null==(r=e.conditions)?void 0:r.urlMatchType)?s:"icontains"](e.conditions.url,n))}
1static getWindowLocation(){return null==s?void 0:s.location}static Pe(e){if(L(e.conditions)||L(null==(i=e.conditions)?void 0:i.utm))return!0;var t=iq();if(t.utm_source){var i,s,r,n,a,o,l,u,c,h=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==t.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(a=e.conditions)||null==(a=a.utm)?void 0:a.utm_source)==t.utm_source,p=null==(o=e.conditions)||null==(o=o.utm)||!o.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==t.utm_medium,g=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==t.utm_term;return h&&p&&g&&d}return!1}static Se(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];to.info("[WebExperiments] "+e,i)}Te(e,t,i){this._is_bot()?nk.Se(nx):"control"!==t?i.forEach(i=>{if(i.selector){nk.Se("applying transform of variant "+t+" for experiment "+e+" ",i);var s,r=null==(s=document)?void 0:s.querySelectorAll(i.selector);null==r||r.forEach(e=>{i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)})}}):nk.Se("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?sJ(n,this.N.custom_blocked_useragents):void 0}}var nS=tl("[Conversations]"),nP="Conversations not available yet.",nF={featureFlags:class{constructor(e){this.Oe=!1,this.Ie=!1,this.Ce=!1,this.Fe=!1,this.Ae=!1,this.Me=!1,this.De=!1,this.Le=!1,this._instance=e,this.featureFlagEventHandlers=[]}get N(){return this._instance.config}get Wt(){return this._instance.persistence}Ue(e){return this._instance.get_property(e)}Ne(){var e,t;return null!=(e=null==(t=this.Wt)?void 0:t.nt(this.N.feature_flag_cache_ttl_ms))&&e}je(){return!!this.Ne()&&(this.Le||this.Ce||(this.Le=!0,nh.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ze(){var e,t=null!=(e=this.N.evaluation_contexts)?e:this.N.evaluation_environments;return!this.N.evaluation_environments||this.N.evaluation_contexts||this.De||(nh.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.De=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||nh.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}Be(){return this.ze().length>0}initialize(){var e,t,{config:i}=this._instance,s=null!=(e=null==(t=i.bootstrap)?void 0:t.featureFlags)?e:{};if(Object.keys(s).length){var r,n,a=null!=(r=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)?r:{},o=Object.keys(s).filter(e=>!!s[e]).reduce((e,t)=>(e[t]=s[t]||!1,e),{}),l=Object.keys(a).filter(e=>o[e]).reduce((e,t)=>(a[t]&&(e[t]=a[t]),e),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(e,t,i){var s=null!=i&&i.merge?this.getFlagVariants():{},r=null!=i&&i.merge?this.getFlagPayloads():{},n=m({},s,e),a=m({},r,t),o={};for(var[l,u]of Object.entries(n)){var c="string"==typeof u;o[l]={key:l,enabled:!!c||!!u,variant:c?u:void 0,reason:void 0,metadata:M(null==a?void 0:a[l])?void 0:{id:0,version:void 0,description:void 0,payload:a[l]}}}this.receivedFeatureFlags({flags:o})}get hasLoadedFlags(){return this.Ie}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.Ue(t$),t=this.Ue(nv),i=this.Ue(nf);if(!i&&!t)return e||{};var s=t4({},e||{});for(var r of[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])]){var n,a,o=s[r],l=null==t?void 0:t[r],u=M(l)?null!=(n=null==o?void 0:o.enabled)&&n:!!l,c=M(l)?o.variant:"string"==typeof l?l:void 0,h=null==i?void 0:i[r],d=m({},o,{enabled:u,variant:u?null!=c?c:null==o?void 0:o.variant:void 0});u!==(null==o?void 0:o.enabled)&&(d.original_enabled=null==o?void 0:o.enabled),c!==(null==o?void 0:o.variant)&&(d.original_variant=null==o?void 0:o.variant),h&&(d.metadata=m({},null==o?void 0:o.metadata,{payload:h,original_payload:null==o||null==(a=o.metadata)?void 0:a.payload})),s[r]=d}return this.Oe||(nh.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.Oe=!0),s}getFlagVariants(){var e=this.Ue(tF),t=this.Ue(nv);if(!t)return e||{};for(var i=t4({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.Oe||(nh.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Oe=!0),i}getFlagPayloads(){var e=this.Ue(n_),t=this.Ue(nf);if(!t)return e||{};for(var i=t4({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.Oe||(nh.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Oe=!0),i}reloadFeatureFlags(){this.Fe||this.N.advanced_disable_feature_flags||this.He||(this._instance.mi.emit("featureFlagsReloading",!0),this.He=setTimeout(()=>{this.qe()},5))}We(){clearTimeout(this.He),this.He=void 0}ensureFlagsLoaded(){this.Ie||this.Ce||this.He||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Fe=e}qe(e){var t;if(this.We(),!this._instance.bt())if(this.Ce)this.Ae=!0;else{var i=this.N.token,s=this.Ue(td),r={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:m({},(null==(t=this.Wt)?void 0:t.get_initial_props())||{},this.Ue(tC)||{}),group_properties:this.Ue(tO),timezone:iX()};null===s||M(s)||(r.$device_id=s),(null!=e&&e.disableFlags||this.N.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Be()&&(r.evaluation_contexts=this.ze());var n=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.N.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Ce=!0,this._instance._send_request({method:"POST",url:n,data:r,compression:this.N.disable_compression?void 0:st.Base64,timeout:this.N.feature_flag_request_timeout_ms,callback:e=>{var t,i,s,n=!0;if(200===e.statusCode&&(this.Ae||(this.$anon_distinct_id=void 0),n=!1),this.Ce=!1,!r.disable_flags||this.Ae){this.Me=!n;var a=[];e.error?e.error instanceof Error?a.push("AbortError"===e.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==e.statusCode&&a.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var o,l=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));(l&&a.push("quota_limited"),null==(s=this.Wt)||s.register({[tA]:a}),l)?nh.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset.  Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(r.disable_flags||this.receivedFeatureFlags(null!=(o=e.json)?o:{},n),this.Ae&&(this.Ae=!1,this.qe()))}}})}}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this.Me)if(this.Ie||this.getFlags()&&this.getFlags().length>0){if(!this.je()){var s=this.getFeatureFlagResult(e,t);return null!=(i=null==s?void 0:s.variant)?i:null==s?void 0:s.enabled}}else nh.warn('getFeatureFlag for key "'+e+np)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.Me)if(this.Ie||this.getFlags()&&this.getFlags().length>0){if(!this.je()){var i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],a=String(r),o=this.Ue(nm)||void 0,l=this.Ue(tN)||void 0,u=this.Ue(tR)||{};if(this.N.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.Ue(tM);h&&h!==d&&(u={},null==(c=this.Wt)||c.register({[tR]:u,[tM]:h}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){C(u[e])?u[e].push(a):u[e]=[a],null==(_=this.Wt)||_.register({[tR]:u});var p=this.getFeatureFlagDetails(e),g=[...null!=(f=this.Ue(tA))?f:[]];M(r)&&g.push("flag_missing");var v={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(m=this.N.bootstrap)||null==(m
1=m.featureFlags)?void 0:m[e])||null,$feature_flag_bootstrapped_payload:(null==(y=this.N.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[e])||null,$used_bootstrap_value:!this.Me};M(null==p||null==(b=p.metadata)?void 0:b.version)||(v.$feature_flag_version=p.metadata.version);var _,f,m,y,b,w,x,E,k,S,P,F=null!=(w=null==p||null==(x=p.reason)?void 0:x.description)?w:null==p||null==(E=p.reason)?void 0:E.code;F&&(v.$feature_flag_reason=F),null!=p&&null!=(k=p.metadata)&&k.id&&(v.$feature_flag_id=p.metadata.id),M(null==p?void 0:p.original_variant)&&M(null==p?void 0:p.original_enabled)||(v.$feature_flag_original_response=M(p.original_variant)?p.original_enabled:p.original_variant),null!=p&&null!=(S=p.metadata)&&S.original_payload&&(v.$feature_flag_original_payload=null==p||null==(P=p.metadata)?void 0:P.original_payload),g.length&&(v.$feature_flag_error=g.join(",")),this._instance.capture("$feature_flag_called",v)}if(s){var I=n;if(!M(n))try{I=JSON.parse(n)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:I}}}}else nh.warn('getFeatureFlagResult for key "'+e+np)}getRemoteConfigPayload(e,t){var i=this.N.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this.Be()&&(s.evaluation_contexts=this.ze()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.N.disable_compression?void 0:st.Base64,timeout:this.N.feature_flag_request_timeout_ms,callback(i){var s,r=null==(s=i.json)?void 0:s.featureFlagPayloads;t((null==r?void 0:r[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this.Me){if(this.Ie||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return M(i)?void 0:!!i}nh.warn('isFeatureEnabled for key "'+e+np)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this.Wt){this.Ie=!0;var i=this.getFlagVariants(),s=this.getFlagPayloads(),r=this.getFlagsWithDetails();!function(e,t,i,s,r){void 0===i&&(i={}),void 0===s&&(s={}),void 0===r&&(r={});var n,a=((n=e.flags)?(e.featureFlags=Object.fromEntries(Object.keys(n).map(e=>{var t;return[e,null!=(t=n[e].variant)?t:n[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(n).filter(e=>n[e].enabled).filter(e=>{var t;return null==(t=n[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=n[e].metadata)?void 0:t.payload]}))):nh.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e),o=a.flags,l=a.featureFlags,u=a.featureFlagPayloads;if(l){var c=e.requestId,h=e.evaluatedAt;if(C(l)){nh.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var d={};if(l)for(var p=0;l.length>p;p++)d[l[p]]=!0;t&&t.register({[ng]:l,[tF]:d})}else{var g=l,v=u,_=o;if(e.errorsWhileComputingFlags)if(o){var f=new Set(Object.keys(o).filter(e=>{var t;return!(null!=(t=o[e])&&t.failed)}));g=m({},i,Object.fromEntries(Object.entries(g).filter(e=>{var[t]=e;return f.has(t)}))),v=m({},s,Object.fromEntries(Object.entries(v||{}).filter(e=>{var[t]=e;return f.has(t)}))),_=m({},r,Object.fromEntries(Object.entries(_||{}).filter(e=>{var[t]=e;return f.has(t)})))}else g=m({},i,g),v=m({},s,v),_=m({},r,_);t&&t.register(m({[ng]:Object.keys(nb(g)),[tF]:g||{},[n_]:v||{},[t$]:_||{}},c?{[nm]:c}:{},h?{[tN]:h}:{}))}}}(e,this.Wt,i,s,r),t||(this.Le=!1),this.Ve(t)}}override(e,t){void 0===t&&(t=!1),nh.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Wt)return nh.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.Wt.unregister(nv),this.Wt.unregister(nf),this.Ve(),nd.info("All overrides cleared");if(C(e)){var t,i=ny(e);return this.Wt.register({[nv]:i}),this.Ve(),nd.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){if(this.Oe=!!(null!=(t=e.suppressWarning)&&t),"flags"in e){if(!1===e.flags)this.Wt.unregister(nv),nd.info("Flag overrides cleared");else if(e.flags){if(C(e.flags)){var s=ny(e.flags);this.Wt.register({[nv]:s})}else this.Wt.register({[nv]:e.flags});nd.info("Flag overrides set",{flags:e.flags})}}return"payloads"in e&&(!1===e.payloads?(this.Wt.unregister(nf),nd.info("Payload overrides cleared")):e.payloads&&(this.Wt.register({[nf]:e.payloads}),nd.info("Payload overrides set",{payloads:e.payloads}))),void this.Ve()}if(e&&"object"==typeof e)return this.Wt.register({[nv]:e}),this.Ve(),nd.info("Flag overrides set",{flags:e});nh.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Ie){var{flags:t,flagVariants:i}=this.Ye();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,r=(this.Ue(tI)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(a.$early_access_feature_name=r.name),i&&(a.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(n,!1);var o=m({},this.getFlagVariants(),{[e]:t});null==(s=this.Wt)||s.register({[ng]:Object.keys(nb(o)),[tF]:o}),this.Ve()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this.Ue(tI),r=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.N.token+r),method:"GET",callback:t=>{var i,s;if(t.json){var r=t.json.earlyAccessFeatures;return null==(i=this.Wt)||i.unregister(tI),null==(s=this.Wt)||s.register({[tI]:r}),e(r)}}})}Ye(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}Ve(e){var{flags:t,flagVariants:i}=this.Ye();
1this.featureFlagEventHandlers.forEach(s=>s(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.Ue(tC)||{};this._instance.register({[tC]:m({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(tC)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.Ue(tO)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=m({},i[t],e[t]),delete e[t]}),this._instance.register({[tO]:m({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.Ue(tO)||{};this._instance.register({[tO]:m({},t,{[e]:{}})})}else this._instance.unregister(tO)}reset(){this.Ie=!1,this.Ce=!1,this.Fe=!1,this.Ae=!1,this.Me=!1,this.$anon_distinct_id=void 0,this.We(),this.Oe=!1}}},nI=m({productTours:class{get Wt(){return this._instance.persistence}constructor(e){this.rs=null,this.ss=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this.Wt&&this.Wt.register({[tx]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this.rs||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(tx)||this.Y(()=>this.ns())}Y(e){var t,i;null!=(t=p.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?r4.error("Could not load product tours script",t):e()})}ns(){var e;!this.rs&&null!=(e=p.__PosthogExtensions__)&&e.generateProductTours&&(this.rs=p.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!C(this.ss)||t){var i=this.Wt;if(i){var s=i.props[r7];if(C(s)&&!t)return this.ss=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:t=>{var s=t.statusCode;if(200!==s||!t.json){var r="Product Tours API could not be loaded, status: "+s;return r4.error(r),void e([],{isLoaded:!1,error:r})}var n=C(t.json.product_tours)?t.json.product_tours:[];this.ss=n,i&&i.register({[r7]:n}),e(n,{isLoaded:!0})}})}else e(this.ss,{isLoaded:!0})}getActiveProductTours(e){L(this.rs)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.rs.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.rs)||t.showTourById(e)}previewTour(e){this.rs?this.rs.previewTour(e):this.Y(()=>{var t;this.ns(),null==(t=this.rs)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.rs)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.rs)||e.nextStep()}previousStep(){var e;null==(e=this.rs)||e.previousStep()}clearCache(){var e;this.ss=null,null==(e=this.Wt)||e.unregister(r7)}resetTour(e){var t;null==(t=this.rs)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.rs)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.rs)||t.cancelPendingTour(e)}}},nF),n$=m({surveys:class{get N(){return this._instance.config}constructor(e){this.fs=void 0,this._surveyManager=null,this.ps=!1,this._s=[],this.gs=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.N.disable_surveys){var t=e.surveys;if(L(t))return s5.warn("Flags not loaded yet. Not loading surveys.");var i=C(t);this.fs=i?t.length>0:t,s5.info("flags response received, isSurveysEnabled: "+this.fs),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(s6)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.ps)s5.info("Already initializing surveys, skipping...");else if(this.N.disable_surveys)s5.info(no);else if(this.N.cookieless_mode&&this._instance.consent.isOptedOut())s5.info("Not loading surveys in cookieless mode without consent.");else{var e=null==p?void 0:p.__PosthogExtensions__;if(e){if(!M(this.fs)||this.N.advanced_enable_surveys){var t=this.fs||this.N.advanced_enable_surveys;this.ps=!0;try{var i=e.generateSurveys;if(i)return void this.bs(i,t);var s=e.loadExternalDependency;if(!s)return void this.ys(tG);s(this._instance,"surveys",i=>{i||!e.generateSurveys?this.ys("Could not load surveys script",i):this.bs(e.generateSurveys,t)})}catch(e){throw this.ys("Error initializing surveys",e),e}finally{this.ps=!1}}}else s5.error("PostHog Extensions not found.")}}bs(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new nn(this._instance),s5.info("Surveys loaded successfully"),this.ws({isLoaded:!0})}ys(e,t){s5.error(e,t),this.ws({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._s.push(e),this._surveyManager&&this.ws({isLoaded:!0}),()=>{this._s=this._s.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.N.disable_surveys)return s5.info(no),e([]);var i,s=this._instance.get_property(tT);if(s&&!t)return e(s,{isLoaded:!0});"undefined"!=typeof Promise&&this.gs?this.gs.then(t=>{var{surveys:i,context:s}=t;return e(i,s)}):("undefined"!=typeof Promise&&(this.gs=new Promise(e=>{i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.N.token),method:"GET",timeout:this.N.surveys_request_timeout_ms,callback:t=>{this.gs=null;var s=t.statusCode;if(200!==s||!t.json){var r="Surveys API could not be loaded, status: "+s;s5.error(r);var n={isLoaded:!1,error:r};return e([],n),void(null==i||i({surveys:[],context:n}))}var a,o,l=t.json.surveys||[],u=l.filter(e=>{var t,i;return!(!e.start_date||e.end_date)&&(!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)||!(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length))});u.length>0&&(null==(o=this._surveyEventReceiver)||o.register(u)),null==(a=this._instance.persistence)||a.register({[tT]:l});var c={isLoaded:!0};e(l,c),null==i||i({surveys:l,context:c})}}))}
1ws(e){for(var t of this._s)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){s5.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!L(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);s5.warn("init was not called")}Es(e){var t=null;return this.getSurveys(i=>{var s;t=null!=(s=i.find(t=>t.id===e))?s:null}),t}Ss(e){if(L(this._surveyManager))return{eligible:!1,reason:na};var t="string"==typeof e?this.Es(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(L(this._surveyManager))return s5.warn("init was not called"),{visible:!1,disabledReason:na};var t=this.Ss(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return L(this._surveyManager)?(s5.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:na})):new Promise(i=>{this.getSurveys(t=>{var s,r=null!=(s=t.find(t=>t.id===e))?s:null;if(r){var n=this.Ss(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(L(this._surveyManager))s5.warn("init was not called");else{var r="string"==typeof e?this.Es(e):e;if(null!=r&&r.id)if(s4.includes(r.type)){var n=null==a?void 0:a.querySelector(t);if(n)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(s5.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;s5.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,n,i),s5.info("Survey "+r.id+" rendered")},1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,i);s5.warn("Survey element not found")}else s5.warn("Surveys of type "+r.type+" cannot be rendered in the app");else s5.warn("Survey not found")}}displaySurvey(e,t){var i;if(L(this._surveyManager))s5.warn("init was not called");else{var s=this.Es(e);if(s){var r=s;if(null!=(i=s.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=m({},s,{appearance:m({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==i5.Popover&&t.initialResponses&&s5.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this.canRenderSurvey(s);if(!n.visible)return void s5.warn("Survey is not eligible to be displayed: ",n.disabledReason)}t.displayType!==i5.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else s5.warn("Survey not found")}}cancelPendingSurvey(e){L(this._surveyManager)?s5.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},nF),nC=m({experiments:nk},nF),nO=m({},nF,{sessionRecording:class{get N(){return this._instance.config}get Wt(){return this._instance.persistence}get started(){var e;return!(null==(e=this.Ge)||!e.isStarted)}get status(){var e,t;return this.Je===r1||this.Je===r2?this.Je:null!=(e=null==(t=this.Ge)?void 0:t.status)?e:this.Je}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.Je=rQ,this.Ke=void 0,this._instance=e,!this._instance.sessionManager)throw r5.error("started without valid sessionManager"),Error(r3+" started without valid sessionManager. This is a bug.");if(this.N.cookieless_mode===tJ)throw Error(r3+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Xe(){var e,t=!(null==(e=this._instance.get_property(tk))||!e.enabled),i=!this.N.disable_session_recording,r=this.N.disable_session_recording||this._instance.consent.isOptedOut();return s&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this.Xe||null==(t=this.Ge)||!t.isStarted){var i=!M(Object.assign)&&!M(Array.from);this.Xe&&i?(this.Qe(e),r5.info("starting")):(this.Je=rQ,this.stopRecording())}}Qe(e){var t,i,s;this.Xe&&(this.Je!==r1&&this.Je!==r2&&(this.Je=r0),null!=p&&null!=(t=p.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=p.__PosthogExtensions__)&&i.initSessionRecording?this.Ze(e):null==(s=p.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this.tr,t=>{if(t)return r5.error("could not load recorder",t);this.Ze(e)}))}stopRecording(){var e,t;null==(e=this.Ke)||e.call(this),this.Ke=void 0,null==(t=this.Ge)||t.stop()}ir(){var e,t;null==(e=this.Ke)||e.call(this),this.Ke=void 0,null==(t=this.Ge)||t.discard()}er(){var e;null==(e=this.Wt)||e.unregister(tP)}rr(e,t){if(L(e))return null;var i=D(e)?e:parseFloat(e);return"number"!=typeof i||!Number.isFinite(i)||0>i||i>1?(r5.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}sr(e){if(this.Wt){var t,i,s=this.Wt,r=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.rr(null==(t=this.N.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.rr(null==i?void 0:i.sampleRate,"remote config sampleRate"),a=null!=r?r:n;L(a)&&this.er();var o=null==i?void 0:i.minimumDurationMilliseconds;s.register({[tk]:m({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:m({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:a,minimumDurationMilliseconds:M(o)?null:o,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers})})};r(),null==(t=this.Ke)||t.call(this),this.Ke=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(r)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.sr(e),void this.ir()):(this.sr(e),void this.startIfEnabledOrStop()):(this.Je===r1&&
1(this.Je=r2,r5.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.Ge)&&i.log?this.Ge.log(e,t):r5.warn("log called before recorder was ready")}get tr(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(tk);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}nr(){var e,t=this._instance.get_property(tk);if(!t)return!1;var i=null!=(e=("object"==typeof t?t:JSON.parse(t)).cache_timestamp)?e:Date.now();return 36e5>=Date.now()-i}Ze(e){var t,i;if(null==(t=p.__PosthogExtensions__)||!t.initSessionRecording)return r5.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.Ge||(this.Ge=null==(i=p.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.Ge._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.nr()){if(this.Je===r2||this.Je===r1)return;return this.Je=r1,r5.info("persisted remote config is stale, requesting fresh config before starting"),void new se(this._instance).load()}this.Je=r0,this.Ge.start(e)}onRRwebEmit(e){var t;null==(t=this.Ge)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.Ge||null==(t=this.Wt)||t.register({$replay_override_linked_flag:!0}),null==(e=this.Ge)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Ge||null==(t=this.Wt)||t.register({$replay_override_sampling:!0}),null==(e=this.Ge)||e.overrideSampling()}overrideTrigger(e){var t,i;this.Ge||null==(i=this.Wt)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(t=this.Ge)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.Ge)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.Ge)||!i.tryAddCustomEvent(e,t))}}},{autocapture:class{constructor(e){this.ar=!1,this.lr=null,this.ur=!1,this.instance=e,this.rageclicks=new rB(e.config.rageclick),this.hr=null}initialize(){this.startIfEnabled()}get N(){var e,t,i=T(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map(e=>new RegExp(e)),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),i}dr(){if(this.isBrowserSupported()){if(s&&a){var e=e=>{e=e||(null==s?void 0:s.event);try{this.vr(e)}catch(e){rG.error("Failed to capture event",e)}};if(is(a,"submit",e,{capture:!0}),is(a,"change",e,{capture:!0}),is(a,"click",e,{capture:!0}),this.N.capture_copied_text){var t=e=>{this.vr(e=e||(null==s?void 0:s.event),rV)};is(a,"copy",t,{capture:!0}),is(a,"cut",t,{capture:!0})}}}else rG.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.ar&&(this.dr(),this.ar=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.ur=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[tv]:!!e.autocapture_opt_out}),this.lr=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.hr=e}getElementSelectors(e){var t,i=[];return null==(t=this.hr)||t.forEach(t=>{var s=null==a?void 0:a.querySelectorAll(t);null==s||s.forEach(s=>{e===s&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[tv];if(null===this.lr&&!U(i)&&!this.instance.bt())return!1;var s=null!=(t=this.lr)?t:!!i;return!!this.instance.config.autocapture&&!s}vr(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,r=rP(e);ry(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,t){if(!s||rT(e)||(U(t)?(i=!!t&&rO,r=void 0):(i=null!=(n=null==t?void 0:t.css_selector_ignorelist)?n:rO,r=null==t?void 0:t.content_ignorelist),!1===i))return!1;var i,r,n,{targetElementList:a}=rR(e,!1);return!function(e,t){var i;if(!1===e||M(e))return!1;if(!0===e)i=rC;else{if(!C(e))return!1;if(e.length>10)return to.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:s}=e;return i.some(e=>t.includes(e)||s.includes(e))})}(r,a.map(e=>{var t;return{safeText:rS(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!rI(a,i)}(r,this.instance.config.rageclick)&&this.vr(e,"$rageclick");
1var n=t===rV;if(r&&function(e,t,i,r,n){if(void 0===i&&(i=void 0),!s||rT(e)||null!=(a=i)&&a.url_allowlist&&!rx(i.url_allowlist)||null!=(o=i)&&o.url_ignorelist&&rx(i.url_ignorelist))return!1;if(null!=(l=i)&&l.dom_event_allowlist){var a,o,l,u,c=i.dom_event_allowlist;if(c&&!c.some(e=>t.type===e))return!1}var{parentIsUsefulElement:h,targetElementList:d}=rR(e,r);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(M(i))return!0;var s,r=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(s=r(n))return s.v;return!1}(d,i)||!rI(d,null==(u=i)?void 0:u.css_selector_allowlist))return!1;var p=s.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var g=e.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(n||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0;default:return h?(n||["click"]).indexOf(t.type)>=0:(n||["click"]).indexOf(t.type)>=0&&(rF.indexOf(g)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this.N,n,n?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=function(e,t){for(var i,r,{e:n,maskAllElementAttributes:a,maskAllText:o,elementAttributeIgnoreList:l,elementsChainAsString:u}=t,c=[e],h=e;h.parentNode&&!rm(h,"body");)rb(h.parentNode)?(c.push(h.parentNode.host),h=h.parentNode.host):(c.push(h.parentNode),h=h.parentNode);var d,p=[],g={},v=!1,_=!1;if(t8(c,e=>{var t=rM(e);"a"===e.tagName.toLowerCase()&&(v=e.getAttribute("href"),v=t&&v&&rW(v)&&v),k(rE(e),"ph-no-capture")&&(_=!0),p.push(function(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};rF.indexOf(r)>-1&&!i&&(n.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?rY(1024,rq(e)):rY(1024,rS(e)));var a=rE(e);a.length>0&&(n.classes=a.filter(function(e){return""!==e})),t8(e.attributes,function(i){var r;if((!rA(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&rW(i.value)&&(!A(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var a=i.value;"class"===i.name&&(a=rw(a).join(" ")),n["attr__"+i.name]=rY(1024,a)}});for(var o=1,l=1,u=e;u=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!rf(t));return t}(u);)o++,u.tagName===e.tagName&&l++;return n.nth_child=o,n.nth_of_type=l,n}(e,a,o,l)),t4(g,function(e){if(!rM(e))return{};var t={};return t8(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&rW(s)&&(t[i]=s)}}),t}(e))}),_)return{props:{},explicitNoCapture:_};if(o||(p[0].$el_text="a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?rq(e):rS(e)),v){p[0].attr__href=v;var f,y,b=null==(f=iM(v))?void 0:f.host,w=null==s||null==(y=s.location)?void 0:y.host;b&&w&&b!==w&&(d=v)}return{props:t4({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:p.map(e=>{var t,i,s,r={text:null==(i=e.$el_text)?void 0:i.slice(0,400),tag_name:e.tag_name,href:null==(s=e.attr__href)?void 0:s.slice(0,2048),attr_class:(t=e.attr__class)?C(t)?t:rw(t):void 0,attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return t7(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return r.attributes[t]=i}),r}).map(e=>{var t,i,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var r of(e.attr_class.sort(),e.attr_class))s+="."+r.replace(/"/g,"");var n=m({},e.text?{text:e.text}:{},{"nth-child":null!=(t=e.nth_child)?t:0,"nth-of-type":null!=(i=e.nth_of_type)?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return t7(n).sort((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)}).forEach(e=>{var[t,i]=e;return a[rz(t.toString())]=rz(i.toString())}),(s+=":")+t7(a).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")}).join(";")},null!=(i=p[0])&&i.$el_text?{$el_text:null==(r=p[0])?void 0:r.$el_text}:{},d&&"click"===n.type?{$external_click_url:d}:{},g)}}(r,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.N.element_attribute_ignorelist,elementsC
1hainAsString:this.ur});if(o)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(a.$element_selectors=l),t===rV){var u,c=rk(null==s||null==(u=s.getSelection())?void 0:u.toString()),h=e.type||"clipboard";if(!c)return!1;a.$selected_content=c,a.$copy_type=h}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return O(null==a?void 0:a.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.cr=(null==s||null==(t=s.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(to.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.pr&&this.pr(),this.pr=void 0,to.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(s&&s.history){var i=this;null!=(e=s.history.pushState)&&e.__posthog_wrapped__||rK(s.history,"pushState",e=>function(t,s,r){e.call(this,t,s,r),i._r("pushState")}),null!=(t=s.history.replaceState)&&t.__posthog_wrapped__||rK(s.history,"replaceState",e=>function(t,s,r){e.call(this,t,s,r),i._r("replaceState")}),this.gr()}}_r(e){try{var t,i=null==s||null==(t=s.location)?void 0:t.pathname;if(!i)return;i!==this.cr&&this.isEnabled&&this._instance.capture(t1,{navigation_type:e}),this.cr=i}catch(t){to.error("Error capturing "+e+" pageview",t)}}gr(){if(!this.pr){var e=()=>{this._r("popstate")};is(s,"popstate",e),this.pr=()=>{s&&s.removeEventListener("popstate",e)}}}},heatmaps:class{get N(){return this.instance.config}constructor(e){var t;this.mr=!1,this.ar=!1,this.br=null,this.instance=e,this.mr=!(null==(t=this.instance.persistence)||!t.props[t_]),this.rageclicks=new rB(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return T(this.N.capture_heatmaps)&&this.N.capture_heatmaps.flush_interval_milliseconds&&(e=this.N.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return L(this.N.capture_heatmaps)?L(this.N.enable_heatmaps)?this.mr:this.N.enable_heatmaps:!1!==this.N.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.ar||(r6.info("starting..."),this.yr(),this.wr());else{var e;clearInterval(null!=(e=this.br)?e:void 0),this.Er(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[t_]:t}),this.mr=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.I;return this.I=void 0,e}Sr(e){this.Tr(e.originalEvent,"deadclick")}wr(){this.br&&clearInterval(this.br),this.br="visible"===(null==a?void 0:a.visibilityState)?setInterval(this.At.bind(this),this.flushIntervalMilliseconds):null}yr(){s&&a&&(this.$r=this.At.bind(this),is(s,t0,this.$r),this.kr=e=>this.Tr(e||(null==s?void 0:s.event)),is(a,"click",this.kr,{capture:!0}),this.Rr=e=>this.Pr(e||(null==s?void 0:s.event)),is(a,"mousemove",this.Rr,{capture:!0}),this.Or=new iI(this.instance,iP,this.Sr.bind(this)),this.Or.startIfEnabledOrStop(),this.Ir=this.wr.bind(this),is(a,tQ,this.Ir),this.ar=!0)}Er(){var e;s&&a&&(this.$r&&s.removeEventListener(t0,this.$r),this.kr&&a.removeEventListener("click",this.kr,{capture:!0}),this.Rr&&a.removeEventListener("mousemove",this.Rr,{capture:!0}),this.Ir&&a.removeEventListener(tQ,this.Ir),clearTimeout(this.Cr),null==(e=this.Or)||e.stop(),this.ar=!1)}Fr(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),a=function(e,t,i){for(var r=e;r&&rf(r)&&!rm(r,"body")&&r!==i;){if(k(t,null==s?void 0:s.getComputedStyle(r).position))return!0;r=r$(r)}return!1}(rP(e),["fixed","sticky"],n);return{x:e.clientX+(a?0:r),y:e.clientY+(a?0:i),target_fixed:a,type:t}}Tr(e,t){var i;if(void 0===t&&(t="click"),!r_(e.target)&&r8(e)){var s=this.Fr(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.Ar(m({},s,{type:"rageclick"})),this.Ar(s)}}Pr(e){!r_(e.target)&&r8(e)&&(clearTimeout(this.Cr),this.Cr=setTimeout(()=>{this.Ar(this.Fr(e,"mousemove"))},500))}Ar(e){if(s){var t=s.location.href,i=this.N.custom_personal_data_properties,r=iN(t,this.N.mask_personal_data_properties?[...ij,...i||[]]:[],iH);this.I=this.I||{},this.I[r]||(this.I[r]=[]),this.I[r].push(e)}}At(){this.I&&!R(this.I)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:iI,webVitalsAutocapture:class{constructor(e){var t;this.mr=!1,this.ar=!1,this.I={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Mr=()=>{clearTimeout(this.Dr),0!==this.I.metrics.length&&(this._instance.capture("$web_vitals",this.I.metrics.reduce((e,t)=>
1m({},e,{["$web_vitals_"+t.name+"_event"]:m({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.I={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Lr=e=>{var t,i=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(M(i))rZ.error("Could not read session ID. Dropping metrics!");else{this.I=this.I||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.Ur();M(s)||(L(null==e?void 0:e.name)||L(null==e?void 0:e.value)?rZ.error("Invalid metric received",e):!this.Nr||this.Nr>e.value?(this.I.url!==s&&(this.Mr(),this.Dr=setTimeout(this.Mr,this.flushToCaptureTimeoutMs)),M(this.I.url)&&(this.I.url=s),this.I.firstMetricTimestamp=M(this.I.firstMetricTimestamp)?Date.now():this.I.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.I.metrics.push(m({},e,{$current_url:s,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.I.metrics.length===this.allowedMetrics.length&&this.Mr()):rZ.error("Ignoring metric with value >= "+this.Nr,e))}},this.jr=()=>{if(!this.ar){var e,t,i,s,r=p.__PosthogExtensions__;M(r)||M(r.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:s}=r.postHogWebVitalsCallbacks),e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.Lr.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.Lr.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Lr.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.Lr.bind(this)),this.ar=!0):rZ.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.mr=!(null==(t=this._instance.persistence)||!t.props[tb]),this.startIfEnabled()}get zr(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=T(this.zr)?null==(e=this.zr)?void 0:e.web_vitals_allowed_metrics:void 0;return L(i)?(null==(t=this._instance.persistence)?void 0:t.props[tE])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(T(this.zr)?this.zr.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=T(this.zr)?this.zr.web_vitals_attribution:void 0;return null!=e&&e}get Nr(){var e=T(this.zr)&&D(this.zr.__web_vitals_max_value)?this.zr.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}get isEnabled(){var e=null==o?void 0:o.protocol;if("http:"!==e&&"https:"!==e)return rZ.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=T(this.zr)?this.zr.web_vitals:U(this.zr)?this.zr:void 0;return U(t)?t:this.mr}startIfEnabled(){this.isEnabled&&!this.ar&&(rZ.info("enabled, starting..."),this.Y(this.jr))}onRemoteConfig(e){if("capturePerformance"in e){var t=T(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=T(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[tb]:t}),this._instance.persistence.register({[tE]:i})),this.mr=t,this.startIfEnabled()}}Y(e){var t,i;null!=(t=p.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?rZ.error("failed to load script",t):e()})}Ur(){var e=s?s.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties;return iN(e,this._instance.config.mask_personal_data_properties?[...ij,...t||[]]:[],iH)}rZ.error("Could not determine current URL")}}},{exceptionObserver:class{constructor(e){var t,i,r;this.jr=()=>{var e;if(s&&this.isEnabled&&null!=(e=p.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=p.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=p.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=p.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Br&&this.N.capture_unhandled_errors&&(this.Br=t(this.captureException.bind(this))),!this.Hr&&this.N.capture_unhandled_rejections&&(this.Hr=i(this.captureException.bind(this))),!this.qr&&this.N.capture_console_errors&&(this.qr=r(this.captureException.bind(this)))}catch(e){rJ.error("failed to start",e),this.Wr()}}},this._instance=e,this.Vr=!(null==(t=this._instance.persistence)||!t.props[tf]),this.Yr=new J({refillRate:null!=(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)?i:1,bucketSize:null!=(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)?r:10,refillInterval:1e4,h:rJ}),this.N=this.Gr(),this.startIfEnabledOrStop()}Gr(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return T(e)?t=m({},t,e):(M(e)?this.Vr:e)&&(t=m({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.N.capture_console_errors||this.N.capture_unhandled_errors||this.N.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(rJ.info("enabled"),this.Wr(),this.Y(this.jr)):this.Wr()}Y(e){var t,i;
1null!=(t=p.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return rJ.error("failed to load script",t);e()})}Wr(){var e,t,i;null==(e=this.Br)||e.call(this),this.Br=void 0,null==(t=this.Hr)||t.call(this),this.Hr=void 0,null==(i=this.qr)||i.call(this),this.qr=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.Vr=!!e.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register({[tf]:this.Vr}),this.N=this.Gr(),this.startIfEnabledOrStop())}onConfigChange(){this.N=this.Gr()}captureException(e){var t,i,s,r=null!=(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)?t:"Exception";this.Yr.consumeRateLimit(r)?rJ.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(s=this._instance.exceptions)||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,i;this.Jr=[],this.Kr=new eY([new e6,new tn,new e4,new e8,new ts,new ti,new e9,new tr],function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];return function(t,s){void 0===s&&(s=0);for(var r=[],n=t.split("\n"),a=s;n.length>a;a++){var o=n[a];if(1024>=o.length){var l=e5.test(o)?o.replace(e5,"$1"):o;if(!l.match(/\S*Error: /)){for(var u of i){var c=u(l,e);if(c){r.push(c);break}}if(r.length>=50)break}}}if(!r.length)return[];var h=Array.from(r);return h.reverse(),h.slice(0,50).map(e=>m({},e,{filename:e.filename||(h[h.length-1]||{}).filename,function:e.function||"?"}))}}("web:javascript",e0,e3)),this._instance=e,this.Jr=null!=(t=null==(i=this._instance.persistence)?void 0:i.get_property(tm))?t:[]}onRemoteConfig(e){var t,i,s;if("errorTracking"in e){var r=null!=(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)?t:[],n=null==(s=e.errorTracking)?void 0:s.captureExtensionExceptions;this.Jr=r,this._instance.persistence&&this._instance.persistence.register({[tm]:this.Jr,[ty]:n})}}get Xr(){var e,t=!!this._instance.get_property(ty),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=i?i:t)&&e}buildProperties(e,t){return this.Kr.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.Qr(t)){if(this.Zr(t))return void nw.info("Skipping exception capture because a suppression rule matched");if(!this.Xr&&this.ts(t))return void nw.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.es(t))return void nw.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",Ui:!0})}Zr(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:i,value:s}=t;return A(i)&&i.length>0&&e.$exception_types.push(i),A(s)&&s.length>0&&e.$exception_values.push(s),e},{$exception_types:[],$exception_values:[]});return this.Jr.some(e=>{var i=e.values.map(e=>{var i,s=sZ[e.operator],r=C(e.value)?e.value:[e.value],n=null!=(i=t[e.key])?i:[];return r.length>0&&s(r,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}ts(e){return e.flatMap(e=>{var t,i;return null!=(t=null==(i=e.stacktrace)?void 0:i.frames)?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}es(e){if(e.length>0){var t,i,s,r,n=null!=(t=null==(i=e[0].stacktrace)?void 0:i.frames)?t:[],a=n[n.length-1];return null!=(s=null==a||null==(r=a.filename)?void 0:r.includes("posthog.com/static"))&&s}return!1}Qr(e){return!L(e)&&C(e)}}},nI,{siteApps:class{constructor(e){this._instance=e,this.os=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ls(e,t){if(t){var i=this.globalsForEvent(t);this.os.push(i),this.os.length>1e3&&(this.os=this.os.slice(10))}}get siteAppLoaders(){var e;return null==(e=p._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.ls.bind(this));this.us=()=>{e(),this.os=[],this.us=void 0}}}globalsForEvent(e){if(!e)throw Error("Event payload is required");var t,i,s,r,n,a,o,l={},u=this._instance.get_property("$groups")||[];for(var[c,h]of Object.entries(this._instance.get_property("$stored_group_properties")||{}))l[c]={id:u[c],type:c,properties:h};var{$set_once:d,$set:p}=e;return{event:m({},y(e,r9),{properties:m({},e.properties,p?{$set:m({},null!=(t=null==(i=e.properties)?void 0:i.$set)?t:{},p)}:{},d?{$set_once:m({},null!=(s=null==(r=e.properties)?void 0:r.$set_once)?s:{},d)}:{}),elements_chain:null!=(n=null==(a=e.properties)?void 0:a.$elements_chain)?n:"",distinct_id:null==(o=e.properties)?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.os.length&&(ne.info("Processing "+this.os.length+" events for site app with id "+e.id),this.os.forEach(e
1=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.us)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,ne.info("Site app with id "+e.id+" "+(r?"loaded":"errored")),s&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback(e){r(e)}});n&&(t.processEvent=n),s=!0}catch(t){ne.error(nt+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){ne.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}hs(){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)}ds(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(t){ne.error("Error while processing event "+e.event+" for site app "+i.id,t)}}}onRemoteConfig(e){var t,i,s,r=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.hs(),void this._instance.on("eventCaptured",e=>this.ds(e))):void ne.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.us)||i.call(this),null!=(s=e.siteApps)&&s.length)if(this.isEnabled){var n=function(e){var t;p["__$$ph_site_app_"+e]=r._instance,null==(t=p.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(r._instance,o,t=>{if(t)return ne.error(nt+e,t)})};for(var{id:a,url:o}of e.siteApps)n(a)}else ne.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},n$,{tracingHeaders:class{constructor(e){this.vs=void 0,this.cs=void 0,this.jr=()=>{var e,t;M(this.vs)&&(null==(e=p.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),M(this.cs)&&(null==(t=p.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}initialize(){this.startIfEnabledOrStop()}Y(e){var t,i;null!=(t=p.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=p.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return rX.error("failed to load script",t);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.Y(this.jr):(null==(e=this.vs)||e.call(this),null==(t=this.cs)||t.call(this),this.vs=void 0,this.cs=void 0)}}},{toolbar:class{constructor(e){this.instance=e}xs(e){p.ph_toolbar_state=e}Ts(){var e;return null!=(e=p.ph_toolbar_state)?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),ir(this.instance.config)||!s||!a)return!1;e=null!=e?e:s.location,i=null!=i?i:s.history;try{if(!t){try{s.localStorage.setItem("test","test"),s.localStorage.removeItem("test")}catch(e){return!1}t=null==s?void 0:s.localStorage}var r,n=nl||iL(e.hash,"__posthog")||iL(e.hash,"state"),o=n?t9(()=>JSON.parse(atob(decodeURIComponent(n))))||t9(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?((r=o).source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(nu)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(e){return!1}}$s(e){var t=p.ph_load_toolbar||p.ph_load_editor;!L(t)&&O(t)?t(e,this.instance):nc.warn("No toolbar load function found")}loadToolbar(e){var t,i=!(null==a||!a.getElementById(tz));if(!s||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=m({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});return(s.localStorage.setItem(nu,JSON.stringify(m({},n,{source:void 0}))),2===this.Ts())?this.$s(n):0===this.Ts()&&(this.xs(1),null==(t=p.__PosthogExtensions__)||null==t.loadExternalDependency||t.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return nc.error("[Toolbar] Failed to load",e),void this.xs(0);this.xs(2),this.$s(n)}),is(s,"turbolinks:load",()=>{this.xs(0),this.loadToolbar(n)})),!0}ks(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}},nC,{conversations:class{constructor(e){this.Rs=void 0,this._conversationsManager=null,this.Ps=!1,this.Os=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;L(t)||(U(t)?this.Rs=t:(this.Rs=t.enabled,this.Os=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.Rs=void 0,this.Os=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ps||this._instance.config.disable_conversations||ir(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==p?void 0:p.__PosthogExtensions__;if(e&&!M(this.Rs)&&this.Rs)if(this.Os&&this.Os.token){this.Ps=!0;try{var t=e.initConversations;if(t)return this.Is(t),void(this.Ps=!1);var i=e.loadExternalDependency;if(!i)return void this.Cs(tG);i(this._instance,"conversations",t=>{t||!e.initConversations?this.Cs("Could not load conversations script",t):this.Is(e.initConversations),this.Ps=!1})}catch(e){this.Cs("Error initializing conversations",e),this.Ps=!1}}else nS.error("Conversations enabled but missing token in remote config.")}}Is(e){if(this.Os)try{this._conversationsManager=e(this.Os,this._instance),nS.info("Conversations loaded successfully")}catch(e){this.Cs("Error completing conversations initialization",e)}else nS.error("Cannot complete initialization: remote config is null")}Cs(e,t){nS.error(e,t),this._conversationsManager=null,this.Ps=!1}show(){this._conversationsManager?this._conversationsManager.show():nS.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Rs&&null!==this._conversationsManager}isVisible(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}sendMessage(e,t,i){var s=this;return f(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(nS.warn(nP),null)})()}getMessages(e,t){var i=this;return f(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(nS.warn(nP),null)})()}markAsRead(e){var t=this;return f(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(nS.warn(nP),null)})()}getTickets(e){var t=this;return f(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(nS.warn(nP),null)})()}requestRestoreLink(e){var t=this;return f(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(nS.warn(nP),null)})()}restoreFromToken(e){var t=this;return f(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(nS.warn(nP),null)})()}restoreFromUrlToken(){var e=this;return f(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(nS.warn(nP),null)})()}getCurrentTicketId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}getWidgetSessionId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}}},{logs:class{constructor(e){var t;this.Fs=!1,this.As=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.Fs=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!L(i)&&i&&(this.Fs=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Fs&&!this.As){var e=tl("[logs]"),t=null==p?void 0:p.__PosthogExtensions__;if(t){var i=t.loadExternalDependency;i?i(this._instance,"logs",i=>{var s;i||null==(s=t.logs)||!s.initializeLogs?e.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.As=!0)}):e.error(tG)}else e.error("PostHog Extensions not found.")}}}});rv.__defaultExtensionClasses=m({},nO);var nT,nR=(nT=ri[ru]=new rv,function(){function e(){e.done||(e.done=!0,rc=!1,t8(ri,function(e){e._dom_loaded()}))}null!=a&&a.addEventListener?"complete"===a.readyState?e():is(a,"DOMContentLoaded",e,{capture:!1}):s&&to.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),nT)}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.