posthog-js 1.310.2 → 1.312.0
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/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.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.d.ts +43 -0
- package/dist/module.full.d.ts +43 -0
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.d.ts +43 -0
- 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.js.map +1 -1
- package/dist/module.no-external.d.ts +43 -0
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/src/page-view.d.ts +4 -0
- package/dist/src/posthog-core.d.ts +39 -0
- package/dist/surveys-preview.d.ts +43 -0
- package/lib/package.json +1 -1
- package/lib/src/page-view.d.ts +4 -0
- package/lib/src/page-view.js +29 -0
- package/lib/src/page-view.js.map +1 -1
- package/lib/src/posthog-core.d.ts +39 -0
- package/lib/src/posthog-core.js +83 -8
- package/lib/src/posthog-core.js.map +1 -1
- package/package.json +1 -1
package/dist/module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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=Array.prototype,r=e.forEach,s=e.indexOf,n=null==i?void 0:i.navigator,o=null==i?void 0:i.document,a=null==i?void 0:i.location,l=null==i?void 0:i.fetch,u=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,h=null==i?void 0:i.AbortController,d=null==n?void 0:n.userAgent,v=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"1.310.2"};function f(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 p(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){f(n,r,s,o,a,"next",t)}function a(t){f(n,r,s,o,a,"throw",t)}o(void 0)}))}}function g(){return g=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},g.apply(null,arguments)}function _(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}var m=["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 m.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))},b=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function w(t,i){return-1!==t.indexOf(i)}var x=function(t){return t.trim()},E=function(t){return t.replace(/^\$/,"")};var S=Array.isArray,k=Object.prototype,P=k.hasOwnProperty,T=k.toString,I=S||function(t){return"[object Array]"===T.call(t)},C=t=>"function"==typeof t,R=t=>t===Object(t)&&!I(t),F=t=>{if(R(t)){for(var i in t)if(P.call(t,i))return!1;return!0}return!1},M=t=>void 0===t,O=t=>"[object String]"==T.call(t),A=t=>O(t)&&0===t.trim().length,D=t=>null===t,j=t=>M(t)||D(t),L=t=>"[object Number]"==T.call(t),N=t=>"[object Boolean]"===T.call(t),U=t=>t instanceof FormData,z=t=>w(b,t);function H(t){return null===t||"object"!=typeof t}function B(t,i){return Object.prototype.toString.call(t)==="[object "+i+"]"}function q(t){return!M(Event)&&function(t,i){try{return t instanceof i}catch(t){return!1}}(t,Event)}var W=[!0,"true",1,"1","yes"],G=t=>w(W,t),V=[!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),L(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):t<i?(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.t={},this.i=t.i,this.o=J(t.bucketSize,0,100,t.h),this.m=J(t.refillRate,0,this.o,t.h),this.$=J(t.refillInterval,0,864e5,t.h)}S(t,i){var e=i-t.lastAccess,r=Math.floor(e/this.$);if(r>0){var s=r*this.m;t.tokens=Math.min(t.tokens+s,this.o),t.lastAccess=t.lastAccess+r*this.$}}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.t[r];return s?this.S(s,e):(s={tokens:this.o,lastAccess:e},this.t[r]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.i)||i.call(this,t)),0===s.tokens)}stop(){this.t={}}}var Y="Mobile",X="iOS",Q="Android",Z="Tablet",tt=Q+" "+Z,it="iPad",et="Apple",rt=et+" Watch",st="Safari",nt="BlackBerry",ot="Samsung",at=ot+"Browser",lt=ot+" Internet",ut="Chrome",ht=ut+" OS",dt=ut+" "+X,vt="Internet Explorer",ct=vt+" "+Y,ft="Opera",pt=ft+" Mini",gt="Edge",_t="Microsoft "+gt,mt="Firefox",yt=mt+" "+X,bt="Nintendo",wt="PlayStation",xt="Xbox",Et=Q+" "+Y,$t=Y+" "+st,St="Windows",kt=St+" Phone",Pt="Nokia",Tt="Ouya",It="Generic",Ct=It+" "+Y.toLowerCase(),Rt=It+" "+Z.toLowerCase(),Ft="Konqueror",Mt="(\\d+(\\.\\d+)?)",Ot=new RegExp("Version/"+Mt),At=new RegExp(xt,"i"),Dt=new RegExp(wt+" \\w+","i"),jt=new RegExp(bt+" \\w+","i"),Lt=new RegExp(nt+"|PlayBook|BB10","i"),Nt={"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"};var Ut,zt,Ht,Bt=(t,i)=>i&&w(i,et)||function(t){return w(t,st)&&!w(t,ut)&&!w(t,Q)}(t),qt=function(t,i){return i=i||"",w(t," OPR/")&&w(t,"Mini")?pt:w(t," OPR/")?ft:Lt.test(t)?nt:w(t,"IE"+Y)||w(t,"WPDesktop")?ct:w(t,at)?lt:w(t,gt)||w(t,"Edg/")?_t:w(t,"FBIOS")?"Facebook "+Y:w(t,"UCWEB")||w(t,"UCBrowser")?"UC Browser":w(t,"CriOS")?dt:w(t,"CrMo")||w(t,ut)?ut:w(t,Q)&&w(t,st)?Et:w(t,"FxiOS")?yt:w(t.toLowerCase(),Ft.toLowerCase())?Ft:Bt(t,i)?w(t,Y)?$t:st:w(t,mt)?mt:w(t,"MSIE")||w(t,"Trident/")?vt:w(t,"Gecko")?mt:""},Wt={[ct]:[new RegExp("rv:"+Mt)],[_t]:[new RegExp(gt+"?\\/"+Mt)],[ut]:[new RegExp("("+ut+"|CrMo)\\/"+Mt)],[dt]:[new RegExp("CriOS\\/"+Mt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Mt)],[st]:[Ot],[$t]:[Ot],[ft]:[new RegExp("(Opera|OPR)\\/"+Mt)],[mt]:[new RegExp(mt+"\\/"+Mt)],[yt]:[new RegExp("FxiOS\\/"+Mt)],[Ft]:[new RegExp("Konqueror[:/]?"+Mt,"i")],[nt]:[new RegExp(nt+" "+Mt),Ot],[Et]:[new RegExp("android\\s"+Mt,"i")],[lt]:[new RegExp(at+"\\/"+Mt)],[vt]:[new RegExp("(rv:|MSIE )"+Mt)],Mozilla:[new RegExp("rv:"+Mt)]},Gt=function(t,i){var e=qt(t,i),r=Wt[e];if(M(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=t.match(n);if(o)return parseFloat(o[o.length-2])}return null},Vt=[[new RegExp(xt+"; "+xt+" (.*?)[);]","i"),t=>[xt,t&&t[1]||""]],[new RegExp(bt,"i"),[bt,""]],[new RegExp(wt,"i"),[wt,""]],[Lt,[nt,""]],[new RegExp(St,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[kt,""];if(new RegExp(Y).test(i)&&!/IEMobile\b/.test(i))return[St+" "+Y,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],s=Nt[r]||"";return/arm/i.test(i)&&(s="RT"),[St,s]}return[St,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[X,i.join(".")]}return[X,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=M(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Q+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Q+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[Q,i.join(".")]}return[Q,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];if(t&&t[1]){var e=[t[1],t[2],t[3]||"0"];i[1]=e.join(".")}return i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ht,""]],[/Linux|debian/i,["Linux",""]]],Jt=function(t){return jt.test(t)?bt:Dt.test(t)?wt:At.test(t)?xt:new RegExp(Tt,"i").test(t)?Tt:new RegExp("("+kt+"|WPDesktop)","i").test(t)?kt:/iPad/.test(t)?it:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?rt:Lt.test(t)?nt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Pt,"i").test(t)?Pt:/(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(Y).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)?Q:tt:new RegExp("(pda|"+Y+")","i").test(t)?Ct:new RegExp(Z,"i").test(t)&&!new RegExp(Z+" pc","i").test(t)?Rt:""},Kt=t=>t instanceof Error;function Yt(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Ht&&e.length===zt||(zt=e.length,Ht=e.reduce(((e,r)=>{Ut||(Ut={});var s=Ut[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,Ut[r]=[l,u];break}}return e}),{})),Ht}}class Xt{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(),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return p((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?1:0),i.chunkIdMap)),g({},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 p((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,g({},i,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:Yt(this.stackParser)}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(r<=4){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return g({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}var Qt="?";function Zt(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?Qt:e,in_app:!0};return M(r)||(n.lineno=r),M(s)||(n.colno=s),n}var ti=(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]:Qt,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},ii=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ei=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ri=/\((\S*)(?::(\d+))(?::(\d+))\)/,si=(t,i)=>{var e=ii.exec(t);if(e){var[,r,s,n]=e;return Zt(i,r,Qt,+s,+n)}var o=ei.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=ri.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=ti(o[1]||Qt,o[2]);return Zt(i,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},ni=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,oi=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ai=(t,i)=>{var e=ni.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=oi.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]||Qt;return[n,s]=ti(n,s),Zt(i,s,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},li=/\(error: (.*)\)/,ui=50;function hi(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return function(i,r){void 0===r&&(r=0);for(var s=[],n=i.split("\n"),o=r;o<n.length;o++){var a=n[o];if(!(a.length>1024)){var l=li.test(a)?a.replace(li,"$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>=ui)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,ui).map((t=>{return g({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||Qt});var e}))}(s)}}class di{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 vi{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 e.error&&"string"==typeof e.error.message?String(e.error.message):String(e)}getStack(t){return t.stacktrace||t.stack||void 0}}class ci{constructor(){}match(t){return B(t,"ErrorEvent")&&null!=t.error}coerce(t,i){var e,r=i.apply(t.error);return r||{type:"ErrorEvent",value:t.message,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}var fi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class pi{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(fi);return r&&(i=r[1],e=r[2]),[i,e]}}var gi=["fatal","error","warning","log","info","debug"];function _i(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(!(s.length>i))return r===e.length||s.length<=i?s:s.slice(0,i)+"..."}return""}class mi{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: "+_i(t)}isSeverityLevel(t){return O(t)&&!A(t)&&gi.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var e=t[i];if(Kt(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class yi{match(t){return q(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+_i(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class bi{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 wi{match(t){return B(t,"PromiseRejectionEvent")}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){if(H(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var xi=function(i,e){var{debugEnabled:r}=void 0===e?{}:e,s={k:function(e){if(t&&(c.DEBUG||v.POSTHOG_DEBUG||r)&&!M(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;a<n;a++)o[a-1]=arguments[a];s(i,...o)}},info:function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];s.k("log",...i)},warn:function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];s.k("warn",...i)},error:function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];s.k("error",...i)},critical:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];console.error(i,...e)},uninitializedWarning:t=>{s.error("You must initialize PostHog before calling "+t)},createLogger:(t,e)=>xi(i+" "+t,e)};return s},Ei=xi("[PostHog.js]"),$i=Ei.createLogger,Si=$i("[ExternalScriptsLoader]"),ki=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Si.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=null==o?void 0:o.querySelectorAll("script");if(r)for(var s,n=function(){if(r[a].src===i){var t=r[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;a<r.length;a++)if(s=n())return s.v;var l=()=>{if(!o)return e("document not found");var r=o.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>e(t),t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");var s,n=o.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):o.body.appendChild(r)};null!=o&&o.body?l():null==o||o.addEventListener("DOMContentLoaded",l)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__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);ki(t,n,e)},v.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);ki(t,r,e)};var Pi={};function Ti(t,i,e){if(I(t))if(r&&t.forEach===r)t.forEach(i,e);else if("length"in t&&t.length===+t.length)for(var s=0,n=t.length;s<n;s++)if(s in t&&i.call(e,t[s],s)===Pi)return}function Ii(t,i,e){if(!j(t)){if(I(t))return Ti(t,i,e);if(U(t)){for(var r of t.entries())if(i.call(e,r[1],r[0])===Pi)return}else for(var s in t)if(P.call(t,s)&&i.call(e,t[s],s)===Pi)return}}var Ci=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return Ti(e,(function(i){for(var e in i)void 0!==i[e]&&(t[e]=i[e])})),t},Ri=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return Ti(e,(function(i){Ti(i,(function(i){t.push(i)}))})),t};function Fi(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 Mi=function(t){try{return t()}catch(t){return}},Oi=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;r<i;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){Ei.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ei.critical(t)}}},Ai=function(t){var i={};return Ii(t,(function(t,e){(O(t)&&t.length>0||L(t))&&(i[e]=t)})),i};function Di(t,i){return e=t,r=t=>O(t)&&!D(i)?t.slice(0,i):t,s=new Set,function t(i,e){return i!==Object(i)?r?r(i,e):i:s.has(i)?void 0:(s.add(i),I(i)?(n=[],Ti(i,(i=>{n.push(t(i))}))):(n={},Ii(i,((i,e)=>{s.has(i)||(n[e]=t(i,e))}))),n);var n}(e);var e,r,s}var ji=["herokuapp.com","vercel.app","netlify.app"];function Li(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 ji)if(e===r)return!1;return!0}function Ni(t,i){for(var e=0;e<t.length;e++)if(i(t[e]))return t[e]}function Ui(t,i,e,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:s,passive:n})}var zi="$people_distinct_id",Hi="__alias",Bi="__timers",qi="$autocapture_disabled_server_side",Wi="$heatmaps_enabled_server_side",Gi="$exception_capture_enabled_server_side",Vi="$error_tracking_suppression_rules",Ji="$error_tracking_capture_extension_exceptions",Ki="$web_vitals_enabled_server_side",Yi="$dead_clicks_enabled_server_side",Xi="$product_tours_enabled_server_side",Qi="$web_vitals_allowed_metrics",Zi="$session_recording_remote_config",te="$sesid",ie="$session_is_sampled",ee="$enabled_feature_flags",re="$early_access_features",se="$feature_flag_details",ne="$stored_person_properties",oe="$stored_group_properties",ae="$surveys",le="$flag_call_reported",ue="$user_state",he="$client_session_props",de="$capture_rate_limit",ve="$initial_campaign_params",ce="$initial_referrer_info",fe="$initial_person_info",pe="$epp",ge="__POSTHOG_TOOLBAR__",_e="$posthog_cookieless",me=[zi,Hi,"__cmpns",Bi,"$session_recording_enabled_server_side",Wi,te,ee,Vi,ue,re,se,oe,ne,ae,le,he,de,ve,ce,pe,fe,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function ye(t){return t instanceof Element&&(t.id===ge||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function be(t){return!!t&&1===t.nodeType}function we(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function xe(t){return!!t&&3===t.nodeType}function Ee(t){return!!t&&11===t.nodeType}function $e(t){return t?x(t).split(/\s+/):[]}function Se(i){var e=null==t?void 0:t.location.href;return!!(e&&i&&i.some((t=>e.match(t))))}function ke(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 $e(i)}function Pe(t){return j(t)?null:x(t).split(/(\s+)/).filter((t=>Je(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Te(t){var i="";return Ue(t)&&!ze(t)&&t.childNodes&&t.childNodes.length&&Ii(t.childNodes,(function(t){var e;xe(t)&&t.textContent&&(i+=null!==(e=Pe(t.textContent))&&void 0!==e?e:"")})),x(i)}function Ie(t){return M(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null;var i}var Ce=["a","button","form","input","select","textarea","label"];function Re(t,i){if(M(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 Fe(t){var i=t.parentNode;return!(!i||!be(i))&&i}var Me=["next","previous","prev",">","<"],Oe=10;var Ae=[".ph-no-rageclick",".ph-no-capture"];function De(i,e){if(!t||je(i))return!1;var r,s,n;N(e)?(r=!!e&&Ae,s=void 0):(r=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:Ae,s=null==e?void 0:e.content_ignorelist);if(!1===r)return!1;var{targetElementList:o}=Le(i,!1);return!function(t,i){if(!1===t||M(t))return!1;var e;if(!0===t)e=Me;else{if(!I(t))return!1;if(t.length>Oe)return Ei.error("[PostHog] content_ignorelist array cannot exceed "+Oe+" 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:Te(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!Re(o,r)}var je=t=>!t||we(t,"html")||!be(t),Le=(i,e)=>{if(!t||je(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!we(n,"body");)if(Ee(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=Fe(n);if(!o)break;if(e||Ce.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 Ne(i,e,r,s,n){var o,a,l,u;if(void 0===r&&(r=void 0),!t||je(i))return!1;if(null!=(o=r)&&o.url_allowlist&&!Se(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&Se(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}=Le(i,s);if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(M(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(!Re(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&&(Ce.indexOf(f)>-1||"true"===i.getAttribute("contenteditable"))}}function Ue(t){for(var i=t;i.parentNode&&!we(i,"body");i=i.parentNode){var e=ke(i);if(w(e,"ph-sensitive")||w(e,"ph-no-capture"))return!1}if(w(ke(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||"";if(O(s)){if(/^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,"")))return!1}return!0}function ze(t){return!!(we(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||we(t,"select")||we(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var He="(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})",Be=new RegExp("^(?:"+He+")$"),qe=new RegExp(He),We="\\d{3}-?\\d{2}-?\\d{4}",Ge=new RegExp("^("+We+")$"),Ve=new RegExp("("+We+")");function Je(t,i){if(void 0===i&&(i=!0),j(t))return!1;if(O(t)){if(t=x(t),(i?Be:qe).test((t||"").replace(/[- ]/g,"")))return!1;if((i?Ge:Ve).test(t))return!1}return!0}function Ke(t){var i=Te(t);return Je(i=(i+" "+Ye(t)).trim())?i:""}function Ye(t){var i="";return t&&t.childNodes&&t.childNodes.length&&Ii(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Te(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Ye(t)).trim())}catch(t){Ei.error("[AutoCapture]",t)}})),i}function Xe(t){return function(t){var i=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=g({},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 Fi(n).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return o[Qe(i.toString())]=Qe(e.toString())})),r+=":",r+=Fi(o).map((t=>{var[i,e]=t;return i+'="'+e+'"'})).join("")}));return i.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:Ze(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Fi(t).filter((t=>{var[i]=t;return 0===i.indexOf("attr__")})).forEach((t=>{var[i,e]=t;return r.attributes[i]=e})),r}))}(t))}function Qe(t){return t.replace(/"|\\"/g,'\\"')}function Ze(t){var i=t.attr__class;return i?I(i)?i:$e(i):void 0}class tr{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&&e-r.timestamp<this.timeoutMs){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 ir="$copy_autocapture",er=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),rr=["fatal","error","warning","log","info","debug"],sr=t=>{var i=null==o?void 0:o.createElement("a");return M(i)?null:(i.href=t,i)},nr=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return Ii(t,(function(t,i){M(t)||M(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)},or=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!I(e)||e.length<2)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Ei.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ar=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],u=(a||"").split("&"),h=[],d=0;d<u.length;d++){var v=u[d].split("=");I(v)&&(i.includes(v[0])?h.push(v[0]+"="+e):h.push(u[d]))}var c=l;return null!=a&&(c+="?"+h.join("&")),null!=n&&(c+="#"+n),c},lr=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},ur=$i("[AutoCapture]");function hr(t,i){return i.length>t?i.slice(0,t)+"...":i}function dr(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!be(i));return i}function vr(t,i,e,r){var s=t.tagName.toLowerCase(),n={tag_name:s};Ce.indexOf(s)>-1&&!e&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=hr(1024,Ke(t)):n.$el_text=hr(1024,Te(t)));var o=ke(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),Ii(t.attributes,(function(e){var s;if((!ze(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&((null==r||!r.includes(e.name))&&!i&&Je(e.value)&&(s=e.name,!O(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7)))){var o=e.value;"class"===e.name&&(o=$e(o).join(" ")),n["attr__"+e.name]=hr(1024,o)}}));for(var a=1,l=1,u=t;u=dr(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function cr(i,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=e,h=[i],d=i;d.parentNode&&!we(d,"body");)Ee(d.parentNode)?(h.push(d.parentNode.host),d=d.parentNode.host):(h.push(d.parentNode),d=d.parentNode);var v,c=[],f={},p=!1,g=!1;if(Ii(h,(t=>{var i=Ue(t);"a"===t.tagName.toLowerCase()&&(p=t.getAttribute("href"),p=i&&p&&Je(p)&&p),w(ke(t),"ph-no-capture")&&(g=!0),c.push(vr(t,o,a,l));var e=function(t){if(!Ue(t))return{};var i={};return Ii(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&&Je(r)&&(i[e]=r)}})),i}(t);Ci(f,e)})),g)return{props:{},explicitNoCapture:g};if(a||("a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?c[0].$el_text=Ke(i):c[0].$el_text=Te(i)),p){var _,m;c[0].attr__href=p;var y=null==(_=sr(p))?void 0:_.host,b=null==t||null==(m=t.location)?void 0:m.host;y&&b&&y!==b&&(v=p)}return{props:Ci({$event_type:n.type,$ce_version:1},u?{}:{$elements:c},{$elements_chain:Xe(c)},null!=(r=c[0])&&r.$el_text?{$el_text:null==(s=c[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},f)}}class fr{constructor(t){this.P=!1,this.T=null,this.I=!1,this.instance=t,this.rageclicks=new tr(t.config.rageclick),this.C=null}get R(){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}F(){if(this.isBrowserSupported()){if(t&&o){var i=i=>{i=i||(null==t?void 0:t.event);try{this.M(i)}catch(t){ur.error("Failed to capture event",t)}};if(Ui(o,"submit",i,{capture:!0}),Ui(o,"change",i,{capture:!0}),Ui(o,"click",i,{capture:!0}),this.R.capture_copied_text){var e=i=>{i=i||(null==t?void 0:t.event),this.M(i,ir)};Ui(o,"copy",e,{capture:!0}),Ui(o,"cut",e,{capture:!0})}}}else ur.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.I=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[qi]:!!t.autocapture_opt_out}),this.T=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.C=t}getElementSelectors(t){var i,e=[];return null==(i=this.C)||i.forEach((i=>{var r=null==o?void 0:o.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i,e=null==(t=this.instance.persistence)?void 0:t.props[qi],r=this.T;if(D(r)&&!N(e)&&!this.instance.O())return!1;var s=null!==(i=this.T)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!s}M(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r,s=Ie(i);if(xe(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())&&De(s,this.instance.config.rageclick)&&this.M(i,"$rageclick");var n=e===ir;if(s&&Ne(s,i,this.R,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=cr(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),e===ir){var u,h=Pe(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 C(null==o?void 0:o.querySelectorAll)}}Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return L(t)&&isFinite(t)&&Math.floor(t)===t});var pr="0123456789abcdef";class gr{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)||t<0||i<0||e<0||r<0||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 gr(s)}toString(){for(var t="",i=0;i<this.bytes.length;i++)t=t+pr.charAt(this.bytes[i]>>>4)+pr.charAt(15&this.bytes[i]),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 gr(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;i<16;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class _r{constructor(){this.A=0,this.D=0,this.j=new br}generate(){var t=this.generateOrAbort();if(M(t)){this.A=0;var i=this.generateOrAbort();if(M(i))throw new Error("Could not generate UUID after timestamp reset");return i}return t}generateOrAbort(){var t=Date.now();if(t>this.A)this.A=t,this.L();else{if(!(t+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return gr.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var mr,yr=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;i<t.length;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!M(t.crypto)&&crypto.getRandomValues&&(yr=t=>crypto.getRandomValues(t));class br{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(yr(this.N),this.U=0),this.N[this.U++]}}var wr=()=>xr().toString(),xr=()=>(mr||(mr=new _r)).generate(),Er="";var $r=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Sr(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=o),Er)return Er;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+wr();!Er&&r--;){var n=e.slice(r).join("."),a=s+"=1;domain=."+n+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(s)&&(i.cookie=a+";max-age=0",Er=n)}return Er}(t);if(!e){var r=(t=>{var i=t.match($r);return i?i[0]:""})(t);r!==e&&Ei.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}var kr={H:()=>!!o,B:function(t){Ei.error("cookieStore error: "+t)},q:function(t){if(o){try{for(var i=t+"=",e=o.cookie.split(";").filter((t=>t.length)),r=0;r<e.length;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}},W:function(t){var i;try{i=JSON.parse(kr.q(t))||{}}catch(t){}return i},G:function(t,i,e,r,s){if(o)try{var n="",a="",l=Sr(o.location.hostname,r);if(e){var u=new Date;u.setTime(u.getTime()+24*e*60*60*1e3),n="; expires="+u.toUTCString()}s&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&Ei.warn("cookieStore warning: large cookie, len="+h.length),o.cookie=h,h}catch(t){return}},V:function(t,i){if(null!=o&&o.cookie)try{kr.G(t,"",-1,i)}catch(t){return}}},Pr=null,Tr={H:function(){if(!D(Pr))return Pr;var i=!0;if(M(t))i=!1;else try{var e="__mplssupport__";Tr.G(e,"xyz"),'"xyz"'!==Tr.q(e)&&(i=!1),Tr.V(e)}catch(t){i=!1}return i||Ei.error("localStorage unsupported; falling back to cookie store"),Pr=i,i},B:function(t){Ei.error("localStorage error: "+t)},q:function(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){Tr.B(t)}return null},W:function(t){try{return JSON.parse(Tr.q(t))||{}}catch(t){}return null},G:function(i,e){try{null==t||t.localStorage.setItem(i,JSON.stringify(e))}catch(t){Tr.B(t)}},V:function(i){try{null==t||t.localStorage.removeItem(i)}catch(t){Tr.B(t)}}},Ir=["$device_id","distinct_id",te,ie,pe,fe],Cr=g({},Tr,{W:function(t){try{var i={};try{i=kr.W(t)||{}}catch(t){}var e=Ci(i,JSON.parse(Tr.q(t)||"{}"));return Tr.G(t,e),e}catch(t){}return null},G:function(t,i,e,r,s,n){try{Tr.G(t,i,void 0,void 0,n);var o={};Ir.forEach((t=>{i[t]&&(o[t]=i[t])})),Object.keys(o).length&&kr.G(t,o,e,r,s,n)}catch(t){Tr.B(t)}},V:function(i,e){try{null==t||t.localStorage.removeItem(i),kr.V(i,e)}catch(t){Tr.B(t)}}}),Rr={},Fr={H:function(){return!0},B:function(t){Ei.error("memoryStorage error: "+t)},q:function(t){return Rr[t]||null},W:function(t){return Rr[t]||null},G:function(t,i){Rr[t]=i},V:function(t){delete Rr[t]}},Mr=null,Or={H:function(){if(!D(Mr))return Mr;if(Mr=!0,M(t))Mr=!1;else try{var i="__support__";Or.G(i,"xyz"),'"xyz"'!==Or.q(i)&&(Mr=!1),Or.V(i)}catch(t){Mr=!1}return Mr},B:function(t){Ei.error("sessionStorage error: ",t)},q:function(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){Or.B(t)}return null},W:function(t){try{return JSON.parse(Or.q(t))||null}catch(t){}return null},G:function(i,e){try{null==t||t.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){Or.B(t)}},V:function(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){Or.B(t)}}},Ar=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class Dr{constructor(t){this._instance=t}get R(){return this._instance.config}get consent(){return this.J()?Ar.DENIED:this.K}isOptedOut(){return"always"===this.R.cookieless_mode||(this.consent===Ar.DENIED||this.consent===Ar.PENDING&&(this.R.opt_out_capturing_by_default||"on_reject"===this.R.cookieless_mode))}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Ar.DENIED}optInOut(t){this.Y.G(this.X,t?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token: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 K(){var t=this.Y.q(this.X);return G(t)?Ar.GRANTED:w(V,t)?Ar.DENIED:Ar.PENDING}get Y(){if(!this.Z){var t=this.R.opt_out_capturing_persistence_type;this.Z="localStorage"===t?Tr:kr;var i="localStorage"===t?kr:Tr;i.q(this.X)&&(this.Z.q(this.X)||this.optInOut(G(i.q(this.X))),i.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!Ni([null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,v.doNotTrack],(t=>G(t)))}}var jr=$i("[Dead Clicks]"),Lr=()=>!0,Nr=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Yi)),r=t.instance.config.capture_dead_clicks;return N(r)?r:!!R(r)||e};class Ur{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[Yi]:null==t?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?jr.error("failed to load script",i):t()}))}et(){var t;if(o){if(!this.tt&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=R(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.tt=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.tt.start(o),jr.info("starting...")}}else jr.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,jr.info("stopping..."))}}var zr=$i("[ExceptionAutocapture]");class Hr{constructor(i){var e,r,s;this.rt=()=>{var i;if(t&&this.isEnabled&&null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=e(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=r(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=s(this.captureException.bind(this)))}catch(t){zr.error("failed to start",t),this.ut()}}},this._instance=i,this.ht=!(null==(e=this._instance.persistence)||!e.props[Gi]),this.dt=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,h:zr}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return R(t)?i=g({},i,t):(M(t)?this.ht:t)&&(i=g({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(zr.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return zr.error("failed to load script",i);t()}))}ut(){var t,i,e;null==(t=this.st)||t.call(this),this.st=void 0,null==(i=this.nt)||i.call(this),this.nt=void 0,null==(e=this.ot)||e.call(this),this.ot=void 0}onRemoteConfig(t){var i=t.autocaptureExceptions;this.ht=!!i||!1,this._instance.persistence&&this._instance.persistence.register({[Gi]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(t){var i,e,r=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.dt.consumeRateLimit(r)?zr.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(t)}}function Br(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return C(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}class qr{constructor(i){var e;this._instance=i,this.ct=(null==t||null==(e=t.location)?void 0:e.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Ei.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,Ei.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(t&&t.history){var r=this;null!=(i=t.history.pushState)&&i.__posthog_wrapped__||Br(t.history,"pushState",(t=>function(i,e,s){t.call(this,i,e,s),r._t("pushState")})),null!=(e=t.history.replaceState)&&e.__posthog_wrapped__||Br(t.history,"replaceState",(t=>function(i,e,s){t.call(this,i,e,s),r._t("replaceState")})),this.yt()}}_t(i){try{var e,r=null==t||null==(e=t.location)?void 0:e.pathname;if(!r)return;r!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:i}),this.ct=r}catch(t){Ei.error("Error capturing "+i+" pageview",t)}}yt(){if(!this.ft){var i=()=>{this._t("popstate")};Ui(t,"popstate",i),this.ft=()=>{t&&t.removeEventListener("popstate",i)}}}}var Wr=$i("[SegmentIntegration]");function Gr(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()||wr();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(ue,"identified")),i()},s=e.user();"then"in s&&C(s.then)?s.then((t=>r(t))):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||Wr.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()||(Wr.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Wr.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,"$pageview"),identify:t=>i(t,"$identify"),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}var Vr="posthog-js";function Jr(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=(null==(a=i.exception)?void 0:a.values)||[],f=c.map((t=>g({},t,{stacktrace:t.stacktrace?g({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>g({},t,{platform:"web:javascript"})))}):void 0}))),p={$exception_message:(null==(l=c[0])?void 0:l.value)||i.message,$exception_type:null==(u=c[0])?void 0:u.type,$exception_level:i.level,$exception_list:f,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(h=c[0])?void 0:h.value)||i.message,$sentry_exception_type:null==(d=c[0])?void 0:d.type,$sentry_tags:i.tags};return e&&r&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+e+"/issues/?project="+r+"&query="+i.event_id),o&&t.exceptions.sendExceptionEvent(p),i}}class Kr{constructor(t,i,e,r,s,n){this.name=Vr,this.setupOnce=function(o){o(Jr(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}var Yr=null!=t&&t.location?lr(t.location.hash,"__posthog")||lr(location.hash,"state"):null,Xr="_postHogToolbarParams",Qr=$i("[Toolbar]"),Zr=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(Zr||{});class ts{constructor(t){this.instance=t}bt(t){v.ph_toolbar_state=t}wt(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:Zr.UNINITIALIZED}maybeLoadToolbar(i,e,r){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===r&&(r=void 0),!t||!o)return!1;i=null!=i?i:t.location,r=null!=r?r: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 s,n=Yr||lr(i.hash,"__posthog")||lr(i.hash,"state"),a=n?Mi((()=>JSON.parse(atob(decodeURIComponent(n)))))||Mi((()=>JSON.parse(decodeURIComponent(n)))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?i.hash=a.desiredHash:r?r.replaceState(r.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(Xr)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch(t){return!1}}xt(t){var i=v.ph_load_toolbar||v.ph_load_editor;!j(i)&&C(i)?i(t,this.instance):Qr.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==o||!o.getElementById(ge));if(!t||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=g({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(t.localStorage.setItem(Xr,JSON.stringify(g({},s,{source:void 0}))),this.wt()===Zr.LOADED)this.xt(s);else if(this.wt()===Zr.UNINITIALIZED){var n;this.bt(Zr.LOADING),null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return Qr.error("[Toolbar] Failed to load",t),void this.bt(Zr.UNINITIALIZED);this.bt(Zr.LOADED),this.xt(s)})),Ui(t,"turbolinks:load",(()=>{this.bt(Zr.UNINITIALIZED),this.loadToolbar(s)}))}return!0}Et(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)}}var is=$i("[TracingHeaders]");class es{constructor(t){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,i;M(this.$t)&&(null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager));M(this.St)&&(null==(i=v.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return is.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.it(this.rt):(null==(t=this.$t)||t.call(this),null==(i=this.St)||i.call(this),this.$t=void 0,this.St=void 0)}}var rs="https?://(.*)",ss=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ns=Ri(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ss),os="<masked>",as=["li_fat_id"];function ls(t,i,e){if(!o)return{};var r,s=i?Ri([],ss,e||[]):[],n=us(ar(o.URL,s,os),t),a=(r={},Ii(as,(function(t){var i=kr.q(t);r[t]=i||null})),r);return Ci(a,n)}function us(t,i){var e=ns.concat(i||[]),r={};return Ii(e,(function(i){var e=or(t,i);r[i]=e||null})),r}function hs(t){var i=function(t){return t?0===t.search(rs+"google.([^/?]*)")?"google":0===t.search(rs+"bing.com")?"bing":0===t.search(rs+"yahoo.com")?"yahoo":0===t.search(rs+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!D(i)){r.$search_engine=i;var s=o?or(o.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function ds(){return navigator.language||navigator.userLanguage}function vs(){return(null==o?void 0:o.referrer)||"$direct"}function cs(t,i){var e=t?Ri([],ss,i||[]):[],r=null==a?void 0:a.href.substring(0,1e3);return{r:vs().substring(0,1e3),u:r?ar(r,e,os):void 0}}function fs(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:"$direct"==e?"$direct":null==(i=sr(e))?void 0:i.host};if(r){s.$current_url=r;var n=sr(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=us(r);Ci(s,o)}if(e){var a=hs(e);Ci(s,a)}return s}function ps(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function gs(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function _s(i,e){if(!d)return{};var r,s,n,o=i?Ri([],ss,e||[]):[],[l,u]=function(t){for(var i=0;i<Vt.length;i++){var[e,r]=Vt[i],s=e.exec(t),n=s&&(C(r)?r(s,t):r);if(n)return n}return["",""]}(d);return Ci(Ai({$os:l,$os_version:u,$browser:qt(d,navigator.vendor),$device:Jt(d),$device_type:(s=d,n=Jt(s),n===it||n===tt||"Kobo"===n||"Kindle Fire"===n||n===Rt?Z:n===bt||n===xt||n===wt||n===Tt?"Console":n===rt?"Wearable":n?Y:"Desktop"),$timezone:ps(),$timezone_offset:gs()}),{$current_url:ar(null==a?void 0:a.href,o,os),$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:Gt(d,navigator.vendor),$browser_language:ds(),$browser_language_prefix:(r=ds(),"string"==typeof r?r.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:"web",$lib_version:c.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var ms=$i("[Web Vitals]"),ys=9e5;class bs{constructor(t){var i;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),0!==this.N.metrics.length&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((t,i)=>g({},t,{["$web_vitals_"+i.name+"_event"]:g({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=t=>{var i,e=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(M(e))ms.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Ct();if(!M(r))if(j(null==t?void 0:t.name)||j(null==t?void 0:t.value))ms.error("Invalid metric received",t);else if(this.Rt&&t.value>=this.Rt)ms.error("Ignoring metric with value >= "+this.Rt,t);else this.N.url!==r&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),M(this.N.url)&&(this.N.url=r),this.N.firstMetricTimestamp=M(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.N.metrics.push(g({},t,{$current_url:r,$session_id:e.sessionId,$window_id:e.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()}},this.rt=()=>{var t,i,e,r,s=v.__PosthogExtensions__;M(s)||M(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.It.bind(this)),this.P=!0):ms.error("web vitals callbacks not loaded - not starting")},this._instance=t,this.kt=!(null==(i=this._instance.persistence)||!i.props[Ki]),this.startIfEnabled()}get allowedMetrics(){var t,i,e=R(this._instance.config.capture_performance)?null==(t=this._instance.config.capture_performance)?void 0:t.web_vitals_allowed_metrics:void 0;return M(e)?(null==(i=this._instance.persistence)?void 0:i.props[Qi])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Rt(){var t=R(this._instance.config.capture_performance)&&L(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:ys;return 0<t&&t<=6e4?ys:t}get isEnabled(){var t=null==a?void 0:a.protocol;if("http:"!==t&&"https:"!==t)return ms.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:N(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return N(i)?i:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(ms.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(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({[Ki]:i}),this._instance.persistence.register({[Qi]:e})),this.kt=i,this.startIfEnabled()}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.postHogWebVitalsCallbacks&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"web-vitals",(i=>{i?ms.error("failed to load script",i):t()}))}Ct(){var i=t?t.location.href:void 0;if(i){var e=this._instance.config.mask_personal_data_properties,r=this._instance.config.custom_personal_data_properties,s=e?Ri([],ss,r||[]):[];return ar(i,s,os)}ms.error("Could not determine current URL")}}var ws=$i("[Heatmaps]");function xs(t){return R(t)&&"clientX"in t&&"clientY"in t&&L(t.clientX)&&L(t.clientY)}class Es{constructor(t){var i;this.kt=!1,this.P=!1,this.Ft=null,this.instance=t,this.kt=!(null==(i=this.instance.persistence)||!i.props[Wi]),this.rageclicks=new tr(t.config.rageclick)}get flushIntervalMilliseconds(){var t=5e3;return R(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return M(this.instance.config.capture_heatmaps)?M(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;ws.info("starting..."),this.Mt(),this.Ot()}else{var t;clearInterval(null!==(t=this.Ft)&&void 0!==t?t:void 0),this.At(),this.getAndClearBuffer()}}onRemoteConfig(t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Wi]:i}),this.kt=i,this.startIfEnabled()}getAndClearBuffer(){var t=this.N;return this.N=void 0,t}Dt(t){this.jt(t.originalEvent,"deadclick")}Ot(){this.Ft&&clearInterval(this.Ft),this.Ft=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(o)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Mt(){t&&o&&(this.Nt=this.Lt.bind(this),Ui(t,"beforeunload",this.Nt),this.Ut=i=>this.jt(i||(null==t?void 0:t.event)),Ui(o,"click",this.Ut,{capture:!0}),this.zt=i=>this.Ht(i||(null==t?void 0:t.event)),Ui(o,"mousemove",this.zt,{capture:!0}),this.Bt=new Ur(this.instance,Lr,this.Dt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Ot.bind(this),Ui(o,"visibilitychange",this.qt),this.P=!0)}At(){var i;t&&o&&(this.Nt&&t.removeEventListener("beforeunload",this.Nt),this.Ut&&o.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&o.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&o.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),null==(i=this.Bt)||i.stop(),this.P=!1)}Gt(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&&be(s)&&!we(s,"body");){if(s===r)return!1;if(w(e,null==t?void 0:t.getComputedStyle(s).position))return!0;s=Fe(s)}return!1}(Ie(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}jt(t,i){var e;if(void 0===i&&(i="click"),!ye(t.target)&&xs(t)){var r=this.Gt(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Vt(g({},r,{type:"rageclick"})),this.Vt(r)}}Ht(t){!ye(t.target)&&xs(t)&&(clearTimeout(this.Wt),this.Wt=setTimeout((()=>{this.Vt(this.Gt(t,"mousemove"))}),500))}Vt(i){if(t){var e=t.location.href,r=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=r?Ri([],ss,s||[]):[],o=ar(e,n,os);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(i)}}Lt(){this.N&&!F(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class $s{constructor(t){this._instance=t}doPageView(i,e){var r,s=this.Jt(i,e);return this.Kt={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.Jt(t,null==(i=this.Kt)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Kt)?void 0:t.pageViewId}}Jt(t,i){var e=this.Kt;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(!(M(n)||M(o)||M(a)||M(l)||M(u)||M(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?1:J(o/n,0,1,Ei),v=n<=1?1:J(a/n,0,1,Ei),c=l<=1?1:J(u/l,0,1,Ei),f=l<=1?1:J(h/l,0,1,Ei);r=Ci(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 Ss=Uint8Array,ks=Uint16Array,Ps=Uint32Array,Ts=new Ss([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]),Is=new Ss([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]),Cs=new Ss([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Rs=function(t,i){for(var e=new ks(31),r=0;r<31;++r)e[r]=i+=1<<t[r-1];var s=new Ps(e[30]);for(r=1;r<30;++r)for(var n=e[r];n<e[r+1];++n)s[n]=n-e[r]<<5|r;return[e,s]},Fs=Rs(Ts,2),Ms=Fs[0],Os=Fs[1];Ms[28]=258,Os[258]=28;for(var As=Rs(Is,0)[1],Ds=new ks(32768),js=0;js<32768;++js){var Ls=(43690&js)>>>1|(21845&js)<<1;Ls=(61680&(Ls=(52428&Ls)>>>2|(13107&Ls)<<2))>>>4|(3855&Ls)<<4,Ds[js]=((65280&Ls)>>>8|(255&Ls)<<8)>>>1}var Ns=function(t,i,e){for(var r=t.length,s=0,n=new ks(i);s<r;++s)++n[t[s]-1];var o,a=new ks(i);for(s=0;s<i;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new ks(1<<i);var l=15-i;for(s=0;s<r;++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;d<=v;++d)o[Ds[d]>>>l]=u}else for(o=new ks(r),s=0;s<r;++s)o[s]=Ds[a[t[s]-1]++]>>>15-t[s];return o},Us=new Ss(288);for(js=0;js<144;++js)Us[js]=8;for(js=144;js<256;++js)Us[js]=9;for(js=256;js<280;++js)Us[js]=7;for(js=280;js<288;++js)Us[js]=8;var zs=new Ss(32);for(js=0;js<32;++js)zs[js]=5;var Hs=Ns(Us,9,0),Bs=Ns(zs,5,0),qs=function(t){return(t/8>>0)+(7&t&&1)},Ws=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof ks?ks:t instanceof Ps?Ps:Ss)(e-i);return r.set(t.subarray(i,e)),r},Gs=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8},Vs=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8,t[r+2]|=e>>>16},Js=function(t,i){for(var e=[],r=0;r<t.length;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Ss(0),0];if(1==s){var o=new Ss(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[u].f<e[d].f?u++:d++],l=e[u!=h&&e[u].f<e[d].f?u++:d++],e[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;r<s;++r)n[r].s>v&&(v=n[r].s);var c=new ks(v+1),f=Ks(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}));r<s;++r){var m=n[r].s;if(!(c[m]>i))break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var y=n[r].s;c[y]<i?p-=1<<i-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==i&&(--c[b],++p)}f=i}return[new Ss(c),f]},Ks=function(t,i,e){return-1==t.s?Math.max(Ks(t.l,i,e+1),Ks(t.r,i,e+1)):i[t.s]=e},Ys=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new ks(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;a<=i;++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]},Xs=function(t,i){for(var e=0,r=0;r<i.length;++r)e+=t[r]*i[r];return e},Qs=function(t,i,e){var r=e.length,s=qs(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;n<r;++n)t[s+n+4]=e[n];return 8*(s+4+r)},Zs=function(t,i,e,r,s,n,o,a,l,u,h){Gs(i,h++,e),++s[256];for(var d=Js(s,15),v=d[0],c=d[1],f=Js(n,15),p=f[0],g=f[1],_=Ys(v),m=_[0],y=_[1],b=Ys(p),w=b[0],x=b[1],E=new ks(19),S=0;S<m.length;++S)E[31&m[S]]++;for(S=0;S<w.length;++S)E[31&w[S]]++;for(var k=Js(E,7),P=k[0],T=k[1],I=19;I>4&&!P[Cs[I-1]];--I);var C,R,F,M,O=u+5<<3,A=Xs(s,Us)+Xs(n,zs)+o,D=Xs(s,v)+Xs(n,p)+o+14+3*I+Xs(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(O<=A&&O<=D)return Qs(i,h,t.subarray(l,l+u));if(Gs(i,h,1+(D<A)),h+=2,D<A){C=Ns(v,c,0),R=v,F=Ns(p,g,0),M=p;var j=Ns(P,T,0);Gs(i,h,y-257),Gs(i,h+5,x-1),Gs(i,h+10,I-4),h+=14;for(S=0;S<I;++S)Gs(i,h+3*S,P[Cs[S]]);h+=3*I;for(var L=[m,w],N=0;N<2;++N){var U=L[N];for(S=0;S<U.length;++S){var z=31&U[S];Gs(i,h,j[z]),h+=P[z],z>15&&(Gs(i,h,U[S]>>>5&127),h+=U[S]>>>12)}}}else C=Hs,R=Us,F=Bs,M=zs;for(S=0;S<a;++S)if(r[S]>255){z=r[S]>>>18&31;Vs(i,h,C[z+257]),h+=R[z+257],z>7&&(Gs(i,h,r[S]>>>23&31),h+=Ts[z]);var H=31&r[S];Vs(i,h,F[H]),h+=M[H],H>3&&(Vs(i,h,r[S]>>>5&8191),h+=Is[H])}else Vs(i,h,C[r[S]]),h+=R[r[S]];return Vs(i,h,C[256]),h+R[256]},tn=new Ps([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),en=function(){for(var t=new Ps(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),rn=function(t,i,e,r,s){return function(t,i,e,r,s,n){var o=t.length,a=new Ss(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!i||o<8)for(var h=0;h<=o;h+=65535){var d=h+65535;d<o?u=Qs(l,u,t.subarray(h,d)):(l[h]=n,u=Qs(l,u,t.subarray(h,o)))}else{for(var v=tn[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new ks(32768),_=new ks(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new Ps(25e3),x=new ks(288),E=new ks(32),S=0,k=0,P=(h=0,0),T=0,I=0;h<o;++h){var C=b(h),R=32767&h,F=_[C];if(g[R]=F,_[C]=R,T<=h){var M=o-h;if((S>7e3||P>24576)&&M>423){u=Zs(t,l,0,w,x,E,k,P,I,h-I,u),P=S=k=0,I=h;for(var O=0;O<286;++O)x[O]=0;for(O=0;O<30;++O)E[O]=0}var A=2,D=0,j=f,L=R-F&32767;if(M>2&&C==b(h-L))for(var N=Math.min(c,M)-1,U=Math.min(32767,h),z=Math.min(258,M);L<=U&&--j&&R!=F;){if(t[h+A]==t[h+A-L]){for(var H=0;H<z&&t[h+H]==t[h+H-L];++H);if(H>A){if(A=H,D=L,H>N)break;var B=Math.min(L,H-2),q=0;for(O=0;O<B;++O){var W=h-L+O+32768&32767,G=W-g[W]+32768&32767;G>q&&(q=G,F=W)}}}L+=(R=F)-(F=g[R])+32768&32767}if(D){w[P++]=268435456|Os[A]<<18|As[D];var V=31&Os[A],J=31&As[D];k+=Ts[V]+Is[J],++x[257+V],++E[J],T=h+A,++S}else w[P++]=t[h],++x[t[h]]}}u=Zs(t,l,n,w,x,E,k,P,I,h-I,u)}return Ws(a,0,r+qs(u)+s)}(t,null==i.level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,e,r,!0)},sn=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function nn(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p:function(i){for(var e=t,r=0;r<i.length;++r)e=en[255&e^i[r]]^e>>>8;t=e},d:function(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n=rn(t,i,10+((s=i).filename&&s.filename.length+1||0),8),o=n.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=i.level<2?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&sn(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;r<=e.length;++r)t[r+10]=e.charCodeAt(r)}}(n,i),sn(n,o-8,e.d()),sn(n,o-4,r),n}var on=function(t){var i,e,r,s,n="";for(i=e=0,r=(t=(t+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var o=t.charCodeAt(s),a=null;o<128?e++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),D(a)||(e>i&&(n+=t.substring(i,e)),n+=a,i=e=s+1)}return e>i&&(n+=t.substring(i,t.length)),n},an=!!u||!!l,ln="text/plain",un=function(t,i,e){var r;void 0===e&&(e=!0);var[s,n]=t.split("?"),o=g({},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=nr(o);return l&&a.push(l),s+"?"+a.join("&")},hn=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),dn=t=>{var{data:i,compression:e}=t;if(i){if(e===er.GZipJS){var r=nn(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Ss(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;o<e;++o){if(s+5>r.length){var a=new Ss(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||i?n(l):l<2048?(n(192|l>>>6),n(128|63&l)):l>55295&&l<57344?(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 Ws(r,0,s)}(hn(i)),{mtime:0}),s=new Blob([r],{type:ln});return{contentType:ln,body:s,estimatedSize:s.size}}if(e===er.Base64){var n=function(t){var i,e,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,u="",h=[];if(!t)return t;t=on(t);do{i=(n=t.charCodeAt(a++)<<16|t.charCodeAt(a++)<<8|t.charCodeAt(a++))>>18&63,e=n>>12&63,r=n>>6&63,s=63&n,h[l++]=o.charAt(i)+o.charAt(e)+o.charAt(r)+o.charAt(s)}while(a<t.length);switch(u=h.join(""),t.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u}(hn(i)),o=(t=>"data="+encodeURIComponent("string"==typeof t?t:hn(t)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=hn(i);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},vn=[];l&&vn.push({transport:"fetch",method:t=>{var i,e,{contentType:r,body:s,estimatedSize:n}=null!==(i=dn(t))&&void 0!==i?i:{},o=new Headers;Ii(t.headers,(function(t,i){o.append(i,t)})),r&&o.append("Content-Type",r);var a=t.url,u=null;if(h){var d=new h;u={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}l(a,g({method:(null==t?void 0:t.method)||"GET",headers:o,keepalive:"POST"===t.method&&(n||0)<52428.8,body:s,signal:null==(e=u)?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){Ei.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{Ei.error(i),null==t.callback||t.callback({statusCode:0,text:i})})).finally((()=>u?clearTimeout(u.timeout):null))}}),u&&vn.push({transport:"XHR",method:t=>{var i,e=new u;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=dn(t))&&void 0!==i?i:{};Ii(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!=n&&n.sendBeacon&&vn.push({transport:"sendBeacon",method:t=>{var i=un(t.url,{beacon:"1"});try{var e,{contentType:r,body:s}=null!==(e=dn(t))&&void 0!==e?e:{},o="string"==typeof s?new Blob([s],{type:r}):s;n.sendBeacon(i,o)}catch(t){}}});var cn=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 fn(t,i,e){return hn({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var pn={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=>cn(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!cn(i,t))))),icontains:(t,i)=>i.map(gn).some((i=>t.map(gn).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(gn).every((i=>t.map(gn).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)))}))},gn=t=>t.toLowerCase();function _n(t,i){return!t||Object.entries(t).every((t=>{var[e,r]=t,s=null==i?void 0:i[e];if(M(s)||D(s))return!1;var n=[String(s)],o=pn[r.operator];return!!o&&o(r.values,n)}))}var mn=$i("[Error tracking]");class yn{constructor(t){var i,e;this.Yt=[],this.Xt=new Xt([new di,new wi,new ci,new vi,new yi,new mi,new pi,new bi],hi("web:javascript",si,ai)),this._instance=t,this.Yt=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Vi))&&void 0!==i?i:[]}onRemoteConfig(t){var i,e,r,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.Yt=s,this._instance.persistence&&this._instance.persistence.register({[Vi]:this.Yt,[Ji]:n})}get Qt(){var t,i=!!this._instance.get_property(Ji),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Xt.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.Zt(i)){if(this.ti(i))return void mn.info("Skipping exception capture because a suppression rule matched");if(!this.Qt&&this.ii(i))return void mn.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ei(i))return void mn.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ti(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.Yt.some((t=>{var e=t.values.map((t=>{var e,r=pn[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)}))}ii(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://")))}ei(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}Zt(t){return!j(t)&&I(t)}}var bn=$i("[FeatureFlags]"),wn=$i("[FeatureFlags]",{debugEnabled:!0}),xn="$active_feature_flags",En="$override_feature_flags",$n="$feature_flag_payloads",Sn="$override_feature_flag_payloads",kn="$feature_flag_request_id",Pn="$feature_flag_evaluated_at",Tn=t=>{var i={};for(var[e,r]of Fi(t||{}))r&&(i[e]=r);return i},In=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]})))):bn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},Cn=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class Rn{constructor(t){this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this._instance=t,this.featureFlagEventHandlers=[]}hi(){var t=this._instance.config.evaluation_environments;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||bn.error("Invalid evaluation environment found:",t,"Expected non-empty string"),i})):[]}di(){return this.hi().length>0}flags(){if(this._instance.config.__preview_remote_config)this.li=!0;else{var t=!this.vi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.ci({disableFlags:t})}}get hasLoadedFlags(){return this.si}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(se),i=this._instance.get_property(En),e=this._instance.get_property(Sn);if(!e&&!i)return t||{};var r=Ci({},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=M(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=M(u)?l.variant:"string"==typeof u?u:void 0,v=null==e?void 0:e[n],c=g({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});if(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=g({},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.ri||(bn.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.ri=!0),r}getFlagVariants(){var t=this._instance.get_property(ee),i=this._instance.get_property(En);if(!i)return t||{};for(var e=Ci({},t),r=Object.keys(i),s=0;s<r.length;s++)e[r[s]]=i[r[s]];return this.ri||(bn.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.ri=!0),e}getFlagPayloads(){var t=this._instance.get_property($n),i=this._instance.get_property(Sn);if(!i)return t||{};for(var e=Ci({},t||{}),r=Object.keys(i),s=0;s<r.length;s++)e[r[s]]=i[r[s]];return this.ri||(bn.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.ri=!0),e}reloadFeatureFlags(){this.oi||this._instance.config.advanced_disable_feature_flags||this.vi||(this.vi=setTimeout((()=>{this.ci()}),5))}fi(){clearTimeout(this.vi),this.vi=void 0}ensureFlagsLoaded(){this.si||this.ni||this.vi||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.oi=t}ci(t){var i;if(this.fi(),!this._instance.O())if(this.ni)this.ai=!0;else{var e=this._instance.config.token,r=this._instance.get_property("$device_id"),s={token:e,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:g({},(null==(i=this._instance.persistence)?void 0:i.get_initial_props())||{},this._instance.get_property(ne)||{}),group_properties:this._instance.get_property(oe)};D(r)||M(r)||(s.$device_id=r),(null!=t&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.di()&&(s.evaluation_environments=this.hi());var n=this._instance.config.__preview_remote_config,o=n?"/flags/?v=2":"/flags/?v=2&config=true",a=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",l=this._instance.requestRouter.endpointFor("flags",o+a);n&&(s.timezone=ps()),this.ni=!0,this._instance._send_request({method:"POST",url:l,data:s,compression:this._instance.config.disable_compression?void 0:er.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:t=>{var i,e,r=!0;(200===t.statusCode&&(this.ai||(this.$anon_distinct_id=void 0),r=!1),this.ni=!1,this.li)||(this.li=!0,this._instance.pi(null!==(e=t.json)&&void 0!==e?e:{}));if(!s.disable_flags||this.ai)if(this.ui=!r,t.json&&null!=(i=t.json.quotaLimited)&&i.includes(Cn.FeatureFlags))bn.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var n;if(!s.disable_flags)this.receivedFeatureFlags(null!==(n=t.json)&&void 0!==n?n:{},r);this.ai&&(this.ai=!1,this.ci())}}})}}getFeatureFlag(t,i){if(void 0===i&&(i={}),this.si||this.getFlags()&&this.getFlags().length>0){var e=this.getFlagVariants()[t],r=""+e,s=this._instance.get_property(kn)||void 0,n=this._instance.get_property(Pn)||void 0,o=this._instance.get_property(le)||{};if((i.send_event||!("send_event"in i))&&(!(t in o)||!o[t].includes(r))){var a,l,u,h,d,v,c,f,p;I(o[t])?o[t].push(r):o[t]=[r],null==(a=this._instance.persistence)||a.register({[le]:o});var g=this.getFeatureFlagDetails(t),_={$feature_flag:t,$feature_flag_response:e,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:s,$feature_flag_evaluated_at:n,$feature_flag_bootstrapped_response:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlags)?void 0:l[t])||null,$feature_flag_bootstrapped_payload:(null==(u=this._instance.config.bootstrap)||null==(u=u.featureFlagPayloads)?void 0:u[t])||null,$used_bootstrap_value:!this.ui};M(null==g||null==(h=g.metadata)?void 0:h.version)||(_.$feature_flag_version=g.metadata.version);var m,y=null!==(d=null==g||null==(v=g.reason)?void 0:v.description)&&void 0!==d?d:null==g||null==(c=g.reason)?void 0:c.code;if(y&&(_.$feature_flag_reason=y),null!=g&&null!=(f=g.metadata)&&f.id&&(_.$feature_flag_id=g.metadata.id),M(null==g?void 0:g.original_variant)&&M(null==g?void 0:g.original_enabled)||(_.$feature_flag_original_response=M(g.original_variant)?g.original_enabled:g.original_variant),null!=g&&null!=(p=g.metadata)&&p.original_payload)_.$feature_flag_original_payload=null==g||null==(m=g.metadata)?void 0:m.original_payload;this._instance.capture("$feature_flag_called",_)}return e}bn.warn('getFeatureFlag for key "'+t+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,i){var e=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:e};this.di()&&(r.evaluation_environments=this.hi()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:r,compression:this._instance.config.disable_compression?void 0:er.Base64,timeout:this._instance.config.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={}),this.si||this.getFlags()&&this.getFlags().length>0){var e=this.getFeatureFlag(t,i);return M(e)?void 0:!!e}bn.warn('isFeatureEnabled for key "'+t+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i){if(this._instance.persistence){this.si=!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=In(t),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var u=t.requestId,h=t.evaluatedAt;if(I(a)){bn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var d={};if(a)for(var v=0;v<a.length;v++)d[a[v]]=!0;i&&i.register({[xn]:a,[ee]:d})}else{var c=a,f=l,p=o;t.errorsWhileComputingFlags&&(c=g({},e,c),f=g({},r,f),p=g({},s,p)),i&&i.register(g({[xn]:Object.keys(Tn(c)),[ee]:c||{},[$n]:f||{},[se]:p||{}},u?{[kn]:u}:{},h?{[Pn]:h}:{}))}}}(t,this._instance.persistence,e,r,s),this.gi(i)}}override(t,i){void 0===i&&(i=!1),bn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this._instance.persistence)return bn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this._instance.persistence.unregister(En),this._instance.persistence.unregister(Sn),this.gi(),wn.info("All overrides cleared");if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;if(this.ri=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i),"flags"in e)if(!1===e.flags)this._instance.persistence.unregister(En),wn.info("Flag overrides cleared");else if(e.flags){if(I(e.flags)){for(var r={},s=0;s<e.flags.length;s++)r[e.flags[s]]=!0;this._instance.persistence.register({[En]:r})}else this._instance.persistence.register({[En]:e.flags});wn.info("Flag overrides set",{flags:e.flags})}return"payloads"in e&&(!1===e.payloads?(this._instance.persistence.unregister(Sn),wn.info("Payload overrides cleared")):e.payloads&&(this._instance.persistence.register({[Sn]:e.payloads}),wn.info("Payload overrides set",{payloads:e.payloads}))),void this.gi()}this.gi()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.si){var{flags:i,flagVariants:e}=this.mi();t(i,e)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,s=(this._instance.get_property(re)||[]).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=g({},this.getFlagVariants(),{[t]:i});null==(r=this._instance.persistence)||r.register({[xn]:Object.keys(Tn(a)),[ee]:a}),this.gi()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this._instance.get_property(re),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._instance.config.token+s),method:"GET",callback:i=>{var e,r;if(i.json){var s=i.json.earlyAccessFeatures;return null==(e=this._instance.persistence)||e.unregister(re),null==(r=this._instance.persistence)||r.register({[re]:s}),t(s)}}})}mi(){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)),{})}}gi(t){var{flags:i,flagVariants:e}=this.mi();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(ne)||{};this._instance.register({[ne]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ne)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(oe)||{};0!==Object.keys(e).length&&Object.keys(e).forEach((i=>{e[i]=g({},e[i],t[i]),delete t[i]})),this._instance.register({[oe]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this._instance.get_property(oe)||{};this._instance.register({[oe]:g({},i,{[t]:{}})})}else this._instance.unregister(oe)}reset(){this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.$anon_distinct_id=void 0,this.fi(),this.ri=!1}}var Fn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Mn{constructor(t,i){this.R=t,this.props={},this.yi=!1,this.bi=(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.Y=this.wi(t),this.load(),t.debug&&Ei.info("Persistence loaded",t.persistence,g({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.xi}wi(t){-1===Fn.indexOf(t.persistence.toLowerCase())&&(Ei.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i=t.persistence.toLowerCase();return"localstorage"===i&&Tr.H()?Tr:"localstorage+cookie"===i&&Cr.H()?Cr:"sessionstorage"===i&&Or.H()?Or:"memory"===i?Fr:"cookie"===i?kr:Cr.H()?Cr:kr}properties(){var t={};return Ii(this.props,(function(i,e){if(e===ee&&R(i))for(var r=Object.keys(i),n=0;n<r.length;n++)t["$feature/"+r[n]]=i[r[n]];else a=e,l=!1,(D(o=me)?l:s&&o.indexOf===s?-1!=o.indexOf(a):(Ii(o,(function(t){if(l||(l=t===a))return Pi})),l))||(t[e]=i);var o,a,l})),t}load(){if(!this.xi){var t=this.Y.W(this.bi);t&&(this.props=Ci({},t))}}save(){this.xi||this.Y.G(this.bi,this.props,this.Ei,this.$i,this.Si,this.R.debug)}remove(){this.Y.V(this.bi,!1),this.Y.V(this.bi,!0)}clear(){this.remove(),this.props={}}register_once(t,i,e){if(R(t)){M(i)&&(i="None"),this.Ei=M(e)?this.ki:e;var r=!1;if(Ii(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.Ei=M(i)?this.ki:i;var e=!1;if(Ii(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.yi){var t=ls(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);F(Ai(t))||this.register(t),this.yi=!0}}update_search_keyword(){var t;this.register((t=null==o?void 0:o.referrer)?hs(t):{})}update_referrer_info(){var t;this.register_once({$referrer:vs(),$referring_domain:null!=o&&o.referrer&&(null==(t=sr(o.referrer))?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[ve]||this.props[ce]||this.register_once({[fe]:cs(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Ii([ce,ve],(i=>{var e=this.props[i];e&&Ii(e,(function(i,e){t["$initial_"+E(e)]=i}))}));var i,e,r=this.props[fe];if(r){var s=(i=fs(r),e={},Ii(i,(function(t,i){e["$initial_"+E(i)]=t})),e);Ci(t,s)}return t}safe_merge(t){return Ii(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this.ki=this.Ei=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){var r=this.wi(t),s=this.props;this.clear(),this.Y=r,this.props=s,this.save()}}set_disabled(t){this.xi=t,this.xi?this.remove():this.save()}set_cross_subdomain(t){t!==this.$i&&(this.$i=t,this.remove(),this.save())}set_secure(t){t!==this.Si&&(this.Si=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[Bi]||{};e[t]=i,this.props[Bi]=e,this.save()}remove_event_timer(t){var i=(this.props[Bi]||{})[t];return M(i)||(delete this.props[Bi][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}var On=$i("[Product Tours]"),An="ph_product_tours";class Dn{constructor(t){this.Pi=null,this.Ti=null,this._instance=t}onRemoteConfig(t){this._instance.persistence&&this._instance.persistence.register({[Xi]:!(null==t||!t.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var t,i;this.Pi||((t=this._instance).config.disable_product_tours||null==(i=t.persistence)||!i.get_property(Xi))||this.it((()=>this.Ii()))}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?On.error("Could not load product tours script",i):t()}))}Ii(){var t;!this.Pi&&null!=(t=v.__PosthogExtensions__)&&t.generateProductTours&&(this.Pi=v.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!I(this.Ti)||i){var e=this._instance.persistence;if(e){var r=e.props[An];if(I(r)&&!i)return this.Ti=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 On.error(s),void t([],{isLoaded:!1,error:s})}var n=I(i.json.product_tours)?i.json.product_tours:[];this.Ti=n,e&&e.register({[An]:n}),t(n,{isLoaded:!0})}})}else t(this.Ti,{isLoaded:!0})}getActiveProductTours(t){j(this.Pi)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Pi.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.Pi)||i.showTourById(t)}previewTour(t){this.Pi?this.Pi.previewTour(t):this.it((()=>{var i;this.Ii(),null==(i=this.Pi)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Pi)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Pi)||t.nextStep()}previousStep(){var t;null==(t=this.Pi)||t.previousStep()}clearCache(){var t;this.Ti=null,null==(t=this._instance.persistence)||t.unregister(An)}resetTour(t){var i;null==(i=this.Pi)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.Pi)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.Pi)||i.cancelPendingTour(t)}}var jn=function(t){return t.Activation="events",t.Cancellation="cancelEvents",t}({}),Ln=function(t){return t.Button="button",t.Tab="tab",t.Selector="selector",t}({}),Nn=function(t){return t.TopLeft="top_left",t.TopRight="top_right",t.TopCenter="top_center",t.MiddleLeft="middle_left",t.MiddleRight="middle_right",t.MiddleCenter="middle_center",t.Left="left",t.Center="center",t.Right="right",t.NextToTrigger="next_to_trigger",t}({}),Un=function(t){return t.Top="top",t.Left="left",t.Right="right",t.Bottom="bottom",t}({}),zn=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({}),Hn=function(t){return t.Open="open",t.MultipleChoice="multiple_choice",t.SingleChoice="single_choice",t.Rating="rating",t.Link="link",t}({}),Bn=function(t){return t.NextQuestion="next_question",t.End="end",t.ResponseBased="response_based",t.SpecificQuestion="specific_question",t}({}),qn=function(t){return t.Once="once",t.Recurring="recurring",t.Always="always",t}({}),Wn=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t.ABANDONED="survey abandoned",t}({}),Gn=function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t.PRODUCT_TOUR_ID="$product_tour_id",t}({}),Vn=function(t){return t.Popover="popover",t.Inline="inline",t}({}),Jn=$i("[Surveys]");var Kn="seenSurvey_",Yn=(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},Xn=t=>((t,i)=>{var e=""+t+i.id;return i.current_iteration&&i.current_iteration>0&&(e=""+t+i.id+"_"+i.current_iteration),e})(Kn,t),Qn=[zn.Popover,zn.Widget,zn.API],Zn={ignoreConditions:!1,ignoreDelay:!1,displayType:Vn.Popover};class to{constructor(){this.Ci={},this.Ci={}}on(t,i){return this.Ci[t]||(this.Ci[t]=[]),this.Ci[t].push(i),()=>{this.Ci[t]=this.Ci[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Ci[t]||[])e(i);for(var r of this.Ci["*"]||[])r(t,i)}}function io(t,i,e){if(j(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 eo{constructor(t){this.Ri=new to,this.Fi=(t,i)=>this.Mi(t,i)&&this.Oi(t,i)&&this.Ai(t,i)&&this.Di(t,i),this.Mi=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.ji=new Set,this.Li=new Set}init(){var t;if(!M(null==(t=this._instance)?void 0:t.Ni)){var i;null==(i=this._instance)||i.Ni(((t,i)=>{this.on(t,i)}))}}register(t){var i,e;if(!M(null==(i=this._instance)?void 0:i.Ni)&&(t.forEach((t=>{var i,e;null==(i=this.Li)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.ji)||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.ji.has(t)||this.ji.has(null==i?void 0:i.event))&&this.Li&&(null==(e=this.Li)?void 0:e.size)>0&&this.Li.forEach((t=>{this.Ui(i,t)&&this.Ri.emit("actionCaptured",t.name)}))}zi(t){this.onAction("actionCaptured",(i=>t(i)))}Ui(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Fi(t,e))return!0;return!1}onAction(t,i){return this.Ri.on(t,i)}Oi(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(!io(r,i.url,i.url_matching||"contains"))return!1}return!0}Ai(t,i){return!!this.Hi(t,i)&&(!!this.Bi(t,i)&&!!this.qi(t,i))}Hi(t,i){var e;if(null==i||!i.href)return!0;var r=this.Wi(t);if(r.length>0)return r.some((t=>io(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&io((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}Bi(t,i){var e;if(null==i||!i.text)return!0;var r=this.Wi(t);if(r.length>0)return r.some((t=>io(t.text,i.text,i.text_matching||"exact")||io(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;!j(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=>io(t,n,o))))}qi(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}Wi(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Di(t,i){return null==i||!i.properties||0===i.properties.length||_n(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 ro{constructor(t){this._instance=t,this.Gi=new Map,this.Vi=new Map,this.Ji=new Map}Ki(t,i){return!!t&&_n(t.propertyFilters,null==i?void 0:i.properties)}Yi(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}Xi(t,i,e){var r=(e===jn.Activation?this.Gi:this.Vi).get(t),s=[];return this.Qi((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.Ki(n,i)}))}register(t){var i;M(null==(i=this._instance)?void 0:i.Ni)||(this.Zi(t),this.te(t))}te(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}));if(0!==i.length){if(null==this.ie){this.ie=new eo(this._instance),this.ie.init();this.ie.zi((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.ie)||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.Ji.get(i.name);e&&e.push(t.id),this.Ji.set(i.name,e||[t.id])}})))}))}}Zi(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}));if(0!==e.length||0!==r.length){null==(i=this._instance)||i.Ni(((t,i)=>{this.onEvent(t,i)})),this.Gi=this.Yi(t,jn.Activation),this.Vi=this.Yi(t,jn.Cancellation)}}onEvent(t,i){var e,r=this.ee(),s=this.re(),n=this.se(),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);h>=0&&(o.splice(h,1),this.ne(o))}}else{if(this.Vi.has(t)){var d=this.Xi(t,i,jn.Cancellation);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);i>=0&&o.splice(i,1),this.oe(t.id)})),this.ne(o))}if(this.Gi.has(t)){r.info("event name matched",{event:t,eventPayload:i,items:this.Gi.get(t)});var v=this.Xi(t,i,jn.Activation);this.ne(o.concat(v.map((t=>t.id))||[]))}}}onAction(t){var i,e=this.re(),r=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[e])||[];this.Ji.has(t)&&this.ne(r.concat(this.Ji.get(t)||[]))}ne(t){var i,e=this.ee(),r=this.re(),s=[...new Set(t)].filter((t=>!this.ae(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.re(),e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e||[]}getEventToItemsMap(){return this.Gi}le(){return this.ie}}class so extends ro{constructor(t){super(t)}re(){return"$surveys_activated"}se(){return Wn.SHOWN}Qi(t){var i;null==(i=this._instance)||i.getSurveys(t)}oe(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}ee(){return Jn}ae(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class no{constructor(t){this.ue=void 0,this._surveyManager=null,this.he=!1,this.de=[],this.ve=null,this._instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){if(!this._instance.config.disable_surveys){var i=t.surveys;if(j(i))return Jn.warn("Flags not loaded yet. Not loading surveys.");var e=I(i);this.ue=e?i.length>0:i,Jn.info("flags response received, isSurveysEnabled: "+this.ue),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var e=localStorage.key(i);(null!=e&&e.startsWith(Kn)||null!=e&&e.startsWith("inProgressSurvey_"))&&t.push(e)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.he)Jn.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Jn.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Jn.info("Not loading surveys in cookieless mode without consent.");else{var t=null==v?void 0:v.__PosthogExtensions__;if(t){if(!M(this.ue)||this._instance.config.advanced_enable_surveys){var i=this.ue||this._instance.config.advanced_enable_surveys;this.he=!0;try{var e=t.generateSurveys;if(e)return void this.ce(e,i);var r=t.loadExternalDependency;if(!r)return void this.fe("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this.fe("Could not load surveys script",e):this.ce(t.generateSurveys,i)}))}catch(t){throw this.fe("Error initializing surveys",t),t}finally{this.he=!1}}}else Jn.error("PostHog Extensions not found.")}}ce(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new so(this._instance),Jn.info("Surveys loaded successfully"),this.pe({isLoaded:!0})}fe(t,i){Jn.error(t,i),this.pe({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.de.push(t),this._surveyManager&&this.pe({isLoaded:!0}),()=>{this.de=this.de.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this._instance.config.disable_surveys)return Jn.info("Disabled. Not loading surveys."),t([]);var e,r=this._instance.get_property(ae);if(r&&!i)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.ve?this.ve.then((i=>{var{surveys:e,context:r}=i;return t(e,r)})):("undefined"!=typeof Promise&&(this.ve=new Promise((t=>{e=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:i=>{var r;this.ve=null;var s=i.statusCode;if(200!==s||!i.json){var n="Surveys API could not be loaded, status: "+s;Jn.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({[ae]:l});var h={isLoaded:!0};t(l,h),null==e||e({surveys:l,context:h})}}))}pe(t){for(var i of this.de)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Jn.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!j(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Jn.warn("init was not called")}ge(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}_e(t){if(j(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var i="string"==typeof t?this.ge(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(j(this._surveyManager))return Jn.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var i=this._e(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return j(this._surveyManager)?(Jn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):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._e(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i){var e;if(j(this._surveyManager))Jn.warn("init was not called");else{var r="string"==typeof t?this.ge(t):t;if(null!=r&&r.id)if(Qn.includes(r.type)){var s=null==o?void 0:o.querySelector(i);if(s)return null!=(e=r.appearance)&&e.surveyPopupDelaySeconds?(Jn.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,i;Jn.info("Rendering survey "+r.id+" with delay of "+(null==(t=r.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(r,s),Jn.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,s);Jn.warn("Survey element not found")}else Jn.warn("Surveys of type "+r.type+" cannot be rendered in the app");else Jn.warn("Survey not found")}}displaySurvey(t,i){var e;if(j(this._surveyManager))Jn.warn("init was not called");else{var r=this.ge(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),!1===i.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void Jn.warn("Survey is not eligible to be displayed: ",n.disabledReason)}i.displayType!==Vn.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,i.selector)}else Jn.warn("Survey not found")}}cancelPendingSurvey(t){j(this._surveyManager)?Jn.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}var oo=$i("[Conversations]");class ao{constructor(t){this.me=void 0,this._conversationsManager=null,this.ye=!1,this.be=null,this._instance=t}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var i=t.conversations;j(i)||(N(i)?this.me=i:(this.me=i.enabled,this.be=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.me=void 0,this.be=null}loadIfEnabled(){if(!this._conversationsManager&&!this.ye&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=null==v?void 0:v.__PosthogExtensions__;if(i&&!M(this.me)&&this.me)if(this.be&&this.be.token){if(function(i){var e;if(!i||0===i.length)return!0;var r=null==t||null==(e=t.location)?void 0:e.hostname;return!r||i.some((t=>{var i=function(t){var i=t.replace(/^https?:\/\//,"");return(i=i.split("/")[0].split("?")[0].split(":")[0])||null}(t);if(!i)return!1;if(i.startsWith("*.")){var e=i.slice(2);return r.endsWith("."+e)||r===e}return r===i}))}(this.be.domains)){this.ye=!0;try{var e=i.initConversations;if(e)return this.we(e),void(this.ye=!1);var r=i.loadExternalDependency;if(!r)return void this.xe("PostHog loadExternalDependency extension not found.");r(this._instance,"conversations",(t=>{t||!i.initConversations?this.xe("Could not load conversations script",t):this.we(i.initConversations),this.ye=!1}))}catch(t){this.xe("Error initializing conversations",t),this.ye=!1}}}else oo.error("Conversations enabled but missing token in remote config.")}}we(t){if(this.be)try{this._conversationsManager=t(this.be,this._instance),oo.info("Conversations loaded successfully")}catch(t){this.xe("Error completing conversations initialization",t)}else oo.error("Cannot complete initialization: remote config is null")}xe(t,i){oo.error(t,i),this._conversationsManager=null,this.ye=!1}enable(){this._conversationsManager?this._conversationsManager.enable():oo.warn("Conversations not loaded yet.")}disable(){this._conversationsManager&&this._conversationsManager.disable()}isLoaded(){return!D(this._conversationsManager)}isEnabled(){return!0===this.me}}var lo=$i("[RateLimiter]");class uo{constructor(t){var i,e;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{lo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void lo.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.captureEventsPerSecond=(null==(i=t.config.rate_limiting)?void 0:i.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(e=t.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=(new Date).getTime(),n=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(de))&&void 0!==i?i:{tokens:this.captureEventsBurstLimit,last:s};n.tokens+=(s-n.last)/1e3*this.captureEventsPerSecond,n.last=s,n.tokens>this.captureEventsBurstLimit&&(n.tokens=this.captureEventsBurstLimit);var o=n.tokens<1;return o||t||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,null==(r=this.instance.persistence)||r.set_property(de,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var ho=$i("[RemoteConfig]");class vo{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ee(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):(ho.error("PostHog Extensions not found. Cannot load remote config."),t())}$e(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 ho.info("Using preloaded remote config",this.remoteConfig),void this.pi(this.remoteConfig);if(this._instance.O())return void ho.warn("Remote config is disabled. Falling back to local config.");this.Ee((t=>{if(!t)return ho.info("No config found after loading remote JS config. Falling back to JSON."),void this.$e((t=>{this.pi(t)}));this.pi(t)}))}catch(t){ho.error("Error loading remote config",t)}}pi(t){t?this._instance.config.__preview_remote_config?(this._instance.pi(t),!1!==t.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):ho.info("__preview_remote_config is disabled. Logging config instead",t):ho.error("Failed to fetch remote config from PostHog.")}}var co=3e3;class fo{constructor(t,i){this.Se=!0,this.ke=[],this.Pe=J((null==i?void 0:i.flush_interval_ms)||co,250,5e3,Ei.createLogger("flush interval"),co),this.Te=t}enqueue(t){this.ke.push(t),this.Ie||this.Ce()}unload(){this.Re();var t=this.ke.length>0?this.Fe():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Te(g({},t,{transport:"sendBeacon"}))}))}enable(){this.Se=!1,this.Ce()}Ce(){var t=this;this.Se||(this.Ie=setTimeout((()=>{if(this.Re(),this.ke.length>0){var i=this.Fe(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&I(e.data)&&Ii(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Te(e)};for(var r in i)e()}}),this.Pe))}Re(){clearTimeout(this.Ie),this.Ie=void 0}Fe(){var t={};return Ii(this.ke,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;M(t[s])&&(t[s]=g({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.ke=[],t}}var po=["retriesPerformedSoFar"];class go{constructor(i){this.Me=!1,this.Oe=3e3,this.ke=[],this._instance=i,this.ke=[],this.Ae=!0,!M(t)&&"onLine"in t.navigator&&(this.Ae=t.navigator.onLine,this.De=()=>{this.Ae=!0,this.Lt()},this.je=()=>{this.Ae=!1},Ui(t,"online",this.De),Ui(t,"offline",this.je))}get length(){return this.ke.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,e=_(t,po);L(i)&&i>0&&(e.url=un(e.url,{retry_count:i})),this._instance._send_request(g({},e,{callback:t=>{200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&(null!=i?i:0)<10?this.Le(g({retriesPerformedSoFar:i},e)):null==e.callback||e.callback(t)}}))}Le(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)*(r-e);return Math.ceil(r+s)}(i),r=Date.now()+e;this.ke.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Ei.warn(s),this.Me||(this.Me=!0,this.Ne())}Ne(){if(this.Ue&&clearTimeout(this.Ue),0===this.ke.length)return this.Me=!1,void(this.Ue=void 0);this.Ue=setTimeout((()=>{this.Ae&&this.ke.length>0&&this.Lt(),this.Ne()}),this.Oe)}Lt(){var t=Date.now(),i=[],e=this.ke.filter((e=>e.retryAt<t||(i.push(e),!1)));if(this.ke=i,e.length>0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:i}of(this.Ue&&(clearTimeout(this.Ue),this.Ue=void 0),this.Me=!1,M(t)||(this.De&&(t.removeEventListener("online",this.De),this.De=void 0),this.je&&(t.removeEventListener("offline",this.je),this.je=void 0)),this.ke))try{this._instance._send_request(g({},i,{transport:"sendBeacon"}))}catch(t){Ei.error(t)}this.ke=[]}}class _o{constructor(t){this.ze=()=>{var t,i,e,r;this.He||(this.He={});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.He.lastScrollY=Math.ceil(n),this.He.maxScrollY=Math.max(n,null!==(t=this.He.maxScrollY)&&void 0!==t?t:0),this.He.maxScrollHeight=Math.max(o,null!==(i=this.He.maxScrollHeight)&&void 0!==i?i:0),this.He.lastContentY=a,this.He.maxContentY=Math.max(a,null!==(e=this.He.maxContentY)&&void 0!==e?e:0),this.He.maxContentHeight=Math.max(l,null!==(r=this.He.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}getContext(){return this.He}resetContext(){var t=this.He;return setTimeout(this.ze,0),t}startMeasuringScrollPosition(){Ui(t,"scroll",this.ze,{capture:!0}),Ui(t,"scrollend",this.ze,{capture:!0}),Ui(t,"resize",this.ze)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==t?void 0:t.document.documentElement;var i=I(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var mo=t=>cs(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class yo{constructor(t,i,e,r){this.Be=t=>{var i=this.qe();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.We(this._instance)};this.Ge.register({[he]:e})}},this._instance=t,this.Ve=i,this.Ge=e,this.We=r||mo,this.Ve.onSessionId(this.Be)}qe(){return this.Ge.props[he]}getSetOnceProps(){var t,i=null==(t=this.qe())?void 0:t.props;return i?"r"in i?fs(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 Ii(Ai(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+E(e)]=i})),t}}var bo=$i("[SessionId]");class wo{on(t,i){return this.Je.on(t,i)}constructor(t,i,e){var r;if(this.Ke=[],this.Ye=void 0,this.Je=new to,this.Xe=(t,i)=>Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=t.config,this.Ge=t.persistence,this.Qe=void 0,this.Ze=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.tr=i||wr,this.ir=e||wr;var s=this.R.persistence_name||this.R.token,n=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*J(n,60,36e3,bo.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.er(),this.rr="ph_"+s+"_window_id",this.sr="ph_"+s+"_primary_window_exists",this.nr()){var o=Or.W(this.rr),a=Or.W(this.sr);o&&!a?this.Qe=o:Or.V(this.rr),Or.G(this.sr,!0)}if(null!=(r=this.R.bootstrap)&&r.sessionID)try{var l=(t=>{var i=t.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.R.bootstrap.sessionID);this.ar(this.R.bootstrap.sessionID,(new Date).getTime(),l)}catch(t){bo.error("Invalid sessionID in bootstrap",t)}this.lr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return M(this.Ke)&&(this.Ke=[]),this.Ke.push(t),this.Ze&&t(this.Ze,this.Qe),()=>{this.Ke=this.Ke.filter((i=>i!==t))}}nr(){return"memory"!==this.R.persistence&&!this.Ge.xi&&Or.H()}ur(t){t!==this.Qe&&(this.Qe=t,this.nr()&&Or.G(this.rr,t))}hr(){return this.Qe?this.Qe:this.nr()?Or.W(this.rr):null}ar(t,i,e){t===this.Ze&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Ze=t,this.Ge.register({[te]:[i,t,e]}))}dr(){var t=this.Ge.props[te];return I(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.ar(null,null,null)}destroy(){clearTimeout(this.vr),this.vr=void 0,this.Ye&&t&&(t.removeEventListener("beforeunload",this.Ye,{capture:!1}),this.Ye=void 0),this.Ke=[]}lr(){this.Ye=()=>{this.nr()&&Or.V(this.sr)},Ui(t,"beforeunload",this.Ye,{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),"always"===this.R.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.dr(),o=this.hr(),a=L(n)&&n>0&&Math.abs(e-n)>864e5,l=!1,u=!s,h=!u&&!t&&this.Xe(e,r);u||h||a?(s=this.tr(),o=this.ir(),bo.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.ir(),l=!0);var d=0===r||!t||a?e:r,v=0===n?(new Date).getTime():n;return this.ur(o),this.ar(s,d,v),t||this.er(),l&&this.Ke.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}}er(){clearTimeout(this.vr),this.vr=setTimeout((()=>{var[t]=this.dr();if(this.Xe((new Date).getTime(),t)){var i=this.Ze;this.resetSessionId(),this.Je.emit("forcedIdleReset",{idleSessionId:i})}}),1.1*this.sessionTimeoutMs)}}var xo=["$set_once","$set"],Eo=$i("[SiteApps]");class $o{constructor(t){this._instance=t,this.cr=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}pr(t,i){if(i){var e=this.globalsForEvent(i);this.cr.push(e),this.cr.length>1e3&&(this.cr=this.cr.slice(10))}}get siteAppLoaders(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance.Ni(this.pr.bind(this));this.gr=()=>{t(),this.cr=[],this.gr=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:g({},_(t,xo),{properties:g({},t.properties,f?{$set:g({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:g({},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.cr.length&&(Eo.info("Processing "+this.cr.length+" events for site app with id "+t.id),this.cr.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.gr)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,Eo.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){Eo.error("Error while initializing PostHog app with config id "+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){Eo.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}_r(){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)}mr(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){Eo.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._r(),void this._instance.on("eventCaptured",(t=>this.mr(t)))):void Eo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.gr)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;v["__$$ph_site_app_"+t]=s._instance,null==(i=v.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return Eo.error("Error while initializing PostHog app with config id "+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else Eo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var So=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},ko=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),Po="i.posthog.com";class To{constructor(t){this.yr={},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("."+Po,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.yr[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.yr[this.apiHost]=ko.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.yr[this.apiHost]=ko.EU:this.yr[this.apiHost]=ko.CUSTOM),this.yr[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===ko.CUSTOM)return this.apiHost+i;var e=Po+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var Io={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&&cn(e.href,i),not_regex:(i,e)=>!!t&&!cn(e.href,i),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class Co{constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{Co.br("retrieved web experiments from the server"),i.wr=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;if(i.wr)Co.br("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.wr)||e.set(t.feature_flag_key,t);var r=i._instance.getFeatureFlag(t.feature_flag_key);O(r)&&t.variants[r]&&i.Er(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Co.$r(n)&&i.Er(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}onFeatureFlags(t){if(this._is_bot())Co.br("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(j(this.wr))return this.wr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Co.br("applying feature flags",t),t.forEach((t=>{var i;if(this.wr&&null!=(i=this.wr)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.wr)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Er(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Co.getWindowLocation();if(null!=t&&t.search){var i=or(null==t?void 0:t.search,"__experiment_id"),e=or(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Co.br("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Sr(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this._instance.config.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._instance.config.token),method:"GET",callback:i=>{if(200!==i.statusCode||!i.json)return t([]);var e=i.json.experiments||[];return t(e)}})}Sr(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(Co.br("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Er(r[0].name,i,r[0].variants[i].transforms))}static $r(t){return!j(t.conditions)&&(Co.kr(t)&&Co.Pr(t))}static kr(t){var i;if(j(t.conditions)||j(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=Co.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||Io[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 Pr(t){var i;if(j(t.conditions)||j(null==(i=t.conditions)?void 0:i.utm))return!0;var e=ls();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 br(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];Ei.info("[WebExperiments] "+t,e)}Er(t,i,e){this._is_bot()?Co.br("Refusing to render web experiment since the viewer is a likely bot"):"control"!==i?e.forEach((e=>{if(e.selector){var r;Co.br("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)}))}})):Co.br("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?So(n,this._instance.config.custom_blocked_useragents):void 0}}var Ro=$i("[PostHog ExternalIntegrations]"),Fo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Mo{constructor(t){this._instance=t}it(t,i){var e;null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return Ro.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;(!r||null!=(e=v.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.it(Fo[i],(()=>{var e;null==(e=v.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=v.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i])&&(null==(n=v.__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 Oo="[SessionRecording]",Ao=$i(Oo);class Do{get started(){var t;return!(null==(t=this.Tr)||!t.isStarted)}get status(){return this.Tr?this.Tr.status:this.Ir&&!this.Cr?"disabled":"lazy_loading"}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Ir=!1,this.Rr=void 0,this._instance=t,!this._instance.sessionManager)throw Ao.error("started without valid sessionManager"),new Error(Oo+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(Oo+' cannot be used with cookieless_mode="always"')}get Cr(){var i,e=!(null==(i=this._instance.get_property(Zi))||!i.enabled),r=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!this.Cr||null==(i=this.Tr)||!i.isStarted){var e=!M(Object.assign)&&!M(Array.from);this.Cr&&e?(this.Fr(t),Ao.info("starting")):this.stopRecording()}}Fr(t){var i,e,r;this.Cr&&(null!=v&&null!=(i=v.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=v.__PosthogExtensions__)&&e.initSessionRecording?this.Mr(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Or,(i=>{if(i)return Ao.error("could not load recorder",i);this.Mr(t)})))}stopRecording(){var t,i;null==(t=this.Rr)||t.call(this),this.Rr=void 0,null==(i=this.Tr)||i.stop()}Ar(){var t;null==(t=this._instance.persistence)||t.unregister(ie)}Dr(t){if(this._instance.persistence){var i,e,r=this._instance.persistence,s=()=>{var i=!1===t.sessionRecording?void 0:t.sessionRecording,e=null==i?void 0:i.sampleRate,s=j(e)?null:parseFloat(e);j(s)&&this.Ar();var n=null==i?void 0:i.minimumDurationMilliseconds;r.register({[Zi]:g({enabled:!!i},i,{networkPayloadCapture:g({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:s,minimumDurationMilliseconds:M(n)?null:n,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers})})};s(),null==(i=this.Rr)||i.call(this),this.Rr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){"sessionRecording"in t?!1!==t.sessionRecording?(this.Dr(t),this.Ir=!0,this.startIfEnabledOrStop()):this.Ir=!0:Ao.info("skipping remote config with no sessionRecording",t)}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.Tr)&&e.log?this.Tr.log(t,i):Ao.warn("log called before recorder was ready")}get Or(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(Zi);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}Mr(t){var i,e;if(null==(i=v.__PosthogExtensions__)||!i.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Tr||(this.Tr=null==(e=v.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.Tr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture);this.Tr.start(t)}onRRwebEmit(t){var i;null==(i=this.Tr)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.Tr||(null==(i=this._instance.persistence)||i.register({$replay_override_linked_flag:!0}));null==(t=this.Tr)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.Tr||(null==(i=this._instance.persistence)||i.register({$replay_override_sampling:!0}));null==(t=this.Tr)||t.overrideSampling()}overrideTrigger(t){var i,e;this.Tr||(null==(e=this._instance.persistence)||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}));null==(i=this.Tr)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.Tr)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.Tr)||!e.tryAddCustomEvent(t,i))}}var jo={},Lo=()=>{},No="posthog",Uo=!an&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),zo=i=>{var e;return g({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Li(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Lo,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:a&&O(null==a?void 0:a.search)&&-1!==a.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:!0,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_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;Ei.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:co},error_tracking:{},_onCapture:Lo,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(i))},Ho=t=>{var i={};M(t.process_person)||(i.person_profiles=t.process_person),M(t.xhr_headers)||(i.request_headers=t.xhr_headers),M(t.cookie_name)||(i.persistence_name=t.cookie_name),M(t.disable_cookie)||(i.disable_persistence=t.disable_cookie),M(t.store_google)||(i.save_campaign_params=t.store_google),M(t.verbose)||(i.debug=t.verbose);var e=Ci({},i,t);return I(t.property_blacklist)&&(M(t.property_denylist)?e.property_denylist=t.property_blacklist:I(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ei.error("Invalid value for property_denylist config: "+t.property_denylist)),e};class Bo{constructor(){this.__forceAllowLocalhost=!1}get jr(){return this.__forceAllowLocalhost}set jr(t){Ei.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class qo{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(){this.webPerformance=new Bo,this.Lr=!1,this.version=c.LIB_VERSION,this.Nr=new to,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=zo(),this.SentryIntegration=Kr,this.sentryIntegration=t=>function(t,i){var e=Jr(t,i);return{name:Vr,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ur=!1,this.zr=null,this.Hr=null,this.Br=null,this.featureFlags=new Rn(this),this.toolbar=new ts(this),this.scrollManager=new _o(this),this.pageViewManager=new $s(this),this.surveys=new no(this),this.conversations=new ao(this),this.experiments=new Co(this),this.exceptions=new yn(this),this.rateLimiter=new uo(this),this.requestRouter=new To(this),this.consent=new Dr(this),this.externalIntegrations=new Mo(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=>Ei.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==No){var r,s=null!==(r=jo[e])&&void 0!==r?r:new qo;return s._init(t,i,e),jo[e]=s,jo[No][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s;if(void 0===e&&(e={}),M(i)||A(i))return Ei.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.qr(e.debug),this.Wr=e,this.Gr=[],e.person_profiles&&(this.Hr=e.person_profiles),this.set_config(Ci({},zo(e.defaults),Ho(e),{name:r,token:i})),this.config.on_xhr_error&&Ei.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:er.GZipJS;var n=this.Vr();this.persistence=new Mn(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mn(g({},this.config,{persistence:"sessionStorage"}),n);var o=g({},this.persistence.props),a=g({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Jr=new fo((t=>this.Kr(t)),this.config.request_queue_config),this.Yr=new go(this),this.__request_queue=[];var l="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new wo(this),this.sessionPropsManager=new yo(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ei.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Xr(l)}),0)):(Ei.info("Initializing extensions synchronously"),this.Xr(l)),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&Ei.info("Starting in debug mode",{this:this,config:e,thisC:g({},this.config),p:o,s:a}),void 0!==(null==(s=e.bootstrap)?void 0:s.distinctID)){var u,h,d=this.config.get_device_id(wr()),v=null!=(u=e.bootstrap)&&u.isIdentifiedID?d:e.bootstrap.distinctID;this.persistence.set_property(ue,null!=(h=e.bootstrap)&&h.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.bootstrap.distinctID,$device_id:v})}if(this.Qr()){var f,p,_=Object.keys((null==(f=e.bootstrap)?void 0:f.featureFlags)||{}).filter((t=>{var i;return!(null==(i=e.bootstrap)||null==(i=i.featureFlags)||!i[t])})).reduce(((t,i)=>{var r;return t[i]=(null==(r=e.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,t}),{}),m=Object.keys((null==(p=e.bootstrap)?void 0:p.featureFlagPayloads)||{}).filter((t=>_[t])).reduce(((t,i)=>{var r,s;null!=(r=e.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(t[i]=null==(s=e.bootstrap)||null==(s=s.featureFlagPayloads)?void 0:s[i]);return t}),{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:m})}if(l)this.register_once({distinct_id:_e,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(wr());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(ue,"anonymous")}return Ui(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),e.segment?Gr(this,(()=>this.Zr())):this.Zr(),C(this.config._onCapture)&&this.config._onCapture!==Lo&&(Ei.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Ei.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}Xr(t){var i=performance.now();this.historyAutocapture=new qr(this),this.historyAutocapture.startIfEnabled();var e=[];e.push((()=>{new es(this).startIfEnabledOrStop()})),e.push((()=>{var t;this.siteApps=new $o(this),null==(t=this.siteApps)||t.init()})),t||e.push((()=>{this.sessionRecording=new Do(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||e.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),e.push((()=>{this.autocapture=new fr(this),this.autocapture.startIfEnabled()})),e.push((()=>{this.surveys.loadIfEnabled()})),e.push((()=>{this.conversations.loadIfEnabled()})),e.push((()=>{this.productTours=new Dn(this),this.productTours.loadIfEnabled()})),e.push((()=>{this.heatmaps=new Es(this),this.heatmaps.startIfEnabled()})),e.push((()=>{this.webVitalsAutocapture=new bs(this)})),e.push((()=>{this.exceptionObserver=new Hr(this),this.exceptionObserver.startIfEnabledOrStop()})),e.push((()=>{this.deadClicksAutocapture=new Ur(this,Nr),this.deadClicksAutocapture.startIfEnabled()})),e.push((()=>{if(this.ts){var t=this.ts;this.ts=void 0,this.pi(t)}})),this.es(e,i)}es(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions)if(performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.es(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){Ei.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&&Ei.info("PostHog extensions initialized ("+r+"ms)")}pi(t){var i,e,r,s,n,a,l,u,h;if(!o||!o.body)return Ei.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pi(t)}),500);this.config.__preview_deferred_init_extensions&&(this.ts=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=w(t.supportedCompression,er.GZipJS)?er.GZipJS:w(t.supportedCompression,er.Base64)?er.Base64:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Hr?this.Hr:"identified_only"}),null==(e=this.siteApps)||e.onRemoteConfig(t),null==(r=this.sessionRecording)||r.onRemoteConfig(t),null==(s=this.autocapture)||s.onRemoteConfig(t),null==(n=this.heatmaps)||n.onRemoteConfig(t),this.surveys.onRemoteConfig(t),this.conversations.onRemoteConfig(t),null==(a=this.productTours)||a.onRemoteConfig(t),null==(l=this.webVitalsAutocapture)||l.onRemoteConfig(t),null==(u=this.exceptionObserver)||u.onRemoteConfig(t),this.exceptions.onRemoteConfig(t),null==(h=this.deadClicksAutocapture)||h.onRemoteConfig(t)}Zr(){try{this.config.loaded(this)}catch(t){Ei.critical("`loaded` function failed",t)}this.rs(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.ss()}),1),new vo(this).load(),this.featureFlags.flags()}rs(){var t;this.is_capturing()&&(this.config.request_batching&&(null==(t=this.Jr)||t.enable()))}_dom_loaded(){this.is_capturing()&&Ti(this.__request_queue,(t=>this.Kr(t))),this.__request_queue=[],this.rs()}_handle_unload(){var t,i;this.surveys.handlePageUnload(),this.config.request_batching?(this.ns()&&this.capture("$pageleave"),null==(t=this.Jr)||t.unload(),null==(i=this.Yr)||i.unload()):this.ns()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(Uo?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=un(t.url,{ip:this.config.ip?1:0}),t.headers=g({},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=g({},t);s.timeout=s.timeout||6e4,s.url=un(s.url,{_:(new Date).getTime().toString(),ver:c.LIB_VERSION,compression:s.compression});var n=null!==(i=s.transport)&&void 0!==i?i:"fetch",o=vn.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(e=null==(r=Ni(o,(t=>t.transport===n)))?void 0:r.method)&&void 0!==e?e:o[0].method;if(!a)throw new Error("No available transport method");a(s)})(g({},t,{callback:i=>{var e,r;(this.rateLimiter.checkForLimiting(i),i.statusCode>=400)&&(null==(e=(r=this.config).on_request_error)||e.call(r,i));null==t.callback||t.callback(i)}}))))}Kr(t){this.Yr?this.Yr.retriableRequest(t):this._send_request(t)}_execute_array(t){var i,e=[],r=[],s=[];Ti(t,(t=>{t&&(i=t[0],I(i)?s.push(t):C(t)?t.call(this):I(t)&&"alias"===i?e.push(t):I(t)&&-1!==i.indexOf("capture")&&C(this[i])?s.push(t):r.push(t))}));var n=function(t,i){Ti(t,(function(t){if(I(t[0])){var e=i;Ii(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else this[t[0]].apply(this,t.slice(1))}),i)};n(e,this),n(r,this),n(s,this)}Qr(){var t,i;return(null==(t=this.config.bootstrap)?void 0:t.featureFlags)&&Object.keys(null==(i=this.config.bootstrap)?void 0:i.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,i,e){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Jr){if(this.is_capturing())if(!M(t)&&O(t)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var n=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==n||!n.isRateLimited){null!=i&&i.$current_url&&!O(null==i?void 0:i.$current_url)&&(Ei.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,a=(null==e?void 0:e.timestamp)||o,l=wr(),u={uuid:l,event:t,properties:this.calculateEventProperties(t,i||{},a,l)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),n&&(u.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),(null==e?void 0:e.$set)&&(u.$set=null==e?void 0:e.$set);var h,d="$groupidentify"!==t,v=this.os(null==e?void 0:e.$set_once,d);if(v&&(u.$set_once=v),(u=Di(u,null!=e&&e._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,M(null==e?void 0:e.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),t===Wn.DISMISSED||t===Wn.SENT){var c=null==i?void 0:i[Gn.SURVEY_ID],f=null==i?void 0:i[Gn.SURVEY_ITERATION];h={id:c,current_iteration:f},localStorage.getItem(Xn(h))||localStorage.setItem(Xn(h),"true"),u.$set=g({},u.$set,{[Yn({id:c,current_iteration:f},t===Wn.SENT?"responded":"dismissed")]:!0})}var p=g({},u.properties.$set,u.$set);if(F(p)||this.setPersonPropertiesForFlags(p),!j(this.config.before_send)){var _=this.ls(u);if(!_)return;u=_}this.Nr.emit("eventCaptured",u);var m={method:"POST",url:null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,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.Kr(m):this.Jr.enqueue(m),u}Ei.critical("This capture call is ignored due to client rate limiting.")}}else Ei.error("No event name provided to posthog.capture")}else Ei.uninitializedWarning("posthog.capture")}Ni(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(t,i,e,r,s){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;var n=s?void 0:this.persistence.remove_event_timer(t),a=g({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),"$snapshot"===t){var l=g({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!O(a.distinct_id)&&!L(a.distinct_id)||A(a.distinct_id))&&Ei.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,h=_s(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(s,e.getTime());a.$session_id=v,a.$window_id=c}this.sessionPropsManager&&Ci(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Ci(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(f=this.Yr)?void 0:f.length}catch(t){a.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===ko.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u="$pageview"!==t||s?"$pageleave"!==t||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,r),a=Ci(a,u),"$pageview"===t&&o&&(a.title=o.title),!M(n)){var p=e.getTime()-n;a.$duration=parseFloat((p/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ci({},h,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),I(this.config.property_denylist)?Ii(this.config.property_denylist,(function(t){delete a[t]})):Ei.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(Ei.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,t));var m=this.us();return a.$process_person_profile=m,m&&!s&&this.hs("_calculate_event_properties"),a}os(t,i){var e;if(void 0===i&&(i=!0),!this.persistence||!this.us())return t;if(this.Lr)return t;var r=this.persistence.get_initial_props(),s=null==(e=this.sessionPropsManager)?void 0:e.getSetOnceProps(),n=Ci({},r,s||{},t||{}),o=this.config.sanitize_properties;return o&&(Ei.error("sanitize_properties is deprecated. Use before_send instead"),n=o(n,"$set_once")),i&&(this.Lr=!0),F(n)?void 0:n}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)}ds(t,i){this.register({[t]:i})}getFeatureFlag(t,i){return this.featureFlags.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(i)}catch(t){return i}}isFeatureEnabled(t,i){return this.featureFlags.isFeatureEnabled(t,i)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,i,e){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){return void 0===i&&(i=!1),this.featureFlags.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Nr.on(t,i)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}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.getSurveys(t,i)}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys.getActiveMatchingSurveys(t,i)}renderSurvey(t,i){this.surveys.renderSurvey(t,i)}displaySurvey(t,i){void 0===i&&(i=Zn),this.surveys.displaySurvey(t,i)}cancelPendingSurvey(t){this.surveys.cancelPendingSurvey(t)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}canRenderSurveyAsync(t,i){return void 0===i&&(i=!1),this.surveys.canRenderSurveyAsync(t,i)}identify(t,i,e){if(!this.__loaded||!this.persistence)return Ei.uninitializedWarning("posthog.identify");if(L(t)&&(t=t.toString(),Ei.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))Ei.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.');else if(t!==_e){if(this.hs("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}t!==r&&t!==this.get_property(Hi)&&(this.unregister(Hi),this.register({distinct_id:t}));var n="anonymous"===(this.persistence.get_property(ue)||"anonymous");t!==r&&n?(this.persistence.set_property(ue,"identified"),this.setPersonPropertiesForFlags(g({},e||{},i||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.Br=fn(t,i,e),this.featureFlags.setAnonymousDistinctId(r)):(i||e)&&this.setPersonProperties(i,e),t!==r&&(this.reloadFeatureFlags(),this.unregister(le))}}else Ei.critical('The string "'+_e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Ei.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,i){if((t||i)&&this.hs("posthog.setPersonProperties")){var e=fn(this.get_distinct_id(),t,i);this.Br!==e?(this.setPersonPropertiesForFlags(g({},i||{},t||{})),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Br=e):Ei.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();r[t]!==i&&this.resetGroupPropertiesForFlags(t),this.register({$groups:g({},r,{[t]:i})}),e&&(this.capture("$groupidentify",{$group_type:t,$group_key:i,$group_set:e}),this.setGroupPropertiesForFlags({[t]:e})),r[t]===i||e||this.reloadFeatureFlags()}else Ei.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.featureFlags.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0),this.hs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,i)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s;if(Ei.info("reset"),!this.__loaded)return Ei.uninitializedWarning("posthog.reset");var n=this.get_property("$device_id");if(this.consent.reset(),null==(i=this.persistence)||i.clear(),null==(e=this.sessionPersistence)||e.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(ue,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this.Br=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:_e,$device_id:null},"");else{var o=this.config.get_device_id(wr());this.register_once({distinct_id:o,$device_id:t?o:n},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var 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(zi)?(Ei.critical("Attempting to create alias for existing People user - aborting."),-2):this.hs("posthog.alias")?(M(i)&&(i=this.get_distinct_id()),t!==i?(this.ds(Hi,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Ei.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=g({},this.config);if(R(t)){var e,r,s,n,o,a,l;Ci(this.config,Ho(t));var u=this.Vr();null==(e=this.persistence)||e.update_config(this.config,i,u),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mn(g({},this.config,{persistence:"sessionStorage"}),u);var h=this.qr(this.config.debug);N(h)&&(this.config.debug=h),N(this.config.debug)&&(this.config.debug?(c.DEBUG=!0,Tr.H()&&Tr.G("ph_debug","true"),Ei.info("set_config",{config:t,oldConfig:i,newConfig:g({},this.config)})):(c.DEBUG=!1,Tr.H()&&Tr.V("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(),this.surveys.loadIfEnabled(),this.vs(),null==(l=this.externalIntegrations)||l.startIfEnabledOrStop()}}startSessionRecording(t){var i=!0===t,e={sampling:i||!(null==t||!t.sampling),linked_flag:i||!(null==t||!t.linked_flag),url_trigger:i||!(null==t||!t.url_trigger),event_trigger:i||!(null==t||!t.event_trigger)};if(Object.values(e).some(Boolean)){var r,s,n,o,a;if(null==(r=this.sessionManager)||r.checkAndGetSessionAndWindowId(),e.sampling)null==(s=this.sessionRecording)||s.overrideSampling();if(e.linked_flag)null==(n=this.sessionRecording)||n.overrideLinkedFlag();if(e.url_trigger)null==(o=this.sessionRecording)||o.overrideTrigger("url");if(e.event_trigger)null==(a=this.sessionRecording)||a.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){var e=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(g({},r,i))}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){return this.toolbar.loadToolbar(t)}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:No;return i!==No&&(i=No+"."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property(ue))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property(ue))}us(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&F(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Hi])&&(null==(i=this.persistence)||null==(i=i.props)||!i[pe]))}ns(){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.us()||this.hs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}hs(t){return"never"===this.config.person_profiles?(Ei.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.ds(pe,!0),!0)}Vr(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut(),i=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||t&&!!i}vs(){var t,i,e,r,s=this.Vr();(null==(t=this.persistence)?void 0:t.xi)!==s&&(null==(e=this.persistence)||e.set_disabled(s));(null==(i=this.sessionPersistence)?void 0:i.xi)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s));return s}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){var e,r;if("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())this.reset(!0),null==(e=this.sessionManager)||e.destroy(),this.sessionManager=new wo(this),this.persistence&&(this.sessionPropsManager=new yo(this,this.sessionManager,this.persistence)),this.sessionRecording=new Do(this),this.sessionRecording.startIfEnabledOrStop();if(this.consent.optInOut(!0),this.vs(),this.rs(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),M(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)this.capture(null!==(r=null==t?void 0:t.captureEventName)&&void 0!==r?r:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this.ss()}else Ei.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t,i;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.vs(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:_e,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.ss())):Ei.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===Ar.GRANTED?"granted":t===Ar.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.vs()}_is_bot(){return n?So(n,this.config.custom_blocked_useragents):void 0}ss(){o&&("visible"===o.visibilityState?this.Ur||(this.Ur=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}),this.zr&&(o.removeEventListener("visibilitychange",this.zr),this.zr=null)):this.zr||(this.zr=this.ss.bind(this),Ui(o,"visibilitychange",this.zr)))}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}))}O(){var t,i,e,r,s,n,o,a=this.Wr||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ei.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",r=!1,s=Ei,n=(i="advanced_disable_flags")in(t=a)&&!M(t[i]),o=e in t&&!M(t[e]),n?t[i]:o?(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e]):r)}ls(t){if(j(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),j(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return z(t.event)?Ei.warn(s+". This can cause unexpected behavior."):Ei.info(s),null}e.properties&&!F(e.properties)||Ei.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.Kt)?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)})}qr(t){var i=N(t)&&!t,e=Tr.H()&&"true"===Tr.q("ph_debug");return!i&&(!!e||t)}}!function(t,i){for(var e=0;e<i.length;e++)t.prototype[i[e]]=Oi(t.prototype[i[e]])}(qo,["identify"]);var Wo,Go={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1},Vo=(Wo=jo[No]=new qo,function(){function i(){i.done||(i.done=!0,Uo=!1,Ii(jo,(function(t){t._dom_loaded()})))}null!=o&&o.addEventListener?"complete"===o.readyState?i():Ui(o,"DOMContentLoaded",i,{capture:!1}):t&&Ei.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Wo);export{ir as COPY_AUTOCAPTURE_EVENT,er as Compression,Go as DEFAULT_PRODUCT_TOUR_APPEARANCE,Vn as DisplaySurveyType,qo as PostHog,Wn as SurveyEventName,Gn as SurveyEventProperties,jn as SurveyEventType,Nn as SurveyPosition,Bn as SurveyQuestionBranchingType,Hn as SurveyQuestionType,qn as SurveySchedule,Un as SurveyTabPosition,zn as SurveyType,Ln as SurveyWidgetType,Vo as default,Vo as posthog,rr as severityLevels};
|
|
1
|
+
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=Array.prototype,r=e.forEach,s=e.indexOf,n=null==i?void 0:i.navigator,o=null==i?void 0:i.document,a=null==i?void 0:i.location,l=null==i?void 0:i.fetch,u=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,h=null==i?void 0:i.AbortController,d=null==n?void 0:n.userAgent,v=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"1.312.0"};function f(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 p(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){f(n,r,s,o,a,"next",t)}function a(t){f(n,r,s,o,a,"throw",t)}o(void 0)}))}}function g(){return g=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},g.apply(null,arguments)}function _(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}var m=["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 m.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))},b=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function w(t,i){return-1!==t.indexOf(i)}var x=function(t){return t.trim()},E=function(t){return t.replace(/^\$/,"")};var S=Array.isArray,k=Object.prototype,P=k.hasOwnProperty,T=k.toString,I=S||function(t){return"[object Array]"===T.call(t)},C=t=>"function"==typeof t,R=t=>t===Object(t)&&!I(t),F=t=>{if(R(t)){for(var i in t)if(P.call(t,i))return!1;return!0}return!1},M=t=>void 0===t,O=t=>"[object String]"==T.call(t),A=t=>O(t)&&0===t.trim().length,D=t=>null===t,j=t=>M(t)||D(t),L=t=>"[object Number]"==T.call(t),N=t=>"[object Boolean]"===T.call(t),U=t=>t instanceof FormData,z=t=>w(b,t);function H(t){return null===t||"object"!=typeof t}function B(t,i){return Object.prototype.toString.call(t)==="[object "+i+"]"}function q(t){return!M(Event)&&function(t,i){try{return t instanceof i}catch(t){return!1}}(t,Event)}var W=[!0,"true",1,"1","yes"],G=t=>w(W,t),V=[!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),L(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):t<i?(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.t={},this.i=t.i,this.o=J(t.bucketSize,0,100,t.h),this.m=J(t.refillRate,0,this.o,t.h),this.$=J(t.refillInterval,0,864e5,t.h)}S(t,i){var e=i-t.lastAccess,r=Math.floor(e/this.$);if(r>0){var s=r*this.m;t.tokens=Math.min(t.tokens+s,this.o),t.lastAccess=t.lastAccess+r*this.$}}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.t[r];return s?this.S(s,e):(s={tokens:this.o,lastAccess:e},this.t[r]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.i)||i.call(this,t)),0===s.tokens)}stop(){this.t={}}}var Y="Mobile",X="iOS",Q="Android",Z="Tablet",tt=Q+" "+Z,it="iPad",et="Apple",rt=et+" Watch",st="Safari",nt="BlackBerry",ot="Samsung",at=ot+"Browser",lt=ot+" Internet",ut="Chrome",ht=ut+" OS",dt=ut+" "+X,vt="Internet Explorer",ct=vt+" "+Y,ft="Opera",pt=ft+" Mini",gt="Edge",_t="Microsoft "+gt,mt="Firefox",yt=mt+" "+X,bt="Nintendo",wt="PlayStation",xt="Xbox",Et=Q+" "+Y,$t=Y+" "+st,St="Windows",kt=St+" Phone",Pt="Nokia",Tt="Ouya",It="Generic",Ct=It+" "+Y.toLowerCase(),Rt=It+" "+Z.toLowerCase(),Ft="Konqueror",Mt="(\\d+(\\.\\d+)?)",Ot=new RegExp("Version/"+Mt),At=new RegExp(xt,"i"),Dt=new RegExp(wt+" \\w+","i"),jt=new RegExp(bt+" \\w+","i"),Lt=new RegExp(nt+"|PlayBook|BB10","i"),Nt={"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"};var Ut,zt,Ht,Bt=(t,i)=>i&&w(i,et)||function(t){return w(t,st)&&!w(t,ut)&&!w(t,Q)}(t),qt=function(t,i){return i=i||"",w(t," OPR/")&&w(t,"Mini")?pt:w(t," OPR/")?ft:Lt.test(t)?nt:w(t,"IE"+Y)||w(t,"WPDesktop")?ct:w(t,at)?lt:w(t,gt)||w(t,"Edg/")?_t:w(t,"FBIOS")?"Facebook "+Y:w(t,"UCWEB")||w(t,"UCBrowser")?"UC Browser":w(t,"CriOS")?dt:w(t,"CrMo")||w(t,ut)?ut:w(t,Q)&&w(t,st)?Et:w(t,"FxiOS")?yt:w(t.toLowerCase(),Ft.toLowerCase())?Ft:Bt(t,i)?w(t,Y)?$t:st:w(t,mt)?mt:w(t,"MSIE")||w(t,"Trident/")?vt:w(t,"Gecko")?mt:""},Wt={[ct]:[new RegExp("rv:"+Mt)],[_t]:[new RegExp(gt+"?\\/"+Mt)],[ut]:[new RegExp("("+ut+"|CrMo)\\/"+Mt)],[dt]:[new RegExp("CriOS\\/"+Mt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Mt)],[st]:[Ot],[$t]:[Ot],[ft]:[new RegExp("(Opera|OPR)\\/"+Mt)],[mt]:[new RegExp(mt+"\\/"+Mt)],[yt]:[new RegExp("FxiOS\\/"+Mt)],[Ft]:[new RegExp("Konqueror[:/]?"+Mt,"i")],[nt]:[new RegExp(nt+" "+Mt),Ot],[Et]:[new RegExp("android\\s"+Mt,"i")],[lt]:[new RegExp(at+"\\/"+Mt)],[vt]:[new RegExp("(rv:|MSIE )"+Mt)],Mozilla:[new RegExp("rv:"+Mt)]},Gt=function(t,i){var e=qt(t,i),r=Wt[e];if(M(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=t.match(n);if(o)return parseFloat(o[o.length-2])}return null},Vt=[[new RegExp(xt+"; "+xt+" (.*?)[);]","i"),t=>[xt,t&&t[1]||""]],[new RegExp(bt,"i"),[bt,""]],[new RegExp(wt,"i"),[wt,""]],[Lt,[nt,""]],[new RegExp(St,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[kt,""];if(new RegExp(Y).test(i)&&!/IEMobile\b/.test(i))return[St+" "+Y,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=e[1],s=Nt[r]||"";return/arm/i.test(i)&&(s="RT"),[St,s]}return[St,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var i=[t[3],t[4],t[5]||"0"];return[X,i.join(".")]}return[X,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=M(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Q+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Q+")","i"),t=>{if(t&&t[2]){var i=[t[2],t[3],t[4]||"0"];return[Q,i.join(".")]}return[Q,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];if(t&&t[1]){var e=[t[1],t[2],t[3]||"0"];i[1]=e.join(".")}return i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ht,""]],[/Linux|debian/i,["Linux",""]]],Jt=function(t){return jt.test(t)?bt:Dt.test(t)?wt:At.test(t)?xt:new RegExp(Tt,"i").test(t)?Tt:new RegExp("("+kt+"|WPDesktop)","i").test(t)?kt:/iPad/.test(t)?it:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?rt:Lt.test(t)?nt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Pt,"i").test(t)?Pt:/(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(Y).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)?Q:tt:new RegExp("(pda|"+Y+")","i").test(t)?Ct:new RegExp(Z,"i").test(t)&&!new RegExp(Z+" pc","i").test(t)?Rt:""},Kt=t=>t instanceof Error;function Yt(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Ht&&e.length===zt||(zt=e.length,Ht=e.reduce(((e,r)=>{Ut||(Ut={});var s=Ut[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,Ut[r]=[l,u];break}}return e}),{})),Ht}}class Xt{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(),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return p((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?1:0),i.chunkIdMap)),g({},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 p((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,g({},i,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:Yt(this.stackParser)}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(r<=4){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return g({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}var Qt="?";function Zt(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?Qt:e,in_app:!0};return M(r)||(n.lineno=r),M(s)||(n.colno=s),n}var ti=(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]:Qt,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},ii=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ei=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ri=/\((\S*)(?::(\d+))(?::(\d+))\)/,si=(t,i)=>{var e=ii.exec(t);if(e){var[,r,s,n]=e;return Zt(i,r,Qt,+s,+n)}var o=ei.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=ri.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=ti(o[1]||Qt,o[2]);return Zt(i,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},ni=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,oi=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ai=(t,i)=>{var e=ni.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=oi.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]||Qt;return[n,s]=ti(n,s),Zt(i,s,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},li=/\(error: (.*)\)/,ui=50;function hi(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return function(i,r){void 0===r&&(r=0);for(var s=[],n=i.split("\n"),o=r;o<n.length;o++){var a=n[o];if(!(a.length>1024)){var l=li.test(a)?a.replace(li,"$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>=ui)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,ui).map((t=>{return g({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||Qt});var e}))}(s)}}class di{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 vi{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 e.error&&"string"==typeof e.error.message?String(e.error.message):String(e)}getStack(t){return t.stacktrace||t.stack||void 0}}class ci{constructor(){}match(t){return B(t,"ErrorEvent")&&null!=t.error}coerce(t,i){var e,r=i.apply(t.error);return r||{type:"ErrorEvent",value:t.message,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}var fi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class pi{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(fi);return r&&(i=r[1],e=r[2]),[i,e]}}var gi=["fatal","error","warning","log","info","debug"];function _i(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(!(s.length>i))return r===e.length||s.length<=i?s:s.slice(0,i)+"..."}return""}class mi{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: "+_i(t)}isSeverityLevel(t){return O(t)&&!A(t)&&gi.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var e=t[i];if(Kt(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class yi{match(t){return q(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+_i(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class bi{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 wi{match(t){return B(t,"PromiseRejectionEvent")}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){if(H(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var xi=function(i,e){var{debugEnabled:r}=void 0===e?{}:e,s={k:function(e){if(t&&(c.DEBUG||v.POSTHOG_DEBUG||r)&&!M(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;a<n;a++)o[a-1]=arguments[a];s(i,...o)}},info:function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];s.k("log",...i)},warn:function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];s.k("warn",...i)},error:function(){for(var t=arguments.length,i=new Array(t),e=0;e<t;e++)i[e]=arguments[e];s.k("error",...i)},critical:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];console.error(i,...e)},uninitializedWarning:t=>{s.error("You must initialize PostHog before calling "+t)},createLogger:(t,e)=>xi(i+" "+t,e)};return s},Ei=xi("[PostHog.js]"),$i=Ei.createLogger,Si=$i("[ExternalScriptsLoader]"),ki=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Si.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=null==o?void 0:o.querySelectorAll("script");if(r)for(var s,n=function(){if(r[a].src===i){var t=r[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;a<r.length;a++)if(s=n())return s.v;var l=()=>{if(!o)return e("document not found");var r=o.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>e(t),t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");var s,n=o.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):o.body.appendChild(r)};null!=o&&o.body?l():null==o||o.addEventListener("DOMContentLoaded",l)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__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);ki(t,n,e)},v.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);ki(t,r,e)};var Pi={};function Ti(t,i,e){if(I(t))if(r&&t.forEach===r)t.forEach(i,e);else if("length"in t&&t.length===+t.length)for(var s=0,n=t.length;s<n;s++)if(s in t&&i.call(e,t[s],s)===Pi)return}function Ii(t,i,e){if(!j(t)){if(I(t))return Ti(t,i,e);if(U(t)){for(var r of t.entries())if(i.call(e,r[1],r[0])===Pi)return}else for(var s in t)if(P.call(t,s)&&i.call(e,t[s],s)===Pi)return}}var Ci=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return Ti(e,(function(i){for(var e in i)void 0!==i[e]&&(t[e]=i[e])})),t},Ri=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];return Ti(e,(function(i){Ti(i,(function(i){t.push(i)}))})),t};function Fi(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 Mi=function(t){try{return t()}catch(t){return}},Oi=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;r<i;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){Ei.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ei.critical(t)}}},Ai=function(t){var i={};return Ii(t,(function(t,e){(O(t)&&t.length>0||L(t))&&(i[e]=t)})),i};function Di(t,i){return e=t,r=t=>O(t)&&!D(i)?t.slice(0,i):t,s=new Set,function t(i,e){return i!==Object(i)?r?r(i,e):i:s.has(i)?void 0:(s.add(i),I(i)?(n=[],Ti(i,(i=>{n.push(t(i))}))):(n={},Ii(i,((i,e)=>{s.has(i)||(n[e]=t(i,e))}))),n);var n}(e);var e,r,s}var ji=["herokuapp.com","vercel.app","netlify.app"];function Li(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 ji)if(e===r)return!1;return!0}function Ni(t,i){for(var e=0;e<t.length;e++)if(i(t[e]))return t[e]}function Ui(t,i,e,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:s,passive:n})}var zi="$people_distinct_id",Hi="__alias",Bi="__timers",qi="$autocapture_disabled_server_side",Wi="$heatmaps_enabled_server_side",Gi="$exception_capture_enabled_server_side",Vi="$error_tracking_suppression_rules",Ji="$error_tracking_capture_extension_exceptions",Ki="$web_vitals_enabled_server_side",Yi="$dead_clicks_enabled_server_side",Xi="$product_tours_enabled_server_side",Qi="$web_vitals_allowed_metrics",Zi="$session_recording_remote_config",te="$sesid",ie="$session_is_sampled",ee="$enabled_feature_flags",re="$early_access_features",se="$feature_flag_details",ne="$stored_person_properties",oe="$stored_group_properties",ae="$surveys",le="$flag_call_reported",ue="$user_state",he="$client_session_props",de="$capture_rate_limit",ve="$initial_campaign_params",ce="$initial_referrer_info",fe="$initial_person_info",pe="$epp",ge="__POSTHOG_TOOLBAR__",_e="$posthog_cookieless",me=[zi,Hi,"__cmpns",Bi,"$session_recording_enabled_server_side",Wi,te,ee,Vi,ue,re,se,oe,ne,ae,le,he,de,ve,ce,pe,fe,"$conversations_widget_session_id","$conversations_ticket_id","$conversations_widget_state","$conversations_user_traits"];function ye(t){return t instanceof Element&&(t.id===ge||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function be(t){return!!t&&1===t.nodeType}function we(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function xe(t){return!!t&&3===t.nodeType}function Ee(t){return!!t&&11===t.nodeType}function $e(t){return t?x(t).split(/\s+/):[]}function Se(i){var e=null==t?void 0:t.location.href;return!!(e&&i&&i.some((t=>e.match(t))))}function ke(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 $e(i)}function Pe(t){return j(t)?null:x(t).split(/(\s+)/).filter((t=>Je(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Te(t){var i="";return Ue(t)&&!ze(t)&&t.childNodes&&t.childNodes.length&&Ii(t.childNodes,(function(t){var e;xe(t)&&t.textContent&&(i+=null!==(e=Pe(t.textContent))&&void 0!==e?e:"")})),x(i)}function Ie(t){return M(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null;var i}var Ce=["a","button","form","input","select","textarea","label"];function Re(t,i){if(M(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 Fe(t){var i=t.parentNode;return!(!i||!be(i))&&i}var Me=["next","previous","prev",">","<"],Oe=10;var Ae=[".ph-no-rageclick",".ph-no-capture"];function De(i,e){if(!t||je(i))return!1;var r,s,n;N(e)?(r=!!e&&Ae,s=void 0):(r=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:Ae,s=null==e?void 0:e.content_ignorelist);if(!1===r)return!1;var{targetElementList:o}=Le(i,!1);return!function(t,i){if(!1===t||M(t))return!1;var e;if(!0===t)e=Me;else{if(!I(t))return!1;if(t.length>Oe)return Ei.error("[PostHog] content_ignorelist array cannot exceed "+Oe+" 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:Te(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!Re(o,r)}var je=t=>!t||we(t,"html")||!be(t),Le=(i,e)=>{if(!t||je(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!we(n,"body");)if(Ee(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=Fe(n);if(!o)break;if(e||Ce.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 Ne(i,e,r,s,n){var o,a,l,u;if(void 0===r&&(r=void 0),!t||je(i))return!1;if(null!=(o=r)&&o.url_allowlist&&!Se(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&Se(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}=Le(i,s);if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(M(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(!Re(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&&(Ce.indexOf(f)>-1||"true"===i.getAttribute("contenteditable"))}}function Ue(t){for(var i=t;i.parentNode&&!we(i,"body");i=i.parentNode){var e=ke(i);if(w(e,"ph-sensitive")||w(e,"ph-no-capture"))return!1}if(w(ke(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||"";if(O(s)){if(/^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,"")))return!1}return!0}function ze(t){return!!(we(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||we(t,"select")||we(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var He="(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})",Be=new RegExp("^(?:"+He+")$"),qe=new RegExp(He),We="\\d{3}-?\\d{2}-?\\d{4}",Ge=new RegExp("^("+We+")$"),Ve=new RegExp("("+We+")");function Je(t,i){if(void 0===i&&(i=!0),j(t))return!1;if(O(t)){if(t=x(t),(i?Be:qe).test((t||"").replace(/[- ]/g,"")))return!1;if((i?Ge:Ve).test(t))return!1}return!0}function Ke(t){var i=Te(t);return Je(i=(i+" "+Ye(t)).trim())?i:""}function Ye(t){var i="";return t&&t.childNodes&&t.childNodes.length&&Ii(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Te(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Ye(t)).trim())}catch(t){Ei.error("[AutoCapture]",t)}})),i}function Xe(t){return function(t){var i=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=g({},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 Fi(n).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return o[Qe(i.toString())]=Qe(e.toString())})),r+=":",r+=Fi(o).map((t=>{var[i,e]=t;return i+'="'+e+'"'})).join("")}));return i.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:Ze(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Fi(t).filter((t=>{var[i]=t;return 0===i.indexOf("attr__")})).forEach((t=>{var[i,e]=t;return r.attributes[i]=e})),r}))}(t))}function Qe(t){return t.replace(/"|\\"/g,'\\"')}function Ze(t){var i=t.attr__class;return i?I(i)?i:$e(i):void 0}class tr{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&&e-r.timestamp<this.timeoutMs){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 ir="$copy_autocapture",er=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),rr=["fatal","error","warning","log","info","debug"],sr=t=>{var i=null==o?void 0:o.createElement("a");return M(i)?null:(i.href=t,i)},nr=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return Ii(t,(function(t,i){M(t)||M(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)},or=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!I(e)||e.length<2)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Ei.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ar=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],u=(a||"").split("&"),h=[],d=0;d<u.length;d++){var v=u[d].split("=");I(v)&&(i.includes(v[0])?h.push(v[0]+"="+e):h.push(u[d]))}var c=l;return null!=a&&(c+="?"+h.join("&")),null!=n&&(c+="#"+n),c},lr=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},ur=$i("[AutoCapture]");function hr(t,i){return i.length>t?i.slice(0,t)+"...":i}function dr(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!be(i));return i}function vr(t,i,e,r){var s=t.tagName.toLowerCase(),n={tag_name:s};Ce.indexOf(s)>-1&&!e&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=hr(1024,Ke(t)):n.$el_text=hr(1024,Te(t)));var o=ke(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),Ii(t.attributes,(function(e){var s;if((!ze(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&((null==r||!r.includes(e.name))&&!i&&Je(e.value)&&(s=e.name,!O(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7)))){var o=e.value;"class"===e.name&&(o=$e(o).join(" ")),n["attr__"+e.name]=hr(1024,o)}}));for(var a=1,l=1,u=t;u=dr(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function cr(i,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=e,h=[i],d=i;d.parentNode&&!we(d,"body");)Ee(d.parentNode)?(h.push(d.parentNode.host),d=d.parentNode.host):(h.push(d.parentNode),d=d.parentNode);var v,c=[],f={},p=!1,g=!1;if(Ii(h,(t=>{var i=Ue(t);"a"===t.tagName.toLowerCase()&&(p=t.getAttribute("href"),p=i&&p&&Je(p)&&p),w(ke(t),"ph-no-capture")&&(g=!0),c.push(vr(t,o,a,l));var e=function(t){if(!Ue(t))return{};var i={};return Ii(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&&Je(r)&&(i[e]=r)}})),i}(t);Ci(f,e)})),g)return{props:{},explicitNoCapture:g};if(a||("a"===i.tagName.toLowerCase()||"button"===i.tagName.toLowerCase()?c[0].$el_text=Ke(i):c[0].$el_text=Te(i)),p){var _,m;c[0].attr__href=p;var y=null==(_=sr(p))?void 0:_.host,b=null==t||null==(m=t.location)?void 0:m.host;y&&b&&y!==b&&(v=p)}return{props:Ci({$event_type:n.type,$ce_version:1},u?{}:{$elements:c},{$elements_chain:Xe(c)},null!=(r=c[0])&&r.$el_text?{$el_text:null==(s=c[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},f)}}class fr{constructor(t){this.P=!1,this.T=null,this.I=!1,this.instance=t,this.rageclicks=new tr(t.config.rageclick),this.C=null}get R(){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}F(){if(this.isBrowserSupported()){if(t&&o){var i=i=>{i=i||(null==t?void 0:t.event);try{this.M(i)}catch(t){ur.error("Failed to capture event",t)}};if(Ui(o,"submit",i,{capture:!0}),Ui(o,"change",i,{capture:!0}),Ui(o,"click",i,{capture:!0}),this.R.capture_copied_text){var e=i=>{i=i||(null==t?void 0:t.event),this.M(i,ir)};Ui(o,"copy",e,{capture:!0}),Ui(o,"cut",e,{capture:!0})}}}else ur.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.F(),this.P=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.I=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[qi]:!!t.autocapture_opt_out}),this.T=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.C=t}getElementSelectors(t){var i,e=[];return null==(i=this.C)||i.forEach((i=>{var r=null==o?void 0:o.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i,e=null==(t=this.instance.persistence)?void 0:t.props[qi],r=this.T;if(D(r)&&!N(e)&&!this.instance.O())return!1;var s=null!==(i=this.T)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!s}M(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r,s=Ie(i);if(xe(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())&&De(s,this.instance.config.rageclick)&&this.M(i,"$rageclick");var n=e===ir;if(s&&Ne(s,i,this.R,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=cr(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.R.element_attribute_ignorelist,elementsChainAsString:this.I});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),e===ir){var u,h=Pe(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 C(null==o?void 0:o.querySelectorAll)}}Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return L(t)&&isFinite(t)&&Math.floor(t)===t});var pr="0123456789abcdef";class gr{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)||t<0||i<0||e<0||r<0||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 gr(s)}toString(){for(var t="",i=0;i<this.bytes.length;i++)t=t+pr.charAt(this.bytes[i]>>>4)+pr.charAt(15&this.bytes[i]),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 gr(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;i<16;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class _r{constructor(){this.A=0,this.D=0,this.j=new br}generate(){var t=this.generateOrAbort();if(M(t)){this.A=0;var i=this.generateOrAbort();if(M(i))throw new Error("Could not generate UUID after timestamp reset");return i}return t}generateOrAbort(){var t=Date.now();if(t>this.A)this.A=t,this.L();else{if(!(t+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return gr.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var mr,yr=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;i<t.length;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!M(t.crypto)&&crypto.getRandomValues&&(yr=t=>crypto.getRandomValues(t));class br{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(yr(this.N),this.U=0),this.N[this.U++]}}var wr=()=>xr().toString(),xr=()=>(mr||(mr=new _r)).generate(),Er="";var $r=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Sr(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=o),Er)return Er;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+wr();!Er&&r--;){var n=e.slice(r).join("."),a=s+"=1;domain=."+n+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(s)&&(i.cookie=a+";max-age=0",Er=n)}return Er}(t);if(!e){var r=(t=>{var i=t.match($r);return i?i[0]:""})(t);r!==e&&Ei.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}var kr={H:()=>!!o,B:function(t){Ei.error("cookieStore error: "+t)},q:function(t){if(o){try{for(var i=t+"=",e=o.cookie.split(";").filter((t=>t.length)),r=0;r<e.length;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}},W:function(t){var i;try{i=JSON.parse(kr.q(t))||{}}catch(t){}return i},G:function(t,i,e,r,s){if(o)try{var n="",a="",l=Sr(o.location.hostname,r);if(e){var u=new Date;u.setTime(u.getTime()+24*e*60*60*1e3),n="; expires="+u.toUTCString()}s&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&Ei.warn("cookieStore warning: large cookie, len="+h.length),o.cookie=h,h}catch(t){return}},V:function(t,i){if(null!=o&&o.cookie)try{kr.G(t,"",-1,i)}catch(t){return}}},Pr=null,Tr={H:function(){if(!D(Pr))return Pr;var i=!0;if(M(t))i=!1;else try{var e="__mplssupport__";Tr.G(e,"xyz"),'"xyz"'!==Tr.q(e)&&(i=!1),Tr.V(e)}catch(t){i=!1}return i||Ei.error("localStorage unsupported; falling back to cookie store"),Pr=i,i},B:function(t){Ei.error("localStorage error: "+t)},q:function(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){Tr.B(t)}return null},W:function(t){try{return JSON.parse(Tr.q(t))||{}}catch(t){}return null},G:function(i,e){try{null==t||t.localStorage.setItem(i,JSON.stringify(e))}catch(t){Tr.B(t)}},V:function(i){try{null==t||t.localStorage.removeItem(i)}catch(t){Tr.B(t)}}},Ir=["$device_id","distinct_id",te,ie,pe,fe],Cr=g({},Tr,{W:function(t){try{var i={};try{i=kr.W(t)||{}}catch(t){}var e=Ci(i,JSON.parse(Tr.q(t)||"{}"));return Tr.G(t,e),e}catch(t){}return null},G:function(t,i,e,r,s,n){try{Tr.G(t,i,void 0,void 0,n);var o={};Ir.forEach((t=>{i[t]&&(o[t]=i[t])})),Object.keys(o).length&&kr.G(t,o,e,r,s,n)}catch(t){Tr.B(t)}},V:function(i,e){try{null==t||t.localStorage.removeItem(i),kr.V(i,e)}catch(t){Tr.B(t)}}}),Rr={},Fr={H:function(){return!0},B:function(t){Ei.error("memoryStorage error: "+t)},q:function(t){return Rr[t]||null},W:function(t){return Rr[t]||null},G:function(t,i){Rr[t]=i},V:function(t){delete Rr[t]}},Mr=null,Or={H:function(){if(!D(Mr))return Mr;if(Mr=!0,M(t))Mr=!1;else try{var i="__support__";Or.G(i,"xyz"),'"xyz"'!==Or.q(i)&&(Mr=!1),Or.V(i)}catch(t){Mr=!1}return Mr},B:function(t){Ei.error("sessionStorage error: ",t)},q:function(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){Or.B(t)}return null},W:function(t){try{return JSON.parse(Or.q(t))||null}catch(t){}return null},G:function(i,e){try{null==t||t.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){Or.B(t)}},V:function(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){Or.B(t)}}},Ar=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class Dr{constructor(t){this._instance=t}get R(){return this._instance.config}get consent(){return this.J()?Ar.DENIED:this.K}isOptedOut(){return"always"===this.R.cookieless_mode||(this.consent===Ar.DENIED||this.consent===Ar.PENDING&&(this.R.opt_out_capturing_by_default||"on_reject"===this.R.cookieless_mode))}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Ar.DENIED}optInOut(t){this.Y.G(this.X,t?1:0,this.R.cookie_expiration,this.R.cross_subdomain_cookie,this.R.secure_cookie)}reset(){this.Y.V(this.X,this.R.cross_subdomain_cookie)}get X(){var{token: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 K(){var t=this.Y.q(this.X);return G(t)?Ar.GRANTED:w(V,t)?Ar.DENIED:Ar.PENDING}get Y(){if(!this.Z){var t=this.R.opt_out_capturing_persistence_type;this.Z="localStorage"===t?Tr:kr;var i="localStorage"===t?kr:Tr;i.q(this.X)&&(this.Z.q(this.X)||this.optInOut(G(i.q(this.X))),i.V(this.X,this.R.cross_subdomain_cookie))}return this.Z}J(){return!!this.R.respect_dnt&&!!Ni([null==n?void 0:n.doNotTrack,null==n?void 0:n.msDoNotTrack,v.doNotTrack],(t=>G(t)))}}var jr=$i("[Dead Clicks]"),Lr=()=>!0,Nr=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Yi)),r=t.instance.config.capture_dead_clicks;return N(r)?r:!!R(r)||e};class Ur{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[Yi]:null==t?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it((()=>{this.et()}))}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?jr.error("failed to load script",i):t()}))}et(){var t;if(o){if(!this.tt&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=R(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.tt=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.tt.start(o),jr.info("starting...")}}else jr.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,jr.info("stopping..."))}}var zr=$i("[ExceptionAutocapture]");class Hr{constructor(i){var e,r,s;this.rt=()=>{var i;if(t&&this.isEnabled&&null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.R.capture_unhandled_errors&&(this.st=e(this.captureException.bind(this))),!this.nt&&this.R.capture_unhandled_rejections&&(this.nt=r(this.captureException.bind(this))),!this.ot&&this.R.capture_console_errors&&(this.ot=s(this.captureException.bind(this)))}catch(t){zr.error("failed to start",t),this.ut()}}},this._instance=i,this.ht=!(null==(e=this._instance.persistence)||!e.props[Gi]),this.dt=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,h:zr}),this.R=this.vt(),this.startIfEnabledOrStop()}vt(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return R(t)?i=g({},i,t):(M(t)?this.ht:t)&&(i=g({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.R.capture_console_errors||this.R.capture_unhandled_errors||this.R.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(zr.info("enabled"),this.ut(),this.it(this.rt)):this.ut()}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return zr.error("failed to load script",i);t()}))}ut(){var t,i,e;null==(t=this.st)||t.call(this),this.st=void 0,null==(i=this.nt)||i.call(this),this.nt=void 0,null==(e=this.ot)||e.call(this),this.ot=void 0}onRemoteConfig(t){var i=t.autocaptureExceptions;this.ht=!!i||!1,this._instance.persistence&&this._instance.persistence.register({[Gi]:this.ht}),this.R=this.vt(),this.startIfEnabledOrStop()}onConfigChange(){this.R=this.vt()}captureException(t){var i,e,r=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.dt.consumeRateLimit(r)?zr.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(t)}}function Br(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return C(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}class qr{constructor(i){var e;this._instance=i,this.ct=(null==t||null==(e=t.location)?void 0:e.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Ei.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ft&&this.ft(),this.ft=void 0,Ei.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(t&&t.history){var r=this;null!=(i=t.history.pushState)&&i.__posthog_wrapped__||Br(t.history,"pushState",(t=>function(i,e,s){t.call(this,i,e,s),r._t("pushState")})),null!=(e=t.history.replaceState)&&e.__posthog_wrapped__||Br(t.history,"replaceState",(t=>function(i,e,s){t.call(this,i,e,s),r._t("replaceState")})),this.yt()}}_t(i){try{var e,r=null==t||null==(e=t.location)?void 0:e.pathname;if(!r)return;r!==this.ct&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:i}),this.ct=r}catch(t){Ei.error("Error capturing "+i+" pageview",t)}}yt(){if(!this.ft){var i=()=>{this._t("popstate")};Ui(t,"popstate",i),this.ft=()=>{t&&t.removeEventListener("popstate",i)}}}}var Wr=$i("[SegmentIntegration]");function Gr(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()||wr();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(ue,"identified")),i()},s=e.user();"then"in s&&C(s.then)?s.then((t=>r(t))):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||Wr.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()||(Wr.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Wr.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,"$pageview"),identify:t=>i(t,"$identify"),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}var Vr="posthog-js";function Jr(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=(null==(a=i.exception)?void 0:a.values)||[],f=c.map((t=>g({},t,{stacktrace:t.stacktrace?g({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>g({},t,{platform:"web:javascript"})))}):void 0}))),p={$exception_message:(null==(l=c[0])?void 0:l.value)||i.message,$exception_type:null==(u=c[0])?void 0:u.type,$exception_level:i.level,$exception_list:f,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(h=c[0])?void 0:h.value)||i.message,$sentry_exception_type:null==(d=c[0])?void 0:d.type,$sentry_tags:i.tags};return e&&r&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+e+"/issues/?project="+r+"&query="+i.event_id),o&&t.exceptions.sendExceptionEvent(p),i}}class Kr{constructor(t,i,e,r,s,n){this.name=Vr,this.setupOnce=function(o){o(Jr(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}var Yr=null!=t&&t.location?lr(t.location.hash,"__posthog")||lr(location.hash,"state"):null,Xr="_postHogToolbarParams",Qr=$i("[Toolbar]"),Zr=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(Zr||{});class ts{constructor(t){this.instance=t}bt(t){v.ph_toolbar_state=t}wt(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:Zr.UNINITIALIZED}maybeLoadToolbar(i,e,r){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===r&&(r=void 0),!t||!o)return!1;i=null!=i?i:t.location,r=null!=r?r: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 s,n=Yr||lr(i.hash,"__posthog")||lr(i.hash,"state"),a=n?Mi((()=>JSON.parse(atob(decodeURIComponent(n)))))||Mi((()=>JSON.parse(decodeURIComponent(n)))):null;return a&&"ph_authorize"===a.action?((s=a).source="url",s&&Object.keys(s).length>0&&(a.desiredHash?i.hash=a.desiredHash:r?r.replaceState(r.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(Xr)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch(t){return!1}}xt(t){var i=v.ph_load_toolbar||v.ph_load_editor;!j(i)&&C(i)?i(t,this.instance):Qr.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==o||!o.getElementById(ge));if(!t||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=g({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(t.localStorage.setItem(Xr,JSON.stringify(g({},s,{source:void 0}))),this.wt()===Zr.LOADED)this.xt(s);else if(this.wt()===Zr.UNINITIALIZED){var n;this.bt(Zr.LOADING),null==(n=v.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return Qr.error("[Toolbar] Failed to load",t),void this.bt(Zr.UNINITIALIZED);this.bt(Zr.LOADED),this.xt(s)})),Ui(t,"turbolinks:load",(()=>{this.bt(Zr.UNINITIALIZED),this.loadToolbar(s)}))}return!0}Et(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)}}var is=$i("[TracingHeaders]");class es{constructor(t){this.$t=void 0,this.St=void 0,this.rt=()=>{var t,i;M(this.$t)&&(null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager));M(this.St)&&(null==(i=v.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return is.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.it(this.rt):(null==(t=this.$t)||t.call(this),null==(i=this.St)||i.call(this),this.$t=void 0,this.St=void 0)}}var rs="https?://(.*)",ss=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ns=Ri(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],ss),os="<masked>",as=["li_fat_id"];function ls(t,i,e){if(!o)return{};var r,s=i?Ri([],ss,e||[]):[],n=us(ar(o.URL,s,os),t),a=(r={},Ii(as,(function(t){var i=kr.q(t);r[t]=i||null})),r);return Ci(a,n)}function us(t,i){var e=ns.concat(i||[]),r={};return Ii(e,(function(i){var e=or(t,i);r[i]=e||null})),r}function hs(t){var i=function(t){return t?0===t.search(rs+"google.([^/?]*)")?"google":0===t.search(rs+"bing.com")?"bing":0===t.search(rs+"yahoo.com")?"yahoo":0===t.search(rs+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!D(i)){r.$search_engine=i;var s=o?or(o.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function ds(){return navigator.language||navigator.userLanguage}function vs(){return(null==o?void 0:o.referrer)||"$direct"}function cs(t,i){var e=t?Ri([],ss,i||[]):[],r=null==a?void 0:a.href.substring(0,1e3);return{r:vs().substring(0,1e3),u:r?ar(r,e,os):void 0}}function fs(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:"$direct"==e?"$direct":null==(i=sr(e))?void 0:i.host};if(r){s.$current_url=r;var n=sr(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=us(r);Ci(s,o)}if(e){var a=hs(e);Ci(s,a)}return s}function ps(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function gs(){try{return(new Date).getTimezoneOffset()}catch(t){return}}function _s(i,e){if(!d)return{};var r,s,n,o=i?Ri([],ss,e||[]):[],[l,u]=function(t){for(var i=0;i<Vt.length;i++){var[e,r]=Vt[i],s=e.exec(t),n=s&&(C(r)?r(s,t):r);if(n)return n}return["",""]}(d);return Ci(Ai({$os:l,$os_version:u,$browser:qt(d,navigator.vendor),$device:Jt(d),$device_type:(s=d,n=Jt(s),n===it||n===tt||"Kobo"===n||"Kindle Fire"===n||n===Rt?Z:n===bt||n===xt||n===wt||n===Tt?"Console":n===rt?"Wearable":n?Y:"Desktop"),$timezone:ps(),$timezone_offset:gs()}),{$current_url:ar(null==a?void 0:a.href,o,os),$host:null==a?void 0:a.host,$pathname:null==a?void 0:a.pathname,$raw_user_agent:d.length>1e3?d.substring(0,997)+"...":d,$browser_version:Gt(d,navigator.vendor),$browser_language:ds(),$browser_language_prefix:(r=ds(),"string"==typeof r?r.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:"web",$lib_version:c.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var ms=$i("[Web Vitals]"),ys=9e5;class bs{constructor(t){var i;this.kt=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Pt=()=>{clearTimeout(this.Tt),0!==this.N.metrics.length&&(this._instance.capture("$web_vitals",this.N.metrics.reduce(((t,i)=>g({},t,{["$web_vitals_"+i.name+"_event"]:g({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.It=t=>{var i,e=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(M(e))ms.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Ct();if(!M(r))if(j(null==t?void 0:t.name)||j(null==t?void 0:t.value))ms.error("Invalid metric received",t);else if(this.Rt&&t.value>=this.Rt)ms.error("Ignoring metric with value >= "+this.Rt,t);else this.N.url!==r&&(this.Pt(),this.Tt=setTimeout(this.Pt,this.flushToCaptureTimeoutMs)),M(this.N.url)&&(this.N.url=r),this.N.firstMetricTimestamp=M(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.N.metrics.push(g({},t,{$current_url:r,$session_id:e.sessionId,$window_id:e.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.Pt()}},this.rt=()=>{var t,i,e,r,s=v.__PosthogExtensions__;M(s)||M(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.It.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.It.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.It.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.It.bind(this)),this.P=!0):ms.error("web vitals callbacks not loaded - not starting")},this._instance=t,this.kt=!(null==(i=this._instance.persistence)||!i.props[Ki]),this.startIfEnabled()}get allowedMetrics(){var t,i,e=R(this._instance.config.capture_performance)?null==(t=this._instance.config.capture_performance)?void 0:t.web_vitals_allowed_metrics:void 0;return M(e)?(null==(i=this._instance.persistence)?void 0:i.props[Qi])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Rt(){var t=R(this._instance.config.capture_performance)&&L(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:ys;return 0<t&&t<=6e4?ys:t}get isEnabled(){var t=null==a?void 0:a.protocol;if("http:"!==t&&"https:"!==t)return ms.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=R(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:N(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return N(i)?i:this.kt}startIfEnabled(){this.isEnabled&&!this.P&&(ms.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(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({[Ki]:i}),this._instance.persistence.register({[Qi]:e})),this.kt=i,this.startIfEnabled()}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.postHogWebVitalsCallbacks&&t(),null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"web-vitals",(i=>{i?ms.error("failed to load script",i):t()}))}Ct(){var i=t?t.location.href:void 0;if(i){var e=this._instance.config.mask_personal_data_properties,r=this._instance.config.custom_personal_data_properties,s=e?Ri([],ss,r||[]):[];return ar(i,s,os)}ms.error("Could not determine current URL")}}var ws=$i("[Heatmaps]");function xs(t){return R(t)&&"clientX"in t&&"clientY"in t&&L(t.clientX)&&L(t.clientY)}class Es{constructor(t){var i;this.kt=!1,this.P=!1,this.Ft=null,this.instance=t,this.kt=!(null==(i=this.instance.persistence)||!i.props[Wi]),this.rageclicks=new tr(t.config.rageclick)}get flushIntervalMilliseconds(){var t=5e3;return R(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return M(this.instance.config.capture_heatmaps)?M(this.instance.config.enable_heatmaps)?this.kt:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;ws.info("starting..."),this.Mt(),this.Ot()}else{var t;clearInterval(null!==(t=this.Ft)&&void 0!==t?t:void 0),this.At(),this.getAndClearBuffer()}}onRemoteConfig(t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Wi]:i}),this.kt=i,this.startIfEnabled()}getAndClearBuffer(){var t=this.N;return this.N=void 0,t}Dt(t){this.jt(t.originalEvent,"deadclick")}Ot(){this.Ft&&clearInterval(this.Ft),this.Ft=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(o)?setInterval(this.Lt.bind(this),this.flushIntervalMilliseconds):null}Mt(){t&&o&&(this.Nt=this.Lt.bind(this),Ui(t,"beforeunload",this.Nt),this.Ut=i=>this.jt(i||(null==t?void 0:t.event)),Ui(o,"click",this.Ut,{capture:!0}),this.zt=i=>this.Ht(i||(null==t?void 0:t.event)),Ui(o,"mousemove",this.zt,{capture:!0}),this.Bt=new Ur(this.instance,Lr,this.Dt.bind(this)),this.Bt.startIfEnabled(),this.qt=this.Ot.bind(this),Ui(o,"visibilitychange",this.qt),this.P=!0)}At(){var i;t&&o&&(this.Nt&&t.removeEventListener("beforeunload",this.Nt),this.Ut&&o.removeEventListener("click",this.Ut,{capture:!0}),this.zt&&o.removeEventListener("mousemove",this.zt,{capture:!0}),this.qt&&o.removeEventListener("visibilitychange",this.qt),clearTimeout(this.Wt),null==(i=this.Bt)||i.stop(),this.P=!1)}Gt(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&&be(s)&&!we(s,"body");){if(s===r)return!1;if(w(e,null==t?void 0:t.getComputedStyle(s).position))return!0;s=Fe(s)}return!1}(Ie(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}jt(t,i){var e;if(void 0===i&&(i="click"),!ye(t.target)&&xs(t)){var r=this.Gt(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Vt(g({},r,{type:"rageclick"})),this.Vt(r)}}Ht(t){!ye(t.target)&&xs(t)&&(clearTimeout(this.Wt),this.Wt=setTimeout((()=>{this.Vt(this.Gt(t,"mousemove"))}),500))}Vt(i){if(t){var e=t.location.href,r=this.instance.config.mask_personal_data_properties,s=this.instance.config.custom_personal_data_properties,n=r?Ri([],ss,s||[]):[],o=ar(e,n,os);this.N=this.N||{},this.N[o]||(this.N[o]=[]),this.N[o].push(i)}}Lt(){this.N&&!F(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class $s{constructor(t){this.Jt=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength)&&(Ei.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Kt=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Yt()}Yt(){var t;this.Xt=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Jt)}destroy(){var t;null==(t=this.Xt)||t.call(this),this.Xt=void 0}doPageView(i,e){var r,s=this.Qt(i,e);return this.Kt={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.Qt(t,null==(i=this.Kt)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Kt)?void 0:t.pageViewId}}Qt(t,i){var e=this.Kt;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(!(M(n)||M(o)||M(a)||M(l)||M(u)||M(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?1:J(o/n,0,1,Ei),v=n<=1?1:J(a/n,0,1,Ei),c=l<=1?1:J(u/l,0,1,Ei),f=l<=1?1:J(h/l,0,1,Ei);r=Ci(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 Ss=Uint8Array,ks=Uint16Array,Ps=Uint32Array,Ts=new Ss([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]),Is=new Ss([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]),Cs=new Ss([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Rs=function(t,i){for(var e=new ks(31),r=0;r<31;++r)e[r]=i+=1<<t[r-1];var s=new Ps(e[30]);for(r=1;r<30;++r)for(var n=e[r];n<e[r+1];++n)s[n]=n-e[r]<<5|r;return[e,s]},Fs=Rs(Ts,2),Ms=Fs[0],Os=Fs[1];Ms[28]=258,Os[258]=28;for(var As=Rs(Is,0)[1],Ds=new ks(32768),js=0;js<32768;++js){var Ls=(43690&js)>>>1|(21845&js)<<1;Ls=(61680&(Ls=(52428&Ls)>>>2|(13107&Ls)<<2))>>>4|(3855&Ls)<<4,Ds[js]=((65280&Ls)>>>8|(255&Ls)<<8)>>>1}var Ns=function(t,i,e){for(var r=t.length,s=0,n=new ks(i);s<r;++s)++n[t[s]-1];var o,a=new ks(i);for(s=0;s<i;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new ks(1<<i);var l=15-i;for(s=0;s<r;++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;d<=v;++d)o[Ds[d]>>>l]=u}else for(o=new ks(r),s=0;s<r;++s)o[s]=Ds[a[t[s]-1]++]>>>15-t[s];return o},Us=new Ss(288);for(js=0;js<144;++js)Us[js]=8;for(js=144;js<256;++js)Us[js]=9;for(js=256;js<280;++js)Us[js]=7;for(js=280;js<288;++js)Us[js]=8;var zs=new Ss(32);for(js=0;js<32;++js)zs[js]=5;var Hs=Ns(Us,9,0),Bs=Ns(zs,5,0),qs=function(t){return(t/8>>0)+(7&t&&1)},Ws=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof ks?ks:t instanceof Ps?Ps:Ss)(e-i);return r.set(t.subarray(i,e)),r},Gs=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8},Vs=function(t,i,e){e<<=7&i;var r=i/8>>0;t[r]|=e,t[r+1]|=e>>>8,t[r+2]|=e>>>16},Js=function(t,i){for(var e=[],r=0;r<t.length;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Ss(0),0];if(1==s){var o=new Ss(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[u].f<e[d].f?u++:d++],l=e[u!=h&&e[u].f<e[d].f?u++:d++],e[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;r<s;++r)n[r].s>v&&(v=n[r].s);var c=new ks(v+1),f=Ks(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}));r<s;++r){var m=n[r].s;if(!(c[m]>i))break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var y=n[r].s;c[y]<i?p-=1<<i-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==i&&(--c[b],++p)}f=i}return[new Ss(c),f]},Ks=function(t,i,e){return-1==t.s?Math.max(Ks(t.l,i,e+1),Ks(t.r,i,e+1)):i[t.s]=e},Ys=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new ks(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;a<=i;++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]},Xs=function(t,i){for(var e=0,r=0;r<i.length;++r)e+=t[r]*i[r];return e},Qs=function(t,i,e){var r=e.length,s=qs(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;n<r;++n)t[s+n+4]=e[n];return 8*(s+4+r)},Zs=function(t,i,e,r,s,n,o,a,l,u,h){Gs(i,h++,e),++s[256];for(var d=Js(s,15),v=d[0],c=d[1],f=Js(n,15),p=f[0],g=f[1],_=Ys(v),m=_[0],y=_[1],b=Ys(p),w=b[0],x=b[1],E=new ks(19),S=0;S<m.length;++S)E[31&m[S]]++;for(S=0;S<w.length;++S)E[31&w[S]]++;for(var k=Js(E,7),P=k[0],T=k[1],I=19;I>4&&!P[Cs[I-1]];--I);var C,R,F,M,O=u+5<<3,A=Xs(s,Us)+Xs(n,zs)+o,D=Xs(s,v)+Xs(n,p)+o+14+3*I+Xs(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(O<=A&&O<=D)return Qs(i,h,t.subarray(l,l+u));if(Gs(i,h,1+(D<A)),h+=2,D<A){C=Ns(v,c,0),R=v,F=Ns(p,g,0),M=p;var j=Ns(P,T,0);Gs(i,h,y-257),Gs(i,h+5,x-1),Gs(i,h+10,I-4),h+=14;for(S=0;S<I;++S)Gs(i,h+3*S,P[Cs[S]]);h+=3*I;for(var L=[m,w],N=0;N<2;++N){var U=L[N];for(S=0;S<U.length;++S){var z=31&U[S];Gs(i,h,j[z]),h+=P[z],z>15&&(Gs(i,h,U[S]>>>5&127),h+=U[S]>>>12)}}}else C=Hs,R=Us,F=Bs,M=zs;for(S=0;S<a;++S)if(r[S]>255){z=r[S]>>>18&31;Vs(i,h,C[z+257]),h+=R[z+257],z>7&&(Gs(i,h,r[S]>>>23&31),h+=Ts[z]);var H=31&r[S];Vs(i,h,F[H]),h+=M[H],H>3&&(Vs(i,h,r[S]>>>5&8191),h+=Is[H])}else Vs(i,h,C[r[S]]),h+=R[r[S]];return Vs(i,h,C[256]),h+R[256]},tn=new Ps([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),en=function(){for(var t=new Ps(256),i=0;i<256;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),rn=function(t,i,e,r,s){return function(t,i,e,r,s,n){var o=t.length,a=new Ss(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!i||o<8)for(var h=0;h<=o;h+=65535){var d=h+65535;d<o?u=Qs(l,u,t.subarray(h,d)):(l[h]=n,u=Qs(l,u,t.subarray(h,o)))}else{for(var v=tn[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new ks(32768),_=new ks(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new Ps(25e3),x=new ks(288),E=new ks(32),S=0,k=0,P=(h=0,0),T=0,I=0;h<o;++h){var C=b(h),R=32767&h,F=_[C];if(g[R]=F,_[C]=R,T<=h){var M=o-h;if((S>7e3||P>24576)&&M>423){u=Zs(t,l,0,w,x,E,k,P,I,h-I,u),P=S=k=0,I=h;for(var O=0;O<286;++O)x[O]=0;for(O=0;O<30;++O)E[O]=0}var A=2,D=0,j=f,L=R-F&32767;if(M>2&&C==b(h-L))for(var N=Math.min(c,M)-1,U=Math.min(32767,h),z=Math.min(258,M);L<=U&&--j&&R!=F;){if(t[h+A]==t[h+A-L]){for(var H=0;H<z&&t[h+H]==t[h+H-L];++H);if(H>A){if(A=H,D=L,H>N)break;var B=Math.min(L,H-2),q=0;for(O=0;O<B;++O){var W=h-L+O+32768&32767,G=W-g[W]+32768&32767;G>q&&(q=G,F=W)}}}L+=(R=F)-(F=g[R])+32768&32767}if(D){w[P++]=268435456|Os[A]<<18|As[D];var V=31&Os[A],J=31&As[D];k+=Ts[V]+Is[J],++x[257+V],++E[J],T=h+A,++S}else w[P++]=t[h],++x[t[h]]}}u=Zs(t,l,n,w,x,E,k,P,I,h-I,u)}return Ws(a,0,r+qs(u)+s)}(t,null==i.level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+i.mem,e,r,!0)},sn=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function nn(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p:function(i){for(var e=t,r=0;r<i.length;++r)e=en[255&e^i[r]]^e>>>8;t=e},d:function(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n=rn(t,i,10+((s=i).filename&&s.filename.length+1||0),8),o=n.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=i.level<2?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&sn(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;r<=e.length;++r)t[r+10]=e.charCodeAt(r)}}(n,i),sn(n,o-8,e.d()),sn(n,o-4,r),n}var on=function(t){var i,e,r,s,n="";for(i=e=0,r=(t=(t+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var o=t.charCodeAt(s),a=null;o<128?e++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),D(a)||(e>i&&(n+=t.substring(i,e)),n+=a,i=e=s+1)}return e>i&&(n+=t.substring(i,t.length)),n},an=!!u||!!l,ln="text/plain",un=function(t,i,e){var r;void 0===e&&(e=!0);var[s,n]=t.split("?"),o=g({},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=nr(o);return l&&a.push(l),s+"?"+a.join("&")},hn=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),dn=t=>{var{data:i,compression:e}=t;if(i){if(e===er.GZipJS){var r=nn(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Ss(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;o<e;++o){if(s+5>r.length){var a=new Ss(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||i?n(l):l<2048?(n(192|l>>>6),n(128|63&l)):l>55295&&l<57344?(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 Ws(r,0,s)}(hn(i)),{mtime:0}),s=new Blob([r],{type:ln});return{contentType:ln,body:s,estimatedSize:s.size}}if(e===er.Base64){var n=function(t){var i,e,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,u="",h=[];if(!t)return t;t=on(t);do{i=(n=t.charCodeAt(a++)<<16|t.charCodeAt(a++)<<8|t.charCodeAt(a++))>>18&63,e=n>>12&63,r=n>>6&63,s=63&n,h[l++]=o.charAt(i)+o.charAt(e)+o.charAt(r)+o.charAt(s)}while(a<t.length);switch(u=h.join(""),t.length%3){case 1:u=u.slice(0,-2)+"==";break;case 2:u=u.slice(0,-1)+"="}return u}(hn(i)),o=(t=>"data="+encodeURIComponent("string"==typeof t?t:hn(t)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=hn(i);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},vn=[];l&&vn.push({transport:"fetch",method:t=>{var i,e,{contentType:r,body:s,estimatedSize:n}=null!==(i=dn(t))&&void 0!==i?i:{},o=new Headers;Ii(t.headers,(function(t,i){o.append(i,t)})),r&&o.append("Content-Type",r);var a=t.url,u=null;if(h){var d=new h;u={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}l(a,g({method:(null==t?void 0:t.method)||"GET",headers:o,keepalive:"POST"===t.method&&(n||0)<52428.8,body:s,signal:null==(e=u)?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){Ei.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{Ei.error(i),null==t.callback||t.callback({statusCode:0,text:i})})).finally((()=>u?clearTimeout(u.timeout):null))}}),u&&vn.push({transport:"XHR",method:t=>{var i,e=new u;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=dn(t))&&void 0!==i?i:{};Ii(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!=n&&n.sendBeacon&&vn.push({transport:"sendBeacon",method:t=>{var i=un(t.url,{beacon:"1"});try{var e,{contentType:r,body:s}=null!==(e=dn(t))&&void 0!==e?e:{},o="string"==typeof s?new Blob([s],{type:r}):s;n.sendBeacon(i,o)}catch(t){}}});var cn=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 fn(t,i,e){return hn({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var pn={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=>cn(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!cn(i,t))))),icontains:(t,i)=>i.map(gn).some((i=>t.map(gn).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(gn).every((i=>t.map(gn).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)))}))},gn=t=>t.toLowerCase();function _n(t,i){return!t||Object.entries(t).every((t=>{var[e,r]=t,s=null==i?void 0:i[e];if(M(s)||D(s))return!1;var n=[String(s)],o=pn[r.operator];return!!o&&o(r.values,n)}))}var mn=$i("[Error tracking]");class yn{constructor(t){var i,e;this.Zt=[],this.ti=new Xt([new di,new wi,new ci,new vi,new yi,new mi,new pi,new bi],hi("web:javascript",si,ai)),this._instance=t,this.Zt=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Vi))&&void 0!==i?i:[]}onRemoteConfig(t){var i,e,r,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.Zt=s,this._instance.persistence&&this._instance.persistence.register({[Vi]:this.Zt,[Ji]:n})}get ii(){var t,i=!!this._instance.get_property(Ji),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.ti.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.ei(i)){if(this.ri(i))return void mn.info("Skipping exception capture because a suppression rule matched");if(!this.ii&&this.si(i))return void mn.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ni(i))return void mn.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}ri(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.Zt.some((t=>{var e=t.values.map((t=>{var e,r=pn[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)}))}si(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://")))}ni(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}ei(t){return!j(t)&&I(t)}}var bn=$i("[FeatureFlags]"),wn=$i("[FeatureFlags]",{debugEnabled:!0}),xn="$active_feature_flags",En="$override_feature_flags",$n="$feature_flag_payloads",Sn="$override_feature_flag_payloads",kn="$feature_flag_request_id",Pn="$feature_flag_evaluated_at",Tn=t=>{var i={};for(var[e,r]of Fi(t||{}))r&&(i[e]=r);return i},In=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]})))):bn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},Cn=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class Rn{constructor(t){this.oi=!1,this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this._instance=t,this.featureFlagEventHandlers=[]}ci(){var t=this._instance.config.evaluation_environments;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||bn.error("Invalid evaluation environment found:",t,"Expected non-empty string"),i})):[]}fi(){return this.ci().length>0}flags(){if(this._instance.config.__preview_remote_config)this.di=!0;else{var t=!this.pi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.gi({disableFlags:t})}}get hasLoadedFlags(){return this.ai}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this._instance.get_property(se),i=this._instance.get_property(En),e=this._instance.get_property(Sn);if(!e&&!i)return t||{};var r=Ci({},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=M(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=M(u)?l.variant:"string"==typeof u?u:void 0,v=null==e?void 0:e[n],c=g({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});if(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=g({},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.oi||(bn.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.oi=!0),r}getFlagVariants(){var t=this._instance.get_property(ee),i=this._instance.get_property(En);if(!i)return t||{};for(var e=Ci({},t),r=Object.keys(i),s=0;s<r.length;s++)e[r[s]]=i[r[s]];return this.oi||(bn.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.oi=!0),e}getFlagPayloads(){var t=this._instance.get_property($n),i=this._instance.get_property(Sn);if(!i)return t||{};for(var e=Ci({},t||{}),r=Object.keys(i),s=0;s<r.length;s++)e[r[s]]=i[r[s]];return this.oi||(bn.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.oi=!0),e}reloadFeatureFlags(){this.ui||this._instance.config.advanced_disable_feature_flags||this.pi||(this.pi=setTimeout((()=>{this.gi()}),5))}mi(){clearTimeout(this.pi),this.pi=void 0}ensureFlagsLoaded(){this.ai||this.li||this.pi||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.ui=t}gi(t){var i;if(this.mi(),!this._instance.O())if(this.li)this.hi=!0;else{var e=this._instance.config.token,r=this._instance.get_property("$device_id"),s={token:e,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:g({},(null==(i=this._instance.persistence)?void 0:i.get_initial_props())||{},this._instance.get_property(ne)||{}),group_properties:this._instance.get_property(oe)};D(r)||M(r)||(s.$device_id=r),(null!=t&&t.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.fi()&&(s.evaluation_environments=this.ci());var n=this._instance.config.__preview_remote_config,o=n?"/flags/?v=2":"/flags/?v=2&config=true",a=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",l=this._instance.requestRouter.endpointFor("flags",o+a);n&&(s.timezone=ps()),this.li=!0,this._instance._send_request({method:"POST",url:l,data:s,compression:this._instance.config.disable_compression?void 0:er.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:t=>{var i,e,r=!0;(200===t.statusCode&&(this.hi||(this.$anon_distinct_id=void 0),r=!1),this.li=!1,this.di)||(this.di=!0,this._instance.yi(null!==(e=t.json)&&void 0!==e?e:{}));if(!s.disable_flags||this.hi)if(this.vi=!r,t.json&&null!=(i=t.json.quotaLimited)&&i.includes(Cn.FeatureFlags))bn.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var n;if(!s.disable_flags)this.receivedFeatureFlags(null!==(n=t.json)&&void 0!==n?n:{},r);this.hi&&(this.hi=!1,this.gi())}}})}}getFeatureFlag(t,i){if(void 0===i&&(i={}),this.ai||this.getFlags()&&this.getFlags().length>0){var e=this.getFlagVariants()[t],r=""+e,s=this._instance.get_property(kn)||void 0,n=this._instance.get_property(Pn)||void 0,o=this._instance.get_property(le)||{};if((i.send_event||!("send_event"in i))&&(!(t in o)||!o[t].includes(r))){var a,l,u,h,d,v,c,f,p;I(o[t])?o[t].push(r):o[t]=[r],null==(a=this._instance.persistence)||a.register({[le]:o});var g=this.getFeatureFlagDetails(t),_={$feature_flag:t,$feature_flag_response:e,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:s,$feature_flag_evaluated_at:n,$feature_flag_bootstrapped_response:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlags)?void 0:l[t])||null,$feature_flag_bootstrapped_payload:(null==(u=this._instance.config.bootstrap)||null==(u=u.featureFlagPayloads)?void 0:u[t])||null,$used_bootstrap_value:!this.vi};M(null==g||null==(h=g.metadata)?void 0:h.version)||(_.$feature_flag_version=g.metadata.version);var m,y=null!==(d=null==g||null==(v=g.reason)?void 0:v.description)&&void 0!==d?d:null==g||null==(c=g.reason)?void 0:c.code;if(y&&(_.$feature_flag_reason=y),null!=g&&null!=(f=g.metadata)&&f.id&&(_.$feature_flag_id=g.metadata.id),M(null==g?void 0:g.original_variant)&&M(null==g?void 0:g.original_enabled)||(_.$feature_flag_original_response=M(g.original_variant)?g.original_enabled:g.original_variant),null!=g&&null!=(p=g.metadata)&&p.original_payload)_.$feature_flag_original_payload=null==g||null==(m=g.metadata)?void 0:m.original_payload;this._instance.capture("$feature_flag_called",_)}return e}bn.warn('getFeatureFlag for key "'+t+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,i){var e=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:e};this.fi()&&(r.evaluation_environments=this.ci()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2&config=true"),data:r,compression:this._instance.config.disable_compression?void 0:er.Base64,timeout:this._instance.config.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={}),this.ai||this.getFlags()&&this.getFlags().length>0){var e=this.getFeatureFlag(t,i);return M(e)?void 0:!!e}bn.warn('isFeatureEnabled for key "'+t+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i){if(this._instance.persistence){this.ai=!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=In(t),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var u=t.requestId,h=t.evaluatedAt;if(I(a)){bn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var d={};if(a)for(var v=0;v<a.length;v++)d[a[v]]=!0;i&&i.register({[xn]:a,[ee]:d})}else{var c=a,f=l,p=o;t.errorsWhileComputingFlags&&(c=g({},e,c),f=g({},r,f),p=g({},s,p)),i&&i.register(g({[xn]:Object.keys(Tn(c)),[ee]:c||{},[$n]:f||{},[se]:p||{}},u?{[kn]:u}:{},h?{[Pn]:h}:{}))}}}(t,this._instance.persistence,e,r,s),this.bi(i)}}override(t,i){void 0===i&&(i=!1),bn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this._instance.persistence)return bn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this._instance.persistence.unregister(En),this._instance.persistence.unregister(Sn),this.bi(),wn.info("All overrides cleared");if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;if(this.oi=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i),"flags"in e)if(!1===e.flags)this._instance.persistence.unregister(En),wn.info("Flag overrides cleared");else if(e.flags){if(I(e.flags)){for(var r={},s=0;s<e.flags.length;s++)r[e.flags[s]]=!0;this._instance.persistence.register({[En]:r})}else this._instance.persistence.register({[En]:e.flags});wn.info("Flag overrides set",{flags:e.flags})}return"payloads"in e&&(!1===e.payloads?(this._instance.persistence.unregister(Sn),wn.info("Payload overrides cleared")):e.payloads&&(this._instance.persistence.register({[Sn]:e.payloads}),wn.info("Payload overrides set",{payloads:e.payloads}))),void this.bi()}this.bi()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ai){var{flags:i,flagVariants:e}=this.wi();t(i,e)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,s=(this._instance.get_property(re)||[]).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=g({},this.getFlagVariants(),{[t]:i});null==(r=this._instance.persistence)||r.register({[xn]:Object.keys(Tn(a)),[ee]:a}),this.bi()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this._instance.get_property(re),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._instance.config.token+s),method:"GET",callback:i=>{var e,r;if(i.json){var s=i.json.earlyAccessFeatures;return null==(e=this._instance.persistence)||e.unregister(re),null==(r=this._instance.persistence)||r.register({[re]:s}),t(s)}}})}wi(){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)),{})}}bi(t){var{flags:i,flagVariants:e}=this.wi();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(ne)||{};this._instance.register({[ne]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ne)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this._instance.get_property(oe)||{};0!==Object.keys(e).length&&Object.keys(e).forEach((i=>{e[i]=g({},e[i],t[i]),delete t[i]})),this._instance.register({[oe]:g({},e,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this._instance.get_property(oe)||{};this._instance.register({[oe]:g({},i,{[t]:{}})})}else this._instance.unregister(oe)}reset(){this.ai=!1,this.li=!1,this.ui=!1,this.hi=!1,this.di=!1,this.vi=!1,this.$anon_distinct_id=void 0,this.mi(),this.oi=!1}}var Fn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Mn{constructor(t,i){this.R=t,this.props={},this.xi=!1,this.Ei=(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.Y=this.$i(t),this.load(),t.debug&&Ei.info("Persistence loaded",t.persistence,g({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.Si}$i(t){-1===Fn.indexOf(t.persistence.toLowerCase())&&(Ei.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i=t.persistence.toLowerCase();return"localstorage"===i&&Tr.H()?Tr:"localstorage+cookie"===i&&Cr.H()?Cr:"sessionstorage"===i&&Or.H()?Or:"memory"===i?Fr:"cookie"===i?kr:Cr.H()?Cr:kr}properties(){var t={};return Ii(this.props,(function(i,e){if(e===ee&&R(i))for(var r=Object.keys(i),n=0;n<r.length;n++)t["$feature/"+r[n]]=i[r[n]];else a=e,l=!1,(D(o=me)?l:s&&o.indexOf===s?-1!=o.indexOf(a):(Ii(o,(function(t){if(l||(l=t===a))return Pi})),l))||(t[e]=i);var o,a,l})),t}load(){if(!this.Si){var t=this.Y.W(this.Ei);t&&(this.props=Ci({},t))}}save(){this.Si||this.Y.G(this.Ei,this.props,this.ki,this.Pi,this.Ti,this.R.debug)}remove(){this.Y.V(this.Ei,!1),this.Y.V(this.Ei,!0)}clear(){this.remove(),this.props={}}register_once(t,i,e){if(R(t)){M(i)&&(i="None"),this.ki=M(e)?this.Ii:e;var r=!1;if(Ii(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.ki=M(i)?this.Ii:i;var e=!1;if(Ii(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.xi){var t=ls(this.R.custom_campaign_params,this.R.mask_personal_data_properties,this.R.custom_personal_data_properties);F(Ai(t))||this.register(t),this.xi=!0}}update_search_keyword(){var t;this.register((t=null==o?void 0:o.referrer)?hs(t):{})}update_referrer_info(){var t;this.register_once({$referrer:vs(),$referring_domain:null!=o&&o.referrer&&(null==(t=sr(o.referrer))?void 0:t.host)||"$direct"},void 0)}set_initial_person_info(){this.props[ve]||this.props[ce]||this.register_once({[fe]:cs(this.R.mask_personal_data_properties,this.R.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Ii([ce,ve],(i=>{var e=this.props[i];e&&Ii(e,(function(i,e){t["$initial_"+E(e)]=i}))}));var i,e,r=this.props[fe];if(r){var s=(i=fs(r),e={},Ii(i,(function(t,i){e["$initial_"+E(i)]=t})),e);Ci(t,s)}return t}safe_merge(t){return Ii(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this.Ii=this.ki=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){var r=this.$i(t),s=this.props;this.clear(),this.Y=r,this.props=s,this.save()}}set_disabled(t){this.Si=t,this.Si?this.remove():this.save()}set_cross_subdomain(t){t!==this.Pi&&(this.Pi=t,this.remove(),this.save())}set_secure(t){t!==this.Ti&&(this.Ti=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[Bi]||{};e[t]=i,this.props[Bi]=e,this.save()}remove_event_timer(t){var i=(this.props[Bi]||{})[t];return M(i)||(delete this.props[Bi][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}var On=$i("[Product Tours]"),An="ph_product_tours";class Dn{constructor(t){this.Ci=null,this.Ri=null,this._instance=t}onRemoteConfig(t){this._instance.persistence&&this._instance.persistence.register({[Xi]:!(null==t||!t.productTours)}),this.loadIfEnabled()}loadIfEnabled(){var t,i;this.Ci||((t=this._instance).config.disable_product_tours||null==(i=t.persistence)||!i.get_property(Xi))||this.it((()=>this.Fi()))}it(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?On.error("Could not load product tours script",i):t()}))}Fi(){var t;!this.Ci&&null!=(t=v.__PosthogExtensions__)&&t.generateProductTours&&(this.Ci=v.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!I(this.Ri)||i){var e=this._instance.persistence;if(e){var r=e.props[An];if(I(r)&&!i)return this.Ri=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 On.error(s),void t([],{isLoaded:!1,error:s})}var n=I(i.json.product_tours)?i.json.product_tours:[];this.Ri=n,e&&e.register({[An]:n}),t(n,{isLoaded:!0})}})}else t(this.Ri,{isLoaded:!0})}getActiveProductTours(t){j(this.Ci)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ci.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.Ci)||i.showTourById(t)}previewTour(t){this.Ci?this.Ci.previewTour(t):this.it((()=>{var i;this.Fi(),null==(i=this.Ci)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Ci)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Ci)||t.nextStep()}previousStep(){var t;null==(t=this.Ci)||t.previousStep()}clearCache(){var t;this.Ri=null,null==(t=this._instance.persistence)||t.unregister(An)}resetTour(t){var i;null==(i=this.Ci)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.Ci)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.Ci)||i.cancelPendingTour(t)}}var jn=function(t){return t.Activation="events",t.Cancellation="cancelEvents",t}({}),Ln=function(t){return t.Button="button",t.Tab="tab",t.Selector="selector",t}({}),Nn=function(t){return t.TopLeft="top_left",t.TopRight="top_right",t.TopCenter="top_center",t.MiddleLeft="middle_left",t.MiddleRight="middle_right",t.MiddleCenter="middle_center",t.Left="left",t.Center="center",t.Right="right",t.NextToTrigger="next_to_trigger",t}({}),Un=function(t){return t.Top="top",t.Left="left",t.Right="right",t.Bottom="bottom",t}({}),zn=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({}),Hn=function(t){return t.Open="open",t.MultipleChoice="multiple_choice",t.SingleChoice="single_choice",t.Rating="rating",t.Link="link",t}({}),Bn=function(t){return t.NextQuestion="next_question",t.End="end",t.ResponseBased="response_based",t.SpecificQuestion="specific_question",t}({}),qn=function(t){return t.Once="once",t.Recurring="recurring",t.Always="always",t}({}),Wn=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t.ABANDONED="survey abandoned",t}({}),Gn=function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t.PRODUCT_TOUR_ID="$product_tour_id",t}({}),Vn=function(t){return t.Popover="popover",t.Inline="inline",t}({}),Jn=$i("[Surveys]");var Kn="seenSurvey_",Yn=(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},Xn=t=>((t,i)=>{var e=""+t+i.id;return i.current_iteration&&i.current_iteration>0&&(e=""+t+i.id+"_"+i.current_iteration),e})(Kn,t),Qn=[zn.Popover,zn.Widget,zn.API],Zn={ignoreConditions:!1,ignoreDelay:!1,displayType:Vn.Popover};class to{constructor(){this.Mi={},this.Mi={}}on(t,i){return this.Mi[t]||(this.Mi[t]=[]),this.Mi[t].push(i),()=>{this.Mi[t]=this.Mi[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Mi[t]||[])e(i);for(var r of this.Mi["*"]||[])r(t,i)}}function io(t,i,e){if(j(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 eo{constructor(t){this.Oi=new to,this.Ai=(t,i)=>this.Di(t,i)&&this.ji(t,i)&&this.Li(t,i)&&this.Ni(t,i),this.Di=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.Ui=new Set,this.zi=new Set}init(){var t;if(!M(null==(t=this._instance)?void 0:t.Hi)){var i;null==(i=this._instance)||i.Hi(((t,i)=>{this.on(t,i)}))}}register(t){var i,e;if(!M(null==(i=this._instance)?void 0:i.Hi)&&(t.forEach((t=>{var i,e;null==(i=this.zi)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.Ui)||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.Ui.has(t)||this.Ui.has(null==i?void 0:i.event))&&this.zi&&(null==(e=this.zi)?void 0:e.size)>0&&this.zi.forEach((t=>{this.Bi(i,t)&&this.Oi.emit("actionCaptured",t.name)}))}qi(t){this.onAction("actionCaptured",(i=>t(i)))}Bi(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Ai(t,e))return!0;return!1}onAction(t,i){return this.Oi.on(t,i)}ji(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(!io(r,i.url,i.url_matching||"contains"))return!1}return!0}Li(t,i){return!!this.Wi(t,i)&&(!!this.Gi(t,i)&&!!this.Vi(t,i))}Wi(t,i){var e;if(null==i||!i.href)return!0;var r=this.Ji(t);if(r.length>0)return r.some((t=>io(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&io((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}Gi(t,i){var e;if(null==i||!i.text)return!0;var r=this.Ji(t);if(r.length>0)return r.some((t=>io(t.text,i.text,i.text_matching||"exact")||io(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;!j(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=>io(t,n,o))))}Vi(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}Ji(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Ni(t,i){return null==i||!i.properties||0===i.properties.length||_n(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 ro{constructor(t){this._instance=t,this.Ki=new Map,this.Yi=new Map,this.Xi=new Map}Qi(t,i){return!!t&&_n(t.propertyFilters,null==i?void 0:i.properties)}Zi(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}te(t,i,e){var r=(e===jn.Activation?this.Ki:this.Yi).get(t),s=[];return this.ie((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.Qi(n,i)}))}register(t){var i;M(null==(i=this._instance)?void 0:i.Hi)||(this.ee(t),this.re(t))}re(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}));if(0!==i.length){if(null==this.se){this.se=new eo(this._instance),this.se.init();this.se.qi((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.se)||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.Xi.get(i.name);e&&e.push(t.id),this.Xi.set(i.name,e||[t.id])}})))}))}}ee(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}));if(0!==e.length||0!==r.length){null==(i=this._instance)||i.Hi(((t,i)=>{this.onEvent(t,i)})),this.Ki=this.Zi(t,jn.Activation),this.Yi=this.Zi(t,jn.Cancellation)}}onEvent(t,i){var e,r=this.ne(),s=this.oe(),n=this.ae(),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);h>=0&&(o.splice(h,1),this.le(o))}}else{if(this.Yi.has(t)){var d=this.te(t,i,jn.Cancellation);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);i>=0&&o.splice(i,1),this.ue(t.id)})),this.le(o))}if(this.Ki.has(t)){r.info("event name matched",{event:t,eventPayload:i,items:this.Ki.get(t)});var v=this.te(t,i,jn.Activation);this.le(o.concat(v.map((t=>t.id))||[]))}}}onAction(t){var i,e=this.oe(),r=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[e])||[];this.Xi.has(t)&&this.le(r.concat(this.Xi.get(t)||[]))}le(t){var i,e=this.ne(),r=this.oe(),s=[...new Set(t)].filter((t=>!this.he(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.oe(),e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e||[]}getEventToItemsMap(){return this.Ki}de(){return this.se}}class so extends ro{constructor(t){super(t)}oe(){return"$surveys_activated"}ae(){return Wn.SHOWN}ie(t){var i;null==(i=this._instance)||i.getSurveys(t)}ue(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}ne(){return Jn}he(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class no{constructor(t){this.ve=void 0,this._surveyManager=null,this.ce=!1,this.fe=[],this.pe=null,this._instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){if(!this._instance.config.disable_surveys){var i=t.surveys;if(j(i))return Jn.warn("Flags not loaded yet. Not loading surveys.");var e=I(i);this.ve=e?i.length>0:i,Jn.info("flags response received, isSurveysEnabled: "+this.ve),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var e=localStorage.key(i);(null!=e&&e.startsWith(Kn)||null!=e&&e.startsWith("inProgressSurvey_"))&&t.push(e)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.ce)Jn.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Jn.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Jn.info("Not loading surveys in cookieless mode without consent.");else{var t=null==v?void 0:v.__PosthogExtensions__;if(t){if(!M(this.ve)||this._instance.config.advanced_enable_surveys){var i=this.ve||this._instance.config.advanced_enable_surveys;this.ce=!0;try{var e=t.generateSurveys;if(e)return void this.ge(e,i);var r=t.loadExternalDependency;if(!r)return void this._e("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this._e("Could not load surveys script",e):this.ge(t.generateSurveys,i)}))}catch(t){throw this._e("Error initializing surveys",t),t}finally{this.ce=!1}}}else Jn.error("PostHog Extensions not found.")}}ge(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new so(this._instance),Jn.info("Surveys loaded successfully"),this.me({isLoaded:!0})}_e(t,i){Jn.error(t,i),this.me({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.fe.push(t),this._surveyManager&&this.me({isLoaded:!0}),()=>{this.fe=this.fe.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this._instance.config.disable_surveys)return Jn.info("Disabled. Not loading surveys."),t([]);var e,r=this._instance.get_property(ae);if(r&&!i)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.pe?this.pe.then((i=>{var{surveys:e,context:r}=i;return t(e,r)})):("undefined"!=typeof Promise&&(this.pe=new Promise((t=>{e=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:i=>{var r;this.pe=null;var s=i.statusCode;if(200!==s||!i.json){var n="Surveys API could not be loaded, status: "+s;Jn.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({[ae]:l});var h={isLoaded:!0};t(l,h),null==e||e({surveys:l,context:h})}}))}me(t){for(var i of this.fe)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Jn.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!j(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Jn.warn("init was not called")}ye(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}be(t){if(j(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var i="string"==typeof t?this.ye(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(j(this._surveyManager))return Jn.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var i=this.be(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return j(this._surveyManager)?(Jn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):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.be(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i){var e;if(j(this._surveyManager))Jn.warn("init was not called");else{var r="string"==typeof t?this.ye(t):t;if(null!=r&&r.id)if(Qn.includes(r.type)){var s=null==o?void 0:o.querySelector(i);if(s)return null!=(e=r.appearance)&&e.surveyPopupDelaySeconds?(Jn.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,i;Jn.info("Rendering survey "+r.id+" with delay of "+(null==(t=r.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(r,s),Jn.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,s);Jn.warn("Survey element not found")}else Jn.warn("Surveys of type "+r.type+" cannot be rendered in the app");else Jn.warn("Survey not found")}}displaySurvey(t,i){var e;if(j(this._surveyManager))Jn.warn("init was not called");else{var r=this.ye(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),!1===i.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void Jn.warn("Survey is not eligible to be displayed: ",n.disabledReason)}i.displayType!==Vn.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,i.selector)}else Jn.warn("Survey not found")}}cancelPendingSurvey(t){j(this._surveyManager)?Jn.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}var oo=$i("[Conversations]");class ao{constructor(t){this.we=void 0,this._conversationsManager=null,this.xe=!1,this.Ee=null,this._instance=t}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var i=t.conversations;j(i)||(N(i)?this.we=i:(this.we=i.enabled,this.Ee=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.we=void 0,this.Ee=null}loadIfEnabled(){if(!this._conversationsManager&&!this.xe&&!(this._instance.config.disable_conversations||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=null==v?void 0:v.__PosthogExtensions__;if(i&&!M(this.we)&&this.we)if(this.Ee&&this.Ee.token){if(function(i){var e;if(!i||0===i.length)return!0;var r=null==t||null==(e=t.location)?void 0:e.hostname;return!r||i.some((t=>{var i=function(t){var i=t.replace(/^https?:\/\//,"");return(i=i.split("/")[0].split("?")[0].split(":")[0])||null}(t);if(!i)return!1;if(i.startsWith("*.")){var e=i.slice(2);return r.endsWith("."+e)||r===e}return r===i}))}(this.Ee.domains)){this.xe=!0;try{var e=i.initConversations;if(e)return this.$e(e),void(this.xe=!1);var r=i.loadExternalDependency;if(!r)return void this.Se("PostHog loadExternalDependency extension not found.");r(this._instance,"conversations",(t=>{t||!i.initConversations?this.Se("Could not load conversations script",t):this.$e(i.initConversations),this.xe=!1}))}catch(t){this.Se("Error initializing conversations",t),this.xe=!1}}}else oo.error("Conversations enabled but missing token in remote config.")}}$e(t){if(this.Ee)try{this._conversationsManager=t(this.Ee,this._instance),oo.info("Conversations loaded successfully")}catch(t){this.Se("Error completing conversations initialization",t)}else oo.error("Cannot complete initialization: remote config is null")}Se(t,i){oo.error(t,i),this._conversationsManager=null,this.xe=!1}enable(){this._conversationsManager?this._conversationsManager.enable():oo.warn("Conversations not loaded yet.")}disable(){this._conversationsManager&&this._conversationsManager.disable()}isLoaded(){return!D(this._conversationsManager)}isEnabled(){return!0===this.we}}var lo=$i("[RateLimiter]");class uo{constructor(t){var i,e;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{lo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void lo.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.captureEventsPerSecond=(null==(i=t.config.rate_limiting)?void 0:i.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(e=t.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=(new Date).getTime(),n=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(de))&&void 0!==i?i:{tokens:this.captureEventsBurstLimit,last:s};n.tokens+=(s-n.last)/1e3*this.captureEventsPerSecond,n.last=s,n.tokens>this.captureEventsBurstLimit&&(n.tokens=this.captureEventsBurstLimit);var o=n.tokens<1;return o||t||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,null==(r=this.instance.persistence)||r.set_property(de,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var ho=$i("[RemoteConfig]");class vo{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}ke(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):(ho.error("PostHog Extensions not found. Cannot load remote config."),t())}Pe(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 ho.info("Using preloaded remote config",this.remoteConfig),void this.yi(this.remoteConfig);if(this._instance.O())return void ho.warn("Remote config is disabled. Falling back to local config.");this.ke((t=>{if(!t)return ho.info("No config found after loading remote JS config. Falling back to JSON."),void this.Pe((t=>{this.yi(t)}));this.yi(t)}))}catch(t){ho.error("Error loading remote config",t)}}yi(t){t?this._instance.config.__preview_remote_config?(this._instance.yi(t),!1!==t.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):ho.info("__preview_remote_config is disabled. Logging config instead",t):ho.error("Failed to fetch remote config from PostHog.")}}var co=3e3;class fo{constructor(t,i){this.Te=!0,this.Ie=[],this.Ce=J((null==i?void 0:i.flush_interval_ms)||co,250,5e3,Ei.createLogger("flush interval"),co),this.Re=t}enqueue(t){this.Ie.push(t),this.Fe||this.Me()}unload(){this.Oe();var t=this.Ie.length>0?this.Ae():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Re(g({},t,{transport:"sendBeacon"}))}))}enable(){this.Te=!1,this.Me()}Me(){var t=this;this.Te||(this.Fe=setTimeout((()=>{if(this.Oe(),this.Ie.length>0){var i=this.Ae(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&I(e.data)&&Ii(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Re(e)};for(var r in i)e()}}),this.Ce))}Oe(){clearTimeout(this.Fe),this.Fe=void 0}Ae(){var t={};return Ii(this.Ie,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;M(t[s])&&(t[s]=g({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.Ie=[],t}}var po=["retriesPerformedSoFar"];class go{constructor(i){this.De=!1,this.je=3e3,this.Ie=[],this._instance=i,this.Ie=[],this.Le=!0,!M(t)&&"onLine"in t.navigator&&(this.Le=t.navigator.onLine,this.Ne=()=>{this.Le=!0,this.Lt()},this.Ue=()=>{this.Le=!1},Ui(t,"online",this.Ne),Ui(t,"offline",this.Ue))}get length(){return this.Ie.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,e=_(t,po);L(i)&&i>0&&(e.url=un(e.url,{retry_count:i})),this._instance._send_request(g({},e,{callback:t=>{200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&(null!=i?i:0)<10?this.ze(g({retriesPerformedSoFar:i},e)):null==e.callback||e.callback(t)}}))}ze(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)*(r-e);return Math.ceil(r+s)}(i),r=Date.now()+e;this.Ie.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Ei.warn(s),this.De||(this.De=!0,this.He())}He(){if(this.Be&&clearTimeout(this.Be),0===this.Ie.length)return this.De=!1,void(this.Be=void 0);this.Be=setTimeout((()=>{this.Le&&this.Ie.length>0&&this.Lt(),this.He()}),this.je)}Lt(){var t=Date.now(),i=[],e=this.Ie.filter((e=>e.retryAt<t||(i.push(e),!1)));if(this.Ie=i,e.length>0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:i}of(this.Be&&(clearTimeout(this.Be),this.Be=void 0),this.De=!1,M(t)||(this.Ne&&(t.removeEventListener("online",this.Ne),this.Ne=void 0),this.Ue&&(t.removeEventListener("offline",this.Ue),this.Ue=void 0)),this.Ie))try{this._instance._send_request(g({},i,{transport:"sendBeacon"}))}catch(t){Ei.error(t)}this.Ie=[]}}class _o{constructor(t){this.qe=()=>{var t,i,e,r;this.We||(this.We={});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.We.lastScrollY=Math.ceil(n),this.We.maxScrollY=Math.max(n,null!==(t=this.We.maxScrollY)&&void 0!==t?t:0),this.We.maxScrollHeight=Math.max(o,null!==(i=this.We.maxScrollHeight)&&void 0!==i?i:0),this.We.lastContentY=a,this.We.maxContentY=Math.max(a,null!==(e=this.We.maxContentY)&&void 0!==e?e:0),this.We.maxContentHeight=Math.max(l,null!==(r=this.We.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}getContext(){return this.We}resetContext(){var t=this.We;return setTimeout(this.qe,0),t}startMeasuringScrollPosition(){Ui(t,"scroll",this.qe,{capture:!0}),Ui(t,"scrollend",this.qe,{capture:!0}),Ui(t,"resize",this.qe)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==t?void 0:t.document.documentElement;var i=I(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var i=this.scrollElement();return i&&i.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var mo=t=>cs(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class yo{constructor(t,i,e,r){this.Ge=t=>{var i=this.Ve();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Je(this._instance)};this.Ke.register({[he]:e})}},this._instance=t,this.Ye=i,this.Ke=e,this.Je=r||mo,this.Ye.onSessionId(this.Ge)}Ve(){return this.Ke.props[he]}getSetOnceProps(){var t,i=null==(t=this.Ve())?void 0:t.props;return i?"r"in i?fs(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 Ii(Ai(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+E(e)]=i})),t}}var bo=$i("[SessionId]");class wo{on(t,i){return this.Xe.on(t,i)}constructor(t,i,e){var r;if(this.Qe=[],this.Ze=void 0,this.Xe=new to,this.tr=(t,i)=>Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.R=t.config,this.Ke=t.persistence,this.ir=void 0,this.er=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.rr=i||wr,this.sr=e||wr;var s=this.R.persistence_name||this.R.token,n=this.R.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*J(n,60,36e3,bo.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.nr(),this.ar="ph_"+s+"_window_id",this.lr="ph_"+s+"_primary_window_exists",this.ur()){var o=Or.W(this.ar),a=Or.W(this.lr);o&&!a?this.ir=o:Or.V(this.ar),Or.G(this.lr,!0)}if(null!=(r=this.R.bootstrap)&&r.sessionID)try{var l=(t=>{var i=t.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.R.bootstrap.sessionID);this.hr(this.R.bootstrap.sessionID,(new Date).getTime(),l)}catch(t){bo.error("Invalid sessionID in bootstrap",t)}this.dr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return M(this.Qe)&&(this.Qe=[]),this.Qe.push(t),this.er&&t(this.er,this.ir),()=>{this.Qe=this.Qe.filter((i=>i!==t))}}ur(){return"memory"!==this.R.persistence&&!this.Ke.Si&&Or.H()}vr(t){t!==this.ir&&(this.ir=t,this.ur()&&Or.G(this.ar,t))}cr(){return this.ir?this.ir:this.ur()?Or.W(this.ar):null}hr(t,i,e){t===this.er&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.er=t,this.Ke.register({[te]:[i,t,e]}))}pr(){var t=this.Ke.props[te];return I(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.hr(null,null,null)}destroy(){clearTimeout(this.gr),this.gr=void 0,this.Ze&&t&&(t.removeEventListener("beforeunload",this.Ze,{capture:!1}),this.Ze=void 0),this.Qe=[]}dr(){this.Ze=()=>{this.ur()&&Or.V(this.lr)},Ui(t,"beforeunload",this.Ze,{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),"always"===this.R.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.pr(),o=this.cr(),a=L(n)&&n>0&&Math.abs(e-n)>864e5,l=!1,u=!s,h=!u&&!t&&this.tr(e,r);u||h||a?(s=this.rr(),o=this.sr(),bo.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.sr(),l=!0);var d=0===r||!t||a?e:r,v=0===n?(new Date).getTime():n;return this.vr(o),this.hr(s,d,v),t||this.nr(),l&&this.Qe.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}}nr(){clearTimeout(this.gr),this.gr=setTimeout((()=>{var[t]=this.pr();if(this.tr((new Date).getTime(),t)){var i=this.er;this.resetSessionId(),this.Xe.emit("forcedIdleReset",{idleSessionId:i})}}),1.1*this.sessionTimeoutMs)}}var xo=["$set_once","$set"],Eo=$i("[SiteApps]");class $o{constructor(t){this._instance=t,this._r=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}mr(t,i){if(i){var e=this.globalsForEvent(i);this._r.push(e),this._r.length>1e3&&(this._r=this._r.slice(10))}}get siteAppLoaders(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}init(){if(this.isEnabled){var t=this._instance.Hi(this.mr.bind(this));this.yr=()=>{t(),this._r=[],this.yr=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:g({},_(t,xo),{properties:g({},t.properties,f?{$set:g({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:g({},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._r.length&&(Eo.info("Processing "+this._r.length+" events for site app with id "+t.id),this._r.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.yr)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,Eo.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){Eo.error("Error while initializing PostHog app with config id "+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){Eo.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}br(){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)}wr(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){Eo.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.br(),void this._instance.on("eventCaptured",(t=>this.wr(t)))):void Eo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.yr)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;v["__$$ph_site_app_"+t]=s._instance,null==(i=v.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return Eo.error("Error while initializing PostHog app with config id "+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else Eo.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var So=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},ko=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),Po="i.posthog.com";class To{constructor(t){this.Er={},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("."+Po,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.Er[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Er[this.apiHost]=ko.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Er[this.apiHost]=ko.EU:this.Er[this.apiHost]=ko.CUSTOM),this.Er[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===ko.CUSTOM)return this.apiHost+i;var e=Po+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var Io={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&&cn(e.href,i),not_regex:(i,e)=>!!t&&!cn(e.href,i),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class Co{constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{Co.$r("retrieved web experiments from the server"),i.Sr=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;if(i.Sr)Co.$r("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.Sr)||e.set(t.feature_flag_key,t);var r=i._instance.getFeatureFlag(t.feature_flag_key);O(r)&&t.variants[r]&&i.kr(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Co.Pr(n)&&i.kr(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}onFeatureFlags(t){if(this._is_bot())Co.$r("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(j(this.Sr))return this.Sr=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Co.$r("applying feature flags",t),t.forEach((t=>{var i;if(this.Sr&&null!=(i=this.Sr)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Sr)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.kr(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Co.getWindowLocation();if(null!=t&&t.search){var i=or(null==t?void 0:t.search,"__experiment_id"),e=or(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Co.$r("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Tr(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this._instance.config.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._instance.config.token),method:"GET",callback:i=>{if(200!==i.statusCode||!i.json)return t([]);var e=i.json.experiments||[];return t(e)}})}Tr(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(Co.$r("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.kr(r[0].name,i,r[0].variants[i].transforms))}static Pr(t){return!j(t.conditions)&&(Co.Ir(t)&&Co.Cr(t))}static Ir(t){var i;if(j(t.conditions)||j(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=Co.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||Io[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 Cr(t){var i;if(j(t.conditions)||j(null==(i=t.conditions)?void 0:i.utm))return!0;var e=ls();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 $r(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;r<i;r++)e[r-1]=arguments[r];Ei.info("[WebExperiments] "+t,e)}kr(t,i,e){this._is_bot()?Co.$r("Refusing to render web experiment since the viewer is a likely bot"):"control"!==i?e.forEach((e=>{if(e.selector){var r;Co.$r("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)}))}})):Co.$r("Control variants leave the page unmodified.")}_is_bot(){return n&&this._instance?So(n,this._instance.config.custom_blocked_useragents):void 0}}var Ro=$i("[PostHog ExternalIntegrations]"),Fo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Mo{constructor(t){this._instance=t}it(t,i){var e;null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return Ro.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;(!r||null!=(e=v.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.it(Fo[i],(()=>{var e;null==(e=v.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=v.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i])&&(null==(n=v.__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 Oo="[SessionRecording]",Ao=$i(Oo);class Do{get started(){var t;return!(null==(t=this.Rr)||!t.isStarted)}get status(){return this.Rr?this.Rr.status:this.Fr&&!this.Mr?"disabled":"lazy_loading"}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Fr=!1,this.Or=void 0,this._instance=t,!this._instance.sessionManager)throw Ao.error("started without valid sessionManager"),new Error(Oo+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(Oo+' cannot be used with cookieless_mode="always"')}get Mr(){var i,e=!(null==(i=this._instance.get_property(Zi))||!i.enabled),r=!this._instance.config.disable_session_recording,s=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!this.Mr||null==(i=this.Rr)||!i.isStarted){var e=!M(Object.assign)&&!M(Array.from);this.Mr&&e?(this.Ar(t),Ao.info("starting")):this.stopRecording()}}Ar(t){var i,e,r;this.Mr&&(null!=v&&null!=(i=v.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=v.__PosthogExtensions__)&&e.initSessionRecording?this.Dr(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.jr,(i=>{if(i)return Ao.error("could not load recorder",i);this.Dr(t)})))}stopRecording(){var t,i;null==(t=this.Or)||t.call(this),this.Or=void 0,null==(i=this.Rr)||i.stop()}Lr(){var t;null==(t=this._instance.persistence)||t.unregister(ie)}Nr(t){if(this._instance.persistence){var i,e,r=this._instance.persistence,s=()=>{var i=!1===t.sessionRecording?void 0:t.sessionRecording,e=null==i?void 0:i.sampleRate,s=j(e)?null:parseFloat(e);j(s)&&this.Lr();var n=null==i?void 0:i.minimumDurationMilliseconds;r.register({[Zi]:g({enabled:!!i},i,{networkPayloadCapture:g({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:s,minimumDurationMilliseconds:M(n)?null:n,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers})})};s(),null==(i=this.Or)||i.call(this),this.Or=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){"sessionRecording"in t?!1!==t.sessionRecording?(this.Nr(t),this.Fr=!0,this.startIfEnabledOrStop()):this.Fr=!0:Ao.info("skipping remote config with no sessionRecording",t)}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.Rr)&&e.log?this.Rr.log(t,i):Ao.warn("log called before recorder was ready")}get jr(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(Zi);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}Dr(t){var i,e;if(null==(i=v.__PosthogExtensions__)||!i.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.Rr||(this.Rr=null==(e=v.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.Rr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture);this.Rr.start(t)}onRRwebEmit(t){var i;null==(i=this.Rr)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.Rr||(null==(i=this._instance.persistence)||i.register({$replay_override_linked_flag:!0}));null==(t=this.Rr)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.Rr||(null==(i=this._instance.persistence)||i.register({$replay_override_sampling:!0}));null==(t=this.Rr)||t.overrideSampling()}overrideTrigger(t){var i,e;this.Rr||(null==(e=this._instance.persistence)||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}));null==(i=this.Rr)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.Rr)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.Rr)||!e.tryAddCustomEvent(t,i))}}var jo={},Lo=()=>{},No="posthog",Uo=!an&&-1===(null==d?void 0:d.indexOf("MSIE"))&&-1===(null==d?void 0:d.indexOf("Mozilla")),zo=i=>{var e;return g({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Li(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Lo,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:a&&O(null==a?void 0:a.search)&&-1!==a.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:!0,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_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;Ei.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:co},error_tracking:{},_onCapture:Lo,__preview_eager_load_replay:!1},(t=>({rageclick:!(t&&t>="2025-11-30")||{content_ignorelist:!0},capture_pageview:!(t&&t>="2025-05-24")||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{}}))(i))},Ho=t=>{var i={};M(t.process_person)||(i.person_profiles=t.process_person),M(t.xhr_headers)||(i.request_headers=t.xhr_headers),M(t.cookie_name)||(i.persistence_name=t.cookie_name),M(t.disable_cookie)||(i.disable_persistence=t.disable_cookie),M(t.store_google)||(i.save_campaign_params=t.store_google),M(t.verbose)||(i.debug=t.verbose);var e=Ci({},i,t);return I(t.property_blacklist)&&(M(t.property_denylist)?e.property_denylist=t.property_blacklist:I(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ei.error("Invalid value for property_denylist config: "+t.property_denylist)),e};class Bo{constructor(){this.__forceAllowLocalhost=!1}get Ur(){return this.__forceAllowLocalhost}set Ur(t){Ei.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class qo{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(){this.webPerformance=new Bo,this.zr=!1,this.version=c.LIB_VERSION,this.Hr=new to,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=zo(),this.SentryIntegration=Kr,this.sentryIntegration=t=>function(t,i){var e=Jr(t,i);return{name:Vr,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Br=!1,this.qr=null,this.Wr=null,this.Gr=null,this.featureFlags=new Rn(this),this.toolbar=new ts(this),this.scrollManager=new _o(this),this.pageViewManager=new $s(this),this.surveys=new no(this),this.conversations=new ao(this),this.experiments=new Co(this),this.exceptions=new yn(this),this.rateLimiter=new uo(this),this.requestRouter=new To(this),this.consent=new Dr(this),this.externalIntegrations=new Mo(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=>Ei.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==No){var r,s=null!==(r=jo[e])&&void 0!==r?r:new qo;return s._init(t,i,e),jo[e]=s,jo[No][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s;if(void 0===e&&(e={}),M(i)||A(i))return Ei.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.Vr(e.debug),this.Jr=e,this.Kr=[],e.person_profiles&&(this.Wr=e.person_profiles),this.set_config(Ci({},zo(e.defaults),Ho(e),{name:r,token:i})),this.config.on_xhr_error&&Ei.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:er.GZipJS;var n=this.Yr();this.persistence=new Mn(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mn(g({},this.config,{persistence:"sessionStorage"}),n);var o=g({},this.persistence.props),a=g({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Xr=new fo((t=>this.Qr(t)),this.config.request_queue_config),this.Zr=new go(this),this.__request_queue=[];var l="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new wo(this),this.sessionPropsManager=new yo(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ei.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.ts(l)}),0)):(Ei.info("Initializing extensions synchronously"),this.ts(l)),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&Ei.info("Starting in debug mode",{this:this,config:e,thisC:g({},this.config),p:o,s:a}),void 0!==(null==(s=e.bootstrap)?void 0:s.distinctID)){var u,h,d=this.config.get_device_id(wr()),v=null!=(u=e.bootstrap)&&u.isIdentifiedID?d:e.bootstrap.distinctID;this.persistence.set_property(ue,null!=(h=e.bootstrap)&&h.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.bootstrap.distinctID,$device_id:v})}if(this.es()){var f,p,_=Object.keys((null==(f=e.bootstrap)?void 0:f.featureFlags)||{}).filter((t=>{var i;return!(null==(i=e.bootstrap)||null==(i=i.featureFlags)||!i[t])})).reduce(((t,i)=>{var r;return t[i]=(null==(r=e.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,t}),{}),m=Object.keys((null==(p=e.bootstrap)?void 0:p.featureFlagPayloads)||{}).filter((t=>_[t])).reduce(((t,i)=>{var r,s;null!=(r=e.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(t[i]=null==(s=e.bootstrap)||null==(s=s.featureFlagPayloads)?void 0:s[i]);return t}),{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:m})}if(l)this.register_once({distinct_id:_e,$device_id:null},"");else if(!this.get_distinct_id()){var y=this.config.get_device_id(wr());this.register_once({distinct_id:y,$device_id:y},""),this.persistence.set_property(ue,"anonymous")}return Ui(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),e.segment?Gr(this,(()=>this.rs())):this.rs(),C(this.config._onCapture)&&this.config._onCapture!==Lo&&(Ei.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Ei.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}ts(t){var i=performance.now();this.historyAutocapture=new qr(this),this.historyAutocapture.startIfEnabled();var e=[];e.push((()=>{new es(this).startIfEnabledOrStop()})),e.push((()=>{var t;this.siteApps=new $o(this),null==(t=this.siteApps)||t.init()})),t||e.push((()=>{this.sessionRecording=new Do(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||e.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),e.push((()=>{this.autocapture=new fr(this),this.autocapture.startIfEnabled()})),e.push((()=>{this.surveys.loadIfEnabled()})),e.push((()=>{this.conversations.loadIfEnabled()})),e.push((()=>{this.productTours=new Dn(this),this.productTours.loadIfEnabled()})),e.push((()=>{this.heatmaps=new Es(this),this.heatmaps.startIfEnabled()})),e.push((()=>{this.webVitalsAutocapture=new bs(this)})),e.push((()=>{this.exceptionObserver=new Hr(this),this.exceptionObserver.startIfEnabledOrStop()})),e.push((()=>{this.deadClicksAutocapture=new Ur(this,Nr),this.deadClicksAutocapture.startIfEnabled()})),e.push((()=>{if(this.ss){var t=this.ss;this.ss=void 0,this.yi(t)}})),this.ns(e,i)}ns(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions)if(performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.ns(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){Ei.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&&Ei.info("PostHog extensions initialized ("+r+"ms)")}yi(t){var i,e,r,s,n,a,l,u,h;if(!o||!o.body)return Ei.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.yi(t)}),500);this.config.__preview_deferred_init_extensions&&(this.ss=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=w(t.supportedCompression,er.GZipJS)?er.GZipJS:w(t.supportedCompression,er.Base64)?er.Base64:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Wr?this.Wr:"identified_only"}),null==(e=this.siteApps)||e.onRemoteConfig(t),null==(r=this.sessionRecording)||r.onRemoteConfig(t),null==(s=this.autocapture)||s.onRemoteConfig(t),null==(n=this.heatmaps)||n.onRemoteConfig(t),this.surveys.onRemoteConfig(t),this.conversations.onRemoteConfig(t),null==(a=this.productTours)||a.onRemoteConfig(t),null==(l=this.webVitalsAutocapture)||l.onRemoteConfig(t),null==(u=this.exceptionObserver)||u.onRemoteConfig(t),this.exceptions.onRemoteConfig(t),null==(h=this.deadClicksAutocapture)||h.onRemoteConfig(t)}rs(){try{this.config.loaded(this)}catch(t){Ei.critical("`loaded` function failed",t)}this.os(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.ls()}),1),new vo(this).load(),this.featureFlags.flags()}os(){var t;this.is_capturing()&&(this.config.request_batching&&(null==(t=this.Xr)||t.enable()))}_dom_loaded(){this.is_capturing()&&Ti(this.__request_queue,(t=>this.Qr(t))),this.__request_queue=[],this.os()}_handle_unload(){var t,i;this.surveys.handlePageUnload(),this.config.request_batching?(this.us()&&this.capture("$pageleave"),null==(t=this.Xr)||t.unload(),null==(i=this.Zr)||i.unload()):this.us()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(Uo?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=un(t.url,{ip:this.config.ip?1:0}),t.headers=g({},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=g({},t);s.timeout=s.timeout||6e4,s.url=un(s.url,{_:(new Date).getTime().toString(),ver:c.LIB_VERSION,compression:s.compression});var n=null!==(i=s.transport)&&void 0!==i?i:"fetch",o=vn.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(e=null==(r=Ni(o,(t=>t.transport===n)))?void 0:r.method)&&void 0!==e?e:o[0].method;if(!a)throw new Error("No available transport method");a(s)})(g({},t,{callback:i=>{var e,r;(this.rateLimiter.checkForLimiting(i),i.statusCode>=400)&&(null==(e=(r=this.config).on_request_error)||e.call(r,i));null==t.callback||t.callback(i)}}))))}Qr(t){this.Zr?this.Zr.retriableRequest(t):this._send_request(t)}_execute_array(t){var i,e=[],r=[],s=[];Ti(t,(t=>{t&&(i=t[0],I(i)?s.push(t):C(t)?t.call(this):I(t)&&"alias"===i?e.push(t):I(t)&&-1!==i.indexOf("capture")&&C(this[i])?s.push(t):r.push(t))}));var n=function(t,i){Ti(t,(function(t){if(I(t[0])){var e=i;Ii(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else this[t[0]].apply(this,t.slice(1))}),i)};n(e,this),n(r,this),n(s,this)}es(){var t,i;return(null==(t=this.config.bootstrap)?void 0:t.featureFlags)&&Object.keys(null==(i=this.config.bootstrap)?void 0:i.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,i,e){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Xr){if(this.is_capturing())if(!M(t)&&O(t)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(s&&!this.config.__preview_capture_bot_pageviews)){var n=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==n||!n.isRateLimited){null!=i&&i.$current_url&&!O(null==i?void 0:i.$current_url)&&(Ei.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,a=(null==e?void 0:e.timestamp)||o,l=wr(),u={uuid:l,event:t,properties:this.calculateEventProperties(t,i||{},a,l)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&s&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),n&&(u.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),(null==e?void 0:e.$set)&&(u.$set=null==e?void 0:e.$set);var h,d="$groupidentify"!==t,v=this.hs(null==e?void 0:e.$set_once,d);if(v&&(u.$set_once=v),(u=Di(u,null!=e&&e._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,M(null==e?void 0:e.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),t===Wn.DISMISSED||t===Wn.SENT){var c=null==i?void 0:i[Gn.SURVEY_ID],f=null==i?void 0:i[Gn.SURVEY_ITERATION];h={id:c,current_iteration:f},localStorage.getItem(Xn(h))||localStorage.setItem(Xn(h),"true"),u.$set=g({},u.$set,{[Yn({id:c,current_iteration:f},t===Wn.SENT?"responded":"dismissed")]:!0})}var p=g({},u.properties.$set,u.$set);if(F(p)||this.setPersonPropertiesForFlags(p),!j(this.config.before_send)){var _=this.ds(u);if(!_)return;u=_}this.Hr.emit("eventCaptured",u);var m={method:"POST",url:null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,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.Qr(m):this.Xr.enqueue(m),u}Ei.critical("This capture call is ignored due to client rate limiting.")}}else Ei.error("No event name provided to posthog.capture")}else Ei.uninitializedWarning("posthog.capture")}Hi(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(t,i,e,r,s){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;var n=s?void 0:this.persistence.remove_event_timer(t),a=g({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),"$snapshot"===t){var l=g({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!O(a.distinct_id)&&!L(a.distinct_id)||A(a.distinct_id))&&Ei.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,h=_s(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(s,e.getTime());a.$session_id=v,a.$window_id=c}this.sessionPropsManager&&Ci(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&Ci(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(f=this.Zr)?void 0:f.length}catch(t){a.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===ko.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u="$pageview"!==t||s?"$pageleave"!==t||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,r),a=Ci(a,u),"$pageview"===t&&o&&(a.title=o.title),!M(n)){var p=e.getTime()-n;a.$duration=parseFloat((p/1e3).toFixed(3))}d&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ci({},h,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),I(this.config.property_denylist)?Ii(this.config.property_denylist,(function(t){delete a[t]})):Ei.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(Ei.error("sanitize_properties is deprecated. Use before_send instead"),a=_(a,t));var m=this.vs();return a.$process_person_profile=m,m&&!s&&this.cs("_calculate_event_properties"),a}hs(t,i){var e;if(void 0===i&&(i=!0),!this.persistence||!this.vs())return t;if(this.zr)return t;var r=this.persistence.get_initial_props(),s=null==(e=this.sessionPropsManager)?void 0:e.getSetOnceProps(),n=Ci({},r,s||{},t||{}),o=this.config.sanitize_properties;return o&&(Ei.error("sanitize_properties is deprecated. Use before_send instead"),n=o(n,"$set_once")),i&&(this.zr=!0),F(n)?void 0:n}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)}fs(t,i){this.register({[t]:i})}getFeatureFlag(t,i){return this.featureFlags.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(i)}catch(t){return i}}isFeatureEnabled(t,i){return this.featureFlags.isFeatureEnabled(t,i)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(t,i,e){var r=null!=e&&e.merge?this.featureFlags.getFlagVariants():{},s=null!=e&&e.merge?this.featureFlags.getFlagPayloads():{},n=g({},r,t),o=g({},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:M(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.featureFlags.receivedFeatureFlags({flags:a})}updateEarlyAccessFeatureEnrollment(t,i,e){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){return void 0===i&&(i=!1),this.featureFlags.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Hr.on(t,i)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}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.getSurveys(t,i)}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys.getActiveMatchingSurveys(t,i)}renderSurvey(t,i){this.surveys.renderSurvey(t,i)}displaySurvey(t,i){void 0===i&&(i=Zn),this.surveys.displaySurvey(t,i)}cancelPendingSurvey(t){this.surveys.cancelPendingSurvey(t)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}canRenderSurveyAsync(t,i){return void 0===i&&(i=!1),this.surveys.canRenderSurveyAsync(t,i)}identify(t,i,e){if(!this.__loaded||!this.persistence)return Ei.uninitializedWarning("posthog.identify");if(L(t)&&(t=t.toString(),Ei.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t)if(["distinct_id","distinctid"].includes(t.toLowerCase()))Ei.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.');else if(t!==_e){if(this.cs("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}t!==r&&t!==this.get_property(Hi)&&(this.unregister(Hi),this.register({distinct_id:t}));var n="anonymous"===(this.persistence.get_property(ue)||"anonymous");t!==r&&n?(this.persistence.set_property(ue,"identified"),this.setPersonPropertiesForFlags(g({},e||{},i||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.Gr=fn(t,i,e),this.featureFlags.setAnonymousDistinctId(r)):(i||e)&&this.setPersonProperties(i,e),t!==r&&(this.reloadFeatureFlags(),this.unregister(le))}}else Ei.critical('The string "'+_e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Ei.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,i){if((t||i)&&this.cs("posthog.setPersonProperties")){var e=fn(this.get_distinct_id(),t,i);this.Gr!==e?(this.setPersonPropertiesForFlags(g({},i||{},t||{})),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Gr=e):Ei.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();r[t]!==i&&this.resetGroupPropertiesForFlags(t),this.register({$groups:g({},r,{[t]:i})}),e&&(this.capture("$groupidentify",{$group_type:t,$group_key:i,$group_set:e}),this.setGroupPropertiesForFlags({[t]:e})),r[t]===i||e||this.reloadFeatureFlags()}else Ei.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.featureFlags.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0),this.cs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,i)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s;if(Ei.info("reset"),!this.__loaded)return Ei.uninitializedWarning("posthog.reset");var n=this.get_property("$device_id");if(this.consent.reset(),null==(i=this.persistence)||i.clear(),null==(e=this.sessionPersistence)||e.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(ue,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this.Gr=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:_e,$device_id:null},"");else{var o=this.config.get_device_id(wr());this.register_once({distinct_id:o,$device_id:t?o:n},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var 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(zi)?(Ei.critical("Attempting to create alias for existing People user - aborting."),-2):this.cs("posthog.alias")?(M(i)&&(i=this.get_distinct_id()),t!==i?(this.fs(Hi,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Ei.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=g({},this.config);if(R(t)){var e,r,s,n,o,a,l;Ci(this.config,Ho(t));var u=this.Yr();null==(e=this.persistence)||e.update_config(this.config,i,u),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Mn(g({},this.config,{persistence:"sessionStorage"}),u);var h=this.Vr(this.config.debug);N(h)&&(this.config.debug=h),N(this.config.debug)&&(this.config.debug?(c.DEBUG=!0,Tr.H()&&Tr.G("ph_debug","true"),Ei.info("set_config",{config:t,oldConfig:i,newConfig:g({},this.config)})):(c.DEBUG=!1,Tr.H()&&Tr.V("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(),this.surveys.loadIfEnabled(),this.ps(),null==(l=this.externalIntegrations)||l.startIfEnabledOrStop()}}startSessionRecording(t){var i=!0===t,e={sampling:i||!(null==t||!t.sampling),linked_flag:i||!(null==t||!t.linked_flag),url_trigger:i||!(null==t||!t.url_trigger),event_trigger:i||!(null==t||!t.event_trigger)};if(Object.values(e).some(Boolean)){var r,s,n,o,a;if(null==(r=this.sessionManager)||r.checkAndGetSessionAndWindowId(),e.sampling)null==(s=this.sessionRecording)||s.overrideSampling();if(e.linked_flag)null==(n=this.sessionRecording)||n.overrideLinkedFlag();if(e.url_trigger)null==(o=this.sessionRecording)||o.overrideTrigger("url");if(e.event_trigger)null==(a=this.sessionRecording)||a.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){var e=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(g({},r,i))}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){return this.toolbar.loadToolbar(t)}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:No;return i!==No&&(i=No+"."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property(ue))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property(ue))}vs(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&F(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Hi])&&(null==(i=this.persistence)||null==(i=i.props)||!i[pe]))}us(){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.vs()||this.cs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}cs(t){return"never"===this.config.person_profiles?(Ei.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.fs(pe,!0),!0)}Yr(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut(),i=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||t&&!!i}ps(){var t,i,e,r,s=this.Yr();(null==(t=this.persistence)?void 0:t.Si)!==s&&(null==(e=this.persistence)||e.set_disabled(s));(null==(i=this.sessionPersistence)?void 0:i.Si)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s));return s}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){var e,r,s;if("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())this.reset(!0),null==(e=this.sessionManager)||e.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new wo(this),this.pageViewManager=new $s(this),this.persistence&&(this.sessionPropsManager=new yo(this,this.sessionManager,this.persistence)),this.sessionRecording=new Do(this),this.sessionRecording.startIfEnabledOrStop();if(this.consent.optInOut(!0),this.ps(),this.os(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),M(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)this.capture(null!==(s=null==t?void 0:t.captureEventName)&&void 0!==s?s:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0});this.config.capture_pageview&&this.ls()}else Ei.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var t,i,e;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.ps(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:_e,$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.ls())):Ei.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return t===Ar.GRANTED?"granted":t===Ar.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.ps()}_is_bot(){return n?So(n,this.config.custom_blocked_useragents):void 0}ls(){o&&("visible"===o.visibilityState?this.Br||(this.Br=!0,this.capture("$pageview",{title:o.title},{send_instantly:!0}),this.qr&&(o.removeEventListener("visibilitychange",this.qr),this.qr=null)):this.qr||(this.qr=this.ls.bind(this),Ui(o,"visibilitychange",this.qr)))}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}))}O(){var t,i,e,r,s,n,o,a=this.Jr||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ei.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",r=!1,s=Ei,n=(i="advanced_disable_flags")in(t=a)&&!M(t[i]),o=e in t&&!M(t[e]),n?t[i]:o?(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e]):r)}ds(t){if(j(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),j(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return z(t.event)?Ei.warn(s+". This can cause unexpected behavior."):Ei.info(s),null}e.properties&&!F(e.properties)||Ei.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.Kt)?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)})}Vr(t){var i=N(t)&&!t,e=Tr.H()&&"true"===Tr.q("ph_debug");return!i&&(!!e||t)}}!function(t,i){for(var e=0;e<i.length;e++)t.prototype[i[e]]=Oi(t.prototype[i[e]])}(qo,["identify"]);var Wo,Go={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1},Vo=(Wo=jo[No]=new qo,function(){function i(){i.done||(i.done=!0,Uo=!1,Ii(jo,(function(t){t._dom_loaded()})))}null!=o&&o.addEventListener?"complete"===o.readyState?i():Ui(o,"DOMContentLoaded",i,{capture:!1}):t&&Ei.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Wo);export{ir as COPY_AUTOCAPTURE_EVENT,er as Compression,Go as DEFAULT_PRODUCT_TOUR_APPEARANCE,Vn as DisplaySurveyType,qo as PostHog,Wn as SurveyEventName,Gn as SurveyEventProperties,jn as SurveyEventType,Nn as SurveyPosition,Bn as SurveyQuestionBranchingType,Hn as SurveyQuestionType,qn as SurveySchedule,Un as SurveyTabPosition,zn as SurveyType,Ln as SurveyWidgetType,Vo as default,Vo as posthog,rr as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.js.map
|