posthog-js 1.366.1 → 1.366.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/conversations.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/logs.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/product-tours.js +1 -1
- package/dist/surveys-preview.js +1 -1
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.js +1 -1
- package/dist/surveys.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function t(t){return function(){var i=this,s=arguments;return new Promise((function(r,n){var o=t.apply(i,s);function a(t){e(o,r,n,a,l,"next",t)}function l(t){e(o,r,n,a,l,"throw",t)}a(void 0)}))}}function i(){return i=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},i.apply(null,arguments)}function s(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}var r="1.366.1",n={DEBUG:!1,LIB_VERSION:r,LIB_NAME:"web",JS_SDK_VERSION:r},o="$people_distinct_id",a="$device_id",l="__alias",u="__timers",c="$autocapture_disabled_server_side",d="$heatmaps_enabled_server_side",_="$exception_capture_enabled_server_side",h="$error_tracking_suppression_rules",p="$error_tracking_capture_extension_exceptions",g="$web_vitals_enabled_server_side",v="$dead_clicks_enabled_server_side",f="$product_tours_enabled_server_side",m="$web_vitals_allowed_metrics",y="$session_recording_remote_config",b="$sesid",w="$session_is_sampled",E="$enabled_feature_flags",S="$early_access_features",x="$feature_flag_details",k="$stored_person_properties",I="$stored_group_properties",P="$surveys",T="$flag_call_reported",C="$flag_call_reported_session_id",R="$feature_flag_errors",F="$feature_flag_evaluated_at",L="$user_state",O="$client_session_props",M="$capture_rate_limit",A="$initial_campaign_params",D="$initial_referrer_info",N="$initial_person_info",U="$epp",q="__POSTHOG_TOOLBAR__",H="$posthog_cookieless",z=[o,l,"__cmpns",u,"$session_recording_enabled_server_side",d,b,E,h,L,S,x,I,k,P,T,C,R,F,O,M,A,D,U,N],j="PostHog loadExternalDependency extension not found.",B="on_reject",V="always",W="anonymous",G="identified",Y="identified_only",K="visibilitychange",J="beforeunload",X="$pageview",Q="$pageleave",Z="$identify",ee="$groupidentify",te="undefined"!=typeof window?window:void 0,ie="undefined"!=typeof globalThis?globalThis:te;"undefined"==typeof self&&(ie.self=ie),"undefined"==typeof File&&(ie.File=function(){});var se=null==ie?void 0:ie.navigator,re=null==ie?void 0:ie.document,ne=null==ie?void 0:ie.location,oe=null==ie?void 0:ie.fetch,ae=null!=ie&&ie.XMLHttpRequest&&"withCredentials"in new ie.XMLHttpRequest?ie.XMLHttpRequest:void 0,le=null==ie?void 0:ie.AbortController,ue=null==ie?void 0:ie.CompressionStream,ce=null==se?void 0:se.userAgent,de=null!=te?te:{};function _e(){return(_e=t((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 he=["$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"],pe=["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"],ge=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return pe.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function ve(e,t){return-1!==e.indexOf(t)}var fe=function(e){return e.trim()},me=function(e){return e.replace(/^\$/,"")},ye=Object.prototype,be=ye.hasOwnProperty,we=ye.toString,Ee=Array.isArray||function(e){return"[object Array]"===we.call(e)},Se=e=>"function"==typeof e,xe=e=>e===Object(e)&&!Ee(e),ke=e=>{if(xe(e)){for(var t in e)if(be.call(e,t))return!1;return!0}return!1},Ie=e=>void 0===e,Pe=e=>"[object String]"==we.call(e),Te=e=>Pe(e)&&0===e.trim().length,Ce=e=>null===e,Re=e=>Ie(e)||Ce(e),Fe=e=>"[object Number]"==we.call(e)&&e==e,Le=e=>Fe(e)&&e>0,Oe=e=>"[object Boolean]"===we.call(e),$e=e=>e instanceof FormData,Me=e=>ve(he,e);function Ae(e){return null===e||"object"!=typeof e}function De(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Ne(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var Ue=[!0,"true",1,"1","yes"],qe=e=>ve(Ue,e),He=[!1,"false",0,"0","no"];function ze(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),Fe(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),ze(r||i,t,i,s))}class je{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=ze(e.bucketSize,0,100,e._logger),this._refillRate=ze(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=ze(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){var i=Math.floor((t-e.lastAccess)/this._refillInterval);i>0&&(e.tokens=Math.min(e.tokens+i*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+i*this._refillInterval)}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this._buckets[s];return r?this._applyRefill(r,i):this._buckets[s]=r={tokens:this._bucketSize,lastAccess:i},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===r.tokens)}stop(){this._buckets={}}}var Be,Ve,We,Ge="Mobile",Ye="iOS",Ke="Android",Je="Tablet",Xe=Ke+" "+Je,Qe="iPad",Ze="Apple",et=Ze+" Watch",tt="Safari",it="BlackBerry",st="Samsung",rt=st+"Browser",nt=st+" Internet",ot="Chrome",at=ot+" OS",lt=ot+" "+Ye,ut="Internet Explorer",ct=ut+" "+Ge,dt="Opera",_t=dt+" Mini",ht="Edge",pt="Microsoft "+ht,gt="Firefox",vt=gt+" "+Ye,ft="Nintendo",mt="PlayStation",yt="Xbox",bt=Ke+" "+Ge,wt=Ge+" "+tt,Et="Windows",St=Et+" Phone",xt="Nokia",kt="Ouya",It="Generic",Pt=It+" "+Ge.toLowerCase(),Tt=It+" "+Je.toLowerCase(),Ct="Konqueror",Rt="(\\d+(\\.\\d+)?)",Ft=new RegExp("Version/"+Rt),Lt=new RegExp(yt,"i"),Ot=new RegExp(mt+" \\w+","i"),$t=new RegExp(ft+" \\w+","i"),Mt=new RegExp(it+"|PlayBook|BB10","i"),At={"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"},Dt=function(e,t){return t=t||"",ve(e," OPR/")&&ve(e,"Mini")?_t:ve(e," OPR/")?dt:Mt.test(e)?it:ve(e,"IE"+Ge)||ve(e,"WPDesktop")?ct:ve(e,rt)?nt:ve(e,ht)||ve(e,"Edg/")?pt:ve(e,"FBIOS")?"Facebook "+Ge:ve(e,"UCWEB")||ve(e,"UCBrowser")?"UC Browser":ve(e,"CriOS")?lt:ve(e,"CrMo")||ve(e,ot)?ot:ve(e,Ke)&&ve(e,tt)?bt:ve(e,"FxiOS")?vt:ve(e.toLowerCase(),Ct.toLowerCase())?Ct:((e,t)=>t&&ve(t,Ze)||function(e){return ve(e,tt)&&!ve(e,ot)&&!ve(e,Ke)}(e))(e,t)?ve(e,Ge)?wt:tt:ve(e,gt)?gt:ve(e,"MSIE")||ve(e,"Trident/")?ut:ve(e,"Gecko")?gt:""},Nt={[ct]:[new RegExp("rv:"+Rt)],[pt]:[new RegExp(ht+"?\\/"+Rt)],[ot]:[new RegExp("("+ot+"|CrMo)\\/"+Rt)],[lt]:[new RegExp("CriOS\\/"+Rt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Rt)],[tt]:[Ft],[wt]:[Ft],[dt]:[new RegExp("(Opera|OPR)\\/"+Rt)],[gt]:[new RegExp(gt+"\\/"+Rt)],[vt]:[new RegExp("FxiOS\\/"+Rt)],[Ct]:[new RegExp("Konqueror[:/]?"+Rt,"i")],[it]:[new RegExp(it+" "+Rt),Ft],[bt]:[new RegExp("android\\s"+Rt,"i")],[nt]:[new RegExp(rt+"\\/"+Rt)],[ut]:[new RegExp("(rv:|MSIE )"+Rt)],Mozilla:[new RegExp("rv:"+Rt)]},Ut=function(e,t){var i=Dt(e,t),s=Nt[i];if(Ie(s))return null;for(var r=0;s.length>r;r++){var n=e.match(s[r]);if(n)return parseFloat(n[n.length-2])}return null},qt=[[new RegExp(yt+"; "+yt+" (.*?)[);]","i"),e=>[yt,e&&e[1]||""]],[new RegExp(ft,"i"),[ft,""]],[new RegExp(mt,"i"),[mt,""]],[Mt,[it,""]],[new RegExp(Et,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[St,""];if(new RegExp(Ge).test(t)&&!/IEMobile\b/.test(t))return[Et+" "+Ge,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=At[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[Et,s]}return[Et,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Ye,[e[3],e[4],e[5]||"0"].join(".")]:[Ye,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Ie(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ke+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ke+")","i"),e=>e&&e[2]?[Ke,[e[2],e[3],e[4]||"0"].join(".")]:[Ke,""]],[/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/,[at,""]],[/Linux|debian/i,["Linux",""]]],Ht=function(e){return $t.test(e)?ft:Ot.test(e)?mt:Lt.test(e)?yt:new RegExp(kt,"i").test(e)?kt:new RegExp("("+St+"|WPDesktop)","i").test(e)?St:/iPad/.test(e)?Qe:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?et:Mt.test(e)?it:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(xt,"i").test(e)?xt:/(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(Ge).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)?Ke:Xe:new RegExp("(pda|"+Ge+")","i").test(e)?Pt:new RegExp(Je,"i").test(e)&&!new RegExp(Je+" pc","i").test(e)?Tt:""},zt=e=>e instanceof Error;function jt(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return We&&i.length===Ve||(Ve=i.length,We=i.reduce(((i,s)=>{Be||(Be={});var r=Be[s];if(r)i[r[0]]=r[1];else for(var n=e(s),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[s];if(l&&u){i[l]=u,Be[s]=[l,u];break}}return i}),{})),We}}class Bt{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 i=this;return t((function*(){for(var t of e)t.stacktrace&&t.stacktrace.frames&&Ee(t.stacktrace.frames)&&(t.stacktrace.frames=yield i.applyModifiers(t.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 s,r;return null!=e.cause&&(s=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),i({},e,{cause:s,stack:r})}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 i=this;return t((function*(){var t=e;for(var s of i.modifiers)t=yield s(t);return t}))()}convertToExceptionList(e,t){var s,r,n,o={type:e.type,value:e.value,mechanism:{type:null!==(s=t.type)&&void 0!==s?s:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(n=e.synthetic)&&void 0!==n&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,i({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:jt(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,s){void 0===s&&(s=0);var r=(i,s)=>{if(4>=s){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return i({},t,{syntheticException:0==s?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,s),next:e=>r(e,s+1)})}}var Vt="?";function Wt(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?Vt:i,in_app:!0};return Ie(s)||(n.lineno=s),Ie(r)||(n.colno=r),n}var Gt=(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]:Vt,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Yt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Kt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Jt=/\((\S*)(?::(\d+))(?::(\d+))\)/,Xt=(e,t)=>{var i=Yt.exec(e);if(i){var[,s,r,n]=i;return Wt(t,s,Vt,+r,+n)}var o=Kt.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=Jt.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Gt(o[1]||Vt,o[2]);return Wt(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Qt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Zt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ei=(e,t)=>{var i=Qt.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=Zt.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]||Vt;return[n,r]=Gt(n,r),Wt(t,r,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},ti=/\(error: (.*)\)/;class ii{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=Pe(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 De(e,"DOMException")}isDOMError(e){return De(e,"DOMError")}}class si{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}}class ri{constructor(){}match(e){return De(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 ni=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class oi{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(ni);return s&&(t=s[1],i=s[2]),[t,i]}}var ai=["fatal","error","warning","log","info","debug"];function li(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 ui{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 Ne(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: "+li(e)}isSeverityLevel(e){return Pe(e)&&!Te(e)&&ai.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(zt(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class ci{match(e){return Ne(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+li(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class di{match(e){return Ae(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 _i{match(e){return De(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Ne(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 Ae(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 hi=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={_log(t){if(te&&(n.DEBUG||de.POSTHOG_DEBUG||i)&&!Ie(te.console)&&te.console){for(var s=("__rrweb_original__"in te.console[t]?te.console[t].__rrweb_original__:te.console[t]),r=arguments.length,o=new Array(r>1?r-1:0),a=1;r>a;a++)o[a-1]=arguments[a];s(e,...o)}},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>hi(e+" "+t,i)};return s},pi=hi("[PostHog.js]"),gi=pi.createLogger;function vi(e,t){Ee(e)&&e.forEach(t)}function fi(e,t){if(!Re(e))if(Ee(e))e.forEach(t);else if($e(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)be.call(e,i)&&t(e[i],i)}var mi=function(e){for(var t=arguments.length,i=new 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 yi(e){for(var t=Object.keys(e),i=t.length,s=new Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var bi=function(e){try{return e()}catch(e){return}},wi=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){pi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),pi.critical(e)}}},Ei=function(e){var t={};return fi(e,(function(e,i){(Pe(e)&&e.length>0||Fe(e))&&(t[i]=e)})),t};var Si=["herokuapp.com","vercel.app","netlify.app"];function xi(e){var t=null==e?void 0:e.hostname;if(!Pe(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of Si)if(i===s)return!1;return!0}function ki(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 Ii(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 Fe(e)&&isFinite(e)&&Math.floor(e)===e});class Pi{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/Math.pow(2,8),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 Pi(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 new Error("Invalid UUIDv7 was generated");return e}clone(){return new Pi(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 Ti{constructor(){this._timestamp=0,this._counter=0,this._random=new Fi}generate(){var e=this.generateOrAbort();if(Ie(e)){this._timestamp=0;var t=this.generateOrAbort();if(Ie(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return Pi.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}}var Ci,Ri=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new 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};te&&!Ie(te.crypto)&&crypto.getRandomValues&&(Ri=e=>crypto.getRandomValues(e));class Fi{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(Ri(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var Li=()=>Oi().toString(),Oi=()=>(Ci||(Ci=new Ti)).generate(),$i="",Mi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Ai={_is_supported:()=>!!re,_error(e){pi.error("cookieStore error: "+e)},_get(e){if(re){try{for(var t=e+"=",i=re.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}},_parse(e){var t;try{t=JSON.parse(Ai._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(re)try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=re),$i)return $i;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+Li();!$i&&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",$i=n)}return $i}(e);if(!i){var s=(e=>{var t=e.match(Mi);return t?t[0]:""})(e);s!==i&&pi.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(re.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&pi.warn("cookieStore warning: large cookie, len="+u.length),re.cookie=u,u}catch(e){return}},_remove(e,t){if(null!=re&&re.cookie)try{Ai._set(e,"",-1,t)}catch(e){return}}},Di=null,Ni={_is_supported(){if(!Ce(Di))return Di;var e=!0;if(Ie(te))e=!1;else try{var t="__mplssupport__";Ni._set(t,"xyz"),'"xyz"'!==Ni._get(t)&&(e=!1),Ni._remove(t)}catch(t){e=!1}return e||pi.error("localStorage unsupported; falling back to cookie store"),Di=e,e},_error(e){pi.error("localStorage error: "+e)},_get(e){try{return null==te?void 0:te.localStorage.getItem(e)}catch(e){Ni._error(e)}return null},_parse(e){try{return JSON.parse(Ni._get(e))||{}}catch(e){}return null},_set(e,t){try{null==te||te.localStorage.setItem(e,JSON.stringify(t))}catch(e){Ni._error(e)}},_remove(e){try{null==te||te.localStorage.removeItem(e)}catch(e){Ni._error(e)}}},Ui=[a,"distinct_id",b,w,U,N,L],qi={},Hi={_is_supported:()=>!0,_error(e){pi.error("memoryStorage error: "+e)},_get:e=>qi[e]||null,_parse:e=>qi[e]||null,_set(e,t){qi[e]=t},_remove(e){delete qi[e]}},zi=null,ji={_is_supported(){if(!Ce(zi))return zi;if(zi=!0,Ie(te))zi=!1;else try{var e="__support__";ji._set(e,"xyz"),'"xyz"'!==ji._get(e)&&(zi=!1),ji._remove(e)}catch(e){zi=!1}return zi},_error(e){pi.error("sessionStorage error: ",e)},_get(e){try{return null==te?void 0:te.sessionStorage.getItem(e)}catch(e){ji._error(e)}return null},_parse(e){try{return JSON.parse(ji._get(e))||null}catch(e){}return null},_set(e,t){try{null==te||te.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){ji._error(e)}},_remove(e){try{null==te||te.sessionStorage.removeItem(e)}catch(e){ji._error(e)}}};class Bi{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===V||0===this.consent||-1===this.consent&&(this._config.opt_out_capturing_by_default||this._config.cookieless_mode===B)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){var e=this._storage._get(this._storageKey);return qe(e)?1:ve(He,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Ni:Ai;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?Ai:Ni;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(qe(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==se?void 0:se.doNotTrack,null==se?void 0:se.msDoNotTrack,de.doNotTrack].some((e=>qe(e)))}}var Vi=gi("[Dead Clicks]"),Wi=()=>!0,Gi=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(v)),s=e.instance.config.capture_dead_clicks;return Oe(s)?s:!!xe(s)||i};class Yi{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}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({[v]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript((()=>{this._start()})):this.stop()}_loadScript(e){var t,i;null!=(t=de.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?Vi.error("failed to load script",t):e()}))}_start(){var e;if(re){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=de.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=xe(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=de.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(re),Vi.info("starting...")}}else Vi.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Vi.info("stopping..."))}}var Ki=gi("[SegmentIntegration]");var Ji="posthog-js";function Xi(e,t){var{organization:s,projectId:r,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{var l,u,c,d,_;if("*"!==o&&!o.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,g=(null==(l=t.exception)?void 0:l.values)||[],v=g.map((e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>i({},e,{platform:"web:javascript"})))}):void 0}))),f={$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==(d=g[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(_=g[0])?void 0:_.type,$sentry_tags:t.tags};return s&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+t.event_id),a&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Qi{constructor(e,t,i,s,r,n){this.name=Ji,this.setupOnce=function(o){o(Xi(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class Zi{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(pi.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==te?void 0:te.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;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:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(Ie(n)||Ie(o)||Ie(a)||Ie(l)||Ie(u)||Ie(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=n>1?ze(o/n,0,1,pi):1,_=n>1?ze(a/n,0,1,pi):1,h=l>1?ze(u/l,0,1,pi):1,p=l>1?ze(c/l,0,1,pi):1;s=mi(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:_,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var es=e=>{var t=null==re?void 0:re.createElement("a");return Ie(t)?null:(t.href=e,t)},ts=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(!Ee(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){pi.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},is=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");Ee(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(l[c]))}var _=a;return null!=o&&(_+="?"+u.join("&")),null!=r&&(_+="#"+r),_},ss=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},rs="https?://(.*)",ns=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],os=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ns],as="<masked>",ls=["li_fat_id"];function us(e,t,i){if(!re)return{};var s,r=t?[...ns,...i||[]]:[],n=cs(is(re.URL,r,as),e),o=(s={},fi(ls,(function(e){var t=Ai._get(e);s[e]=t||null})),s);return mi(o,n)}function cs(e,t){var i=os.concat(t||[]),s={};return fi(i,(function(t){var i=ts(e,t);s[t]=i||null})),s}function ds(e){var t=function(e){return e?0===e.search(rs+"google.([^/?]*)")?"google":0===e.search(rs+"bing.com")?"bing":0===e.search(rs+"yahoo.com")?"yahoo":0===e.search(rs+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!Ce(t)){s.$search_engine=t;var r=re?ts(re.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function _s(){return navigator.language||navigator.userLanguage}var hs="$direct";function ps(){return(null==re?void 0:re.referrer)||hs}function gs(e,t){var i=e?[...ns,...t||[]]:[],s=null==ne?void 0:ne.href.substring(0,1e3);return{r:ps().substring(0,1e3),u:s?is(s,i,as):void 0}}function vs(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==hs?hs:null==(t=es(i))?void 0:t.host};if(s){r.$current_url=s;var n=es(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname;var o=cs(s);mi(r,o)}if(i){var a=ds(i);mi(r,a)}return r}function fs(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function ms(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var ys=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class bs{constructor(e,t){this._config=e,this.props={},this._campaign_params_saved=!1,this._name=(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._storage=this._buildStorage(e),this.load(),e.debug&&pi.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this._disabled}_buildStorage(e){-1===ys.indexOf(e.persistence.toLowerCase())&&(pi.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=[...Ui,...e];return i({},Ni,{_parse(e){try{var t={};try{t=Ai._parse(e)||{}}catch(e){}var i=mi(t,JSON.parse(Ni._get(e)||"{}"));return Ni._set(e,i),i}catch(e){}return null},_set(e,i,s,r,n,o){try{Ni._set(e,i,void 0,void 0,o);var a={};t.forEach((e=>{i[e]&&(a[e]=i[e])})),Object.keys(a).length&&Ai._set(e,a,s,r,n,o)}catch(e){Ni._error(e)}},_remove(e,t){try{null==te||te.localStorage.removeItem(e),Ai._remove(e,t)}catch(e){Ni._error(e)}}})}(e.cookie_persisted_properties||[]),s=e.persistence.toLowerCase();return"localstorage"===s&&Ni._is_supported()?Ni:"localstorage+cookie"===s&&t._is_supported()?t:"sessionstorage"===s&&ji._is_supported()?ji:"memory"===s?Hi:"cookie"===s?Ai:t._is_supported()?t:Ai}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[F];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return fi(this.props,((t,i)=>{if(i===E&&xe(t)){if(!this._isFeatureFlagCacheStale())for(var s=Object.keys(t),r=0;s.length>r;r++)e["$feature/"+s[r]]=t[s[r]]}else-1===z.indexOf(i)&&(e[i]=t)})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=mi({},e))}}save(){this._disabled||this._storage._set(this._name,this.props,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)}remove(){this._storage._remove(this._name,!1),this._storage._remove(this._name,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(xe(e)){Ie(t)&&(t="None"),this._expire_days=Ie(i)?this._default_expiry:i;var s=!1;if(fi(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(xe(e)){this._expire_days=Ie(t)?this._default_expiry:t;var i=!1;if(fi(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._campaign_params_saved){var e=us(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);ke(Ei(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==re?void 0:re.referrer)?ds(e):{})}update_referrer_info(){var e;this.register_once({$referrer:ps(),$referring_domain:null!=re&&re.referrer&&(null==(e=es(re.referrer))?void 0:e.host)||hs},void 0)}set_initial_person_info(){this.props[A]||this.props[D]||this.register_once({[N]:gs(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};fi([D,A],(t=>{var i=this.props[t];i&&fi(i,(function(t,i){e["$initial_"+me(i)]=t}))}));var t,i,s=this.props[N];if(s){var r=(t=vs(s),i={},fi(t,(function(e,t){i["$initial_"+me(t)]=e})),i);mi(e,r)}return e}safe_merge(e){return fi(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this._default_expiry=this._expire_days=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._buildStorage(e),r=this.props;this.clear(),this._storage=s,this.props=r,this.save()}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove(),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[u]||{};i[e]=t,this.props[u]=i,this.save()}remove_event_timer(e){var t=(this.props[u]||{})[e];return Ie(t)||(delete this.props[u][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var ws={Activation:"events",Cancellation:"cancelEvents"},Es={Button:"button",Tab:"tab",Selector:"selector"},Ss={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},xs={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},ks={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Is={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Ps={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Ts={Once:"once",Recurring:"recurring",Always:"always"},Cs={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Rs={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Fs={Popover:"popover",Inline:"inline"},Ls={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Os={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},$s={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Ms=gi("[RateLimiter]");class As{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=>{Ms.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void Ms.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){var t,i,s;void 0===e&&(e=!1);var{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(M))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.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(M,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var Ds=gi("[RemoteConfig]");class Ns{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=de._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=de.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(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 Ds.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void Ds.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return Ds.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e),this._startRefreshInterval()}));this._onRemoteConfig(e),this._startRefreshInterval()}))}catch(e){Ds.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){this._instance._shouldDisableFlags()||"hidden"===(null==re?void 0:re.visibilityState)||this._instance.reloadFeatureFlags()}_startRefreshInterval(){var e;if(!this._refreshInterval){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this._refreshInterval=setInterval((()=>{this.refresh()}),t))}}_onRemoteConfig(e){var t;e||Ds.error("Failed to fetch remote config from PostHog."),this._instance._onRemoteConfig(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 Us=["fatal","error","warning","log","info","debug"],qs={GZipJS:"gzip-js",Base64:"base64"},Hs=Uint8Array,zs=Uint16Array,js=Uint32Array,Bs=new Hs([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]),Vs=new Hs([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]),Ws=new Hs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Gs=function(e,t){for(var i=new zs(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new js(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]},Ys=Gs(Bs,2),Ks=Ys[1];Ys[0][28]=258,Ks[258]=28;for(var Js=Gs(Vs,0)[1],Xs=new zs(32768),Qs=0;32768>Qs;++Qs){var Zs=(43690&Qs)>>>1|(21845&Qs)<<1;Xs[Qs]=((65280&(Zs=(61680&(Zs=(52428&Zs)>>>2|(13107&Zs)<<2))>>>4|(3855&Zs)<<4))>>>8|(255&Zs)<<8)>>>1}var er=function(e,t,i){for(var s=e.length,r=0,n=new zs(t);s>r;++r)++n[e[r]-1];var o,a=new zs(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new zs(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],d=a[e[r]-1]++<<c,_=d|(1<<c)-1;_>=d;++d)o[Xs[d]>>>l]=u}else for(o=new zs(s),r=0;s>r;++r)o[r]=Xs[a[e[r]-1]++]>>>15-e[r];return o},tr=new Hs(288);for(Qs=0;144>Qs;++Qs)tr[Qs]=8;for(Qs=144;256>Qs;++Qs)tr[Qs]=9;for(Qs=256;280>Qs;++Qs)tr[Qs]=7;for(Qs=280;288>Qs;++Qs)tr[Qs]=8;var ir=new Hs(32);for(Qs=0;32>Qs;++Qs)ir[Qs]=5;var sr=er(tr,9,0),rr=er(ir,5,0),nr=function(e){return(e/8>>0)+(7&e&&1)},or=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof zs?zs:e instanceof js?js:Hs)(i-t);return s.set(e.subarray(t,i)),s},ar=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},lr=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},ur=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 Hs(0),0];if(1==r){var o=new Hs(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(e,t){return e.f-t.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=c&&i[d].f>i[u].f?u++:d++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var _=n[0].s;for(s=1;r>s;++s)n[s].s>_&&(_=n[s].s);var h=new zs(_+1),p=cr(i[c-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new Hs(h),p]},cr=function(e,t,i){return-1==e.s?Math.max(cr(e.l,t,i+1),cr(e.r,t,i+1)):t[e.s]=i},dr=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new zs(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},_r=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},hr=function(e,t,i){var s=i.length,r=nr(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)},pr=function(e,t,i,s,r,n,o,a,l,u,c){ar(t,c++,i),++r[256];for(var d=ur(r,15),_=d[0],h=d[1],p=ur(n,15),g=p[0],v=p[1],f=dr(_),m=f[0],y=f[1],b=dr(g),w=b[0],E=b[1],S=new zs(19),x=0;m.length>x;++x)S[31&m[x]]++;for(x=0;w.length>x;++x)S[31&w[x]]++;for(var k=ur(S,7),I=k[0],P=k[1],T=19;T>4&&!I[Ws[T-1]];--T);var C,R,F,L,O=u+5<<3,M=_r(r,tr)+_r(n,ir)+o,A=_r(r,_)+_r(n,g)+o+14+3*T+_r(S,I)+(2*S[16]+3*S[17]+7*S[18]);if(M>=O&&A>=O)return hr(t,c,e.subarray(l,l+u));if(ar(t,c,1+(M>A)),c+=2,M>A){C=er(_,h,0),R=_,F=er(g,v,0),L=g;var D=er(I,P,0);for(ar(t,c,y-257),ar(t,c+5,E-1),ar(t,c+10,T-4),c+=14,x=0;T>x;++x)ar(t,c+3*x,I[Ws[x]]);c+=3*T;for(var N=[m,w],U=0;2>U;++U){var q=N[U];for(x=0;q.length>x;++x)ar(t,c,D[H=31&q[x]]),c+=I[H],H>15&&(ar(t,c,q[x]>>>5&127),c+=q[x]>>>12)}}else C=sr,R=tr,F=rr,L=ir;for(x=0;a>x;++x)if(s[x]>255){var H;lr(t,c,C[257+(H=s[x]>>>18&31)]),c+=R[H+257],H>7&&(ar(t,c,s[x]>>>23&31),c+=Bs[H]);var z=31&s[x];lr(t,c,F[z]),c+=L[z],z>3&&(lr(t,c,s[x]>>>5&8191),c+=Vs[z])}else lr(t,c,C[s[x]]),c+=R[s[x]];return lr(t,c,C[256]),c+R[256]},gr=new js([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),vr=function(){for(var e=new js(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),fr=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function mr(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=vr[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new Hs(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var d=c+65535;o>d?u=hr(l,u,e.subarray(c,d)):(l[c]=!0,u=hr(l,u,e.subarray(c,o)))}else{for(var _=gr[t-1],h=_>>>13,p=8191&_,g=(1<<i)-1,v=new zs(32768),f=new zs(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new js(25e3),E=new zs(288),S=new zs(32),x=0,k=0,I=(c=0,0),P=0,T=0;o>c;++c){var C=b(c),R=32767&c,F=f[C];if(v[R]=F,f[C]=R,c>=P){var L=o-c;if((x>7e3||I>24576)&&L>423){u=pr(e,l,0,w,E,S,k,I,T,c-T,u),I=x=k=0,T=c;for(var O=0;286>O;++O)E[O]=0;for(O=0;30>O;++O)S[O]=0}var M=2,A=0,D=p,N=R-F&32767;if(L>2&&C==b(c-N))for(var U=Math.min(h,L)-1,q=Math.min(32767,c),H=Math.min(258,L);q>=N&&--D&&R!=F;){if(e[c+M]==e[c+M-N]){for(var z=0;H>z&&e[c+z]==e[c+z-N];++z);if(z>M){if(M=z,A=N,z>U)break;var j=Math.min(N,z-2),B=0;for(O=0;j>O;++O){var V=c-N+O+32768&32767,W=V-v[V]+32768&32767;W>B&&(B=W,F=V)}}}N+=(R=F)-(F=v[R])+32768&32767}if(A){w[I++]=268435456|Ks[M]<<18|Js[A];var G=31&Ks[M],Y=31&Js[A];k+=Bs[G]+Vs[Y],++E[257+G],++S[Y],P=c+M,++x}else w[I++]=e[c],++E[e[c]]}}u=pr(e,l,!0,w,E,S,k,I,T,c-T,u)}return or(a,0,s+nr(u)+r)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),c=u.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:9==t.level?2:0,e[9]=3,0!=t.mtime&&fr(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)}}(u,t),fr(u,c-8,i.d()),fr(u,c-4,s),u}var yr=!!ae||!!oe,br="text/plain",wr=function(e,t,s){var r;void 0===s&&(s=!0);var[n,o]=e.split("?"),a=i({},t),l=null!==(r=null==o?void 0:o.split("&").map((e=>{var t,[i,r]=e.split("="),n=s&&null!==(t=a[i])&&void 0!==t?t:r;return delete a[i],i+"="+n})))&&void 0!==r?r:[],u=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return fi(e,(function(e,t){Ie(e)||Ie(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)})),r.join(t)}(a);return u&&l.push(u),n+"?"+l.join("&")},Er=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),Sr=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:i}=e;if(t){if(i===qs.GZipJS){var s=mr(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new Hs(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;i>o;++o){if(r+5>s.length){var a=new Hs(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return or(s,0,r)}(Er(t)),{mtime:0});return{contentType:br,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===qs.Base64){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Er(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Er(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Er(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},xr=function(){var e=t((function*(e){var t=Er(e.data),s=yield function(e,t){return _e.apply(this,arguments)}(t,n.DEBUG);if(!s)return e;var r=yield s.arrayBuffer();return i({},e,{_encodedBody:{contentType:br,body:r,estimatedSize:r.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),kr=[];oe&&kr.push({transport:"fetch",method(e){var t,s,{contentType:r,body:n,estimatedSize:o}=null!==(t=Sr(e))&&void 0!==t?t:{},a=new Headers;fi(e.headers,(function(e,t){a.append(t,e)})),r&&a.append("Content-Type",r);var l=e.url,u=null;if(le){var c=new le;u={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}oe(l,i({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&52428.8>(o||0),body:n,signal:null==(s=u)?void 0:s.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){pi.error(e)}null==e.callback||e.callback(s)})))).catch((t=>{pi.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>u?clearTimeout(u.timeout):null))}}),ae&&kr.push({transport:"XHR",method(e){var t,i=new ae;i.open(e.method||"GET",e.url,!0);var{contentType:s,body:r}=null!==(t=Sr(e))&&void 0!==t?t:{};fi(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!=se&&se.sendBeacon&&kr.push({transport:"sendBeacon",method(e){var t=wr(e.url,{beacon:"1"});try{var i,{contentType:s,body:r}=null!==(i=Sr(e))&&void 0!==i?i:{};if(!r)return;var n=r instanceof Blob?r:new Blob([r],{type:s});se.sendBeacon(t,n)}catch(e){}}});var Ir=3e3;class Pr{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=ze((null==t?void 0:t.flush_interval_ms)||Ir,250,5e3,pi.createLogger("flush interval"),Ir),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this._sendRequest(i({},e,{transport:"sendBeacon"}))}))}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout((()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&Ee(i.data)&&fi(i.data,(e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp})),e._sendRequest(i)};for(var s in t)i()}}),this._flushTimeoutMs))}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return fi(this._queue,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;Ie(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)})),this._queue=[],e}}var Tr=["retriesPerformedSoFar"];class Cr{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!Ie(te)&&"onLine"in te.navigator&&(this._areWeOnline=te.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},ki(te,"online",this._onlineListener),ki(te,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=s(e,Tr);Le(t)&&(r.url=wr(r.url,{retry_count:t})),this._instance._send_request(i({},r,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==r.callback||r.callback(e):this._enqueue(i({retriesPerformedSoFar:t},r))}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=Math.random()-.5;return Math.ceil(s+r*(s-i))}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});var r="Enqueued failed request for retry in "+i;navigator.onLine||(r+=" (Browser is offline)"),pi.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter((i=>e>i.retryAt||(t.push(i),!1)));if(this._queue=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Ie(te)||(this._onlineListener&&(te.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(te.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){pi.error(e)}this._queue=[]}}class Rr{constructor(e){this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){ki(te,"scroll",this._updateScrollData,{capture:!0}),ki(te,"scrollend",this._updateScrollData,{capture:!0}),ki(te,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==te?void 0:te.document.documentElement;var e=Ee(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==te?void 0:te.document.querySelector(t);if(i)return i}}scrollY(){if(this._scrollRoot){var e=this.scrollElement();return e&&e.scrollTop||0}return te&&(te.scrollY||te.pageYOffset||te.document.documentElement.scrollTop)||0}scrollX(){if(this._scrollRoot){var e=this.scrollElement();return e&&e.scrollLeft||0}return te&&(te.scrollX||te.pageXOffset||te.document.documentElement.scrollLeft)||0}}var Fr=e=>gs(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class Lr{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[O]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||Fr,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[O]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?vs(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 fi(Ei(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+me(i)]=t})),e}}class Or{constructor(){this._events={}}on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}}var $r=gi("[SessionId]");class Mr{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._eventEmitter=new Or,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Le(e)||!Le(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===V)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Li,this._windowIdGenerator=i||Li;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*ze(this._config.session_idle_timeout_seconds||1800,60,36e3,$r.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=ji._parse(this._window_id_storage_key),o=ji._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:ji._remove(this._window_id_storage_key),ji._set(this._primary_window_exists_storage_key,!0)}if(null!=(s=this._config.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this._config.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this._setSessionId(this._config.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){$r.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Ie(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&ji._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&ji._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?ji._parse(this._window_id_storage_key):null}_setSessionId(e,t,i){e===this._sessionId&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,this._persistence.register({[b]:[t,e,i]}))}_getSessionId(){var e=this._persistence.props[b];return Ee(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}destroy(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&te&&(te.removeEventListener(J,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._canUseSessionStorage()&&ji._remove(this._primary_window_exists_storage_key)},ki(te,J,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===V)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[s,r,n]=this._getSessionId(),o=this._getWindowId(),a=Le(n)&&Math.abs(i-n)>864e5,l=!1,u=!r,c=!u&&!e&&this._sessionHasBeenIdleTooLong(i,s);u||c||a?(r=this._sessionIdGenerator(),o=this._windowIdGenerator(),$r.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this._windowIdGenerator(),l=!0);var d=Le(s)&&e&&!a?s:i,_=Le(n)?n:(new Date).getTime();return this._setWindowId(o),this._setSessionId(r,d,_),e||this._resetIdleTimer(),l&&this._sessionIdChangedHandlers.forEach((e=>e(r,o,l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0))),{sessionId:r,windowId:o,sessionStartTimestamp:_,changeReason:l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:s}}_resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{var[e]=this._getSessionId();if(this._sessionHasBeenIdleTooLong((new Date).getTime(),e)){var t=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var Ar=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&ge(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some((e=>ge(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver},Dr=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 Nr(e,t,i){return Er({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var Ur={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=>Dr(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!Dr(t,e))))),icontains:(e,t)=>t.map(qr).some((t=>e.map(qr).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(qr).every((t=>e.map(qr).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)))}))},qr=e=>e.toLowerCase();function Hr(e,t){return!e||Object.entries(e).every((e=>{var[i,s]=e,r=null==t?void 0:t[i];if(Ie(r)||Ce(r))return!1;var n=[String(r)],o=Ur[s.operator];return!!o&&o(s.values,n)}))}var zr="custom",jr="i.posthog.com";class Br{constructor(e){this._regionCache={},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("."+jr,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[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":zr),this._regionCache[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===zr)return this.apiHost+t;var i=jr+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var Vr=gi("[Surveys]"),Wr="seenSurvey_",Gr=(e,t)=>{var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i},Yr=e=>((e,t)=>{var i=""+Wr+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+Wr+t.id+"_"+t.current_iteration),i})(0,e),Kr=[ks.Popover,ks.Widget,ks.API],Jr={ignoreConditions:!1,ignoreDelay:!1,displayType:Fs.Popover},Xr=gi("[PostHog ExternalIntegrations]"),Qr={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Zr{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return Xr.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,r,n;!s||null!=(i=de.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(Qr[t],(()=>{var i;null==(i=de.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!s&&null!=(r=de.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]&&(null==(n=de.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,s]of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;t(i)}}}var en={},tn=0,sn=()=>{},rn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',nn="Surveys module not available",on="sanitize_properties is deprecated. Use before_send instead",an="Invalid value for property_denylist config: ",ln="posthog",un=!yr&&-1===(null==ce?void 0:ce.indexOf("MSIE"))&&-1===(null==ce?void 0:ce.indexOf("Mozilla")),cn=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:xi(null==re?void 0:re.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:sn,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:ne&&Pe(null==ne?void 0:ne.search)&&-1!==ne.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==te||null==(t=te.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){pi.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:Y,before_send:void 0,request_queue_config:{flush_interval_ms:Ir},error_tracking:{},_onCapture:sn,__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))},dn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],_n=e=>{var t={};for(var[i,s]of dn)Ie(e[i])||(t[s]=e[i]);var r=mi({},t,e);return Ee(e.property_blacklist)&&(Ie(e.property_denylist)?r.property_denylist=e.property_blacklist:Ee(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:pi.error(an+e.property_denylist)),r};class hn{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){pi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class pn{_replaceExtension(e,t){if(e){var i=this._extensions.indexOf(e);-1!==i&&this._extensions.splice(i,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this.webPerformance=new hn,this._personProcessingSetOncePropertiesSent=!1,this.version=n.LIB_VERSION,this._internalEventEmitter=new Or,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=cn(),this.SentryIntegration=Qi,this.sentryIntegration=e=>function(e,t){var i=Xi(e,t);return{name:Ji,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new Rr(this),this.pageViewManager=new Zi(this),this.rateLimiter=new As(this),this.requestRouter=new Br(this),this.consent=new Bi(this),this.externalIntegrations=new Zr(this);var t=null!==(e=pn.__defaultExtensionClasses)&&void 0!==e?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=Pe(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=Pe(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>pi.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==ln){var s,r=null!==(s=en[i])&&void 0!==s?s:new pn;return r._init(e,t,i),en[i]=r,en[ln][i]=r,r}return this._init(e,t,i)}_init(e,t,s){var r,o;if(void 0===t&&(t={}),Ie(e)||Te(e))return pi.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._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person),this.set_config(mi({},cn(t.defaults),_n(t),{name:s,token:e})),this.config.on_xhr_error&&pi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:qs.GZipJS;var a=this._is_persistence_disabled();this.persistence=new bs(this.config,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new bs(i({},this.config,{persistence:"sessionStorage"}),a);var l=i({},this.persistence.props),u=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new Pr((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new Cr(this),this.__request_queue=[];var c=this.config.cookieless_mode===V||this.config.cookieless_mode===B&&this.consent.isExplicitlyOptedOut();if(c||(this.sessionManager=new Mr(this),this.sessionPropsManager=new Lr(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(pi.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(c)}),0)):(pi.info("Initializing extensions synchronously"),this._initExtensions(c)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&pi.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:l,s:u}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var d=t.bootstrap.distinctID,_=this.get_distinct_id(),h=this.persistence.get_property(L);if(t.bootstrap.isIdentifiedID&&null!=_&&_!==d&&h===W)this.identify(d);else if(t.bootstrap.isIdentifiedID&&null!=_&&_!==d&&h===G)pi.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 p=this.config.get_device_id(Li()),g=t.bootstrap.isIdentifiedID?p:d;this.persistence.set_property(L,t.bootstrap.isIdentifiedID?G:W),this.register({distinct_id:d,$device_id:g})}}if(c)this.register_once({distinct_id:H,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(Li());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(L,W)}return ki(te,"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()||Li();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(L,G)),t()},r=i.user();"then"in r&&Se(r.then)?r.then(s):s(r)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||Ki.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Ki.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Ki.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};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,X),identify:e=>t(e,Z),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),Se(this.config._onCapture)&&this.config._onCapture!==sn&&(pi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&pi.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}_initExtensions(e){var t,s,r,n,o,a,l,u=performance.now(),c=i({},pn.__defaultExtensionClasses,this.config.__extensionClasses),d=[];c.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new c.featureFlags(this)),c.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new c.exceptions(this)),c.historyAutocapture&&this._extensions.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this._extensions.push(new c.tracingHeaders(this)),c.siteApps&&this._extensions.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),c.autocapture&&this._extensions.push(this.autocapture=new c.autocapture(this)),c.surveys&&this._extensions.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new c.surveys(this)),c.logs&&this._extensions.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new c.logs(this)),c.conversations&&this._extensions.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new c.conversations(this)),c.productTours&&this._extensions.push(this.productTours=new c.productTours(this)),c.heatmaps&&this._extensions.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this._extensions.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Gi)),c.toolbar&&this._extensions.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new c.toolbar(this)),c.experiments&&this._extensions.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new c.experiments(this)),this._extensions.forEach((e=>{e.initialize&&d.push((()=>{null==e.initialize||e.initialize()}))})),d.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(d,u)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var i=e.shift();if(i)try{i()}catch(e){pi.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&&pi.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!re||!re.body)return pi.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ve(e.supportedCompression,qs.GZipJS)?qs.GZipJS:ve(e.supportedCompression,qs.Base64)?qs.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Y}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){pi.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=ne&&ne.hostname){var e=ne.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===V)&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new Ns(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&vi(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Q),null==(t=this._requestQueue)||t.unload(),null==(i=this._retryQueue)||i.unload()):this._shouldCapturePageleave()&&this.capture(Q,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(un?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=wr(e.url,{ip:this.config.ip?1:0}),e.headers=i({},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,s,r,o=i({},e);o.timeout=o.timeout||6e4,o.url=wr(o.url,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:o.compression});var a=null!==(t=o.transport)&&void 0!==t?t:"fetch",l=kr.filter((e=>!o.disableTransport||!e.transport||!o.disableTransport.includes(e.transport))),u=null!==(s=null==(r=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===a)return e[i]}(l))?void 0:r.method)&&void 0!==s?s:l[0].method;if(!u)throw new Error("No available transport method");"sendBeacon"!==a&&o.data&&o.compression===qs.GZipJS&&ue?xr(o).then((e=>{u(e)})).catch((()=>{u(o)})):u(o)})(i({},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)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){tn++;try{var t,i=[],s=[],r=[];vi(e,(e=>{e&&(Ee(t=e[0])?r.push(e):Se(e)?e.call(this):Ee(e)&&"alias"===t?i.push(e):Ee(e)&&-1!==t.indexOf("capture")&&Se(this[t])?r.push(e):s.push(e))}));var n=function(e,t){vi(e,(function(e){if(Ee(e[0])){var i=t;fi(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{tn--}}push(e){if(tn>0&&Ee(e)&&Pe(e[0])){var t=pn.prototype[e[0]];Se(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!Ie(e)&&Pe(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var c=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==c||!c.isRateLimited){null!=t&&t.$current_url&&!Pe(null==t?void 0:t.$current_url)&&(pi.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!=s&&s._originatedFromCaptureException||pi.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 d=new Date,_=(null==s?void 0:s.timestamp)||d,h=Li(),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},_,h)};e===X&&this.config.__preview_capture_bot_pageviews&&u&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),c&&(p.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens),(null==s?void 0:s.$set)&&(p.$set=null==s?void 0:s.$set);var g,v=this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==ee,e===Z);if(v&&(p.$set_once=v),null!=s&&s._noTruncate||(n=this.config.properties_string_max_length,o=p,a=e=>Pe(e)?e.slice(0,n):e,l=new Set,p=function e(t,i){return t!==Object(t)?a?a(t):t:l.has(t)?void 0:(l.add(t),Ee(t)?(s=[],vi(t,(t=>{s.push(e(t))}))):(s={},fi(t,((t,i)=>{l.has(t)||(s[i]=e(t,i))}))),s);var s}(o)),p.timestamp=_,Ie(null==s?void 0:s.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),e===Cs.DISMISSED||e===Cs.SENT){var f=null==t?void 0:t[Rs.SURVEY_ID],m=null==t?void 0:t[Rs.SURVEY_ITERATION];g={id:f,current_iteration:m},localStorage.getItem(Yr(g))||localStorage.setItem(Yr(g),"true"),p.$set=i({},p.$set,{[Gr({id:f,current_iteration:m},e===Cs.SENT?"responded":"dismissed")]:!0})}else e===Cs.SHOWN&&(p.$set=i({},p.$set,{[Rs.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===Os.SHOWN){var y=null==t?void 0:t[$s.TOUR_TYPE];y&&(p.$set=i({},p.$set,{[$s.TOUR_LAST_SEEN_DATE+"/"+y]:(new Date).toISOString()}))}var b=i({},p.properties.$set,p.$set);if(ke(b)||this.setPersonPropertiesForFlags(b),!Re(this.config.before_send)){var w=this._runBeforeSend(p);if(!w)return;p=w}this._internalEventEmitter.emit("eventCaptured",p);var E={method:"POST",url:null!==(r=null==s?void 0:s._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==s?void 0:s._batchKey};return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly?this._send_retriable_request(E):this._requestQueue.enqueue(E),p}pi.critical("This capture call is ignored due to client rate limiting.")}}else pi.error("No event name provided to posthog.capture")}else pi.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,s,r,o){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var a=o?void 0:this.persistence.remove_event_timer(e),l=i({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,(this.config.cookieless_mode==V||this.config.cookieless_mode==B&&this.consent.isExplicitlyOptedOut())&&(l.$cookieless_mode=!0),"$snapshot"===e){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!Pe(l.distinct_id)&&!Fe(l.distinct_id)||Te(l.distinct_id))&&pi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var c,d=function(e,t){var i,s,r,o;if(!ce)return{};var a,l,u,c,d,_,h,p,g=e?[...ns,...t||[]]:[],[v,f]=function(e){for(var t=0;qt.length>t;t++){var[i,s]=qt[t],r=i.exec(e),n=r&&(Se(s)?s(r,e):s);if(n)return n}return["",""]}(ce);return mi(Ei({$os:v,$os_version:f,$browser:Dt(ce,navigator.vendor),$device:Ht(ce),$device_type:(l=ce,u={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(s=navigator)?void 0:s.maxTouchPoints,screenWidth:null==te||null==(r=te.screen)?void 0:r.width,screenHeight:null==te||null==(o=te.screen)?void 0:o.height,devicePixelRatio:null==te?void 0:te.devicePixelRatio},p=Ht(l),p===Qe||p===Xe||"Kobo"===p||"Kindle Fire"===p||p===Tt?Je:p===ft||p===yt||p===mt||p===kt?"Console":p===et?"Wearable":p?Ge:"Android"===(null==u?void 0:u.userAgentDataPlatform)&&(null!==(c=null==u?void 0:u.maxTouchPoints)&&void 0!==c?c:0)>0?600>Math.min(null!==(d=null==u?void 0:u.screenWidth)&&void 0!==d?d:0,null!==(_=null==u?void 0:u.screenHeight)&&void 0!==_?_:0)/(null!==(h=null==u?void 0:u.devicePixelRatio)&&void 0!==h?h:1)?Ge:Je:"Desktop"),$timezone:fs(),$timezone_offset:ms()}),{$current_url:is(null==ne?void 0:ne.href,g,as),$host:null==ne?void 0:ne.host,$pathname:null==ne?void 0:ne.pathname,$raw_user_agent:ce.length>1e3?ce.substring(0,997)+"...":ce,$browser_version:Ut(ce,navigator.vendor),$browser_language:_s(),$browser_language_prefix:(a=_s(),"string"==typeof a?a.split("-")[0]:void 0),$screen_height:null==te?void 0:te.screen.height,$screen_width:null==te?void 0:te.screen.width,$viewport_height:null==te?void 0:te.innerHeight,$viewport_width:null==te?void 0:te.innerWidth,$lib:n.LIB_NAME,$lib_version:n.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:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,s.getTime());l.$session_id=_,l.$window_id=h}this.sessionPropsManager&&mi(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&mi(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===zr&&(l.$lib_custom_api_host=this.config.api_host),c=e!==X||o?e!==Q||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),l=mi(l,c),e===X&&re&&(l.title=re.title),!Ie(a)){var g=s.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}ce&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=mi({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Ee(this.config.property_denylist)?fi(this.config.property_denylist,(function(e){delete l[e]})):pi.error(an+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(pi.error(on),l=v(l,e));var f=this._hasPersonProcessing();return l.$process_person_profile=f,f&&!o&&this._requirePersonProcessing("_calculate_event_properties"),l}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=mi({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(pi.error(on),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),ke(o)?void 0:o}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)}_register_single(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._internalEventEmitter.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:nn}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:nn})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:nn})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=Jr),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))&&void 0!==t?t:{visible:!1,disabledReason:nn}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:nn})}_validateIdentifyId(e){return!e||Te(e)?(pi.critical("Unique user id has not been set in posthog.identify"),!1):e===H?(pi.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())||(pi.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 pi.uninitializedWarning("posthog.identify");if(Fe(e)&&(e=e.toString(),pi.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(L)||W)===W;e!==s&&n?(this.persistence.set_property(L,G),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(Z,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=Nr(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(T))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=Nr(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=i):pi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},r,{[e]:t})}),n||s){var o={$group_type:e,$group_key:t};s&&(o.$group_set=s),this.capture(ee,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else pi.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._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,r,n,o,l,u;if(pi.info("reset"),!this.__loaded)return pi.uninitializedWarning("posthog.reset");var c=this.get_property(a);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._remoteConfigLoader)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(l=this.persistence)||l.set_property(L,W),null==(u=this.sessionManager)||u.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===V)this.register_once({distinct_id:H,$device_id:null},"");else{var d=this.config.get_device_id(Li());this.register_once({distinct_id:d,$device_id:e?d:c},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}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)&&void 0!==e?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)&&void 0!==r?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(o)?(pi.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Ie(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(l,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(pi.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(xe(e)){var s,r,o,a,l,u,c,d,_;mi(this.config,_n(e));var h=this._is_persistence_disabled();null==(s=this.persistence)||s.update_config(this.config,t,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new bs(i({},this.config,{persistence:"sessionStorage"}),h);var p=this._checkLocalStorageForDebug(this.config.debug);Oe(p)&&(this.config.debug=p),Oe(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,Ni._is_supported()&&Ni._set("ph_debug",!0),pi.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(n.DEBUG=!1,Ni._is_supported()&&Ni._remove("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.autocapture)||a.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(d=this.surveys)||d.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(_=this.externalIntegrations)||_.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){n.LIB_NAME=e,n.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.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 s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(i({},r,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))&&void 0!==t&&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)&&void 0!==e?e:ln;return t!==ln&&(t=ln+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(L))===G||(null==(t=this.sessionPersistence)?void 0:t.get_property(L))===G}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===Y&&!this._isIdentified()&&ke(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[l])&&(null==(t=this.persistence)||null==(t=t.props)||!t[U]))}_shouldCapturePageleave(){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._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(pi.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(U,!0),!0)}_is_persistence_disabled(){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!==B)}_sync_opt_out_with_persistence(){var e,t,i,s,r=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==V){if(this.config.cookieless_mode===B&&this.consent.isExplicitlyOptedOut()){var i,s,r,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new Mr(this),this.pageViewManager=new Zi(this),this.persistence&&(this.sessionPropsManager=new Lr(this,this.sessionManager,this.persistence));var a=null!==(r=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==r?r:null==(o=pn.__defaultExtensionClasses)?void 0:o.sessionRecording;a&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new a(this)))}var l,u;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==B&&(null==(l=this.surveys)||l.loadIfEnabled()),(Ie(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(u=null==e?void 0:e.captureEventName)&&void 0!==u?u:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else pi.warn(rn)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==V?(this.config.cookieless_mode===B&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===B&&(this.register({distinct_id:H,$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._captureInitialPageview())):pi.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===V||(this.config.cookieless_mode===B?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return se?Ar(se,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){re&&("visible"===re.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(X,{title:re.title},{send_instantly:!0}),this._visibilityStateListener&&(re.removeEventListener(K,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),ki(re,K,this._visibilityStateListener)))}debug(e){!1===e?(null==te||te.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==te||te.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}))}_shouldDisableFlags(){var e,t,i,s,r,n,o=this._originalUserConfig||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(pi.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",!1,s=pi,r=(t="advanced_disable_flags")in(e=o)&&!Re(e[t]),n=i in e&&!Re(e[i]),r?e[t]:!!n&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}_runBeforeSend(e){if(Re(this.config.before_send))return e;var t=Ee(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),Re(i)){var r="Event '"+e.event+"' was rejected in beforeSend function";return Me(e.event)?pi.warn(r+". This can cause unexpected behavior."):pi.info(r),null}i.properties&&!ke(i.properties)||pi.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?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)})}_checkLocalStorageForDebug(e){var t=Oe(e)&&!e,i=Ni._is_supported()&&"true"===Ni._get("ph_debug");return!t&&(!!i||e)}}function gn(e){return e instanceof Element&&(e.id===q||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function vn(e){return!!e&&1===e.nodeType}function fn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function mn(e){return!!e&&3===e.nodeType}function yn(e){return!!e&&11===e.nodeType}function bn(e){return e?fe(e).split(/\s+/):[]}function wn(e){var t=null==te?void 0:te.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function En(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 bn(t)}function Sn(e){return Re(e)?null:fe(e).split(/(\s+)/).filter((e=>Hn(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function xn(e){var t="";return On(e)&&!$n(e)&&e.childNodes&&e.childNodes.length&&fi(e.childNodes,(function(e){var i;mn(e)&&e.textContent&&(t+=null!==(i=Sn(e.textContent))&&void 0!==i?i:"")})),fe(t)}function kn(e){return Ie(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}pn.__defaultExtensionClasses={},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=wi(e.prototype[t[i]])}(pn,["identify"]);var In=["a","button","form","input","select","textarea","label"];function Pn(e,t){if(Ie(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 Tn(e){var t=e.parentNode;return!(!t||!vn(t))&&t}var Cn=["next","previous","prev",">","<"],Rn=[".ph-no-rageclick",".ph-no-capture"];var Fn=e=>!e||fn(e,"html")||!vn(e),Ln=(e,t)=>{if(!te||Fn(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[e],r=e;r.parentNode&&!fn(r,"body");)if(yn(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=Tn(r);if(!n)break;if(t||In.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=te.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}s.push(n),r=n}return{parentIsUsefulElement:i,targetElementList:s}};function On(e){for(var t=e;t.parentNode&&!fn(t,"body");t=t.parentNode){var i=En(t);if(ve(i,"ph-sensitive")||ve(i,"ph-no-capture"))return!1}if(ve(En(e),"ph-include"))return!0;var s=e.type||"";if(Pe(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!Pe(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 $n(e){return!!(fn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||fn(e,"select")||fn(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Mn="(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})",An=new RegExp("^(?:"+Mn+")$"),Dn=new RegExp(Mn),Nn="\\d{3}-?\\d{2}-?\\d{4}",Un=new RegExp("^("+Nn+")$"),qn=new RegExp("("+Nn+")");function Hn(e,t){if(void 0===t&&(t=!0),Re(e))return!1;if(Pe(e)){if(e=fe(e),(t?An:Dn).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Un:qn).test(e))return!1}return!0}function zn(e){var t=xn(e);return Hn(t=(t+" "+jn(e)).trim())?t:""}function jn(e){var t="";return e&&e.childNodes&&e.childNodes.length&&fi(e.childNodes,(function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var s=xn(e);t=(t+" "+s).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+jn(e)).trim())}catch(e){pi.error("[AutoCapture]",e)}})),t}function Bn(e){return e.replace(/"|\\"/g,'\\"')}function Vn(e){var t=e.attr__class;return t?Ee(t)?t:bn(t):void 0}class Wn{constructor(e){this.disabled=!1===e;var t=xe(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 Gn="$copy_autocapture",Yn=gi("[AutoCapture]");function Kn(e,t){return t.length>e?t.slice(0,e)+"...":t}function Jn(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!vn(t));return t}function Xn(e,t){for(var s,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=t,c=[e],d=e;d.parentNode&&!fn(d,"body");)yn(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var _,h,p=[],g={},v=!1,f=!1;if(fi(c,(e=>{var t=On(e);"a"===e.tagName.toLowerCase()&&(v=e.getAttribute("href"),v=t&&v&&Hn(v)&&v),ve(En(e),"ph-no-capture")&&(f=!0),p.push(function(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};In.indexOf(r)>-1&&!i&&(n.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?Kn(1024,zn(e)):Kn(1024,xn(e)));var o=En(e);o.length>0&&(n.classes=o.filter((function(e){return""!==e}))),fi(e.attributes,(function(i){var r;if((!$n(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&Hn(i.value)&&(!Pe(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=i.value;"class"===i.name&&(o=bn(o).join(" ")),n["attr__"+i.name]=Kn(1024,o)}}));for(var a=1,l=1,u=e;u=Jn(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,o,a,l));var i=function(e){if(!On(e))return{};var t={};return fi(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&&Hn(s)&&(t[i]=s)}})),t}(e);mi(g,i)})),f)return{props:{},explicitNoCapture:f};if(a||(p[0].$el_text="a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?zn(e):xn(e)),v){var m,y;p[0].attr__href=v;var b=null==(m=es(v))?void 0:m.host,w=null==te||null==(y=te.location)?void 0:y.host;b&&w&&b!==w&&(_=v)}return{props:mi({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:(h=p,function(e){return e.map((e=>{var t,s,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))r+="."+n.replace(/"/g,"");var o=i({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(s=e.nth_of_type)&&void 0!==s?s:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return yi(o).sort(((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)})).forEach((e=>{var[t,i]=e;return a[Bn(t.toString())]=Bn(i.toString())})),(r+=":")+yi(a).map((e=>{var[t,i]=e;return t+'="'+i+'"'})).join("")})).join(";")}(function(e){return e.map((e=>{var t,i,s={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:Vn(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return yi(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,i]=e;return s.attributes[t]=i})),s}))}(h)))},null!=(s=p[0])&&s.$el_text?{$el_text:null==(r=p[0])?void 0:r.$el_text}:{},_&&"click"===n.type?{$external_click_url:_}:{},g)}}var Qn=gi("[ExceptionAutocapture]");function Zn(e,t,i){try{if(!(t in e))return()=>{};var s=e[t],r=i(s);return Se(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]=s}}catch(e){return()=>{}}}var eo=gi("[TracingHeaders]"),to=gi("[Web Vitals]"),io=9e5,so="disabled",ro="lazy_loading",no="awaiting_config",oo="missing_config";gi("[SessionRecording]");var ao="[SessionRecording]",lo=gi(ao),uo=gi("[Heatmaps]");function co(e){return xe(e)&&"clientX"in e&&"clientY"in e&&Fe(e.clientX)&&Fe(e.clientY)}var _o=gi("[Product Tours]"),ho="ph_product_tours",po=["$set_once","$set"],go=gi("[SiteApps]"),vo="Error while initializing PostHog app with config id ";function fo(e,t,i){if(Re(e))return!1;switch(i){case"exact":return e===t;case"contains":var s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class mo{constructor(e){this._debugEventEmitter=new Or,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),this._checkStepEvent=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this._actionEvents=new Set,this._actionRegistry=new Set}init(){var e,t;Ie(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(!Ie(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,i;null==(t=this._actionRegistry)||t.add(e),null==(i=e.steps)||i.forEach((e=>{var t;null==(t=this._actionEvents)||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._actionEvents.has(e)||this._actionEvents.has(null==t?void 0:t.event))&&this._actionRegistry&&(null==(i=this._actionRegistry)?void 0:i.size)>0&&this._actionRegistry.forEach((e=>{this._checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)}))}_addActionHook(e){this.onAction("actionCaptured",(t=>e(t)))}_checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this._checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(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)return!1;if(!fo(s,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var i;if(null==t||!t.href)return!0;var s=this._getElementsList(e);if(s.length>0)return s.some((e=>fo(e.href,t.href,t.href_matching||"exact")));var r,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&fo((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(null==t||!t.text)return!0;var s=this._getElementsList(e);if(s.length>0)return s.some((e=>fo(e.text,t.text,t.text_matching||"exact")||fo(e.$el_text,t.text,t.text_matching||"exact")));var r,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!Re(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",r.some((e=>fo(e,n,o))))}_checkStepSelector(e,t){var i,s;if(null==t||!t.selector)return!0;var 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}return!1}_getElementsList(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return null==t||!t.properties||0===t.properties.length||Hr(t.properties.reduce(((e,t)=>{var i=Ee(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 yo{constructor(e){this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map}_doesEventMatchFilter(e,t){return!!e&&Hr(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(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}_getMatchingItems(e,t,i){var s=(i===ws.Activation?this._eventToItems:this._cancelEventToItems).get(e),r=[];return this._getItems((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._doesEventMatchFilter(n,t)}))}register(e){var t;Ie(null==(t=this._instance)?void 0:t._addCaptureHook)||(this._setupEventBasedItems(e),this._setupActionBasedItems(e))}_setupActionBasedItems(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._actionMatcher&&(this._actionMatcher=new mo(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook((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._actionMatcher)||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._actionToItems.get(t.name);i&&i.push(e.id),this._actionToItems.set(t.name,i||[e.id])}})))})))}_setupEventBasedItems(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._eventToItems=this._buildEventToItemMap(e,ws.Activation),this._cancelEventToItems=this._buildEventToItemMap(e,ws.Cancellation))}onEvent(e,t){var i,s=this._getLogger(),r=this._getActivatedKey(),n=this._getShownEventName(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[r])||[];if(n===e&&t&&o.length>0){var a,l;s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var u=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(u){var c=o.indexOf(u);0>c||(o.splice(c,1),this._updateActivatedItems(o))}}else{if(this._cancelEventToItems.has(e)){var d=this._getMatchingItems(e,t,ws.Cancellation);d.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map((e=>e.id))}),d.forEach((e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this._cancelPendingItem(e.id)})),this._updateActivatedItems(o))}if(this._eventToItems.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var _=this._getMatchingItems(e,t,ws.Activation);this._updateActivatedItems(o.concat(_.map((e=>e.id))||[]))}}}onAction(e){var t,i=this._getActivatedKey(),s=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this._actionToItems.has(e)&&this._updateActivatedItems(s.concat(this._actionToItems.get(e)||[]))}_updateActivatedItems(e){var t,i=this._getLogger(),s=this._getActivatedKey(),r=[...new Set(e)].filter((e=>!this._isItemPermanentlyIneligible(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._getActivatedKey();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}}class bo extends yo{constructor(e){super(e)}_getActivatedKey(){return"$surveys_activated"}_getShownEventName(){return Cs.SHOWN}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return Vr}_isItemPermanentlyIneligible(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var wo="SDK is not enabled or survey functionality is not yet loaded",Eo="Disabled. Not loading surveys.",So=null!=te&&te.location?ss(te.location.hash,"__posthog")||ss(location.hash,"state"):null,xo="_postHogToolbarParams",ko=gi("[Toolbar]"),Io=gi("[FeatureFlags]"),Po=gi("[FeatureFlags]",{debugEnabled:!0}),To="\" failed. Feature flags didn't load in time.",Co="$active_feature_flags",Ro="$override_feature_flags",Fo="$feature_flag_payloads",Lo="$override_feature_flag_payloads",Oo="$feature_flag_request_id",$o=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},Mo=e=>{var t={};for(var[i,s]of yi(e||{}))s&&(t[i]=s);return t},Ao=gi("[Error tracking]"),Do="Refusing to render web experiment since the viewer is a likely bot",No={icontains:(e,t)=>!!te&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!te&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!te&&Dr(t.href,e),not_regex:(e,t)=>!!te&&!Dr(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Uo{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{Uo._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;t._flagToExperiments&&(Uo._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t._flagToExperiments)||i.set(e.feature_flag_key,e));var s=t._instance.getFeatureFlag(e.feature_flag_key);Pe(s)&&e.variants[s]&&t._applyTransforms(e.name,s,e.variants[s].transforms)}else if(e.variants)for(var r in e.variants){var n=e.variants[r];Uo._matchesTestVariant(n)&&t._applyTransforms(e.name,r,n.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())Uo._logInfo(Do);else if(!this._config.disable_web_experiments){if(Re(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Uo._logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this._flagToExperiments)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this._applyTransforms(r.name,s,r.variants[s].transforms)}}))}}previewWebExperiment(){var e=Uo.getWindowLocation();if(null!=e&&e.search){var t=ts(null==e?void 0:e.search,"__experiment_id"),i=ts(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Uo._logInfo("previewing web experiments "+t+" && "+i),this.getWebExperiments((e=>{this._showPreviewWebExperiment(parseInt(t),i,e)}),!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._config.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._config.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,t,i){var s=i.filter((t=>t.id===e));s&&s.length>0&&(Uo._logInfo("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this._applyTransforms(s[0].name,t,s[0].variants[t].transforms))}static _matchesTestVariant(e){return!Re(e.conditions)&&Uo._matchUrlConditions(e)&&Uo._matchUTMConditions(e)}static _matchUrlConditions(e){var t;if(Re(e.conditions)||Re(null==(t=e.conditions)?void 0:t.url))return!0;var i,s,r,n=Uo.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||No[null!==(s=null==(r=e.conditions)?void 0:r.urlMatchType)&&void 0!==s?s:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==te?void 0:te.location}static _matchUTMConditions(e){var t;if(Re(e.conditions)||Re(null==(t=e.conditions)?void 0:t.utm))return!0;var i=us();if(i.utm_source){var s,r,n,o,a,l,u,c,d=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==i.utm_campaign,_=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,h=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,p=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==i.utm_term;return d&&h&&p&&_}return!1}static _logInfo(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];pi.info("[WebExperiments] "+e,i)}_applyTransforms(e,t,i){this._is_bot()?Uo._logInfo(Do):"control"!==t?i.forEach((i=>{if(i.selector){var s;Uo._logInfo("applying transform of variant "+t+" for experiment "+e+" ",i);var r=null==(s=document)?void 0:s.querySelectorAll(i.selector);null==r||r.forEach((e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}})):Uo._logInfo("Control variants leave the page unmodified.")}_is_bot(){return se&&this._instance?Ar(se,this._config.custom_blocked_useragents):void 0}}var qo=gi("[Conversations]"),Ho="Conversations not available yet.",zo={featureFlags:class{constructor(e){this._override_warning=!1,this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this._hasLoggedDeprecationWarning=!1,this._staleCacheRefreshTriggered=!1,this._instance=e,this.featureFlagEventHandlers=[]}get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}_prop(e){return this._instance.get_property(e)}_isCacheStale(){var e,t;return null!==(e=null==(t=this._persistence)?void 0:t._isFeatureFlagCacheStale(this._config.feature_flag_cache_ttl_ms))&&void 0!==e&&e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,Io.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){var e,t=null!==(e=this._config.evaluation_contexts)&&void 0!==e?e:this._config.evaluation_environments;return!this._config.evaluation_environments||this._config.evaluation_contexts||this._hasLoggedDeprecationWarning||(Io.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._hasLoggedDeprecationWarning=!0),null!=t&&t.length?t.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||Io.error("Invalid evaluation context found:",e,"Expected non-empty string"),t})):[]}_shouldIncludeEvaluationEnvironments(){return this._getValidEvaluationEnvironments().length>0}initialize(){var e,t,{config:i}=this._instance,s=null!==(e=null==(t=i.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(s).length){var r,n,o=null!==(r=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==r?r:{},a=Object.keys(s).filter((e=>!!s[e])).reduce(((e,t)=>(e[t]=s[t]||!1,e)),{}),l=Object.keys(o).filter((e=>a[e])).reduce(((e,t)=>(o[t]&&(e[t]=o[t]),e)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,s){var r=null!=s&&s.merge?this.getFlagVariants():{},n=null!=s&&s.merge?this.getFlagPayloads():{},o=i({},r,e),a=i({},n,t),l={};for(var[u,c]of Object.entries(o)){var d="string"==typeof c;l[u]={key:u,enabled:!!d||Boolean(c),variant:d?c:void 0,reason:void 0,metadata:Ie(null==a?void 0:a[u])?void 0:{id:0,version:void 0,description:void 0,payload:a[u]}}}this.receivedFeatureFlags({flags:l})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._prop(x),t=this._prop(Ro),s=this._prop(Lo);if(!s&&!t)return e||{};var r=mi({},e||{}),n=[...new Set([...Object.keys(s||{}),...Object.keys(t||{})])];for(var o of n){var a,l,u=r[o],c=null==t?void 0:t[o],d=Ie(c)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!c,_=Ie(c)?u.variant:"string"==typeof c?c:void 0,h=null==s?void 0:s[o],p=i({},u,{enabled:d,variant:d?null!=_?_:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(p.original_enabled=null==u?void 0:u.enabled),_!==(null==u?void 0:u.variant)&&(p.original_variant=null==u?void 0:u.variant),h&&(p.metadata=i({},null==u?void 0:u.metadata,{payload:h,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),r[o]=p}return this._override_warning||(Io.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:s,finalDetails:r}),this._override_warning=!0),r}getFlagVariants(){var e=this._prop(E),t=this._prop(Ro);if(!t)return e||{};for(var i=mi({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this._override_warning||(Io.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){var e=this._prop(Fo),t=this._prop(Lo);if(!t)return e||{};for(var i=mi({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this._override_warning||(Io.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}reloadFeatureFlags(){this._reloadingDisabled||this._config.advanced_disable_feature_flags||this._reloadDebouncer||(this._instance._internalEventEmitter.emit("featureFlagsReloading",!0),this._reloadDebouncer=setTimeout((()=>{this._callFlagsEndpoint()}),5))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}_callFlagsEndpoint(e){var t;if(this._clearDebouncer(),!this._instance._shouldDisableFlags())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var s=this._config.token,r=this._prop(a),n={token:s,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},(null==(t=this._persistence)?void 0:t.get_initial_props())||{},this._prop(k)||{}),group_properties:this._prop(I),timezone:fs()};Ce(r)||Ie(r)||(n.$device_id=r),(null!=e&&e.disableFlags||this._config.advanced_disable_feature_flags)&&(n.disable_flags=!0),this._shouldIncludeEvaluationEnvironments()&&(n.evaluation_contexts=this._getValidEvaluationEnvironments());var o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this._config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this._requestInFlight=!0,this._instance._send_request({method:"POST",url:o,data:n,compression:this._config.disable_compression?void 0:qs.Base64,timeout:this._config.feature_flag_request_timeout_ms,callback:e=>{var t,i,s,r=!0;if(200===e.statusCode&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),r=!1),this._requestInFlight=!1,!n.disable_flags||this._additionalReloadRequested){this._flagsLoadedFromRemote=!r;var o=[];e.error?e.error instanceof Error?o.push("AbortError"===e.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==e.statusCode&&o.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(l&&o.push("quota_limited"),null==(s=this._persistence)||s.register({[R]:o}),l)Io.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else n.disable_flags||this.receivedFeatureFlags(null!==(a=e.json)&&void 0!==a?a:{},r),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())}}})}}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var s=this.getFeatureFlagResult(e,t);return null!==(i=null==s?void 0:s.variant)&&void 0!==i?i:null==s?void 0:s.enabled}}else Io.warn('getFeatureFlag for key "'+e+To)}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._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],o=String(r),a=this._prop(Oo)||void 0,l=this._prop(F)||void 0,u=this._prop(T)||{};if(this._config.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),_=this._prop(C);d&&d!==_&&(u={},null==(c=this._persistence)||c.register({[T]:u,[C]:d}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){var h,p,g,v,f,m,y,b,w,E;Ee(u[e])?u[e].push(o):u[e]=[o],null==(h=this._persistence)||h.register({[T]:u});var S=this.getFeatureFlagDetails(e),x=[...null!==(p=this._prop(R))&&void 0!==p?p:[]];Ie(r)&&x.push("flag_missing");var k={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(g=this._config.bootstrap)||null==(g=g.featureFlags)?void 0:g[e])||null,$feature_flag_bootstrapped_payload:(null==(v=this._config.bootstrap)||null==(v=v.featureFlagPayloads)?void 0:v[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Ie(null==S||null==(f=S.metadata)?void 0:f.version)||(k.$feature_flag_version=S.metadata.version);var I,P=null!==(m=null==S||null==(y=S.reason)?void 0:y.description)&&void 0!==m?m:null==S||null==(b=S.reason)?void 0:b.code;P&&(k.$feature_flag_reason=P),null!=S&&null!=(w=S.metadata)&&w.id&&(k.$feature_flag_id=S.metadata.id),Ie(null==S?void 0:S.original_variant)&&Ie(null==S?void 0:S.original_enabled)||(k.$feature_flag_original_response=Ie(S.original_variant)?S.original_enabled:S.original_variant),null!=S&&null!=(E=S.metadata)&&E.original_payload&&(k.$feature_flag_original_payload=null==S||null==(I=S.metadata)?void 0:I.original_payload),x.length&&(k.$feature_flag_error=x.join(",")),this._instance.capture("$feature_flag_called",k)}if(s){var L=n;if(!Ie(n))try{L=JSON.parse(n)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:L}}}}else Io.warn('getFeatureFlagResult for key "'+e+To)}getRemoteConfigPayload(e,t){var i=this._config.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this._shouldIncludeEvaluationEnvironments()&&(s.evaluation_contexts=this._getValidEvaluationEnvironments()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this._config.disable_compression?void 0:qs.Base64,timeout:this._config.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._flagsLoadedFromRemote){if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return Ie(i)?void 0:!!i}Io.warn('isFeatureEnabled for key "'+e+To)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._persistence){this._hasLoadedFlags=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(e,t,s,r,n){void 0===s&&(s={}),void 0===r&&(r={}),void 0===n&&(n={});var o=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>{var i;return[e,null!==(i=t[e].variant)&&void 0!==i?i:t[e].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>{var i;return null==(i=t[e].metadata)?void 0:i.payload})).map((e=>{var i;return[e,null==(i=t[e].metadata)?void 0:i.payload]})))):Io.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var c=e.requestId,d=e.evaluatedAt;if(Ee(l)){Io.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var _={};if(l)for(var h=0;l.length>h;h++)_[l[h]]=!0;t&&t.register({[Co]:l,[E]:_})}else{var p=l,g=u,v=a;if(e.errorsWhileComputingFlags)if(a){var f=new Set(Object.keys(a).filter((e=>{var t;return!(null!=(t=a[e])&&t.failed)})));p=i({},s,Object.fromEntries(Object.entries(p).filter((e=>{var[t]=e;return f.has(t)})))),g=i({},r,Object.fromEntries(Object.entries(g||{}).filter((e=>{var[t]=e;return f.has(t)})))),v=i({},n,Object.fromEntries(Object.entries(v||{}).filter((e=>{var[t]=e;return f.has(t)}))))}else p=i({},s,p),g=i({},r,g),v=i({},n,v);t&&t.register(i({[Co]:Object.keys(Mo(p)),[E]:p||{},[Fo]:g||{},[x]:v||{}},c?{[Oo]:c}:{},d?{[F]:d}:{}))}}}(e,this._persistence,s,r,n),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),Io.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._persistence)return Io.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._persistence.unregister(Ro),this._persistence.unregister(Lo),this._fireFeatureFlagsCallbacks(),Po.info("All overrides cleared");if(Ee(e)){var t=$o(e);return this._persistence.register({[Ro]:t}),this._fireFeatureFlagsCallbacks(),Po.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var i,s=e;if(this._override_warning=Boolean(null!==(i=s.suppressWarning)&&void 0!==i&&i),"flags"in s)if(!1===s.flags)this._persistence.unregister(Ro),Po.info("Flag overrides cleared");else if(s.flags){if(Ee(s.flags)){var r=$o(s.flags);this._persistence.register({[Ro]:r})}else this._persistence.register({[Ro]:s.flags});Po.info("Flag overrides set",{flags:s.flags})}return"payloads"in s&&(!1===s.payloads?(this._persistence.unregister(Lo),Po.info("Payload overrides cleared")):s.payloads&&(this._persistence.register({[Lo]:s.payloads}),Po.info("Payload overrides set",{payloads:s.payloads}))),void this._fireFeatureFlagsCallbacks()}if(e&&"object"==typeof e)return this._persistence.register({[Ro]:e}),this._fireFeatureFlagsCallbacks(),Po.info("Flag overrides set",{flags:e});Io.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,s){var r,n=(this._prop(S)||[]).find((t=>t.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};n&&(a.$early_access_feature_name=n.name),s&&(a.$feature_enrollment_stage=s),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=i({},this.getFlagVariants(),{[e]:t});null==(r=this._persistence)||r.register({[Co]:Object.keys(Mo(l)),[E]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this._prop(S),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._config.token+r),method:"GET",callback:t=>{var i,s;if(t.json){var r=t.json.earlyAccessFeatures;return null==(i=this._persistence)||i.unregister(S),null==(s=this._persistence)||s.register({[S]:r}),e(r)}}})}_prepareFeatureFlagsForCallbacks(){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)),{})}}_fireFeatureFlagsCallbacks(e){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach((s=>s(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var s=this._prop(k)||{},r=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),n=null==e?void 0:e.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in s||(o[a]=n[a]));this._instance.register({[k]:i({},s,o,r)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(k)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var s=this._prop(I)||{};0!==Object.keys(s).length&&Object.keys(s).forEach((t=>{s[t]=i({},s[t],e[t]),delete e[t]})),this._instance.register({[I]:i({},s,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(I)||{};this._instance.register({[I]:i({},t,{[e]:{}})})}else this._instance.unregister(I)}reset(){this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1}}},jo={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!(null==(e=this._lazyLoadedSessionRecording)||!e.isStarted)}get status(){var e,t;return this._recordingStatus===no||this._recordingStatus===oo?this._recordingStatus:null!==(e=null==(t=this._lazyLoadedSessionRecording)?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=so,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw lo.error("started without valid sessionManager"),new Error(ao+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===V)throw new Error(ao+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _isRecordingEnabled(){var e,t=!(null==(e=this._instance.get_property(y))||!e.enabled),i=!this._config.disable_session_recording,s=this._config.disable_session_recording||this._instance.consent.isOptedOut();return te&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var i=!Ie(Object.assign)&&!Ie(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),lo.info("starting")):(this._recordingStatus=so,this.stopRecording())}}_lazyLoadAndStart(e){var t,i,s;this._isRecordingEnabled&&(this._recordingStatus!==no&&this._recordingStatus!==oo&&(this._recordingStatus=ro),null!=de&&null!=(t=de.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=de.__PosthogExtensions__)&&i.initSessionRecording?this._onScriptLoaded(e):null==(s=de.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return lo.error("could not load recorder",t);this._onScriptLoaded(e)})))}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_discardRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.discard()}_resetSampling(){var e;null==(e=this._persistence)||e.unregister(w)}_validateSampleRate(e,t){if(Re(e))return null;var i,s=Fe(e)?e:parseFloat(e);return"number"!=typeof(i=s)||!Number.isFinite(i)||0>i||i>1?(lo.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):s}_persistRemoteConfig(e){if(this._persistence){var t,s,r=this._persistence,n=()=>{var t,s=!1===e.sessionRecording?void 0:e.sessionRecording,n=this._validateSampleRate(null==(t=this._config.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),o=this._validateSampleRate(null==s?void 0:s.sampleRate,"remote config sampleRate"),a=null!=n?n:o;Re(a)&&this._resetSampling();var l=null==s?void 0:s.minimumDurationMilliseconds;r.register({[y]:i({cache_timestamp:Date.now(),enabled:!!s},s,{networkPayloadCapture:i({capturePerformance:e.capturePerformance},null==s?void 0:s.networkPayloadCapture),canvasRecording:{enabled:null==s?void 0:s.recordCanvas,fps:null==s?void 0:s.canvasFps,quality:null==s?void 0:s.canvasQuality},sampleRate:a,minimumDurationMilliseconds:Ie(l)?null:l,endpoint:null==s?void 0:s.endpoint,triggerMatchType:null==s?void 0:s.triggerMatchType,masking:null==s?void 0:s.masking,urlTriggers:null==s?void 0:s.urlTriggers})})};n(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(s=this._instance.sessionManager)?void 0:s.onSessionId(n)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this._persistRemoteConfig(e),void this._discardRecording()):(this._persistRemoteConfig(e),void this.startIfEnabledOrStop()):(this._recordingStatus===no&&(this._recordingStatus=oo,lo.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._lazyLoadedSessionRecording)&&i.log?this._lazyLoadedSessionRecording.log(e,t):lo.warn("log called before recorder was ready")}get _scriptName(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(y);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t=this._instance.get_property(y);if(!t)return!1;var i=null!==(e=("object"==typeof t?t:JSON.parse(t)).cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-i}_onScriptLoaded(e){var t,i;if(null==(t=de.__PosthogExtensions__)||!t.initSessionRecording)return lo.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._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(i=de.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===oo||this._recordingStatus===no)return;return this._recordingStatus=no,lo.info("persisted remote config is stale, requesting fresh config before starting"),void new Ns(this._instance).load()}this._recordingStatus=ro,this._lazyLoadedSessionRecording.start(e)}onRRwebEmit(e){var t;null==(t=this._lazyLoadedSessionRecording)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({$replay_override_linked_flag:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({$replay_override_sampling:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||null==(i=this._persistence)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this._lazyLoadedSessionRecording)||!i.tryAddCustomEvent(e,t))}}},Bo={autocapture:class{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new Wn(e.config.rageclick),this._elementSelectors=null}initialize(){this.startIfEnabled()}get _config(){var e,t,i=xe(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}_addDomEventHandlers(){if(this.isBrowserSupported()){if(te&&re){var e=e=>{e=e||(null==te?void 0:te.event);try{this._captureEvent(e)}catch(e){Yn.error("Failed to capture event",e)}};if(ki(re,"submit",e,{capture:!0}),ki(re,"change",e,{capture:!0}),ki(re,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{this._captureEvent(e=e||(null==te?void 0:te.event),Gn)};ki(re,"copy",t,{capture:!0}),ki(re,"cut",t,{capture:!0})}}}else Yn.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[c]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,i=[];return null==(t=this._elementSelectors)||t.forEach((t=>{var s=null==re?void 0:re.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[c];if(Ce(this._isDisabledServerSide)&&!Oe(i)&&!this.instance._shouldDisableFlags())return!1;var s=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}_captureEvent(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,s=kn(e);mn(s)&&(s=s.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(!te||Fn(e))return!1;var i,s,r;if(Oe(t)?(i=!!t&&Rn,s=void 0):(i=null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:Rn,s=null==t?void 0:t.content_ignorelist),!1===i)return!1;var{targetElementList:n}=Ln(e,!1);return!function(e,t){if(!1===e||Ie(e))return!1;var i;if(!0===e)i=Cn;else{if(!Ee(e))return!1;if(e.length>10)return pi.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)))}))}(s,n.map((e=>{var t;return{safeText:xn(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!Pn(n,i)}(s,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var r=t===Gn;if(s&&function(e,t,i,s,r){var n,o,a,l;if(void 0===i&&(i=void 0),!te||Fn(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!wn(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&wn(i.url_ignorelist))return!1;if(null!=(a=i)&&a.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some((e=>t.type===e)))return!1}var{parentIsUsefulElement:c,targetElementList:d}=Ln(e,s);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(Ie(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))return!1;if(!Pn(d,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var _=te.getComputedStyle(e);if(_&&"pointer"===_.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return c?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(In.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this._config,r,r?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=Xn(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(o)return!1;var a=this.getElementSelectors(s);if(a&&a.length>0&&(n.$element_selectors=a),t===Gn){var l,u=Sn(null==te||null==(l=te.getSelection())?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=c}return this.instance.capture(t,n),!0}}}isBrowserSupported(){return Se(null==re?void 0:re.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this._lastPathname=(null==te||null==(t=te.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(pi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,pi.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(te&&te.history){var i=this;null!=(e=te.history.pushState)&&e.__posthog_wrapped__||Zn(te.history,"pushState",(e=>function(t,s,r){e.call(this,t,s,r),i._capturePageview("pushState")})),null!=(t=te.history.replaceState)&&t.__posthog_wrapped__||Zn(te.history,"replaceState",(e=>function(t,s,r){e.call(this,t,s,r),i._capturePageview("replaceState")})),this._setupPopstateListener()}}_capturePageview(e){try{var t,i=null==te||null==(t=te.location)?void 0:t.pathname;if(!i)return;i!==this._lastPathname&&this.isEnabled&&this._instance.capture(X,{navigation_type:e}),this._lastPathname=i}catch(t){pi.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};ki(te,"popstate",e),this._popstateListener=()=>{te&&te.removeEventListener("popstate",e)}}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!(null==(t=this.instance.persistence)||!t.props[d]),this.rageclicks=new Wn(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return xe(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Re(this._config.capture_heatmaps)?Re(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;uo.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[d]:t}),this._enabledServerSide=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval="visible"===(null==re?void 0:re.visibilityState)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){te&&re&&(this._flushHandler=this._flush.bind(this),ki(te,J,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==te?void 0:te.event)),ki(re,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==te?void 0:te.event)),ki(re,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new Yi(this.instance,Wi,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),ki(re,K,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;te&&re&&(this._flushHandler&&te.removeEventListener(J,this._flushHandler),this._onClickHandler&&re.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&re.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&re.removeEventListener(K,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(e=this._deadClicksCapture)||e.stop(),this._initialized=!1)}_getProperties(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=function(e,t,i){for(var s=e;s&&vn(s)&&!fn(s,"body");){if(s===i)return!1;if(ve(t,null==te?void 0:te.getComputedStyle(s).position))return!0;s=Tn(s)}return!1}(kn(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:s),y:e.clientY+(n?0:i),target_fixed:n,type:t}}_onClick(e,t){var s;if(void 0===t&&(t="click"),!gn(e.target)&&co(e)){var r=this._getProperties(e,t);null!=(s=this.rageclicks)&&s.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture(i({},r,{type:"rageclick"})),this._capture(r)}}_onMouseMove(e){!gn(e.target)&&co(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(te){var t=te.location.href,i=this._config.custom_personal_data_properties,s=this._config.mask_personal_data_properties?[...ns,...i||[]]:[],r=is(t,s,as);this._buffer=this._buffer||{},this._buffer[r]||(this._buffer[r]=[]),this._buffer[r].push(e)}}_flush(){this._buffer&&!ke(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Yi,webVitalsAutocapture:class{constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",this._buffer.metrics.reduce(((e,t)=>i({},e,{["$web_vitals_"+t.name+"_event"]:i({},t),["$web_vitals_"+t.name+"_value"]:t.value})),{})),this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t,s=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(Ie(s))to.error("Could not read session ID. Dropping metrics!");else{this._buffer=this._buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this._currentURL();Ie(r)||(Re(null==e?void 0:e.name)||Re(null==e?void 0:e.value)?to.error("Invalid metric received",e):!this._maxAllowedValue||this._maxAllowedValue>e.value?(this._buffer.url!==r&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Ie(this._buffer.url)&&(this._buffer.url=r),this._buffer.firstMetricTimestamp=Ie(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this._buffer.metrics.push(i({},e,{$current_url:r,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()):to.error("Ignoring metric with value >= "+this._maxAllowedValue,e))}},this._startCapturing=()=>{if(!this._initialized){var e,t,i,s,r=de.__PosthogExtensions__;Ie(r)||Ie(r.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:s}=r.postHogWebVitalsCallbacks),e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this._addToBuffer.bind(this)),this._initialized=!0):to.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[g]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=xe(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Re(i)?(null==(t=this._instance.persistence)?void 0:t.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(xe(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=xe(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return null!=e&&e}get _maxAllowedValue(){var e=xe(this._perfConfig)&&Fe(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:io;return e>0&&6e4>=e?io:e}get isEnabled(){var e=null==ne?void 0:ne.protocol;if("http:"!==e&&"https:"!==e)return to.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=xe(this._perfConfig)?this._perfConfig.web_vitals:Oe(this._perfConfig)?this._perfConfig:void 0;return Oe(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(to.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if("capturePerformance"in e){var t=xe(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=xe(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[g]:t}),this._instance.persistence.register({[m]:i})),this._enabledServerSide=t,this.startIfEnabled()}}_loadScript(e){var t,i;null!=(t=de.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(t=>{t?to.error("failed to load script",t):e()}))}_currentURL(){var e=te?te.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...ns,...t||[]]:[];return is(e,i,as)}to.error("Could not determine current URL")}}},Vo={exceptionObserver:class{constructor(e){var t,i,s;this._startCapturing=()=>{var e;if(te&&this.isEnabled&&null!=(e=de.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=de.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=de.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=de.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=t(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=i(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=s(this.captureException.bind(this)))}catch(e){Qn.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[_]),this._rateLimiter=new je({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,_logger:Qn}),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return xe(e)?t=i({},t,e):(Ie(e)?this._remoteEnabled:e)&&(t=i({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Qn.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i;null!=(t=de.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return Qn.error("failed to load script",t);e()}))}_stopCapturing(){var e,t,i;null==(e=this._unwrapOnError)||e.call(this),this._unwrapOnError=void 0,null==(t=this._unwrapUnhandledRejection)||t.call(this),this._unwrapUnhandledRejection=void 0,null==(i=this._unwrapConsoleError)||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this._remoteEnabled=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[_]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}onConfigChange(){this._config=this._requiredConfig()}captureException(e){var t,i,s,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this._rateLimiter.consumeRateLimit(r)?Qn.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,s;this._suppressionRules=[],this._errorPropertiesBuilder=new Bt([new ii,new _i,new ri,new si,new ci,new ui,new oi,new di],function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;t>r;r++)s[r-1]=arguments[r];return function(t,r){void 0===r&&(r=0);for(var n=[],o=t.split("\n"),a=r;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=ti.test(l)?l.replace(ti,"$1"):l;if(!u.match(/\S*Error: /)){for(var c of s){var d=c(u,e);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map((e=>{return i({},e,{filename:e.filename||(s=t,s[s.length-1]||{}).filename,function:e.function||Vt});var s}))}(n)}}("web:javascript",Xt,ei)),this._instance=e,this._suppressionRules=null!==(t=null==(s=this._instance.persistence)?void 0:s.get_property(h))&&void 0!==t?t:[]}onRemoteConfig(e){var t,i,s;if("errorTracking"in e){var r=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(s=e.errorTracking)?void 0:s.captureExtensionExceptions;this._suppressionRules=r,this._instance.persistence&&this._instance.persistence.register({[h]:this._suppressionRules,[p]:n})}}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(p),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.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._isExceptionList(t)){if(this._matchesSuppressionRule(t))return void Ao.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return void Ao.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return void Ao.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0})}_matchesSuppressionRule(e){if(0===e.length)return!1;var t=e.reduce(((e,t)=>{var{type:i,value:s}=t;return Pe(i)&&i.length>0&&e.$exception_types.push(i),Pe(s)&&s.length>0&&e.$exception_values.push(s),e}),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some((e=>{var i=e.values.map((e=>{var i,s=Ur[e.operator],r=Ee(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return r.length>0&&s(r,n)}));return"OR"===e.type?i.some(Boolean):i.every(Boolean)}))}_isExtensionException(e){return e.flatMap((e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}_isPostHogException(e){if(e.length>0){var t,i,s,r,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(s=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&void 0!==s&&s}return!1}_isExceptionList(e){return!Re(e)&&Ee(e)}}},Wo=i({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this._persistence&&this._persistence.register({[f]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this._productTourManager||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(f)||this._loadScript((()=>this._startProductTours()))}_loadScript(e){var t,i;null!=(t=de.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(t=>{t?_o.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=de.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=de.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Ee(this._cachedTours)||t){var i=this._persistence;if(i){var s=i.props[ho];if(Ee(s)&&!t)return this._cachedTours=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 _o.error(r),void e([],{isLoaded:!1,error:r})}var n=Ee(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,i&&i.register({[ho]:n}),e(n,{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){Re(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this._productTourManager)||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript((()=>{var t;this._startProductTours(),null==(t=this._productTourManager)||t.previewTour(e)}))}dismissProductTour(){var e;null==(e=this._productTourManager)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this._productTourManager)||e.nextStep()}previousStep(){var e;null==(e=this._productTourManager)||e.previousStep()}clearCache(){var e;this._cachedTours=null,null==(e=this._persistence)||e.unregister(ho)}resetTour(e){var t;null==(t=this._productTourManager)||t.resetTour(e)}resetAllTours(){var e;null==(e=this._productTourManager)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this._productTourManager)||t.cancelPendingTour(e)}}},zo),Go={siteApps:class{constructor(e){this._instance=e,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(t){var i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}}get siteAppLoaders(){var e;return null==(e=de._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,r,n,o,a,l,u;if(!e)throw new Error("Event payload is required");var c={},d=this._instance.get_property("$groups")||[],_=this._instance.get_property("$stored_group_properties")||{};for(var[h,p]of Object.entries(_))c[h]={id:d[h],type:h,properties:p};var{$set_once:g,$set:v}=e;return{event:i({},s(e,po),{properties:i({},e.properties,v?{$set:i({},null!==(t=null==(r=e.properties)?void 0:r.$set)&&void 0!==t?t:{},v)}:{},g?{$set_once:i({},null!==(n=null==(o=e.properties)?void 0:o.$set_once)&&void 0!==n?n:{},g)}:{}),elements_chain:null!==(a=null==(l=e.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(u=e.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this._bufferedInvocations.length&&(go.info("Processing "+this._bufferedInvocations.length+" events for site app with id "+e.id),this._bufferedInvocations.forEach((e=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&(null==(i=this._stopBuffering)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,go.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){go.error(vo+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){go.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}_setupSiteApps(){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)}_onCapturedEvent(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){go.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._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void go.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this._stopBuffering)||i.call(this),null!=(s=e.siteApps)&&s.length)if(this.isEnabled){var n=function(e){var t;de["__$$ph_site_app_"+e]=r._instance,null==(t=de.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(r._instance,a,(t=>{if(t)return go.error(vo+e,t)}))};for(var{id:o,url:a}of e.siteApps)n(o)}else go.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Yo={tracingHeaders:class{constructor(e){this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._startCapturing=()=>{var e,t;Ie(this._restoreXHRPatch)&&(null==(e=de.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),Ie(this._restoreFetchPatch)&&(null==(t=de.__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()}_loadScript(e){var t,i;null!=(t=de.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return eo.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):(null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}},Ko=i({surveys:class{get _config(){return this._instance.config}constructor(e){this._isSurveysEnabled=void 0,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._config.disable_surveys){var t=e.surveys;if(Re(t))return Vr.warn("Flags not loaded yet. Not loading surveys.");var i=Ee(t);this._isSurveysEnabled=i?t.length>0:t,Vr.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(Wr)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)Vr.info("Already initializing surveys, skipping...");else if(this._config.disable_surveys)Vr.info(Eo);else if(this._config.cookieless_mode&&this._instance.consent.isOptedOut())Vr.info("Not loading surveys in cookieless mode without consent.");else{var e=null==de?void 0:de.__PosthogExtensions__;if(e){if(!Ie(this._isSurveysEnabled)||this._config.advanced_enable_surveys){var t=this._isSurveysEnabled||this._config.advanced_enable_surveys;this._isInitializingSurveys=!0;try{var i=e.generateSurveys;if(i)return void this._completeSurveyInitialization(i,t);var s=e.loadExternalDependency;if(!s)return void this._handleSurveyLoadError(j);s(this._instance,"surveys",(i=>{i||!e.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",i):this._completeSurveyInitialization(e.generateSurveys,t)}))}catch(e){throw this._handleSurveyLoadError("Error initializing surveys",e),e}finally{this._isInitializingSurveys=!1}}}else Vr.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new bo(this._instance),Vr.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){Vr.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter((t=>t!==e))}}getSurveys(e,t){if(void 0===t&&(t=!1),this._config.disable_surveys)return Vr.info(Eo),e([]);var i,s=this._instance.get_property(P);if(s&&!t)return e(s,{isLoaded:!0});"undefined"!=typeof Promise&&this._getSurveysInFlightPromise?this._getSurveysInFlightPromise.then((t=>{var{surveys:i,context:s}=t;return e(i,s)})):("undefined"!=typeof Promise&&(this._getSurveysInFlightPromise=new Promise((e=>{i=e}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._config.token),method:"GET",timeout:this._config.surveys_request_timeout_ms,callback:t=>{var s;this._getSurveysInFlightPromise=null;var r=t.statusCode;if(200!==r||!t.json){var n="Surveys API could not be loaded, status: "+r;Vr.error(n);var o={isLoaded:!1,error:n};return e([],o),void(null==i||i({surveys:[],context:o}))}var a,l=t.json.surveys||[],u=l.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(s=this._instance.persistence)||s.register({[P]:l});var c={isLoaded:!0};e(l,c),null==i||i({surveys:l,context:c})}}))}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){Vr.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Re(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Vr.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys((i=>{var s;t=null!==(s=i.find((t=>t.id===e)))&&void 0!==s?s:null})),t}_checkSurveyEligibility(e){if(Re(this._surveyManager))return{eligible:!1,reason:wo};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Re(this._surveyManager))return Vr.warn("init was not called"),{visible:!1,disabledReason:wo};var t=this._checkSurveyEligibility(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Re(this._surveyManager)?(Vr.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:wo})):new Promise((i=>{this.getSurveys((t=>{var s,r=null!==(s=t.find((t=>t.id===e)))&&void 0!==s?s:null;if(r){var n=this._checkSurveyEligibility(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,i){var s;if(Re(this._surveyManager))Vr.warn("init was not called");else{var r="string"==typeof e?this._getSurveyById(e):e;if(null!=r&&r.id)if(Kr.includes(r.type)){var n=null==re?void 0:re.querySelector(t);if(n)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(Vr.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;Vr.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),Vr.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,i);Vr.warn("Survey element not found")}else Vr.warn("Surveys of type "+r.type+" cannot be rendered in the app");else Vr.warn("Survey not found")}}displaySurvey(e,t){var s;if(Re(this._surveyManager))Vr.warn("init was not called");else{var r=this._getSurveyById(e);if(r){var n=r;if(null!=(s=r.appearance)&&s.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=i({},r,{appearance:i({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Fs.Popover&&t.initialResponses&&Vr.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var o=this.canRenderSurvey(r);if(!o.visible)return void Vr.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Fs.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else Vr.warn("Survey not found")}}cancelPendingSurvey(e){Re(this._surveyManager)?Vr.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},zo),Jo={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){de.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=de.ph_toolbar_state)&&void 0!==e?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),Ii(this.instance.config))return!1;if(!te||!re)return!1;e=null!=e?e:te.location,i=null!=i?i:te.history;try{if(!t){try{te.localStorage.setItem("test","test"),te.localStorage.removeItem("test")}catch(e){return!1}t=null==te?void 0:te.localStorage}var s,r=So||ss(e.hash,"__posthog")||ss(e.hash,"state"),n=r?bi((()=>JSON.parse(atob(decodeURIComponent(r)))))||bi((()=>JSON.parse(decodeURIComponent(r)))):null;return n&&"ph_authorize"===n.action?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(xo)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}_callLoadToolbar(e){var t=de.ph_load_toolbar||de.ph_load_editor;!Re(t)&&Se(t)?t(e,this.instance):ko.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==re||!re.getElementById(q));if(!te||t)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=i({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(te.localStorage.setItem(xo,JSON.stringify(i({},r,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(r);else if(0===this._getToolbarState()){var n;this._setToolbarState(1),null==(n=de.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return ko.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(r)})),ki(te,"turbolinks:load",(()=>{this._setToolbarState(0),this.loadToolbar(r)}))}return!0}_loadEditor(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)}}},Xo=i({experiments:Uo},zo),Qo={conversations:class{constructor(e){this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;Re(t)||(Oe(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null}loadIfEnabled(){if(!(this._conversationsManager||this._isInitializing||this._instance.config.disable_conversations||Ii(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==de?void 0:de.__PosthogExtensions__;if(e&&!Ie(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{var t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);var i=e.loadExternalDependency;if(!i)return void this._handleLoadError(j);i(this._instance,"conversations",(t=>{t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1}))}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else qo.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),qo.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else qo.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){qo.error(e,t),this._conversationsManager=null,this._isInitializing=!1}show(){this._conversationsManager?this._conversationsManager.show():qo.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Ce(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,i,s){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,i,s):(qo.warn(Ho),null)}))()}getMessages(e,i){var s=this;return t((function*(){return s._conversationsManager?s._conversationsManager.getMessages(e,i):(qo.warn(Ho),null)}))()}markAsRead(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(e):(qo.warn(Ho),null)}))()}getTickets(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.getTickets(e):(qo.warn(Ho),null)}))()}requestRestoreLink(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(e):(qo.warn(Ho),null)}))()}restoreFromToken(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(e):(qo.warn(Ho),null)}))()}restoreFromUrlToken(){var e=this;return t((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(qo.warn(Ho),null)}))()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null==(e=this._conversationsManager)||e.setIdentity()}_onIdentityCleared(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},Zo={logs:class{constructor(e){var t;this._isLogsEnabled=!1,this._isLoaded=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this._isLogsEnabled=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!Re(i)&&i&&(this._isLogsEnabled=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this._isLogsEnabled&&!this._isLoaded){var e=gi("[logs]"),t=null==de?void 0:de.__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._isLoaded=!0)})):e.error(j)}else e.error("PostHog Extensions not found.")}}}},ea=i({},zo,jo,Bo,Vo,Wo,Go,Ko,Yo,Jo,Xo,Qo,Zo);pn.__defaultExtensionClasses=i({},ea);var ta,ia=(ta=en[ln]=new pn,function(){function e(){e.done||(e.done=!0,un=!1,fi(en,(function(e){e._dom_loaded()})))}null!=re&&re.addEventListener?"complete"===re.readyState?e():ki(re,"DOMContentLoaded",e,{capture:!1}):te&&pi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),ta);export{qs as Compression,Ls as DEFAULT_PRODUCT_TOUR_APPEARANCE,Fs as DisplaySurveyType,pn as PostHog,Os as ProductTourEventName,$s as ProductTourEventProperties,Cs as SurveyEventName,Rs as SurveyEventProperties,ws as SurveyEventType,Ss as SurveyPosition,Ps as SurveyQuestionBranchingType,Is as SurveyQuestionType,Ts as SurveySchedule,xs as SurveyTabPosition,ks as SurveyType,Es as SurveyWidgetType,ia as default,ia as posthog,Us as severityLevels};
|
|
1
|
+
function e(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(e){return void i(e)}a.done?t(l):Promise.resolve(l).then(s,r)}function t(t){return function(){var i=this,s=arguments;return new Promise((function(r,n){var o=t.apply(i,s);function a(t){e(o,r,n,a,l,"next",t)}function l(t){e(o,r,n,a,l,"throw",t)}a(void 0)}))}}function i(){return i=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},i.apply(null,arguments)}function s(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}var r="1.366.2",n={DEBUG:!1,LIB_VERSION:r,LIB_NAME:"web",JS_SDK_VERSION:r},o="$people_distinct_id",a="$device_id",l="__alias",u="__timers",c="$autocapture_disabled_server_side",d="$heatmaps_enabled_server_side",_="$exception_capture_enabled_server_side",h="$error_tracking_suppression_rules",p="$error_tracking_capture_extension_exceptions",g="$web_vitals_enabled_server_side",v="$dead_clicks_enabled_server_side",f="$product_tours_enabled_server_side",m="$web_vitals_allowed_metrics",y="$session_recording_remote_config",b="$sesid",w="$session_is_sampled",E="$enabled_feature_flags",S="$early_access_features",x="$feature_flag_details",k="$stored_person_properties",I="$stored_group_properties",P="$surveys",T="$flag_call_reported",C="$flag_call_reported_session_id",R="$feature_flag_errors",F="$feature_flag_evaluated_at",L="$user_state",O="$client_session_props",M="$capture_rate_limit",A="$initial_campaign_params",D="$initial_referrer_info",N="$initial_person_info",U="$epp",q="__POSTHOG_TOOLBAR__",H="$posthog_cookieless",z=[o,l,"__cmpns",u,"$session_recording_enabled_server_side",d,b,E,h,L,S,x,I,k,P,T,C,R,F,O,M,A,D,U,N],j="PostHog loadExternalDependency extension not found.",B="on_reject",V="always",W="anonymous",G="identified",Y="identified_only",K="visibilitychange",J="beforeunload",X="$pageview",Q="$pageleave",Z="$identify",ee="$groupidentify",te="undefined"!=typeof window?window:void 0,ie="undefined"!=typeof globalThis?globalThis:te;"undefined"==typeof self&&(ie.self=ie),"undefined"==typeof File&&(ie.File=function(){});var se=null==ie?void 0:ie.navigator,re=null==ie?void 0:ie.document,ne=null==ie?void 0:ie.location,oe=null==ie?void 0:ie.fetch,ae=null!=ie&&ie.XMLHttpRequest&&"withCredentials"in new ie.XMLHttpRequest?ie.XMLHttpRequest:void 0,le=null==ie?void 0:ie.AbortController,ue=null==ie?void 0:ie.CompressionStream,ce=null==se?void 0:se.userAgent,de=null!=te?te:{};function _e(){return(_e=t((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 he=["$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"],pe=["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"],ge=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return pe.concat(t).some((e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)}))};function ve(e,t){return-1!==e.indexOf(t)}var fe=function(e){return e.trim()},me=function(e){return e.replace(/^\$/,"")},ye=Object.prototype,be=ye.hasOwnProperty,we=ye.toString,Ee=Array.isArray||function(e){return"[object Array]"===we.call(e)},Se=e=>"function"==typeof e,xe=e=>e===Object(e)&&!Ee(e),ke=e=>{if(xe(e)){for(var t in e)if(be.call(e,t))return!1;return!0}return!1},Ie=e=>void 0===e,Pe=e=>"[object String]"==we.call(e),Te=e=>Pe(e)&&0===e.trim().length,Ce=e=>null===e,Re=e=>Ie(e)||Ce(e),Fe=e=>"[object Number]"==we.call(e)&&e==e,Le=e=>Fe(e)&&e>0,Oe=e=>"[object Boolean]"===we.call(e),$e=e=>e instanceof FormData,Me=e=>ve(he,e);function Ae(e){return null===e||"object"!=typeof e}function De(e,t){return{}.toString.call(e)==="[object "+t+"]"}function Ne(e){return"undefined"!=typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var Ue=[!0,"true",1,"1","yes"],qe=e=>ve(Ue,e),He=[!1,"false",0,"0","no"];function ze(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),Fe(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),ze(r||i,t,i,s))}class je{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=ze(e.bucketSize,0,100,e._logger),this._refillRate=ze(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=ze(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){var i=Math.floor((t-e.lastAccess)/this._refillInterval);i>0&&(e.tokens=Math.min(e.tokens+i*this._refillRate,this._bucketSize),e.lastAccess=e.lastAccess+i*this._refillInterval)}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this._buckets[s];return r?this._applyRefill(r,i):this._buckets[s]=r={tokens:this._bucketSize,lastAccess:i},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this._onBucketRateLimited)||t.call(this,e)),0===r.tokens)}stop(){this._buckets={}}}var Be,Ve,We,Ge="Mobile",Ye="iOS",Ke="Android",Je="Tablet",Xe=Ke+" "+Je,Qe="iPad",Ze="Apple",et=Ze+" Watch",tt="Safari",it="BlackBerry",st="Samsung",rt=st+"Browser",nt=st+" Internet",ot="Chrome",at=ot+" OS",lt=ot+" "+Ye,ut="Internet Explorer",ct=ut+" "+Ge,dt="Opera",_t=dt+" Mini",ht="Edge",pt="Microsoft "+ht,gt="Firefox",vt=gt+" "+Ye,ft="Nintendo",mt="PlayStation",yt="Xbox",bt=Ke+" "+Ge,wt=Ge+" "+tt,Et="Windows",St=Et+" Phone",xt="Nokia",kt="Ouya",It="Generic",Pt=It+" "+Ge.toLowerCase(),Tt=It+" "+Je.toLowerCase(),Ct="Konqueror",Rt="(\\d+(\\.\\d+)?)",Ft=new RegExp("Version/"+Rt),Lt=new RegExp(yt,"i"),Ot=new RegExp(mt+" \\w+","i"),$t=new RegExp(ft+" \\w+","i"),Mt=new RegExp(it+"|PlayBook|BB10","i"),At={"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"},Dt=function(e,t){return t=t||"",ve(e," OPR/")&&ve(e,"Mini")?_t:ve(e," OPR/")?dt:Mt.test(e)?it:ve(e,"IE"+Ge)||ve(e,"WPDesktop")?ct:ve(e,rt)?nt:ve(e,ht)||ve(e,"Edg/")?pt:ve(e,"FBIOS")?"Facebook "+Ge:ve(e,"UCWEB")||ve(e,"UCBrowser")?"UC Browser":ve(e,"CriOS")?lt:ve(e,"CrMo")||ve(e,ot)?ot:ve(e,Ke)&&ve(e,tt)?bt:ve(e,"FxiOS")?vt:ve(e.toLowerCase(),Ct.toLowerCase())?Ct:((e,t)=>t&&ve(t,Ze)||function(e){return ve(e,tt)&&!ve(e,ot)&&!ve(e,Ke)}(e))(e,t)?ve(e,Ge)?wt:tt:ve(e,gt)?gt:ve(e,"MSIE")||ve(e,"Trident/")?ut:ve(e,"Gecko")?gt:""},Nt={[ct]:[new RegExp("rv:"+Rt)],[pt]:[new RegExp(ht+"?\\/"+Rt)],[ot]:[new RegExp("("+ot+"|CrMo)\\/"+Rt)],[lt]:[new RegExp("CriOS\\/"+Rt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Rt)],[tt]:[Ft],[wt]:[Ft],[dt]:[new RegExp("(Opera|OPR)\\/"+Rt)],[gt]:[new RegExp(gt+"\\/"+Rt)],[vt]:[new RegExp("FxiOS\\/"+Rt)],[Ct]:[new RegExp("Konqueror[:/]?"+Rt,"i")],[it]:[new RegExp(it+" "+Rt),Ft],[bt]:[new RegExp("android\\s"+Rt,"i")],[nt]:[new RegExp(rt+"\\/"+Rt)],[ut]:[new RegExp("(rv:|MSIE )"+Rt)],Mozilla:[new RegExp("rv:"+Rt)]},Ut=function(e,t){var i=Dt(e,t),s=Nt[i];if(Ie(s))return null;for(var r=0;s.length>r;r++){var n=e.match(s[r]);if(n)return parseFloat(n[n.length-2])}return null},qt=[[new RegExp(yt+"; "+yt+" (.*?)[);]","i"),e=>[yt,e&&e[1]||""]],[new RegExp(ft,"i"),[ft,""]],[new RegExp(mt,"i"),[mt,""]],[Mt,[it,""]],[new RegExp(Et,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[St,""];if(new RegExp(Ge).test(t)&&!/IEMobile\b/.test(t))return[Et+" "+Ge,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=At[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[Et,s]}return[Et,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?[Ye,[e[3],e[4],e[5]||"0"].join(".")]:[Ye,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Ie(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ke+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ke+")","i"),e=>e&&e[2]?[Ke,[e[2],e[3],e[4]||"0"].join(".")]:[Ke,""]],[/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/,[at,""]],[/Linux|debian/i,["Linux",""]]],Ht=function(e){return $t.test(e)?ft:Ot.test(e)?mt:Lt.test(e)?yt:new RegExp(kt,"i").test(e)?kt:new RegExp("("+St+"|WPDesktop)","i").test(e)?St:/iPad/.test(e)?Qe:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?et:Mt.test(e)?it:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(xt,"i").test(e)?xt:/(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(Ge).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)?Ke:Xe:new RegExp("(pda|"+Ge+")","i").test(e)?Pt:new RegExp(Je,"i").test(e)&&!new RegExp(Je+" pc","i").test(e)?Tt:""},zt=e=>e instanceof Error;function jt(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return We&&i.length===Ve||(Ve=i.length,We=i.reduce(((i,s)=>{Be||(Be={});var r=Be[s];if(r)i[r[0]]=r[1];else for(var n=e(s),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=t[s];if(l&&u){i[l]=u,Be[s]=[l,u];break}}return i}),{})),We}}class Bt{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 i=this;return t((function*(){for(var t of e)t.stacktrace&&t.stacktrace.frames&&Ee(t.stacktrace.frames)&&(t.stacktrace.frames=yield i.applyModifiers(t.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 s,r;return null!=e.cause&&(s=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),i({},e,{cause:s,stack:r})}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 i=this;return t((function*(){var t=e;for(var s of i.modifiers)t=yield s(t);return t}))()}convertToExceptionList(e,t){var s,r,n,o={type:e.type,value:e.value,mechanism:{type:null!==(s=t.type)&&void 0!==s?s:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(n=e.synthetic)&&void 0!==n&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,i({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:jt(this.stackParser),skipFirstLines:null!==(t=e.skipFirstLines)&&void 0!==t?t:1}}buildCoercingContext(e,t,s){void 0===s&&(s=0);var r=(i,s)=>{if(4>=s){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return i({},t,{syntheticException:0==s?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,s),next:e=>r(e,s+1)})}}var Vt="?";function Wt(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?Vt:i,in_app:!0};return Ie(s)||(n.lineno=s),Ie(r)||(n.colno=r),n}var Gt=(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]:Vt,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},Yt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Kt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Jt=/\((\S*)(?::(\d+))(?::(\d+))\)/,Xt=(e,t)=>{var i=Yt.exec(e);if(i){var[,s,r,n]=i;return Wt(t,s,Vt,+r,+n)}var o=Kt.exec(e);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=Jt.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Gt(o[1]||Vt,o[2]);return Wt(t,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Qt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Zt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ei=(e,t)=>{var i=Qt.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=Zt.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]||Vt;return[n,r]=Gt(n,r),Wt(t,r,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},ti=/\(error: (.*)\)/;class ii{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=Pe(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 De(e,"DOMException")}isDOMError(e){return De(e,"DOMError")}}class si{match(e){return(e=>e instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}}class ri{constructor(){}match(e){return De(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 ni=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class oi{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(ni);return s&&(t=s[1],i=s[2]),[t,i]}}var ai=["fatal","error","warning","log","info","debug"];function li(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 ui{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 Ne(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: "+li(e)}isSeverityLevel(e){return Pe(e)&&!Te(e)&&ai.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var i=e[t];if(zt(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class ci{match(e){return Ne(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+li(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class di{match(e){return Ae(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 _i{match(e){return De(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Ne(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 Ae(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 hi=function(e,t){var{debugEnabled:i}=void 0===t?{}:t,s={_log(t){if(te&&(n.DEBUG||de.POSTHOG_DEBUG||i)&&!Ie(te.console)&&te.console){for(var s=("__rrweb_original__"in te.console[t]?te.console[t].__rrweb_original__:te.console[t]),r=arguments.length,o=new Array(r>1?r-1:0),a=1;r>a;a++)o[a-1]=arguments[a];s(e,...o)}},info(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("log",...t)},warn(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("warn",...t)},error(){for(var e=arguments.length,t=new Array(e),i=0;e>i;i++)t[i]=arguments[i];s._log("error",...t)},critical(){for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>hi(e+" "+t,i)};return s},pi=hi("[PostHog.js]"),gi=pi.createLogger;function vi(e,t){Ee(e)&&e.forEach(t)}function fi(e,t){if(!Re(e))if(Ee(e))e.forEach(t);else if($e(e))e.forEach(((e,i)=>t(e,i)));else for(var i in e)be.call(e,i)&&t(e[i],i)}var mi=function(e){for(var t=arguments.length,i=new 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 yi(e){for(var t=Object.keys(e),i=t.length,s=new Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var bi=function(e){try{return e()}catch(e){return}},wi=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){pi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),pi.critical(e)}}},Ei=function(e){var t={};return fi(e,(function(e,i){(Pe(e)&&e.length>0||Fe(e))&&(t[i]=e)})),t};var Si=["herokuapp.com","vercel.app","netlify.app"];function xi(e){var t=null==e?void 0:e.hostname;if(!Pe(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of Si)if(i===s)return!1;return!0}function ki(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 Ii(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 Fe(e)&&isFinite(e)&&Math.floor(e)===e});class Pi{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>1073741823||s>4294967295)throw new RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/Math.pow(2,8),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 Pi(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 new Error("Invalid UUIDv7 was generated");return e}clone(){return new Pi(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 Ti{constructor(){this._timestamp=0,this._counter=0,this._random=new Fi}generate(){var e=this.generateOrAbort();if(Ie(e)){this._timestamp=0;var t=this.generateOrAbort();if(Ie(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this._timestamp)this._timestamp=e,this._resetCounter();else{if(this._timestamp>=e+1e4)return;this._counter++,this._counter>4398046511103&&(this._timestamp++,this._resetCounter())}return Pi.fromFieldsV7(this._timestamp,Math.trunc(this._counter/Math.pow(2,30)),this._counter&Math.pow(2,30)-1,this._random.nextUint32())}_resetCounter(){this._counter=1024*this._random.nextUint32()+(1023&this._random.nextUint32())}}var Ci,Ri=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new 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};te&&!Ie(te.crypto)&&crypto.getRandomValues&&(Ri=e=>crypto.getRandomValues(e));class Fi{constructor(){this._buffer=new Uint32Array(8),this._cursor=1/0}nextUint32(){return this._buffer.length>this._cursor||(Ri(this._buffer),this._cursor=0),this._buffer[this._cursor++]}}var Li=()=>Oi().toString(),Oi=()=>(Ci||(Ci=new Ti)).generate(),$i="",Mi=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Ai={_is_supported:()=>!!re,_error(e){pi.error("cookieStore error: "+e)},_get(e){if(re){try{for(var t=e+"=",i=re.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}},_parse(e){var t;try{t=JSON.parse(Ai._get(e))||{}}catch(e){}return t},_set(e,t,i,s,r){if(re)try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=re),$i)return $i;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+Li();!$i&&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",$i=n)}return $i}(e);if(!i){var s=(e=>{var t=e.match(Mi);return t?t[0]:""})(e);s!==i&&pi.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(re.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(o="; secure");var u=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&pi.warn("cookieStore warning: large cookie, len="+u.length),re.cookie=u,u}catch(e){return}},_remove(e,t){if(null!=re&&re.cookie)try{Ai._set(e,"",-1,t)}catch(e){return}}},Di=null,Ni={_is_supported(){if(!Ce(Di))return Di;var e=!0;if(Ie(te))e=!1;else try{var t="__mplssupport__";Ni._set(t,"xyz"),'"xyz"'!==Ni._get(t)&&(e=!1),Ni._remove(t)}catch(t){e=!1}return e||pi.error("localStorage unsupported; falling back to cookie store"),Di=e,e},_error(e){pi.error("localStorage error: "+e)},_get(e){try{return null==te?void 0:te.localStorage.getItem(e)}catch(e){Ni._error(e)}return null},_parse(e){try{return JSON.parse(Ni._get(e))||{}}catch(e){}return null},_set(e,t){try{null==te||te.localStorage.setItem(e,JSON.stringify(t))}catch(e){Ni._error(e)}},_remove(e){try{null==te||te.localStorage.removeItem(e)}catch(e){Ni._error(e)}}},Ui=[a,"distinct_id",b,w,U,N,L],qi={},Hi={_is_supported:()=>!0,_error(e){pi.error("memoryStorage error: "+e)},_get:e=>qi[e]||null,_parse:e=>qi[e]||null,_set(e,t){qi[e]=t},_remove(e){delete qi[e]}},zi=null,ji={_is_supported(){if(!Ce(zi))return zi;if(zi=!0,Ie(te))zi=!1;else try{var e="__support__";ji._set(e,"xyz"),'"xyz"'!==ji._get(e)&&(zi=!1),ji._remove(e)}catch(e){zi=!1}return zi},_error(e){pi.error("sessionStorage error: ",e)},_get(e){try{return null==te?void 0:te.sessionStorage.getItem(e)}catch(e){ji._error(e)}return null},_parse(e){try{return JSON.parse(ji._get(e))||null}catch(e){}return null},_set(e,t){try{null==te||te.sessionStorage.setItem(e,JSON.stringify(t))}catch(e){ji._error(e)}},_remove(e){try{null==te||te.sessionStorage.removeItem(e)}catch(e){ji._error(e)}}};class Bi{constructor(e){this._instance=e}get _config(){return this._instance.config}get consent(){return this._getDnt()?0:this._storedConsent}isOptedOut(){return this._config.cookieless_mode===V||0===this.consent||-1===this.consent&&(this._config.opt_out_capturing_by_default||this._config.cookieless_mode===B)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}optInOut(e){this._storage._set(this._storageKey,e?1:0,this._config.cookie_expiration,this._config.cross_subdomain_cookie,this._config.secure_cookie)}reset(){this._storage._remove(this._storageKey,this._config.cross_subdomain_cookie)}get _storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get _storedConsent(){var e=this._storage._get(this._storageKey);return qe(e)?1:ve(He,e)?0:-1}get _storage(){var e=this._config.opt_out_capturing_persistence_type,t="localStorage"===e?Ni:Ai;if(!this._persistentStore||this._persistentStore!==t){this._persistentStore=t;var i="localStorage"===e?Ai:Ni;i._get(this._storageKey)&&(this._persistentStore._get(this._storageKey)||this.optInOut(qe(i._get(this._storageKey))),i._remove(this._storageKey,this._config.cross_subdomain_cookie))}return this._persistentStore}_getDnt(){return!!this._config.respect_dnt&&[null==se?void 0:se.doNotTrack,null==se?void 0:se.msDoNotTrack,de.doNotTrack].some((e=>qe(e)))}}var Vi=gi("[Dead Clicks]"),Wi=()=>!0,Gi=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(v)),s=e.instance.config.capture_dead_clicks;return Oe(s)?s:!!xe(s)||i};class Yi{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}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({[v]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this._loadScript((()=>{this._start()})):this.stop()}_loadScript(e){var t,i;null!=(t=de.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(t=>{t?Vi.error("failed to load script",t):e()}))}_start(){var e;if(re){if(!this._lazyLoadedDeadClicksAutocapture&&null!=(e=de.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=xe(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=de.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(re),Vi.info("starting...")}}else Vi.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,Vi.info("stopping..."))}}var Ki=gi("[SegmentIntegration]");var Ji="posthog-js";function Xi(e,t){var{organization:s,projectId:r,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{var l,u,c,d,_;if("*"!==o&&!o.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var h=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p,g=(null==(l=t.exception)?void 0:l.values)||[],v=g.map((e=>i({},e,{stacktrace:e.stacktrace?i({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map((e=>i({},e,{platform:"web:javascript"})))}):void 0}))),f={$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==(d=g[0])?void 0:d.value)||t.message,$sentry_exception_type:null==(_=g[0])?void 0:_.type,$sentry_tags:t.tags};return s&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+t.event_id),a&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class Qi{constructor(e,t,i,s,r,n){this.name=Ji,this.setupOnce=function(o){o(Xi(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class Zi{constructor(e){this._onSessionIdChange=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(pi.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this._currentPageview=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this._setupSessionRotationHandler()}_setupSessionRotationHandler(){var e;this._unsubscribeSessionId=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this._onSessionIdChange)}destroy(){var e;null==(e=this._unsubscribeSessionId)||e.call(this),this._unsubscribeSessionId=void 0}doPageView(e,t){var i,s=this._previousPageViewProperties(e,t);return this._currentPageview={pathname:null!==(i=null==te?void 0:te.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this._previousPageViewProperties(e,null==(t=this._currentPageview)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this._currentPageview)?void 0:e.pageViewId}}_previousPageViewProperties(e,t){var i=this._currentPageview;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:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(Ie(n)||Ie(o)||Ie(a)||Ie(l)||Ie(u)||Ie(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var d=n>1?ze(o/n,0,1,pi):1,_=n>1?ze(a/n,0,1,pi):1,h=l>1?ze(u/l,0,1,pi):1,p=l>1?ze(c/l,0,1,pi):1;s=mi(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:_,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:h,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var es=e=>{var t=null==re?void 0:re.createElement("a");return Ie(t)?null:(t.href=e,t)},ts=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(!Ee(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(e){pi.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},is=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],c=0;l.length>c;c++){var d=l[c].split("=");Ee(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(l[c]))}var _=a;return null!=o&&(_+="?"+u.join("&")),null!=r&&(_+="#"+r),_},ss=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},rs="https?://(.*)",ns=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],os=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ns],as="<masked>",ls=["li_fat_id"];function us(e,t,i){if(!re)return{};var s,r=t?[...ns,...i||[]]:[],n=cs(is(re.URL,r,as),e),o=(s={},fi(ls,(function(e){var t=Ai._get(e);s[e]=t||null})),s);return mi(o,n)}function cs(e,t){var i=os.concat(t||[]),s={};return fi(i,(function(t){var i=ts(e,t);s[t]=i||null})),s}function ds(e){var t=function(e){return e?0===e.search(rs+"google.([^/?]*)")?"google":0===e.search(rs+"bing.com")?"bing":0===e.search(rs+"yahoo.com")?"yahoo":0===e.search(rs+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!=t?"q":"p",s={};if(!Ce(t)){s.$search_engine=t;var r=re?ts(re.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function _s(){return navigator.language||navigator.userLanguage}var hs="$direct";function ps(){return(null==re?void 0:re.referrer)||hs}function gs(e,t){var i=e?[...ns,...t||[]]:[],s=null==ne?void 0:ne.href.substring(0,1e3);return{r:ps().substring(0,1e3),u:s?is(s,i,as):void 0}}function vs(e){var t,{r:i,u:s}=e,r={$referrer:i,$referring_domain:null==i?void 0:i==hs?hs:null==(t=es(i))?void 0:t.host};if(s){r.$current_url=s;var n=es(s);r.$host=null==n?void 0:n.host,r.$pathname=null==n?void 0:n.pathname;var o=cs(s);mi(r,o)}if(i){var a=ds(i);mi(r,a)}return r}function fs(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function ms(){try{return(new Date).getTimezoneOffset()}catch(e){return}}var ys=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class bs{constructor(e,t){this._config=e,this.props={},this._campaign_params_saved=!1,this._name=(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._storage=this._buildStorage(e),this.load(),e.debug&&pi.info("Persistence loaded",e.persistence,i({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this._disabled}_buildStorage(e){-1===ys.indexOf(e.persistence.toLowerCase())&&(pi.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=function(e){void 0===e&&(e=[]);var t=[...Ui,...e];return i({},Ni,{_parse(e){try{var t={};try{t=Ai._parse(e)||{}}catch(e){}var i=mi(t,JSON.parse(Ni._get(e)||"{}"));return Ni._set(e,i),i}catch(e){}return null},_set(e,i,s,r,n,o){try{Ni._set(e,i,void 0,void 0,o);var a={};t.forEach((e=>{i[e]&&(a[e]=i[e])})),Object.keys(a).length&&Ai._set(e,a,s,r,n,o)}catch(e){Ni._error(e)}},_remove(e,t){try{null==te||te.localStorage.removeItem(e),Ai._remove(e,t)}catch(e){Ni._error(e)}}})}(e.cookie_persisted_properties||[]),s=e.persistence.toLowerCase();return"localstorage"===s&&Ni._is_supported()?Ni:"localstorage+cookie"===s&&t._is_supported()?t:"sessionstorage"===s&&ji._is_supported()?ji:"memory"===s?Hi:"cookie"===s?Ai:t._is_supported()?t:Ai}_isFeatureFlagCacheStale(e){var t=null!=e?e:this._config.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[F];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return fi(this.props,((t,i)=>{if(i===E&&xe(t)){if(!this._isFeatureFlagCacheStale())for(var s=Object.keys(t),r=0;s.length>r;r++)e["$feature/"+s[r]]=t[s[r]]}else-1===z.indexOf(i)&&(e[i]=t)})),e}load(){if(!this._disabled){var e=this._storage._parse(this._name);e&&(this.props=mi({},e))}}save(){this._disabled||this._storage._set(this._name,this.props,this._expire_days,this._cross_subdomain,this._secure,this._config.debug)}remove(){this._storage._remove(this._name,!1),this._storage._remove(this._name,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(xe(e)){Ie(t)&&(t="None"),this._expire_days=Ie(i)?this._default_expiry:i;var s=!1;if(fi(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(xe(e)){this._expire_days=Ie(t)?this._default_expiry:t;var i=!1;if(fi(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._campaign_params_saved){var e=us(this._config.custom_campaign_params,this._config.mask_personal_data_properties,this._config.custom_personal_data_properties);ke(Ei(e))||this.register(e),this._campaign_params_saved=!0}}update_search_keyword(){var e;this.register((e=null==re?void 0:re.referrer)?ds(e):{})}update_referrer_info(){var e;this.register_once({$referrer:ps(),$referring_domain:null!=re&&re.referrer&&(null==(e=es(re.referrer))?void 0:e.host)||hs},void 0)}set_initial_person_info(){this.props[A]||this.props[D]||this.register_once({[N]:gs(this._config.mask_personal_data_properties,this._config.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};fi([D,A],(t=>{var i=this.props[t];i&&fi(i,(function(t,i){e["$initial_"+me(i)]=t}))}));var t,i,s=this.props[N];if(s){var r=(t=vs(s),i={},fi(t,(function(e,t){i["$initial_"+me(t)]=e})),i);mi(e,r)}return e}safe_merge(e){return fi(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this._default_expiry=this._expire_days=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._buildStorage(e),r=this.props;this.clear(),this._storage=s,this.props=r,this.save()}}set_disabled(e){this._disabled=e,this._disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this._cross_subdomain&&(this._cross_subdomain=e,this.remove(),this.save())}set_secure(e){e!==this._secure&&(this._secure=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[u]||{};i[e]=t,this.props[u]=i,this.save()}remove_event_timer(e){var t=(this.props[u]||{})[e];return Ie(t)||(delete this.props[u][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}var ws={Activation:"events",Cancellation:"cancelEvents"},Es={Button:"button",Tab:"tab",Selector:"selector"},Ss={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},xs={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},ks={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Is={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Ps={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Ts={Once:"once",Recurring:"recurring",Always:"always"},Cs={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Rs={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Fs={Popover:"popover",Inline:"inline"},Ls={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Os={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},$s={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Ms=gi("[RateLimiter]");class As{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=>{Ms.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4}))}catch(e){return void Ms.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){var t,i,s;void 0===e&&(e=!1);var{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(M))&&void 0!==t?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);var l=1>a.tokens;return l||e||(a.tokens=Math.max(0,a.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(M,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var Ds=gi("[RemoteConfig]");class Ns{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=de._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}_loadRemoteConfigJs(e){var t,i;null!=(t=de.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}_loadRemoteConfigJSON(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 Ds.info("Using preloaded remote config",this.remoteConfig),this._onRemoteConfig(this.remoteConfig),void this._startRefreshInterval();if(this._instance._shouldDisableFlags())return void Ds.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs((e=>{if(!e)return Ds.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON((e=>{this._onRemoteConfig(e),this._startRefreshInterval()}));this._onRemoteConfig(e),this._startRefreshInterval()}))}catch(e){Ds.error("Error loading remote config",e)}}stop(){this._refreshInterval&&(clearInterval(this._refreshInterval),this._refreshInterval=void 0)}refresh(){this._instance._shouldDisableFlags()||"hidden"===(null==re?void 0:re.visibilityState)||this._instance.reloadFeatureFlags()}_startRefreshInterval(){var e;if(!this._refreshInterval){var t=null!==(e=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==e?e:3e5;0!==t&&(this._refreshInterval=setInterval((()=>{this.refresh()}),t))}}_onRemoteConfig(e){var t;e||Ds.error("Failed to fetch remote config from PostHog."),this._instance._onRemoteConfig(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 Us=["fatal","error","warning","log","info","debug"],qs={GZipJS:"gzip-js",Base64:"base64"},Hs=Uint8Array,zs=Uint16Array,js=Uint32Array,Bs=new Hs([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]),Vs=new Hs([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]),Ws=new Hs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Gs=function(e,t){for(var i=new zs(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new js(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]},Ys=Gs(Bs,2),Ks=Ys[1];Ys[0][28]=258,Ks[258]=28;for(var Js=Gs(Vs,0)[1],Xs=new zs(32768),Qs=0;32768>Qs;++Qs){var Zs=(43690&Qs)>>>1|(21845&Qs)<<1;Xs[Qs]=((65280&(Zs=(61680&(Zs=(52428&Zs)>>>2|(13107&Zs)<<2))>>>4|(3855&Zs)<<4))>>>8|(255&Zs)<<8)>>>1}var er=function(e,t,i){for(var s=e.length,r=0,n=new zs(t);s>r;++r)++n[e[r]-1];var o,a=new zs(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;if(i){o=new zs(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],d=a[e[r]-1]++<<c,_=d|(1<<c)-1;_>=d;++d)o[Xs[d]>>>l]=u}else for(o=new zs(s),r=0;s>r;++r)o[r]=Xs[a[e[r]-1]++]>>>15-e[r];return o},tr=new Hs(288);for(Qs=0;144>Qs;++Qs)tr[Qs]=8;for(Qs=144;256>Qs;++Qs)tr[Qs]=9;for(Qs=256;280>Qs;++Qs)tr[Qs]=7;for(Qs=280;288>Qs;++Qs)tr[Qs]=8;var ir=new Hs(32);for(Qs=0;32>Qs;++Qs)ir[Qs]=5;var sr=er(tr,9,0),rr=er(ir,5,0),nr=function(e){return(e/8>>0)+(7&e&&1)},or=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof zs?zs:e instanceof js?js:Hs)(i-t);return s.set(e.subarray(t,i)),s},ar=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},lr=function(e,t,i){var s=t/8>>0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},ur=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 Hs(0),0];if(1==r){var o=new Hs(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(e,t){return e.f-t.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,c=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=c&&i[d].f>i[u].f?u++:d++],i[c++]={s:-1,f:a.f+l.f,l:a,r:l};var _=n[0].s;for(s=1;r>s;++s)n[s].s>_&&(_=n[s].s);var h=new zs(_+1),p=cr(i[c-1],h,0);if(p>t){s=0;var g=0,v=p-t,f=1<<v;for(n.sort((function(e,t){return h[t.s]-h[e.s]||e.f-t.f}));r>s;++s){var m=n[s].s;if(t>=h[m])break;g+=f-(1<<p-h[m]),h[m]=t}for(g>>>=v;g>0;){var y=n[s].s;t>h[y]?g-=1<<t-h[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;h[b]==t&&(--h[b],++g)}p=t}return[new Hs(h),p]},cr=function(e,t,i){return-1==e.s?Math.max(cr(e.l,t,i+1),cr(e.r,t,i+1)):t[e.s]=i},dr=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new zs(++t),s=0,r=e[0],n=1,o=function(e){i[s++]=e},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},_r=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},hr=function(e,t,i){var s=i.length,r=nr(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)},pr=function(e,t,i,s,r,n,o,a,l,u,c){ar(t,c++,i),++r[256];for(var d=ur(r,15),_=d[0],h=d[1],p=ur(n,15),g=p[0],v=p[1],f=dr(_),m=f[0],y=f[1],b=dr(g),w=b[0],E=b[1],S=new zs(19),x=0;m.length>x;++x)S[31&m[x]]++;for(x=0;w.length>x;++x)S[31&w[x]]++;for(var k=ur(S,7),I=k[0],P=k[1],T=19;T>4&&!I[Ws[T-1]];--T);var C,R,F,L,O=u+5<<3,M=_r(r,tr)+_r(n,ir)+o,A=_r(r,_)+_r(n,g)+o+14+3*T+_r(S,I)+(2*S[16]+3*S[17]+7*S[18]);if(M>=O&&A>=O)return hr(t,c,e.subarray(l,l+u));if(ar(t,c,1+(M>A)),c+=2,M>A){C=er(_,h,0),R=_,F=er(g,v,0),L=g;var D=er(I,P,0);for(ar(t,c,y-257),ar(t,c+5,E-1),ar(t,c+10,T-4),c+=14,x=0;T>x;++x)ar(t,c+3*x,I[Ws[x]]);c+=3*T;for(var N=[m,w],U=0;2>U;++U){var q=N[U];for(x=0;q.length>x;++x)ar(t,c,D[H=31&q[x]]),c+=I[H],H>15&&(ar(t,c,q[x]>>>5&127),c+=q[x]>>>12)}}else C=sr,R=tr,F=rr,L=ir;for(x=0;a>x;++x)if(s[x]>255){var H;lr(t,c,C[257+(H=s[x]>>>18&31)]),c+=R[H+257],H>7&&(ar(t,c,s[x]>>>23&31),c+=Bs[H]);var z=31&s[x];lr(t,c,F[z]),c+=L[z],z>3&&(lr(t,c,s[x]>>>5&8191),c+=Vs[z])}else lr(t,c,C[s[x]]),c+=R[s[x]];return lr(t,c,C[256]),c+R[256]},gr=new js([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),vr=function(){for(var e=new js(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),fr=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function mr(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p(t){for(var i=e,s=0;t.length>s;++s)i=vr[255&i^t[s]]^i>>>8;e=i},d(){return 4294967295^e}}}(),s=e.length;i.p(e);var r,n,o,a,l,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(e,t,i,s,r,n){var o=e.length,a=new Hs(s+o+5*(1+Math.floor(o/7e3))+r),l=a.subarray(s,a.length-r),u=0;if(!t||8>o)for(var c=0;o>=c;c+=65535){var d=c+65535;o>d?u=hr(l,u,e.subarray(c,d)):(l[c]=!0,u=hr(l,u,e.subarray(c,o)))}else{for(var _=gr[t-1],h=_>>>13,p=8191&_,g=(1<<i)-1,v=new zs(32768),f=new zs(g+1),m=Math.ceil(i/3),y=2*m,b=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<y)&g},w=new js(25e3),E=new zs(288),S=new zs(32),x=0,k=0,I=(c=0,0),P=0,T=0;o>c;++c){var C=b(c),R=32767&c,F=f[C];if(v[R]=F,f[C]=R,c>=P){var L=o-c;if((x>7e3||I>24576)&&L>423){u=pr(e,l,0,w,E,S,k,I,T,c-T,u),I=x=k=0,T=c;for(var O=0;286>O;++O)E[O]=0;for(O=0;30>O;++O)S[O]=0}var M=2,A=0,D=p,N=R-F&32767;if(L>2&&C==b(c-N))for(var U=Math.min(h,L)-1,q=Math.min(32767,c),H=Math.min(258,L);q>=N&&--D&&R!=F;){if(e[c+M]==e[c+M-N]){for(var z=0;H>z&&e[c+z]==e[c+z-N];++z);if(z>M){if(M=z,A=N,z>U)break;var j=Math.min(N,z-2),B=0;for(O=0;j>O;++O){var V=c-N+O+32768&32767,W=V-v[V]+32768&32767;W>B&&(B=W,F=V)}}}N+=(R=F)-(F=v[R])+32768&32767}if(A){w[I++]=268435456|Ks[M]<<18|Js[A];var G=31&Ks[M],Y=31&Js[A];k+=Bs[G]+Vs[Y],++E[257+G],++S[Y],P=c+M,++x}else w[I++]=e[c],++E[e[c]]}}u=pr(e,l,!0,w,E,S,k,I,T,c-T,u)}return or(a,0,s+nr(u)+r)}(n=e,null==(o=t).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),c=u.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:9==t.level?2:0,e[9]=3,0!=t.mtime&&fr(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)}}(u,t),fr(u,c-8,i.d()),fr(u,c-4,s),u}var yr=!!ae||!!oe,br="text/plain",wr=function(e,t,s){var r;void 0===s&&(s=!0);var[n,o]=e.split("?"),a=i({},t),l=null!==(r=null==o?void 0:o.split("&").map((e=>{var t,[i,r]=e.split("="),n=s&&null!==(t=a[i])&&void 0!==t?t:r;return delete a[i],i+"="+n})))&&void 0!==r?r:[],u=function(e,t){var i,s;void 0===t&&(t="&");var r=[];return fi(e,(function(e,t){Ie(e)||Ie(t)||"undefined"===t||(i=encodeURIComponent((e=>e instanceof File)(e)?e.name:e.toString()),s=encodeURIComponent(t),r[r.length]=s+"="+i)})),r.join(t)}(a);return u&&l.push(u),n+"?"+l.join("&")},Er=(e,t)=>JSON.stringify(e,((e,t)=>"bigint"==typeof t?t.toString():t),t),Sr=e=>{if(e._encodedBody)return e._encodedBody;var{data:t,compression:i}=e;if(t){if(i===qs.GZipJS){var s=mr(function(e,t){var i=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var s=new Hs(e.length+(e.length>>>1)),r=0,n=function(e){s[r++]=e},o=0;i>o;++o){if(r+5>s.length){var a=new Hs(r+8+(i-o<<1));a.set(s),s=a}var l=e.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return or(s,0,r)}(Er(t)),{mtime:0});return{contentType:br,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(i===qs.Base64){var r=function(e){return e?btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,((e,t)=>String.fromCharCode(parseInt(t,16))))):e}(Er(t)),n=(e=>"data="+encodeURIComponent("string"==typeof e?e:Er(e)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Er(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},xr=function(){var e=t((function*(e){var t=Er(e.data),s=yield function(e,t){return _e.apply(this,arguments)}(t,n.DEBUG);if(!s)return e;var r=yield s.arrayBuffer();return i({},e,{_encodedBody:{contentType:br,body:r,estimatedSize:r.byteLength}})}));return function(t){return e.apply(this,arguments)}}(),kr=[];oe&&kr.push({transport:"fetch",method(e){var t,s,{contentType:r,body:n,estimatedSize:o}=null!==(t=Sr(e))&&void 0!==t?t:{},a=new Headers;fi(e.headers,(function(e,t){a.append(t,e)})),r&&a.append("Content-Type",r);var l=e.url,u=null;if(le){var c=new le;u={signal:c.signal,timeout:setTimeout((()=>c.abort()),e.timeout)}}oe(l,i({method:(null==e?void 0:e.method)||"GET",headers:a,keepalive:"POST"===e.method&&52428.8>(o||0),body:n,signal:null==(s=u)?void 0:s.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){pi.error(e)}null==e.callback||e.callback(s)})))).catch((t=>{pi.error(t),null==e.callback||e.callback({statusCode:0,error:t})})).finally((()=>u?clearTimeout(u.timeout):null))}}),ae&&kr.push({transport:"XHR",method(e){var t,i=new ae;i.open(e.method||"GET",e.url,!0);var{contentType:s,body:r}=null!==(t=Sr(e))&&void 0!==t?t:{};fi(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!=se&&se.sendBeacon&&kr.push({transport:"sendBeacon",method(e){var t=wr(e.url,{beacon:"1"});try{var i,{contentType:s,body:r}=null!==(i=Sr(e))&&void 0!==i?i:{};if(!r)return;var n=r instanceof Blob?r:new Blob([r],{type:s});se.sendBeacon(t,n)}catch(e){}}});var Ir=3e3;class Pr{constructor(e,t){this._isPaused=!0,this._queue=[],this._flushTimeoutMs=ze((null==t?void 0:t.flush_interval_ms)||Ir,250,5e3,pi.createLogger("flush interval"),Ir),this._sendRequest=e}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){this._clearFlushTimeout();var e=this._queue.length>0?this._formatQueue():{},t=Object.values(e);[...t.filter((e=>0===e.url.indexOf("/e"))),...t.filter((e=>0!==e.url.indexOf("/e")))].map((e=>{this._sendRequest(i({},e,{transport:"sendBeacon"}))}))}enable(){this._isPaused=!1,this._setFlushTimeout()}_setFlushTimeout(){var e=this;this._isPaused||(this._flushTimeout=setTimeout((()=>{if(this._clearFlushTimeout(),this._queue.length>0){var t=this._formatQueue(),i=function(){var i=t[s],r=(new Date).getTime();i.data&&Ee(i.data)&&fi(i.data,(e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp})),e._sendRequest(i)};for(var s in t)i()}}),this._flushTimeoutMs))}_clearFlushTimeout(){clearTimeout(this._flushTimeout),this._flushTimeout=void 0}_formatQueue(){var e={};return fi(this._queue,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;Ie(e[n])&&(e[n]=i({},r,{data:[]})),null==(s=e[n].data)||s.push(r.data)})),this._queue=[],e}}var Tr=["retriesPerformedSoFar"];class Cr{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._instance=e,this._queue=[],this._areWeOnline=!0,!Ie(te)&&"onLine"in te.navigator&&(this._areWeOnline=te.navigator.onLine,this._onlineListener=()=>{this._areWeOnline=!0,this._flush()},this._offlineListener=()=>{this._areWeOnline=!1},ki(te,"online",this._onlineListener),ki(te,"offline",this._offlineListener))}get length(){return this._queue.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=s(e,Tr);Le(t)&&(r.url=wr(r.url,{retry_count:t})),this._instance._send_request(i({},r,{callback:e=>{200===e.statusCode||e.statusCode>=400&&500>e.statusCode||(null!=t?t:0)>=10?null==r.callback||r.callback(e):this._enqueue(i({retriesPerformedSoFar:t},r))}}))}_enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,s=Math.min(18e5,t),r=Math.random()-.5;return Math.ceil(s+r*(s-i))}(t),s=Date.now()+i;this._queue.push({retryAt:s,requestOptions:e});var r="Enqueued failed request for retry in "+i;navigator.onLine||(r+=" (Browser is offline)"),pi.warn(r),this._isPolling||(this._isPolling=!0,this._poll())}_poll(){if(this._poller&&clearTimeout(this._poller),0===this._queue.length)return this._isPolling=!1,void(this._poller=void 0);this._poller=setTimeout((()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._poll()}),this._pollIntervalMs)}_flush(){var e=Date.now(),t=[],i=this._queue.filter((i=>e>i.retryAt||(t.push(i),!1)));if(this._queue=t,i.length>0)for(var{requestOptions:s}of i)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._isPolling=!1,Ie(te)||(this._onlineListener&&(te.removeEventListener("online",this._onlineListener),this._onlineListener=void 0),this._offlineListener&&(te.removeEventListener("offline",this._offlineListener),this._offlineListener=void 0)),this._queue))try{this._instance._send_request(i({},e,{transport:"sendBeacon"}))}catch(e){pi.error(e)}this._queue=[]}}class Rr{constructor(e){this._updateScrollData=()=>{var e,t,i,s;this._context||(this._context={});var r=this.scrollElement(),n=this.scrollY(),o=r?Math.max(0,r.scrollHeight-r.clientHeight):0,a=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this._context.lastScrollY=Math.ceil(n),this._context.maxScrollY=Math.max(n,null!==(e=this._context.maxScrollY)&&void 0!==e?e:0),this._context.maxScrollHeight=Math.max(o,null!==(t=this._context.maxScrollHeight)&&void 0!==t?t:0),this._context.lastContentY=a,this._context.maxContentY=Math.max(a,null!==(i=this._context.maxContentY)&&void 0!==i?i:0),this._context.maxContentHeight=Math.max(l,null!==(s=this._context.maxContentHeight)&&void 0!==s?s:0)},this._instance=e}get _scrollRoot(){return this._instance.config.scroll_root_selector}getContext(){return this._context}resetContext(){var e=this._context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){ki(te,"scroll",this._updateScrollData,{capture:!0}),ki(te,"scrollend",this._updateScrollData,{capture:!0}),ki(te,"resize",this._updateScrollData)}scrollElement(){if(!this._scrollRoot)return null==te?void 0:te.document.documentElement;var e=Ee(this._scrollRoot)?this._scrollRoot:[this._scrollRoot];for(var t of e){var i=null==te?void 0:te.document.querySelector(t);if(i)return i}}scrollY(){if(this._scrollRoot){var e=this.scrollElement();return e&&e.scrollTop||0}return te&&(te.scrollY||te.pageYOffset||te.document.documentElement.scrollTop)||0}scrollX(){if(this._scrollRoot){var e=this.scrollElement();return e&&e.scrollLeft||0}return te&&(te.scrollX||te.pageXOffset||te.document.documentElement.scrollLeft)||0}}var Fr=e=>gs(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class Lr{constructor(e,t,i,s){this._onSessionIdCallback=e=>{var t=this._getStored();if(!t||t.sessionId!==e){var i={sessionId:e,props:this._sessionSourceParamGenerator(this._instance)};this._persistence.register({[O]:i})}},this._instance=e,this._sessionIdManager=t,this._persistence=i,this._sessionSourceParamGenerator=s||Fr,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[O]}getSetOnceProps(){var e,t=null==(e=this._getStored())?void 0:e.props;return t?"r"in t?vs(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 fi(Ei(this.getSetOnceProps()),((t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+me(i)]=t})),e}}class Or{constructor(){this._events={}}on(e,t){return this._events[e]||(this._events[e]=[]),this._events[e].push(t),()=>{this._events[e]=this._events[e].filter((e=>e!==t))}}emit(e,t){for(var i of this._events[e]||[])i(t);for(var s of this._events["*"]||[])s(e,t)}}var $r=gi("[SessionId]");class Mr{on(e,t){return this._eventEmitter.on(e,t)}constructor(e,t,i){var s;if(this._sessionIdChangedHandlers=[],this._beforeUnloadListener=void 0,this._eventEmitter=new Or,this._sessionHasBeenIdleTooLong=(e,t)=>!(!Le(e)||!Le(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===V)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this._config=e.config,this._persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||Li,this._windowIdGenerator=i||Li;var r=this._config.persistence_name||this._config.token;if(this._sessionTimeoutMs=1e3*ze(this._config.session_idle_timeout_seconds||1800,60,36e3,$r.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._resetIdleTimer(),this._window_id_storage_key="ph_"+r+"_window_id",this._primary_window_exists_storage_key="ph_"+r+"_primary_window_exists",this._canUseSessionStorage()){var n=ji._parse(this._window_id_storage_key),o=ji._parse(this._primary_window_exists_storage_key);n&&!o?this._windowId=n:ji._remove(this._window_id_storage_key),ji._set(this._primary_window_exists_storage_key,!0)}if(null!=(s=this._config.bootstrap)&&s.sessionID)try{var a=(e=>{var t=this._config.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw new Error("Not a valid UUID");if("7"!==t[12])throw new Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this._setSessionId(this._config.bootstrap.sessionID,(new Date).getTime(),a)}catch(e){$r.error("Invalid sessionID in bootstrap",e)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return Ie(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter((t=>t!==e))}}_canUseSessionStorage(){return"memory"!==this._config.persistence&&!this._persistence._disabled&&ji._is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&ji._set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?ji._parse(this._window_id_storage_key):null}_setSessionId(e,t,i){e===this._sessionId&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this._sessionId=e,this._persistence.register({[b]:[t,e,i]}))}_getSessionId(){var e=this._persistence.props[b];return Ee(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}destroy(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=void 0,this._beforeUnloadListener&&te&&(te.removeEventListener(J,this._beforeUnloadListener,{capture:!1}),this._beforeUnloadListener=void 0),this._sessionIdChangedHandlers=[]}_listenToReloadWindow(){this._beforeUnloadListener=()=>{this._canUseSessionStorage()&&ji._remove(this._primary_window_exists_storage_key)},ki(te,J,this._beforeUnloadListener,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this._config.cookieless_mode===V)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[s,r,n]=this._getSessionId(),o=this._getWindowId(),a=Le(n)&&Math.abs(i-n)>864e5,l=!1,u=!r,c=!u&&!e&&this._sessionHasBeenIdleTooLong(i,s);u||c||a?(r=this._sessionIdGenerator(),o=this._windowIdGenerator(),$r.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this._windowIdGenerator(),l=!0);var d=Le(s)&&e&&!a?s:i,_=Le(n)?n:(new Date).getTime();return this._setWindowId(o),this._setSessionId(r,d,_),e||this._resetIdleTimer(),l&&this._sessionIdChangedHandlers.forEach((e=>e(r,o,l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0))),{sessionId:r,windowId:o,sessionStartTimestamp:_,changeReason:l?{noSessionId:u,activityTimeout:c,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:s}}_resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout((()=>{var[e]=this._getSessionId();if(this._sessionHasBeenIdleTooLong((new Date).getTime(),e)){var t=this._sessionId;this.resetSessionId(),this._eventEmitter.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var Ar=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&ge(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some((e=>ge(null==e?void 0:e.brand,t))))return!0}catch(e){}return!!e.webdriver},Dr=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 Nr(e,t,i){return Er({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var Ur={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=>Dr(t,e))))),not_regex:(e,t)=>t.every((t=>e.every((e=>!Dr(t,e))))),icontains:(e,t)=>t.map(qr).some((t=>e.map(qr).some((e=>t.includes(e))))),not_icontains:(e,t)=>t.map(qr).every((t=>e.map(qr).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)))}))},qr=e=>e.toLowerCase();function Hr(e,t){return!e||Object.entries(e).every((e=>{var[i,s]=e,r=null==t?void 0:t[i];if(Ie(r)||Ce(r))return!1;var n=[String(r)],o=Ur[s.operator];return!!o&&o(s.values,n)}))}var zr="custom",jr="i.posthog.com";class Br{constructor(e){this._regionCache={},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("."+jr,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(this._regionCache[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":zr),this._regionCache[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===zr)return this.apiHost+t;var i=jr+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var Vr=gi("[Surveys]"),Wr="seenSurvey_",Gr=(e,t)=>{var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i},Yr=e=>((e,t)=>{var i=""+Wr+t.id;return t.current_iteration&&t.current_iteration>0&&(i=""+Wr+t.id+"_"+t.current_iteration),i})(0,e),Kr=[ks.Popover,ks.Widget,ks.API],Jr={ignoreConditions:!1,ignoreDelay:!1,displayType:Fs.Popover},Xr=gi("[PostHog ExternalIntegrations]"),Qr={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Zr{constructor(e){this._instance=e}_loadScript(e,t){var i;null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(e=>{if(e)return Xr.error("failed to load script",e);t()}))}startIfEnabledOrStop(){var e=this,t=function(t){var i,r,n;!s||null!=(i=de.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e._loadScript(Qr[t],(()=>{var i;null==(i=de.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)})),!s&&null!=(r=de.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[t]&&(null==(n=de.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,s]of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;t(i)}}}var en={},tn=0,sn=()=>{},rn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',nn="Surveys module not available",on="sanitize_properties is deprecated. Use before_send instead",an="Invalid value for property_denylist config: ",ln="posthog",un=!yr&&-1===(null==ce?void 0:ce.indexOf("MSIE"))&&-1===(null==ce?void 0:ce.indexOf("Mozilla")),cn=e=>{var t;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:xi(null==re?void 0:re.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:sn,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:ne&&Pe(null==ne?void 0:ne.search)&&-1!==ne.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==te||null==(t=te.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){pi.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:Y,before_send:void 0,request_queue_config:{flush_interval_ms:Ir},error_tracking:{},_onCapture:sn,__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))},dn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],_n=e=>{var t={};for(var[i,s]of dn)Ie(e[i])||(t[s]=e[i]);var r=mi({},t,e);return Ee(e.property_blacklist)&&(Ie(e.property_denylist)?r.property_denylist=e.property_blacklist:Ee(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:pi.error(an+e.property_denylist)),r};class hn{constructor(){this.__forceAllowLocalhost=!1}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){pi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class pn{_replaceExtension(e,t){if(e){var i=this._extensions.indexOf(e);-1!==i&&this._extensions.splice(i,1)}return this._extensions.push(t),null==t.initialize||t.initialize(),t}get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){var e;this.webPerformance=new hn,this._personProcessingSetOncePropertiesSent=!1,this.version=n.LIB_VERSION,this._internalEventEmitter=new Or,this._extensions=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=cn(),this.SentryIntegration=Qi,this.sentryIntegration=e=>function(e,t){var i=Xi(e,t);return{name:Ji,processEvent:e=>i(e)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._visibilityStateListener=null,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.scrollManager=new Rr(this),this.pageViewManager=new Zi(this),this.rateLimiter=new As(this),this.requestRouter=new Br(this),this.consent=new Bi(this),this.externalIntegrations=new Zr(this);var t=null!==(e=pn.__defaultExtensionClasses)&&void 0!==e?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=Pe(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=Pe(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",(e=>pi.info('send "'+(null==e?void 0:e.event)+'"',e)))}init(e,t,i){if(i&&i!==ln){var s,r=null!==(s=en[i])&&void 0!==s?s:new pn;return r._init(e,t,i),en[i]=r,en[ln][i]=r,r}return this._init(e,t,i)}_init(e,t,s){var r,o;if(void 0===t&&(t={}),Ie(e)||Te(e))return pi.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._checkLocalStorageForDebug(t.debug),this._originalUserConfig=t,this._triggered_notifs=[],t.person_profiles?this._initialPersonProfilesConfig=t.person_profiles:t.process_person&&(this._initialPersonProfilesConfig=t.process_person),this.set_config(mi({},cn(t.defaults),_n(t),{name:s,token:e})),this.config.on_xhr_error&&pi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:qs.GZipJS;var a=this._is_persistence_disabled();this.persistence=new bs(this.config,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new bs(i({},this.config,{persistence:"sessionStorage"}),a);var l=i({},this.persistence.props),u=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this._requestQueue=new Pr((e=>this._send_retriable_request(e)),this.config.request_queue_config),this._retryQueue=new Cr(this),this.__request_queue=[];var c=this.config.cookieless_mode===V||this.config.cookieless_mode===B&&this.consent.isExplicitlyOptedOut();if(c||(this.sessionManager=new Mr(this),this.sessionPropsManager=new Lr(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(pi.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this._initExtensions(c)}),0)):(pi.info("Initializing extensions synchronously"),this._initExtensions(c)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&pi.info("Starting in debug mode",{this:this,config:t,thisC:i({},this.config),p:l,s:u}),!this.config.identity_distinct_id||null!=(r=t.bootstrap)&&r.distinctID||(t.bootstrap=i({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=t.bootstrap)?void 0:o.distinctID)){var d=t.bootstrap.distinctID,_=this.get_distinct_id(),h=this.persistence.get_property(L);if(t.bootstrap.isIdentifiedID&&null!=_&&_!==d&&h===W)this.identify(d);else if(t.bootstrap.isIdentifiedID&&null!=_&&_!==d&&h===G)pi.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 p=this.config.get_device_id(Li()),g=t.bootstrap.isIdentifiedID?p:d;this.persistence.set_property(L,t.bootstrap.isIdentifiedID?G:W),this.register({distinct_id:d,$device_id:g})}}if(c)this.register_once({distinct_id:H,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(Li());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(L,W)}return ki(te,"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()||Li();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(L,G)),t()},r=i.user();"then"in r&&Se(r.then)?r.then(s):s(r)}(e,(()=>{i.register((e=>{Promise&&Promise.resolve||Ki.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(Ki.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(Ki.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};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,X),identify:e=>t(e,Z),screen:e=>t(e,"$screen")}})(e)).then((()=>{t()}))}))}(this,(()=>this._loaded())):this._loaded(),Se(this.config._onCapture)&&this.config._onCapture!==sn&&(pi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(e=>this.config._onCapture(e.event,e)))),this.config.ip&&pi.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}_initExtensions(e){var t,s,r,n,o,a,l,u=performance.now(),c=i({},pn.__defaultExtensionClasses,this.config.__extensionClasses),d=[];c.featureFlags&&this._extensions.push(this.featureFlags=null!==(t=this.featureFlags)&&void 0!==t?t:new c.featureFlags(this)),c.exceptions&&this._extensions.push(this.exceptions=null!==(s=this.exceptions)&&void 0!==s?s:new c.exceptions(this)),c.historyAutocapture&&this._extensions.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this._extensions.push(new c.tracingHeaders(this)),c.siteApps&&this._extensions.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this._extensions.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),c.autocapture&&this._extensions.push(this.autocapture=new c.autocapture(this)),c.surveys&&this._extensions.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new c.surveys(this)),c.logs&&this._extensions.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new c.logs(this)),c.conversations&&this._extensions.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new c.conversations(this)),c.productTours&&this._extensions.push(this.productTours=new c.productTours(this)),c.heatmaps&&this._extensions.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this._extensions.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this._extensions.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this._extensions.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Gi)),c.toolbar&&this._extensions.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new c.toolbar(this)),c.experiments&&this._extensions.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new c.experiments(this)),this._extensions.forEach((e=>{e.initialize&&d.push((()=>{null==e.initialize||e.initialize()}))})),d.push((()=>{if(this._pendingRemoteConfig){var e=this._pendingRemoteConfig;this._pendingRemoteConfig=void 0,this._onRemoteConfig(e)}})),this._processInitTaskQueue(d,u)}_processInitTaskQueue(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this._processInitTaskQueue(e,t)}),0);var i=e.shift();if(i)try{i()}catch(e){pi.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&&pi.info("PostHog extensions initialized ("+s+"ms)")}_onRemoteConfig(e){var t;if(!re||!re.body)return pi.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this._onRemoteConfig(e)}),500);this.config.__preview_deferred_init_extensions&&(this._pendingRemoteConfig=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ve(e.supportedCompression,qs.GZipJS)?qs.GZipJS:ve(e.supportedCompression,qs.Base64)?qs.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:Y}),this._extensions.forEach((t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e)))}_loaded(){try{this.config.loaded(this)}catch(e){pi.critical("`loaded` function failed",e)}if(this._start_queue_if_opted_in(),this.config.internal_or_test_user_hostname&&null!=ne&&ne.hostname){var e=ne.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===V)&&this._captureInitialPageview()}),1),this._remoteConfigLoader=new Ns(this),this._remoteConfigLoader.load()}_start_queue_if_opted_in(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this._requestQueue)||e.enable())}_dom_loaded(){this.is_capturing()&&vi(this.__request_queue,(e=>this._send_retriable_request(e))),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t,i;null==(e=this.surveys)||e.handlePageUnload(),this.config.request_batching?(this._shouldCapturePageleave()&&this.capture(Q),null==(t=this._requestQueue)||t.unload(),null==(i=this._retryQueue)||i.unload()):this._shouldCapturePageleave()&&this.capture(Q,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(un?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=wr(e.url,{ip:this.config.ip?1:0}),e.headers=i({},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,s,r,o=i({},e);o.timeout=o.timeout||6e4,o.url=wr(o.url,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:o.compression});var a=null!==(t=o.transport)&&void 0!==t?t:"fetch",l=kr.filter((e=>!o.disableTransport||!e.transport||!o.disableTransport.includes(e.transport))),u=null!==(s=null==(r=function(e,t){for(var i=0;e.length>i;i++)if(e[i].transport===a)return e[i]}(l))?void 0:r.method)&&void 0!==s?s:l[0].method;if(!u)throw new Error("No available transport method");"sendBeacon"!==a&&o.data&&o.compression===qs.GZipJS&&ue?xr(o).then((e=>{u(e)})).catch((()=>{u(o)})):u(o)})(i({},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)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){tn++;try{var t,i=[],s=[],r=[];vi(e,(e=>{e&&(Ee(t=e[0])?r.push(e):Se(e)?e.call(this):Ee(e)&&"alias"===t?i.push(e):Ee(e)&&-1!==t.indexOf("capture")&&Se(this[t])?r.push(e):s.push(e))}));var n=function(e,t){vi(e,(function(e){if(Ee(e[0])){var i=t;fi(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{tn--}}push(e){if(tn>0&&Ee(e)&&Pe(e[0])){var t=pn.prototype[e[0]];Se(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(this.is_capturing())if(!Ie(e)&&Pe(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var c=null!=s&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==c||!c.isRateLimited){null!=t&&t.$current_url&&!Pe(null==t?void 0:t.$current_url)&&(pi.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!=s&&s._originatedFromCaptureException||pi.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 d=new Date,_=(null==s?void 0:s.timestamp)||d,h=Li(),p={uuid:h,event:e,properties:this.calculateEventProperties(e,t||{},_,h)};e===X&&this.config.__preview_capture_bot_pageviews&&u&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),c&&(p.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens),(null==s?void 0:s.$set)&&(p.$set=null==s?void 0:s.$set);var g,v=this._calculate_set_once_properties(null==s?void 0:s.$set_once,e!==ee,e===Z);if(v&&(p.$set_once=v),null!=s&&s._noTruncate||(n=this.config.properties_string_max_length,o=p,a=e=>Pe(e)?e.slice(0,n):e,l=new Set,p=function e(t,i){return t!==Object(t)?a?a(t):t:l.has(t)?void 0:(l.add(t),Ee(t)?(s=[],vi(t,(t=>{s.push(e(t))}))):(s={},fi(t,((t,i)=>{l.has(t)||(s[i]=e(t,i))}))),s);var s}(o)),p.timestamp=_,Ie(null==s?void 0:s.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),e===Cs.DISMISSED||e===Cs.SENT){var f=null==t?void 0:t[Rs.SURVEY_ID],m=null==t?void 0:t[Rs.SURVEY_ITERATION];g={id:f,current_iteration:m},localStorage.getItem(Yr(g))||localStorage.setItem(Yr(g),"true"),p.$set=i({},p.$set,{[Gr({id:f,current_iteration:m},e===Cs.SENT?"responded":"dismissed")]:!0})}else e===Cs.SHOWN&&(p.$set=i({},p.$set,{[Rs.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(e===Os.SHOWN){var y=null==t?void 0:t[$s.TOUR_TYPE];y&&(p.$set=i({},p.$set,{[$s.TOUR_LAST_SEEN_DATE+"/"+y]:(new Date).toISOString()}))}var b=i({},p.properties.$set,p.$set);if(ke(b)||this.setPersonPropertiesForFlags(b),!Re(this.config.before_send)){var w=this._runBeforeSend(p);if(!w)return;p=w}this._internalEventEmitter.emit("eventCaptured",p);var E={method:"POST",url:null!==(r=null==s?void 0:s._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:null==s?void 0:s._batchKey};return!this.config.request_batching||s&&(null==s||!s._batchKey)||null!=s&&s.send_instantly?this._send_retriable_request(E):this._requestQueue.enqueue(E),p}pi.critical("This capture call is ignored due to client rate limiting.")}}else pi.error("No event name provided to posthog.capture")}else pi.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,s,r,o){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var a=o?void 0:this.persistence.remove_event_timer(e),l=i({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,(this.config.cookieless_mode==V||this.config.cookieless_mode==B&&this.consent.isExplicitlyOptedOut())&&(l.$cookieless_mode=!0),"$snapshot"===e){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!Pe(l.distinct_id)&&!Fe(l.distinct_id)||Te(l.distinct_id))&&pi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var c,d=function(e,t){var i,s,r,o;if(!ce)return{};var a,l,u,c,d,_,h,p,g=e?[...ns,...t||[]]:[],[v,f]=function(e){for(var t=0;qt.length>t;t++){var[i,s]=qt[t],r=i.exec(e),n=r&&(Se(s)?s(r,e):s);if(n)return n}return["",""]}(ce);return mi(Ei({$os:v,$os_version:f,$browser:Dt(ce,navigator.vendor),$device:Ht(ce),$device_type:(l=ce,u={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(s=navigator)?void 0:s.maxTouchPoints,screenWidth:null==te||null==(r=te.screen)?void 0:r.width,screenHeight:null==te||null==(o=te.screen)?void 0:o.height,devicePixelRatio:null==te?void 0:te.devicePixelRatio},p=Ht(l),p===Qe||p===Xe||"Kobo"===p||"Kindle Fire"===p||p===Tt?Je:p===ft||p===yt||p===mt||p===kt?"Console":p===et?"Wearable":p?Ge:"Android"===(null==u?void 0:u.userAgentDataPlatform)&&(null!==(c=null==u?void 0:u.maxTouchPoints)&&void 0!==c?c:0)>0?600>Math.min(null!==(d=null==u?void 0:u.screenWidth)&&void 0!==d?d:0,null!==(_=null==u?void 0:u.screenHeight)&&void 0!==_?_:0)/(null!==(h=null==u?void 0:u.devicePixelRatio)&&void 0!==h?h:1)?Ge:Je:"Desktop"),$timezone:fs(),$timezone_offset:ms()}),{$current_url:is(null==ne?void 0:ne.href,g,as),$host:null==ne?void 0:ne.host,$pathname:null==ne?void 0:ne.pathname,$raw_user_agent:ce.length>1e3?ce.substring(0,997)+"...":ce,$browser_version:Ut(ce,navigator.vendor),$browser_language:_s(),$browser_language_prefix:(a=_s(),"string"==typeof a?a.split("-")[0]:void 0),$screen_height:null==te?void 0:te.screen.height,$screen_width:null==te?void 0:te.screen.width,$viewport_height:null==te?void 0:te.innerHeight,$viewport_width:null==te?void 0:te.innerWidth,$lib:n.LIB_NAME,$lib_version:n.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:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,s.getTime());l.$session_id=_,l.$window_id=h}this.sessionPropsManager&&mi(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&mi(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this._retryQueue)?void 0:p.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===zr&&(l.$lib_custom_api_host=this.config.api_host),c=e!==X||o?e!==Q||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),l=mi(l,c),e===X&&re&&(l.title=re.title),!Ie(a)){var g=s.getTime()-a;l.$duration=parseFloat((g/1e3).toFixed(3))}ce&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=mi({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Ee(this.config.property_denylist)?fi(this.config.property_denylist,(function(e){delete l[e]})):pi.error(an+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(pi.error(on),l=v(l,e));var f=this._hasPersonProcessing();return l.$process_person_profile=f,f&&!o&&this._requirePersonProcessing("_calculate_event_properties"),l}_calculate_set_once_properties(e,t,i){var s;if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this._hasPersonProcessing())return e;if(this._personProcessingSetOncePropertiesSent&&!i)return e;var r=this.persistence.get_initial_props(),n=null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps(),o=mi({},r,n||{},e||{}),a=this.config.sanitize_properties;return a&&(pi.error(on),o=a(o,"$set_once")),t&&(this._personProcessingSetOncePropertiesSent=!0),ke(o)?void 0:o}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)}_register_single(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._internalEventEmitter.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:nn}),()=>{})}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:nn})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:nn})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=Jr),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))&&void 0!==t?t:{visible:!1,disabledReason:nn}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!==(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:nn})}_validateIdentifyId(e){return!e||Te(e)?(pi.critical("Unique user id has not been set in posthog.identify"),!1):e===H?(pi.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())||(pi.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 pi.uninitializedWarning("posthog.identify");if(Fe(e)&&(e=e.toString(),pi.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this._validateIdentifyId(e)&&this._requirePersonProcessing("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(L)||W)===W;e!==s&&n?(this.persistence.set_property(L,G),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(Z,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this._cachedPersonProperties=Nr(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s)):(t||i)&&this.setPersonProperties(t,i),e!==s&&(this.reloadFeatureFlags(),this.unregister(T))}}setPersonProperties(e,t){if((e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")){var i=Nr(this.get_distinct_id(),e,t);this._cachedPersonProperties!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this._cachedPersonProperties=i):pi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:i({},r,{[e]:t})}),n||s){var o={$group_type:e,$group_key:t};s&&(o.$group_set=s),this.capture(ee,o)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else pi.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._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){var t,i,s,r,n,o,l,u;if(pi.info("reset"),!this.__loaded)return pi.uninitializedWarning("posthog.reset");var c=this.get_property(a);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._remoteConfigLoader)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(l=this.persistence)||l.set_property(L,W),null==(u=this.sessionManager)||u.resetSessionId(),this._cachedPersonProperties=null,this.config.cookieless_mode===V)this.register_once({distinct_id:H,$device_id:null},"");else{var d=this.config.get_device_id(Li());this.register_once({distinct_id:d,$device_id:e?d:c},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i._onIdentityChanged()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e._onIdentityCleared()}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)&&void 0!==e?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)&&void 0!==r?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(o)?(pi.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Ie(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(l,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(pi.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=i({},this.config);if(xe(e)){var s,r,o,a,l,u,c,d,_;mi(this.config,_n(e));var h=this._is_persistence_disabled();null==(s=this.persistence)||s.update_config(this.config,t,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new bs(i({},this.config,{persistence:"sessionStorage"}),h);var p=this._checkLocalStorageForDebug(this.config.debug);Oe(p)&&(this.config.debug=p),Oe(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,Ni._is_supported()&&Ni._set("ph_debug",!0),pi.info("set_config",{config:e,oldConfig:t,newConfig:i({},this.config)})):(n.DEBUG=!1,Ni._is_supported()&&Ni._remove("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.autocapture)||a.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(d=this.surveys)||d.loadIfEnabled(),this._sync_opt_out_with_persistence(),null==(_=this.externalIntegrations)||_.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){n.LIB_NAME=e,n.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),a.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),a.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 s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(i({},r,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))&&void 0!==t&&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)&&void 0!==e?e:ln;return t!==ln&&(t=ln+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(L))===G||(null==(t=this.sessionPersistence)?void 0:t.get_property(L))===G}_hasPersonProcessing(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===Y&&!this._isIdentified()&&ke(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[l])&&(null==(t=this.persistence)||null==(t=t.props)||!t[U]))}_shouldCapturePageleave(){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._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._requirePersonProcessing("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_requirePersonProcessing(e){return"never"===this.config.person_profiles?(pi.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(U,!0),!0)}_is_persistence_disabled(){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!==B)}_sync_opt_out_with_persistence(){var e,t,i,s,r=this._is_persistence_disabled();return(null==(e=this.persistence)?void 0:e._disabled)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t._disabled)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==V){if(this.config.cookieless_mode===B&&this.consent.isExplicitlyOptedOut()){var i,s,r,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new Mr(this),this.pageViewManager=new Zi(this),this.persistence&&(this.sessionPropsManager=new Lr(this,this.sessionManager,this.persistence));var a=null!==(r=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==r?r:null==(o=pn.__defaultExtensionClasses)?void 0:o.sessionRecording;a&&(this.sessionRecording=this._replaceExtension(this.sessionRecording,new a(this)))}var l,u;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),this._start_queue_if_opted_in(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==B&&(null==(l=this.surveys)||l.loadIfEnabled()),(Ie(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(u=null==e?void 0:e.captureEventName)&&void 0!==u?u:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}else pi.warn(rn)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==V?(this.config.cookieless_mode===B&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this._sync_opt_out_with_persistence(),this.config.cookieless_mode===B&&(this.register({distinct_id:H,$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._captureInitialPageview())):pi.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===V||(this.config.cookieless_mode===B?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return se?Ar(se,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){re&&("visible"===re.visibilityState?this._initialPageviewCaptured||(this._initialPageviewCaptured=!0,this.capture(X,{title:re.title},{send_instantly:!0}),this._visibilityStateListener&&(re.removeEventListener(K,this._visibilityStateListener),this._visibilityStateListener=null)):this._visibilityStateListener||(this._visibilityStateListener=this._captureInitialPageview.bind(this),ki(re,K,this._visibilityStateListener)))}debug(e){!1===e?(null==te||te.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==te||te.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}))}_shouldDisableFlags(){var e,t,i,s,r,n,o=this._originalUserConfig||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(pi.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",!1,s=pi,r=(t="advanced_disable_flags")in(e=o)&&!Re(e[t]),n=i in e&&!Re(e[i]),r?e[t]:!!n&&(s&&s.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}_runBeforeSend(e){if(Re(this.config.before_send))return e;var t=Ee(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of t){if(i=s(i),Re(i)){var r="Event '"+e.event+"' was rejected in beforeSend function";return Me(e.event)?pi.warn(r+". This can cause unexpected behavior."):pi.info(r),null}i.properties&&!ke(i.properties)||pi.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager._currentPageview)?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)})}_checkLocalStorageForDebug(e){var t=Oe(e)&&!e,i=Ni._is_supported()&&"true"===Ni._get("ph_debug");return!t&&(!!i||e)}}function gn(e){return e instanceof Element&&(e.id===q||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function vn(e){return!!e&&1===e.nodeType}function fn(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function mn(e){return!!e&&3===e.nodeType}function yn(e){return!!e&&11===e.nodeType}function bn(e){return e?fe(e).split(/\s+/):[]}function wn(e){var t=null==te?void 0:te.location.href;return!!(t&&e&&e.some((e=>t.match(e))))}function En(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 bn(t)}function Sn(e){return Re(e)?null:fe(e).split(/(\s+)/).filter((e=>Hn(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function xn(e){var t="";return On(e)&&!$n(e)&&e.childNodes&&e.childNodes.length&&fi(e.childNodes,(function(e){var i;mn(e)&&e.textContent&&(t+=null!==(i=Sn(e.textContent))&&void 0!==i?i:"")})),fe(t)}function kn(e){return Ie(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}pn.__defaultExtensionClasses={},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=wi(e.prototype[t[i]])}(pn,["identify"]);var In=["a","button","form","input","select","textarea","label"];function Pn(e,t){if(Ie(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 Tn(e){var t=e.parentNode;return!(!t||!vn(t))&&t}var Cn=["next","previous","prev",">","<"],Rn=[".ph-no-rageclick",".ph-no-capture"];var Fn=e=>!e||fn(e,"html")||!vn(e),Ln=(e,t)=>{if(!te||Fn(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[e],r=e;r.parentNode&&!fn(r,"body");)if(yn(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=Tn(r);if(!n)break;if(t||In.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=te.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}s.push(n),r=n}return{parentIsUsefulElement:i,targetElementList:s}};function On(e){for(var t=e;t.parentNode&&!fn(t,"body");t=t.parentNode){var i=En(t);if(ve(i,"ph-sensitive")||ve(i,"ph-no-capture"))return!1}if(ve(En(e),"ph-include"))return!0;var s=e.type||"";if(Pe(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";return!Pe(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 $n(e){return!!(fn(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||fn(e,"select")||fn(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Mn="(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})",An=new RegExp("^(?:"+Mn+")$"),Dn=new RegExp(Mn),Nn="\\d{3}-?\\d{2}-?\\d{4}",Un=new RegExp("^("+Nn+")$"),qn=new RegExp("("+Nn+")");function Hn(e,t){if(void 0===t&&(t=!0),Re(e))return!1;if(Pe(e)){if(e=fe(e),(t?An:Dn).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Un:qn).test(e))return!1}return!0}function zn(e){var t=xn(e);return Hn(t=(t+" "+jn(e)).trim())?t:""}function jn(e){var t="";return e&&e.childNodes&&e.childNodes.length&&fi(e.childNodes,(function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var s=xn(e);t=(t+" "+s).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+jn(e)).trim())}catch(e){pi.error("[AutoCapture]",e)}})),t}function Bn(e){return e.replace(/"|\\"/g,'\\"')}function Vn(e){var t=e.attr__class;return t?Ee(t)?t:bn(t):void 0}class Wn{constructor(e){this.disabled=!1===e;var t=xe(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 Gn="$copy_autocapture",Yn=gi("[AutoCapture]");function Kn(e,t){return t.length>e?t.slice(0,e)+"...":t}function Jn(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!vn(t));return t}function Xn(e,t){for(var s,r,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=t,c=[e],d=e;d.parentNode&&!fn(d,"body");)yn(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var _,h,p=[],g={},v=!1,f=!1;if(fi(c,(e=>{var t=On(e);"a"===e.tagName.toLowerCase()&&(v=e.getAttribute("href"),v=t&&v&&Hn(v)&&v),ve(En(e),"ph-no-capture")&&(f=!0),p.push(function(e,t,i,s){var r=e.tagName.toLowerCase(),n={tag_name:r};In.indexOf(r)>-1&&!i&&(n.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?Kn(1024,zn(e)):Kn(1024,xn(e)));var o=En(e);o.length>0&&(n.classes=o.filter((function(e){return""!==e}))),fi(e.attributes,(function(i){var r;if((!$n(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&Hn(i.value)&&(!Pe(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){var o=i.value;"class"===i.name&&(o=bn(o).join(" ")),n["attr__"+i.name]=Kn(1024,o)}}));for(var a=1,l=1,u=e;u=Jn(u);)a++,u.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,o,a,l));var i=function(e){if(!On(e))return{};var t={};return fi(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&&Hn(s)&&(t[i]=s)}})),t}(e);mi(g,i)})),f)return{props:{},explicitNoCapture:f};if(a||(p[0].$el_text="a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?zn(e):xn(e)),v){var m,y;p[0].attr__href=v;var b=null==(m=es(v))?void 0:m.host,w=null==te||null==(y=te.location)?void 0:y.host;b&&w&&b!==w&&(_=v)}return{props:mi({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:(h=p,function(e){return e.map((e=>{var t,s,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var n of(e.attr_class.sort(),e.attr_class))r+="."+n.replace(/"/g,"");var o=i({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(s=e.nth_of_type)&&void 0!==s?s:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return yi(o).sort(((e,t)=>{var[i]=e,[s]=t;return i.localeCompare(s)})).forEach((e=>{var[t,i]=e;return a[Bn(t.toString())]=Bn(i.toString())})),(r+=":")+yi(a).map((e=>{var[t,i]=e;return t+'="'+i+'"'})).join("")})).join(";")}(function(e){return e.map((e=>{var t,i,s={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?void 0:i.slice(0,2048),attr_class:Vn(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return yi(e).filter((e=>{var[t]=e;return 0===t.indexOf("attr__")})).forEach((e=>{var[t,i]=e;return s.attributes[t]=i})),s}))}(h)))},null!=(s=p[0])&&s.$el_text?{$el_text:null==(r=p[0])?void 0:r.$el_text}:{},_&&"click"===n.type?{$external_click_url:_}:{},g)}}var Qn=gi("[ExceptionAutocapture]");function Zn(e,t,i){try{if(!(t in e))return()=>{};var s=e[t],r=i(s);return Se(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]=s}}catch(e){return()=>{}}}var eo=gi("[TracingHeaders]"),to=gi("[Web Vitals]"),io=9e5,so="disabled",ro="lazy_loading",no="awaiting_config",oo="missing_config";gi("[SessionRecording]");var ao="[SessionRecording]",lo=gi(ao),uo=gi("[Heatmaps]");function co(e){return xe(e)&&"clientX"in e&&"clientY"in e&&Fe(e.clientX)&&Fe(e.clientY)}var _o=gi("[Product Tours]"),ho="ph_product_tours",po=["$set_once","$set"],go=gi("[SiteApps]"),vo="Error while initializing PostHog app with config id ";function fo(e,t,i){if(Re(e))return!1;switch(i){case"exact":return e===t;case"contains":var s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class mo{constructor(e){this._debugEventEmitter=new Or,this._checkStep=(e,t)=>this._checkStepEvent(e,t)&&this._checkStepUrl(e,t)&&this._checkStepElement(e,t)&&this._checkStepProperties(e,t),this._checkStepEvent=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this._actionEvents=new Set,this._actionRegistry=new Set}init(){var e,t;Ie(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(!Ie(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach((e=>{var t,i;null==(t=this._actionRegistry)||t.add(e),null==(i=e.steps)||i.forEach((e=>{var t;null==(t=this._actionEvents)||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._actionEvents.has(e)||this._actionEvents.has(null==t?void 0:t.event))&&this._actionRegistry&&(null==(i=this._actionRegistry)?void 0:i.size)>0&&this._actionRegistry.forEach((e=>{this._checkAction(t,e)&&this._debugEventEmitter.emit("actionCaptured",e.name)}))}_addActionHook(e){this.onAction("actionCaptured",(t=>e(t)))}_checkAction(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this._checkStep(e,i))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}_checkStepUrl(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)return!1;if(!fo(s,t.url,t.url_matching||"contains"))return!1}return!0}_checkStepElement(e,t){return!!this._checkStepHref(e,t)&&!!this._checkStepText(e,t)&&!!this._checkStepSelector(e,t)}_checkStepHref(e,t){var i;if(null==t||!t.href)return!0;var s=this._getElementsList(e);if(s.length>0)return s.some((e=>fo(e.href,t.href,t.href_matching||"exact")));var r,n=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!n&&fo((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}_checkStepText(e,t){var i;if(null==t||!t.text)return!0;var s=this._getElementsList(e);if(s.length>0)return s.some((e=>fo(e.text,t.text,t.text_matching||"exact")||fo(e.$el_text,t.text,t.text_matching||"exact")));var r,n,o,a=(null==e||null==(i=e.properties)?void 0:i.$elements_chain)||"";return!!a&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!Re(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(a),n=t.text,o=t.text_matching||"exact",r.some((e=>fo(e,n,o))))}_checkStepSelector(e,t){var i,s;if(null==t||!t.selector)return!0;var 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}return!1}_getElementsList(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}_checkStepProperties(e,t){return null==t||!t.properties||0===t.properties.length||Hr(t.properties.reduce(((e,t)=>{var i=Ee(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 yo{constructor(e){this._instance=e,this._eventToItems=new Map,this._cancelEventToItems=new Map,this._actionToItems=new Map}_doesEventMatchFilter(e,t){return!!e&&Hr(e.propertyFilters,null==t?void 0:t.properties)}_buildEventToItemMap(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}_getMatchingItems(e,t,i){var s=(i===ws.Activation?this._eventToItems:this._cancelEventToItems).get(e),r=[];return this._getItems((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._doesEventMatchFilter(n,t)}))}register(e){var t;Ie(null==(t=this._instance)?void 0:t._addCaptureHook)||(this._setupEventBasedItems(e),this._setupActionBasedItems(e))}_setupActionBasedItems(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._actionMatcher&&(this._actionMatcher=new mo(this._instance),this._actionMatcher.init(),this._actionMatcher._addActionHook((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._actionMatcher)||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._actionToItems.get(t.name);i&&i.push(e.id),this._actionToItems.set(t.name,i||[e.id])}})))})))}_setupEventBasedItems(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._eventToItems=this._buildEventToItemMap(e,ws.Activation),this._cancelEventToItems=this._buildEventToItemMap(e,ws.Cancellation))}onEvent(e,t){var i,s=this._getLogger(),r=this._getActivatedKey(),n=this._getShownEventName(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[r])||[];if(n===e&&t&&o.length>0){var a,l;s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var u=(null==t||null==(a=t.properties)?void 0:a.$survey_id)||(null==t||null==(l=t.properties)?void 0:l.$product_tour_id);if(u){var c=o.indexOf(u);0>c||(o.splice(c,1),this._updateActivatedItems(o))}}else{if(this._cancelEventToItems.has(e)){var d=this._getMatchingItems(e,t,ws.Cancellation);d.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map((e=>e.id))}),d.forEach((e=>{var t=o.indexOf(e.id);0>t||o.splice(t,1),this._cancelPendingItem(e.id)})),this._updateActivatedItems(o))}if(this._eventToItems.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this._eventToItems.get(e)});var _=this._getMatchingItems(e,t,ws.Activation);this._updateActivatedItems(o.concat(_.map((e=>e.id))||[]))}}}onAction(e){var t,i=this._getActivatedKey(),s=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[];this._actionToItems.has(e)&&this._updateActivatedItems(s.concat(this._actionToItems.get(e)||[]))}_updateActivatedItems(e){var t,i=this._getLogger(),s=this._getActivatedKey(),r=[...new Set(e)].filter((e=>!this._isItemPermanentlyIneligible(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._getActivatedKey();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getEventToItemsMap(){return this._eventToItems}_getActionMatcher(){return this._actionMatcher}}class bo extends yo{constructor(e){super(e)}_getActivatedKey(){return"$surveys_activated"}_getShownEventName(){return Cs.SHOWN}_getItems(e){var t;null==(t=this._instance)||t.getSurveys(e)}_cancelPendingItem(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}_getLogger(){return Vr}_isItemPermanentlyIneligible(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var wo="SDK is not enabled or survey functionality is not yet loaded",Eo="Disabled. Not loading surveys.",So=null!=te&&te.location?ss(te.location.hash,"__posthog")||ss(location.hash,"state"):null,xo="_postHogToolbarParams",ko=gi("[Toolbar]"),Io=gi("[FeatureFlags]"),Po=gi("[FeatureFlags]",{debugEnabled:!0}),To="\" failed. Feature flags didn't load in time.",Co="$active_feature_flags",Ro="$override_feature_flags",Fo="$feature_flag_payloads",Lo="$override_feature_flag_payloads",Oo="$feature_flag_request_id",$o=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},Mo=e=>{var t={};for(var[i,s]of yi(e||{}))s&&(t[i]=s);return t},Ao=gi("[Error tracking]"),Do="Refusing to render web experiment since the viewer is a likely bot",No={icontains:(e,t)=>!!te&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!te&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!te&&Dr(t.href,e),not_regex:(e,t)=>!!te&&!Dr(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Uo{get _config(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments((e=>{Uo._logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,e.forEach((e=>{if(e.feature_flag_key){var i;t._flagToExperiments&&(Uo._logInfo("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t._flagToExperiments)||i.set(e.feature_flag_key,e));var s=t._instance.getFeatureFlag(e.feature_flag_key);Pe(s)&&e.variants[s]&&t._applyTransforms(e.name,s,e.variants[s].transforms)}else if(e.variants)for(var r in e.variants){var n=e.variants[r];Uo._matchesTestVariant(n)&&t._applyTransforms(e.name,r,n.transforms)}}))}),e)},this._instance=e,this._instance.onFeatureFlags((e=>{this.onFeatureFlags(e)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())Uo._logInfo(Do);else if(!this._config.disable_web_experiments){if(Re(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Uo._logInfo("applying feature flags",e),e.forEach((e=>{var t;if(this._flagToExperiments&&null!=(t=this._flagToExperiments)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this._flagToExperiments)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this._applyTransforms(r.name,s,r.variants[s].transforms)}}))}}previewWebExperiment(){var e=Uo.getWindowLocation();if(null!=e&&e.search){var t=ts(null==e?void 0:e.search,"__experiment_id"),i=ts(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Uo._logInfo("previewing web experiments "+t+" && "+i),this.getWebExperiments((e=>{this._showPreviewWebExperiment(parseInt(t),i,e)}),!1,!0))}}loadIfEnabled(){this._config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._config.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._config.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}_showPreviewWebExperiment(e,t,i){var s=i.filter((t=>t.id===e));s&&s.length>0&&(Uo._logInfo("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this._applyTransforms(s[0].name,t,s[0].variants[t].transforms))}static _matchesTestVariant(e){return!Re(e.conditions)&&Uo._matchUrlConditions(e)&&Uo._matchUTMConditions(e)}static _matchUrlConditions(e){var t;if(Re(e.conditions)||Re(null==(t=e.conditions)?void 0:t.url))return!0;var i,s,r,n=Uo.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||No[null!==(s=null==(r=e.conditions)?void 0:r.urlMatchType)&&void 0!==s?s:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==te?void 0:te.location}static _matchUTMConditions(e){var t;if(Re(e.conditions)||Re(null==(t=e.conditions)?void 0:t.utm))return!0;var i=us();if(i.utm_source){var s,r,n,o,a,l,u,c,d=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==i.utm_campaign,_=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,h=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,p=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==i.utm_term;return d&&h&&p&&_}return!1}static _logInfo(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];pi.info("[WebExperiments] "+e,i)}_applyTransforms(e,t,i){this._is_bot()?Uo._logInfo(Do):"control"!==t?i.forEach((i=>{if(i.selector){var s;Uo._logInfo("applying transform of variant "+t+" for experiment "+e+" ",i);var r=null==(s=document)?void 0:s.querySelectorAll(i.selector);null==r||r.forEach((e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)}))}})):Uo._logInfo("Control variants leave the page unmodified.")}_is_bot(){return se&&this._instance?Ar(se,this._config.custom_blocked_useragents):void 0}}var qo=gi("[Conversations]"),Ho="Conversations not available yet.",zo={featureFlags:class{constructor(e){this._override_warning=!1,this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this._hasLoggedDeprecationWarning=!1,this._staleCacheRefreshTriggered=!1,this._instance=e,this.featureFlagEventHandlers=[]}get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}_prop(e){return this._instance.get_property(e)}_isCacheStale(){var e,t;return null!==(e=null==(t=this._persistence)?void 0:t._isFeatureFlagCacheStale(this._config.feature_flag_cache_ttl_ms))&&void 0!==e&&e}_checkAndTriggerStaleRefresh(){return!!this._isCacheStale()&&(this._staleCacheRefreshTriggered||this._requestInFlight||(this._staleCacheRefreshTriggered=!0,Io.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}_getValidEvaluationEnvironments(){var e,t=null!==(e=this._config.evaluation_contexts)&&void 0!==e?e:this._config.evaluation_environments;return!this._config.evaluation_environments||this._config.evaluation_contexts||this._hasLoggedDeprecationWarning||(Io.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this._hasLoggedDeprecationWarning=!0),null!=t&&t.length?t.filter((e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||Io.error("Invalid evaluation context found:",e,"Expected non-empty string"),t})):[]}_shouldIncludeEvaluationEnvironments(){return this._getValidEvaluationEnvironments().length>0}initialize(){var e,t,{config:i}=this._instance,s=null!==(e=null==(t=i.bootstrap)?void 0:t.featureFlags)&&void 0!==e?e:{};if(Object.keys(s).length){var r,n,o=null!==(r=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==r?r:{},a=Object.keys(s).filter((e=>!!s[e])).reduce(((e,t)=>(e[t]=s[t]||!1,e)),{}),l=Object.keys(o).filter((e=>a[e])).reduce(((e,t)=>(o[t]&&(e[t]=o[t]),e)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(e,t,s){var r=null!=s&&s.merge?this.getFlagVariants():{},n=null!=s&&s.merge?this.getFlagPayloads():{},o=i({},r,e),a=i({},n,t),l={};for(var[u,c]of Object.entries(o)){var d="string"==typeof c;l[u]={key:u,enabled:!!d||Boolean(c),variant:d?c:void 0,reason:void 0,metadata:Ie(null==a?void 0:a[u])?void 0:{id:0,version:void 0,description:void 0,payload:a[u]}}}this.receivedFeatureFlags({flags:l})}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._prop(x),t=this._prop(Ro),s=this._prop(Lo);if(!s&&!t)return e||{};var r=mi({},e||{}),n=[...new Set([...Object.keys(s||{}),...Object.keys(t||{})])];for(var o of n){var a,l,u=r[o],c=null==t?void 0:t[o],d=Ie(c)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!c,_=Ie(c)?u.variant:"string"==typeof c?c:void 0,h=null==s?void 0:s[o],p=i({},u,{enabled:d,variant:d?null!=_?_:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(p.original_enabled=null==u?void 0:u.enabled),_!==(null==u?void 0:u.variant)&&(p.original_variant=null==u?void 0:u.variant),h&&(p.metadata=i({},null==u?void 0:u.metadata,{payload:h,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),r[o]=p}return this._override_warning||(Io.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:s,finalDetails:r}),this._override_warning=!0),r}getFlagVariants(){var e=this._prop(E),t=this._prop(Ro);if(!t)return e||{};for(var i=mi({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this._override_warning||(Io.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this._override_warning=!0),i}getFlagPayloads(){var e=this._prop(Fo),t=this._prop(Lo);if(!t)return e||{};for(var i=mi({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this._override_warning||(Io.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this._override_warning=!0),i}reloadFeatureFlags(){this._reloadingDisabled||this._config.advanced_disable_feature_flags||this._reloadDebouncer||(this._instance._internalEventEmitter.emit("featureFlagsReloading",!0),this._reloadDebouncer=setTimeout((()=>{this._callFlagsEndpoint()}),5))}_clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this._reloadingDisabled=e}_callFlagsEndpoint(e){var t;if(this._clearDebouncer(),!this._instance._shouldDisableFlags())if(this._requestInFlight)this._additionalReloadRequested=!0;else{var s=this._config.token,r=this._prop(a),n={token:s,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},(null==(t=this._persistence)?void 0:t.get_initial_props())||{},this._prop(k)||{}),group_properties:this._prop(I),timezone:fs()};Ce(r)||Ie(r)||(n.$device_id=r),(null!=e&&e.disableFlags||this._config.advanced_disable_feature_flags)&&(n.disable_flags=!0),this._shouldIncludeEvaluationEnvironments()&&(n.evaluation_contexts=this._getValidEvaluationEnvironments());var o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this._config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this._requestInFlight=!0,this._instance._send_request({method:"POST",url:o,data:n,compression:this._config.disable_compression?void 0:qs.Base64,timeout:this._config.feature_flag_request_timeout_ms,callback:e=>{var t,i,s,r=!0;if(200===e.statusCode&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),r=!1),this._requestInFlight=!1,!n.disable_flags||this._additionalReloadRequested){this._flagsLoadedFromRemote=!r;var o=[];e.error?e.error instanceof Error?o.push("AbortError"===e.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==e.statusCode&&o.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(l&&o.push("quota_limited"),null==(s=this._persistence)||s.register({[R]:o}),l)Io.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else n.disable_flags||this.receivedFeatureFlags(null!==(a=e.json)&&void 0!==a?a:{},r),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callFlagsEndpoint())}}})}}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var s=this.getFeatureFlagResult(e,t);return null!==(i=null==s?void 0:s.variant)&&void 0!==i?i:null==s?void 0:s.enabled}}else Io.warn('getFeatureFlag for key "'+e+To)}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._flagsLoadedFromRemote)if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){if(!this._checkAndTriggerStaleRefresh()){var i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],o=String(r),a=this._prop(Oo)||void 0,l=this._prop(F)||void 0,u=this._prop(T)||{};if(this._config.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),_=this._prop(C);d&&d!==_&&(u={},null==(c=this._persistence)||c.register({[T]:u,[C]:d}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(o))){var h,p,g,v,f,m,y,b,w,E;Ee(u[e])?u[e].push(o):u[e]=[o],null==(h=this._persistence)||h.register({[T]:u});var S=this.getFeatureFlagDetails(e),x=[...null!==(p=this._prop(R))&&void 0!==p?p:[]];Ie(r)&&x.push("flag_missing");var k={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(g=this._config.bootstrap)||null==(g=g.featureFlags)?void 0:g[e])||null,$feature_flag_bootstrapped_payload:(null==(v=this._config.bootstrap)||null==(v=v.featureFlagPayloads)?void 0:v[e])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Ie(null==S||null==(f=S.metadata)?void 0:f.version)||(k.$feature_flag_version=S.metadata.version);var I,P=null!==(m=null==S||null==(y=S.reason)?void 0:y.description)&&void 0!==m?m:null==S||null==(b=S.reason)?void 0:b.code;P&&(k.$feature_flag_reason=P),null!=S&&null!=(w=S.metadata)&&w.id&&(k.$feature_flag_id=S.metadata.id),Ie(null==S?void 0:S.original_variant)&&Ie(null==S?void 0:S.original_enabled)||(k.$feature_flag_original_response=Ie(S.original_variant)?S.original_enabled:S.original_variant),null!=S&&null!=(E=S.metadata)&&E.original_payload&&(k.$feature_flag_original_payload=null==S||null==(I=S.metadata)?void 0:I.original_payload),x.length&&(k.$feature_flag_error=x.join(",")),this._instance.capture("$feature_flag_called",k)}if(s){var L=n;if(!Ie(n))try{L=JSON.parse(n)}catch(e){}return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:L}}}}else Io.warn('getFeatureFlagResult for key "'+e+To)}getRemoteConfigPayload(e,t){var i=this._config.token,s={distinct_id:this._instance.get_distinct_id(),token:i};this._shouldIncludeEvaluationEnvironments()&&(s.evaluation_contexts=this._getValidEvaluationEnvironments()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this._config.disable_compression?void 0:qs.Base64,timeout:this._config.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._flagsLoadedFromRemote){if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return Ie(i)?void 0:!!i}Io.warn('isFeatureEnabled for key "'+e+To)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._persistence){this._hasLoadedFlags=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(e,t,s,r,n){void 0===s&&(s={}),void 0===r&&(r={}),void 0===n&&(n={});var o=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map((e=>{var i;return[e,null!==(i=t[e].variant)&&void 0!==i?i:t[e].enabled]}))),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter((e=>t[e].enabled)).filter((e=>{var i;return null==(i=t[e].metadata)?void 0:i.payload})).map((e=>{var i;return[e,null==(i=t[e].metadata)?void 0:i.payload]})))):Io.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var c=e.requestId,d=e.evaluatedAt;if(Ee(l)){Io.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var _={};if(l)for(var h=0;l.length>h;h++)_[l[h]]=!0;t&&t.register({[Co]:l,[E]:_})}else{var p=l,g=u,v=a;if(e.errorsWhileComputingFlags)if(a){var f=new Set(Object.keys(a).filter((e=>{var t;return!(null!=(t=a[e])&&t.failed)})));p=i({},s,Object.fromEntries(Object.entries(p).filter((e=>{var[t]=e;return f.has(t)})))),g=i({},r,Object.fromEntries(Object.entries(g||{}).filter((e=>{var[t]=e;return f.has(t)})))),v=i({},n,Object.fromEntries(Object.entries(v||{}).filter((e=>{var[t]=e;return f.has(t)}))))}else p=i({},s,p),g=i({},r,g),v=i({},n,v);t&&t.register(i({[Co]:Object.keys(Mo(p)),[E]:p||{},[Fo]:g||{},[x]:v||{}},c?{[Oo]:c}:{},d?{[F]:d}:{}))}}}(e,this._persistence,s,r,n),t||(this._staleCacheRefreshTriggered=!1),this._fireFeatureFlagsCallbacks(t)}}override(e,t){void 0===t&&(t=!1),Io.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._persistence)return Io.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._persistence.unregister(Ro),this._persistence.unregister(Lo),this._fireFeatureFlagsCallbacks(),Po.info("All overrides cleared");if(Ee(e)){var t=$o(e);return this._persistence.register({[Ro]:t}),this._fireFeatureFlagsCallbacks(),Po.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var i,s=e;if(this._override_warning=Boolean(null!==(i=s.suppressWarning)&&void 0!==i&&i),"flags"in s)if(!1===s.flags)this._persistence.unregister(Ro),Po.info("Flag overrides cleared");else if(s.flags){if(Ee(s.flags)){var r=$o(s.flags);this._persistence.register({[Ro]:r})}else this._persistence.register({[Ro]:s.flags});Po.info("Flag overrides set",{flags:s.flags})}return"payloads"in s&&(!1===s.payloads?(this._persistence.unregister(Lo),Po.info("Payload overrides cleared")):s.payloads&&(this._persistence.register({[Lo]:s.payloads}),Po.info("Payload overrides set",{payloads:s.payloads}))),void this._fireFeatureFlagsCallbacks()}if(e&&"object"==typeof e)return this._persistence.register({[Ro]:e}),this._fireFeatureFlagsCallbacks(),Po.info("Flag overrides set",{flags:e});Io.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._hasLoadedFlags){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,s){var r,n=(this._prop(S)||[]).find((t=>t.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};n&&(a.$early_access_feature_name=n.name),s&&(a.$feature_enrollment_stage=s),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=i({},this.getFlagVariants(),{[e]:t});null==(r=this._persistence)||r.register({[Co]:Object.keys(Mo(l)),[E]:l}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this._prop(S),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._config.token+r),method:"GET",callback:t=>{var i,s;if(t.json){var r=t.json.earlyAccessFeatures;return null==(i=this._persistence)||i.unregister(S),null==(s=this._persistence)||s.register({[S]:r}),e(r)}}})}_prepareFeatureFlagsForCallbacks(){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)),{})}}_fireFeatureFlagsCallbacks(e){var{flags:t,flagVariants:i}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach((s=>s(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var s=this._prop(k)||{},r=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),n=null==e?void 0:e.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in s||(o[a]=n[a]));this._instance.register({[k]:i({},s,o,r)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(k)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var s=this._prop(I)||{};0!==Object.keys(s).length&&Object.keys(s).forEach((t=>{s[t]=i({},s[t],e[t]),delete e[t]})),this._instance.register({[I]:i({},s,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._prop(I)||{};this._instance.register({[I]:i({},t,{[e]:{}})})}else this._instance.unregister(I)}reset(){this._hasLoadedFlags=!1,this._requestInFlight=!1,this._reloadingDisabled=!1,this._additionalReloadRequested=!1,this._flagsLoadedFromRemote=!1,this.$anon_distinct_id=void 0,this._clearDebouncer(),this._override_warning=!1}}},jo={sessionRecording:class{get _config(){return this._instance.config}get _persistence(){return this._instance.persistence}get started(){var e;return!(null==(e=this._lazyLoadedSessionRecording)||!e.isStarted)}get status(){var e,t;return this._recordingStatus===no||this._recordingStatus===oo?this._recordingStatus:null!==(e=null==(t=this._lazyLoadedSessionRecording)?void 0:t.status)&&void 0!==e?e:this._recordingStatus}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._recordingStatus=so,this._persistFlagsOnSessionListener=void 0,this._instance=e,!this._instance.sessionManager)throw lo.error("started without valid sessionManager"),new Error(ao+" started without valid sessionManager. This is a bug.");if(this._config.cookieless_mode===V)throw new Error(ao+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _isRecordingEnabled(){var e,t=!(null==(e=this._instance.get_property(y))||!e.enabled),i=!this._config.disable_session_recording,s=this._config.disable_session_recording||this._instance.consent.isOptedOut();return te&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this._isRecordingEnabled||null==(t=this._lazyLoadedSessionRecording)||!t.isStarted){var i=!Ie(Object.assign)&&!Ie(Array.from);this._isRecordingEnabled&&i?(this._lazyLoadAndStart(e),lo.info("starting")):(this._recordingStatus=so,this.stopRecording())}}_lazyLoadAndStart(e){var t,i,s;this._isRecordingEnabled&&(this._recordingStatus!==no&&this._recordingStatus!==oo&&(this._recordingStatus=ro),null!=de&&null!=(t=de.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=de.__PosthogExtensions__)&&i.initSessionRecording?this._onScriptLoaded(e):null==(s=de.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this._scriptName,(t=>{if(t)return lo.error("could not load recorder",t);this._onScriptLoaded(e)})))}stopRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.stop()}_discardRecording(){var e,t;null==(e=this._persistFlagsOnSessionListener)||e.call(this),this._persistFlagsOnSessionListener=void 0,null==(t=this._lazyLoadedSessionRecording)||t.discard()}_resetSampling(){var e;null==(e=this._persistence)||e.unregister(w)}_validateSampleRate(e,t){if(Re(e))return null;var i,s=Fe(e)?e:parseFloat(e);return"number"!=typeof(i=s)||!Number.isFinite(i)||0>i||i>1?(lo.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):s}_persistRemoteConfig(e){if(this._persistence){var t,s,r=this._persistence,n=()=>{var t,s=!1===e.sessionRecording?void 0:e.sessionRecording,n=this._validateSampleRate(null==(t=this._config.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),o=this._validateSampleRate(null==s?void 0:s.sampleRate,"remote config sampleRate"),a=null!=n?n:o;Re(a)&&this._resetSampling();var l=null==s?void 0:s.minimumDurationMilliseconds;r.register({[y]:i({cache_timestamp:Date.now(),enabled:!!s},s,{networkPayloadCapture:i({capturePerformance:e.capturePerformance},null==s?void 0:s.networkPayloadCapture),canvasRecording:{enabled:null==s?void 0:s.recordCanvas,fps:null==s?void 0:s.canvasFps,quality:null==s?void 0:s.canvasQuality},sampleRate:a,minimumDurationMilliseconds:Ie(l)?null:l,endpoint:null==s?void 0:s.endpoint,triggerMatchType:null==s?void 0:s.triggerMatchType,masking:null==s?void 0:s.masking,urlTriggers:null==s?void 0:s.urlTriggers})})};n(),null==(t=this._persistFlagsOnSessionListener)||t.call(this),this._persistFlagsOnSessionListener=null==(s=this._instance.sessionManager)?void 0:s.onSessionId(n)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this._persistRemoteConfig(e),void this._discardRecording()):(this._persistRemoteConfig(e),void this.startIfEnabledOrStop()):(this._recordingStatus===no&&(this._recordingStatus=oo,lo.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._lazyLoadedSessionRecording)&&i.log?this._lazyLoadedSessionRecording.log(e,t):lo.warn("log called before recorder was ready")}get _scriptName(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(y);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}_isRemoteConfigFresh(){var e,t=this._instance.get_property(y);if(!t)return!1;var i=null!==(e=("object"==typeof t?t:JSON.parse(t)).cache_timestamp)&&void 0!==e?e:Date.now();return 36e5>=Date.now()-i}_onScriptLoaded(e){var t,i;if(null==(t=de.__PosthogExtensions__)||!t.initSessionRecording)return lo.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._lazyLoadedSessionRecording||(this._lazyLoadedSessionRecording=null==(i=de.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this._lazyLoadedSessionRecording._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this._isRemoteConfigFresh()){if(this._recordingStatus===oo||this._recordingStatus===no)return;return this._recordingStatus=no,lo.info("persisted remote config is stale, requesting fresh config before starting"),void new Ns(this._instance).load()}this._recordingStatus=ro,this._lazyLoadedSessionRecording.start(e)}onRRwebEmit(e){var t;null==(t=this._lazyLoadedSessionRecording)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({$replay_override_linked_flag:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this._lazyLoadedSessionRecording||null==(t=this._persistence)||t.register({$replay_override_sampling:!0}),null==(e=this._lazyLoadedSessionRecording)||e.overrideSampling()}overrideTrigger(e){var t,i;this._lazyLoadedSessionRecording||null==(i=this._persistence)||i.register({["url"===e?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(t=this._lazyLoadedSessionRecording)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this._lazyLoadedSessionRecording)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this._lazyLoadedSessionRecording)||!i.tryAddCustomEvent(e,t))}}},Bo={autocapture:class{constructor(e){this._initialized=!1,this._isDisabledServerSide=null,this._elementsChainAsString=!1,this.instance=e,this.rageclicks=new Wn(e.config.rageclick),this._elementSelectors=null}initialize(){this.startIfEnabled()}get _config(){var e,t,i=xe(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}_addDomEventHandlers(){if(this.isBrowserSupported()){if(te&&re){var e=e=>{e=e||(null==te?void 0:te.event);try{this._captureEvent(e)}catch(e){Yn.error("Failed to capture event",e)}};if(ki(re,"submit",e,{capture:!0}),ki(re,"change",e,{capture:!0}),ki(re,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{this._captureEvent(e=e||(null==te?void 0:te.event),Gn)};ki(re,"copy",t,{capture:!0}),ki(re,"cut",t,{capture:!0})}}}else Yn.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[c]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,i=[];return null==(t=this._elementSelectors)||t.forEach((t=>{var s=null==re?void 0:re.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[c];if(Ce(this._isDisabledServerSide)&&!Oe(i)&&!this.instance._shouldDisableFlags())return!1;var s=null!==(t=this._isDisabledServerSide)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}_captureEvent(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,s=kn(e);mn(s)&&(s=s.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(!te||Fn(e))return!1;var i,s,r;if(Oe(t)?(i=!!t&&Rn,s=void 0):(i=null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:Rn,s=null==t?void 0:t.content_ignorelist),!1===i)return!1;var{targetElementList:n}=Ln(e,!1);return!function(e,t){if(!1===e||Ie(e))return!1;var i;if(!0===e)i=Cn;else{if(!Ee(e))return!1;if(e.length>10)return pi.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)))}))}(s,n.map((e=>{var t;return{safeText:xn(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}})))&&!Pn(n,i)}(s,this.instance.config.rageclick)&&this._captureEvent(e,"$rageclick");var r=t===Gn;if(s&&function(e,t,i,s,r){var n,o,a,l;if(void 0===i&&(i=void 0),!te||Fn(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!wn(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&wn(i.url_ignorelist))return!1;if(null!=(a=i)&&a.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some((e=>t.type===e)))return!1}var{parentIsUsefulElement:c,targetElementList:d}=Ln(e,s);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(Ie(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))return!1;if(!Pn(d,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var _=te.getComputedStyle(e);if(_&&"pointer"===_.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return c?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(In.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this._config,r,r?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=Xn(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(o)return!1;var a=this.getElementSelectors(s);if(a&&a.length>0&&(n.$element_selectors=a),t===Gn){var l,u=Sn(null==te||null==(l=te.getSelection())?void 0:l.toString()),c=e.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=c}return this.instance.capture(t,n),!0}}}isBrowserSupported(){return Se(null==re?void 0:re.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this._lastPathname=(null==te||null==(t=te.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(pi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this._popstateListener&&this._popstateListener(),this._popstateListener=void 0,pi.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(te&&te.history){var i=this;null!=(e=te.history.pushState)&&e.__posthog_wrapped__||Zn(te.history,"pushState",(e=>function(t,s,r){e.call(this,t,s,r),i._capturePageview("pushState")})),null!=(t=te.history.replaceState)&&t.__posthog_wrapped__||Zn(te.history,"replaceState",(e=>function(t,s,r){e.call(this,t,s,r),i._capturePageview("replaceState")})),this._setupPopstateListener()}}_capturePageview(e){try{var t,i=null==te||null==(t=te.location)?void 0:t.pathname;if(!i)return;i!==this._lastPathname&&this.isEnabled&&this._instance.capture(X,{navigation_type:e}),this._lastPathname=i}catch(t){pi.error("Error capturing "+e+" pageview",t)}}_setupPopstateListener(){if(!this._popstateListener){var e=()=>{this._capturePageview("popstate")};ki(te,"popstate",e),this._popstateListener=()=>{te&&te.removeEventListener("popstate",e)}}}},heatmaps:class{get _config(){return this.instance.config}constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._flushInterval=null,this.instance=e,this._enabledServerSide=!(null==(t=this.instance.persistence)||!t.props[d]),this.rageclicks=new Wn(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return xe(this._config.capture_heatmaps)&&this._config.capture_heatmaps.flush_interval_milliseconds&&(e=this._config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Re(this._config.capture_heatmaps)?Re(this._config.enable_heatmaps)?this._enabledServerSide:this._config.enable_heatmaps:!1!==this._config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;uo.info("starting..."),this._setupListeners(),this._onVisibilityChange()}else{var e;clearInterval(null!==(e=this._flushInterval)&&void 0!==e?e:void 0),this._removeListeners(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[d]:t}),this._enabledServerSide=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this._buffer;return this._buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_onVisibilityChange(){this._flushInterval&&clearInterval(this._flushInterval),this._flushInterval="visible"===(null==re?void 0:re.visibilityState)?setInterval(this._flush.bind(this),this.flushIntervalMilliseconds):null}_setupListeners(){te&&re&&(this._flushHandler=this._flush.bind(this),ki(te,J,this._flushHandler),this._onClickHandler=e=>this._onClick(e||(null==te?void 0:te.event)),ki(re,"click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler=e=>this._onMouseMove(e||(null==te?void 0:te.event)),ki(re,"mousemove",this._onMouseMoveHandler,{capture:!0}),this._deadClicksCapture=new Yi(this.instance,Wi,this._onDeadClick.bind(this)),this._deadClicksCapture.startIfEnabledOrStop(),this._onVisibilityChange_handler=this._onVisibilityChange.bind(this),ki(re,K,this._onVisibilityChange_handler),this._initialized=!0)}_removeListeners(){var e;te&&re&&(this._flushHandler&&te.removeEventListener(J,this._flushHandler),this._onClickHandler&&re.removeEventListener("click",this._onClickHandler,{capture:!0}),this._onMouseMoveHandler&&re.removeEventListener("mousemove",this._onMouseMoveHandler,{capture:!0}),this._onVisibilityChange_handler&&re.removeEventListener(K,this._onVisibilityChange_handler),clearTimeout(this._mouseMoveTimeout),null==(e=this._deadClicksCapture)||e.stop(),this._initialized=!1)}_getProperties(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=function(e,t,i){for(var s=e;s&&vn(s)&&!fn(s,"body");){if(s===i)return!1;if(ve(t,null==te?void 0:te.getComputedStyle(s).position))return!0;s=Tn(s)}return!1}(kn(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:s),y:e.clientY+(n?0:i),target_fixed:n,type:t}}_onClick(e,t){var s;if(void 0===t&&(t="click"),!gn(e.target)&&co(e)){var r=this._getProperties(e,t);null!=(s=this.rageclicks)&&s.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this._capture(i({},r,{type:"rageclick"})),this._capture(r)}}_onMouseMove(e){!gn(e.target)&&co(e)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout((()=>{this._capture(this._getProperties(e,"mousemove"))}),500))}_capture(e){if(te){var t=te.location.href,i=this._config.custom_personal_data_properties,s=this._config.mask_personal_data_properties?[...ns,...i||[]]:[],r=is(t,s,as);this._buffer=this._buffer||{},this._buffer[r]||(this._buffer[r]=[]),this._buffer[r].push(e)}}_flush(){this._buffer&&!ke(this._buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Yi,webVitalsAutocapture:class{constructor(e){var t;this._enabledServerSide=!1,this._initialized=!1,this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0},this._flushToCapture=()=>{clearTimeout(this._delayedFlushTimer),0!==this._buffer.metrics.length&&(this._instance.capture("$web_vitals",this._buffer.metrics.reduce(((e,t)=>i({},e,{["$web_vitals_"+t.name+"_event"]:i({},t),["$web_vitals_"+t.name+"_value"]:t.value})),{})),this._buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this._addToBuffer=e=>{var t,s=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(Ie(s))to.error("Could not read session ID. Dropping metrics!");else{this._buffer=this._buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this._currentURL();Ie(r)||(Re(null==e?void 0:e.name)||Re(null==e?void 0:e.value)?to.error("Invalid metric received",e):!this._maxAllowedValue||this._maxAllowedValue>e.value?(this._buffer.url!==r&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Ie(this._buffer.url)&&(this._buffer.url=r),this._buffer.firstMetricTimestamp=Ie(this._buffer.firstMetricTimestamp)?Date.now():this._buffer.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this._buffer.metrics.push(i({},e,{$current_url:r,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this._buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()):to.error("Ignoring metric with value >= "+this._maxAllowedValue,e))}},this._startCapturing=()=>{if(!this._initialized){var e,t,i,s,r=de.__PosthogExtensions__;Ie(r)||Ie(r.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:s}=r.postHogWebVitalsCallbacks),e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this._addToBuffer.bind(this)),this._initialized=!0):to.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this._enabledServerSide=!(null==(t=this._instance.persistence)||!t.props[g]),this.startIfEnabled()}get _perfConfig(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=xe(this._perfConfig)?null==(e=this._perfConfig)?void 0:e.web_vitals_allowed_metrics:void 0;return Re(i)?(null==(t=this._instance.persistence)?void 0:t.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(xe(this._perfConfig)?this._perfConfig.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=xe(this._perfConfig)?this._perfConfig.web_vitals_attribution:void 0;return null!=e&&e}get _maxAllowedValue(){var e=xe(this._perfConfig)&&Fe(this._perfConfig.__web_vitals_max_value)?this._perfConfig.__web_vitals_max_value:io;return e>0&&6e4>=e?io:e}get isEnabled(){var e=null==ne?void 0:ne.protocol;if("http:"!==e&&"https:"!==e)return to.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=xe(this._perfConfig)?this._perfConfig.web_vitals:Oe(this._perfConfig)?this._perfConfig:void 0;return Oe(t)?t:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(to.info("enabled, starting..."),this._loadScript(this._startCapturing))}onRemoteConfig(e){if("capturePerformance"in e){var t=xe(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=xe(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[g]:t}),this._instance.persistence.register({[m]:i})),this._enabledServerSide=t,this.startIfEnabled()}}_loadScript(e){var t,i;null!=(t=de.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(t=>{t?to.error("failed to load script",t):e()}))}_currentURL(){var e=te?te.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...ns,...t||[]]:[];return is(e,i,as)}to.error("Could not determine current URL")}}},Vo={exceptionObserver:class{constructor(e){var t,i,s;this._startCapturing=()=>{var e;if(te&&this.isEnabled&&null!=(e=de.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=de.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=de.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=de.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this._unwrapOnError&&this._config.capture_unhandled_errors&&(this._unwrapOnError=t(this.captureException.bind(this))),!this._unwrapUnhandledRejection&&this._config.capture_unhandled_rejections&&(this._unwrapUnhandledRejection=i(this.captureException.bind(this))),!this._unwrapConsoleError&&this._config.capture_console_errors&&(this._unwrapConsoleError=s(this.captureException.bind(this)))}catch(e){Qn.error("failed to start",e),this._stopCapturing()}}},this._instance=e,this._remoteEnabled=!(null==(t=this._instance.persistence)||!t.props[_]),this._rateLimiter=new je({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,_logger:Qn}),this._config=this._requiredConfig(),this.startIfEnabledOrStop()}_requiredConfig(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return xe(e)?t=i({},t,e):(Ie(e)?this._remoteEnabled:e)&&(t=i({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this._config.capture_console_errors||this._config.capture_unhandled_errors||this._config.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Qn.info("enabled"),this._stopCapturing(),this._loadScript(this._startCapturing)):this._stopCapturing()}_loadScript(e){var t,i;null!=(t=de.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(t=>{if(t)return Qn.error("failed to load script",t);e()}))}_stopCapturing(){var e,t,i;null==(e=this._unwrapOnError)||e.call(this),this._unwrapOnError=void 0,null==(t=this._unwrapUnhandledRejection)||t.call(this),this._unwrapUnhandledRejection=void 0,null==(i=this._unwrapConsoleError)||i.call(this),this._unwrapConsoleError=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this._remoteEnabled=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[_]:this._remoteEnabled}),this._config=this._requiredConfig(),this.startIfEnabledOrStop())}onConfigChange(){this._config=this._requiredConfig()}captureException(e){var t,i,s,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this._rateLimiter.consumeRateLimit(r)?Qn.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,s;this._suppressionRules=[],this._errorPropertiesBuilder=new Bt([new ii,new _i,new ri,new si,new ci,new ui,new oi,new di],function(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;t>r;r++)s[r-1]=arguments[r];return function(t,r){void 0===r&&(r=0);for(var n=[],o=t.split("\n"),a=r;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=ti.test(l)?l.replace(ti,"$1"):l;if(!u.match(/\S*Error: /)){for(var c of s){var d=c(u,e);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map((e=>{return i({},e,{filename:e.filename||(s=t,s[s.length-1]||{}).filename,function:e.function||Vt});var s}))}(n)}}("web:javascript",Xt,ei)),this._instance=e,this._suppressionRules=null!==(t=null==(s=this._instance.persistence)?void 0:s.get_property(h))&&void 0!==t?t:[]}onRemoteConfig(e){var t,i,s;if("errorTracking"in e){var r=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(s=e.errorTracking)?void 0:s.captureExtensionExceptions;this._suppressionRules=r,this._instance.persistence&&this._instance.persistence.register({[h]:this._suppressionRules,[p]:n})}}get _captureExtensionExceptions(){var e,t=!!this._instance.get_property(p),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this._errorPropertiesBuilder.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._isExceptionList(t)){if(this._matchesSuppressionRule(t))return void Ao.info("Skipping exception capture because a suppression rule matched");if(!this._captureExtensionExceptions&&this._isExtensionException(t))return void Ao.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this._isPostHogException(t))return void Ao.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",_originatedFromCaptureException:!0})}_matchesSuppressionRule(e){if(0===e.length)return!1;var t=e.reduce(((e,t)=>{var{type:i,value:s}=t;return Pe(i)&&i.length>0&&e.$exception_types.push(i),Pe(s)&&s.length>0&&e.$exception_values.push(s),e}),{$exception_types:[],$exception_values:[]});return this._suppressionRules.some((e=>{var i=e.values.map((e=>{var i,s=Ur[e.operator],r=Ee(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return r.length>0&&s(r,n)}));return"OR"===e.type?i.some(Boolean):i.every(Boolean)}))}_isExtensionException(e){return e.flatMap((e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}_isPostHogException(e){if(e.length>0){var t,i,s,r,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(s=null==o||null==(r=o.filename)?void 0:r.includes("posthog.com/static"))&&void 0!==s&&s}return!1}_isExceptionList(e){return!Re(e)&&Ee(e)}}},Wo=i({productTours:class{get _persistence(){return this._instance.persistence}constructor(e){this._productTourManager=null,this._cachedTours=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){"productTours"in e&&(this._persistence&&this._persistence.register({[f]:!!e.productTours}),this.loadIfEnabled())}loadIfEnabled(){var e,t;this._productTourManager||(e=this._instance).config.disable_product_tours||null==(t=e.persistence)||!t.get_property(f)||this._loadScript((()=>this._startProductTours()))}_loadScript(e){var t,i;null!=(t=de.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(t=>{t?_o.error("Could not load product tours script",t):e()}))}_startProductTours(){var e;!this._productTourManager&&null!=(e=de.__PosthogExtensions__)&&e.generateProductTours&&(this._productTourManager=de.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Ee(this._cachedTours)||t){var i=this._persistence;if(i){var s=i.props[ho];if(Ee(s)&&!t)return this._cachedTours=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 _o.error(r),void e([],{isLoaded:!1,error:r})}var n=Ee(t.json.product_tours)?t.json.product_tours:[];this._cachedTours=n,i&&i.register({[ho]:n}),e(n,{isLoaded:!0})}})}else e(this._cachedTours,{isLoaded:!0})}getActiveProductTours(e){Re(this._productTourManager)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this._productTourManager.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this._productTourManager)||t.showTourById(e)}previewTour(e){this._productTourManager?this._productTourManager.previewTour(e):this._loadScript((()=>{var t;this._startProductTours(),null==(t=this._productTourManager)||t.previewTour(e)}))}dismissProductTour(){var e;null==(e=this._productTourManager)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this._productTourManager)||e.nextStep()}previousStep(){var e;null==(e=this._productTourManager)||e.previousStep()}clearCache(){var e;this._cachedTours=null,null==(e=this._persistence)||e.unregister(ho)}resetTour(e){var t;null==(t=this._productTourManager)||t.resetTour(e)}resetAllTours(){var e;null==(e=this._productTourManager)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this._productTourManager)||t.cancelPendingTour(e)}}},zo),Go={siteApps:class{constructor(e){this._instance=e,this._bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}_eventCollector(e,t){if(t){var i=this.globalsForEvent(t);this._bufferedInvocations.push(i),this._bufferedInvocations.length>1e3&&(this._bufferedInvocations=this._bufferedInvocations.slice(10))}}get siteAppLoaders(){var e;return null==(e=de._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this._eventCollector.bind(this));this._stopBuffering=()=>{e(),this._bufferedInvocations=[],this._stopBuffering=void 0}}}globalsForEvent(e){var t,r,n,o,a,l,u;if(!e)throw new Error("Event payload is required");var c={},d=this._instance.get_property("$groups")||[],_=this._instance.get_property("$stored_group_properties")||{};for(var[h,p]of Object.entries(_))c[h]={id:d[h],type:h,properties:p};var{$set_once:g,$set:v}=e;return{event:i({},s(e,po),{properties:i({},e.properties,v?{$set:i({},null!==(t=null==(r=e.properties)?void 0:r.$set)&&void 0!==t?t:{},v)}:{},g?{$set_once:i({},null!==(n=null==(o=e.properties)?void 0:o.$set_once)&&void 0!==n?n:{},g)}:{}),elements_chain:null!==(a=null==(l=e.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(u=e.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this._bufferedInvocations.length&&(go.info("Processing "+this._bufferedInvocations.length+" events for site app with id "+e.id),this._bufferedInvocations.forEach((e=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every((e=>e.processedBuffer||e.errored))&&(null==(i=this._stopBuffering)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,go.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){go.error(vo+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){go.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}_setupSiteApps(){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)}_onCapturedEvent(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){go.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._setupSiteApps(),void this._instance.on("eventCaptured",(e=>this._onCapturedEvent(e)))):void go.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this._stopBuffering)||i.call(this),null!=(s=e.siteApps)&&s.length)if(this.isEnabled){var n=function(e){var t;de["__$$ph_site_app_"+e]=r._instance,null==(t=de.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(r._instance,a,(t=>{if(t)return go.error(vo+e,t)}))};for(var{id:o,url:a}of e.siteApps)n(o)}else go.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Yo={tracingHeaders:class{constructor(e){this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0,this._startCapturing=()=>{var e,t;Ie(this._restoreXHRPatch)&&(null==(e=de.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),Ie(this._restoreFetchPatch)&&(null==(t=de.__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()}_loadScript(e){var t,i;null!=(t=de.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=de.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(t=>{if(t)return eo.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):(null==(e=this._restoreXHRPatch)||e.call(this),null==(t=this._restoreFetchPatch)||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}},Ko=i({surveys:class{get _config(){return this._instance.config}constructor(e){this._isSurveysEnabled=void 0,this._surveyManager=null,this._isInitializingSurveys=!1,this._surveyCallbacks=[],this._getSurveysInFlightPromise=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._config.disable_surveys){var t=e.surveys;if(Re(t))return Vr.warn("Flags not loaded yet. Not loading surveys.");var i=Ee(t);this._isSurveysEnabled=i?t.length>0:t,Vr.info("flags response received, isSurveysEnabled: "+this._isSurveysEnabled),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(Wr)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((e=>localStorage.removeItem(e)))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)Vr.info("Already initializing surveys, skipping...");else if(this._config.disable_surveys)Vr.info(Eo);else if(this._config.cookieless_mode&&this._instance.consent.isOptedOut())Vr.info("Not loading surveys in cookieless mode without consent.");else{var e=null==de?void 0:de.__PosthogExtensions__;if(e){if(!Ie(this._isSurveysEnabled)||this._config.advanced_enable_surveys){var t=this._isSurveysEnabled||this._config.advanced_enable_surveys;this._isInitializingSurveys=!0;try{var i=e.generateSurveys;if(i)return void this._completeSurveyInitialization(i,t);var s=e.loadExternalDependency;if(!s)return void this._handleSurveyLoadError(j);s(this._instance,"surveys",(i=>{i||!e.generateSurveys?this._handleSurveyLoadError("Could not load surveys script",i):this._completeSurveyInitialization(e.generateSurveys,t)}))}catch(e){throw this._handleSurveyLoadError("Error initializing surveys",e),e}finally{this._isInitializingSurveys=!1}}}else Vr.error("PostHog Extensions not found.")}}_completeSurveyInitialization(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new bo(this._instance),Vr.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})}_handleSurveyLoadError(e,t){Vr.error(e,t),this._notifySurveyCallbacks({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._surveyCallbacks.push(e),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter((t=>t!==e))}}getSurveys(e,t){if(void 0===t&&(t=!1),this._config.disable_surveys)return Vr.info(Eo),e([]);var i,s=this._instance.get_property(P);if(s&&!t)return e(s,{isLoaded:!0});"undefined"!=typeof Promise&&this._getSurveysInFlightPromise?this._getSurveysInFlightPromise.then((t=>{var{surveys:i,context:s}=t;return e(i,s)})):("undefined"!=typeof Promise&&(this._getSurveysInFlightPromise=new Promise((e=>{i=e}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._config.token),method:"GET",timeout:this._config.surveys_request_timeout_ms,callback:t=>{var s;this._getSurveysInFlightPromise=null;var r=t.statusCode;if(200!==r||!t.json){var n="Surveys API could not be loaded, status: "+r;Vr.error(n);var o={isLoaded:!1,error:n};return e([],o),void(null==i||i({surveys:[],context:o}))}var a,l=t.json.surveys||[],u=l.filter((e=>function(e){return!(!e.start_date||e.end_date)}(e)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(s=this._instance.persistence)||s.register({[P]:l});var c={isLoaded:!0};e(l,c),null==i||i({surveys:l,context:c})}}))}_notifySurveyCallbacks(e){for(var t of this._surveyCallbacks)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){Vr.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Re(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Vr.warn("init was not called")}_getSurveyById(e){var t=null;return this.getSurveys((i=>{var s;t=null!==(s=i.find((t=>t.id===e)))&&void 0!==s?s:null})),t}_checkSurveyEligibility(e){if(Re(this._surveyManager))return{eligible:!1,reason:wo};var t="string"==typeof e?this._getSurveyById(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Re(this._surveyManager))return Vr.warn("init was not called"),{visible:!1,disabledReason:wo};var t=this._checkSurveyEligibility(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Re(this._surveyManager)?(Vr.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:wo})):new Promise((i=>{this.getSurveys((t=>{var s,r=null!==(s=t.find((t=>t.id===e)))&&void 0!==s?s:null;if(r){var n=this._checkSurveyEligibility(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,i){var s;if(Re(this._surveyManager))Vr.warn("init was not called");else{var r="string"==typeof e?this._getSurveyById(e):e;if(null!=r&&r.id)if(Kr.includes(r.type)){var n=null==re?void 0:re.querySelector(t);if(n)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(Vr.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var e,t;Vr.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),Vr.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,i);Vr.warn("Survey element not found")}else Vr.warn("Surveys of type "+r.type+" cannot be rendered in the app");else Vr.warn("Survey not found")}}displaySurvey(e,t){var s;if(Re(this._surveyManager))Vr.warn("init was not called");else{var r=this._getSurveyById(e);if(r){var n=r;if(null!=(s=r.appearance)&&s.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=i({},r,{appearance:i({},r.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==Fs.Popover&&t.initialResponses&&Vr.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var o=this.canRenderSurvey(r);if(!o.visible)return void Vr.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==Fs.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else Vr.warn("Survey not found")}}cancelPendingSurvey(e){Re(this._surveyManager)?Vr.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},zo),Jo={toolbar:class{constructor(e){this.instance=e}_setToolbarState(e){de.ph_toolbar_state=e}_getToolbarState(){var e;return null!==(e=de.ph_toolbar_state)&&void 0!==e?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),Ii(this.instance.config))return!1;if(!te||!re)return!1;e=null!=e?e:te.location,i=null!=i?i:te.history;try{if(!t){try{te.localStorage.setItem("test","test"),te.localStorage.removeItem("test")}catch(e){return!1}t=null==te?void 0:te.localStorage}var s,r=So||ss(e.hash,"__posthog")||ss(e.hash,"state"),n=r?bi((()=>JSON.parse(atob(decodeURIComponent(r)))))||bi((()=>JSON.parse(decodeURIComponent(r)))):null;return n&&"ph_authorize"===n.action?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(xo)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}_callLoadToolbar(e){var t=de.ph_load_toolbar||de.ph_load_editor;!Re(t)&&Se(t)?t(e,this.instance):ko.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==re||!re.getElementById(q));if(!te||t)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=i({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(te.localStorage.setItem(xo,JSON.stringify(i({},r,{source:void 0}))),2===this._getToolbarState())this._callLoadToolbar(r);else if(0===this._getToolbarState()){var n;this._setToolbarState(1),null==(n=de.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(e=>{if(e)return ko.error("[Toolbar] Failed to load",e),void this._setToolbarState(0);this._setToolbarState(2),this._callLoadToolbar(r)})),ki(te,"turbolinks:load",(()=>{this._setToolbarState(0),this.loadToolbar(r)}))}return!0}_loadEditor(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)}}},Xo=i({experiments:Uo},zo),Qo={conversations:class{constructor(e){this._isConversationsEnabled=void 0,this._conversationsManager=null,this._isInitializing=!1,this._remoteConfig=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;Re(t)||(Oe(t)?this._isConversationsEnabled=t:(this._isConversationsEnabled=t.enabled,this._remoteConfig=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this._isConversationsEnabled=void 0,this._remoteConfig=null}loadIfEnabled(){if(!(this._conversationsManager||this._isInitializing||this._instance.config.disable_conversations||Ii(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==de?void 0:de.__PosthogExtensions__;if(e&&!Ie(this._isConversationsEnabled)&&this._isConversationsEnabled)if(this._remoteConfig&&this._remoteConfig.token){this._isInitializing=!0;try{var t=e.initConversations;if(t)return this._completeInitialization(t),void(this._isInitializing=!1);var i=e.loadExternalDependency;if(!i)return void this._handleLoadError(j);i(this._instance,"conversations",(t=>{t||!e.initConversations?this._handleLoadError("Could not load conversations script",t):this._completeInitialization(e.initConversations),this._isInitializing=!1}))}catch(e){this._handleLoadError("Error initializing conversations",e),this._isInitializing=!1}}else qo.error("Conversations enabled but missing token in remote config.")}}_completeInitialization(e){if(this._remoteConfig)try{this._conversationsManager=e(this._remoteConfig,this._instance),qo.info("Conversations loaded successfully")}catch(e){this._handleLoadError("Error completing conversations initialization",e)}else qo.error("Cannot complete initialization: remote config is null")}_handleLoadError(e,t){qo.error(e,t),this._conversationsManager=null,this._isInitializing=!1}show(){this._conversationsManager?this._conversationsManager.show():qo.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this._isConversationsEnabled&&!Ce(this._conversationsManager)}isVisible(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&void 0!==e&&e}sendMessage(e,i,s){var r=this;return t((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(e,i,s):(qo.warn(Ho),null)}))()}getMessages(e,i){var s=this;return t((function*(){return s._conversationsManager?s._conversationsManager.getMessages(e,i):(qo.warn(Ho),null)}))()}markAsRead(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(e):(qo.warn(Ho),null)}))()}getTickets(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.getTickets(e):(qo.warn(Ho),null)}))()}requestRestoreLink(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(e):(qo.warn(Ho),null)}))()}restoreFromToken(e){var i=this;return t((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(e):(qo.warn(Ho),null)}))()}restoreFromUrlToken(){var e=this;return t((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(qo.warn(Ho),null)}))()}getCurrentTicketId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())&&void 0!==e?e:null}getWidgetSessionId(){var e,t;return null!==(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())&&void 0!==e?e:null}_onIdentityChanged(){var e;null==(e=this._conversationsManager)||e.setIdentity()}_onIdentityCleared(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},Zo={logs:class{constructor(e){var t;this._isLogsEnabled=!1,this._isLoaded=!1,this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this._isLogsEnabled=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,i=null==(t=e.logs)?void 0:t.captureConsoleLogs;!Re(i)&&i&&(this._isLogsEnabled=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this._isLogsEnabled&&!this._isLoaded){var e=gi("[logs]"),t=null==de?void 0:de.__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._isLoaded=!0)})):e.error(j)}else e.error("PostHog Extensions not found.")}}}},ea=i({},zo,jo,Bo,Vo,Wo,Go,Ko,Yo,Jo,Xo,Qo,Zo);pn.__defaultExtensionClasses=i({},ea);var ta,ia=(ta=en[ln]=new pn,function(){function e(){e.done||(e.done=!0,un=!1,fi(en,(function(e){e._dom_loaded()})))}null!=re&&re.addEventListener?"complete"===re.readyState?e():ki(re,"DOMContentLoaded",e,{capture:!1}):te&&pi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),ta);export{qs as Compression,Ls as DEFAULT_PRODUCT_TOUR_APPEARANCE,Fs as DisplaySurveyType,pn as PostHog,Os as ProductTourEventName,$s as ProductTourEventProperties,Cs as SurveyEventName,Rs as SurveyEventProperties,ws as SurveyEventType,Ss as SurveyPosition,Ps as SurveyQuestionBranchingType,Is as SurveyQuestionType,Ts as SurveySchedule,xs as SurveyTabPosition,ks as SurveyType,Es as SurveyWidgetType,ia as default,ia as posthog,Us as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.no-external.js.map
|