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
package/dist/array.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){"use strict";var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(i.self=i),"undefined"==typeof File&&(i.File=function(){});var e=null==i?void 0:i.navigator,r=null==i?void 0:i.document,s=null==i?void 0:i.location,n=null==i?void 0:i.fetch,o=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,a=null==i?void 0:i.AbortController,l=null==i?void 0:i.CompressionStream,u=null==e?void 0:e.userAgent,h=null!=t?t:{},d="1.366.1",v={DEBUG:!1,LIB_VERSION:d,LIB_NAME:"web",JS_SDK_VERSION:d};function c(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function f(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){c(n,r,s,o,a,"next",t)}function a(t){c(n,r,s,o,a,"throw",t)}o(void 0)}))}}function p(){return p=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},p.apply(null,arguments)}function g(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}function _(){return(_=f((function*(t,i){void 0===i&&(i=!0);try{var e=new Blob([t],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(e).blob()}catch(t){return i&&console.error("Failed to gzip compress data",t),null}}))).apply(this,arguments)}var m=["$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"],b=["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"],y=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return b.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function w(t,i){return-1!==t.indexOf(i)}var x=function(t){return t.trim()},E=function(t){return t.replace(/^\$/,"")},S=Object.prototype,k=S.hasOwnProperty,P=S.toString,I=Array.isArray||function(t){return"[object Array]"===P.call(t)},T=t=>"function"==typeof t,R=t=>t===Object(t)&&!I(t),C=t=>{if(R(t)){for(var i in t)if(k.call(t,i))return!1;return!0}return!1},F=t=>void 0===t,O=t=>"[object String]"==P.call(t),M=t=>O(t)&&0===t.trim().length,A=t=>null===t,D=t=>F(t)||A(t),j=t=>"[object Number]"==P.call(t)&&t==t,L=t=>j(t)&&t>0,z=t=>"[object Boolean]"===P.call(t),U=t=>t instanceof FormData,N=t=>w(m,t);function H(t){return null===t||"object"!=typeof t}function B(t,i){return{}.toString.call(t)==="[object "+i+"]"}function q(t){return"undefined"!=typeof Event&&function(t,i){try{return t instanceof i}catch(t){return!1}}(t,Event)}var W=[!0,"true",1,"1","yes"],V=t=>w(W,t),G=[!1,"false",0,"0","no"];function J(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),j(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),J(s||e,i,e,r))}class K{constructor(t){this.Pt={},this.Dt=t.Dt,this.jt=J(t.bucketSize,0,100,t.qt),this.$t=J(t.refillRate,0,this.jt,t.qt),this.Ht=J(t.refillInterval,0,864e5,t.qt)}Vt(t,i){var e=Math.floor((i-t.lastAccess)/this.Ht);e>0&&(t.tokens=Math.min(t.tokens+e*this.$t,this.jt),t.lastAccess=t.lastAccess+e*this.Ht)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.Pt[r];return s?this.Vt(s,e):this.Pt[r]=s={tokens:this.jt,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.Dt)||i.call(this,t)),0===s.tokens)}stop(){this.Pt={}}}var Y,X,Q,Z="Mobile",tt="iOS",it="Android",et="Tablet",rt=it+" "+et,st="iPad",nt="Apple",ot=nt+" Watch",at="Safari",lt="BlackBerry",ut="Samsung",ht=ut+"Browser",dt=ut+" Internet",vt="Chrome",ct=vt+" OS",ft=vt+" "+tt,pt="Internet Explorer",gt=pt+" "+Z,_t="Opera",mt=_t+" Mini",bt="Edge",yt="Microsoft "+bt,wt="Firefox",xt=wt+" "+tt,Et="Nintendo",St="PlayStation",$t="Xbox",kt=it+" "+Z,Pt=Z+" "+at,It="Windows",Tt=It+" Phone",Rt="Nokia",Ct="Ouya",Ft="Generic",Ot=Ft+" "+Z.toLowerCase(),Mt=Ft+" "+et.toLowerCase(),At="Konqueror",Dt="(\\d+(\\.\\d+)?)",jt=new RegExp("Version/"+Dt),Lt=new RegExp($t,"i"),zt=new RegExp(St+" \\w+","i"),Ut=new RegExp(Et+" \\w+","i"),Nt=new RegExp(lt+"|PlayBook|BB10","i"),Ht={"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"},Bt=function(t,i){return i=i||"",w(t," OPR/")&&w(t,"Mini")?mt:w(t," OPR/")?_t:Nt.test(t)?lt:w(t,"IE"+Z)||w(t,"WPDesktop")?gt:w(t,ht)?dt:w(t,bt)||w(t,"Edg/")?yt:w(t,"FBIOS")?"Facebook "+Z:w(t,"UCWEB")||w(t,"UCBrowser")?"UC Browser":w(t,"CriOS")?ft:w(t,"CrMo")||w(t,vt)?vt:w(t,it)&&w(t,at)?kt:w(t,"FxiOS")?xt:w(t.toLowerCase(),At.toLowerCase())?At:((t,i)=>i&&w(i,nt)||function(t){return w(t,at)&&!w(t,vt)&&!w(t,it)}(t))(t,i)?w(t,Z)?Pt:at:w(t,wt)?wt:w(t,"MSIE")||w(t,"Trident/")?pt:w(t,"Gecko")?wt:""},qt={[gt]:[new RegExp("rv:"+Dt)],[yt]:[new RegExp(bt+"?\\/"+Dt)],[vt]:[new RegExp("("+vt+"|CrMo)\\/"+Dt)],[ft]:[new RegExp("CriOS\\/"+Dt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Dt)],[at]:[jt],[Pt]:[jt],[_t]:[new RegExp("(Opera|OPR)\\/"+Dt)],[wt]:[new RegExp(wt+"\\/"+Dt)],[xt]:[new RegExp("FxiOS\\/"+Dt)],[At]:[new RegExp("Konqueror[:/]?"+Dt,"i")],[lt]:[new RegExp(lt+" "+Dt),jt],[kt]:[new RegExp("android\\s"+Dt,"i")],[dt]:[new RegExp(ht+"\\/"+Dt)],[pt]:[new RegExp("(rv:|MSIE )"+Dt)],Mozilla:[new RegExp("rv:"+Dt)]},Wt=function(t,i){var e=Bt(t,i),r=qt[e];if(F(r))return null;for(var s=0;r.length>s;s++){var n=t.match(r[s]);if(n)return parseFloat(n[n.length-2])}return null},Vt=[[new RegExp($t+"; "+$t+" (.*?)[);]","i"),t=>[$t,t&&t[1]||""]],[new RegExp(Et,"i"),[Et,""]],[new RegExp(St,"i"),[St,""]],[Nt,[lt,""]],[new RegExp(It,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Tt,""];if(new RegExp(Z).test(i)&&!/IEMobile\b/.test(i))return[It+" "+Z,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Ht[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[It,r]}return[It,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[tt,[t[3],t[4],t[5]||"0"].join(".")]:[tt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=F(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+it+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+it+")","i"),t=>t&&t[2]?[it,[t[2],t[3],t[4]||"0"].join(".")]:[it,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ct,""]],[/Linux|debian/i,["Linux",""]]],Gt=function(t){return Ut.test(t)?Et:zt.test(t)?St:Lt.test(t)?$t:new RegExp(Ct,"i").test(t)?Ct:new RegExp("("+Tt+"|WPDesktop)","i").test(t)?Tt:/iPad/.test(t)?st:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ot:Nt.test(t)?lt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Rt,"i").test(t)?Rt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Z).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?it:rt:new RegExp("(pda|"+Z+")","i").test(t)?Ot:new RegExp(et,"i").test(t)&&!new RegExp(et+" pc","i").test(t)?Mt:""},Jt=t=>t instanceof Error;function Kt(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Q&&e.length===X||(X=e.length,Q=e.reduce(((e,r)=>{Y||(Y={});var s=Y[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=i[r];if(l&&u){e[l]=u,Y[r]=[l,u];break}}return e}),{})),Q}}class Yt{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return f((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&I(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),p({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return f((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,i){var e,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,p({},i,{handled:!0}))),o}buildParsingContext(t){var i;return{chunkIdMap:Kt(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return p({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}var Xt="?";function Qt(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?Xt:e,in_app:!0};return F(r)||(n.lineno=r),F(s)||(n.colno=s),n}var Zt=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:Xt,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},ti=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ii=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ei=/\((\S*)(?::(\d+))(?::(\d+))\)/,ri=(t,i)=>{var e=ti.exec(t);if(e){var[,r,s,n]=e;return Qt(i,r,Xt,+s,+n)}var o=ii.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=ei.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Zt(o[1]||Xt,o[2]);return Qt(i,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},si=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ni=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,oi=(t,i)=>{var e=si.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=ni.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||Xt;return[n,s]=Zt(n,s),Qt(i,s,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ai=/\(error: (.*)\)/;class li{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=O(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return B(t,"DOMException")}isDOMError(t){return B(t,"DOMError")}}class ui{match(t){return(t=>t instanceof Error)(t)}coerce(t,i){return{type:this.getType(t),value:this.getMessage(t,i),stack:this.getStack(t),cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}}class hi{constructor(){}match(t){return B(t,"ErrorEvent")&&null!=t.error}coerce(t,i){var e;return i.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}var di=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class vi{match(t){return"string"==typeof t}coerce(t,i){var e,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(di);return r&&(i=r[1],e=r[2]),[i,e]}}var ci=["fatal","error","warning","log","info","debug"];function fi(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}class pi{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r=this.getErrorPropertyFromObject(t);return r?i.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(e=i.syntheticException)?void 0:e.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return q(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+fi(t)}isSeverityLevel(t){return O(t)&&!M(t)&&ci.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(Jt(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class gi{match(t){return q(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+fi(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class _i{match(t){return H(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class mi{match(t){return B(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!q(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return H(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var bi=function(i,e){var{debugEnabled:r}=void 0===e?{}:e,s={C(e){if(t&&(v.DEBUG||h.POSTHOG_DEBUG||r)&&!F(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[e]?t.console[e].__rrweb_original__:t.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(i,...o)}},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.C("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.C("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.C("error",...i)},critical(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];console.error(i,...e)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,e)=>bi(i+" "+t,e)};return s},yi=bi("[PostHog.js]"),wi=yi.createLogger,xi=wi("[ExternalScriptsLoader]"),Ei=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return xi.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var s=null==r?void 0:r.querySelectorAll("script");if(s)for(var n,o=function(){if(s[a].src===i){var t=s[a];return t.__posthog_loading_callback_fired?{v:e()}:(t.addEventListener("load",(i=>{t.__posthog_loading_callback_fired=!0,e(void 0,i)})),t.onerror=t=>e(t),{v:void 0})}},a=0;s.length>a;a++)if(n=o())return n.v;var l=()=>{if(!r)return e("document not found");var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=i,s.onload=t=>{s.__posthog_loading_callback_fired=!0,e(void 0,t)},s.onerror=t=>e(t),t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?l():null==r||r.addEventListener("DOMContentLoaded",l)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{var r="/static/"+i+".js?v="+t.version;if("remote-config"===i&&(r="/array/"+t.config.token+"/config.js"),"toolbar"===i){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=t.requestRouter.endpointFor("assets",r);Ei(t,n,e)},h.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);Ei(t,r,e)};var Si="$people_distinct_id",$i="$device_id",ki="__alias",Pi="__timers",Ii="$autocapture_disabled_server_side",Ti="$heatmaps_enabled_server_side",Ri="$exception_capture_enabled_server_side",Ci="$error_tracking_suppression_rules",Fi="$error_tracking_capture_extension_exceptions",Oi="$web_vitals_enabled_server_side",Mi="$dead_clicks_enabled_server_side",Ai="$product_tours_enabled_server_side",Di="$web_vitals_allowed_metrics",ji="$session_recording_remote_config",Li="$sesid",zi="$session_is_sampled",Ui="$enabled_feature_flags",Ni="$early_access_features",Hi="$feature_flag_details",Bi="$stored_person_properties",qi="$stored_group_properties",Wi="$surveys",Vi="$flag_call_reported",Gi="$flag_call_reported_session_id",Ji="$feature_flag_errors",Ki="$feature_flag_evaluated_at",Yi="$user_state",Xi="$client_session_props",Qi="$capture_rate_limit",Zi="$initial_campaign_params",te="$initial_referrer_info",ie="$initial_person_info",ee="$epp",re="__POSTHOG_TOOLBAR__",se="$posthog_cookieless",ne=[Si,ki,"__cmpns",Pi,"$session_recording_enabled_server_side",Ti,Li,Ui,Ci,Yi,Ni,Hi,qi,Bi,Wi,Vi,Gi,Ji,Ki,Xi,Qi,Zi,te,ee,ie],oe="PostHog loadExternalDependency extension not found.",ae="on_reject",le="always",ue="anonymous",he="identified",de="identified_only",ve="visibilitychange",ce="beforeunload",fe="$pageview",pe="$pageleave",ge="$identify",_e="$groupidentify";function me(t,i){I(t)&&t.forEach(i)}function be(t,i){if(!D(t))if(I(t))t.forEach(i);else if(U(t))t.forEach(((t,e)=>i(t,e)));else for(var e in t)k.call(t,e)&&i(t[e],e)}var ye=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function we(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var xe=function(t){try{return t()}catch(t){return}},Ee=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){yi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),yi.critical(t)}}},Se=function(t){var i={};return be(t,(function(t,e){(O(t)&&t.length>0||j(t))&&(i[e]=t)})),i};var $e=["herokuapp.com","vercel.app","netlify.app"];function ke(t){var i=null==t?void 0:t.hostname;if(!O(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of $e)if(e===r)return!1;return!0}function Pe(t,i,e,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:s,passive:n})}function Ie(t){return"ph_toolbar_internal"===t.name}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return j(t)&&isFinite(t)&&Math.floor(t)===t});class Te{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||0>t||0>i||0>e||0>r||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Te(s)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Te(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class Re{constructor(){this.I=0,this.S=0,this.k=new Oe}generate(){var t=this.generateOrAbort();if(F(t)){this.I=0;var i=this.generateOrAbort();if(F(i))throw new Error("Could not generate UUID after timestamp reset");return i}return t}generateOrAbort(){var t=Date.now();if(t>this.I)this.I=t,this.A();else{if(this.I>=t+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Te.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}var Ce,Fe=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!F(t.crypto)&&crypto.getRandomValues&&(Fe=t=>crypto.getRandomValues(t));class Oe{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(Fe(this.T),this.N=0),this.T[this.N++]}}var Me=()=>Ae().toString(),Ae=()=>(Ce||(Ce=new Re)).generate(),De="",je=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Le={Yt:()=>!!r,Ut(t){yi.error("cookieStore error: "+t)},Wt(t){if(r){try{for(var i=t+"=",e=r.cookie.split(";").filter((t=>t.length)),s=0;e.length>s;s++){for(var n=e[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(i))return decodeURIComponent(n.substring(i.length,n.length))}}catch(t){}return null}},Gt(t){var i;try{i=JSON.parse(Le.Wt(t))||{}}catch(t){}return i},Xt(t,i,e,s,n){if(r)try{var o="",a="",l=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=r),De)return De;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),s=Math.min(e.length,8),n="dmn_chk_"+Me();!De&&s--;){var o=e.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(n)&&(i.cookie=a+";max-age=0",De=o)}return De}(t);if(!e){var s=(t=>{var i=t.match(je);return i?i[0]:""})(t);s!==e&&yi.info("Warning: cookie subdomain discovery mismatch",s,e),e=s}return e?"; domain=."+e:""}return""}(r.location.hostname,s);if(e){var u=new Date;u.setTime(u.getTime()+864e5*e),o="; expires="+u.toUTCString()}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+o+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&yi.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,h}catch(t){return}},Jt(t,i){if(null!=r&&r.cookie)try{Le.Xt(t,"",-1,i)}catch(t){return}}},ze=null,Ue={Yt(){if(!A(ze))return ze;var i=!0;if(F(t))i=!1;else try{var e="__mplssupport__";Ue.Xt(e,"xyz"),'"xyz"'!==Ue.Wt(e)&&(i=!1),Ue.Jt(e)}catch(t){i=!1}return i||yi.error("localStorage unsupported; falling back to cookie store"),ze=i,i},Ut(t){yi.error("localStorage error: "+t)},Wt(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){Ue.Ut(t)}return null},Gt(t){try{return JSON.parse(Ue.Wt(t))||{}}catch(t){}return null},Xt(i,e){try{null==t||t.localStorage.setItem(i,JSON.stringify(e))}catch(t){Ue.Ut(t)}},Jt(i){try{null==t||t.localStorage.removeItem(i)}catch(t){Ue.Ut(t)}}},Ne=[$i,"distinct_id",Li,zi,ee,ie,Yi],He={},Be={Yt:()=>!0,Ut(t){yi.error("memoryStorage error: "+t)},Wt:t=>He[t]||null,Gt:t=>He[t]||null,Xt(t,i){He[t]=i},Jt(t){delete He[t]}},qe=null,We={Yt(){if(!A(qe))return qe;if(qe=!0,F(t))qe=!1;else try{var i="__support__";We.Xt(i,"xyz"),'"xyz"'!==We.Wt(i)&&(qe=!1),We.Jt(i)}catch(t){qe=!1}return qe},Ut(t){yi.error("sessionStorage error: ",t)},Wt(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){We.Ut(t)}return null},Gt(t){try{return JSON.parse(We.Wt(t))||null}catch(t){}return null},Xt(i,e){try{null==t||t.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){We.Ut(t)}},Jt(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){We.Ut(t)}}};class Ve{constructor(t){this._instance=t}get Rt(){return this._instance.config}get consent(){return this.Kt()?0:this.Qt}isOptedOut(){return this.Rt.cookieless_mode===le||0===this.consent||-1===this.consent&&(this.Rt.opt_out_capturing_by_default||this.Rt.cookieless_mode===ae)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}optInOut(t){this.ti.Xt(this.ei,t?1:0,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}reset(){this.ti.Jt(this.ei,this.Rt.cross_subdomain_cookie)}get ei(){var{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get Qt(){var t=this.ti.Wt(this.ei);return V(t)?1:w(G,t)?0:-1}get ti(){var t=this.Rt.opt_out_capturing_persistence_type,i="localStorage"===t?Ue:Le;if(!this.ii||this.ii!==i){this.ii=i;var e="localStorage"===t?Le:Ue;e.Wt(this.ei)&&(this.ii.Wt(this.ei)||this.optInOut(V(e.Wt(this.ei))),e.Jt(this.ei,this.Rt.cross_subdomain_cookie))}return this.ii}Kt(){return!!this.Rt.respect_dnt&&[null==e?void 0:e.doNotTrack,null==e?void 0:e.msDoNotTrack,h.doNotTrack].some((t=>V(t)))}}var Ge=wi("[Dead Clicks]"),Je=()=>!0,Ke=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Mi)),r=t.instance.config.capture_dead_clicks;return z(r)?r:!!R(r)||e};class Ye{get lazyLoadedDeadClicksAutocapture(){return this.ri}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Mi]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ni((()=>{this.si()})):this.stop()}ni(t){var i,e;null!=(i=h.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Ge.error("failed to load script",i):t()}))}si(){var t;if(r){if(!this.ri&&null!=(t=h.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=R(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.ri=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.ri.start(r),Ge.info("starting...")}}else Ge.error("`document` not found. Cannot start.")}stop(){this.ri&&(this.ri.stop(),this.ri=void 0,Ge.info("stopping..."))}}var Xe=wi("[SegmentIntegration]");var Qe="posthog-js";function Ze(t,i){var{organization:e,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===i?{}:i;return i=>{var a,l,u,h,d;if("*"!==n&&!n.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,f=(null==(a=i.exception)?void 0:a.values)||[],g=f.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(l=f[0])?void 0:l.value)||i.message,$exception_type:null==(u=f[0])?void 0:u.type,$exception_level:i.level,$exception_list:g,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(h=f[0])?void 0:h.value)||i.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:i.tags};return e&&r&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+e+"/issues/?project="+r+"&query="+i.event_id),o&&(null==(c=t.exceptions)||c.sendExceptionEvent(_)),i}}class tr{constructor(t,i,e,r,s,n){this.name=Qe,this.setupOnce=function(o){o(Ze(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class ir{constructor(t){this.oi=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength)&&(yi.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.ai=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.li()}li(){var t;this.ui=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.oi)}destroy(){var t;null==(t=this.ui)||t.call(this),this.ui=void 0}doPageView(i,e){var r,s=this.hi(i,e);return this.ai={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.hi(t,null==(i=this.ai)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ai)?void 0:t.pageViewId}}hi(t,i){var e=this.ai;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:h}=s;if(!(F(n)||F(o)||F(a)||F(l)||F(u)||F(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?J(o/n,0,1,yi):1,v=n>1?J(a/n,0,1,yi):1,c=l>1?J(u/l,0,1,yi):1,f=l>1?J(h/l,0,1,yi):1;r=ye(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var er=t=>{var i=null==r?void 0:r.createElement("a");return F(i)?null:(i.href=t,i)},rr=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!I(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){yi.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},sr=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");I(d)&&(i.includes(d[0])?u.push(d[0]+"="+e):u.push(l[h]))}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},nr=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},or="https?://(.*)",ar=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],lr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ar],ur="<masked>",hr=["li_fat_id"];function dr(t,i,e){if(!r)return{};var s,n=i?[...ar,...e||[]]:[],o=vr(sr(r.URL,n,ur),t),a=(s={},be(hr,(function(t){var i=Le.Wt(t);s[t]=i||null})),s);return ye(a,o)}function vr(t,i){var e=lr.concat(i||[]),r={};return be(e,(function(i){var e=rr(t,i);r[i]=e||null})),r}function cr(t){var i=function(t){return t?0===t.search(or+"google.([^/?]*)")?"google":0===t.search(or+"bing.com")?"bing":0===t.search(or+"yahoo.com")?"yahoo":0===t.search(or+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",s={};if(!A(i)){s.$search_engine=i;var n=r?rr(r.referrer,e):"";n.length&&(s.ph_keyword=n)}return s}function fr(){return navigator.language||navigator.userLanguage}var pr="$direct";function gr(){return(null==r?void 0:r.referrer)||pr}function _r(t,i){var e=t?[...ar,...i||[]]:[],r=null==s?void 0:s.href.substring(0,1e3);return{r:gr().substring(0,1e3),u:r?sr(r,e,ur):void 0}}function mr(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:e==pr?pr:null==(i=er(e))?void 0:i.host};if(r){s.$current_url=r;var n=er(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=vr(r);ye(s,o)}if(e){var a=cr(e);ye(s,a)}return s}function br(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function yr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var wr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class xr{constructor(t,i){this.Rt=t,this.props={},this.ci=!1,this.di=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.ti=this.vi(t),this.load(),t.debug&&yi.info("Persistence loaded",t.persistence,p({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.fi}vi(i){-1===wr.indexOf(i.persistence.toLowerCase())&&(yi.critical("Unknown persistence type "+i.persistence+"; falling back to localStorage+cookie"),i.persistence="localStorage+cookie");var e=function(i){void 0===i&&(i=[]);var e=[...Ne,...i];return p({},Ue,{Gt(t){try{var i={};try{i=Le.Gt(t)||{}}catch(t){}var e=ye(i,JSON.parse(Ue.Wt(t)||"{}"));return Ue.Xt(t,e),e}catch(t){}return null},Xt(t,i,r,s,n,o){try{Ue.Xt(t,i,void 0,void 0,o);var a={};e.forEach((t=>{i[t]&&(a[t]=i[t])})),Object.keys(a).length&&Le.Xt(t,a,r,s,n,o)}catch(t){Ue.Ut(t)}},Jt(i,e){try{null==t||t.localStorage.removeItem(i),Le.Jt(i,e)}catch(t){Ue.Ut(t)}}})}(i.cookie_persisted_properties||[]),r=i.persistence.toLowerCase();return"localstorage"===r&&Ue.Yt()?Ue:"localstorage+cookie"===r&&e.Yt()?e:"sessionstorage"===r&&We.Yt()?We:"memory"===r?Be:"cookie"===r?Le:e.Yt()?e:Le}pi(t){var i=null!=t?t:this.Rt.feature_flag_cache_ttl_ms;if(!i||0>=i)return!1;var e=this.props[Ki];return!e||"number"!=typeof e||Date.now()-e>i}properties(){var t={};return be(this.props,((i,e)=>{if(e===Ui&&R(i)){if(!this.pi())for(var r=Object.keys(i),s=0;r.length>s;s++)t["$feature/"+r[s]]=i[r[s]]}else-1===ne.indexOf(e)&&(t[e]=i)})),t}load(){if(!this.fi){var t=this.ti.Gt(this.di);t&&(this.props=ye({},t))}}save(){this.fi||this.ti.Xt(this.di,this.props,this.gi,this.mi,this.yi,this.Rt.debug)}remove(){this.ti.Jt(this.di,!1),this.ti.Jt(this.di,!0)}clear(){this.remove(),this.props={}}register_once(t,i,e){if(R(t)){F(i)&&(i="None"),this.gi=F(e)?this.bi:e;var r=!1;if(be(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.props[e]=t,r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(R(t)){this.gi=F(i)?this.bi:i;var e=!1;if(be(t,((i,r)=>{t.hasOwnProperty(r)&&this.props[r]!==i&&(this.props[r]=i,e=!0)})),e)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.ci){var t=dr(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);C(Se(t))||this.register(t),this.ci=!0}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?cr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:gr(),$referring_domain:null!=r&&r.referrer&&(null==(t=er(r.referrer))?void 0:t.host)||pr},void 0)}set_initial_person_info(){this.props[Zi]||this.props[te]||this.register_once({[ie]:_r(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};be([te,Zi],(i=>{var e=this.props[i];e&&be(e,(function(i,e){t["$initial_"+E(e)]=i}))}));var i,e,r=this.props[ie];if(r){var s=(i=mr(r),e={},be(i,(function(t,i){e["$initial_"+E(i)]=t})),e);ye(t,s)}return t}safe_merge(t){return be(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this.bi=this.gi=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!e),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==i.persistence||!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every(((t,i)=>t===r[i]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[])){var r=this.vi(t),s=this.props;this.clear(),this.ti=r,this.props=s,this.save()}}set_disabled(t){this.fi=t,this.fi?this.remove():this.save()}set_cross_subdomain(t){t!==this.mi&&(this.mi=t,this.remove(),this.save())}set_secure(t){t!==this.yi&&(this.yi=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[Pi]||{};e[t]=i,this.props[Pi]=e,this.save()}remove_event_timer(t){var i=(this.props[Pi]||{})[t];return F(i)||(delete this.props[Pi][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}var Er="events",Sr="cancelEvents",$r="survey shown",kr="survey sent",Pr="popover",Ir=wi("[RateLimiter]");class Tr{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{Ir.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Ir.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(Qi))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;return l||t||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Qi,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var Rr=wi("[RemoteConfig]");class Cr{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}wi(t){var i,e;null!=(i=h.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Ii(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(i){t(i.json)}})}load(){try{if(this.remoteConfig)return Rr.info("Using preloaded remote config",this.remoteConfig),this.Ci(this.remoteConfig),void this.Si();if(this._instance.ki())return void Rr.warn("Remote config is disabled. Falling back to local config.");this.wi((t=>{if(!t)return Rr.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ii((t=>{this.Ci(t),this.Si()}));this.Ci(t),this.Si()}))}catch(t){Rr.error("Error loading remote config",t)}}stop(){this.xi&&(clearInterval(this.xi),this.xi=void 0)}refresh(){this._instance.ki()||"hidden"===(null==r?void 0:r.visibilityState)||this._instance.reloadFeatureFlags()}Si(){var t;if(!this.xi){var i=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==i&&(this.xi=setInterval((()=>{this.refresh()}),i))}}Ci(t){var i;t||Rr.error("Failed to fetch remote config from PostHog."),this._instance.Ci(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded())}}var Fr="gzip-js",Or="base64",Mr=Uint8Array,Ar=Uint16Array,Dr=Uint32Array,jr=new Mr([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]),Lr=new Mr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),zr=new Mr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ur=function(t,i){for(var e=new Ar(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new Dr(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},Nr=Ur(jr,2),Hr=Nr[1];Nr[0][28]=258,Hr[258]=28;for(var Br=Ur(Lr,0)[1],qr=new Ar(32768),Wr=0;32768>Wr;++Wr){var Vr=(43690&Wr)>>>1|(21845&Wr)<<1;qr[Wr]=((65280&(Vr=(61680&(Vr=(52428&Vr)>>>2|(13107&Vr)<<2))>>>4|(3855&Vr)<<4))>>>8|(255&Vr)<<8)>>>1}var Gr=function(t,i,e){for(var r=t.length,s=0,n=new Ar(i);r>s;++s)++n[t[s]-1];var o,a=new Ar(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Ar(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],h=i-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;v>=d;++d)o[qr[d]>>>l]=u}else for(o=new Ar(r),s=0;r>s;++s)o[s]=qr[a[t[s]-1]++]>>>15-t[s];return o},Jr=new Mr(288);for(Wr=0;144>Wr;++Wr)Jr[Wr]=8;for(Wr=144;256>Wr;++Wr)Jr[Wr]=9;for(Wr=256;280>Wr;++Wr)Jr[Wr]=7;for(Wr=280;288>Wr;++Wr)Jr[Wr]=8;var Kr=new Mr(32);for(Wr=0;32>Wr;++Wr)Kr[Wr]=5;var Yr=Gr(Jr,9,0),Xr=Gr(Kr,5,0),Qr=function(t){return(t/8>>0)+(7&t&&1)},Zr=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Ar?Ar:t instanceof Dr?Dr:Mr)(e-i);return r.set(t.subarray(i,e)),r},ts=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},is=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},es=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Mr(0),0];if(1==s){var o=new Mr(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],u=0,h=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=e[e[d].f>e[u].f?u++:d++],l=e[u!=h&&e[d].f>e[u].f?u++:d++],e[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new Ar(v+1),f=rs(e[h-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var b=n[r].s;i>c[b]?p-=1<<i-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new Mr(c),f]},rs=function(t,i,e){return-1==t.s?Math.max(rs(t.l,i,e+1),rs(t.r,i,e+1)):i[t.s]=e},ss=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Ar(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},ns=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},os=function(t,i,e){var r=e.length,s=Qr(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=e[n];return 8*(s+4+r)},as=function(t,i,e,r,s,n,o,a,l,u,h){ts(i,h++,e),++s[256];for(var d=es(s,15),v=d[0],c=d[1],f=es(n,15),p=f[0],g=f[1],_=ss(v),m=_[0],b=_[1],y=ss(p),w=y[0],x=y[1],E=new Ar(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var k=es(E,7),P=k[0],I=k[1],T=19;T>4&&!P[zr[T-1]];--T);var R,C,F,O,M=u+5<<3,A=ns(s,Jr)+ns(n,Kr)+o,D=ns(s,v)+ns(n,p)+o+14+3*T+ns(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(A>=M&&D>=M)return os(i,h,t.subarray(l,l+u));if(ts(i,h,1+(A>D)),h+=2,A>D){R=Gr(v,c,0),C=v,F=Gr(p,g,0),O=p;var j=Gr(P,I,0);for(ts(i,h,b-257),ts(i,h+5,x-1),ts(i,h+10,T-4),h+=14,S=0;T>S;++S)ts(i,h+3*S,P[zr[S]]);h+=3*T;for(var L=[m,w],z=0;2>z;++z){var U=L[z];for(S=0;U.length>S;++S)ts(i,h,j[N=31&U[S]]),h+=P[N],N>15&&(ts(i,h,U[S]>>>5&127),h+=U[S]>>>12)}}else R=Yr,C=Jr,F=Xr,O=Kr;for(S=0;a>S;++S)if(r[S]>255){var N;is(i,h,R[257+(N=r[S]>>>18&31)]),h+=C[N+257],N>7&&(ts(i,h,r[S]>>>23&31),h+=jr[N]);var H=31&r[S];is(i,h,F[H]),h+=O[H],H>3&&(is(i,h,r[S]>>>5&8191),h+=Lr[H])}else is(i,h,R[r[S]]),h+=C[r[S]];return is(i,h,R[256]),h+C[256]},ls=new Dr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),us=function(){for(var t=new Dr(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),hs=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function ds(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=us[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,u=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new Mr(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!i||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=os(l,u,t.subarray(h,d)):(l[h]=!0,u=os(l,u,t.subarray(h,o)))}else{for(var v=ls[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new Ar(32768),_=new Ar(p+1),m=Math.ceil(e/3),b=2*m,y=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<b)&p},w=new Dr(25e3),x=new Ar(288),E=new Ar(32),S=0,k=0,P=(h=0,0),I=0,T=0;o>h;++h){var R=y(h),C=32767&h,F=_[R];if(g[C]=F,_[R]=C,h>=I){var O=o-h;if((S>7e3||P>24576)&&O>423){u=as(t,l,0,w,x,E,k,P,T,h-T,u),P=S=k=0,T=h;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)E[M]=0}var A=2,D=0,j=f,L=C-F&32767;if(O>2&&R==y(h-L))for(var z=Math.min(c,O)-1,U=Math.min(32767,h),N=Math.min(258,O);U>=L&&--j&&C!=F;){if(t[h+A]==t[h+A-L]){for(var H=0;N>H&&t[h+H]==t[h+H-L];++H);if(H>A){if(A=H,D=L,H>z)break;var B=Math.min(L,H-2),q=0;for(M=0;B>M;++M){var W=h-L+M+32768&32767,V=W-g[W]+32768&32767;V>q&&(q=V,F=W)}}}L+=(C=F)-(F=g[C])+32768&32767}if(D){w[P++]=268435456|Hr[A]<<18|Br[D];var G=31&Hr[A],J=31&Br[D];k+=jr[G]+Lr[J],++x[257+G],++E[J],I=h+A,++S}else w[P++]=t[h],++x[t[h]]}}u=as(t,l,!0,w,x,E,k,P,T,h-T,u)}return Zr(a,0,r+Qr(u)+s)}(n=t,null==(o=i).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)),h=u.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&hs(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(u,i),hs(u,h-8,e.d()),hs(u,h-4,r),u}var vs=!!o||!!n,cs="text/plain",fs=function(t,i,e){var r;void 0===e&&(e=!0);var[s,n]=t.split("?"),o=p({},i),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var i,[r,s]=t.split("="),n=e&&null!==(i=o[r])&&void 0!==i?i:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],l=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return be(t,(function(t,i){F(t)||F(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)}(o);return l&&a.push(l),s+"?"+a.join("&")},ps=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),gs=t=>{if(t.zt)return t.zt;var{data:i,compression:e}=t;if(i){if(e===Fr){var r=ds(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Mr(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;e>o;++o){if(s+5>r.length){var a=new Mr(s+8+(e-o<<1));a.set(r),r=a}var l=t.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&t.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 Zr(r,0,s)}(ps(i)),{mtime:0});return{contentType:cs,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Or){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,i)=>String.fromCharCode(parseInt(i,16))))):t}(ps(i)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:ps(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=ps(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},_s=function(){var t=f((function*(t){var i=ps(t.data),e=yield function(t,i){return _.apply(this,arguments)}(i,v.DEBUG);if(!e)return t;var r=yield e.arrayBuffer();return p({},t,{zt:{contentType:cs,body:r,estimatedSize:r.byteLength}})}));return function(i){return t.apply(this,arguments)}}(),ms=[];n&&ms.push({transport:"fetch",method(t){var i,e,{contentType:r,body:s,estimatedSize:o}=null!==(i=gs(t))&&void 0!==i?i:{},l=new Headers;be(t.headers,(function(t,i){l.append(i,t)})),r&&l.append("Content-Type",r);var u=t.url,h=null;if(a){var d=new a;h={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}n(u,p({method:(null==t?void 0:t.method)||"GET",headers:l,keepalive:"POST"===t.method&&52428.8>(o||0),body:s,signal:null==(e=h)?void 0:e.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){yi.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{yi.error(i),null==t.callback||t.callback({statusCode:0,error:i})})).finally((()=>h?clearTimeout(h.timeout):null))}}),o&&ms.push({transport:"XHR",method(t){var i,e=new o;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=gs(t))&&void 0!==i?i:{};be(t.headers,(function(t,i){e.setRequestHeader(i,t)})),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),t.disableXHRCredentials||(e.withCredentials=!0),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(s)}}),null!=e&&e.sendBeacon&&ms.push({transport:"sendBeacon",method(t){var i=fs(t.url,{beacon:"1"});try{var r,{contentType:s,body:n}=null!==(r=gs(t))&&void 0!==r?r:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:s});e.sendBeacon(i,o)}catch(t){}}});var bs=3e3;class ys{constructor(t,i){this.Ti=!0,this.Ai=[],this.Ei=J((null==i?void 0:i.flush_interval_ms)||bs,250,5e3,yi.createLogger("flush interval"),bs),this.Ri=t}enqueue(t){this.Ai.push(t),this.Ni||this.Mi()}unload(){this.Fi();var t=this.Ai.length>0?this.Oi():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ri(p({},t,{transport:"sendBeacon"}))}))}enable(){this.Ti=!1,this.Mi()}Mi(){var t=this;this.Ti||(this.Ni=setTimeout((()=>{if(this.Fi(),this.Ai.length>0){var i=this.Oi(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&I(e.data)&&be(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ri(e)};for(var r in i)e()}}),this.Ei))}Fi(){clearTimeout(this.Ni),this.Ni=void 0}Oi(){var t={};return be(this.Ai,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;F(t[s])&&(t[s]=p({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.Ai=[],t}}var ws=["retriesPerformedSoFar"];class xs{constructor(i){this.Pi=!1,this.Li=3e3,this.Ai=[],this._instance=i,this.Ai=[],this.Di=!0,!F(t)&&"onLine"in t.navigator&&(this.Di=t.navigator.onLine,this.Bi=()=>{this.Di=!0,this.ji()},this.qi=()=>{this.Di=!1},Pe(t,"online",this.Bi),Pe(t,"offline",this.qi))}get length(){return this.Ai.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,e=g(t,ws);L(i)&&(e.url=fs(e.url,{retry_count:i})),this._instance._send_request(p({},e,{callback:t=>{200===t.statusCode||t.statusCode>=400&&500>t.statusCode||(null!=i?i:0)>=10?null==e.callback||e.callback(t):this.Zi(p({retriesPerformedSoFar:i},e))}}))}Zi(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=Math.random()-.5;return Math.ceil(r+s*(r-e))}(i),r=Date.now()+e;this.Ai.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),yi.warn(s),this.Pi||(this.Pi=!0,this.$i())}$i(){if(this.Hi&&clearTimeout(this.Hi),0===this.Ai.length)return this.Pi=!1,void(this.Hi=void 0);this.Hi=setTimeout((()=>{this.Di&&this.Ai.length>0&&this.ji(),this.$i()}),this.Li)}ji(){var t=Date.now(),i=[],e=this.Ai.filter((e=>t>e.retryAt||(i.push(e),!1)));if(this.Ai=i,e.length>0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:i}of(this.Hi&&(clearTimeout(this.Hi),this.Hi=void 0),this.Pi=!1,F(t)||(this.Bi&&(t.removeEventListener("online",this.Bi),this.Bi=void 0),this.qi&&(t.removeEventListener("offline",this.qi),this.qi=void 0)),this.Ai))try{this._instance._send_request(p({},i,{transport:"sendBeacon"}))}catch(t){yi.error(t)}this.Ai=[]}}class Es{constructor(t){this.Vi=()=>{var t,i,e,r;this.zi||(this.zi={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.zi.lastScrollY=Math.ceil(n),this.zi.maxScrollY=Math.max(n,null!==(t=this.zi.maxScrollY)&&void 0!==t?t:0),this.zi.maxScrollHeight=Math.max(o,null!==(i=this.zi.maxScrollHeight)&&void 0!==i?i:0),this.zi.lastContentY=a,this.zi.maxContentY=Math.max(a,null!==(e=this.zi.maxContentY)&&void 0!==e?e:0),this.zi.maxContentHeight=Math.max(l,null!==(r=this.zi.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Yi(){return this._instance.config.scroll_root_selector}getContext(){return this.zi}resetContext(){var t=this.zi;return setTimeout(this.Vi,0),t}startMeasuringScrollPosition(){Pe(t,"scroll",this.Vi,{capture:!0}),Pe(t,"scrollend",this.Vi,{capture:!0}),Pe(t,"resize",this.Vi)}scrollElement(){if(!this.Yi)return null==t?void 0:t.document.documentElement;var i=I(this.Yi)?this.Yi:[this.Yi];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}scrollY(){if(this.Yi){var i=this.scrollElement();return i&&i.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this.Yi){var i=this.scrollElement();return i&&i.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var Ss=t=>_r(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class $s{constructor(t,i,e,r){this.Ui=t=>{var i=this.Wi();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Gi(this._instance)};this.Xi.register({[Xi]:e})}},this._instance=t,this.Ji=i,this.Xi=e,this.Gi=r||Ss,this.Ji.onSessionId(this.Ui)}Wi(){return this.Xi.props[Xi]}getSetOnceProps(){var t,i=null==(t=this.Wi())?void 0:t.props;return i?"r"in i?mr(i):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return be(Se(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+E(e)]=i})),t}}class ks{constructor(){this.Ki={}}on(t,i){return this.Ki[t]||(this.Ki[t]=[]),this.Ki[t].push(i),()=>{this.Ki[t]=this.Ki[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Ki[t]||[])e(i);for(var r of this.Ki["*"]||[])r(t,i)}}var Ps=wi("[SessionId]");class Is{on(t,i){return this.Qi.on(t,i)}constructor(t,i,e){var r;if(this.tr=[],this.er=void 0,this.Qi=new ks,this.ir=(t,i)=>!(!L(t)||!L(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===le)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=t.config,this.Xi=t.persistence,this.rr=void 0,this.nr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.sr=i||Me,this.ar=e||Me;var s=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*J(this.Rt.session_idle_timeout_seconds||1800,60,36e3,Ps.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+s+"_window_id",this.hr="ph_"+s+"_primary_window_exists",this.cr()){var n=We.Gt(this.ur),o=We.Gt(this.hr);n&&!o?this.rr=n:We.Jt(this.ur),We.Xt(this.hr,!0)}if(null!=(r=this.Rt.bootstrap)&&r.sessionID)try{var a=(t=>{var i=this.Rt.bootstrap.sessionID.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})();this.dr(this.Rt.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){Ps.error("Invalid sessionID in bootstrap",t)}this.vr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return F(this.tr)&&(this.tr=[]),this.tr.push(t),this.nr&&t(this.nr,this.rr),()=>{this.tr=this.tr.filter((i=>i!==t))}}cr(){return"memory"!==this.Rt.persistence&&!this.Xi.fi&&We.Yt()}pr(t){t!==this.rr&&(this.rr=t,this.cr()&&We.Xt(this.ur,t))}gr(){return this.rr?this.rr:this.cr()?We.Gt(this.ur):null}dr(t,i,e){t===this.nr&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.nr=t,this.Xi.register({[Li]:[i,t,e]}))}mr(){var t=this.Xi.props[Li];return I(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.dr(null,null,null)}destroy(){clearTimeout(this.yr),this.yr=void 0,this.er&&t&&(t.removeEventListener(ce,this.er,{capture:!1}),this.er=void 0),this.tr=[]}vr(){this.er=()=>{this.cr()&&We.Jt(this.hr)},Pe(t,ce,this.er,{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),this.Rt.cookieless_mode===le)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.mr(),o=this.gr(),a=L(n)&&Math.abs(e-n)>864e5,l=!1,u=!s,h=!u&&!t&&this.ir(e,r);u||h||a?(s=this.sr(),o=this.ar(),Ps.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.ar(),l=!0);var d=L(r)&&t&&!a?r:e,v=L(n)?n:(new Date).getTime();return this.pr(o),this.dr(s,d,v),t||this.lr(),l&&this.tr.forEach((t=>t(s,o,l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}lr(){clearTimeout(this.yr),this.yr=setTimeout((()=>{var[t]=this.mr();if(this.ir((new Date).getTime(),t)){var i=this.nr;this.resetSessionId(),this.Qi.emit("forcedIdleReset",{idleSessionId:i})}}),1.1*this.sessionTimeoutMs)}}var Ts=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&y(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>y(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver},Rs=function(t,i){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}};function Cs(t,i,e){return ps({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var Fs={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>Rs(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Rs(i,t))))),icontains:(t,i)=>i.map(Os).some((i=>t.map(Os).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(Os).every((i=>t.map(Os).every((t=>!i.includes(t))))),gt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e>parseFloat(t)))})),lt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e<parseFloat(t)))}))},Os=t=>t.toLowerCase();function Ms(t,i){return!t||Object.entries(t).every((t=>{var[e,r]=t,s=null==i?void 0:i[e];if(F(s)||A(s))return!1;var n=[String(s)],o=Fs[r.operator];return!!o&&o(r.values,n)}))}var As="custom",Ds="i.posthog.com";class js{constructor(t){this.br={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+Ds,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.br[this.apiHost]||(this.br[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":As),this.br[this.apiHost]}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.uiHost+i;if("flags"===t)return this.flagsApiHost+i;if(this.region===As)return this.apiHost+i;var e=Ds+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var Ls=wi("[Surveys]"),zs="seenSurvey_",Us=(t,i)=>{var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e},Ns=t=>((t,i)=>{var e=""+t+i.id;return i.current_iteration&&i.current_iteration>0&&(e=""+t+i.id+"_"+i.current_iteration),e})(zs,t),Hs=["popover","widget","api"],Bs={ignoreConditions:!1,ignoreDelay:!1,displayType:Pr},qs=wi("[PostHog ExternalIntegrations]"),Ws={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Vs{constructor(t){this._instance=t}ni(t,i){var e;null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return qs.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;!r||null!=(e=h.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.ni(Ws[i],(()=>{var e;null==(e=h.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=h.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i]&&(null==(n=h.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[i])||n.stop())};for(var[e,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;i(e)}}}var Gs={},Js=0,Ks=()=>{},Ys='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Xs="Surveys module not available",Qs="sanitize_properties is deprecated. Use before_send instead",Zs="Invalid value for property_denylist config: ",tn="posthog",en=!vs&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),rn=i=>{var e;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ke(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ks,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",__preview_deferred_init_extensions:!1,debug:s&&O(null==s?void 0:s.search)&&-1!==s.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==t||null==(e=t.location)?void 0:e.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(t){yi.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:de,before_send:void 0,request_queue_config:{flush_interval_ms:bs},error_tracking:{},_onCapture:Ks,__preview_eager_load_replay:!1},(t=>({rageclick:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(i))},sn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],nn=t=>{var i={};for(var[e,r]of sn)F(t[e])||(i[r]=t[e]);var s=ye({},i,t);return I(t.property_blacklist)&&(F(t.property_denylist)?s.property_denylist=t.property_blacklist:I(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:yi.error(Zs+t.property_denylist)),s};class on{constructor(){this.__forceAllowLocalhost=!1}get wr(){return this.__forceAllowLocalhost}set wr(t){yi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class an{_r(t,i){if(t){var e=this.Ir.indexOf(t);-1!==e&&this.Ir.splice(e,1)}return this.Ir.push(i),null==i.initialize||i.initialize(),i}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new on,this.Cr=!1,this.version=v.LIB_VERSION,this.Sr=new ks,this.Ir=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=rn(),this.SentryIntegration=tr,this.sentryIntegration=t=>function(t,i){var e=Ze(t,i);return{name:Qe,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.kr=!1,this.Tr=null,this.Ar=null,this.Er=null,this.scrollManager=new Es(this),this.pageViewManager=new ir(this),this.rateLimiter=new Tr(this),this.requestRouter=new js(this),this.consent=new Ve(this),this.externalIntegrations=new Vs(this);var i=null!==(t=an.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,i,e)=>{var r=O(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=O(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>yi.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==tn){var r,s=null!==(r=Gs[e])&&void 0!==r?r:new an;return s._init(t,i,e),Gs[e]=s,Gs[tn][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s,n;if(void 0===e&&(e={}),F(i)||M(i))return yi.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={},e.debug=this.Rr(e.debug),this.Nr=e,this.Mr=[],e.person_profiles?this.Ar=e.person_profiles:e.process_person&&(this.Ar=e.process_person),this.set_config(ye({},rn(e.defaults),nn(e),{name:r,token:i})),this.config.on_xhr_error&&yi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:Fr;var o=this.Fr();this.persistence=new xr(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xr(p({},this.config,{persistence:"sessionStorage"}),o);var a=p({},this.persistence.props),l=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Or=new ys((t=>this.Pr(t)),this.config.request_queue_config),this.Lr=new xs(this),this.__request_queue=[];var u=this.config.cookieless_mode===le||this.config.cookieless_mode===ae&&this.consent.isExplicitlyOptedOut();if(u||(this.sessionManager=new Is(this),this.sessionPropsManager=new $s(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(yi.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Dr(u)}),0)):(yi.info("Initializing extensions synchronously"),this.Dr(u)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&yi.info("Starting in debug mode",{this:this,config:e,thisC:p({},this.config),p:a,s:l}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=p({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=e.bootstrap)?void 0:n.distinctID)){var h=e.bootstrap.distinctID,d=this.get_distinct_id(),c=this.persistence.get_property(Yi);if(e.bootstrap.isIdentifiedID&&null!=d&&d!==h&&c===ue)this.identify(h);else if(e.bootstrap.isIdentifiedID&&null!=d&&d!==h&&c===he)yi.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 f=this.config.get_device_id(Me()),g=e.bootstrap.isIdentifiedID?f:h;this.persistence.set_property(Yi,e.bootstrap.isIdentifiedID?he:ue),this.register({distinct_id:h,$device_id:g})}}if(u)this.register_once({distinct_id:se,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(Me());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(Yi,ue)}return Pe(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),e.segment?function(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||Me();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(Yi,he)),i()},s=e.user();"then"in s&&T(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||Xe.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Xe.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Xe.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,fe),identify:t=>i(t,ge),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}(this,(()=>this.Br())):this.Br(),T(this.config._onCapture)&&this.config._onCapture!==Ks&&(yi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&yi.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Dr(t){var i,e,r,s,n,o,a,l=performance.now(),u=p({},an.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.Ir.push(this.featureFlags=null!==(i=this.featureFlags)&&void 0!==i?i:new u.featureFlags(this)),u.exceptions&&this.Ir.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new u.exceptions(this)),u.historyAutocapture&&this.Ir.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Ir.push(new u.tracingHeaders(this)),u.siteApps&&this.Ir.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.Ir.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Ir.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.Ir.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this)),u.logs&&this.Ir.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this)),u.conversations&&this.Ir.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new u.conversations(this)),u.productTours&&this.Ir.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Ir.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Ir.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Ir.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Ir.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Ke)),u.toolbar&&this.Ir.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new u.toolbar(this)),u.experiments&&this.Ir.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new u.experiments(this)),this.Ir.forEach((t=>{t.initialize&&h.push((()=>{null==t.initialize||t.initialize()}))})),h.push((()=>{if(this.jr){var t=this.jr;this.jr=void 0,this.Ci(t)}})),this.qr(h,l)}qr(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.qr(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){yi.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&yi.info("PostHog extensions initialized ("+r+"ms)")}Ci(t){var i;if(!r||!r.body)return yi.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Ci(t)}),500);this.config.__preview_deferred_init_extensions&&(this.jr=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=w(t.supportedCompression,Fr)?Fr:w(t.supportedCompression,Or)?Or:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Ar?this.Ar:de}),this.Ir.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}Br(){try{this.config.loaded(this)}catch(t){yi.critical("`loaded` function failed",t)}if(this.Zr(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===le)&&this.$r()}),1),this.Hr=new Cr(this),this.Hr.load()}Zr(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Or)||t.enable())}_dom_loaded(){this.is_capturing()&&me(this.__request_queue,(t=>this.Pr(t))),this.__request_queue=[],this.Zr()}_handle_unload(){var t,i,e;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.Vr()&&this.capture(pe),null==(i=this.Or)||i.unload(),null==(e=this.Lr)||e.unload()):this.Vr()&&this.capture(pe,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(en?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=fs(t.url,{ip:this.config.ip?1:0}),t.headers=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,s=p({},t);s.timeout=s.timeout||6e4,s.url=fs(s.url,{_:(new Date).getTime().toString(),ver:v.JS_SDK_VERSION,compression:s.compression});var n=null!==(i=s.transport)&&void 0!==i?i:"fetch",o=ms.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(e=null==(r=function(t,i){for(var e=0;t.length>e;e++)if(t[e].transport===n)return t[e]}(o))?void 0:r.method)&&void 0!==e?e:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&s.data&&s.compression===Fr&&l?_s(s).then((t=>{a(t)})).catch((()=>{a(s)})):a(s)})(p({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))))}Pr(t){this.Lr?this.Lr.retriableRequest(t):this._send_request(t)}_execute_array(t){Js++;try{var i,e=[],r=[],s=[];me(t,(t=>{t&&(I(i=t[0])?s.push(t):T(t)?t.call(this):I(t)&&"alias"===i?e.push(t):I(t)&&-1!==i.indexOf("capture")&&T(this[i])?s.push(t):r.push(t))}));var n=function(t,i){me(t,(function(t){if(I(t[0])){var e=i;be(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else i[t[0]].apply(i,t.slice(1))}))};n(e,this),n(r,this),n(s,this)}finally{Js--}}push(t){if(Js>0&&I(t)&&O(t[0])){var i=an.prototype[t[0]];T(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,e){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Or){if(this.is_capturing())if(!F(t)&&O(t)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=i&&i.$current_url&&!O(null==i?void 0:i.$current_url)&&(yi.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=e&&e.zr||yi.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,d=(null==e?void 0:e.timestamp)||h,v=Me(),c={uuid:v,event:t,properties:this.calculateEventProperties(t,i||{},d,v)};t===fe&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),u&&(c.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==e?void 0:e.$set)&&(c.$set=null==e?void 0:e.$set);var f,g=this.Yr(null==e?void 0:e.$set_once,t!==_e,t===ge);if(g&&(c.$set_once=g),null!=e&&e._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>O(t)?t.slice(0,s):t,a=new Set,c=function t(i,e){return i!==Object(i)?o?o(i):i:a.has(i)?void 0:(a.add(i),I(i)?(r=[],me(i,(i=>{r.push(t(i))}))):(r={},be(i,((i,e)=>{a.has(i)||(r[e]=t(i,e))}))),r);var r}(n)),c.timestamp=d,F(null==e?void 0:e.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=h),"survey dismissed"===t||t===kr){var _=null==i?void 0:i.$survey_id,m=null==i?void 0:i.$survey_iteration;f={id:_,current_iteration:m},localStorage.getItem(Ns(f))||localStorage.setItem(Ns(f),"true"),c.$set=p({},c.$set,{[Us({id:_,current_iteration:m},t===kr?"responded":"dismissed")]:!0})}else t===$r&&(c.$set=p({},c.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var b=null==i?void 0:i.$product_tour_type;b&&(c.$set=p({},c.$set,{["$product_tour_last_seen_date/"+b]:(new Date).toISOString()}))}var y=p({},c.properties.$set,c.$set);if(C(y)||this.setPersonPropertiesForFlags(y),!D(this.config.before_send)){var w=this.Ur(c);if(!w)return;c=w}this.Sr.emit("eventCaptured",c);var x={method:"POST",url:null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:null==e?void 0:e._batchKey};return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly?this.Pr(x):this.Or.enqueue(x),c}yi.critical("This capture call is ignored due to client rate limiting.")}}else yi.error("No event name provided to posthog.capture")}else yi.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(i,e,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return e;var l=a?void 0:this.persistence.remove_event_timer(i),h=p({},e);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,(this.config.cookieless_mode==le||this.config.cookieless_mode==ae&&this.consent.isExplicitlyOptedOut())&&(h.$cookieless_mode=!0),"$snapshot"===i){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!O(h.distinct_id)&&!j(h.distinct_id)||M(h.distinct_id))&&yi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var c,f=function(i,e){var r,n,o,a;if(!u)return{};var l,h,d,c,f,p,g,_,m=i?[...ar,...e||[]]:[],[b,y]=function(t){for(var i=0;Vt.length>i;i++){var[e,r]=Vt[i],s=e.exec(t),n=s&&(T(r)?r(s,t):r);if(n)return n}return["",""]}(u);return ye(Se({$os:b,$os_version:y,$browser:Bt(u,navigator.vendor),$device:Gt(u),$device_type:(h=u,d={userAgentDataPlatform:null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,maxTouchPoints:null==(n=navigator)?void 0:n.maxTouchPoints,screenWidth:null==t||null==(o=t.screen)?void 0:o.width,screenHeight:null==t||null==(a=t.screen)?void 0:a.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio},_=Gt(h),_===st||_===rt||"Kobo"===_||"Kindle Fire"===_||_===Mt?et:_===Et||_===$t||_===St||_===Ct?"Console":_===ot?"Wearable":_?Z:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!==(c=null==d?void 0:d.maxTouchPoints)&&void 0!==c?c:0)>0?600>Math.min(null!==(f=null==d?void 0:d.screenWidth)&&void 0!==f?f:0,null!==(p=null==d?void 0:d.screenHeight)&&void 0!==p?p:0)/(null!==(g=null==d?void 0:d.devicePixelRatio)&&void 0!==g?g:1)?Z:et:"Desktop"),$timezone:br(),$timezone_offset:yr()}),{$current_url:sr(null==s?void 0:s.href,m,ur),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Wt(u,navigator.vendor),$browser_language:fr(),$browser_language_prefix:(l=fr(),"string"==typeof l?l.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:g,windowId:_}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());h.$session_id=g,h.$window_id=_}this.sessionPropsManager&&ye(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&ye(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.Lr)?void 0:m.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===As&&(h.$lib_custom_api_host=this.config.api_host),c=i!==fe||a?i!==pe||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=ye(h,c),i===fe&&r&&(h.title=r.title),!F(l)){var b=n.getTime()-l;h.$duration=parseFloat((b/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser"),(h=ye({},f,this.persistence.properties(),this.sessionPersistence.properties(),h)).$is_identified=this._isIdentified(),I(this.config.property_denylist)?be(this.config.property_denylist,(function(t){delete h[t]})):yi.error(Zs+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var y=this.config.sanitize_properties;y&&(yi.error(Qs),h=y(h,i));var w=this.Wr();return h.$process_person_profile=w,w&&!a&&this.Gr("_calculate_event_properties"),h}Yr(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.Wr())return t;if(this.Cr&&!e)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=ye({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(yi.error(Qs),o=a(o,"$set_once")),i&&(this.Cr=!0),C(o)?void 0:o}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i;null==(i=this.sessionPersistence)||i.register(t)}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t)}Xr(t,i){this.register({[t]:i})}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}isFeatureEnabled(t,i){var e;return null==(e=this.featureFlags)?void 0:e.isFeatureEnabled(t,i)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Sr.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Xs}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Xs})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Xs})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=Bs),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:Xs}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:Xs})}Jr(t){return!t||M(t)?(yi.critical("Unique user id has not been set in posthog.identify"),!1):t===se?(yi.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(yi.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,i,e){if(!this.__loaded||!this.persistence)return yi.uninitializedWarning("posthog.identify");if(j(t)&&(t=t.toString(),yi.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Jr(t)&&this.Gr("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property($i)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(ki)&&(this.unregister(ki),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(Yi)||ue)===ue;t!==r&&n?(this.persistence.set_property(Yi,he),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.capture(ge,{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.Er=Cs(t,i,e),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(i||e)&&this.setPersonProperties(i,e),t!==r&&(this.reloadFeatureFlags(),this.unregister(Vi))}}setPersonProperties(t,i){if((t||i)&&this.Gr("posthog.setPersonProperties")){var e=Cs(this.get_distinct_id(),t,i);this.Er!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Er=e):yi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,e){if(t&&i){var r=this.getGroups(),s=r[t]!==i;if(s&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},r,{[t]:i})}),s||e){var n={$group_type:t,$group_key:i};e&&(n.$group_set=e),this.capture(_e,n)}e&&this.setGroupPropertiesForFlags({[t]:e}),s&&!e&&this.reloadFeatureFlags()}else yi.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.Gr("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s,n,o,a,l;if(yi.info("reset"),!this.__loaded)return yi.uninitializedWarning("posthog.reset");var u=this.get_property($i);if(this.consent.reset(),null==(i=this.persistence)||i.clear(),null==(e=this.sessionPersistence)||e.clear(),null==(r=this.surveys)||r.reset(),null==(s=this.Hr)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(Yi,ue),null==(l=this.sessionManager)||l.resetSessionId(),this.Er=null,this.config.cookieless_mode===le)this.register_once({distinct_id:se,$device_id:null},"");else{var h=this.config.get_device_id(Me());this.register_once({distinct_id:h,$device_id:t?h:u},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,i){var e;this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null==(e=this.conversations)||e.Kr()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.Qr()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(Si)?(yi.critical("Attempting to create alias for existing People user - aborting."),-2):this.Gr("posthog.alias")?(F(i)&&(i=this.get_distinct_id()),t!==i?(this.Xr(ki,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(yi.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=p({},this.config);if(R(t)){var e,r,s,n,o,a,l,u,h;ye(this.config,nn(t));var d=this.Fr();null==(e=this.persistence)||e.update_config(this.config,i,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xr(p({},this.config,{persistence:"sessionStorage"}),d);var c=this.Rr(this.config.debug);z(c)&&(this.config.debug=c),z(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,Ue.Yt()&&Ue.Xt("ph_debug",!0),yi.info("set_config",{config:t,oldConfig:i,newConfig:p({},this.config)})):(v.DEBUG=!1,Ue.Yt()&&Ue.Jt("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.sessionRecording)||s.startIfEnabledOrStop(),null==(n=this.autocapture)||n.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),null==(a=this.exceptionObserver)||a.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(u=this.surveys)||u.loadIfEnabled(),this.tn(),null==(h=this.externalIntegrations)||h.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){v.LIB_NAME=t,v.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.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 t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){if(this.exceptions){var e=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(p({},r,i))}}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:tn;return i!==tn&&(i=tn+"."+i),i}_isIdentified(){var t,i;return(null==(t=this.persistence)?void 0:t.get_property(Yi))===he||(null==(i=this.sessionPersistence)?void 0:i.get_property(Yi))===he}Wr(){var t,i;return!("never"===this.config.person_profiles||this.config.person_profiles===de&&!this._isIdentified()&&C(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[ki])&&(null==(i=this.persistence)||null==(i=i.props)||!i[ee]))}Vr(){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.Wr()||this.Gr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Gr("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Gr(t){return"never"===this.config.person_profiles?(yi.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Xr(ee,!0),!0)}Fr(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ae)}tn(){var t,i,e,r,s=this.Fr();return(null==(t=this.persistence)?void 0:t.fi)!==s&&(null==(e=this.persistence)||e.set_disabled(s)),(null==(i=this.sessionPersistence)?void 0:i.fi)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==le){if(this.config.cookieless_mode===ae&&this.consent.isExplicitlyOptedOut()){var e,r,s,n,o;this.reset(!0),null==(e=this.sessionManager)||e.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Is(this),this.pageViewManager=new ir(this),this.persistence&&(this.sessionPropsManager=new $s(this,this.sessionManager,this.persistence));var a=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=an.__defaultExtensionClasses)?void 0:o.sessionRecording;a&&(this.sessionRecording=this._r(this.sessionRecording,new a(this)))}var l,u;this.consent.optInOut(!0),this.tn(),this.Zr(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==ae&&(null==(l=this.surveys)||l.loadIfEnabled()),(F(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$r()}else yi.warn(Ys)}opt_out_capturing(){var t,i,e;this.config.cookieless_mode!==le?(this.config.cookieless_mode===ae&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===ae&&(this.register({distinct_id:se,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,this.$r())):yi.warn(Ys)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===le||(this.config.cookieless_mode===ae?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return e?Ts(e,this.config.custom_blocked_useragents):void 0}$r(){r&&("visible"===r.visibilityState?this.kr||(this.kr=!0,this.capture(fe,{title:r.title},{send_instantly:!0}),this.Tr&&(r.removeEventListener(ve,this.Tr),this.Tr=null)):this.Tr||(this.Tr=this.$r.bind(this),Pe(r,ve,this.Tr)))}debug(i){!1===i?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}ki(){var t,i,e,r,s,n,o=this.Nr||{};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?(yi.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):(e="advanced_disable_decide",!1,r=yi,s=(i="advanced_disable_flags")in(t=o)&&!D(t[i]),n=e in t&&!D(t[e]),s?t[i]:!!n&&(r&&r.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e]))}Ur(t){if(D(this.config.before_send))return t;var i=I(this.config.before_send)?this.config.before_send:[this.config.before_send],e=t;for(var r of i){if(e=r(e),D(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return N(t.event)?yi.warn(s+". This can cause unexpected behavior."):yi.info(s),null}e.properties&&!C(e.properties)||yi.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return e}getPageViewId(){var t;return null==(t=this.pageViewManager.ai)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Rr(t){var i=z(t)&&!t,e=Ue.Yt()&&"true"===Ue.Wt("ph_debug");return!i&&(!!e||t)}}function ln(t){return t instanceof Element&&(t.id===re||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function un(t){return!!t&&1===t.nodeType}function hn(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function dn(t){return!!t&&3===t.nodeType}function vn(t){return!!t&&11===t.nodeType}function cn(t){return t?x(t).split(/\s+/):[]}function fn(i){var e=null==t?void 0:t.location.href;return!!(e&&i&&i.some((t=>e.match(t))))}function pn(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return cn(i)}function gn(t){return D(t)?null:x(t).split(/(\s+)/).filter((t=>Mn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function _n(t){var i="";return kn(t)&&!Pn(t)&&t.childNodes&&t.childNodes.length&&be(t.childNodes,(function(t){var e;dn(t)&&t.textContent&&(i+=null!==(e=gn(t.textContent))&&void 0!==e?e:"")})),x(i)}function mn(t){return F(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null;var i}an.__defaultExtensionClasses={},function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=Ee(t.prototype[i[e]])}(an,["identify"]);var bn=["a","button","form","input","select","textarea","label"];function yn(t,i){if(F(i))return!0;var e,r=function(t){if(i.some((i=>t.matches(i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function wn(t){var i=t.parentNode;return!(!i||!un(i))&&i}var xn=["next","previous","prev",">","<"],En=[".ph-no-rageclick",".ph-no-capture"];var Sn=t=>!t||hn(t,"html")||!un(t),$n=(i,e)=>{if(!t||Sn(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!hn(n,"body");)if(vn(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=wn(n);if(!o)break;if(e||bn.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function kn(t){for(var i=t;i.parentNode&&!hn(i,"body");i=i.parentNode){var e=pn(i);if(w(e,"ph-sensitive")||w(e,"ph-no-capture"))return!1}if(w(pn(t),"ph-include"))return!0;var r=t.type||"";if(O(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!O(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Pn(t){return!!(hn(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||hn(t,"select")||hn(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var In="(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})",Tn=new RegExp("^(?:"+In+")$"),Rn=new RegExp(In),Cn="\\d{3}-?\\d{2}-?\\d{4}",Fn=new RegExp("^("+Cn+")$"),On=new RegExp("("+Cn+")");function Mn(t,i){if(void 0===i&&(i=!0),D(t))return!1;if(O(t)){if(t=x(t),(i?Tn:Rn).test((t||"").replace(/[- ]/g,"")))return!1;if((i?Fn:On).test(t))return!1}return!0}function An(t){var i=_n(t);return Mn(i=(i+" "+Dn(t)).trim())?i:""}function Dn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&be(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=_n(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Dn(t)).trim())}catch(t){yi.error("[AutoCapture]",t)}})),i}function jn(t){return t.replace(/"|\\"/g,'\\"')}function Ln(t){var i=t.attr__class;return i?I(i)?i:cn(i):void 0}class zn{constructor(t){this.disabled=!1===t;var i=R(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var Un="$copy_autocapture",Nn=wi("[AutoCapture]");function Hn(t,i){return i.length>t?i.slice(0,t)+"...":i}function Bn(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!un(i));return i}function qn(i,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=e,h=[i],d=i;d.parentNode&&!hn(d,"body");)vn(d.parentNode)?(h.push(d.parentNode.host),d=d.parentNode.host):(h.push(d.parentNode),d=d.parentNode);var v,c,f=[],g={},_=!1,m=!1;if(be(h,(t=>{var i=kn(t);"a"===t.tagName.toLowerCase()&&(_=t.getAttribute("href"),_=i&&_&&Mn(_)&&_),w(pn(t),"ph-no-capture")&&(m=!0),f.push(function(t,i,e,r){var s=t.tagName.toLowerCase(),n={tag_name:s};bn.indexOf(s)>-1&&!e&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?Hn(1024,An(t)):Hn(1024,_n(t)));var o=pn(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),be(t.attributes,(function(e){var s;if((!Pn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Mn(e.value)&&(!O(s=e.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=e.value;"class"===e.name&&(o=cn(o).join(" ")),n["attr__"+e.name]=Hn(1024,o)}}));for(var a=1,l=1,u=t;u=Bn(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(t,o,a,l));var e=function(t){if(!kn(t))return{};var i={};return be(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Mn(r)&&(i[e]=r)}})),i}(t);ye(g,e)})),m)return{props:{},explicitNoCapture:m};if(a||(f[0].$el_text="a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?An(i):_n(i)),_){var b,y;f[0].attr__href=_;var x=null==(b=er(_))?void 0:b.host,E=null==t||null==(y=t.location)?void 0:y.host;x&&E&&x!==E&&(v=_)}return{props:ye({$event_type:n.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:(c=f,function(t){return t.map((t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=p({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return we(n).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return o[jn(i.toString())]=jn(e.toString())})),(r+=":")+we(o).map((t=>{var[i,e]=t;return i+'="'+e+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Ln(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return we(t).filter((t=>{var[i]=t;return 0===i.indexOf("attr__")})).forEach((t=>{var[i,e]=t;return r.attributes[i]=e})),r}))}(c)))},null!=(r=f[0])&&r.$el_text?{$el_text:null==(s=f[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},g)}}var Wn=wi("[ExceptionAutocapture]");function Vn(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return T(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}var Gn=wi("[TracingHeaders]"),Jn=wi("[Web Vitals]"),Kn=9e5,Yn="disabled",Xn="lazy_loading",Qn="awaiting_config",Zn="missing_config";wi("[SessionRecording]");var to="[SessionRecording]",io=wi(to),eo=wi("[Heatmaps]");function ro(t){return R(t)&&"clientX"in t&&"clientY"in t&&j(t.clientX)&&j(t.clientY)}var so=wi("[Product Tours]"),no="ph_product_tours",oo=["$set_once","$set"],ao=wi("[SiteApps]"),lo="Error while initializing PostHog app with config id ";function uo(t,i,e){if(D(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class ho{constructor(t){this.en=new ks,this.rn=(t,i)=>this.nn(t,i)&&this.sn(t,i)&&this.an(t,i)&&this.ln(t,i),this.nn=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.un=new Set,this.hn=new Set}init(){var t,i;F(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(i=this._instance)||i._addCaptureHook(((t,i)=>{this.on(t,i)})))}register(t){var i,e;if(!F(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i,e;null==(i=this.hn)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.un)||i.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r,s=new Set;t.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,i){var e;null!=i&&0!=t.length&&(this.un.has(t)||this.un.has(null==i?void 0:i.event))&&this.hn&&(null==(e=this.hn)?void 0:e.size)>0&&this.hn.forEach((t=>{this.cn(i,t)&&this.en.emit("actionCaptured",t.name)}))}dn(t){this.onAction("actionCaptured",(i=>t(i)))}cn(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.rn(t,e))return!0;return!1}onAction(t,i){return this.en.on(t,i)}sn(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!uo(r,i.url,i.url_matching||"contains"))return!1}return!0}an(t,i){return!!this.vn(t,i)&&!!this.fn(t,i)&&!!this.pn(t,i)}vn(t,i){var e;if(null==i||!i.href)return!0;var r=this.gn(t);if(r.length>0)return r.some((t=>uo(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&uo((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}fn(t,i){var e;if(null==i||!i.text)return!0;var r=this.gn(t);if(r.length>0)return r.some((t=>uo(t.text,i.text,i.text_matching||"exact")||uo(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!D(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>uo(t,n,o))))}pn(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}gn(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}ln(t,i){return null==i||!i.properties||0===i.properties.length||Ms(i.properties.reduce(((t,i)=>{var e=I(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class vo{constructor(t){this._instance=t,this.mn=new Map,this.yn=new Map,this.bn=new Map}wn(t,i){return!!t&&Ms(t.propertyFilters,null==i?void 0:i.properties)}_n(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}In(t,i,e){var r=(e===Er?this.mn:this.yn).get(t),s=[];return this.Cn((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.wn(n,i)}))}register(t){var i;F(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.Sn(t),this.kn(t))}kn(t){var i=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.actions)&&(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length)>0}));0!==i.length&&(null==this.xn&&(this.xn=new ho(this._instance),this.xn.init(),this.xn.dn((t=>{this.onAction(t)}))),i.forEach((t=>{var i,e,r,s,n;t.conditions&&null!=(i=t.conditions)&&i.actions&&null!=(e=t.conditions)&&null!=(e=e.actions)&&e.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.xn)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((i=>{if(i&&i.name){var e=this.bn.get(i.name);e&&e.push(t.id),this.bn.set(i.name,e||[t.id])}})))})))}Sn(t){var i,e=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),r=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}));0===e.length&&0===r.length||(null==(i=this._instance)||i._addCaptureHook(((t,i)=>{this.onEvent(t,i)})),this.mn=this._n(t,Er),this.yn=this._n(t,Sr))}onEvent(t,i){var e,r=this.re(),s=this.Tn(),n=this.An(),o=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[s])||[];if(n===t&&i&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:t,eventPayload:i,existingActivatedItems:o});var u=(null==i||null==(a=i.properties)?void 0:a.$survey_id)||(null==i||null==(l=i.properties)?void 0:l.$product_tour_id);if(u){var h=o.indexOf(u);0>h||(o.splice(h,1),this.En(o))}}else{if(this.yn.has(t)){var d=this.In(t,i,Sr);d.length>0&&(r.info("cancel event matched, cancelling items",{event:t,itemsToCancel:d.map((t=>t.id))}),d.forEach((t=>{var i=o.indexOf(t.id);0>i||o.splice(i,1),this.Rn(t.id)})),this.En(o))}if(this.mn.has(t)){r.info("event name matched",{event:t,eventPayload:i,items:this.mn.get(t)});var v=this.In(t,i,Er);this.En(o.concat(v.map((t=>t.id))||[]))}}}onAction(t){var i,e=this.Tn(),r=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[e])||[];this.bn.has(t)&&this.En(r.concat(this.bn.get(t)||[]))}En(t){var i,e=this.re(),r=this.Tn(),s=[...new Set(t)].filter((t=>!this.Nn(t)));e.info("updating activated items",{activatedItems:s}),null==(i=this._instance)||null==(i=i.persistence)||i.register({[r]:s})}getActivatedIds(){var t,i=this.Tn();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}getEventToItemsMap(){return this.mn}Mn(){return this.xn}}class co extends vo{constructor(t){super(t)}Tn(){return"$surveys_activated"}An(){return $r}Cn(t){var i;null==(i=this._instance)||i.getSurveys(t)}Rn(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}re(){return Ls}Nn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var fo="SDK is not enabled or survey functionality is not yet loaded",po="Disabled. Not loading surveys.",go=null!=t&&t.location?nr(t.location.hash,"__posthog")||nr(location.hash,"state"):null,_o="_postHogToolbarParams",mo=wi("[Toolbar]"),bo=wi("[FeatureFlags]"),yo=wi("[FeatureFlags]",{debugEnabled:!0}),wo="\" failed. Feature flags didn't load in time.",xo="$active_feature_flags",Eo="$override_feature_flags",So="$feature_flag_payloads",$o="$override_feature_flag_payloads",ko="$feature_flag_request_id",Po=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},Io=t=>{var i={};for(var[e,r]of we(t||{}))r&&(i[e]=r);return i},To=wi("[Error tracking]"),Ro="Refusing to render web experiment since the viewer is a likely bot",Co={icontains:(i,e)=>!!t&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!t&&-1===e.href.toLowerCase().indexOf(i.toLowerCase()),regex:(i,e)=>!!t&&Rs(e.href,i),not_regex:(i,e)=>!!t&&!Rs(e.href,i),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class Fo{get Rt(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{Fo.Fn("retrieved web experiments from the server"),i.On=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;i.On&&(Fo.Fn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.On)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);O(r)&&t.variants[r]&&i.Pn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Fo.Ln(n)&&i.Pn(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Fo.Fn(Ro);else if(!this.Rt.disable_web_experiments){if(D(this.On))return this.On=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Fo.Fn("applying feature flags",t),t.forEach((t=>{var i;if(this.On&&null!=(i=this.On)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.On)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Pn(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Fo.getWindowLocation();if(null!=t&&t.search){var i=rr(null==t?void 0:t.search,"__experiment_id"),e=rr(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Fo.Fn("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Dn(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this.Rt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Rt.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Rt.token),method:"GET",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Dn(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(Fo.Fn("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Pn(r[0].name,i,r[0].variants[i].transforms))}static Ln(t){return!D(t.conditions)&&Fo.Bn(t)&&Fo.jn(t)}static Bn(t){var i;if(D(t.conditions)||D(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=Fo.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||Co[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static jn(t){var i;if(D(t.conditions)||D(null==(i=t.conditions)?void 0:i.utm))return!0;var e=dr();if(e.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static Fn(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];yi.info("[WebExperiments] "+t,e)}Pn(t,i,e){this._is_bot()?Fo.Fn(Ro):"control"!==i?e.forEach((e=>{if(e.selector){var r;Fo.Fn("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):Fo.Fn("Control variants leave the page unmodified.")}_is_bot(){return e&&this._instance?Ts(e,this.Rt.custom_blocked_useragents):void 0}}var Oo,Mo,Ao=wi("[Conversations]"),Do="Conversations not available yet.",jo={featureFlags:class{constructor(t){this.qn=!1,this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.Yn=!1,this.Un=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Rt(){return this._instance.config}get Xi(){return this._instance.persistence}Wn(t){return this._instance.get_property(t)}Gn(){var t,i;return null!==(t=null==(i=this.Xi)?void 0:i.pi(this.Rt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}Xn(){return!!this.Gn()&&(this.Un||this.$n||(this.Un=!0,bo.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Jn(){var t,i=null!==(t=this.Rt.evaluation_contexts)&&void 0!==t?t:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Yn||(bo.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yn=!0),null!=i&&i.length?i.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||bo.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}Kn(){return this.Jn().length>0}initialize(){var t,i,{config:e}=this._instance,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,i)=>(t[i]=r[i]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,i)=>(o[i]&&(t[i]=o[i]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,e){var r=null!=e&&e.merge?this.getFlagVariants():{},s=null!=e&&e.merge?this.getFlagPayloads():{},n=p({},r,t),o=p({},s,i),a={};for(var[l,u]of Object.entries(n)){var h="string"==typeof u;a[l]={key:l,enabled:!!h||Boolean(u),variant:h?u:void 0,reason:void 0,metadata:F(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Zn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Wn(Hi),i=this.Wn(Eo),e=this.Wn($o);if(!e&&!i)return t||{};var r=ye({},t||{}),s=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(var n of s){var o,a,l=r[n],u=null==i?void 0:i[n],h=F(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=F(u)?l.variant:"string"==typeof u?u:void 0,v=null==e?void 0:e[n],c=p({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=p({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.qn||(bo.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.qn=!0),r}getFlagVariants(){var t=this.Wn(Ui),i=this.Wn(Eo);if(!i)return t||{};for(var e=ye({},t),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.qn||(bo.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.qn=!0),e}getFlagPayloads(){var t=this.Wn(So),i=this.Wn($o);if(!i)return t||{};for(var e=ye({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.qn||(bo.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.qn=!0),e}reloadFeatureFlags(){this.Hn||this.Rt.advanced_disable_feature_flags||this.Qn||(this._instance.Sr.emit("featureFlagsReloading",!0),this.Qn=setTimeout((()=>{this.ts()}),5))}es(){clearTimeout(this.Qn),this.Qn=void 0}ensureFlagsLoaded(){this.Zn||this.$n||this.Qn||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Hn=t}ts(t){var i;if(this.es(),!this._instance.ki())if(this.$n)this.Vn=!0;else{var e=this.Rt.token,r=this.Wn($i),s={token:e,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:p({},(null==(i=this.Xi)?void 0:i.get_initial_props())||{},this.Wn(Bi)||{}),group_properties:this.Wn(qi),timezone:br()};A(r)||F(r)||(s.$device_id=r),(null!=t&&t.disableFlags||this.Rt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Kn()&&(s.evaluation_contexts=this.Jn());var n=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Rt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$n=!0,this._instance._send_request({method:"POST",url:n,data:s,compression:this.Rt.disable_compression?void 0:Or,timeout:this.Rt.feature_flag_request_timeout_ms,callback:t=>{var i,e,r,n=!0;if(200===t.statusCode&&(this.Vn||(this.$anon_distinct_id=void 0),n=!1),this.$n=!1,!s.disable_flags||this.Vn){this.zn=!n;var o=[];t.error?t.error instanceof Error?o.push("AbortError"===t.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==t.statusCode&&o.push("api_error_"+t.statusCode),null!=(i=t.json)&&i.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(e=t.json)||null==(e=e.quotaLimited)||!e.includes("feature_flags"));if(l&&o.push("quota_limited"),null==(r=this.Xi)||r.register({[Ji]:o}),l)bo.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 s.disable_flags||this.receivedFeatureFlags(null!==(a=t.json)&&void 0!==a?a:{},n),this.Vn&&(this.Vn=!1,this.ts())}}})}}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else bo.warn('getFeatureFlag for key "'+t+wo)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var e=this.getFlagVariants(),r=t in e,s=e[t],n=this.getFlagPayloads()[t],o=String(s),a=this.Wn(ko)||void 0,l=this.Wn(Ki)||void 0,u=this.Wn(Vi)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.Wn(Gi);d&&d!==v&&(u={},null==(h=this.Xi)||h.register({[Vi]:u,[Gi]:d}))}if((i.send_event||!("send_event"in i))&&(!(t in u)||!u[t].includes(o))){var c,f,p,g,_,m,b,y,w,x;I(u[t])?u[t].push(o):u[t]=[o],null==(c=this.Xi)||c.register({[Vi]:u});var E=this.getFeatureFlagDetails(t),S=[...null!==(f=this.Wn(Ji))&&void 0!==f?f:[]];F(s)&&S.push("flag_missing");var k={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(p=this.Rt.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(g=this.Rt.bootstrap)||null==(g=g.featureFlagPayloads)?void 0:g[t])||null,$used_bootstrap_value:!this.zn};F(null==E||null==(_=E.metadata)?void 0:_.version)||(k.$feature_flag_version=E.metadata.version);var P,T=null!==(m=null==E||null==(b=E.reason)?void 0:b.description)&&void 0!==m?m:null==E||null==(y=E.reason)?void 0:y.code;T&&(k.$feature_flag_reason=T),null!=E&&null!=(w=E.metadata)&&w.id&&(k.$feature_flag_id=E.metadata.id),F(null==E?void 0:E.original_variant)&&F(null==E?void 0:E.original_enabled)||(k.$feature_flag_original_response=F(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(k.$feature_flag_original_payload=null==E||null==(P=E.metadata)?void 0:P.original_payload),S.length&&(k.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",k)}if(r){var R=n;if(!F(n))try{R=JSON.parse(n)}catch(t){}return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:R}}}}else bo.warn('getFeatureFlagResult for key "'+t+wo)}getRemoteConfigPayload(t,i){var e=this.Rt.token,r={distinct_id:this._instance.get_distinct_id(),token:e};this.Kn()&&(r.evaluation_contexts=this.Jn()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Rt.disable_compression?void 0:Or,timeout:this.Rt.feature_flag_request_timeout_ms,callback(e){var r,s=null==(r=e.json)?void 0:r.featureFlagPayloads;i((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,i){if(void 0===i&&(i={}),!i.fresh||this.zn){if(this.Zn||this.getFlags()&&this.getFlags().length>0){var e=this.getFeatureFlag(t,i);return F(e)?void 0:!!e}bo.warn('isFeatureEnabled for key "'+t+wo)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i){if(this.Xi){this.Zn=!0;var e=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(t,i,e,r,s){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={});var n=(t=>{var i=t.flags;return i?(t.featureFlags=Object.fromEntries(Object.keys(i).map((t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(i).filter((t=>i[t].enabled)).filter((t=>{var e;return null==(e=i[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=i[t].metadata)?void 0:e.payload]})))):bo.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var u=t.requestId,h=t.evaluatedAt;if(I(a)){bo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var d={};if(a)for(var v=0;a.length>v;v++)d[a[v]]=!0;i&&i.register({[xo]:a,[Ui]:d})}else{var c=a,f=l,g=o;if(t.errorsWhileComputingFlags)if(o){var _=new Set(Object.keys(o).filter((t=>{var i;return!(null!=(i=o[t])&&i.failed)})));c=p({},e,Object.fromEntries(Object.entries(c).filter((t=>{var[i]=t;return _.has(i)})))),f=p({},r,Object.fromEntries(Object.entries(f||{}).filter((t=>{var[i]=t;return _.has(i)})))),g=p({},s,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[i]=t;return _.has(i)}))))}else c=p({},e,c),f=p({},r,f),g=p({},s,g);i&&i.register(p({[xo]:Object.keys(Io(c)),[Ui]:c||{},[So]:f||{},[Hi]:g||{}},u?{[ko]:u}:{},h?{[Ki]:h}:{}))}}}(t,this.Xi,e,r,s),i||(this.Un=!1),this.rs(i)}}override(t,i){void 0===i&&(i=!1),bo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.Xi)return bo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.Xi.unregister(Eo),this.Xi.unregister($o),this.rs(),yo.info("All overrides cleared");if(I(t)){var i=Po(t);return this.Xi.register({[Eo]:i}),this.rs(),yo.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e,r=t;if(this.qn=Boolean(null!==(e=r.suppressWarning)&&void 0!==e&&e),"flags"in r)if(!1===r.flags)this.Xi.unregister(Eo),yo.info("Flag overrides cleared");else if(r.flags){if(I(r.flags)){var s=Po(r.flags);this.Xi.register({[Eo]:s})}else this.Xi.register({[Eo]:r.flags});yo.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.Xi.unregister($o),yo.info("Payload overrides cleared")):r.payloads&&(this.Xi.register({[$o]:r.payloads}),yo.info("Payload overrides set",{payloads:r.payloads}))),void this.rs()}if(t&&"object"==typeof t)return this.Xi.register({[Eo]:t}),this.rs(),yo.info("Flag overrides set",{flags:t});bo.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Zn){var{flags:i,flagVariants:e}=this.ns();t(i,e)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,s=(this.Wn(Ni)||[]).find((i=>i.flagKey===t)),n={["$feature_enrollment/"+t]:i},o={$feature_flag:t,$feature_enrollment:i,$set:n};s&&(o.$early_access_feature_name=s.name),e&&(o.$feature_enrollment_stage=e),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=p({},this.getFlagVariants(),{[t]:i});null==(r=this.Xi)||r.register({[xo]:Object.keys(Io(a)),[Ui]:a}),this.rs()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Wn(Ni),s=e?"&"+e.map((t=>"stage="+t)).join("&"):"";if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Rt.token+s),method:"GET",callback:i=>{var e,r;if(i.json){var s=i.json.earlyAccessFeatures;return null==(e=this.Xi)||e.unregister(Ni),null==(r=this.Xi)||r.register({[Ni]:s}),t(s)}}})}ns(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}rs(t){var{flags:i,flagVariants:e}=this.ns();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.Wn(Bi)||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),s=null==t?void 0:t.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in e||(n[o]=s[o]));this._instance.register({[Bi]:p({},e,n,r)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Bi)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.Wn(qi)||{};0!==Object.keys(e).length&&Object.keys(e).forEach((i=>{e[i]=p({},e[i],t[i]),delete t[i]})),this._instance.register({[qi]:p({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Wn(qi)||{};this._instance.register({[qi]:p({},i,{[t]:{}})})}else this._instance.unregister(qi)}reset(){this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.$anon_distinct_id=void 0,this.es(),this.qn=!1}}},Lo={sessionRecording:class{get Rt(){return this._instance.config}get Xi(){return this._instance.persistence}get started(){var t;return!(null==(t=this.ss)||!t.isStarted)}get status(){var t,i;return this.os===Qn||this.os===Zn?this.os:null!==(t=null==(i=this.ss)?void 0:i.status)&&void 0!==t?t:this.os}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.os=Yn,this.ls=void 0,this._instance=t,!this._instance.sessionManager)throw io.error("started without valid sessionManager"),new Error(to+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===le)throw new Error(to+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get us(){var i,e=!(null==(i=this._instance.get_property(ji))||!i.enabled),r=!this.Rt.disable_session_recording,s=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!this.us||null==(i=this.ss)||!i.isStarted){var e=!F(Object.assign)&&!F(Array.from);this.us&&e?(this.hs(t),io.info("starting")):(this.os=Yn,this.stopRecording())}}hs(t){var i,e,r;this.us&&(this.os!==Qn&&this.os!==Zn&&(this.os=Xn),null!=h&&null!=(i=h.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=h.__PosthogExtensions__)&&e.initSessionRecording?this.cs(t):null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.ds,(i=>{if(i)return io.error("could not load recorder",i);this.cs(t)})))}stopRecording(){var t,i;null==(t=this.ls)||t.call(this),this.ls=void 0,null==(i=this.ss)||i.stop()}vs(){var t,i;null==(t=this.ls)||t.call(this),this.ls=void 0,null==(i=this.ss)||i.discard()}fs(){var t;null==(t=this.Xi)||t.unregister(zi)}ps(t,i){if(D(t))return null;var e,r=j(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(io.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}gs(t){if(this.Xi){var i,e,r=this.Xi,s=()=>{var i,e=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.ps(null==(i=this.Rt.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),n=this.ps(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=s?s:n;D(o)&&this.fs();var a=null==e?void 0:e.minimumDurationMilliseconds;r.register({[ji]:p({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:p({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:o,minimumDurationMilliseconds:F(a)?null:a,endpoint:null==e?void 0:e.endpoint,triggerMatchType:null==e?void 0:e.triggerMatchType,masking:null==e?void 0:e.masking,urlTriggers:null==e?void 0:e.urlTriggers})})};s(),null==(i=this.ls)||i.call(this),this.ls=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.gs(t),void this.vs()):(this.gs(t),void this.startIfEnabledOrStop()):(this.os===Qn&&(this.os=Zn,io.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.ss)&&e.log?this.ss.log(t,i):io.warn("log called before recorder was ready")}get ds(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(ji);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}ys(){var t,i=this._instance.get_property(ji);if(!i)return!1;var e=null!==(t=("object"==typeof i?i:JSON.parse(i)).cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-e}cs(t){var i,e;if(null==(i=h.__PosthogExtensions__)||!i.initSessionRecording)return io.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.ss||(this.ss=null==(e=h.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.ss._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ys()){if(this.os===Zn||this.os===Qn)return;return this.os=Qn,io.info("persisted remote config is stale, requesting fresh config before starting"),void new Cr(this._instance).load()}this.os=Xn,this.ss.start(t)}onRRwebEmit(t){var i;null==(i=this.ss)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.ss||null==(i=this.Xi)||i.register({$replay_override_linked_flag:!0}),null==(t=this.ss)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.ss||null==(i=this.Xi)||i.register({$replay_override_sampling:!0}),null==(t=this.ss)||t.overrideSampling()}overrideTrigger(t){var i,e;this.ss||null==(e=this.Xi)||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(i=this.ss)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.ss)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.ss)||!e.tryAddCustomEvent(t,i))}}},zo={autocapture:class{constructor(t){this.bs=!1,this.ws=null,this._s=!1,this.instance=t,this.rageclicks=new zn(t.config.rageclick),this.Is=null}initialize(){this.startIfEnabled()}get Rt(){var t,i,e=R(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=null==(t=e.url_allowlist)?void 0:t.map((t=>new RegExp(t))),e.url_ignorelist=null==(i=e.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),e}Cs(){if(this.isBrowserSupported()){if(t&&r){var i=i=>{i=i||(null==t?void 0:t.event);try{this.Ss(i)}catch(t){Nn.error("Failed to capture event",t)}};if(Pe(r,"submit",i,{capture:!0}),Pe(r,"change",i,{capture:!0}),Pe(r,"click",i,{capture:!0}),this.Rt.capture_copied_text){var e=i=>{this.Ss(i=i||(null==t?void 0:t.event),Un)};Pe(r,"copy",e,{capture:!0}),Pe(r,"cut",e,{capture:!0})}}}else Nn.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.bs&&(this.Cs(),this.bs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this._s=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ii]:!!t.autocapture_opt_out}),this.ws=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Is=t}getElementSelectors(t){var i,e=[];return null==(i=this.Is)||i.forEach((i=>{var s=null==r?void 0:r.querySelectorAll(i);null==s||s.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i,e=null==(t=this.instance.persistence)?void 0:t.props[Ii];if(A(this.ws)&&!z(e)&&!this.instance.ki())return!1;var r=null!==(i=this.ws)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!r}Ss(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r,s=mn(i);dn(s)&&(s=s.parentNode||null),"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent&&this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(i.clientX,i.clientY,i.timeStamp||(new Date).getTime())&&function(i,e){if(!t||Sn(i))return!1;var r,s,n;if(z(e)?(r=!!e&&En,s=void 0):(r=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:En,s=null==e?void 0:e.content_ignorelist),!1===r)return!1;var{targetElementList:o}=$n(i,!1);return!function(t,i){if(!1===t||F(t))return!1;var e;if(!0===t)e=xn;else{if(!I(t))return!1;if(t.length>10)return yi.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var{safeText:i,ariaLabel:r}=t;return e.some((t=>i.includes(t)||r.includes(t)))}))}(s,o.map((t=>{var i;return{safeText:_n(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!yn(o,r)}(s,this.instance.config.rageclick)&&this.Ss(i,"$rageclick");var n=e===Un;if(s&&function(i,e,r,s,n){var o,a,l,u;if(void 0===r&&(r=void 0),!t||Sn(i))return!1;if(null!=(o=r)&&o.url_allowlist&&!fn(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&fn(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var h=r.dom_event_allowlist;if(h&&!h.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:d,targetElementList:v}=$n(i,s);if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(F(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,r))return!1;if(!yn(v,null==(u=r)?void 0:u.css_selector_allowlist))return!1;var c=t.getComputedStyle(i);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===e.type)return!0;var f=i.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return d?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(bn.indexOf(f)>-1||"true"===i.getAttribute("contenteditable"))}}(s,i,this.Rt,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=qn(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist,elementsChainAsString:this._s});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),e===Un){var u,h=gn(null==t||null==(u=t.getSelection())?void 0:u.toString()),d=i.type||"clipboard";if(!h)return!1;o.$selected_content=h,o.$copy_type=d}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return T(null==r?void 0:r.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.ks=(null==t||null==(e=t.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(yi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.xs&&this.xs(),this.xs=void 0,yi.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(t&&t.history){var r=this;null!=(i=t.history.pushState)&&i.__posthog_wrapped__||Vn(t.history,"pushState",(t=>function(i,e,s){t.call(this,i,e,s),r.Ts("pushState")})),null!=(e=t.history.replaceState)&&e.__posthog_wrapped__||Vn(t.history,"replaceState",(t=>function(i,e,s){t.call(this,i,e,s),r.Ts("replaceState")})),this.As()}}Ts(i){try{var e,r=null==t||null==(e=t.location)?void 0:e.pathname;if(!r)return;r!==this.ks&&this.isEnabled&&this._instance.capture(fe,{navigation_type:i}),this.ks=r}catch(t){yi.error("Error capturing "+i+" pageview",t)}}As(){if(!this.xs){var i=()=>{this.Ts("popstate")};Pe(t,"popstate",i),this.xs=()=>{t&&t.removeEventListener("popstate",i)}}}},heatmaps:class{get Rt(){return this.instance.config}constructor(t){var i;this.Es=!1,this.bs=!1,this.Rs=null,this.instance=t,this.Es=!(null==(i=this.instance.persistence)||!i.props[Ti]),this.rageclicks=new zn(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return R(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return D(this.Rt.capture_heatmaps)?D(this.Rt.enable_heatmaps)?this.Es:this.Rt.enable_heatmaps:!1!==this.Rt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.bs)return;eo.info("starting..."),this.Ns(),this.Tt()}else{var t;clearInterval(null!==(t=this.Rs)&&void 0!==t?t:void 0),this.Ms(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ti]:i}),this.Es=i,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Fs(t){this.wt(t.originalEvent,"deadclick")}Tt(){this.Rs&&clearInterval(this.Rs),this.Rs=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(r)?setInterval(this.ji.bind(this),this.flushIntervalMilliseconds):null}Ns(){t&&r&&(this.Os=this.ji.bind(this),Pe(t,ce,this.Os),this.Ps=i=>this.wt(i||(null==t?void 0:t.event)),Pe(r,"click",this.Ps,{capture:!0}),this.Ls=i=>this.Ds(i||(null==t?void 0:t.event)),Pe(r,"mousemove",this.Ls,{capture:!0}),this.Bs=new Ye(this.instance,Je,this.Fs.bind(this)),this.Bs.startIfEnabledOrStop(),this.js=this.Tt.bind(this),Pe(r,ve,this.js),this.bs=!0)}Ms(){var i;t&&r&&(this.Os&&t.removeEventListener(ce,this.Os),this.Ps&&r.removeEventListener("click",this.Ps,{capture:!0}),this.Ls&&r.removeEventListener("mousemove",this.Ls,{capture:!0}),this.js&&r.removeEventListener(ve,this.js),clearTimeout(this.qs),null==(i=this.Bs)||i.stop(),this.bs=!1)}Zs(i,e){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(i,e,r){for(var s=i;s&&un(s)&&!hn(s,"body");){if(s===r)return!1;if(w(e,null==t?void 0:t.getComputedStyle(s).position))return!0;s=wn(s)}return!1}(mn(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}wt(t,i){var e;if(void 0===i&&(i="click"),!ln(t.target)&&ro(t)){var r=this.Zs(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.$s(p({},r,{type:"rageclick"})),this.$s(r)}}Ds(t){!ln(t.target)&&ro(t)&&(clearTimeout(this.qs),this.qs=setTimeout((()=>{this.$s(this.Zs(t,"mousemove"))}),500))}$s(i){if(t){var e=t.location.href,r=this.Rt.custom_personal_data_properties,s=this.Rt.mask_personal_data_properties?[...ar,...r||[]]:[],n=sr(e,s,ur);this.T=this.T||{},this.T[n]||(this.T[n]=[]),this.T[n].push(i)}}ji(){this.T&&!C(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ye,webVitalsAutocapture:class{constructor(t){var i;this.Es=!1,this.bs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hs=()=>{clearTimeout(this.Vs),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((t,i)=>p({},t,{["$web_vitals_"+i.name+"_event"]:p({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.nt=t=>{var i,e=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(F(e))Jn.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.zs();F(r)||(D(null==t?void 0:t.name)||D(null==t?void 0:t.value)?Jn.error("Invalid metric received",t):!this.Ys||this.Ys>t.value?(this.T.url!==r&&(this.Hs(),this.Vs=setTimeout(this.Hs,this.flushToCaptureTimeoutMs)),F(this.T.url)&&(this.T.url=r),this.T.firstMetricTimestamp=F(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.T.metrics.push(p({},t,{$current_url:r,$session_id:e.sessionId,$window_id:e.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Hs()):Jn.error("Ignoring metric with value >= "+this.Ys,t))}},this.Us=()=>{if(!this.bs){var t,i,e,r,s=h.__PosthogExtensions__;F(s)||F(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.nt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.nt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.nt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.nt.bind(this)),this.bs=!0):Jn.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Es=!(null==(i=this._instance.persistence)||!i.props[Oi]),this.startIfEnabled()}get Ws(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=R(this.Ws)?null==(t=this.Ws)?void 0:t.web_vitals_allowed_metrics:void 0;return D(e)?(null==(i=this._instance.persistence)?void 0:i.props[Di])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(R(this.Ws)?this.Ws.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=R(this.Ws)?this.Ws.web_vitals_attribution:void 0;return null!=t&&t}get Ys(){var t=R(this.Ws)&&j(this.Ws.__web_vitals_max_value)?this.Ws.__web_vitals_max_value:Kn;return t>0&&6e4>=t?Kn:t}get isEnabled(){var t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Jn.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=R(this.Ws)?this.Ws.web_vitals:z(this.Ws)?this.Ws:void 0;return z(i)?i:this.Es}startIfEnabled(){this.isEnabled&&!this.bs&&(Jn.info("enabled, starting..."),this.ni(this.Us))}onRemoteConfig(t){if("capturePerformance"in t){var i=R(t.capturePerformance)&&!!t.capturePerformance.web_vitals,e=R(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Oi]:i}),this._instance.persistence.register({[Di]:e})),this.Es=i,this.startIfEnabled()}}ni(t){var i,e;null!=(i=h.__PosthogExtensions__)&&i.postHogWebVitalsCallbacks?t():null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?Jn.error("failed to load script",i):t()}))}zs(){var i=t?t.location.href:void 0;if(i){var e=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...ar,...e||[]]:[];return sr(i,r,ur)}Jn.error("Could not determine current URL")}}},Uo={exceptionObserver:class{constructor(i){var e,r,s;this.Us=()=>{var i;if(t&&this.isEnabled&&null!=(i=h.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Gs&&this.Rt.capture_unhandled_errors&&(this.Gs=e(this.captureException.bind(this))),!this.Xs&&this.Rt.capture_unhandled_rejections&&(this.Xs=r(this.captureException.bind(this))),!this.Js&&this.Rt.capture_console_errors&&(this.Js=s(this.captureException.bind(this)))}catch(t){Wn.error("failed to start",t),this.Ks()}}},this._instance=i,this.Qs=!(null==(e=this._instance.persistence)||!e.props[Ri]),this.eo=new K({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,qt:Wn}),this.Rt=this.io(),this.startIfEnabledOrStop()}io(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return R(t)?i=p({},i,t):(F(t)?this.Qs:t)&&(i=p({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Rt.capture_console_errors||this.Rt.capture_unhandled_errors||this.Rt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Wn.info("enabled"),this.Ks(),this.ni(this.Us)):this.Ks()}ni(t){var i,e;null!=(i=h.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Wn.error("failed to load script",i);t()}))}Ks(){var t,i,e;null==(t=this.Gs)||t.call(this),this.Gs=void 0,null==(i=this.Xs)||i.call(this),this.Xs=void 0,null==(e=this.Js)||e.call(this),this.Js=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.Qs=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Ri]:this.Qs}),this.Rt=this.io(),this.startIfEnabledOrStop())}onConfigChange(){this.Rt=this.io()}captureException(t){var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.eo.consumeRateLimit(s)?Wn.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var i,e;this.ro=[],this.no=new Yt([new li,new mi,new hi,new ui,new gi,new pi,new vi,new _i],function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];return function(i,r){void 0===r&&(r=0);for(var s=[],n=i.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=ai.test(a)?a.replace(ai,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of e){var h=u(l,t);if(h){s.push(h);break}}if(s.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map((t=>{return p({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||Xt});var e}))}(s)}}("web:javascript",ri,oi)),this._instance=t,this.ro=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Ci))&&void 0!==i?i:[]}onRemoteConfig(t){var i,e,r;if("errorTracking"in t){var s=null!==(i=null==(e=t.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.ro=s,this._instance.persistence&&this._instance.persistence.register({[Ci]:this.ro,[Fi]:n})}}get so(){var t,i=!!this._instance.get_property(Fi),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.no.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}sendExceptionEvent(t){var i=t.$exception_list;if(this.oo(i)){if(this.ao(i))return void To.info("Skipping exception capture because a suppression rule matched");if(!this.so&&this.lo(i))return void To.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.uo(i))return void To.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",zr:!0})}ao(t){if(0===t.length)return!1;var i=t.reduce(((t,i)=>{var{type:e,value:r}=i;return O(e)&&e.length>0&&t.$exception_types.push(e),O(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.ro.some((t=>{var e=t.values.map((t=>{var e,r=Fs[t.operator],s=I(t.value)?t.value:[t.value],n=null!==(e=i[t.key])&&void 0!==e?e:[];return s.length>0&&r(s,n)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}lo(t){return t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}uo(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}oo(t){return!D(t)&&I(t)}}},No=p({productTours:class{get Xi(){return this._instance.persistence}constructor(t){this.ho=null,this.co=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.Xi&&this.Xi.register({[Ai]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,i;this.ho||(t=this._instance).config.disable_product_tours||null==(i=t.persistence)||!i.get_property(Ai)||this.ni((()=>this.do()))}ni(t){var i,e;null!=(i=h.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?so.error("Could not load product tours script",i):t()}))}do(){var t;!this.ho&&null!=(t=h.__PosthogExtensions__)&&t.generateProductTours&&(this.ho=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!I(this.co)||i){var e=this.Xi;if(e){var r=e.props[no];if(I(r)&&!i)return this.co=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:i=>{var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return so.error(s),void t([],{isLoaded:!1,error:s})}var n=I(i.json.product_tours)?i.json.product_tours:[];this.co=n,e&&e.register({[no]:n}),t(n,{isLoaded:!0})}})}else t(this.co,{isLoaded:!0})}getActiveProductTours(t){D(this.ho)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.ho.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.ho)||i.showTourById(t)}previewTour(t){this.ho?this.ho.previewTour(t):this.ni((()=>{var i;this.do(),null==(i=this.ho)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.ho)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.ho)||t.nextStep()}previousStep(){var t;null==(t=this.ho)||t.previousStep()}clearCache(){var t;this.co=null,null==(t=this.Xi)||t.unregister(no)}resetTour(t){var i;null==(i=this.ho)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.ho)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.ho)||i.cancelPendingTour(t)}}},jo),Ho={siteApps:class{constructor(t){this._instance=t,this.vo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}fo(t,i){if(i){var e=this.globalsForEvent(i);this.vo.push(e),this.vo.length>1e3&&(this.vo=this.vo.slice(10))}}get siteAppLoaders(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.fo.bind(this));this.po=()=>{t(),this.vo=[],this.po=void 0}}}globalsForEvent(t){var i,e,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(h))l[d]={id:u[d],type:d,properties:v};var{$set_once:c,$set:f}=t;return{event:p({},g(t,oo),{properties:p({},t.properties,f?{$set:p({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:p({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.vo.length&&(ao.info("Processing "+this.vo.length+" events for site app with id "+t.id),this.vo.forEach((t=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(e=this.po)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,ao.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var{processEvent:n}=t.init({posthog:this._instance,callback(t){s(t)}});n&&(i.processEvent=n),r=!0}catch(i){ao.error(lo+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){ao.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}mo(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}yo(t){if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t);for(var e of Object.values(this.apps))try{null==e.processEvent||e.processEvent(i)}catch(i){ao.error("Error while processing event "+t.event+" for site app "+e.id,i)}}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.mo(),void this._instance.on("eventCaptured",(t=>this.yo(t)))):void ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.po)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;h["__$$ph_site_app_"+t]=s._instance,null==(i=h.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return ao.error(lo+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Bo={tracingHeaders:class{constructor(t){this.bo=void 0,this.wo=void 0,this.Us=()=>{var t,i;F(this.bo)&&(null==(t=h.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),F(this.wo)&&(null==(i=h.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}ni(t){var i,e;null!=(i=h.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Gn.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.ni(this.Us):(null==(t=this.bo)||t.call(this),null==(i=this.wo)||i.call(this),this.bo=void 0,this.wo=void 0)}}},qo=p({surveys:class{get Rt(){return this._instance.config}constructor(t){this._o=void 0,this._surveyManager=null,this.Io=!1,this.Co=[],this.So=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Rt.disable_surveys){var i=t.surveys;if(D(i))return Ls.warn("Flags not loaded yet. Not loading surveys.");var e=I(i);this._o=e?i.length>0:i,Ls.info("flags response received, isSurveysEnabled: "+this._o),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var e=localStorage.key(i);(null!=e&&e.startsWith(zs)||null!=e&&e.startsWith("inProgressSurvey_"))&&t.push(e)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.Io)Ls.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)Ls.info(po);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())Ls.info("Not loading surveys in cookieless mode without consent.");else{var t=null==h?void 0:h.__PosthogExtensions__;if(t){if(!F(this._o)||this.Rt.advanced_enable_surveys){var i=this._o||this.Rt.advanced_enable_surveys;this.Io=!0;try{var e=t.generateSurveys;if(e)return void this.ko(e,i);var r=t.loadExternalDependency;if(!r)return void this.xo(oe);r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this.xo("Could not load surveys script",e):this.ko(t.generateSurveys,i)}))}catch(t){throw this.xo("Error initializing surveys",t),t}finally{this.Io=!1}}}else Ls.error("PostHog Extensions not found.")}}ko(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new co(this._instance),Ls.info("Surveys loaded successfully"),this.To({isLoaded:!0})}xo(t,i){Ls.error(t,i),this.To({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Co.push(t),this._surveyManager&&this.To({isLoaded:!0}),()=>{this.Co=this.Co.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this.Rt.disable_surveys)return Ls.info(po),t([]);var e,r=this._instance.get_property(Wi);if(r&&!i)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.So?this.So.then((i=>{var{surveys:e,context:r}=i;return t(e,r)})):("undefined"!=typeof Promise&&(this.So=new Promise((t=>{e=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:i=>{var r;this.So=null;var s=i.statusCode;if(200!==s||!i.json){var n="Surveys API could not be loaded, status: "+s;Ls.error(n);var o={isLoaded:!1,error:n};return t([],o),void(null==e||e({surveys:[],context:o}))}var a,l=i.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(r=this._instance.persistence)||r.register({[Wi]:l});var h={isLoaded:!0};t(l,h),null==e||e({surveys:l,context:h})}}))}To(t){for(var i of this.Co)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Ls.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!D(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Ls.warn("init was not called")}Ao(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}Eo(t){if(D(this._surveyManager))return{eligible:!1,reason:fo};var i="string"==typeof t?this.Ao(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(D(this._surveyManager))return Ls.warn("init was not called"),{visible:!1,disabledReason:fo};var i=this.Eo(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return D(this._surveyManager)?(Ls.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:fo})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.Eo(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var s;if(D(this._surveyManager))Ls.warn("init was not called");else{var n="string"==typeof t?this.Ao(t):t;if(null!=n&&n.id)if(Hs.includes(n.type)){var o=null==r?void 0:r.querySelector(i);if(o)return null!=(s=n.appearance)&&s.surveyPopupDelaySeconds?(Ls.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,i;Ls.info("Rendering survey "+n.id+" with delay of "+(null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(n,o,e),Ls.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,o,e);Ls.warn("Survey element not found")}else Ls.warn("Surveys of type "+n.type+" cannot be rendered in the app");else Ls.warn("Survey not found")}}displaySurvey(t,i){var e;if(D(this._surveyManager))Ls.warn("init was not called");else{var r=this.Ao(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=p({},r,{appearance:p({},r.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==Pr&&i.initialResponses&&Ls.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void Ls.warn("Survey is not eligible to be displayed: ",n.disabledReason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(s,i):this.renderSurvey(s,i.selector,i.properties)}else Ls.warn("Survey not found")}}cancelPendingSurvey(t){D(this._surveyManager)?Ls.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},jo),Wo={toolbar:class{constructor(t){this.instance=t}Ro(t){h.ph_toolbar_state=t}No(){var t;return null!==(t=h.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,s){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===s&&(s=void 0),Ie(this.instance.config))return!1;if(!t||!r)return!1;i=null!=i?i:t.location,s=null!=s?s:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}var n,o=go||nr(i.hash,"__posthog")||nr(i.hash,"state"),a=o?xe((()=>JSON.parse(atob(decodeURIComponent(o)))))||xe((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?i.hash=a.desiredHash:s?s.replaceState(s.state,"",i.pathname+i.search):i.hash="")):((n=JSON.parse(e.getItem(_o)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}Mo(t){var i=h.ph_load_toolbar||h.ph_load_editor;!D(i)&&T(i)?i(t,this.instance):mo.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==r||!r.getElementById(re));if(!t||e)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=p({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(_o,JSON.stringify(p({},n,{source:void 0}))),2===this.No())this.Mo(n);else if(0===this.No()){var o;this.Ro(1),null==(o=h.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return mo.error("[Toolbar] Failed to load",t),void this.Ro(0);this.Ro(2),this.Mo(n)})),Pe(t,"turbolinks:load",(()=>{this.Ro(0),this.loadToolbar(n)}))}return!0}Fo(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},Vo=p({experiments:Fo},jo),Go={conversations:class{constructor(t){this.Oo=void 0,this._conversationsManager=null,this.Po=!1,this.Lo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var i=t.conversations;D(i)||(z(i)?this.Oo=i:(this.Oo=i.enabled,this.Lo=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Oo=void 0,this.Lo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Po||this._instance.config.disable_conversations||Ie(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==h?void 0:h.__PosthogExtensions__;if(t&&!F(this.Oo)&&this.Oo)if(this.Lo&&this.Lo.token){this.Po=!0;try{var i=t.initConversations;if(i)return this.Do(i),void(this.Po=!1);var e=t.loadExternalDependency;if(!e)return void this.Bo(oe);e(this._instance,"conversations",(i=>{i||!t.initConversations?this.Bo("Could not load conversations script",i):this.Do(t.initConversations),this.Po=!1}))}catch(t){this.Bo("Error initializing conversations",t),this.Po=!1}}else Ao.error("Conversations enabled but missing token in remote config.")}}Do(t){if(this.Lo)try{this._conversationsManager=t(this.Lo,this._instance),Ao.info("Conversations loaded successfully")}catch(t){this.Bo("Error completing conversations initialization",t)}else Ao.error("Cannot complete initialization: remote config is null")}Bo(t,i){Ao.error(t,i),this._conversationsManager=null,this.Po=!1}show(){this._conversationsManager?this._conversationsManager.show():Ao.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Oo&&!A(this._conversationsManager)}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var r=this;return f((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(Ao.warn(Do),null)}))()}getMessages(t,i){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(Ao.warn(Do),null)}))()}markAsRead(t){var i=this;return f((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Ao.warn(Do),null)}))()}getTickets(t){var i=this;return f((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Ao.warn(Do),null)}))()}requestRestoreLink(t){var i=this;return f((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Ao.warn(Do),null)}))()}restoreFromToken(t){var i=this;return f((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Ao.warn(Do),null)}))()}restoreFromUrlToken(){var t=this;return f((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ao.warn(Do),null)}))()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Kr(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Qr(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Jo={logs:class{constructor(t){var i;this.jo=!1,this.qo=!1,this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.jo=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var i,e=null==(i=t.logs)?void 0:i.captureConsoleLogs;!D(e)&&e&&(this.jo=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.jo&&!this.qo){var t=wi("[logs]"),i=null==h?void 0:h.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(e=>{var r;e||null==(r=i.logs)||!r.initializeLogs?t.error("Could not load logs script",e):(i.logs.initializeLogs(this._instance),this.qo=!0)})):t.error(oe)}else t.error("PostHog Extensions not found.")}}}},Ko=p({},jo,Lo,zo,Uo,No,Ho,qo,Bo,Wo,Vo,Go,Jo);an.__defaultExtensionClasses=p({},Ko),Oo=Gs[tn]=new an,(Mo=h.posthog)&&be(Mo._i,(function(t){if(t&&I(t)){var i=Oo.init(t[0],t[1],t[2]),e=Mo[t[2]]||Mo;i&&(i._execute_array.call(i.people,e.people),i._execute_array(e))}})),h.posthog=Oo,function(){function i(){i.done||(i.done=!0,en=!1,be(Gs,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?i():Pe(r,"DOMContentLoaded",i,{capture:!1}):t&&yi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}();
|
|
1
|
+
!function(){"use strict";var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(i.self=i),"undefined"==typeof File&&(i.File=function(){});var e=null==i?void 0:i.navigator,r=null==i?void 0:i.document,s=null==i?void 0:i.location,n=null==i?void 0:i.fetch,o=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,a=null==i?void 0:i.AbortController,l=null==i?void 0:i.CompressionStream,u=null==e?void 0:e.userAgent,h=null!=t?t:{},d="1.366.2",v={DEBUG:!1,LIB_VERSION:d,LIB_NAME:"web",JS_SDK_VERSION:d};function c(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function f(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){c(n,r,s,o,a,"next",t)}function a(t){c(n,r,s,o,a,"throw",t)}o(void 0)}))}}function p(){return p=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},p.apply(null,arguments)}function g(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}function _(){return(_=f((function*(t,i){void 0===i&&(i=!0);try{var e=new Blob([t],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(e).blob()}catch(t){return i&&console.error("Failed to gzip compress data",t),null}}))).apply(this,arguments)}var m=["$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"],b=["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"],y=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return b.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function w(t,i){return-1!==t.indexOf(i)}var x=function(t){return t.trim()},E=function(t){return t.replace(/^\$/,"")},S=Object.prototype,k=S.hasOwnProperty,P=S.toString,I=Array.isArray||function(t){return"[object Array]"===P.call(t)},T=t=>"function"==typeof t,R=t=>t===Object(t)&&!I(t),C=t=>{if(R(t)){for(var i in t)if(k.call(t,i))return!1;return!0}return!1},F=t=>void 0===t,O=t=>"[object String]"==P.call(t),M=t=>O(t)&&0===t.trim().length,A=t=>null===t,D=t=>F(t)||A(t),j=t=>"[object Number]"==P.call(t)&&t==t,L=t=>j(t)&&t>0,z=t=>"[object Boolean]"===P.call(t),U=t=>t instanceof FormData,N=t=>w(m,t);function H(t){return null===t||"object"!=typeof t}function B(t,i){return{}.toString.call(t)==="[object "+i+"]"}function q(t){return"undefined"!=typeof Event&&function(t,i){try{return t instanceof i}catch(t){return!1}}(t,Event)}var W=[!0,"true",1,"1","yes"],V=t=>w(W,t),G=[!1,"false",0,"0","no"];function J(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),j(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),J(s||e,i,e,r))}class K{constructor(t){this.Pt={},this.Dt=t.Dt,this.jt=J(t.bucketSize,0,100,t.qt),this.$t=J(t.refillRate,0,this.jt,t.qt),this.Ht=J(t.refillInterval,0,864e5,t.qt)}Vt(t,i){var e=Math.floor((i-t.lastAccess)/this.Ht);e>0&&(t.tokens=Math.min(t.tokens+e*this.$t,this.jt),t.lastAccess=t.lastAccess+e*this.Ht)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.Pt[r];return s?this.Vt(s,e):this.Pt[r]=s={tokens:this.jt,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.Dt)||i.call(this,t)),0===s.tokens)}stop(){this.Pt={}}}var Y,X,Q,Z="Mobile",tt="iOS",it="Android",et="Tablet",rt=it+" "+et,st="iPad",nt="Apple",ot=nt+" Watch",at="Safari",lt="BlackBerry",ut="Samsung",ht=ut+"Browser",dt=ut+" Internet",vt="Chrome",ct=vt+" OS",ft=vt+" "+tt,pt="Internet Explorer",gt=pt+" "+Z,_t="Opera",mt=_t+" Mini",bt="Edge",yt="Microsoft "+bt,wt="Firefox",xt=wt+" "+tt,Et="Nintendo",St="PlayStation",$t="Xbox",kt=it+" "+Z,Pt=Z+" "+at,It="Windows",Tt=It+" Phone",Rt="Nokia",Ct="Ouya",Ft="Generic",Ot=Ft+" "+Z.toLowerCase(),Mt=Ft+" "+et.toLowerCase(),At="Konqueror",Dt="(\\d+(\\.\\d+)?)",jt=new RegExp("Version/"+Dt),Lt=new RegExp($t,"i"),zt=new RegExp(St+" \\w+","i"),Ut=new RegExp(Et+" \\w+","i"),Nt=new RegExp(lt+"|PlayBook|BB10","i"),Ht={"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"},Bt=function(t,i){return i=i||"",w(t," OPR/")&&w(t,"Mini")?mt:w(t," OPR/")?_t:Nt.test(t)?lt:w(t,"IE"+Z)||w(t,"WPDesktop")?gt:w(t,ht)?dt:w(t,bt)||w(t,"Edg/")?yt:w(t,"FBIOS")?"Facebook "+Z:w(t,"UCWEB")||w(t,"UCBrowser")?"UC Browser":w(t,"CriOS")?ft:w(t,"CrMo")||w(t,vt)?vt:w(t,it)&&w(t,at)?kt:w(t,"FxiOS")?xt:w(t.toLowerCase(),At.toLowerCase())?At:((t,i)=>i&&w(i,nt)||function(t){return w(t,at)&&!w(t,vt)&&!w(t,it)}(t))(t,i)?w(t,Z)?Pt:at:w(t,wt)?wt:w(t,"MSIE")||w(t,"Trident/")?pt:w(t,"Gecko")?wt:""},qt={[gt]:[new RegExp("rv:"+Dt)],[yt]:[new RegExp(bt+"?\\/"+Dt)],[vt]:[new RegExp("("+vt+"|CrMo)\\/"+Dt)],[ft]:[new RegExp("CriOS\\/"+Dt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Dt)],[at]:[jt],[Pt]:[jt],[_t]:[new RegExp("(Opera|OPR)\\/"+Dt)],[wt]:[new RegExp(wt+"\\/"+Dt)],[xt]:[new RegExp("FxiOS\\/"+Dt)],[At]:[new RegExp("Konqueror[:/]?"+Dt,"i")],[lt]:[new RegExp(lt+" "+Dt),jt],[kt]:[new RegExp("android\\s"+Dt,"i")],[dt]:[new RegExp(ht+"\\/"+Dt)],[pt]:[new RegExp("(rv:|MSIE )"+Dt)],Mozilla:[new RegExp("rv:"+Dt)]},Wt=function(t,i){var e=Bt(t,i),r=qt[e];if(F(r))return null;for(var s=0;r.length>s;s++){var n=t.match(r[s]);if(n)return parseFloat(n[n.length-2])}return null},Vt=[[new RegExp($t+"; "+$t+" (.*?)[);]","i"),t=>[$t,t&&t[1]||""]],[new RegExp(Et,"i"),[Et,""]],[new RegExp(St,"i"),[St,""]],[Nt,[lt,""]],[new RegExp(It,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Tt,""];if(new RegExp(Z).test(i)&&!/IEMobile\b/.test(i))return[It+" "+Z,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Ht[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[It,r]}return[It,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[tt,[t[3],t[4],t[5]||"0"].join(".")]:[tt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=F(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+it+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+it+")","i"),t=>t&&t[2]?[it,[t[2],t[3],t[4]||"0"].join(".")]:[it,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ct,""]],[/Linux|debian/i,["Linux",""]]],Gt=function(t){return Ut.test(t)?Et:zt.test(t)?St:Lt.test(t)?$t:new RegExp(Ct,"i").test(t)?Ct:new RegExp("("+Tt+"|WPDesktop)","i").test(t)?Tt:/iPad/.test(t)?st:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ot:Nt.test(t)?lt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Rt,"i").test(t)?Rt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Z).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?it:rt:new RegExp("(pda|"+Z+")","i").test(t)?Ot:new RegExp(et,"i").test(t)&&!new RegExp(et+" pc","i").test(t)?Mt:""},Jt=t=>t instanceof Error;function Kt(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Q&&e.length===X||(X=e.length,Q=e.reduce(((e,r)=>{Y||(Y={});var s=Y[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=i[r];if(l&&u){e[l]=u,Y[r]=[l,u];break}}return e}),{})),Q}}class Yt{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return f((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&I(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),p({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return f((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,i){var e,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,p({},i,{handled:!0}))),o}buildParsingContext(t){var i;return{chunkIdMap:Kt(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return p({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}var Xt="?";function Qt(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?Xt:e,in_app:!0};return F(r)||(n.lineno=r),F(s)||(n.colno=s),n}var Zt=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:Xt,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},ti=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ii=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ei=/\((\S*)(?::(\d+))(?::(\d+))\)/,ri=(t,i)=>{var e=ti.exec(t);if(e){var[,r,s,n]=e;return Qt(i,r,Xt,+s,+n)}var o=ii.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=ei.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Zt(o[1]||Xt,o[2]);return Qt(i,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},si=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ni=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,oi=(t,i)=>{var e=si.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=ni.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||Xt;return[n,s]=Zt(n,s),Qt(i,s,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ai=/\(error: (.*)\)/;class li{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=O(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return B(t,"DOMException")}isDOMError(t){return B(t,"DOMError")}}class ui{match(t){return(t=>t instanceof Error)(t)}coerce(t,i){return{type:this.getType(t),value:this.getMessage(t,i),stack:this.getStack(t),cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}}class hi{constructor(){}match(t){return B(t,"ErrorEvent")&&null!=t.error}coerce(t,i){var e;return i.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}var di=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class vi{match(t){return"string"==typeof t}coerce(t,i){var e,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(di);return r&&(i=r[1],e=r[2]),[i,e]}}var ci=["fatal","error","warning","log","info","debug"];function fi(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}class pi{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r=this.getErrorPropertyFromObject(t);return r?i.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(e=i.syntheticException)?void 0:e.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return q(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+fi(t)}isSeverityLevel(t){return O(t)&&!M(t)&&ci.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(Jt(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class gi{match(t){return q(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+fi(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class _i{match(t){return H(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class mi{match(t){return B(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!q(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return H(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var bi=function(i,e){var{debugEnabled:r}=void 0===e?{}:e,s={C(e){if(t&&(v.DEBUG||h.POSTHOG_DEBUG||r)&&!F(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[e]?t.console[e].__rrweb_original__:t.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(i,...o)}},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.C("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.C("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.C("error",...i)},critical(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];console.error(i,...e)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,e)=>bi(i+" "+t,e)};return s},yi=bi("[PostHog.js]"),wi=yi.createLogger,xi=wi("[ExternalScriptsLoader]"),Ei=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return xi.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var s=null==r?void 0:r.querySelectorAll("script");if(s)for(var n,o=function(){if(s[a].src===i){var t=s[a];return t.__posthog_loading_callback_fired?{v:e()}:(t.addEventListener("load",(i=>{t.__posthog_loading_callback_fired=!0,e(void 0,i)})),t.onerror=t=>e(t),{v:void 0})}},a=0;s.length>a;a++)if(n=o())return n.v;var l=()=>{if(!r)return e("document not found");var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=i,s.onload=t=>{s.__posthog_loading_callback_fired=!0,e(void 0,t)},s.onerror=t=>e(t),t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?l():null==r||r.addEventListener("DOMContentLoaded",l)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{var r="/static/"+i+".js?v="+t.version;if("remote-config"===i&&(r="/array/"+t.config.token+"/config.js"),"toolbar"===i){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=t.requestRouter.endpointFor("assets",r);Ei(t,n,e)},h.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);Ei(t,r,e)};var Si="$people_distinct_id",$i="$device_id",ki="__alias",Pi="__timers",Ii="$autocapture_disabled_server_side",Ti="$heatmaps_enabled_server_side",Ri="$exception_capture_enabled_server_side",Ci="$error_tracking_suppression_rules",Fi="$error_tracking_capture_extension_exceptions",Oi="$web_vitals_enabled_server_side",Mi="$dead_clicks_enabled_server_side",Ai="$product_tours_enabled_server_side",Di="$web_vitals_allowed_metrics",ji="$session_recording_remote_config",Li="$sesid",zi="$session_is_sampled",Ui="$enabled_feature_flags",Ni="$early_access_features",Hi="$feature_flag_details",Bi="$stored_person_properties",qi="$stored_group_properties",Wi="$surveys",Vi="$flag_call_reported",Gi="$flag_call_reported_session_id",Ji="$feature_flag_errors",Ki="$feature_flag_evaluated_at",Yi="$user_state",Xi="$client_session_props",Qi="$capture_rate_limit",Zi="$initial_campaign_params",te="$initial_referrer_info",ie="$initial_person_info",ee="$epp",re="__POSTHOG_TOOLBAR__",se="$posthog_cookieless",ne=[Si,ki,"__cmpns",Pi,"$session_recording_enabled_server_side",Ti,Li,Ui,Ci,Yi,Ni,Hi,qi,Bi,Wi,Vi,Gi,Ji,Ki,Xi,Qi,Zi,te,ee,ie],oe="PostHog loadExternalDependency extension not found.",ae="on_reject",le="always",ue="anonymous",he="identified",de="identified_only",ve="visibilitychange",ce="beforeunload",fe="$pageview",pe="$pageleave",ge="$identify",_e="$groupidentify";function me(t,i){I(t)&&t.forEach(i)}function be(t,i){if(!D(t))if(I(t))t.forEach(i);else if(U(t))t.forEach(((t,e)=>i(t,e)));else for(var e in t)k.call(t,e)&&i(t[e],e)}var ye=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function we(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var xe=function(t){try{return t()}catch(t){return}},Ee=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){yi.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),yi.critical(t)}}},Se=function(t){var i={};return be(t,(function(t,e){(O(t)&&t.length>0||j(t))&&(i[e]=t)})),i};var $e=["herokuapp.com","vercel.app","netlify.app"];function ke(t){var i=null==t?void 0:t.hostname;if(!O(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of $e)if(e===r)return!1;return!0}function Pe(t,i,e,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:s,passive:n})}function Ie(t){return"ph_toolbar_internal"===t.name}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return j(t)&&isFinite(t)&&Math.floor(t)===t});class Te{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||0>t||0>i||0>e||0>r||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Te(s)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Te(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class Re{constructor(){this.I=0,this.S=0,this.k=new Oe}generate(){var t=this.generateOrAbort();if(F(t)){this.I=0;var i=this.generateOrAbort();if(F(i))throw new Error("Could not generate UUID after timestamp reset");return i}return t}generateOrAbort(){var t=Date.now();if(t>this.I)this.I=t,this.A();else{if(this.I>=t+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Te.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}var Ce,Fe=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!F(t.crypto)&&crypto.getRandomValues&&(Fe=t=>crypto.getRandomValues(t));class Oe{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(Fe(this.T),this.N=0),this.T[this.N++]}}var Me=()=>Ae().toString(),Ae=()=>(Ce||(Ce=new Re)).generate(),De="",je=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Le={Yt:()=>!!r,Ut(t){yi.error("cookieStore error: "+t)},Wt(t){if(r){try{for(var i=t+"=",e=r.cookie.split(";").filter((t=>t.length)),s=0;e.length>s;s++){for(var n=e[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(i))return decodeURIComponent(n.substring(i.length,n.length))}}catch(t){}return null}},Gt(t){var i;try{i=JSON.parse(Le.Wt(t))||{}}catch(t){}return i},Xt(t,i,e,s,n){if(r)try{var o="",a="",l=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=r),De)return De;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),s=Math.min(e.length,8),n="dmn_chk_"+Me();!De&&s--;){var o=e.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(n)&&(i.cookie=a+";max-age=0",De=o)}return De}(t);if(!e){var s=(t=>{var i=t.match(je);return i?i[0]:""})(t);s!==e&&yi.info("Warning: cookie subdomain discovery mismatch",s,e),e=s}return e?"; domain=."+e:""}return""}(r.location.hostname,s);if(e){var u=new Date;u.setTime(u.getTime()+864e5*e),o="; expires="+u.toUTCString()}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+o+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&yi.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,h}catch(t){return}},Jt(t,i){if(null!=r&&r.cookie)try{Le.Xt(t,"",-1,i)}catch(t){return}}},ze=null,Ue={Yt(){if(!A(ze))return ze;var i=!0;if(F(t))i=!1;else try{var e="__mplssupport__";Ue.Xt(e,"xyz"),'"xyz"'!==Ue.Wt(e)&&(i=!1),Ue.Jt(e)}catch(t){i=!1}return i||yi.error("localStorage unsupported; falling back to cookie store"),ze=i,i},Ut(t){yi.error("localStorage error: "+t)},Wt(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){Ue.Ut(t)}return null},Gt(t){try{return JSON.parse(Ue.Wt(t))||{}}catch(t){}return null},Xt(i,e){try{null==t||t.localStorage.setItem(i,JSON.stringify(e))}catch(t){Ue.Ut(t)}},Jt(i){try{null==t||t.localStorage.removeItem(i)}catch(t){Ue.Ut(t)}}},Ne=[$i,"distinct_id",Li,zi,ee,ie,Yi],He={},Be={Yt:()=>!0,Ut(t){yi.error("memoryStorage error: "+t)},Wt:t=>He[t]||null,Gt:t=>He[t]||null,Xt(t,i){He[t]=i},Jt(t){delete He[t]}},qe=null,We={Yt(){if(!A(qe))return qe;if(qe=!0,F(t))qe=!1;else try{var i="__support__";We.Xt(i,"xyz"),'"xyz"'!==We.Wt(i)&&(qe=!1),We.Jt(i)}catch(t){qe=!1}return qe},Ut(t){yi.error("sessionStorage error: ",t)},Wt(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){We.Ut(t)}return null},Gt(t){try{return JSON.parse(We.Wt(t))||null}catch(t){}return null},Xt(i,e){try{null==t||t.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){We.Ut(t)}},Jt(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){We.Ut(t)}}};class Ve{constructor(t){this._instance=t}get Rt(){return this._instance.config}get consent(){return this.Kt()?0:this.Qt}isOptedOut(){return this.Rt.cookieless_mode===le||0===this.consent||-1===this.consent&&(this.Rt.opt_out_capturing_by_default||this.Rt.cookieless_mode===ae)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}optInOut(t){this.tr.Xt(this.er,t?1:0,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}reset(){this.tr.Jt(this.er,this.Rt.cross_subdomain_cookie)}get er(){var{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get Qt(){var t=this.tr.Wt(this.er);return V(t)?1:w(G,t)?0:-1}get tr(){var t=this.Rt.opt_out_capturing_persistence_type,i="localStorage"===t?Ue:Le;if(!this.rr||this.rr!==i){this.rr=i;var e="localStorage"===t?Le:Ue;e.Wt(this.er)&&(this.rr.Wt(this.er)||this.optInOut(V(e.Wt(this.er))),e.Jt(this.er,this.Rt.cross_subdomain_cookie))}return this.rr}Kt(){return!!this.Rt.respect_dnt&&[null==e?void 0:e.doNotTrack,null==e?void 0:e.msDoNotTrack,h.doNotTrack].some((t=>V(t)))}}var Ge=wi("[Dead Clicks]"),Je=()=>!0,Ke=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Mi)),r=t.instance.config.capture_dead_clicks;return z(r)?r:!!R(r)||e};class Ye{get lazyLoadedDeadClicksAutocapture(){return this.ir}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Mi]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.nr((()=>{this.sr()})):this.stop()}nr(t){var i,e;null!=(i=h.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Ge.error("failed to load script",i):t()}))}sr(){var t;if(r){if(!this.ir&&null!=(t=h.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=R(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.ir=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.ir.start(r),Ge.info("starting...")}}else Ge.error("`document` not found. Cannot start.")}stop(){this.ir&&(this.ir.stop(),this.ir=void 0,Ge.info("stopping..."))}}var Xe=wi("[SegmentIntegration]");var Qe="posthog-js";function Ze(t,i){var{organization:e,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===i?{}:i;return i=>{var a,l,u,h,d;if("*"!==n&&!n.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,f=(null==(a=i.exception)?void 0:a.values)||[],g=f.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(l=f[0])?void 0:l.value)||i.message,$exception_type:null==(u=f[0])?void 0:u.type,$exception_level:i.level,$exception_list:g,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(h=f[0])?void 0:h.value)||i.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:i.tags};return e&&r&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+e+"/issues/?project="+r+"&query="+i.event_id),o&&(null==(c=t.exceptions)||c.sendExceptionEvent(_)),i}}class tr{constructor(t,i,e,r,s,n){this.name=Qe,this.setupOnce=function(o){o(Ze(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class ir{constructor(t){this.ar=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength)&&(yi.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.lr=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ur()}ur(){var t;this.hr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.ar)}destroy(){var t;null==(t=this.hr)||t.call(this),this.hr=void 0}doPageView(i,e){var r,s=this.cr(i,e);return this.lr={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.cr(t,null==(i=this.lr)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.lr)?void 0:t.pageViewId}}cr(t,i){var e=this.lr;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:h}=s;if(!(F(n)||F(o)||F(a)||F(l)||F(u)||F(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?J(o/n,0,1,yi):1,v=n>1?J(a/n,0,1,yi):1,c=l>1?J(u/l,0,1,yi):1,f=l>1?J(h/l,0,1,yi):1;r=ye(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var er=t=>{var i=null==r?void 0:r.createElement("a");return F(i)?null:(i.href=t,i)},rr=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!I(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){yi.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},sr=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");I(d)&&(i.includes(d[0])?u.push(d[0]+"="+e):u.push(l[h]))}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},nr=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},or="https?://(.*)",ar=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],lr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ar],ur="<masked>",hr=["li_fat_id"];function dr(t,i,e){if(!r)return{};var s,n=i?[...ar,...e||[]]:[],o=vr(sr(r.URL,n,ur),t),a=(s={},be(hr,(function(t){var i=Le.Wt(t);s[t]=i||null})),s);return ye(a,o)}function vr(t,i){var e=lr.concat(i||[]),r={};return be(e,(function(i){var e=rr(t,i);r[i]=e||null})),r}function cr(t){var i=function(t){return t?0===t.search(or+"google.([^/?]*)")?"google":0===t.search(or+"bing.com")?"bing":0===t.search(or+"yahoo.com")?"yahoo":0===t.search(or+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",s={};if(!A(i)){s.$search_engine=i;var n=r?rr(r.referrer,e):"";n.length&&(s.ph_keyword=n)}return s}function fr(){return navigator.language||navigator.userLanguage}var pr="$direct";function gr(){return(null==r?void 0:r.referrer)||pr}function _r(t,i){var e=t?[...ar,...i||[]]:[],r=null==s?void 0:s.href.substring(0,1e3);return{r:gr().substring(0,1e3),u:r?sr(r,e,ur):void 0}}function mr(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:e==pr?pr:null==(i=er(e))?void 0:i.host};if(r){s.$current_url=r;var n=er(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=vr(r);ye(s,o)}if(e){var a=cr(e);ye(s,a)}return s}function br(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function yr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var wr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class xr{constructor(t,i){this.Rt=t,this.props={},this.dr=!1,this.vr=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.tr=this.pr(t),this.load(),t.debug&&yi.info("Persistence loaded",t.persistence,p({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.gr}pr(i){-1===wr.indexOf(i.persistence.toLowerCase())&&(yi.critical("Unknown persistence type "+i.persistence+"; falling back to localStorage+cookie"),i.persistence="localStorage+cookie");var e=function(i){void 0===i&&(i=[]);var e=[...Ne,...i];return p({},Ue,{Gt(t){try{var i={};try{i=Le.Gt(t)||{}}catch(t){}var e=ye(i,JSON.parse(Ue.Wt(t)||"{}"));return Ue.Xt(t,e),e}catch(t){}return null},Xt(t,i,r,s,n,o){try{Ue.Xt(t,i,void 0,void 0,o);var a={};e.forEach((t=>{i[t]&&(a[t]=i[t])})),Object.keys(a).length&&Le.Xt(t,a,r,s,n,o)}catch(t){Ue.Ut(t)}},Jt(i,e){try{null==t||t.localStorage.removeItem(i),Le.Jt(i,e)}catch(t){Ue.Ut(t)}}})}(i.cookie_persisted_properties||[]),r=i.persistence.toLowerCase();return"localstorage"===r&&Ue.Yt()?Ue:"localstorage+cookie"===r&&e.Yt()?e:"sessionstorage"===r&&We.Yt()?We:"memory"===r?Be:"cookie"===r?Le:e.Yt()?e:Le}mr(t){var i=null!=t?t:this.Rt.feature_flag_cache_ttl_ms;if(!i||0>=i)return!1;var e=this.props[Ki];return!e||"number"!=typeof e||Date.now()-e>i}properties(){var t={};return be(this.props,((i,e)=>{if(e===Ui&&R(i)){if(!this.mr())for(var r=Object.keys(i),s=0;r.length>s;s++)t["$feature/"+r[s]]=i[r[s]]}else-1===ne.indexOf(e)&&(t[e]=i)})),t}load(){if(!this.gr){var t=this.tr.Gt(this.vr);t&&(this.props=ye({},t))}}save(){this.gr||this.tr.Xt(this.vr,this.props,this.yr,this.br,this.wr,this.Rt.debug)}remove(){this.tr.Jt(this.vr,!1),this.tr.Jt(this.vr,!0)}clear(){this.remove(),this.props={}}register_once(t,i,e){if(R(t)){F(i)&&(i="None"),this.yr=F(e)?this._r:e;var r=!1;if(be(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.props[e]=t,r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(R(t)){this.yr=F(i)?this._r:i;var e=!1;if(be(t,((i,r)=>{t.hasOwnProperty(r)&&this.props[r]!==i&&(this.props[r]=i,e=!0)})),e)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.dr){var t=dr(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);C(Se(t))||this.register(t),this.dr=!0}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?cr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:gr(),$referring_domain:null!=r&&r.referrer&&(null==(t=er(r.referrer))?void 0:t.host)||pr},void 0)}set_initial_person_info(){this.props[Zi]||this.props[te]||this.register_once({[ie]:_r(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};be([te,Zi],(i=>{var e=this.props[i];e&&be(e,(function(i,e){t["$initial_"+E(e)]=i}))}));var i,e,r=this.props[ie];if(r){var s=(i=mr(r),e={},be(i,(function(t,i){e["$initial_"+E(i)]=t})),e);ye(t,s)}return t}safe_merge(t){return be(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this._r=this.yr=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!e),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==i.persistence||!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every(((t,i)=>t===r[i]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[])){var r=this.pr(t),s=this.props;this.clear(),this.tr=r,this.props=s,this.save()}}set_disabled(t){this.gr=t,this.gr?this.remove():this.save()}set_cross_subdomain(t){t!==this.br&&(this.br=t,this.remove(),this.save())}set_secure(t){t!==this.wr&&(this.wr=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[Pi]||{};e[t]=i,this.props[Pi]=e,this.save()}remove_event_timer(t){var i=(this.props[Pi]||{})[t];return F(i)||(delete this.props[Pi][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}var Er="events",Sr="cancelEvents",$r="survey shown",kr="survey sent",Pr="popover",Ir=wi("[RateLimiter]");class Tr{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{Ir.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Ir.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(Qi))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;return l||t||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Qi,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var Rr=wi("[RemoteConfig]");class Cr{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ir(t){var i,e;null!=(i=h.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Cr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(i){t(i.json)}})}load(){try{if(this.remoteConfig)return Rr.info("Using preloaded remote config",this.remoteConfig),this.Sr(this.remoteConfig),void this.kr();if(this._instance.Tr())return void Rr.warn("Remote config is disabled. Falling back to local config.");this.Ir((t=>{if(!t)return Rr.info("No config found after loading remote JS config. Falling back to JSON."),void this.Cr((t=>{this.Sr(t),this.kr()}));this.Sr(t),this.kr()}))}catch(t){Rr.error("Error loading remote config",t)}}stop(){this.Ar&&(clearInterval(this.Ar),this.Ar=void 0)}refresh(){this._instance.Tr()||"hidden"===(null==r?void 0:r.visibilityState)||this._instance.reloadFeatureFlags()}kr(){var t;if(!this.Ar){var i=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==i&&(this.Ar=setInterval((()=>{this.refresh()}),i))}}Sr(t){var i;t||Rr.error("Failed to fetch remote config from PostHog."),this._instance.Sr(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded())}}var Fr="gzip-js",Or="base64",Mr=Uint8Array,Ar=Uint16Array,Dr=Uint32Array,jr=new Mr([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]),Lr=new Mr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),zr=new Mr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ur=function(t,i){for(var e=new Ar(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new Dr(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},Nr=Ur(jr,2),Hr=Nr[1];Nr[0][28]=258,Hr[258]=28;for(var Br=Ur(Lr,0)[1],qr=new Ar(32768),Wr=0;32768>Wr;++Wr){var Vr=(43690&Wr)>>>1|(21845&Wr)<<1;qr[Wr]=((65280&(Vr=(61680&(Vr=(52428&Vr)>>>2|(13107&Vr)<<2))>>>4|(3855&Vr)<<4))>>>8|(255&Vr)<<8)>>>1}var Gr=function(t,i,e){for(var r=t.length,s=0,n=new Ar(i);r>s;++s)++n[t[s]-1];var o,a=new Ar(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Ar(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],h=i-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;v>=d;++d)o[qr[d]>>>l]=u}else for(o=new Ar(r),s=0;r>s;++s)o[s]=qr[a[t[s]-1]++]>>>15-t[s];return o},Jr=new Mr(288);for(Wr=0;144>Wr;++Wr)Jr[Wr]=8;for(Wr=144;256>Wr;++Wr)Jr[Wr]=9;for(Wr=256;280>Wr;++Wr)Jr[Wr]=7;for(Wr=280;288>Wr;++Wr)Jr[Wr]=8;var Kr=new Mr(32);for(Wr=0;32>Wr;++Wr)Kr[Wr]=5;var Yr=Gr(Jr,9,0),Xr=Gr(Kr,5,0),Qr=function(t){return(t/8>>0)+(7&t&&1)},Zr=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Ar?Ar:t instanceof Dr?Dr:Mr)(e-i);return r.set(t.subarray(i,e)),r},ts=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},is=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},es=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Mr(0),0];if(1==s){var o=new Mr(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],u=0,h=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=e[e[d].f>e[u].f?u++:d++],l=e[u!=h&&e[d].f>e[u].f?u++:d++],e[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new Ar(v+1),f=rs(e[h-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var b=n[r].s;i>c[b]?p-=1<<i-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new Mr(c),f]},rs=function(t,i,e){return-1==t.s?Math.max(rs(t.l,i,e+1),rs(t.r,i,e+1)):i[t.s]=e},ss=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Ar(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},ns=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},os=function(t,i,e){var r=e.length,s=Qr(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=e[n];return 8*(s+4+r)},as=function(t,i,e,r,s,n,o,a,l,u,h){ts(i,h++,e),++s[256];for(var d=es(s,15),v=d[0],c=d[1],f=es(n,15),p=f[0],g=f[1],_=ss(v),m=_[0],b=_[1],y=ss(p),w=y[0],x=y[1],E=new Ar(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var k=es(E,7),P=k[0],I=k[1],T=19;T>4&&!P[zr[T-1]];--T);var R,C,F,O,M=u+5<<3,A=ns(s,Jr)+ns(n,Kr)+o,D=ns(s,v)+ns(n,p)+o+14+3*T+ns(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(A>=M&&D>=M)return os(i,h,t.subarray(l,l+u));if(ts(i,h,1+(A>D)),h+=2,A>D){R=Gr(v,c,0),C=v,F=Gr(p,g,0),O=p;var j=Gr(P,I,0);for(ts(i,h,b-257),ts(i,h+5,x-1),ts(i,h+10,T-4),h+=14,S=0;T>S;++S)ts(i,h+3*S,P[zr[S]]);h+=3*T;for(var L=[m,w],z=0;2>z;++z){var U=L[z];for(S=0;U.length>S;++S)ts(i,h,j[N=31&U[S]]),h+=P[N],N>15&&(ts(i,h,U[S]>>>5&127),h+=U[S]>>>12)}}else R=Yr,C=Jr,F=Xr,O=Kr;for(S=0;a>S;++S)if(r[S]>255){var N;is(i,h,R[257+(N=r[S]>>>18&31)]),h+=C[N+257],N>7&&(ts(i,h,r[S]>>>23&31),h+=jr[N]);var H=31&r[S];is(i,h,F[H]),h+=O[H],H>3&&(is(i,h,r[S]>>>5&8191),h+=Lr[H])}else is(i,h,R[r[S]]),h+=C[r[S]];return is(i,h,R[256]),h+C[256]},ls=new Dr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),us=function(){for(var t=new Dr(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),hs=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function ds(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=us[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,u=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new Mr(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!i||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=os(l,u,t.subarray(h,d)):(l[h]=!0,u=os(l,u,t.subarray(h,o)))}else{for(var v=ls[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new Ar(32768),_=new Ar(p+1),m=Math.ceil(e/3),b=2*m,y=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<b)&p},w=new Dr(25e3),x=new Ar(288),E=new Ar(32),S=0,k=0,P=(h=0,0),I=0,T=0;o>h;++h){var R=y(h),C=32767&h,F=_[R];if(g[C]=F,_[R]=C,h>=I){var O=o-h;if((S>7e3||P>24576)&&O>423){u=as(t,l,0,w,x,E,k,P,T,h-T,u),P=S=k=0,T=h;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)E[M]=0}var A=2,D=0,j=f,L=C-F&32767;if(O>2&&R==y(h-L))for(var z=Math.min(c,O)-1,U=Math.min(32767,h),N=Math.min(258,O);U>=L&&--j&&C!=F;){if(t[h+A]==t[h+A-L]){for(var H=0;N>H&&t[h+H]==t[h+H-L];++H);if(H>A){if(A=H,D=L,H>z)break;var B=Math.min(L,H-2),q=0;for(M=0;B>M;++M){var W=h-L+M+32768&32767,V=W-g[W]+32768&32767;V>q&&(q=V,F=W)}}}L+=(C=F)-(F=g[C])+32768&32767}if(D){w[P++]=268435456|Hr[A]<<18|Br[D];var G=31&Hr[A],J=31&Br[D];k+=jr[G]+Lr[J],++x[257+G],++E[J],I=h+A,++S}else w[P++]=t[h],++x[t[h]]}}u=as(t,l,!0,w,x,E,k,P,T,h-T,u)}return Zr(a,0,r+Qr(u)+s)}(n=t,null==(o=i).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)),h=u.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&hs(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(u,i),hs(u,h-8,e.d()),hs(u,h-4,r),u}var vs=!!o||!!n,cs="text/plain",fs=function(t,i,e){var r;void 0===e&&(e=!0);var[s,n]=t.split("?"),o=p({},i),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var i,[r,s]=t.split("="),n=e&&null!==(i=o[r])&&void 0!==i?i:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],l=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return be(t,(function(t,i){F(t)||F(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)}(o);return l&&a.push(l),s+"?"+a.join("&")},ps=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),gs=t=>{if(t.zt)return t.zt;var{data:i,compression:e}=t;if(i){if(e===Fr){var r=ds(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Mr(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;e>o;++o){if(s+5>r.length){var a=new Mr(s+8+(e-o<<1));a.set(r),r=a}var l=t.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&t.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 Zr(r,0,s)}(ps(i)),{mtime:0});return{contentType:cs,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Or){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,i)=>String.fromCharCode(parseInt(i,16))))):t}(ps(i)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:ps(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=ps(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},_s=function(){var t=f((function*(t){var i=ps(t.data),e=yield function(t,i){return _.apply(this,arguments)}(i,v.DEBUG);if(!e)return t;var r=yield e.arrayBuffer();return p({},t,{zt:{contentType:cs,body:r,estimatedSize:r.byteLength}})}));return function(i){return t.apply(this,arguments)}}(),ms=[];n&&ms.push({transport:"fetch",method(t){var i,e,{contentType:r,body:s,estimatedSize:o}=null!==(i=gs(t))&&void 0!==i?i:{},l=new Headers;be(t.headers,(function(t,i){l.append(i,t)})),r&&l.append("Content-Type",r);var u=t.url,h=null;if(a){var d=new a;h={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}n(u,p({method:(null==t?void 0:t.method)||"GET",headers:l,keepalive:"POST"===t.method&&52428.8>(o||0),body:s,signal:null==(e=h)?void 0:e.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){yi.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{yi.error(i),null==t.callback||t.callback({statusCode:0,error:i})})).finally((()=>h?clearTimeout(h.timeout):null))}}),o&&ms.push({transport:"XHR",method(t){var i,e=new o;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=gs(t))&&void 0!==i?i:{};be(t.headers,(function(t,i){e.setRequestHeader(i,t)})),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),t.disableXHRCredentials||(e.withCredentials=!0),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(s)}}),null!=e&&e.sendBeacon&&ms.push({transport:"sendBeacon",method(t){var i=fs(t.url,{beacon:"1"});try{var r,{contentType:s,body:n}=null!==(r=gs(t))&&void 0!==r?r:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:s});e.sendBeacon(i,o)}catch(t){}}});var bs=3e3;class ys{constructor(t,i){this.Er=!0,this.Rr=[],this.Nr=J((null==i?void 0:i.flush_interval_ms)||bs,250,5e3,yi.createLogger("flush interval"),bs),this.Mr=t}enqueue(t){this.Rr.push(t),this.Fr||this.Or()}unload(){this.Pr();var t=this.Rr.length>0?this.Lr():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Mr(p({},t,{transport:"sendBeacon"}))}))}enable(){this.Er=!1,this.Or()}Or(){var t=this;this.Er||(this.Fr=setTimeout((()=>{if(this.Pr(),this.Rr.length>0){var i=this.Lr(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&I(e.data)&&be(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Mr(e)};for(var r in i)e()}}),this.Nr))}Pr(){clearTimeout(this.Fr),this.Fr=void 0}Lr(){var t={};return be(this.Rr,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;F(t[s])&&(t[s]=p({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.Rr=[],t}}var ws=["retriesPerformedSoFar"];class xs{constructor(i){this.Dr=!1,this.Br=3e3,this.Rr=[],this._instance=i,this.Rr=[],this.jr=!0,!F(t)&&"onLine"in t.navigator&&(this.jr=t.navigator.onLine,this.qr=()=>{this.jr=!0,this.Zr()},this.$r=()=>{this.jr=!1},Pe(t,"online",this.qr),Pe(t,"offline",this.$r))}get length(){return this.Rr.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,e=g(t,ws);L(i)&&(e.url=fs(e.url,{retry_count:i})),this._instance._send_request(p({},e,{callback:t=>{200===t.statusCode||t.statusCode>=400&&500>t.statusCode||(null!=i?i:0)>=10?null==e.callback||e.callback(t):this.Hr(p({retriesPerformedSoFar:i},e))}}))}Hr(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=Math.random()-.5;return Math.ceil(r+s*(r-e))}(i),r=Date.now()+e;this.Rr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),yi.warn(s),this.Dr||(this.Dr=!0,this.Vr())}Vr(){if(this.zr&&clearTimeout(this.zr),0===this.Rr.length)return this.Dr=!1,void(this.zr=void 0);this.zr=setTimeout((()=>{this.jr&&this.Rr.length>0&&this.Zr(),this.Vr()}),this.Br)}Zr(){var t=Date.now(),i=[],e=this.Rr.filter((e=>t>e.retryAt||(i.push(e),!1)));if(this.Rr=i,e.length>0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:i}of(this.zr&&(clearTimeout(this.zr),this.zr=void 0),this.Dr=!1,F(t)||(this.qr&&(t.removeEventListener("online",this.qr),this.qr=void 0),this.$r&&(t.removeEventListener("offline",this.$r),this.$r=void 0)),this.Rr))try{this._instance._send_request(p({},i,{transport:"sendBeacon"}))}catch(t){yi.error(t)}this.Rr=[]}}class Es{constructor(t){this.Yr=()=>{var t,i,e,r;this.Ur||(this.Ur={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Ur.lastScrollY=Math.ceil(n),this.Ur.maxScrollY=Math.max(n,null!==(t=this.Ur.maxScrollY)&&void 0!==t?t:0),this.Ur.maxScrollHeight=Math.max(o,null!==(i=this.Ur.maxScrollHeight)&&void 0!==i?i:0),this.Ur.lastContentY=a,this.Ur.maxContentY=Math.max(a,null!==(e=this.Ur.maxContentY)&&void 0!==e?e:0),this.Ur.maxContentHeight=Math.max(l,null!==(r=this.Ur.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Wr(){return this._instance.config.scroll_root_selector}getContext(){return this.Ur}resetContext(){var t=this.Ur;return setTimeout(this.Yr,0),t}startMeasuringScrollPosition(){Pe(t,"scroll",this.Yr,{capture:!0}),Pe(t,"scrollend",this.Yr,{capture:!0}),Pe(t,"resize",this.Yr)}scrollElement(){if(!this.Wr)return null==t?void 0:t.document.documentElement;var i=I(this.Wr)?this.Wr:[this.Wr];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}scrollY(){if(this.Wr){var i=this.scrollElement();return i&&i.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this.Wr){var i=this.scrollElement();return i&&i.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var Ss=t=>_r(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class $s{constructor(t,i,e,r){this.Gr=t=>{var i=this.Xr();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Jr(this._instance)};this.Kr.register({[Xi]:e})}},this._instance=t,this.Qr=i,this.Kr=e,this.Jr=r||Ss,this.Qr.onSessionId(this.Gr)}Xr(){return this.Kr.props[Xi]}getSetOnceProps(){var t,i=null==(t=this.Xr())?void 0:t.props;return i?"r"in i?mr(i):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return be(Se(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+E(e)]=i})),t}}class ks{constructor(){this.ti={}}on(t,i){return this.ti[t]||(this.ti[t]=[]),this.ti[t].push(i),()=>{this.ti[t]=this.ti[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.ti[t]||[])e(i);for(var r of this.ti["*"]||[])r(t,i)}}var Ps=wi("[SessionId]");class Is{on(t,i){return this.ei.on(t,i)}constructor(t,i,e){var r;if(this.ri=[],this.ii=void 0,this.ei=new ks,this.ni=(t,i)=>!(!L(t)||!L(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===le)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=t.config,this.Kr=t.persistence,this.si=void 0,this.oi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ai=i||Me,this.li=e||Me;var s=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*J(this.Rt.session_idle_timeout_seconds||1800,60,36e3,Ps.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ui(),this.hi="ph_"+s+"_window_id",this.ci="ph_"+s+"_primary_window_exists",this.di()){var n=We.Gt(this.hi),o=We.Gt(this.ci);n&&!o?this.si=n:We.Jt(this.hi),We.Xt(this.ci,!0)}if(null!=(r=this.Rt.bootstrap)&&r.sessionID)try{var a=(t=>{var i=this.Rt.bootstrap.sessionID.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})();this.vi(this.Rt.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){Ps.error("Invalid sessionID in bootstrap",t)}this.fi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return F(this.ri)&&(this.ri=[]),this.ri.push(t),this.oi&&t(this.oi,this.si),()=>{this.ri=this.ri.filter((i=>i!==t))}}di(){return"memory"!==this.Rt.persistence&&!this.Kr.gr&&We.Yt()}pi(t){t!==this.si&&(this.si=t,this.di()&&We.Xt(this.hi,t))}gi(){return this.si?this.si:this.di()?We.Gt(this.hi):null}vi(t,i,e){t===this.oi&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.oi=t,this.Kr.register({[Li]:[i,t,e]}))}mi(){var t=this.Kr.props[Li];return I(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.vi(null,null,null)}destroy(){clearTimeout(this.yi),this.yi=void 0,this.ii&&t&&(t.removeEventListener(ce,this.ii,{capture:!1}),this.ii=void 0),this.ri=[]}fi(){this.ii=()=>{this.di()&&We.Jt(this.ci)},Pe(t,ce,this.ii,{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),this.Rt.cookieless_mode===le)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.mi(),o=this.gi(),a=L(n)&&Math.abs(e-n)>864e5,l=!1,u=!s,h=!u&&!t&&this.ni(e,r);u||h||a?(s=this.ai(),o=this.li(),Ps.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.li(),l=!0);var d=L(r)&&t&&!a?r:e,v=L(n)?n:(new Date).getTime();return this.pi(o),this.vi(s,d,v),t||this.ui(),l&&this.ri.forEach((t=>t(s,o,l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}ui(){clearTimeout(this.yi),this.yi=setTimeout((()=>{var[t]=this.mi();if(this.ni((new Date).getTime(),t)){var i=this.oi;this.resetSessionId(),this.ei.emit("forcedIdleReset",{idleSessionId:i})}}),1.1*this.sessionTimeoutMs)}}var Ts=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&y(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>y(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver},Rs=function(t,i){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}};function Cs(t,i,e){return ps({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var Fs={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>Rs(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Rs(i,t))))),icontains:(t,i)=>i.map(Os).some((i=>t.map(Os).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(Os).every((i=>t.map(Os).every((t=>!i.includes(t))))),gt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e>parseFloat(t)))})),lt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e<parseFloat(t)))}))},Os=t=>t.toLowerCase();function Ms(t,i){return!t||Object.entries(t).every((t=>{var[e,r]=t,s=null==i?void 0:i[e];if(F(s)||A(s))return!1;var n=[String(s)],o=Fs[r.operator];return!!o&&o(r.values,n)}))}var As="custom",Ds="i.posthog.com";class js{constructor(t){this.bi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+Ds,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.bi[this.apiHost]||(this.bi[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":As),this.bi[this.apiHost]}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.uiHost+i;if("flags"===t)return this.flagsApiHost+i;if(this.region===As)return this.apiHost+i;var e=Ds+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var Ls=wi("[Surveys]"),zs="seenSurvey_",Us=(t,i)=>{var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e},Ns=t=>((t,i)=>{var e=""+t+i.id;return i.current_iteration&&i.current_iteration>0&&(e=""+t+i.id+"_"+i.current_iteration),e})(zs,t),Hs=["popover","widget","api"],Bs={ignoreConditions:!1,ignoreDelay:!1,displayType:Pr},qs=wi("[PostHog ExternalIntegrations]"),Ws={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Vs{constructor(t){this._instance=t}nr(t,i){var e;null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return qs.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;!r||null!=(e=h.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.nr(Ws[i],(()=>{var e;null==(e=h.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=h.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i]&&(null==(n=h.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[i])||n.stop())};for(var[e,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;i(e)}}}var Gs={},Js=0,Ks=()=>{},Ys='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Xs="Surveys module not available",Qs="sanitize_properties is deprecated. Use before_send instead",Zs="Invalid value for property_denylist config: ",tn="posthog",en=!vs&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),rn=i=>{var e;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ke(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ks,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",__preview_deferred_init_extensions:!1,debug:s&&O(null==s?void 0:s.search)&&-1!==s.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==t||null==(e=t.location)?void 0:e.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(t){yi.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:de,before_send:void 0,request_queue_config:{flush_interval_ms:bs},error_tracking:{},_onCapture:Ks,__preview_eager_load_replay:!1},(t=>({rageclick:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(i))},sn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],nn=t=>{var i={};for(var[e,r]of sn)F(t[e])||(i[r]=t[e]);var s=ye({},i,t);return I(t.property_blacklist)&&(F(t.property_denylist)?s.property_denylist=t.property_blacklist:I(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:yi.error(Zs+t.property_denylist)),s};class on{constructor(){this.__forceAllowLocalhost=!1}get wi(){return this.__forceAllowLocalhost}set wi(t){yi.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class an{Ii(t,i){if(t){var e=this.Ci.indexOf(t);-1!==e&&this.Ci.splice(e,1)}return this.Ci.push(i),null==i.initialize||i.initialize(),i}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new on,this.Si=!1,this.version=v.LIB_VERSION,this.ki=new ks,this.Ci=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=rn(),this.SentryIntegration=tr,this.sentryIntegration=t=>function(t,i){var e=Ze(t,i);return{name:Qe,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.xi=!1,this.Ti=null,this.Ai=null,this.Ei=null,this.scrollManager=new Es(this),this.pageViewManager=new ir(this),this.rateLimiter=new Tr(this),this.requestRouter=new js(this),this.consent=new Ve(this),this.externalIntegrations=new Vs(this);var i=null!==(t=an.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,i,e)=>{var r=O(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=O(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>yi.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==tn){var r,s=null!==(r=Gs[e])&&void 0!==r?r:new an;return s._init(t,i,e),Gs[e]=s,Gs[tn][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s,n;if(void 0===e&&(e={}),F(i)||M(i))return yi.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={},e.debug=this.Ri(e.debug),this.Ni=e,this.Mi=[],e.person_profiles?this.Ai=e.person_profiles:e.process_person&&(this.Ai=e.process_person),this.set_config(ye({},rn(e.defaults),nn(e),{name:r,token:i})),this.config.on_xhr_error&&yi.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:Fr;var o=this.Fi();this.persistence=new xr(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xr(p({},this.config,{persistence:"sessionStorage"}),o);var a=p({},this.persistence.props),l=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Oi=new ys((t=>this.Pi(t)),this.config.request_queue_config),this.Li=new xs(this),this.__request_queue=[];var u=this.config.cookieless_mode===le||this.config.cookieless_mode===ae&&this.consent.isExplicitlyOptedOut();if(u||(this.sessionManager=new Is(this),this.sessionPropsManager=new $s(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(yi.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Di(u)}),0)):(yi.info("Initializing extensions synchronously"),this.Di(u)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&yi.info("Starting in debug mode",{this:this,config:e,thisC:p({},this.config),p:a,s:l}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=p({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=e.bootstrap)?void 0:n.distinctID)){var h=e.bootstrap.distinctID,d=this.get_distinct_id(),c=this.persistence.get_property(Yi);if(e.bootstrap.isIdentifiedID&&null!=d&&d!==h&&c===ue)this.identify(h);else if(e.bootstrap.isIdentifiedID&&null!=d&&d!==h&&c===he)yi.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 f=this.config.get_device_id(Me()),g=e.bootstrap.isIdentifiedID?f:h;this.persistence.set_property(Yi,e.bootstrap.isIdentifiedID?he:ue),this.register({distinct_id:h,$device_id:g})}}if(u)this.register_once({distinct_id:se,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(Me());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(Yi,ue)}return Pe(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),e.segment?function(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||Me();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(Yi,he)),i()},s=e.user();"then"in s&&T(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||Xe.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Xe.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Xe.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,fe),identify:t=>i(t,ge),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}(this,(()=>this.Bi())):this.Bi(),T(this.config._onCapture)&&this.config._onCapture!==Ks&&(yi.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&yi.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}Di(t){var i,e,r,s,n,o,a,l=performance.now(),u=p({},an.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.Ci.push(this.featureFlags=null!==(i=this.featureFlags)&&void 0!==i?i:new u.featureFlags(this)),u.exceptions&&this.Ci.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new u.exceptions(this)),u.historyAutocapture&&this.Ci.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Ci.push(new u.tracingHeaders(this)),u.siteApps&&this.Ci.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.Ci.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Ci.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.Ci.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this)),u.logs&&this.Ci.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this)),u.conversations&&this.Ci.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new u.conversations(this)),u.productTours&&this.Ci.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Ci.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Ci.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Ci.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Ci.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Ke)),u.toolbar&&this.Ci.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new u.toolbar(this)),u.experiments&&this.Ci.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new u.experiments(this)),this.Ci.forEach((t=>{t.initialize&&h.push((()=>{null==t.initialize||t.initialize()}))})),h.push((()=>{if(this.ji){var t=this.ji;this.ji=void 0,this.Sr(t)}})),this.qi(h,l)}qi(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.qi(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){yi.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&yi.info("PostHog extensions initialized ("+r+"ms)")}Sr(t){var i;if(!r||!r.body)return yi.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Sr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.ji=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=w(t.supportedCompression,Fr)?Fr:w(t.supportedCompression,Or)?Or:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Ai?this.Ai:de}),this.Ci.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}Bi(){try{this.config.loaded(this)}catch(t){yi.critical("`loaded` function failed",t)}if(this.Zi(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===le)&&this.$i()}),1),this.Hi=new Cr(this),this.Hi.load()}Zi(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Oi)||t.enable())}_dom_loaded(){this.is_capturing()&&me(this.__request_queue,(t=>this.Pi(t))),this.__request_queue=[],this.Zi()}_handle_unload(){var t,i,e;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.Vi()&&this.capture(pe),null==(i=this.Oi)||i.unload(),null==(e=this.Li)||e.unload()):this.Vi()&&this.capture(pe,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(en?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=fs(t.url,{ip:this.config.ip?1:0}),t.headers=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,s=p({},t);s.timeout=s.timeout||6e4,s.url=fs(s.url,{_:(new Date).getTime().toString(),ver:v.JS_SDK_VERSION,compression:s.compression});var n=null!==(i=s.transport)&&void 0!==i?i:"fetch",o=ms.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(e=null==(r=function(t,i){for(var e=0;t.length>e;e++)if(t[e].transport===n)return t[e]}(o))?void 0:r.method)&&void 0!==e?e:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&s.data&&s.compression===Fr&&l?_s(s).then((t=>{a(t)})).catch((()=>{a(s)})):a(s)})(p({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))))}Pi(t){this.Li?this.Li.retriableRequest(t):this._send_request(t)}_execute_array(t){Js++;try{var i,e=[],r=[],s=[];me(t,(t=>{t&&(I(i=t[0])?s.push(t):T(t)?t.call(this):I(t)&&"alias"===i?e.push(t):I(t)&&-1!==i.indexOf("capture")&&T(this[i])?s.push(t):r.push(t))}));var n=function(t,i){me(t,(function(t){if(I(t[0])){var e=i;be(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else i[t[0]].apply(i,t.slice(1))}))};n(e,this),n(r,this),n(s,this)}finally{Js--}}push(t){if(Js>0&&I(t)&&O(t[0])){var i=an.prototype[t[0]];T(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,e){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Oi){if(this.is_capturing())if(!F(t)&&O(t)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=i&&i.$current_url&&!O(null==i?void 0:i.$current_url)&&(yi.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=e&&e.zi||yi.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,d=(null==e?void 0:e.timestamp)||h,v=Me(),c={uuid:v,event:t,properties:this.calculateEventProperties(t,i||{},d,v)};t===fe&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),u&&(c.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==e?void 0:e.$set)&&(c.$set=null==e?void 0:e.$set);var f,g=this.Yi(null==e?void 0:e.$set_once,t!==_e,t===ge);if(g&&(c.$set_once=g),null!=e&&e._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>O(t)?t.slice(0,s):t,a=new Set,c=function t(i,e){return i!==Object(i)?o?o(i):i:a.has(i)?void 0:(a.add(i),I(i)?(r=[],me(i,(i=>{r.push(t(i))}))):(r={},be(i,((i,e)=>{a.has(i)||(r[e]=t(i,e))}))),r);var r}(n)),c.timestamp=d,F(null==e?void 0:e.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=h),"survey dismissed"===t||t===kr){var _=null==i?void 0:i.$survey_id,m=null==i?void 0:i.$survey_iteration;f={id:_,current_iteration:m},localStorage.getItem(Ns(f))||localStorage.setItem(Ns(f),"true"),c.$set=p({},c.$set,{[Us({id:_,current_iteration:m},t===kr?"responded":"dismissed")]:!0})}else t===$r&&(c.$set=p({},c.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var b=null==i?void 0:i.$product_tour_type;b&&(c.$set=p({},c.$set,{["$product_tour_last_seen_date/"+b]:(new Date).toISOString()}))}var y=p({},c.properties.$set,c.$set);if(C(y)||this.setPersonPropertiesForFlags(y),!D(this.config.before_send)){var w=this.Ui(c);if(!w)return;c=w}this.ki.emit("eventCaptured",c);var x={method:"POST",url:null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:null==e?void 0:e._batchKey};return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly?this.Pi(x):this.Oi.enqueue(x),c}yi.critical("This capture call is ignored due to client rate limiting.")}}else yi.error("No event name provided to posthog.capture")}else yi.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(i,e,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return e;var l=a?void 0:this.persistence.remove_event_timer(i),h=p({},e);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,(this.config.cookieless_mode==le||this.config.cookieless_mode==ae&&this.consent.isExplicitlyOptedOut())&&(h.$cookieless_mode=!0),"$snapshot"===i){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!O(h.distinct_id)&&!j(h.distinct_id)||M(h.distinct_id))&&yi.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var c,f=function(i,e){var r,n,o,a;if(!u)return{};var l,h,d,c,f,p,g,_,m=i?[...ar,...e||[]]:[],[b,y]=function(t){for(var i=0;Vt.length>i;i++){var[e,r]=Vt[i],s=e.exec(t),n=s&&(T(r)?r(s,t):r);if(n)return n}return["",""]}(u);return ye(Se({$os:b,$os_version:y,$browser:Bt(u,navigator.vendor),$device:Gt(u),$device_type:(h=u,d={userAgentDataPlatform:null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,maxTouchPoints:null==(n=navigator)?void 0:n.maxTouchPoints,screenWidth:null==t||null==(o=t.screen)?void 0:o.width,screenHeight:null==t||null==(a=t.screen)?void 0:a.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio},_=Gt(h),_===st||_===rt||"Kobo"===_||"Kindle Fire"===_||_===Mt?et:_===Et||_===$t||_===St||_===Ct?"Console":_===ot?"Wearable":_?Z:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!==(c=null==d?void 0:d.maxTouchPoints)&&void 0!==c?c:0)>0?600>Math.min(null!==(f=null==d?void 0:d.screenWidth)&&void 0!==f?f:0,null!==(p=null==d?void 0:d.screenHeight)&&void 0!==p?p:0)/(null!==(g=null==d?void 0:d.devicePixelRatio)&&void 0!==g?g:1)?Z:et:"Desktop"),$timezone:br(),$timezone_offset:yr()}),{$current_url:sr(null==s?void 0:s.href,m,ur),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Wt(u,navigator.vendor),$browser_language:fr(),$browser_language_prefix:(l=fr(),"string"==typeof l?l.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:g,windowId:_}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());h.$session_id=g,h.$window_id=_}this.sessionPropsManager&&ye(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&ye(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.Li)?void 0:m.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===As&&(h.$lib_custom_api_host=this.config.api_host),c=i!==fe||a?i!==pe||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=ye(h,c),i===fe&&r&&(h.title=r.title),!F(l)){var b=n.getTime()-l;h.$duration=parseFloat((b/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser"),(h=ye({},f,this.persistence.properties(),this.sessionPersistence.properties(),h)).$is_identified=this._isIdentified(),I(this.config.property_denylist)?be(this.config.property_denylist,(function(t){delete h[t]})):yi.error(Zs+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var y=this.config.sanitize_properties;y&&(yi.error(Qs),h=y(h,i));var w=this.Wi();return h.$process_person_profile=w,w&&!a&&this.Gi("_calculate_event_properties"),h}Yi(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.Wi())return t;if(this.Si&&!e)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=ye({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(yi.error(Qs),o=a(o,"$set_once")),i&&(this.Si=!0),C(o)?void 0:o}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i;null==(i=this.sessionPersistence)||i.register(t)}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t)}Xi(t,i){this.register({[t]:i})}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}isFeatureEnabled(t,i){var e;return null==(e=this.featureFlags)?void 0:e.isFeatureEnabled(t,i)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.ki.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Xs}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Xs})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Xs})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=Bs),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:Xs}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:Xs})}Ji(t){return!t||M(t)?(yi.critical("Unique user id has not been set in posthog.identify"),!1):t===se?(yi.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(yi.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,i,e){if(!this.__loaded||!this.persistence)return yi.uninitializedWarning("posthog.identify");if(j(t)&&(t=t.toString(),yi.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Ji(t)&&this.Gi("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property($i)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(ki)&&(this.unregister(ki),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(Yi)||ue)===ue;t!==r&&n?(this.persistence.set_property(Yi,he),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.capture(ge,{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.Ei=Cs(t,i,e),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(i||e)&&this.setPersonProperties(i,e),t!==r&&(this.reloadFeatureFlags(),this.unregister(Vi))}}setPersonProperties(t,i){if((t||i)&&this.Gi("posthog.setPersonProperties")){var e=Cs(this.get_distinct_id(),t,i);this.Ei!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Ei=e):yi.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,e){if(t&&i){var r=this.getGroups(),s=r[t]!==i;if(s&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},r,{[t]:i})}),s||e){var n={$group_type:t,$group_key:i};e&&(n.$group_set=e),this.capture(_e,n)}e&&this.setGroupPropertiesForFlags({[t]:e}),s&&!e&&this.reloadFeatureFlags()}else yi.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.Gi("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s,n,o,a,l;if(yi.info("reset"),!this.__loaded)return yi.uninitializedWarning("posthog.reset");var u=this.get_property($i);if(this.consent.reset(),null==(i=this.persistence)||i.clear(),null==(e=this.sessionPersistence)||e.clear(),null==(r=this.surveys)||r.reset(),null==(s=this.Hi)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(Yi,ue),null==(l=this.sessionManager)||l.resetSessionId(),this.Ei=null,this.config.cookieless_mode===le)this.register_once({distinct_id:se,$device_id:null},"");else{var h=this.config.get_device_id(Me());this.register_once({distinct_id:h,$device_id:t?h:u},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,i){var e;this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null==(e=this.conversations)||e.Ki()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.Qi()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(Si)?(yi.critical("Attempting to create alias for existing People user - aborting."),-2):this.Gi("posthog.alias")?(F(i)&&(i=this.get_distinct_id()),t!==i?(this.Xi(ki,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(yi.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=p({},this.config);if(R(t)){var e,r,s,n,o,a,l,u,h;ye(this.config,nn(t));var d=this.Fi();null==(e=this.persistence)||e.update_config(this.config,i,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new xr(p({},this.config,{persistence:"sessionStorage"}),d);var c=this.Ri(this.config.debug);z(c)&&(this.config.debug=c),z(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,Ue.Yt()&&Ue.Xt("ph_debug",!0),yi.info("set_config",{config:t,oldConfig:i,newConfig:p({},this.config)})):(v.DEBUG=!1,Ue.Yt()&&Ue.Jt("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.sessionRecording)||s.startIfEnabledOrStop(),null==(n=this.autocapture)||n.startIfEnabled(),null==(o=this.heatmaps)||o.startIfEnabled(),null==(a=this.exceptionObserver)||a.startIfEnabledOrStop(),null==(l=this.deadClicksAutocapture)||l.startIfEnabledOrStop(),null==(u=this.surveys)||u.loadIfEnabled(),this.tn(),null==(h=this.externalIntegrations)||h.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){v.LIB_NAME=t,v.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.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 t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){if(this.exceptions){var e=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(p({},r,i))}}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:tn;return i!==tn&&(i=tn+"."+i),i}_isIdentified(){var t,i;return(null==(t=this.persistence)?void 0:t.get_property(Yi))===he||(null==(i=this.sessionPersistence)?void 0:i.get_property(Yi))===he}Wi(){var t,i;return!("never"===this.config.person_profiles||this.config.person_profiles===de&&!this._isIdentified()&&C(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[ki])&&(null==(i=this.persistence)||null==(i=i.props)||!i[ee]))}Vi(){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.Wi()||this.Gi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Gi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Gi(t){return"never"===this.config.person_profiles?(yi.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Xi(ee,!0),!0)}Fi(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ae)}tn(){var t,i,e,r,s=this.Fi();return(null==(t=this.persistence)?void 0:t.gr)!==s&&(null==(e=this.persistence)||e.set_disabled(s)),(null==(i=this.sessionPersistence)?void 0:i.gr)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==le){if(this.config.cookieless_mode===ae&&this.consent.isExplicitlyOptedOut()){var e,r,s,n,o;this.reset(!0),null==(e=this.sessionManager)||e.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Is(this),this.pageViewManager=new ir(this),this.persistence&&(this.sessionPropsManager=new $s(this,this.sessionManager,this.persistence));var a=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=an.__defaultExtensionClasses)?void 0:o.sessionRecording;a&&(this.sessionRecording=this.Ii(this.sessionRecording,new a(this)))}var l,u;this.consent.optInOut(!0),this.tn(),this.Zi(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==ae&&(null==(l=this.surveys)||l.loadIfEnabled()),(F(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.$i()}else yi.warn(Ys)}opt_out_capturing(){var t,i,e;this.config.cookieless_mode!==le?(this.config.cookieless_mode===ae&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===ae&&(this.register({distinct_id:se,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,this.$i())):yi.warn(Ys)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===le||(this.config.cookieless_mode===ae?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return e?Ts(e,this.config.custom_blocked_useragents):void 0}$i(){r&&("visible"===r.visibilityState?this.xi||(this.xi=!0,this.capture(fe,{title:r.title},{send_instantly:!0}),this.Ti&&(r.removeEventListener(ve,this.Ti),this.Ti=null)):this.Ti||(this.Ti=this.$i.bind(this),Pe(r,ve,this.Ti)))}debug(i){!1===i?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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}))}Tr(){var t,i,e,r,s,n,o=this.Ni||{};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?(yi.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):(e="advanced_disable_decide",!1,r=yi,s=(i="advanced_disable_flags")in(t=o)&&!D(t[i]),n=e in t&&!D(t[e]),s?t[i]:!!n&&(r&&r.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e]))}Ui(t){if(D(this.config.before_send))return t;var i=I(this.config.before_send)?this.config.before_send:[this.config.before_send],e=t;for(var r of i){if(e=r(e),D(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return N(t.event)?yi.warn(s+". This can cause unexpected behavior."):yi.info(s),null}e.properties&&!C(e.properties)||yi.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return e}getPageViewId(){var t;return null==(t=this.pageViewManager.lr)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Ri(t){var i=z(t)&&!t,e=Ue.Yt()&&"true"===Ue.Wt("ph_debug");return!i&&(!!e||t)}}function ln(t){return t instanceof Element&&(t.id===re||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function un(t){return!!t&&1===t.nodeType}function hn(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function dn(t){return!!t&&3===t.nodeType}function vn(t){return!!t&&11===t.nodeType}function cn(t){return t?x(t).split(/\s+/):[]}function fn(i){var e=null==t?void 0:t.location.href;return!!(e&&i&&i.some((t=>e.match(t))))}function pn(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return cn(i)}function gn(t){return D(t)?null:x(t).split(/(\s+)/).filter((t=>Mn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function _n(t){var i="";return kn(t)&&!Pn(t)&&t.childNodes&&t.childNodes.length&&be(t.childNodes,(function(t){var e;dn(t)&&t.textContent&&(i+=null!==(e=gn(t.textContent))&&void 0!==e?e:"")})),x(i)}function mn(t){return F(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null;var i}an.__defaultExtensionClasses={},function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=Ee(t.prototype[i[e]])}(an,["identify"]);var bn=["a","button","form","input","select","textarea","label"];function yn(t,i){if(F(i))return!0;var e,r=function(t){if(i.some((i=>t.matches(i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function wn(t){var i=t.parentNode;return!(!i||!un(i))&&i}var xn=["next","previous","prev",">","<"],En=[".ph-no-rageclick",".ph-no-capture"];var Sn=t=>!t||hn(t,"html")||!un(t),$n=(i,e)=>{if(!t||Sn(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!hn(n,"body");)if(vn(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=wn(n);if(!o)break;if(e||bn.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function kn(t){for(var i=t;i.parentNode&&!hn(i,"body");i=i.parentNode){var e=pn(i);if(w(e,"ph-sensitive")||w(e,"ph-no-capture"))return!1}if(w(pn(t),"ph-include"))return!0;var r=t.type||"";if(O(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!O(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Pn(t){return!!(hn(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||hn(t,"select")||hn(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var In="(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})",Tn=new RegExp("^(?:"+In+")$"),Rn=new RegExp(In),Cn="\\d{3}-?\\d{2}-?\\d{4}",Fn=new RegExp("^("+Cn+")$"),On=new RegExp("("+Cn+")");function Mn(t,i){if(void 0===i&&(i=!0),D(t))return!1;if(O(t)){if(t=x(t),(i?Tn:Rn).test((t||"").replace(/[- ]/g,"")))return!1;if((i?Fn:On).test(t))return!1}return!0}function An(t){var i=_n(t);return Mn(i=(i+" "+Dn(t)).trim())?i:""}function Dn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&be(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=_n(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Dn(t)).trim())}catch(t){yi.error("[AutoCapture]",t)}})),i}function jn(t){return t.replace(/"|\\"/g,'\\"')}function Ln(t){var i=t.attr__class;return i?I(i)?i:cn(i):void 0}class zn{constructor(t){this.disabled=!1===t;var i=R(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var Un="$copy_autocapture",Nn=wi("[AutoCapture]");function Hn(t,i){return i.length>t?i.slice(0,t)+"...":i}function Bn(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!un(i));return i}function qn(i,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=e,h=[i],d=i;d.parentNode&&!hn(d,"body");)vn(d.parentNode)?(h.push(d.parentNode.host),d=d.parentNode.host):(h.push(d.parentNode),d=d.parentNode);var v,c,f=[],g={},_=!1,m=!1;if(be(h,(t=>{var i=kn(t);"a"===t.tagName.toLowerCase()&&(_=t.getAttribute("href"),_=i&&_&&Mn(_)&&_),w(pn(t),"ph-no-capture")&&(m=!0),f.push(function(t,i,e,r){var s=t.tagName.toLowerCase(),n={tag_name:s};bn.indexOf(s)>-1&&!e&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?Hn(1024,An(t)):Hn(1024,_n(t)));var o=pn(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),be(t.attributes,(function(e){var s;if((!Pn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Mn(e.value)&&(!O(s=e.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=e.value;"class"===e.name&&(o=cn(o).join(" ")),n["attr__"+e.name]=Hn(1024,o)}}));for(var a=1,l=1,u=t;u=Bn(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(t,o,a,l));var e=function(t){if(!kn(t))return{};var i={};return be(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Mn(r)&&(i[e]=r)}})),i}(t);ye(g,e)})),m)return{props:{},explicitNoCapture:m};if(a||(f[0].$el_text="a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?An(i):_n(i)),_){var b,y;f[0].attr__href=_;var x=null==(b=er(_))?void 0:b.host,E=null==t||null==(y=t.location)?void 0:y.host;x&&E&&x!==E&&(v=_)}return{props:ye({$event_type:n.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:(c=f,function(t){return t.map((t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=p({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return we(n).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return o[jn(i.toString())]=jn(e.toString())})),(r+=":")+we(o).map((t=>{var[i,e]=t;return i+'="'+e+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Ln(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return we(t).filter((t=>{var[i]=t;return 0===i.indexOf("attr__")})).forEach((t=>{var[i,e]=t;return r.attributes[i]=e})),r}))}(c)))},null!=(r=f[0])&&r.$el_text?{$el_text:null==(s=f[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},g)}}var Wn=wi("[ExceptionAutocapture]");function Vn(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return T(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}var Gn=wi("[TracingHeaders]"),Jn=wi("[Web Vitals]"),Kn=9e5,Yn="disabled",Xn="lazy_loading",Qn="awaiting_config",Zn="missing_config";wi("[SessionRecording]");var to="[SessionRecording]",io=wi(to),eo=wi("[Heatmaps]");function ro(t){return R(t)&&"clientX"in t&&"clientY"in t&&j(t.clientX)&&j(t.clientY)}var so=wi("[Product Tours]"),no="ph_product_tours",oo=["$set_once","$set"],ao=wi("[SiteApps]"),lo="Error while initializing PostHog app with config id ";function uo(t,i,e){if(D(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class ho{constructor(t){this.en=new ks,this.rn=(t,i)=>this.nn(t,i)&&this.sn(t,i)&&this.an(t,i)&&this.ln(t,i),this.nn=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.un=new Set,this.hn=new Set}init(){var t,i;F(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(i=this._instance)||i._addCaptureHook(((t,i)=>{this.on(t,i)})))}register(t){var i,e;if(!F(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i,e;null==(i=this.hn)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.un)||i.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r,s=new Set;t.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,i){var e;null!=i&&0!=t.length&&(this.un.has(t)||this.un.has(null==i?void 0:i.event))&&this.hn&&(null==(e=this.hn)?void 0:e.size)>0&&this.hn.forEach((t=>{this.cn(i,t)&&this.en.emit("actionCaptured",t.name)}))}dn(t){this.onAction("actionCaptured",(i=>t(i)))}cn(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.rn(t,e))return!0;return!1}onAction(t,i){return this.en.on(t,i)}sn(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!uo(r,i.url,i.url_matching||"contains"))return!1}return!0}an(t,i){return!!this.vn(t,i)&&!!this.fn(t,i)&&!!this.pn(t,i)}vn(t,i){var e;if(null==i||!i.href)return!0;var r=this.gn(t);if(r.length>0)return r.some((t=>uo(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&uo((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}fn(t,i){var e;if(null==i||!i.text)return!0;var r=this.gn(t);if(r.length>0)return r.some((t=>uo(t.text,i.text,i.text_matching||"exact")||uo(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!D(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>uo(t,n,o))))}pn(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}gn(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}ln(t,i){return null==i||!i.properties||0===i.properties.length||Ms(i.properties.reduce(((t,i)=>{var e=I(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class vo{constructor(t){this._instance=t,this.mn=new Map,this.yn=new Map,this.bn=new Map}wn(t,i){return!!t&&Ms(t.propertyFilters,null==i?void 0:i.properties)}_n(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}In(t,i,e){var r=(e===Er?this.mn:this.yn).get(t),s=[];return this.Cn((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.wn(n,i)}))}register(t){var i;F(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.Sn(t),this.kn(t))}kn(t){var i=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.actions)&&(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length)>0}));0!==i.length&&(null==this.xn&&(this.xn=new ho(this._instance),this.xn.init(),this.xn.dn((t=>{this.onAction(t)}))),i.forEach((t=>{var i,e,r,s,n;t.conditions&&null!=(i=t.conditions)&&i.actions&&null!=(e=t.conditions)&&null!=(e=e.actions)&&e.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.xn)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((i=>{if(i&&i.name){var e=this.bn.get(i.name);e&&e.push(t.id),this.bn.set(i.name,e||[t.id])}})))})))}Sn(t){var i,e=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),r=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}));0===e.length&&0===r.length||(null==(i=this._instance)||i._addCaptureHook(((t,i)=>{this.onEvent(t,i)})),this.mn=this._n(t,Er),this.yn=this._n(t,Sr))}onEvent(t,i){var e,r=this.re(),s=this.Tn(),n=this.An(),o=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[s])||[];if(n===t&&i&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:t,eventPayload:i,existingActivatedItems:o});var u=(null==i||null==(a=i.properties)?void 0:a.$survey_id)||(null==i||null==(l=i.properties)?void 0:l.$product_tour_id);if(u){var h=o.indexOf(u);0>h||(o.splice(h,1),this.En(o))}}else{if(this.yn.has(t)){var d=this.In(t,i,Sr);d.length>0&&(r.info("cancel event matched, cancelling items",{event:t,itemsToCancel:d.map((t=>t.id))}),d.forEach((t=>{var i=o.indexOf(t.id);0>i||o.splice(i,1),this.Rn(t.id)})),this.En(o))}if(this.mn.has(t)){r.info("event name matched",{event:t,eventPayload:i,items:this.mn.get(t)});var v=this.In(t,i,Er);this.En(o.concat(v.map((t=>t.id))||[]))}}}onAction(t){var i,e=this.Tn(),r=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[e])||[];this.bn.has(t)&&this.En(r.concat(this.bn.get(t)||[]))}En(t){var i,e=this.re(),r=this.Tn(),s=[...new Set(t)].filter((t=>!this.Nn(t)));e.info("updating activated items",{activatedItems:s}),null==(i=this._instance)||null==(i=i.persistence)||i.register({[r]:s})}getActivatedIds(){var t,i=this.Tn();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}getEventToItemsMap(){return this.mn}Mn(){return this.xn}}class co extends vo{constructor(t){super(t)}Tn(){return"$surveys_activated"}An(){return $r}Cn(t){var i;null==(i=this._instance)||i.getSurveys(t)}Rn(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}re(){return Ls}Nn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var fo="SDK is not enabled or survey functionality is not yet loaded",po="Disabled. Not loading surveys.",go=null!=t&&t.location?nr(t.location.hash,"__posthog")||nr(location.hash,"state"):null,_o="_postHogToolbarParams",mo=wi("[Toolbar]"),bo=wi("[FeatureFlags]"),yo=wi("[FeatureFlags]",{debugEnabled:!0}),wo="\" failed. Feature flags didn't load in time.",xo="$active_feature_flags",Eo="$override_feature_flags",So="$feature_flag_payloads",$o="$override_feature_flag_payloads",ko="$feature_flag_request_id",Po=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},Io=t=>{var i={};for(var[e,r]of we(t||{}))r&&(i[e]=r);return i},To=wi("[Error tracking]"),Ro="Refusing to render web experiment since the viewer is a likely bot",Co={icontains:(i,e)=>!!t&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!t&&-1===e.href.toLowerCase().indexOf(i.toLowerCase()),regex:(i,e)=>!!t&&Rs(e.href,i),not_regex:(i,e)=>!!t&&!Rs(e.href,i),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class Fo{get Rt(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{Fo.Fn("retrieved web experiments from the server"),i.On=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;i.On&&(Fo.Fn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.On)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);O(r)&&t.variants[r]&&i.Pn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Fo.Ln(n)&&i.Pn(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Fo.Fn(Ro);else if(!this.Rt.disable_web_experiments){if(D(this.On))return this.On=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Fo.Fn("applying feature flags",t),t.forEach((t=>{var i;if(this.On&&null!=(i=this.On)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.On)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Pn(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Fo.getWindowLocation();if(null!=t&&t.search){var i=rr(null==t?void 0:t.search,"__experiment_id"),e=rr(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Fo.Fn("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Dn(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this.Rt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Rt.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Rt.token),method:"GET",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Dn(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(Fo.Fn("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Pn(r[0].name,i,r[0].variants[i].transforms))}static Ln(t){return!D(t.conditions)&&Fo.Bn(t)&&Fo.jn(t)}static Bn(t){var i;if(D(t.conditions)||D(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=Fo.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||Co[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static jn(t){var i;if(D(t.conditions)||D(null==(i=t.conditions)?void 0:i.utm))return!0;var e=dr();if(e.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static Fn(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];yi.info("[WebExperiments] "+t,e)}Pn(t,i,e){this._is_bot()?Fo.Fn(Ro):"control"!==i?e.forEach((e=>{if(e.selector){var r;Fo.Fn("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):Fo.Fn("Control variants leave the page unmodified.")}_is_bot(){return e&&this._instance?Ts(e,this.Rt.custom_blocked_useragents):void 0}}var Oo,Mo,Ao=wi("[Conversations]"),Do="Conversations not available yet.",jo={featureFlags:class{constructor(t){this.qn=!1,this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.Yn=!1,this.Un=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Rt(){return this._instance.config}get Kr(){return this._instance.persistence}Wn(t){return this._instance.get_property(t)}Gn(){var t,i;return null!==(t=null==(i=this.Kr)?void 0:i.mr(this.Rt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}Xn(){return!!this.Gn()&&(this.Un||this.$n||(this.Un=!0,bo.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Jn(){var t,i=null!==(t=this.Rt.evaluation_contexts)&&void 0!==t?t:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Yn||(bo.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yn=!0),null!=i&&i.length?i.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||bo.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}Kn(){return this.Jn().length>0}initialize(){var t,i,{config:e}=this._instance,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,i)=>(t[i]=r[i]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,i)=>(o[i]&&(t[i]=o[i]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,e){var r=null!=e&&e.merge?this.getFlagVariants():{},s=null!=e&&e.merge?this.getFlagPayloads():{},n=p({},r,t),o=p({},s,i),a={};for(var[l,u]of Object.entries(n)){var h="string"==typeof u;a[l]={key:l,enabled:!!h||Boolean(u),variant:h?u:void 0,reason:void 0,metadata:F(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Zn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Wn(Hi),i=this.Wn(Eo),e=this.Wn($o);if(!e&&!i)return t||{};var r=ye({},t||{}),s=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(var n of s){var o,a,l=r[n],u=null==i?void 0:i[n],h=F(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=F(u)?l.variant:"string"==typeof u?u:void 0,v=null==e?void 0:e[n],c=p({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=p({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.qn||(bo.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.qn=!0),r}getFlagVariants(){var t=this.Wn(Ui),i=this.Wn(Eo);if(!i)return t||{};for(var e=ye({},t),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.qn||(bo.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.qn=!0),e}getFlagPayloads(){var t=this.Wn(So),i=this.Wn($o);if(!i)return t||{};for(var e=ye({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.qn||(bo.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.qn=!0),e}reloadFeatureFlags(){this.Hn||this.Rt.advanced_disable_feature_flags||this.Qn||(this._instance.ki.emit("featureFlagsReloading",!0),this.Qn=setTimeout((()=>{this.ts()}),5))}es(){clearTimeout(this.Qn),this.Qn=void 0}ensureFlagsLoaded(){this.Zn||this.$n||this.Qn||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Hn=t}ts(t){var i;if(this.es(),!this._instance.Tr())if(this.$n)this.Vn=!0;else{var e=this.Rt.token,r=this.Wn($i),s={token:e,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:p({},(null==(i=this.Kr)?void 0:i.get_initial_props())||{},this.Wn(Bi)||{}),group_properties:this.Wn(qi),timezone:br()};A(r)||F(r)||(s.$device_id=r),(null!=t&&t.disableFlags||this.Rt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Kn()&&(s.evaluation_contexts=this.Jn());var n=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Rt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$n=!0,this._instance._send_request({method:"POST",url:n,data:s,compression:this.Rt.disable_compression?void 0:Or,timeout:this.Rt.feature_flag_request_timeout_ms,callback:t=>{var i,e,r,n=!0;if(200===t.statusCode&&(this.Vn||(this.$anon_distinct_id=void 0),n=!1),this.$n=!1,!s.disable_flags||this.Vn){this.zn=!n;var o=[];t.error?t.error instanceof Error?o.push("AbortError"===t.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==t.statusCode&&o.push("api_error_"+t.statusCode),null!=(i=t.json)&&i.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(e=t.json)||null==(e=e.quotaLimited)||!e.includes("feature_flags"));if(l&&o.push("quota_limited"),null==(r=this.Kr)||r.register({[Ji]:o}),l)bo.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 s.disable_flags||this.receivedFeatureFlags(null!==(a=t.json)&&void 0!==a?a:{},n),this.Vn&&(this.Vn=!1,this.ts())}}})}}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else bo.warn('getFeatureFlag for key "'+t+wo)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var e=this.getFlagVariants(),r=t in e,s=e[t],n=this.getFlagPayloads()[t],o=String(s),a=this.Wn(ko)||void 0,l=this.Wn(Ki)||void 0,u=this.Wn(Vi)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.Wn(Gi);d&&d!==v&&(u={},null==(h=this.Kr)||h.register({[Vi]:u,[Gi]:d}))}if((i.send_event||!("send_event"in i))&&(!(t in u)||!u[t].includes(o))){var c,f,p,g,_,m,b,y,w,x;I(u[t])?u[t].push(o):u[t]=[o],null==(c=this.Kr)||c.register({[Vi]:u});var E=this.getFeatureFlagDetails(t),S=[...null!==(f=this.Wn(Ji))&&void 0!==f?f:[]];F(s)&&S.push("flag_missing");var k={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(p=this.Rt.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(g=this.Rt.bootstrap)||null==(g=g.featureFlagPayloads)?void 0:g[t])||null,$used_bootstrap_value:!this.zn};F(null==E||null==(_=E.metadata)?void 0:_.version)||(k.$feature_flag_version=E.metadata.version);var P,T=null!==(m=null==E||null==(b=E.reason)?void 0:b.description)&&void 0!==m?m:null==E||null==(y=E.reason)?void 0:y.code;T&&(k.$feature_flag_reason=T),null!=E&&null!=(w=E.metadata)&&w.id&&(k.$feature_flag_id=E.metadata.id),F(null==E?void 0:E.original_variant)&&F(null==E?void 0:E.original_enabled)||(k.$feature_flag_original_response=F(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(k.$feature_flag_original_payload=null==E||null==(P=E.metadata)?void 0:P.original_payload),S.length&&(k.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",k)}if(r){var R=n;if(!F(n))try{R=JSON.parse(n)}catch(t){}return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:R}}}}else bo.warn('getFeatureFlagResult for key "'+t+wo)}getRemoteConfigPayload(t,i){var e=this.Rt.token,r={distinct_id:this._instance.get_distinct_id(),token:e};this.Kn()&&(r.evaluation_contexts=this.Jn()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Rt.disable_compression?void 0:Or,timeout:this.Rt.feature_flag_request_timeout_ms,callback(e){var r,s=null==(r=e.json)?void 0:r.featureFlagPayloads;i((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,i){if(void 0===i&&(i={}),!i.fresh||this.zn){if(this.Zn||this.getFlags()&&this.getFlags().length>0){var e=this.getFeatureFlag(t,i);return F(e)?void 0:!!e}bo.warn('isFeatureEnabled for key "'+t+wo)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i){if(this.Kr){this.Zn=!0;var e=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(t,i,e,r,s){void 0===e&&(e={}),void 0===r&&(r={}),void 0===s&&(s={});var n=(t=>{var i=t.flags;return i?(t.featureFlags=Object.fromEntries(Object.keys(i).map((t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(i).filter((t=>i[t].enabled)).filter((t=>{var e;return null==(e=i[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=i[t].metadata)?void 0:e.payload]})))):bo.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var u=t.requestId,h=t.evaluatedAt;if(I(a)){bo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var d={};if(a)for(var v=0;a.length>v;v++)d[a[v]]=!0;i&&i.register({[xo]:a,[Ui]:d})}else{var c=a,f=l,g=o;if(t.errorsWhileComputingFlags)if(o){var _=new Set(Object.keys(o).filter((t=>{var i;return!(null!=(i=o[t])&&i.failed)})));c=p({},e,Object.fromEntries(Object.entries(c).filter((t=>{var[i]=t;return _.has(i)})))),f=p({},r,Object.fromEntries(Object.entries(f||{}).filter((t=>{var[i]=t;return _.has(i)})))),g=p({},s,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[i]=t;return _.has(i)}))))}else c=p({},e,c),f=p({},r,f),g=p({},s,g);i&&i.register(p({[xo]:Object.keys(Io(c)),[Ui]:c||{},[So]:f||{},[Hi]:g||{}},u?{[ko]:u}:{},h?{[Ki]:h}:{}))}}}(t,this.Kr,e,r,s),i||(this.Un=!1),this.rs(i)}}override(t,i){void 0===i&&(i=!1),bo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.Kr)return bo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.Kr.unregister(Eo),this.Kr.unregister($o),this.rs(),yo.info("All overrides cleared");if(I(t)){var i=Po(t);return this.Kr.register({[Eo]:i}),this.rs(),yo.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e,r=t;if(this.qn=Boolean(null!==(e=r.suppressWarning)&&void 0!==e&&e),"flags"in r)if(!1===r.flags)this.Kr.unregister(Eo),yo.info("Flag overrides cleared");else if(r.flags){if(I(r.flags)){var s=Po(r.flags);this.Kr.register({[Eo]:s})}else this.Kr.register({[Eo]:r.flags});yo.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.Kr.unregister($o),yo.info("Payload overrides cleared")):r.payloads&&(this.Kr.register({[$o]:r.payloads}),yo.info("Payload overrides set",{payloads:r.payloads}))),void this.rs()}if(t&&"object"==typeof t)return this.Kr.register({[Eo]:t}),this.rs(),yo.info("Flag overrides set",{flags:t});bo.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Zn){var{flags:i,flagVariants:e}=this.ns();t(i,e)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,s=(this.Wn(Ni)||[]).find((i=>i.flagKey===t)),n={["$feature_enrollment/"+t]:i},o={$feature_flag:t,$feature_enrollment:i,$set:n};s&&(o.$early_access_feature_name=s.name),e&&(o.$feature_enrollment_stage=e),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=p({},this.getFlagVariants(),{[t]:i});null==(r=this.Kr)||r.register({[xo]:Object.keys(Io(a)),[Ui]:a}),this.rs()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Wn(Ni),s=e?"&"+e.map((t=>"stage="+t)).join("&"):"";if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Rt.token+s),method:"GET",callback:i=>{var e,r;if(i.json){var s=i.json.earlyAccessFeatures;return null==(e=this.Kr)||e.unregister(Ni),null==(r=this.Kr)||r.register({[Ni]:s}),t(s)}}})}ns(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}rs(t){var{flags:i,flagVariants:e}=this.ns();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.Wn(Bi)||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),s=null==t?void 0:t.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in e||(n[o]=s[o]));this._instance.register({[Bi]:p({},e,n,r)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Bi)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.Wn(qi)||{};0!==Object.keys(e).length&&Object.keys(e).forEach((i=>{e[i]=p({},e[i],t[i]),delete t[i]})),this._instance.register({[qi]:p({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Wn(qi)||{};this._instance.register({[qi]:p({},i,{[t]:{}})})}else this._instance.unregister(qi)}reset(){this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.$anon_distinct_id=void 0,this.es(),this.qn=!1}}},Lo={sessionRecording:class{get Rt(){return this._instance.config}get Kr(){return this._instance.persistence}get started(){var t;return!(null==(t=this.ss)||!t.isStarted)}get status(){var t,i;return this.os===Qn||this.os===Zn?this.os:null!==(t=null==(i=this.ss)?void 0:i.status)&&void 0!==t?t:this.os}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.os=Yn,this.ls=void 0,this._instance=t,!this._instance.sessionManager)throw io.error("started without valid sessionManager"),new Error(to+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===le)throw new Error(to+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get us(){var i,e=!(null==(i=this._instance.get_property(ji))||!i.enabled),r=!this.Rt.disable_session_recording,s=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!this.us||null==(i=this.ss)||!i.isStarted){var e=!F(Object.assign)&&!F(Array.from);this.us&&e?(this.hs(t),io.info("starting")):(this.os=Yn,this.stopRecording())}}hs(t){var i,e,r;this.us&&(this.os!==Qn&&this.os!==Zn&&(this.os=Xn),null!=h&&null!=(i=h.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=h.__PosthogExtensions__)&&e.initSessionRecording?this.cs(t):null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.ds,(i=>{if(i)return io.error("could not load recorder",i);this.cs(t)})))}stopRecording(){var t,i;null==(t=this.ls)||t.call(this),this.ls=void 0,null==(i=this.ss)||i.stop()}vs(){var t,i;null==(t=this.ls)||t.call(this),this.ls=void 0,null==(i=this.ss)||i.discard()}fs(){var t;null==(t=this.Kr)||t.unregister(zi)}ps(t,i){if(D(t))return null;var e,r=j(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(io.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}gs(t){if(this.Kr){var i,e,r=this.Kr,s=()=>{var i,e=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.ps(null==(i=this.Rt.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),n=this.ps(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=s?s:n;D(o)&&this.fs();var a=null==e?void 0:e.minimumDurationMilliseconds;r.register({[ji]:p({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:p({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:o,minimumDurationMilliseconds:F(a)?null:a,endpoint:null==e?void 0:e.endpoint,triggerMatchType:null==e?void 0:e.triggerMatchType,masking:null==e?void 0:e.masking,urlTriggers:null==e?void 0:e.urlTriggers})})};s(),null==(i=this.ls)||i.call(this),this.ls=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.gs(t),void this.vs()):(this.gs(t),void this.startIfEnabledOrStop()):(this.os===Qn&&(this.os=Zn,io.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.ss)&&e.log?this.ss.log(t,i):io.warn("log called before recorder was ready")}get ds(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(ji);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}ys(){var t,i=this._instance.get_property(ji);if(!i)return!1;var e=null!==(t=("object"==typeof i?i:JSON.parse(i)).cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-e}cs(t){var i,e;if(null==(i=h.__PosthogExtensions__)||!i.initSessionRecording)return io.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.ss||(this.ss=null==(e=h.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.ss._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ys()){if(this.os===Zn||this.os===Qn)return;return this.os=Qn,io.info("persisted remote config is stale, requesting fresh config before starting"),void new Cr(this._instance).load()}this.os=Xn,this.ss.start(t)}onRRwebEmit(t){var i;null==(i=this.ss)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.ss||null==(i=this.Kr)||i.register({$replay_override_linked_flag:!0}),null==(t=this.ss)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.ss||null==(i=this.Kr)||i.register({$replay_override_sampling:!0}),null==(t=this.ss)||t.overrideSampling()}overrideTrigger(t){var i,e;this.ss||null==(e=this.Kr)||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(i=this.ss)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.ss)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.ss)||!e.tryAddCustomEvent(t,i))}}},zo={autocapture:class{constructor(t){this.bs=!1,this.ws=null,this._s=!1,this.instance=t,this.rageclicks=new zn(t.config.rageclick),this.Is=null}initialize(){this.startIfEnabled()}get Rt(){var t,i,e=R(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=null==(t=e.url_allowlist)?void 0:t.map((t=>new RegExp(t))),e.url_ignorelist=null==(i=e.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),e}Cs(){if(this.isBrowserSupported()){if(t&&r){var i=i=>{i=i||(null==t?void 0:t.event);try{this.Ss(i)}catch(t){Nn.error("Failed to capture event",t)}};if(Pe(r,"submit",i,{capture:!0}),Pe(r,"change",i,{capture:!0}),Pe(r,"click",i,{capture:!0}),this.Rt.capture_copied_text){var e=i=>{this.Ss(i=i||(null==t?void 0:t.event),Un)};Pe(r,"copy",e,{capture:!0}),Pe(r,"cut",e,{capture:!0})}}}else Nn.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.bs&&(this.Cs(),this.bs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this._s=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ii]:!!t.autocapture_opt_out}),this.ws=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Is=t}getElementSelectors(t){var i,e=[];return null==(i=this.Is)||i.forEach((i=>{var s=null==r?void 0:r.querySelectorAll(i);null==s||s.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i,e=null==(t=this.instance.persistence)?void 0:t.props[Ii];if(A(this.ws)&&!z(e)&&!this.instance.Tr())return!1;var r=null!==(i=this.ws)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!r}Ss(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r,s=mn(i);dn(s)&&(s=s.parentNode||null),"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent&&this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(i.clientX,i.clientY,i.timeStamp||(new Date).getTime())&&function(i,e){if(!t||Sn(i))return!1;var r,s,n;if(z(e)?(r=!!e&&En,s=void 0):(r=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:En,s=null==e?void 0:e.content_ignorelist),!1===r)return!1;var{targetElementList:o}=$n(i,!1);return!function(t,i){if(!1===t||F(t))return!1;var e;if(!0===t)e=xn;else{if(!I(t))return!1;if(t.length>10)return yi.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var{safeText:i,ariaLabel:r}=t;return e.some((t=>i.includes(t)||r.includes(t)))}))}(s,o.map((t=>{var i;return{safeText:_n(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!yn(o,r)}(s,this.instance.config.rageclick)&&this.Ss(i,"$rageclick");var n=e===Un;if(s&&function(i,e,r,s,n){var o,a,l,u;if(void 0===r&&(r=void 0),!t||Sn(i))return!1;if(null!=(o=r)&&o.url_allowlist&&!fn(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&fn(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var h=r.dom_event_allowlist;if(h&&!h.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:d,targetElementList:v}=$n(i,s);if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(F(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,r))return!1;if(!yn(v,null==(u=r)?void 0:u.css_selector_allowlist))return!1;var c=t.getComputedStyle(i);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===e.type)return!0;var f=i.tagName.toLowerCase();switch(f){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return d?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(bn.indexOf(f)>-1||"true"===i.getAttribute("contenteditable"))}}(s,i,this.Rt,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=qn(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist,elementsChainAsString:this._s});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),e===Un){var u,h=gn(null==t||null==(u=t.getSelection())?void 0:u.toString()),d=i.type||"clipboard";if(!h)return!1;o.$selected_content=h,o.$copy_type=d}return this.instance.capture(e,o),!0}}}isBrowserSupported(){return T(null==r?void 0:r.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.ks=(null==t||null==(e=t.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(yi.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.xs&&this.xs(),this.xs=void 0,yi.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(t&&t.history){var r=this;null!=(i=t.history.pushState)&&i.__posthog_wrapped__||Vn(t.history,"pushState",(t=>function(i,e,s){t.call(this,i,e,s),r.Ts("pushState")})),null!=(e=t.history.replaceState)&&e.__posthog_wrapped__||Vn(t.history,"replaceState",(t=>function(i,e,s){t.call(this,i,e,s),r.Ts("replaceState")})),this.As()}}Ts(i){try{var e,r=null==t||null==(e=t.location)?void 0:e.pathname;if(!r)return;r!==this.ks&&this.isEnabled&&this._instance.capture(fe,{navigation_type:i}),this.ks=r}catch(t){yi.error("Error capturing "+i+" pageview",t)}}As(){if(!this.xs){var i=()=>{this.Ts("popstate")};Pe(t,"popstate",i),this.xs=()=>{t&&t.removeEventListener("popstate",i)}}}},heatmaps:class{get Rt(){return this.instance.config}constructor(t){var i;this.Es=!1,this.bs=!1,this.Rs=null,this.instance=t,this.Es=!(null==(i=this.instance.persistence)||!i.props[Ti]),this.rageclicks=new zn(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return R(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return D(this.Rt.capture_heatmaps)?D(this.Rt.enable_heatmaps)?this.Es:this.Rt.enable_heatmaps:!1!==this.Rt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.bs)return;eo.info("starting..."),this.Ns(),this.Tt()}else{var t;clearInterval(null!==(t=this.Rs)&&void 0!==t?t:void 0),this.Ms(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ti]:i}),this.Es=i,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Fs(t){this.wt(t.originalEvent,"deadclick")}Tt(){this.Rs&&clearInterval(this.Rs),this.Rs=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(r)?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}Ns(){t&&r&&(this.Os=this.Zr.bind(this),Pe(t,ce,this.Os),this.Ps=i=>this.wt(i||(null==t?void 0:t.event)),Pe(r,"click",this.Ps,{capture:!0}),this.Ls=i=>this.Ds(i||(null==t?void 0:t.event)),Pe(r,"mousemove",this.Ls,{capture:!0}),this.Bs=new Ye(this.instance,Je,this.Fs.bind(this)),this.Bs.startIfEnabledOrStop(),this.js=this.Tt.bind(this),Pe(r,ve,this.js),this.bs=!0)}Ms(){var i;t&&r&&(this.Os&&t.removeEventListener(ce,this.Os),this.Ps&&r.removeEventListener("click",this.Ps,{capture:!0}),this.Ls&&r.removeEventListener("mousemove",this.Ls,{capture:!0}),this.js&&r.removeEventListener(ve,this.js),clearTimeout(this.qs),null==(i=this.Bs)||i.stop(),this.bs=!1)}Zs(i,e){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(i,e,r){for(var s=i;s&&un(s)&&!hn(s,"body");){if(s===r)return!1;if(w(e,null==t?void 0:t.getComputedStyle(s).position))return!0;s=wn(s)}return!1}(mn(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}wt(t,i){var e;if(void 0===i&&(i="click"),!ln(t.target)&&ro(t)){var r=this.Zs(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.$s(p({},r,{type:"rageclick"})),this.$s(r)}}Ds(t){!ln(t.target)&&ro(t)&&(clearTimeout(this.qs),this.qs=setTimeout((()=>{this.$s(this.Zs(t,"mousemove"))}),500))}$s(i){if(t){var e=t.location.href,r=this.Rt.custom_personal_data_properties,s=this.Rt.mask_personal_data_properties?[...ar,...r||[]]:[],n=sr(e,s,ur);this.T=this.T||{},this.T[n]||(this.T[n]=[]),this.T[n].push(i)}}Zr(){this.T&&!C(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ye,webVitalsAutocapture:class{constructor(t){var i;this.Es=!1,this.bs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hs=()=>{clearTimeout(this.Vs),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((t,i)=>p({},t,{["$web_vitals_"+i.name+"_event"]:p({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.nt=t=>{var i,e=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(F(e))Jn.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.zs();F(r)||(D(null==t?void 0:t.name)||D(null==t?void 0:t.value)?Jn.error("Invalid metric received",t):!this.Ys||this.Ys>t.value?(this.T.url!==r&&(this.Hs(),this.Vs=setTimeout(this.Hs,this.flushToCaptureTimeoutMs)),F(this.T.url)&&(this.T.url=r),this.T.firstMetricTimestamp=F(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.T.metrics.push(p({},t,{$current_url:r,$session_id:e.sessionId,$window_id:e.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Hs()):Jn.error("Ignoring metric with value >= "+this.Ys,t))}},this.Us=()=>{if(!this.bs){var t,i,e,r,s=h.__PosthogExtensions__;F(s)||F(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.nt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.nt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.nt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.nt.bind(this)),this.bs=!0):Jn.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Es=!(null==(i=this._instance.persistence)||!i.props[Oi]),this.startIfEnabled()}get Ws(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=R(this.Ws)?null==(t=this.Ws)?void 0:t.web_vitals_allowed_metrics:void 0;return D(e)?(null==(i=this._instance.persistence)?void 0:i.props[Di])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(R(this.Ws)?this.Ws.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=R(this.Ws)?this.Ws.web_vitals_attribution:void 0;return null!=t&&t}get Ys(){var t=R(this.Ws)&&j(this.Ws.__web_vitals_max_value)?this.Ws.__web_vitals_max_value:Kn;return t>0&&6e4>=t?Kn:t}get isEnabled(){var t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Jn.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=R(this.Ws)?this.Ws.web_vitals:z(this.Ws)?this.Ws:void 0;return z(i)?i:this.Es}startIfEnabled(){this.isEnabled&&!this.bs&&(Jn.info("enabled, starting..."),this.nr(this.Us))}onRemoteConfig(t){if("capturePerformance"in t){var i=R(t.capturePerformance)&&!!t.capturePerformance.web_vitals,e=R(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Oi]:i}),this._instance.persistence.register({[Di]:e})),this.Es=i,this.startIfEnabled()}}nr(t){var i,e;null!=(i=h.__PosthogExtensions__)&&i.postHogWebVitalsCallbacks?t():null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?Jn.error("failed to load script",i):t()}))}zs(){var i=t?t.location.href:void 0;if(i){var e=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...ar,...e||[]]:[];return sr(i,r,ur)}Jn.error("Could not determine current URL")}}},Uo={exceptionObserver:class{constructor(i){var e,r,s;this.Us=()=>{var i;if(t&&this.isEnabled&&null!=(i=h.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Gs&&this.Rt.capture_unhandled_errors&&(this.Gs=e(this.captureException.bind(this))),!this.Xs&&this.Rt.capture_unhandled_rejections&&(this.Xs=r(this.captureException.bind(this))),!this.Js&&this.Rt.capture_console_errors&&(this.Js=s(this.captureException.bind(this)))}catch(t){Wn.error("failed to start",t),this.Ks()}}},this._instance=i,this.Qs=!(null==(e=this._instance.persistence)||!e.props[Ri]),this.eo=new K({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,qt:Wn}),this.Rt=this.ro(),this.startIfEnabledOrStop()}ro(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return R(t)?i=p({},i,t):(F(t)?this.Qs:t)&&(i=p({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Rt.capture_console_errors||this.Rt.capture_unhandled_errors||this.Rt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Wn.info("enabled"),this.Ks(),this.nr(this.Us)):this.Ks()}nr(t){var i,e;null!=(i=h.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Wn.error("failed to load script",i);t()}))}Ks(){var t,i,e;null==(t=this.Gs)||t.call(this),this.Gs=void 0,null==(i=this.Xs)||i.call(this),this.Xs=void 0,null==(e=this.Js)||e.call(this),this.Js=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.Qs=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Ri]:this.Qs}),this.Rt=this.ro(),this.startIfEnabledOrStop())}onConfigChange(){this.Rt=this.ro()}captureException(t){var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.eo.consumeRateLimit(s)?Wn.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var i,e;this.io=[],this.no=new Yt([new li,new mi,new hi,new ui,new gi,new pi,new vi,new _i],function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];return function(i,r){void 0===r&&(r=0);for(var s=[],n=i.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=ai.test(a)?a.replace(ai,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of e){var h=u(l,t);if(h){s.push(h);break}}if(s.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map((t=>{return p({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||Xt});var e}))}(s)}}("web:javascript",ri,oi)),this._instance=t,this.io=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Ci))&&void 0!==i?i:[]}onRemoteConfig(t){var i,e,r;if("errorTracking"in t){var s=null!==(i=null==(e=t.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.io=s,this._instance.persistence&&this._instance.persistence.register({[Ci]:this.io,[Fi]:n})}}get so(){var t,i=!!this._instance.get_property(Fi),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.no.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}sendExceptionEvent(t){var i=t.$exception_list;if(this.oo(i)){if(this.ao(i))return void To.info("Skipping exception capture because a suppression rule matched");if(!this.so&&this.lo(i))return void To.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.uo(i))return void To.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",zi:!0})}ao(t){if(0===t.length)return!1;var i=t.reduce(((t,i)=>{var{type:e,value:r}=i;return O(e)&&e.length>0&&t.$exception_types.push(e),O(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.io.some((t=>{var e=t.values.map((t=>{var e,r=Fs[t.operator],s=I(t.value)?t.value:[t.value],n=null!==(e=i[t.key])&&void 0!==e?e:[];return s.length>0&&r(s,n)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}lo(t){return t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}uo(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}oo(t){return!D(t)&&I(t)}}},No=p({productTours:class{get Kr(){return this._instance.persistence}constructor(t){this.ho=null,this.co=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.Kr&&this.Kr.register({[Ai]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,i;this.ho||(t=this._instance).config.disable_product_tours||null==(i=t.persistence)||!i.get_property(Ai)||this.nr((()=>this.do()))}nr(t){var i,e;null!=(i=h.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?so.error("Could not load product tours script",i):t()}))}do(){var t;!this.ho&&null!=(t=h.__PosthogExtensions__)&&t.generateProductTours&&(this.ho=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!I(this.co)||i){var e=this.Kr;if(e){var r=e.props[no];if(I(r)&&!i)return this.co=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:i=>{var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return so.error(s),void t([],{isLoaded:!1,error:s})}var n=I(i.json.product_tours)?i.json.product_tours:[];this.co=n,e&&e.register({[no]:n}),t(n,{isLoaded:!0})}})}else t(this.co,{isLoaded:!0})}getActiveProductTours(t){D(this.ho)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.ho.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.ho)||i.showTourById(t)}previewTour(t){this.ho?this.ho.previewTour(t):this.nr((()=>{var i;this.do(),null==(i=this.ho)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.ho)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.ho)||t.nextStep()}previousStep(){var t;null==(t=this.ho)||t.previousStep()}clearCache(){var t;this.co=null,null==(t=this.Kr)||t.unregister(no)}resetTour(t){var i;null==(i=this.ho)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.ho)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.ho)||i.cancelPendingTour(t)}}},jo),Ho={siteApps:class{constructor(t){this._instance=t,this.vo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}fo(t,i){if(i){var e=this.globalsForEvent(i);this.vo.push(e),this.vo.length>1e3&&(this.vo=this.vo.slice(10))}}get siteAppLoaders(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.fo.bind(this));this.po=()=>{t(),this.vo=[],this.po=void 0}}}globalsForEvent(t){var i,e,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(h))l[d]={id:u[d],type:d,properties:v};var{$set_once:c,$set:f}=t;return{event:p({},g(t,oo),{properties:p({},t.properties,f?{$set:p({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:p({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.vo.length&&(ao.info("Processing "+this.vo.length+" events for site app with id "+t.id),this.vo.forEach((t=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(e=this.po)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,ao.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var{processEvent:n}=t.init({posthog:this._instance,callback(t){s(t)}});n&&(i.processEvent=n),r=!0}catch(i){ao.error(lo+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){ao.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}mo(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}yo(t){if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t);for(var e of Object.values(this.apps))try{null==e.processEvent||e.processEvent(i)}catch(i){ao.error("Error while processing event "+t.event+" for site app "+e.id,i)}}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.mo(),void this._instance.on("eventCaptured",(t=>this.yo(t)))):void ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.po)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;h["__$$ph_site_app_"+t]=s._instance,null==(i=h.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return ao.error(lo+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Bo={tracingHeaders:class{constructor(t){this.bo=void 0,this.wo=void 0,this.Us=()=>{var t,i;F(this.bo)&&(null==(t=h.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),F(this.wo)&&(null==(i=h.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}nr(t){var i,e;null!=(i=h.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=h.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Gn.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.nr(this.Us):(null==(t=this.bo)||t.call(this),null==(i=this.wo)||i.call(this),this.bo=void 0,this.wo=void 0)}}},qo=p({surveys:class{get Rt(){return this._instance.config}constructor(t){this._o=void 0,this._surveyManager=null,this.Io=!1,this.Co=[],this.So=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Rt.disable_surveys){var i=t.surveys;if(D(i))return Ls.warn("Flags not loaded yet. Not loading surveys.");var e=I(i);this._o=e?i.length>0:i,Ls.info("flags response received, isSurveysEnabled: "+this._o),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var e=localStorage.key(i);(null!=e&&e.startsWith(zs)||null!=e&&e.startsWith("inProgressSurvey_"))&&t.push(e)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.Io)Ls.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)Ls.info(po);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())Ls.info("Not loading surveys in cookieless mode without consent.");else{var t=null==h?void 0:h.__PosthogExtensions__;if(t){if(!F(this._o)||this.Rt.advanced_enable_surveys){var i=this._o||this.Rt.advanced_enable_surveys;this.Io=!0;try{var e=t.generateSurveys;if(e)return void this.ko(e,i);var r=t.loadExternalDependency;if(!r)return void this.xo(oe);r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this.xo("Could not load surveys script",e):this.ko(t.generateSurveys,i)}))}catch(t){throw this.xo("Error initializing surveys",t),t}finally{this.Io=!1}}}else Ls.error("PostHog Extensions not found.")}}ko(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new co(this._instance),Ls.info("Surveys loaded successfully"),this.To({isLoaded:!0})}xo(t,i){Ls.error(t,i),this.To({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Co.push(t),this._surveyManager&&this.To({isLoaded:!0}),()=>{this.Co=this.Co.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this.Rt.disable_surveys)return Ls.info(po),t([]);var e,r=this._instance.get_property(Wi);if(r&&!i)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.So?this.So.then((i=>{var{surveys:e,context:r}=i;return t(e,r)})):("undefined"!=typeof Promise&&(this.So=new Promise((t=>{e=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:i=>{var r;this.So=null;var s=i.statusCode;if(200!==s||!i.json){var n="Surveys API could not be loaded, status: "+s;Ls.error(n);var o={isLoaded:!1,error:n};return t([],o),void(null==e||e({surveys:[],context:o}))}var a,l=i.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(r=this._instance.persistence)||r.register({[Wi]:l});var h={isLoaded:!0};t(l,h),null==e||e({surveys:l,context:h})}}))}To(t){for(var i of this.Co)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Ls.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!D(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Ls.warn("init was not called")}Ao(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}Eo(t){if(D(this._surveyManager))return{eligible:!1,reason:fo};var i="string"==typeof t?this.Ao(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(D(this._surveyManager))return Ls.warn("init was not called"),{visible:!1,disabledReason:fo};var i=this.Eo(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return D(this._surveyManager)?(Ls.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:fo})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.Eo(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var s;if(D(this._surveyManager))Ls.warn("init was not called");else{var n="string"==typeof t?this.Ao(t):t;if(null!=n&&n.id)if(Hs.includes(n.type)){var o=null==r?void 0:r.querySelector(i);if(o)return null!=(s=n.appearance)&&s.surveyPopupDelaySeconds?(Ls.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,i;Ls.info("Rendering survey "+n.id+" with delay of "+(null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(n,o,e),Ls.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,o,e);Ls.warn("Survey element not found")}else Ls.warn("Surveys of type "+n.type+" cannot be rendered in the app");else Ls.warn("Survey not found")}}displaySurvey(t,i){var e;if(D(this._surveyManager))Ls.warn("init was not called");else{var r=this.Ao(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=p({},r,{appearance:p({},r.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==Pr&&i.initialResponses&&Ls.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void Ls.warn("Survey is not eligible to be displayed: ",n.disabledReason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(s,i):this.renderSurvey(s,i.selector,i.properties)}else Ls.warn("Survey not found")}}cancelPendingSurvey(t){D(this._surveyManager)?Ls.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},jo),Wo={toolbar:class{constructor(t){this.instance=t}Ro(t){h.ph_toolbar_state=t}No(){var t;return null!==(t=h.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,s){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===s&&(s=void 0),Ie(this.instance.config))return!1;if(!t||!r)return!1;i=null!=i?i:t.location,s=null!=s?s:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}var n,o=go||nr(i.hash,"__posthog")||nr(i.hash,"state"),a=o?xe((()=>JSON.parse(atob(decodeURIComponent(o)))))||xe((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?i.hash=a.desiredHash:s?s.replaceState(s.state,"",i.pathname+i.search):i.hash="")):((n=JSON.parse(e.getItem(_o)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}Mo(t){var i=h.ph_load_toolbar||h.ph_load_editor;!D(i)&&T(i)?i(t,this.instance):mo.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==r||!r.getElementById(re));if(!t||e)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=p({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(_o,JSON.stringify(p({},n,{source:void 0}))),2===this.No())this.Mo(n);else if(0===this.No()){var o;this.Ro(1),null==(o=h.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return mo.error("[Toolbar] Failed to load",t),void this.Ro(0);this.Ro(2),this.Mo(n)})),Pe(t,"turbolinks:load",(()=>{this.Ro(0),this.loadToolbar(n)}))}return!0}Fo(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},Vo=p({experiments:Fo},jo),Go={conversations:class{constructor(t){this.Oo=void 0,this._conversationsManager=null,this.Po=!1,this.Lo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var i=t.conversations;D(i)||(z(i)?this.Oo=i:(this.Oo=i.enabled,this.Lo=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Oo=void 0,this.Lo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Po||this._instance.config.disable_conversations||Ie(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==h?void 0:h.__PosthogExtensions__;if(t&&!F(this.Oo)&&this.Oo)if(this.Lo&&this.Lo.token){this.Po=!0;try{var i=t.initConversations;if(i)return this.Do(i),void(this.Po=!1);var e=t.loadExternalDependency;if(!e)return void this.Bo(oe);e(this._instance,"conversations",(i=>{i||!t.initConversations?this.Bo("Could not load conversations script",i):this.Do(t.initConversations),this.Po=!1}))}catch(t){this.Bo("Error initializing conversations",t),this.Po=!1}}else Ao.error("Conversations enabled but missing token in remote config.")}}Do(t){if(this.Lo)try{this._conversationsManager=t(this.Lo,this._instance),Ao.info("Conversations loaded successfully")}catch(t){this.Bo("Error completing conversations initialization",t)}else Ao.error("Cannot complete initialization: remote config is null")}Bo(t,i){Ao.error(t,i),this._conversationsManager=null,this.Po=!1}show(){this._conversationsManager?this._conversationsManager.show():Ao.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Oo&&!A(this._conversationsManager)}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var r=this;return f((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(Ao.warn(Do),null)}))()}getMessages(t,i){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(Ao.warn(Do),null)}))()}markAsRead(t){var i=this;return f((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Ao.warn(Do),null)}))()}getTickets(t){var i=this;return f((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Ao.warn(Do),null)}))()}requestRestoreLink(t){var i=this;return f((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Ao.warn(Do),null)}))()}restoreFromToken(t){var i=this;return f((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Ao.warn(Do),null)}))()}restoreFromUrlToken(){var t=this;return f((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ao.warn(Do),null)}))()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Ki(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Qi(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Jo={logs:class{constructor(t){var i;this.jo=!1,this.qo=!1,this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.jo=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var i,e=null==(i=t.logs)?void 0:i.captureConsoleLogs;!D(e)&&e&&(this.jo=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.jo&&!this.qo){var t=wi("[logs]"),i=null==h?void 0:h.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(e=>{var r;e||null==(r=i.logs)||!r.initializeLogs?t.error("Could not load logs script",e):(i.logs.initializeLogs(this._instance),this.qo=!0)})):t.error(oe)}else t.error("PostHog Extensions not found.")}}}},Ko=p({},jo,Lo,zo,Uo,No,Ho,qo,Bo,Wo,Vo,Go,Jo);an.__defaultExtensionClasses=p({},Ko),Oo=Gs[tn]=new an,(Mo=h.posthog)&&be(Mo._i,(function(t){if(t&&I(t)){var i=Oo.init(t[0],t[1],t[2]),e=Mo[t[2]]||Mo;i&&(i._execute_array.call(i.people,e.people),i._execute_array(e))}})),h.posthog=Oo,function(){function i(){i.done||(i.done=!0,en=!1,be(Gs,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?i():Pe(r,"DOMContentLoaded",i,{capture:!1}):t&&yi.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}();
|
|
2
2
|
//# sourceMappingURL=array.js.map
|