@deriv-com/analytics 1.39.2 → 1.39.4

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.
Files changed (50) hide show
  1. package/dist/browser/analytics.bundle.global.js +12 -12
  2. package/dist/browser/analytics.bundle.global.js.map +1 -1
  3. package/dist/browser/analytics.esm.mjs +1 -1
  4. package/dist/browser/analytics.esm.mjs.map +1 -1
  5. package/dist/chunk-35PJECDZ.mjs +9 -0
  6. package/dist/chunk-35PJECDZ.mjs.map +1 -0
  7. package/dist/{chunk-44P2MMGV.mjs → chunk-AGTZ7DYP.mjs} +3 -3
  8. package/dist/{chunk-44P2MMGV.mjs.map → chunk-AGTZ7DYP.mjs.map} +1 -1
  9. package/dist/chunk-AKXW5KX7.js +4 -0
  10. package/dist/chunk-AKXW5KX7.js.map +1 -0
  11. package/dist/chunk-ASVWETRZ.mjs +3 -0
  12. package/dist/chunk-ASVWETRZ.mjs.map +1 -0
  13. package/dist/chunk-EZWNCHVR.js +3 -0
  14. package/dist/chunk-EZWNCHVR.js.map +1 -0
  15. package/dist/{chunk-Y3QT7NAG.js → chunk-LFQLME3L.js} +3 -3
  16. package/dist/{chunk-Y3QT7NAG.js.map → chunk-LFQLME3L.js.map} +1 -1
  17. package/dist/{chunk-FY3NPDUL.mjs → chunk-T37YZXV4.mjs} +2 -2
  18. package/dist/chunk-XC5XM6FP.mjs +4 -0
  19. package/dist/chunk-XC5XM6FP.mjs.map +1 -0
  20. package/dist/{growthbook-IRLKT4KH.mjs → growthbook-TE4SOUS2.mjs} +2 -2
  21. package/dist/index.js +2 -2
  22. package/dist/index.mjs +1 -1
  23. package/dist/metafile-cjs.json +1 -1
  24. package/dist/metafile-esm.json +1 -1
  25. package/dist/metafile-iife.json +1 -1
  26. package/dist/posthog-66UECPCZ.mjs +6 -0
  27. package/dist/posthog-66UECPCZ.mjs.map +1 -0
  28. package/dist/providers/growthbook/index.js +2 -2
  29. package/dist/providers/growthbook/index.mjs +1 -1
  30. package/dist/providers/posthog/index.js +2 -2
  31. package/dist/providers/posthog/index.mjs +1 -1
  32. package/dist/providers/rudderstack/index.js +1 -1
  33. package/dist/providers/rudderstack/index.mjs +1 -1
  34. package/dist/utils/analytics-cache/index.js +1 -1
  35. package/dist/utils/analytics-cache/index.mjs +1 -1
  36. package/package.json +2 -2
  37. package/dist/chunk-GGU2UVKH.mjs +0 -4
  38. package/dist/chunk-GGU2UVKH.mjs.map +0 -1
  39. package/dist/chunk-J3V5QNIH.js +0 -4
  40. package/dist/chunk-J3V5QNIH.js.map +0 -1
  41. package/dist/chunk-LIPHY7JK.mjs +0 -3
  42. package/dist/chunk-LIPHY7JK.mjs.map +0 -1
  43. package/dist/chunk-SQ6Q4Z5S.js +0 -3
  44. package/dist/chunk-SQ6Q4Z5S.js.map +0 -1
  45. package/dist/chunk-UG2YL4OB.mjs +0 -9
  46. package/dist/chunk-UG2YL4OB.mjs.map +0 -1
  47. package/dist/posthog-PBG3EMGB.mjs +0 -6
  48. package/dist/posthog-PBG3EMGB.mjs.map +0 -1
  49. /package/dist/{chunk-FY3NPDUL.mjs.map → chunk-T37YZXV4.mjs.map} +0 -0
  50. /package/dist/{growthbook-IRLKT4KH.mjs.map → growthbook-TE4SOUS2.mjs.map} +0 -0
@@ -1,6 +0,0 @@
1
- /* @deriv-com/analytics - Browser ESM Bundle (RudderStack + PostHog) - Built with tsup */
2
- import{d as Zr,e as Qr,f as es,i as ts,j as is}from"./chunk-UG2YL4OB.mjs";var d=typeof window<"u"?window:void 0,W=typeof globalThis<"u"?globalThis:d;typeof self>"u"&&(W.self=W),typeof File>"u"&&(W.File=function(){});var Qs=Array.prototype,rs=Qs.forEach,ss=Qs.indexOf,ee=W?.navigator,m=W?.document,V=W?.location,Ci=W?.fetch,Ai=W!=null&&W.XMLHttpRequest&&"withCredentials"in new W.XMLHttpRequest?W.XMLHttpRequest:void 0,ns=W?.AbortController,J=ee?.userAgent,E=d??{},ve={DEBUG:!1,LIB_VERSION:"1.356.1"};function os(i,e,t,r,s,n,o){try{var a=i[n](o),l=a.value}catch(c){return void t(c)}a.done?e(l):Promise.resolve(l).then(r,s)}function fe(i){return function(){var e=this,t=arguments;return new Promise((function(r,s){var n=i.apply(e,t);function o(l){os(n,r,s,o,a,"next",l)}function a(l){os(n,r,s,o,a,"throw",l)}o(void 0)}))}}function f(){return f=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},f.apply(null,arguments)}function en(i,e){if(i==null)return{};var t={};for(var r in i)if({}.hasOwnProperty.call(i,r)){if(e.indexOf(r)!==-1)continue;t[r]=i[r]}return t}var ho=["$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"],po=["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"],as=function(i,e){if(e===void 0&&(e=[]),!i)return!1;var t=i.toLowerCase();return po.concat(e).some((r=>{var s=r.toLowerCase();return t.indexOf(s)!==-1}))};function O(i,e){return i.indexOf(e)!==-1}var hi=function(i){return i.trim()},Mi=function(i){return i.replace(/^\$/,"")},_o=Array.isArray,tn=Object.prototype,rn=tn.hasOwnProperty,di=tn.toString,I=_o||function(i){return di.call(i)==="[object Array]"},be=i=>typeof i=="function",q=i=>i===Object(i)&&!I(i),Xe=i=>{if(q(i)){for(var e in i)if(rn.call(i,e))return!1;return!0}return!1},y=i=>i===void 0,H=i=>di.call(i)=="[object String]",Di=i=>H(i)&&i.trim().length===0,ae=i=>i===null,$=i=>y(i)||ae(i),xe=i=>di.call(i)=="[object Number]"&&i==i,Ye=i=>xe(i)&&i>0,Ee=i=>di.call(i)==="[object Boolean]",go=i=>i instanceof FormData,vo=i=>O(ho,i);function Ni(i){return i===null||typeof i!="object"}function Bt(i,e){return Object.prototype.toString.call(i)==="[object "+e+"]"}function sn(i){return!y(Event)&&(function(e,t){try{return e instanceof t}catch{return!1}})(i,Event)}var fo=[!0,"true",1,"1","yes"],vi=i=>O(fo,i),mo=[!1,"false",0,"0","no"];function pe(i,e,t,r,s){return e>t&&(r.warn("min cannot be greater than max."),e=t),xe(i)?i>t?(r.warn(" cannot be greater than max: "+t+". Using max value instead."),t):i<e?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):i:(r.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+s),pe(s||t,e,t,r))}var Li=class{constructor(e){this.t={},this.i=e.i,this.o=pe(e.bucketSize,0,100,e.h),this.m=pe(e.refillRate,0,this.o,e.h),this.$=pe(e.refillInterval,0,864e5,e.h)}S(e,t){var r=t-e.lastAccess,s=Math.floor(r/this.$);if(s>0){var n=s*this.m;e.tokens=Math.min(e.tokens+n,this.o),e.lastAccess=e.lastAccess+s*this.$}}consumeRateLimit(e){var t,r=Date.now(),s=String(e),n=this.t[s];return n?this.S(n,r):(n={tokens:this.o,lastAccess:r},this.t[s]=n),n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.i)==null||t.call(this,e)),n.tokens===0)}stop(){this.t={}}},ne="Mobile",Vt="iOS",we="Android",Pt="Tablet",nn=we+" "+Pt,on="iPad",an="Apple",ln=an+" Watch",Tt="Safari",et="BlackBerry",cn="Samsung",un=cn+"Browser",hn=cn+" Internet",Ue="Chrome",yo=Ue+" OS",dn=Ue+" "+Vt,Lr="Internet Explorer",pn=Lr+" "+ne,Ur="Opera",bo=Ur+" Mini",jr="Edge",_n="Microsoft "+jr,Ze="Firefox",gn=Ze+" "+Vt,Rt="Nintendo",Ot="PlayStation",Qe="Xbox",vn=we+" "+ne,fn=ne+" "+Tt,gt="Windows",Ui=gt+" Phone",ls="Nokia",ji="Ouya",mn="Generic",wo=mn+" "+ne.toLowerCase(),yn=mn+" "+Pt.toLowerCase(),Hi="Konqueror",Y="(\\d+(\\.\\d+)?)",fi=new RegExp("Version/"+Y),Eo=new RegExp(Qe,"i"),xo=new RegExp(Ot+" \\w+","i"),ko=new RegExp(Rt+" \\w+","i"),Hr=new RegExp(et+"|PlayBook|BB10","i"),So={"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"},Mt,cs,mi,Po=(i,e)=>e&&O(e,an)||(function(t){return O(t,Tt)&&!O(t,Ue)&&!O(t,we)})(i),bn=function(i,e){return e=e||"",O(i," OPR/")&&O(i,"Mini")?bo:O(i," OPR/")?Ur:Hr.test(i)?et:O(i,"IE"+ne)||O(i,"WPDesktop")?pn:O(i,un)?hn:O(i,jr)||O(i,"Edg/")?_n:O(i,"FBIOS")?"Facebook "+ne:O(i,"UCWEB")||O(i,"UCBrowser")?"UC Browser":O(i,"CriOS")?dn:O(i,"CrMo")||O(i,Ue)?Ue:O(i,we)&&O(i,Tt)?vn:O(i,"FxiOS")?gn:O(i.toLowerCase(),Hi.toLowerCase())?Hi:Po(i,e)?O(i,ne)?fn:Tt:O(i,Ze)?Ze:O(i,"MSIE")||O(i,"Trident/")?Lr:O(i,"Gecko")?Ze:""},To={[pn]:[new RegExp("rv:"+Y)],[_n]:[new RegExp(jr+"?\\/"+Y)],[Ue]:[new RegExp("("+Ue+"|CrMo)\\/"+Y)],[dn]:[new RegExp("CriOS\\/"+Y)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Y)],[Tt]:[fi],[fn]:[fi],[Ur]:[new RegExp("(Opera|OPR)\\/"+Y)],[Ze]:[new RegExp(Ze+"\\/"+Y)],[gn]:[new RegExp("FxiOS\\/"+Y)],[Hi]:[new RegExp("Konqueror[:/]?"+Y,"i")],[et]:[new RegExp(et+" "+Y),fi],[vn]:[new RegExp("android\\s"+Y,"i")],[hn]:[new RegExp(un+"\\/"+Y)],[Lr]:[new RegExp("(rv:|MSIE )"+Y)],Mozilla:[new RegExp("rv:"+Y)]},Ro=function(i,e){var t=bn(i,e),r=To[t];if(y(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=i.match(n);if(o)return parseFloat(o[o.length-2])}return null},us=[[new RegExp(Qe+"; "+Qe+" (.*?)[);]","i"),i=>[Qe,i&&i[1]||""]],[new RegExp(Rt,"i"),[Rt,""]],[new RegExp(Ot,"i"),[Ot,""]],[Hr,[et,""]],[new RegExp(gt,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Ui,""];if(new RegExp(ne).test(e)&&!/IEMobile\b/.test(e))return[gt+" "+ne,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var r=t[1],s=So[r]||"";return/arm/i.test(e)&&(s="RT"),[gt,s]}return[gt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>{if(i&&i[3]){var e=[i[3],i[4],i[5]||"0"];return[Vt,e.join(".")]}return[Vt,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=y(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+we+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+we+")","i"),i=>{if(i&&i[2]){var e=[i[2],i[3],i[4]||"0"];return[we,e.join(".")]}return[we,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];if(i&&i[1]){var t=[i[1],i[2],i[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[yo,""]],[/Linux|debian/i,["Linux",""]]],hs=function(i){return ko.test(i)?Rt:xo.test(i)?Ot:Eo.test(i)?Qe:new RegExp(ji,"i").test(i)?ji:new RegExp("("+Ui+"|WPDesktop)","i").test(i)?Ui:/iPad/.test(i)?on:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?ln:Hr.test(i)?et:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(ls,"i").test(i)?ls:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?new RegExp(ne).test(i)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)||/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?we:nn:new RegExp("(pda|"+ne+")","i").test(i)?wo:new RegExp(Pt,"i").test(i)&&!new RegExp(Pt+" pc","i").test(i)?yn:""},Oo=i=>i instanceof Error;function $o(i){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return mi&&t.length===cs||(cs=t.length,mi=t.reduce(((r,s)=>{Mt||(Mt={});var n=Mt[s];if(n)r[n[0]]=n[1];else for(var o=i(s),a=o.length-1;a>=0;a--){var l=o[a],c=l?.filename,u=e[s];if(c&&u){r[c]=u,Mt[s]=[c,u];break}}return r}),{})),mi}}var qi=class{constructor(e,t,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){t===void 0&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(r,t,0).apply(e),n=this.buildParsingContext(t),o=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var t=this;return fe((function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&I(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r,s;return e.cause!=null&&(r=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),f({},e,{cause:r,stack:s})}applyChunkIds(e,t){return e.map((r=>(r.filename&&t&&(r.chunk_id=t[r.filename]),r)))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return fe((function*(){var r=e;for(var s of t.modifiers)r=yield s(r);return r}))()}convertToExceptionList(e,t){var r,s,n,o={type:e.type,value:e.value,mechanism:{type:(r=t.type)!==null&&r!==void 0?r:"generic",handled:(s=t.handled)===null||s===void 0||s,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,f({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:$o(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,r){r===void 0&&(r=0);var s=(n,o)=>{if(o<=4){var a=this.buildCoercingContext(e,t,o);return this.applyCoercers(n,a)}};return f({},t,{syntheticException:r==0?t.syntheticException:void 0,mechanism:e,apply:n=>s(n,r),next:n=>s(n,r+1)})}},tt="?";function Bi(i,e,t,r,s){var n={platform:i,filename:e,function:t==="<anonymous>"?tt:t,in_app:!0};return y(r)||(n.lineno=r),y(s)||(n.colno=s),n}var wn=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,r=i.indexOf("safari-web-extension")!==-1;return t||r?[i.indexOf("@")!==-1?i.split("@")[0]:tt,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},Io=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Fo=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Co=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ao=(i,e)=>{var t=Io.exec(i);if(t){var[,r,s,n]=t;return Bi(e,r,tt,+s,+n)}var o=Fo.exec(i);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=Co.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=wn(o[1]||tt,o[2]);return Bi(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Mo=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Do=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,No=(i,e)=>{var t=Mo.exec(i);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var r=Do.exec(t[3]);r&&(t[1]=t[1]||"eval",t[3]=r[1],t[4]=r[2],t[5]="")}var s=t[3],n=t[1]||tt;return[n,s]=wn(n,s),Bi(e,s,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},ds=/\(error: (.*)\)/,ps=50;function Lo(){return(function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return function(s,n){n===void 0&&(n=0);for(var o=[],a=s.split(`
3
- `),l=n;l<a.length;l++){var c=a[l];if(!(c.length>1024)){var u=ds.test(c)?c.replace(ds,"$1"):c;if(!u.match(/\S*Error: /)){for(var h of t){var p=h(u,i);if(p){o.push(p);break}}if(o.length>=ps)break}}}return(function(_){if(!_.length)return[];var g=Array.from(_);return g.reverse(),g.slice(0,ps).map((v=>{return f({},v,{filename:v.filename||(w=g,w[w.length-1]||{}).filename,function:v.function||tt});var w}))})(o)}})("web:javascript",Ao,No)}var Vi=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=H(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return Bt(e,"DOMException")}isDOMError(e){return Bt(e,"DOMError")}},Wi=class{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var r=e.message;return r.error&&typeof r.error.message=="string"?String(r.error.message):String(r)}getStack(e){return e.stacktrace||e.stack||void 0}},zi=class{constructor(){}match(e){return Bt(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var r,s=t.apply(e.error);return s||{type:"ErrorEvent",value:e.message,stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},Uo=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Gi=class{match(e){return typeof e=="string"}coerce(e,t){var r,[s,n]=this.getInfos(e);return{type:s??"Error",value:n??e,stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,s=e.match(Uo);return s&&(t=s[1],r=s[2]),[t,r]}},jo=["fatal","error","warning","log","info","debug"];function En(i,e){e===void 0&&(e=40);var t=Object.keys(i);if(t.sort(),!t.length)return"[object has no keys]";for(var r=t.length;r>0;r--){var s=t.slice(0,r).join(", ");if(!(s.length>e))return r===t.length||s.length<=e?s:s.slice(0,e)+"..."}return""}var Yi=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var r,s=this.getErrorPropertyFromObject(e);return s?t.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(r=t.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return sn(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+En(e)}isSeverityLevel(e){return H(e)&&!Di(e)&&jo.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var r=e[t];if(Oo(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Ki=class{match(e){return sn(e)}coerce(e,t){var r,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+En(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},Xi=class{match(e){return Ni(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}}},Ji=class{match(e){return Bt(e,"PromiseRejectionEvent")}coerce(e,t){var r,s=this.getUnhandledRejectionReason(e);return Ni(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(r=t.syntheticException)==null?void 0:r.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){if(Ni(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}},xn=function(i,e){var{debugEnabled:t}=e===void 0?{}:e,r={k:function(s){if(d&&(ve.DEBUG||E.POSTHOG_DEBUG||t)&&!y(d.console)&&d.console){for(var n=("__rrweb_original__"in d.console[s])?d.console[s].__rrweb_original__:d.console[s],o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];n(i,...a)}},info:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];r.k("log",...n)},warn:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];r.k("warn",...n)},error:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];r.k("error",...n)},critical:function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];console.error(i,...n)},uninitializedWarning:s=>{r.error("You must initialize PostHog before calling "+s)},createLogger:(s,n)=>xn(i+" "+s,n)};return r},b=xn("[PostHog.js]"),N=b.createLogger,Ho=N("[ExternalScriptsLoader]"),_s=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return Ho.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var r=m?.querySelectorAll("script");if(r){for(var s,n=function(){if(r[o].src===e){var l=r[o];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(c=>{l.__posthog_loading_callback_fired=!0,t(void 0,c)})),l.onerror=c=>t(c),{v:void 0})}},o=0;o<r.length;o++)if(s=n())return s.v}var a=()=>{if(!m)return t("document not found");var l=m.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),i.config.prepare_external_dependency_script&&(l=i.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(i.config.external_scripts_inject_target==="head")m.head.appendChild(l);else{var c,u=m.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):m.body.appendChild(l)}};m!=null&&m.body?a():m?.addEventListener("DOMContentLoaded",a)};E.__PosthogExtensions__=E.__PosthogExtensions__||{},E.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{var r="/static/"+e+".js?v="+i.version;if(e==="remote-config"&&(r="/array/"+i.config.token+"/config.js"),e==="toolbar"){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=i.requestRouter.endpointFor("assets",r);_s(i,n,t)},E.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var r=i.requestRouter.endpointFor("api",e);_s(i,r,t)};var Wt={};function Ae(i,e,t){if(I(i)){if(rs&&i.forEach===rs)i.forEach(e,t);else if("length"in i&&i.length===+i.length){for(var r=0,s=i.length;r<s;r++)if(r in i&&e.call(t,i[r],r)===Wt)return}}}function A(i,e,t){if(!$(i)){if(I(i))return Ae(i,e,t);if(go(i)){for(var r of i.entries())if(e.call(t,r[1],r[0])===Wt)return}else for(var s in i)if(rn.call(i,s)&&e.call(t,i[s],s)===Wt)return}}var U=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return Ae(t,(function(s){for(var n in s)s[n]!==void 0&&(i[n]=s[n])})),i},it=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return Ae(t,(function(s){Ae(s,(function(n){i.push(n)}))})),i};function Ht(i){for(var e=Object.keys(i),t=e.length,r=new Array(t);t--;)r[t]=[e[t],i[e[t]]];return r}var gs=function(i){try{return i()}catch{return}},qo=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i.apply(this,t)}catch(s){b.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),b.critical(s)}}},qr=function(i){var e={};return A(i,(function(t,r){(H(t)&&t.length>0||xe(t))&&(e[r]=t)})),e};function Bo(i,e){return t=i,r=n=>H(n)&&!ae(e)?n.slice(0,e):n,s=new Set,(function n(o,a){return o!==Object(o)?r?r(o,a):o:s.has(o)?void 0:(s.add(o),I(o)?(l=[],Ae(o,(c=>{l.push(n(c))}))):(l={},A(o,((c,u)=>{s.has(c)||(l[u]=n(c,u))}))),l);var l})(t);var t,r,s}var Vo=["herokuapp.com","vercel.app","netlify.app"];function Wo(i){var e=i?.hostname;if(!H(e))return!1;var t=e.split(".").slice(-2).join(".");for(var r of Vo)if(t===r)return!1;return!0}function kn(i,e){for(var t=0;t<i.length;t++)if(e(i[t]))return i[t]}function j(i,e,t,r){var{capture:s=!1,passive:n=!0}=r??{};i?.addEventListener(e,t,{capture:s,passive:n})}function Sn(i){return i.name==="ph_toolbar_internal"}var Pn="$people_distinct_id",vt="__alias",ft="__timers",vs="$autocapture_disabled_server_side",Zi="$heatmaps_enabled_server_side",fs="$exception_capture_enabled_server_side",Qi="$error_tracking_suppression_rules",ms="$error_tracking_capture_extension_exceptions",ys="$web_vitals_enabled_server_side",Tn="$dead_clicks_enabled_server_side",bs="$product_tours_enabled_server_side",ws="$web_vitals_allowed_metrics",Dt="$session_recording_remote_config",zt="$sesid",Rn="$session_is_sampled",Je="$enabled_feature_flags",mt="$early_access_features",er="$feature_flag_details",yt="$stored_person_properties",Le="$stored_group_properties",tr="$surveys",Gt="$flag_call_reported",ir="$feature_flag_errors",Yt="$feature_flag_evaluated_at",he="$user_state",rr="$client_session_props",sr="$capture_rate_limit",nr="$initial_campaign_params",or="$initial_referrer_info",Kt="$initial_person_info",Xt="$epp",On="__POSTHOG_TOOLBAR__",ot="$posthog_cookieless",zo=[Pn,vt,"__cmpns",ft,"$session_recording_enabled_server_side",Zi,zt,Je,Qi,he,mt,er,Le,yt,tr,Gt,ir,Yt,rr,sr,nr,or,Xt,Kt];Math.trunc||(Math.trunc=function(i){return i<0?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return xe(i)&&isFinite(i)&&Math.floor(i)===i});var Es="0123456789abcdef",ar=class i{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(s)||e<0||t<0||r<0||s<0||e>0xffffffffffff||t>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new i(n)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Es.charAt(this.bytes[t]>>>4)+Es.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new i(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var r=this.bytes[t]-e.bytes[t];if(r!==0)return Math.sign(r)}return 0}},lr=class{constructor(){this.P=0,this.T=0,this.C=new cr}generate(){var e=this.generateOrAbort();if(y(e)){this.P=0;var t=this.generateOrAbort();if(y(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.P)this.P=e,this.I();else{if(!(e+1e4>this.P))return;this.T++,this.T>4398046511103&&(this.P++,this.I())}return ar.fromFieldsV7(this.P,Math.trunc(this.T/Math.pow(2,30)),this.T&Math.pow(2,30)-1,this.C.nextUint32())}I(){this.T=1024*this.C.nextUint32()+(1023&this.C.nextUint32())}},xs,$n=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<i.length;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};d&&!y(d.crypto)&&crypto.getRandomValues&&($n=i=>crypto.getRandomValues(i));var cr=class{constructor(){this.R=new Uint32Array(8),this.F=1/0}nextUint32(){return this.F>=this.R.length&&($n(this.R),this.F=0),this.R[this.F++]}},Ce=()=>Go().toString(),Go=()=>(xs||(xs=new lr)).generate(),at="",Yo=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Ko(i,e){if(e){var t=(function(s,n){if(n===void 0&&(n=m),at)return at;if(!n||["localhost","127.0.0.1"].includes(s))return"";for(var o=s.split("."),a=Math.min(o.length,8),l="dmn_chk_"+Ce();!at&&a--;){var c=o.slice(a).join("."),u=l+"=1;domain=."+c+";path=/";n.cookie=u+";max-age=3",n.cookie.includes(l)&&(n.cookie=u+";max-age=0",at=c)}return at})(i);if(!t){var r=(s=>{var n=s.match(Yo);return n?n[0]:""})(i);r!==t&&b.info("Warning: cookie subdomain discovery mismatch",r,t),t=r}return t?"; domain=."+t:""}return""}var de={O:()=>!!m,M:function(i){b.error("cookieStore error: "+i)},A:function(i){if(m){try{for(var e=i+"=",t=m.cookie.split(";").filter((n=>n.length)),r=0;r<t.length;r++){for(var s=t[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},D:function(i){var e;try{e=JSON.parse(de.A(i))||{}}catch{}return e},j:function(i,e,t,r,s){if(m)try{var n="",o="",a=Ko(m.location.hostname,r);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),n="; expires="+l.toUTCString()}s&&(o="; secure");var c=i+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&b.warn("cookieStore warning: large cookie, len="+c.length),m.cookie=c,c}catch{return}},L:function(i,e){if(m!=null&&m.cookie)try{de.j(i,"",-1,e)}catch{return}}},yi=null,D={O:function(){if(!ae(yi))return yi;var i=!0;if(y(d))i=!1;else try{var e="__mplssupport__";D.j(e,"xyz"),D.A(e)!=='"xyz"'&&(i=!1),D.L(e)}catch{i=!1}return i||b.error("localStorage unsupported; falling back to cookie store"),yi=i,i},M:function(i){b.error("localStorage error: "+i)},A:function(i){try{return d?.localStorage.getItem(i)}catch(e){D.M(e)}return null},D:function(i){try{return JSON.parse(D.A(i))||{}}catch{}return null},j:function(i,e){try{d?.localStorage.setItem(i,JSON.stringify(e))}catch(t){D.M(t)}},L:function(i){try{d?.localStorage.removeItem(i)}catch(e){D.M(e)}}},Xo=["$device_id","distinct_id",zt,Rn,Xt,Kt,he],Nt={},Jo={O:function(){return!0},M:function(i){b.error("memoryStorage error: "+i)},A:function(i){return Nt[i]||null},D:function(i){return Nt[i]||null},j:function(i,e){Nt[i]=e},L:function(i){delete Nt[i]}},Ne=null,B={O:function(){if(!ae(Ne))return Ne;if(Ne=!0,y(d))Ne=!1;else try{var i="__support__";B.j(i,"xyz"),B.A(i)!=='"xyz"'&&(Ne=!1),B.L(i)}catch{Ne=!1}return Ne},M:function(i){b.error("sessionStorage error: ",i)},A:function(i){try{return d?.sessionStorage.getItem(i)}catch(e){B.M(e)}return null},D:function(i){try{return JSON.parse(B.A(i))||null}catch{}return null},j:function(i,e){try{d?.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){B.M(t)}},L:function(i){try{d?.sessionStorage.removeItem(i)}catch(e){B.M(e)}}},me=(function(i){return i[i.PENDING=-1]="PENDING",i[i.DENIED=0]="DENIED",i[i.GRANTED=1]="GRANTED",i})({}),ur=class{constructor(e){this._instance=e}get N(){return this._instance.config}get consent(){return this.U()?me.DENIED:this.H}isOptedOut(){return this.N.cookieless_mode==="always"||this.consent===me.DENIED||this.consent===me.PENDING&&(this.N.opt_out_capturing_by_default||this.N.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===me.DENIED}optInOut(e){this.B.j(this.q,e?1:0,this.N.cookie_expiration,this.N.cross_subdomain_cookie,this.N.secure_cookie)}reset(){this.B.L(this.q,this.N.cross_subdomain_cookie)}get q(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:r}=this._instance.config;return r||(t?t+e:"__ph_opt_in_out_"+e)}get H(){var e=this.B.A(this.q);return vi(e)?me.GRANTED:O(mo,e)?me.DENIED:me.PENDING}get B(){if(!this.W){var e=this.N.opt_out_capturing_persistence_type;this.W=e==="localStorage"?D:de;var t=e==="localStorage"?de:D;t.A(this.q)&&(this.W.A(this.q)||this.optInOut(vi(t.A(this.q))),t.L(this.q,this.N.cross_subdomain_cookie))}return this.W}U(){return!!this.N.respect_dnt&&!!kn([ee?.doNotTrack,ee?.msDoNotTrack,E.doNotTrack],(e=>vi(e)))}},Lt=N("[Dead Clicks]"),Zo=()=>!0,Qo=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(Tn)),r=i.instance.config.capture_dead_clicks;return Ee(r)?r:!!q(r)||t},Jt=class{get lazyLoadedDeadClicksAutocapture(){return this.G}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Tn]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.V((()=>{this.J()})):this.stop()}V(e){var t,r;(t=E.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(r=E.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",(s=>{s?Lt.error("failed to load script",s):e()}))}J(){var e;if(m){if(!this.G&&(e=E.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=q(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.G=E.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.G.start(m),Lt.info("starting...")}}else Lt.error("`document` not found. Cannot start.")}stop(){this.G&&(this.G.stop(),this.G=void 0,Lt.info("stopping..."))}},bi=N("[SegmentIntegration]");function ea(i,e){var t=i.config.segment;if(!t)return e();(function(r,s){var n=r.config.segment;if(!n)return s();var o=l=>{var c=()=>l.anonymousId()||Ce();r.config.get_device_id=c,l.id()&&(r.register({distinct_id:l.id(),$device_id:c()}),r.persistence.set_property(he,"identified")),s()},a=n.user();"then"in a&&be(a.then)?a.then(o):o(a)})(i,(()=>{t.register((r=>{Promise&&Promise.resolve||bi.warn("This browser does not have Promise support, and can not use the segment integration");var s=(n,o)=>{if(!o)return n;n.event.userId||n.event.anonymousId===r.get_distinct_id()||(bi.info("No userId set, resetting PostHog"),r.reset()),n.event.userId&&n.event.userId!==r.get_distinct_id()&&(bi.info("UserId set, identifying with PostHog"),r.identify(n.event.userId));var a=r.calculateEventProperties(o,n.event.properties);return n.event.properties=Object.assign({},a,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:n=>s(n,n.event.event),page:n=>s(n,"$pageview"),identify:n=>s(n,"$identify"),screen:n=>s(n,"$screen")}})(i)).then((()=>{e()}))}))}var In="posthog-js";function Fn(i,e){var{organization:t,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,c,u,h,p;if(!(n==="*"||n.includes(a.level))||!i.__loaded)return a;a.tags||(a.tags={});var _=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());a.tags["PostHog Person URL"]=_,i.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var g=((l=a.exception)==null?void 0:l.values)||[],v=g.map((S=>f({},S,{stacktrace:S.stacktrace?f({},S.stacktrace,{type:"raw",frames:(S.stacktrace.frames||[]).map((k=>f({},k,{platform:"web:javascript"})))}):void 0}))),w={$exception_message:((c=g[0])==null?void 0:c.value)||a.message,$exception_type:(u=g[0])==null?void 0:u.type,$exception_level:a.level,$exception_list:v,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((h=g[0])==null?void 0:h.value)||a.message,$sentry_exception_type:(p=g[0])==null?void 0:p.type,$sentry_tags:a.tags};return t&&r&&(w.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),o&&i.exceptions.sendExceptionEvent(w),a}}var hr=class{constructor(e,t,r,s,n,o){this.name=In,this.setupOnce=function(a){a(Fn(e,{organization:t,projectId:r,prefix:s,severityAllowList:n,sendExceptionsToPostHog:o==null||o}))}}},Zt=i=>{var e=m?.createElement("a");return y(e)?null:(e.href=i,e)},ta=function(i,e){var t,r;e===void 0&&(e="&");var s=[];return A(i,(function(n,o){y(n)||y(o)||o==="undefined"||(t=encodeURIComponent((a=>a instanceof File)(n)?n.name:n.toString()),r=encodeURIComponent(o),s[s.length]=r+"="+t)})),s.join(e)},Qt=function(i,e){for(var t,r=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===e){t=n;break}}if(!I(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{b.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},$t=function(i,e,t){if(!i||!e||!e.length)return i;for(var r=i.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],c=(a||"").split("&"),u=[],h=0;h<c.length;h++){var p=c[h].split("=");I(p)&&(e.includes(p[0])?u.push(p[0]+"="+t):u.push(c[h]))}var _=l;return a!=null&&(_+="?"+u.join("&")),n!=null&&(_+="#"+n),_},ei=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},ia=d!=null&&d.location?ei(d.location.hash,"__posthog")||ei(location.hash,"state"):null,ks="_postHogToolbarParams",Ss=N("[Toolbar]"),Fe=(function(i){return i[i.UNINITIALIZED=0]="UNINITIALIZED",i[i.LOADING=1]="LOADING",i[i.LOADED=2]="LOADED",i})(Fe||{}),dr=class{constructor(e){this.instance=e}K(e){E.ph_toolbar_state=e}Y(){var e;return(e=E.ph_toolbar_state)!==null&&e!==void 0?e:Fe.UNINITIALIZED}maybeLoadToolbar(e,t,r){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),r===void 0&&(r=void 0),Sn(this.instance.config)||!d||!m)return!1;e=e??d.location,r=r??d.history;try{if(!t){try{d.localStorage.setItem("test","test"),d.localStorage.removeItem("test")}catch{return!1}t=d?.localStorage}var s,n=ia||ei(e.hash,"__posthog")||ei(e.hash,"state"),o=n?gs((()=>JSON.parse(atob(decodeURIComponent(n)))))||gs((()=>JSON.parse(decodeURIComponent(n)))):null;return o&&o.action==="ph_authorize"?((s=o).source="url",s&&Object.keys(s).length>0&&(o.desiredHash?e.hash=o.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(ks)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}X(e){var t=E.ph_load_toolbar||E.ph_load_editor;!$(t)&&be(t)?t(e,this.instance):Ss.warn("No toolbar load function found")}loadToolbar(e){var t=!(m==null||!m.getElementById(On));if(!d||t)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=f({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(d.localStorage.setItem(ks,JSON.stringify(f({},s,{source:void 0}))),this.Y()===Fe.LOADED)this.X(s);else if(this.Y()===Fe.UNINITIALIZED){var n;this.K(Fe.LOADING),(n=E.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"toolbar",(o=>{if(o)return Ss.error("[Toolbar] Failed to load",o),void this.K(Fe.UNINITIALIZED);this.K(Fe.LOADED),this.X(s)})),j(d,"turbolinks:load",(()=>{this.K(Fe.UNINITIALIZED),this.loadToolbar(s)}))}return!0}Z(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,r){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(e,t,r)}},ti=class{constructor(e){this.tt=(t,r,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength)&&(b.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.it=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.et()}et(){var e;this.rt=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.tt)}destroy(){var e;(e=this.rt)==null||e.call(this),this.rt=void 0}doPageView(e,t){var r,s=this.st(e,t);return this.it={pathname:(r=d?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.st(e,(t=this.it)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.it)==null?void 0:e.pageViewId}}st(e,t){var r=this.it;if(!r)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:r.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:h}=n;if(!(y(o)||y(a)||y(l)||y(c)||y(u)||y(h))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),h=Math.ceil(h);var p=o<=1?1:pe(a/o,0,1,b),_=o<=1?1:pe(l/o,0,1,b),g=c<=1?1:pe(u/c,0,1,b),v=c<=1?1:pe(h/c,0,1,b);s=U(s,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:_,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:v})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),s}};var ye=(function(i){return i.GZipJS="gzip-js",i.Base64="base64",i})({}),oe=Uint8Array,K=Uint16Array,rt=Uint32Array,Br=new oe([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]),Vr=new oe([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]),Ps=new oe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Cn=function(i,e){for(var t=new K(31),r=0;r<31;++r)t[r]=e+=1<<i[r-1];var s=new rt(t[30]);for(r=1;r<30;++r)for(var n=t[r];n<t[r+1];++n)s[n]=n-t[r]<<5|r;return[t,s]},An=Cn(Br,2),ra=An[0],pr=An[1];ra[28]=258,pr[258]=28;for(_r=Cn(Vr,0)[1],ii=new K(32768),M=0;M<32768;++M)Oe=(43690&M)>>>1|(21845&M)<<1,Oe=(61680&(Oe=(52428&Oe)>>>2|(13107&Oe)<<2))>>>4|(3855&Oe)<<4,ii[M]=((65280&Oe)>>>8|(255&Oe)<<8)>>>1;var Oe,_r,ii,M,xt=function(i,e,t){for(var r=i.length,s=0,n=new K(e);s<r;++s)++n[i[s]-1];var o,a=new K(e);for(s=0;s<e;++s)a[s]=a[s-1]+n[s-1]<<1;if(t){o=new K(1<<e);var l=15-e;for(s=0;s<r;++s)if(i[s])for(var c=s<<4|i[s],u=e-i[s],h=a[i[s]-1]++<<u,p=h|(1<<u)-1;h<=p;++h)o[ii[h]>>>l]=c}else for(o=new K(r),s=0;s<r;++s)o[s]=ii[a[i[s]-1]++]>>>15-i[s];return o},je=new oe(288);for(M=0;M<144;++M)je[M]=8;for(M=144;M<256;++M)je[M]=9;for(M=256;M<280;++M)je[M]=7;for(M=280;M<288;++M)je[M]=8;var ri=new oe(32);for(M=0;M<32;++M)ri[M]=5;var sa=xt(je,9,0),na=xt(ri,5,0),Mn=function(i){return(i/8>>0)+(7&i&&1)},Dn=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var r=new(i instanceof K?K:i instanceof rt?rt:oe)(t-e);return r.set(i.subarray(e,t)),r},ge=function(i,e,t){t<<=7&e;var r=e/8>>0;i[r]|=t,i[r+1]|=t>>>8},lt=function(i,e,t){t<<=7&e;var r=e/8>>0;i[r]|=t,i[r+1]|=t>>>8,i[r+2]|=t>>>16},wi=function(i,e){for(var t=[],r=0;r<i.length;++r)i[r]&&t.push({s:r,f:i[r]});var s=t.length,n=t.slice();if(!s)return[new oe(0),0];if(s==1){var o=new oe(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort((function(x,L){return x.f-L.f})),t.push({s:-1,f:25001});var a=t[0],l=t[1],c=0,u=1,h=2;for(t[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=t[t[c].f<t[h].f?c++:h++],l=t[c!=u&&t[c].f<t[h].f?c++:h++],t[u++]={s:-1,f:a.f+l.f,l:a,r:l};var p=n[0].s;for(r=1;r<s;++r)n[r].s>p&&(p=n[r].s);var _=new K(p+1),g=gr(t[u-1],_,0);if(g>e){r=0;var v=0,w=g-e,S=1<<w;for(n.sort((function(x,L){return _[L.s]-_[x.s]||x.f-L.f}));r<s;++r){var k=n[r].s;if(!(_[k]>e))break;v+=S-(1<<g-_[k]),_[k]=e}for(v>>>=w;v>0;){var R=n[r].s;_[R]<e?v-=1<<e-_[R]++-1:++r}for(;r>=0&&v;--r){var T=n[r].s;_[T]==e&&(--_[T],++v)}g=e}return[new oe(_),g]},gr=function(i,e,t){return i.s==-1?Math.max(gr(i.l,e,t+1),gr(i.r,e,t+1)):e[i.s]=t},Ts=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new K(++e),r=0,s=i[0],n=1,o=function(l){t[r++]=l},a=1;a<=e;++a)if(i[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=i[a]}return[t.subarray(0,r),e]},ct=function(i,e){for(var t=0,r=0;r<e.length;++r)t+=i[r]*e[r];return t},vr=function(i,e,t){var r=t.length,s=Mn(e+2);i[s]=255&r,i[s+1]=r>>>8,i[s+2]=255^i[s],i[s+3]=255^i[s+1];for(var n=0;n<r;++n)i[s+n+4]=t[n];return 8*(s+4+r)},Rs=function(i,e,t,r,s,n,o,a,l,c,u){ge(e,u++,t),++s[256];for(var h=wi(s,15),p=h[0],_=h[1],g=wi(n,15),v=g[0],w=g[1],S=Ts(p),k=S[0],R=S[1],T=Ts(v),x=T[0],L=T[1],F=new K(19),P=0;P<k.length;++P)F[31&k[P]]++;for(P=0;P<x.length;++P)F[31&x[P]]++;for(var Z=wi(F,7),z=Z[0],te=Z[1],ie=19;ie>4&&!z[Ps[ie-1]];--ie);var _e,le,ce,qe,Se=c+5<<3,De=ct(s,je)+ct(n,ri)+o,ue=ct(s,p)+ct(n,v)+o+14+3*ie+ct(F,z)+(2*F[16]+3*F[17]+7*F[18]);if(Se<=De&&Se<=ue)return vr(e,u,i.subarray(l,l+c));if(ge(e,u,1+(ue<De)),u+=2,ue<De){_e=xt(p,_,0),le=p,ce=xt(v,w,0),qe=v;var Pe=xt(z,te,0);for(ge(e,u,R-257),ge(e,u+5,L-1),ge(e,u+10,ie-4),u+=14,P=0;P<ie;++P)ge(e,u+3*P,z[Ps[P]]);u+=3*ie;for(var Be=[k,x],G=0;G<2;++G){var re=Be[G];for(P=0;P<re.length;++P){var Q=31&re[P];ge(e,u,Pe[Q]),u+=z[Q],Q>15&&(ge(e,u,re[P]>>>5&127),u+=re[P]>>>12)}}}else _e=sa,le=je,ce=na,qe=ri;for(P=0;P<a;++P)if(r[P]>255){Q=r[P]>>>18&31,lt(e,u,_e[Q+257]),u+=le[Q+257],Q>7&&(ge(e,u,r[P]>>>23&31),u+=Br[Q]);var Ve=31&r[P];lt(e,u,ce[Ve]),u+=qe[Ve],Ve>3&&(lt(e,u,r[P]>>>5&8191),u+=Vr[Ve])}else lt(e,u,_e[r[P]]),u+=le[r[P]];return lt(e,u,_e[256]),u+le[256]},oa=new rt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),aa=(function(){for(var i=new rt(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i})(),la=function(i,e,t,r,s){return(function(n,o,a,l,c,u){var h=n.length,p=new oe(l+h+5*(1+Math.floor(h/7e3))+c),_=p.subarray(l,p.length-c),g=0;if(!o||h<8)for(var v=0;v<=h;v+=65535){var w=v+65535;w<h?g=vr(_,g,n.subarray(v,w)):(_[v]=u,g=vr(_,g,n.subarray(v,h)))}else{for(var S=oa[o-1],k=S>>>13,R=8191&S,T=(1<<a)-1,x=new K(32768),L=new K(T+1),F=Math.ceil(a/3),P=2*F,Z=function(gi){return(n[gi]^n[gi+1]<<F^n[gi+2]<<P)&T},z=new rt(25e3),te=new K(288),ie=new K(32),_e=0,le=0,ce=(v=0,0),qe=0,Se=0;v<h;++v){var De=Z(v),ue=32767&v,Pe=L[De];if(x[ue]=Pe,L[De]=ue,qe<=v){var Be=h-v;if((_e>7e3||ce>24576)&&Be>423){g=Rs(n,_,0,z,te,ie,le,ce,Se,v-Se,g),ce=_e=le=0,Se=v;for(var G=0;G<286;++G)te[G]=0;for(G=0;G<30;++G)ie[G]=0}var re=2,Q=0,Ve=R,Te=ue-Pe&32767;if(Be>2&&De==Z(v-Te))for(var ao=Math.min(k,Be)-1,lo=Math.min(32767,v),co=Math.min(258,Be);Te<=lo&&--Ve&&ue!=Pe;){if(n[v+re]==n[v+re-Te]){for(var Re=0;Re<co&&n[v+Re]==n[v+Re-Te];++Re);if(Re>re){if(re=Re,Q=Te,Re>ao)break;var uo=Math.min(Te,Re-2),Yr=0;for(G=0;G<uo;++G){var _i=v-Te+G+32768&32767,Kr=_i-x[_i]+32768&32767;Kr>Yr&&(Yr=Kr,Pe=_i)}}}Te+=(ue=Pe)-(Pe=x[ue])+32768&32767}if(Q){z[ce++]=268435456|pr[re]<<18|_r[Q];var Xr=31&pr[re],Jr=31&_r[Q];le+=Br[Xr]+Vr[Jr],++te[257+Xr],++ie[Jr],qe=v+re,++_e}else z[ce++]=n[v],++te[n[v]]}}g=Rs(n,_,u,z,te,ie,le,ce,Se,v-Se,g)}return Dn(p,0,l+Mn(g)+c)})(i,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+e.mem,t,r,!0)},Ei=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};function ca(i,e){e===void 0&&(e={});var t=(function(){var a=4294967295;return{p:function(l){for(var c=a,u=0;u<l.length;++u)c=aa[255&c^l[u]]^c>>>8;a=c},d:function(){return 4294967295^a}}})(),r=i.length;t.p(i);var s,n=la(i,e,10+((s=e).filename&&s.filename.length+1||0),8),o=n.length;return(function(a,l){var c=l.filename;if(a[0]=31,a[1]=139,a[2]=8,a[8]=l.level<2?4:l.level==9?2:0,a[9]=3,l.mtime!=0&&Ei(a,4,Math.floor(new Date(l.mtime||Date.now())/1e3)),c){a[3]=8;for(var u=0;u<=c.length;++u)a[u+10]=c.charCodeAt(u)}})(n,e),Ei(n,o-8,t.d()),Ei(n,o-4,r),n}var ua=function(i){var e,t,r,s,n="";for(e=t=0,r=(i=(i+"").replace(/\r\n/g,`
4
- `).replace(/\r/g,`
5
- `)).length,s=0;s<r;s++){var o=i.charCodeAt(s),a=null;o<128?t++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),ae(a)||(t>e&&(n+=i.substring(e,t)),n+=a,e=t=s+1)}return t>e&&(n+=i.substring(e,i.length)),n},ha=!!Ai||!!Ci,Os="text/plain",si=function(i,e,t){var r;t===void 0&&(t=!0);var[s,n]=i.split("?"),o=f({},e),a=(r=n?.split("&").map((c=>{var u,[h,p]=c.split("="),_=t&&(u=o[h])!==null&&u!==void 0?u:p;return delete o[h],h+"="+_})))!==null&&r!==void 0?r:[],l=ta(o);return l&&a.push(l),s+"?"+a.join("&")},bt=(i,e)=>JSON.stringify(i,((t,r)=>typeof r=="bigint"?r.toString():r),e),xi=i=>{var{data:e,compression:t}=i;if(e){if(t===ye.GZipJS){var r=ca((function(l,c){var u=l.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(l);for(var h=new oe(l.length+(l.length>>>1)),p=0,_=function(S){h[p++]=S},g=0;g<u;++g){if(p+5>h.length){var v=new oe(p+8+(u-g<<1));v.set(h),h=v}var w=l.charCodeAt(g);w<128||c?_(w):w<2048?(_(192|w>>>6),_(128|63&w)):w>55295&&w<57344?(_(240|(w=65536+(1047552&w)|1023&l.charCodeAt(++g))>>>18),_(128|w>>>12&63),_(128|w>>>6&63),_(128|63&w)):(_(224|w>>>12),_(128|w>>>6&63),_(128|63&w))}return Dn(h,0,p)})(bt(e)),{mtime:0}),s=new Blob([r],{type:Os});return{contentType:Os,body:s,estimatedSize:s.size}}if(t===ye.Base64){var n=(function(l){var c,u,h,p,_,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",v=0,w=0,S="",k=[];if(!l)return l;l=ua(l);do c=(_=l.charCodeAt(v++)<<16|l.charCodeAt(v++)<<8|l.charCodeAt(v++))>>18&63,u=_>>12&63,h=_>>6&63,p=63&_,k[w++]=g.charAt(c)+g.charAt(u)+g.charAt(h)+g.charAt(p);while(v<l.length);switch(S=k.join(""),l.length%3){case 1:S=S.slice(0,-2)+"==";break;case 2:S=S.slice(0,-1)+"="}return S})(bt(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:bt(l)))(n);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=bt(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},qt=[];Ci&&qt.push({transport:"fetch",method:i=>{var e,t,{contentType:r,body:s,estimatedSize:n}=(e=xi(i))!==null&&e!==void 0?e:{},o=new Headers;A(i.headers,(function(u,h){o.append(h,u)})),r&&o.append("Content-Type",r);var a=i.url,l=null;if(ns){var c=new ns;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),i.timeout)}}Ci(a,f({method:i?.method||"GET",headers:o,keepalive:i.method==="POST"&&(n||0)<52428.8,body:s,signal:(t=l)==null?void 0:t.signal},i.fetchOptions)).then((u=>u.text().then((h=>{var p={statusCode:u.status,text:h};if(u.status===200)try{p.json=JSON.parse(h)}catch(_){b.error(_)}i.callback==null||i.callback(p)})))).catch((u=>{b.error(u),i.callback==null||i.callback({statusCode:0,error:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),Ai&&qt.push({transport:"XHR",method:i=>{var e,t=new Ai;t.open(i.method||"GET",i.url,!0);var{contentType:r,body:s}=(e=xi(i))!==null&&e!==void 0?e:{};A(i.headers,(function(n,o){t.setRequestHeader(o,n)})),r&&t.setRequestHeader("Content-Type",r),i.timeout&&(t.timeout=i.timeout),i.disableXHRCredentials||(t.withCredentials=!0),t.onreadystatechange=()=>{if(t.readyState===4){var n={statusCode:t.status,text:t.responseText};if(t.status===200)try{n.json=JSON.parse(t.responseText)}catch{}i.callback==null||i.callback(n)}},t.send(s)}}),ee!=null&&ee.sendBeacon&&qt.push({transport:"sendBeacon",method:i=>{var e=si(i.url,{beacon:"1"});try{var t,{contentType:r,body:s}=(t=xi(i))!==null&&t!==void 0?t:{},n=typeof s=="string"?new Blob([s],{type:r}):s;ee.sendBeacon(e,n)}catch{}}});var ni=function(i,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(i)}catch{return!1}};function $s(i,e,t){return bt({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Nn={exact:(i,e)=>e.some((t=>i.some((r=>t===r)))),is_not:(i,e)=>e.every((t=>i.every((r=>t!==r)))),regex:(i,e)=>e.some((t=>i.some((r=>ni(t,r))))),not_regex:(i,e)=>e.every((t=>i.every((r=>!ni(t,r))))),icontains:(i,e)=>e.map(Ut).some((t=>i.map(Ut).some((r=>t.includes(r))))),not_icontains:(i,e)=>e.map(Ut).every((t=>i.map(Ut).every((r=>!t.includes(r))))),gt:(i,e)=>e.some((t=>{var r=parseFloat(t);return!isNaN(r)&&i.some((s=>r>parseFloat(s)))})),lt:(i,e)=>e.some((t=>{var r=parseFloat(t);return!isNaN(r)&&i.some((s=>r<parseFloat(s)))}))},Ut=i=>i.toLowerCase();function Ln(i,e){return!i||Object.entries(i).every((t=>{var[r,s]=t,n=e?.[r];if(y(n)||ae(n))return!1;var o=[String(n)],a=Nn[s.operator];return!!a&&a(s.values,o)}))}var ki=N("[Error tracking]"),fr=class{constructor(e){var t,r;this.nt=[],this.ot=new qi([new Vi,new Ji,new zi,new Wi,new Ki,new Yi,new Gi,new Xi],Lo()),this._instance=e,this.nt=(t=(r=this._instance.persistence)==null?void 0:r.get_property(Qi))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,r,s;if("errorTracking"in e){var n=(t=(r=e.errorTracking)==null?void 0:r.suppressionRules)!==null&&t!==void 0?t:[],o=(s=e.errorTracking)==null?void 0:s.captureExtensionExceptions;this.nt=n,this._instance.persistence&&this._instance.persistence.register({[Qi]:this.nt,[ms]:o})}}get ut(){var e,t=!!this._instance.get_property(ms),r=this._instance.config.error_tracking.captureExtensionExceptions;return(e=r??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.ot.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.ht(t)){if(this.dt(t))return void ki.info("Skipping exception capture because a suppression rule matched");if(!this.ut&&this.vt(t))return void ki.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ct(t))return void ki.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",ft:!0})}dt(e){if(e.length===0)return!1;var t=e.reduce(((r,s)=>{var{type:n,value:o}=s;return H(n)&&n.length>0&&r.$exception_types.push(n),H(o)&&o.length>0&&r.$exception_values.push(o),r}),{$exception_types:[],$exception_values:[]});return this.nt.some((r=>{var s=r.values.map((n=>{var o,a=Nn[n.operator],l=I(n.value)?n.value:[n.value],c=(o=t[n.key])!==null&&o!==void 0?o:[];return l.length>0&&a(l,c)}));return r.type==="OR"?s.some(Boolean):s.every(Boolean)}))}vt(e){return e.flatMap((t=>{var r,s;return(r=(s=t.stacktrace)==null?void 0:s.frames)!==null&&r!==void 0?r:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ct(e){if(e.length>0){var t,r,s,n,o=(t=(r=e[0].stacktrace)==null?void 0:r.frames)!==null&&t!==void 0?t:[],a=o[o.length-1];return(s=a==null||(n=a.filename)==null?void 0:n.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}ht(e){return!$(e)&&I(e)}},jt="https?://(.*)",st=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],da=it(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],st),It="<masked>",pa=["li_fat_id"];function Un(i,e,t){if(!m)return{};var r,s=e?it([],st,t||[]):[],n=jn($t(m.URL,s,It),i),o=(r={},A(pa,(function(a){var l=de.A(a);r[a]=l||null})),r);return U(o,n)}function jn(i,e){var t=da.concat(e||[]),r={};return A(t,(function(s){var n=Qt(i,s);r[s]=n||null})),r}function Hn(i){var e=(function(n){return n?n.search(jt+"google.([^/?]*)")===0?"google":n.search(jt+"bing.com")===0?"bing":n.search(jt+"yahoo.com")===0?"yahoo":n.search(jt+"duckduckgo.com")===0?"duckduckgo":null:null})(i),t=e!="yahoo"?"q":"p",r={};if(!ae(e)){r.$search_engine=e;var s=m?Qt(m.referrer,t):"";s.length&&(r.ph_keyword=s)}return r}function Is(){return navigator.language||navigator.userLanguage}function qn(){return m?.referrer||"$direct"}function Bn(i,e){var t=i?it([],st,e||[]):[],r=V?.href.substring(0,1e3);return{r:qn().substring(0,1e3),u:r?$t(r,t,It):void 0}}function Vn(i){var e,{r:t,u:r}=i,s={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Zt(t))==null?void 0:e.host};if(r){s.$current_url=r;var n=Zt(r);s.$host=n?.host,s.$pathname=n?.pathname;var o=jn(r);U(s,o)}if(t){var a=Hn(t);U(s,a)}return s}function Wn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function _a(){try{return new Date().getTimezoneOffset()}catch{return}}function ga(i,e){var t,r;if(!J)return{};var s,n,o=i?it([],st,e||[]):[],[a,l]=(function(S){for(var k=0;k<us.length;k++){var[R,T]=us[k],x=R.exec(S),L=x&&(be(T)?T(x,S):T);if(L)return L}return["",""]})(J),c=(s=hs(J))===on||s===nn||s==="Kobo"||s==="Kindle Fire"||s===yn?Pt:s===Rt||s===Qe||s===Ot||s===ji?"Console":s===ln?"Wearable":s?ne:"Desktop";if(c==="Desktop"&&((t=navigator)==null||(t=t.userAgentData)==null?void 0:t.platform)==="Android"&&((r=navigator)==null?void 0:r.maxTouchPoints)>0){var u,h,p,_,g,v=(u=d==null||(h=d.screen)==null?void 0:h.width)!==null&&u!==void 0?u:0,w=(p=d==null||(_=d.screen)==null?void 0:_.height)!==null&&p!==void 0?p:0;c=Math.min(v,w)/((g=d?.devicePixelRatio)!==null&&g!==void 0?g:1)>=600?"Tablet":"Mobile"}return U(qr({$os:a,$os_version:l,$browser:bn(J,navigator.vendor),$device:hs(J),$device_type:c,$timezone:Wn(),$timezone_offset:_a()}),{$current_url:$t(V?.href,o,It),$host:V?.host,$pathname:V?.pathname,$raw_user_agent:J.length>1e3?J.substring(0,997)+"...":J,$browser_version:Ro(J,navigator.vendor),$browser_language:Is(),$browser_language_prefix:(n=Is(),typeof n=="string"?n.split("-")[0]:void 0),$screen_height:d?.screen.height,$screen_width:d?.screen.width,$viewport_height:d?.innerHeight,$viewport_width:d?.innerWidth,$lib:"web",$lib_version:ve.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var X=N("[FeatureFlags]"),ut=N("[FeatureFlags]",{debugEnabled:!0}),va="errors_while_computing_flags",fa="flag_missing",ma="quota_limited",ya="timeout",ba="connection_error",wa="unknown_error",Ea=i=>"api_error_"+i,Si="$active_feature_flags",We="$override_feature_flags",Fs="$feature_flag_payloads",ht="$override_feature_flag_payloads",Cs="$feature_flag_request_id",As=i=>{var e={};for(var[t,r]of Ht(i||{}))r&&(e[t]=r);return e},xa=i=>{var e=i.flags;return e?(i.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var r;return[t,(r=e[t].variant)!==null&&r!==void 0?r:e[t].enabled]}))),i.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var r;return(r=e[t].metadata)==null?void 0:r.payload})).map((t=>{var r;return[t,(r=e[t].metadata)==null?void 0:r.payload]})))):X.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),i},ka=(function(i){return i.FeatureFlags="feature_flags",i.Recordings="recordings",i})({}),mr=class{constructor(e){this._t=!1,this.bt=!1,this.yt=!1,this.wt=!1,this.xt=!1,this.$t=!1,this.Et=!1,this.St=!1,this._instance=e,this.featureFlagEventHandlers=[]}kt(){var e,t;return(e=(t=this._instance.persistence)==null?void 0:t.Pt(this._instance.config.feature_flag_cache_ttl_ms))!==null&&e!==void 0&&e}Tt(){return!!this.kt()&&(this.St||this.yt||(this.St=!0,X.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ct(){var e,t=(e=this._instance.config.evaluation_contexts)!==null&&e!==void 0?e:this._instance.config.evaluation_environments;return!this._instance.config.evaluation_environments||this._instance.config.evaluation_contexts||this.Et||(X.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Et=!0),t!=null&&t.length?t.filter((r=>{var s=r&&typeof r=="string"&&r.trim().length>0;return s||X.error("Invalid evaluation context found:",r,"Expected non-empty string"),s})):[]}It(){return this.Ct().length>0}get hasLoadedFlags(){return this.bt}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(er),t=this._instance.get_property(We),r=this._instance.get_property(ht);if(!r&&!t)return e||{};var s=U({},e||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(var o of n){var a,l,c=s[o],u=t?.[o],h=y(u)?(a=c?.enabled)!==null&&a!==void 0&&a:!!u,p=y(u)?c.variant:typeof u=="string"?u:void 0,_=r?.[o],g=f({},c,{enabled:h,variant:h?p??c?.variant:void 0});h!==c?.enabled&&(g.original_enabled=c?.enabled),p!==c?.variant&&(g.original_variant=c?.variant),_&&(g.metadata=f({},c?.metadata,{payload:_,original_payload:c==null||(l=c.metadata)==null?void 0:l.payload})),s[o]=g}return this._t||(X.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:s}),this._t=!0),s}getFlagVariants(){var e=this._instance.get_property(Je),t=this._instance.get_property(We);if(!t)return e||{};for(var r=U({},e),s=Object.keys(t),n=0;n<s.length;n++)r[s[n]]=t[s[n]];return this._t||(X.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this._t=!0),r}getFlagPayloads(){var e=this._instance.get_property(Fs),t=this._instance.get_property(ht);if(!t)return e||{};for(var r=U({},e||{}),s=Object.keys(t),n=0;n<s.length;n++)r[s[n]]=t[s[n]];return this._t||(X.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this._t=!0),r}reloadFeatureFlags(){this.wt||this._instance.config.advanced_disable_feature_flags||this.Rt||(this._instance.Ft.emit("featureFlagsReloading",!0),this.Rt=setTimeout((()=>{this.Ot()}),5))}Mt(){clearTimeout(this.Rt),this.Rt=void 0}ensureFlagsLoaded(){this.bt||this.yt||this.Rt||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.wt=e}Ot(e){var t;if(this.Mt(),!this._instance.At())if(this.yt)this.xt=!0;else{var r=this._instance.config.token,s=this._instance.get_property("$device_id"),n={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:f({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(yt)||{}),group_properties:this._instance.get_property(Le),timezone:Wn()};ae(s)||y(s)||(n.$device_id=s),(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.It()&&(n.evaluation_contexts=this.Ct());var o=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+o);this.yt=!0,this._instance._send_request({method:"POST",url:a,data:n,compression:this._instance.config.disable_compression?void 0:ye.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var c,u,h,p=!0;if(l.statusCode===200&&(this.xt||(this.$anon_distinct_id=void 0),p=!1),this.yt=!1,!n.disable_flags||this.xt){this.$t=!p;var _=[];l.error?l.error instanceof Error?_.push(l.error.name==="AbortError"?ya:ba):_.push(wa):l.statusCode!==200&&_.push(Ea(l.statusCode)),(c=l.json)!=null&&c.errorsWhileComputingFlags&&_.push(va);var g=!((u=l.json)==null||(u=u.quotaLimited)==null||!u.includes(ka.FeatureFlags));if(g&&_.push(ma),(h=this._instance.persistence)==null||h.register({[ir]:_}),g)X.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 v;n.disable_flags||this.receivedFeatureFlags((v=l.json)!==null&&v!==void 0?v:{},p),this.xt&&(this.xt=!1,this.Ot())}}}})}}getFeatureFlag(e,t){var r;if(t===void 0&&(t={}),!t.fresh||this.$t)if(this.bt||this.getFlags()&&this.getFlags().length>0){if(!this.Tt()){var s=this.getFeatureFlagResult(e,t);return(r=s?.variant)!==null&&r!==void 0?r:s?.enabled}}else X.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t){if(t===void 0&&(t={}),!t.fresh||this.$t)if(this.bt||this.getFlags()&&this.getFlags().length>0){if(!this.Tt()){var r=this.getFlagVariants(),s=e in r,n=r[e],o=this.getFlagPayloads()[e],a=String(n),l=this._instance.get_property(Cs)||void 0,c=this._instance.get_property(Yt)||void 0,u=this._instance.get_property(Gt)||{};if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){var h,p,_,g,v,w,S,k,R,T;I(u[e])?u[e].push(a):u[e]=[a],(h=this._instance.persistence)==null||h.register({[Gt]:u});var x=this.getFeatureFlagDetails(e),L=[...(p=this._instance.get_property(ir))!==null&&p!==void 0?p:[]];y(n)&&L.push(fa);var F={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:o||null,$feature_flag_request_id:l,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:((_=this._instance.config.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[e])||null,$feature_flag_bootstrapped_payload:((g=this._instance.config.bootstrap)==null||(g=g.featureFlagPayloads)==null?void 0:g[e])||null,$used_bootstrap_value:!this.$t};y(x==null||(v=x.metadata)==null?void 0:v.version)||(F.$feature_flag_version=x.metadata.version);var P,Z=(w=x==null||(S=x.reason)==null?void 0:S.description)!==null&&w!==void 0?w:x==null||(k=x.reason)==null?void 0:k.code;Z&&(F.$feature_flag_reason=Z),x!=null&&(R=x.metadata)!=null&&R.id&&(F.$feature_flag_id=x.metadata.id),y(x?.original_variant)&&y(x?.original_enabled)||(F.$feature_flag_original_response=y(x.original_variant)?x.original_enabled:x.original_variant),x!=null&&(T=x.metadata)!=null&&T.original_payload&&(F.$feature_flag_original_payload=x==null||(P=x.metadata)==null?void 0:P.original_payload),L.length&&(F.$feature_flag_error=L.join(",")),this._instance.capture("$feature_flag_called",F)}if(s){var z=o;if(!y(o))try{z=JSON.parse(o)}catch{}return{key:e,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:z}}}}else X.warn('getFeatureFlagResult for key "'+e+`" failed. Feature flags didn't load in time.`)}getRemoteConfigPayload(e,t){var r=this._instance.config.token,s={distinct_id:this._instance.get_distinct_id(),token:r};this.It()&&(s.evaluation_contexts=this.Ct()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this._instance.config.disable_compression?void 0:ye.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:n=>{var o,a=(o=n.json)==null?void 0:o.featureFlagPayloads;t(a?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),!t.fresh||this.$t){if(this.bt||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,t);return y(r)?void 0:!!r}X.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.bt=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(o,a,l,c,u){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var h=xa(o),p=h.flags,_=h.featureFlags,g=h.featureFlagPayloads;if(_){var v=o.requestId,w=o.evaluatedAt;if(I(_)){X.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var S={};if(_)for(var k=0;k<_.length;k++)S[_[k]]=!0;a&&a.register({[Si]:_,[Je]:S})}else{var R=_,T=g,x=p;if(o.errorsWhileComputingFlags)if(p){var L=new Set(Object.keys(p).filter((F=>{var P;return!((P=p[F])!=null&&P.failed)})));R=f({},l,Object.fromEntries(Object.entries(R).filter((F=>{var[P]=F;return L.has(P)})))),T=f({},c,Object.fromEntries(Object.entries(T||{}).filter((F=>{var[P]=F;return L.has(P)})))),x=f({},u,Object.fromEntries(Object.entries(x||{}).filter((F=>{var[P]=F;return L.has(P)}))))}else R=f({},l,R),T=f({},c,T),x=f({},u,x);a&&a.register(f({[Si]:Object.keys(As(R)),[Je]:R||{},[Fs]:T||{},[er]:x||{}},v?{[Cs]:v}:{},w?{[Yt]:w}:{}))}}})(e,this._instance.persistence,r,s,n),t||(this.St=!1),this.Dt(t)}}override(e,t){t===void 0&&(t=!1),X.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return X.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(We),this._instance.persistence.unregister(ht),this.Dt(),ut.info("All overrides cleared");if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,r=e;if(this._t=!!((t=r.suppressWarning)!==null&&t!==void 0&&t),"flags"in r){if(r.flags===!1)this._instance.persistence.unregister(We),ut.info("Flag overrides cleared");else if(r.flags){if(I(r.flags)){for(var s={},n=0;n<r.flags.length;n++)s[r.flags[n]]=!0;this._instance.persistence.register({[We]:s})}else this._instance.persistence.register({[We]:r.flags});ut.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this._instance.persistence.unregister(ht),ut.info("Payload overrides cleared")):r.payloads&&(this._instance.persistence.register({[ht]:r.payloads}),ut.info("Payload overrides set",{payloads:r.payloads}))),void this.Dt()}this.Dt()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.bt){var{flags:t,flagVariants:r}=this.jt();e(t,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var s,n=(this._instance.get_property(mt)||[]).find((c=>c.flagKey===e)),o={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:o};n&&(a.$early_access_feature_name=n.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=f({},this.getFlagVariants(),{[e]:t});(s=this._instance.persistence)==null||s.register({[Si]:Object.keys(As(l)),[Je]:l}),this.Dt()}getEarlyAccessFeatures(e,t,r){t===void 0&&(t=!1);var s=this._instance.get_property(mt),n=r?"&"+r.map((o=>"stage="+o)).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+n),method:"GET",callback:o=>{var a,l;if(o.json){var c=o.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(mt),(l=this._instance.persistence)==null||l.register({[mt]:c}),e(c)}}})}jt(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((r=>t[r])),flagVariants:Object.keys(t).filter((r=>t[r])).reduce(((r,s)=>(r[s]=t[s],r)),{})}}Dt(e){var{flags:t,flagVariants:r}=this.jt();this.featureFlagEventHandlers.forEach((s=>s(t,r,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var r=this._instance.get_property(yt)||{};this._instance.register({[yt]:f({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(yt)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var r=this._instance.get_property(Le)||{};Object.keys(r).length!==0&&Object.keys(r).forEach((s=>{r[s]=f({},r[s],e[s]),delete e[s]})),this._instance.register({[Le]:f({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(Le)||{};this._instance.register({[Le]:f({},t,{[e]:{}})})}else this._instance.unregister(Le)}reset(){this.bt=!1,this.yt=!1,this.wt=!1,this.xt=!1,this.$t=!1,this.$anon_distinct_id=void 0,this.Mt(),this._t=!1}},Sa=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],kt=class{constructor(e,t){this.N=e,this.props={},this.Lt=!1,this.Nt=(r=>{var s="";return r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+s+"_posthog"})(e),this.B=this.Ut(e),this.load(),e.debug&&b.info("Persistence loaded",e.persistence,f({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.zt}Ut(e){Sa.indexOf(e.persistence.toLowerCase())===-1&&(b.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=(function(s){s===void 0&&(s=[]);var n=[...Xo,...s];return f({},D,{D:function(o){try{var a={};try{a=de.D(o)||{}}catch{}var l=U(a,JSON.parse(D.A(o)||"{}"));return D.j(o,l),l}catch{}return null},j:function(o,a,l,c,u,h){try{D.j(o,a,void 0,void 0,h);var p={};n.forEach((_=>{a[_]&&(p[_]=a[_])})),Object.keys(p).length&&de.j(o,p,l,c,u,h)}catch(_){D.M(_)}},L:function(o,a){try{d?.localStorage.removeItem(o),de.L(o,a)}catch(l){D.M(l)}}})})(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return r==="localstorage"&&D.O()?D:r==="localstorage+cookie"&&t.O()?t:r==="sessionstorage"&&B.O()?B:r==="memory"?Jo:r==="cookie"?de:t.O()?t:de}Pt(e){var t=e??this.N.feature_flag_cache_ttl_ms;if(!t||t<=0)return!1;var r=this.props[Yt];return!r||typeof r!="number"||Date.now()-r>t}properties(){var e={};return A(this.props,((t,r)=>{if(r===Je&&q(t)){if(!this.Pt())for(var s=Object.keys(t),n=0;n<s.length;n++)e["$feature/"+s[n]]=t[s[n]]}else a=r,l=!1,(ae(o=zo)?l:ss&&o.indexOf===ss?o.indexOf(a)!=-1:(A(o,(function(c){if(l||(l=c===a))return Wt})),l))||(e[r]=t);var o,a,l})),e}load(){if(!this.zt){var e=this.B.D(this.Nt);e&&(this.props=U({},e))}}save(){this.zt||this.B.j(this.Nt,this.props,this.Ht,this.Bt,this.qt,this.N.debug)}remove(){this.B.L(this.Nt,!1),this.B.L(this.Nt,!0)}clear(){this.remove(),this.props={}}register_once(e,t,r){if(q(e)){y(t)&&(t="None"),this.Ht=y(r)?this.Wt:r;var s=!1;if(A(e,((n,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=n,s=!0)})),s)return this.save(),!0}return!1}register(e,t){if(q(e)){this.Ht=y(t)?this.Wt:t;var r=!1;if(A(e,((s,n)=>{e.hasOwnProperty(n)&&this.props[n]!==s&&(this.props[n]=s,r=!0)})),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Lt){var e=Un(this.N.custom_campaign_params,this.N.mask_personal_data_properties,this.N.custom_personal_data_properties);Xe(qr(e))||this.register(e),this.Lt=!0}}update_search_keyword(){var e;this.register((e=m?.referrer)?Hn(e):{})}update_referrer_info(){var e;this.register_once({$referrer:qn(),$referring_domain:m!=null&&m.referrer&&((e=Zt(m.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[nr]||this.props[or]||this.register_once({[Kt]:Bn(this.N.mask_personal_data_properties,this.N.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};A([or,nr],(o=>{var a=this.props[o];a&&A(a,(function(l,c){e["$initial_"+Mi(c)]=l}))}));var t,r,s=this.props[Kt];if(s){var n=(t=Vn(s),r={},A(t,(function(o,a){r["$initial_"+Mi(a)]=o})),r);U(e,n)}return e}safe_merge(e){return A(this.props,(function(t,r){r in e||(e[r]=t)})),e}update_config(e,t,r){if(this.Wt=this.Ht=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),c=[...a].sort();return l.every(((u,h)=>u===c[h]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[])){var s=this.Ut(e),n=this.props;this.clear(),this.B=s,this.props=n,this.save()}}set_disabled(e){this.zt=e,this.zt?this.remove():this.save()}set_cross_subdomain(e){e!==this.Bt&&(this.Bt=e,this.remove(),this.save())}set_secure(e){e!==this.qt&&(this.qt=e,this.remove(),this.save())}set_event_timer(e,t){var r=this.props[ft]||{};r[e]=t,this.props[ft]=r,this.save()}remove_event_timer(e){var t=(this.props[ft]||{})[e];return y(t)||(delete this.props[ft][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},dt=(function(i){return i.Activation="events",i.Cancellation="cancelEvents",i})({}),il=(function(i){return i.Button="button",i.Tab="tab",i.Selector="selector",i})({}),rl=(function(i){return i.TopLeft="top_left",i.TopRight="top_right",i.TopCenter="top_center",i.MiddleLeft="middle_left",i.MiddleRight="middle_right",i.MiddleCenter="middle_center",i.Left="left",i.Center="center",i.Right="right",i.NextToTrigger="next_to_trigger",i})({}),sl=(function(i){return i.Top="top",i.Left="left",i.Right="right",i.Bottom="bottom",i})({}),Pi=(function(i){return i.Popover="popover",i.API="api",i.Widget="widget",i.ExternalSurvey="external_survey",i})({}),nl=(function(i){return i.Open="open",i.MultipleChoice="multiple_choice",i.SingleChoice="single_choice",i.Rating="rating",i.Link="link",i})({}),ol=(function(i){return i.NextQuestion="next_question",i.End="end",i.ResponseBased="response_based",i.SpecificQuestion="specific_question",i})({}),al=(function(i){return i.Once="once",i.Recurring="recurring",i.Always="always",i})({}),wt=(function(i){return i.SHOWN="survey shown",i.DISMISSED="survey dismissed",i.SENT="survey sent",i.ABANDONED="survey abandoned",i})({}),Ti=(function(i){return i.SURVEY_ID="$survey_id",i.SURVEY_NAME="$survey_name",i.SURVEY_RESPONSE="$survey_response",i.SURVEY_ITERATION="$survey_iteration",i.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",i.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",i.SURVEY_SUBMISSION_ID="$survey_submission_id",i.SURVEY_QUESTIONS="$survey_questions",i.SURVEY_COMPLETED="$survey_completed",i.PRODUCT_TOUR_ID="$product_tour_id",i.SURVEY_LAST_SEEN_DATE="$survey_last_seen_date",i})({}),yr=(function(i){return i.Popover="popover",i.Inline="inline",i})({}),C=N("[Surveys]"),zn="seenSurvey_",Pa=(i,e)=>{var t="$survey_"+e+"/"+i.id;return i.current_iteration&&i.current_iteration>0&&(t="$survey_"+e+"/"+i.id+"/"+i.current_iteration),t},Ms=i=>((e,t)=>{var r=""+e+t.id;return t.current_iteration&&t.current_iteration>0&&(r=""+e+t.id+"_"+t.current_iteration),r})(zn,i),Ta=[Pi.Popover,Pi.Widget,Pi.API],Ra={ignoreConditions:!1,ignoreDelay:!1,displayType:yr.Popover},Ft=class{constructor(){this.Gt={},this.Gt={}}on(e,t){return this.Gt[e]||(this.Gt[e]=[]),this.Gt[e].push(t),()=>{this.Gt[e]=this.Gt[e].filter((r=>r!==t))}}emit(e,t){for(var r of this.Gt[e]||[])r(t);for(var s of this.Gt["*"]||[])s(e,t)}};function ze(i,e,t){if($(i))return!1;switch(t){case"exact":return i===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(i);case"regex":try{return new RegExp(e).test(i)}catch{return!1}default:return!1}}var br=class{constructor(e){this.Vt=new Ft,this.Jt=(t,r)=>this.Kt(t,r)&&this.Yt(t,r)&&this.Xt(t,r)&&this.Qt(t,r),this.Kt=(t,r)=>r==null||!r.event||t?.event===r?.event,this._instance=e,this.Zt=new Set,this.ti=new Set}init(){var e;if(!y((e=this._instance)==null?void 0:e._addCaptureHook)){var t;(t=this._instance)==null||t._addCaptureHook(((r,s)=>{this.on(r,s)}))}}register(e){var t,r;if(!y((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((o=>{var a,l;(a=this.ti)==null||a.add(o),(l=o.steps)==null||l.forEach((c=>{var u;(u=this.Zt)==null||u.add(c?.event||"")}))})),(r=this._instance)!=null&&r.autocapture)){var s,n=new Set;e.forEach((o=>{var a;(a=o.steps)==null||a.forEach((l=>{l!=null&&l.selector&&n.add(l?.selector)}))})),(s=this._instance)==null||s.autocapture.setElementSelectors(n)}}on(e,t){var r;t!=null&&e.length!=0&&(this.Zt.has(e)||this.Zt.has(t?.event))&&this.ti&&((r=this.ti)==null?void 0:r.size)>0&&this.ti.forEach((s=>{this.ii(t,s)&&this.Vt.emit("actionCaptured",s.name)}))}ei(e){this.onAction("actionCaptured",(t=>e(t)))}ii(e,t){if(t?.steps==null)return!1;for(var r of t.steps)if(this.Jt(e,r))return!0;return!1}onAction(e,t){return this.Vt.on(e,t)}Yt(e,t){if(t!=null&&t.url){var r,s=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!s||typeof s!="string"||!ze(s,t.url,t.url_matching||"contains"))return!1}return!0}Xt(e,t){return!!this.ri(e,t)&&!!this.si(e,t)&&!!this.ni(e,t)}ri(e,t){var r;if(t==null||!t.href)return!0;var s=this.oi(e);if(s.length>0)return s.some((a=>ze(a.href,t.href,t.href_matching||"exact")));var n,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&ze((n=o.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}si(e,t){var r;if(t==null||!t.text)return!0;var s=this.oi(e);if(s.length>0)return s.some((c=>ze(c.text,t.text,t.text_matching||"exact")||ze(c.$el_text,t.text,t.text_matching||"exact")));var n,o,a,l=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!l&&(n=(function(c){for(var u,h=[],p=/(?::|")text="(.*?)"/g;!$(u=p.exec(c));)h.includes(u[1])||h.push(u[1]);return h})(l),o=t.text,a=t.text_matching||"exact",n.some((c=>ze(c,o,a))))}ni(e,t){var r,s;if(t==null||!t.selector)return!0;var n=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var o=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(t.selector_regex&&o)try{return new RegExp(t.selector_regex).test(o)}catch{return!1}return!1}oi(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Qt(e,t){return t==null||!t.properties||t.properties.length===0||Ln(t.properties.reduce(((r,s)=>{var n=I(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return r[s.key]={values:n,operator:s.operator||"exact"},r}),{}),e?.properties)}},wr=class{constructor(e){this._instance=e,this.ai=new Map,this.li=new Map,this.ui=new Map}hi(e,t){return!!e&&Ln(e.propertyFilters,t?.properties)}di(e,t){var r=new Map;return e.forEach((s=>{var n;(n=s.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach((o=>{if(o!=null&&o.name){var a=r.get(o.name)||[];a.push(s.id),r.set(o.name,a)}}))})),r}vi(e,t,r){var s=(r===dt.Activation?this.ai:this.li).get(e),n=[];return this.ci((o=>{n=o.filter((a=>s?.includes(a.id)))})),n.filter((o=>{var a,l=(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null?void 0:a.find((c=>c.name===e));return this.hi(l,t)}))}register(e){var t;y((t=this._instance)==null?void 0:t._addCaptureHook)||(this.fi(e),this.pi(e))}pi(e){var t=e.filter((r=>{var s,n;return((s=r.conditions)==null?void 0:s.actions)&&((n=r.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.gi==null&&(this.gi=new br(this._instance),this.gi.init(),this.gi.ei((r=>{this.onAction(r)}))),t.forEach((r=>{var s,n,o,a,l;r.conditions&&(s=r.conditions)!=null&&s.actions&&(n=r.conditions)!=null&&(n=n.actions)!=null&&n.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.gi)==null||a.register(r.conditions.actions.values),(l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((c=>{if(c&&c.name){var u=this.ui.get(c.name);u&&u.push(r.id),this.ui.set(c.name,u||[r.id])}})))})))}fi(e){var t,r=e.filter((n=>{var o,a;return((o=n.conditions)==null?void 0:o.events)&&((a=n.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0})),s=e.filter((n=>{var o,a;return((o=n.conditions)==null?void 0:o.cancelEvents)&&((a=n.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0}));(r.length!==0||s.length!==0)&&((t=this._instance)==null||t._addCaptureHook(((n,o)=>{this.onEvent(n,o)})),this.ai=this.di(e,dt.Activation),this.li=this.di(e,dt.Cancellation))}onEvent(e,t){var r,s=this.mi(),n=this.bi(),o=this.yi(),a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[n])||[];if(o===e&&t&&a.length>0){var l,c;s.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:a});var u=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(u){var h=a.indexOf(u);h>=0&&(a.splice(h,1),this.wi(a))}}else{if(this.li.has(e)){var p=this.vi(e,t,dt.Cancellation);p.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:p.map((g=>g.id))}),p.forEach((g=>{var v=a.indexOf(g.id);v>=0&&a.splice(v,1),this.xi(g.id)})),this.wi(a))}if(this.ai.has(e)){s.info("event name matched",{event:e,eventPayload:t,items:this.ai.get(e)});var _=this.vi(e,t,dt.Activation);this.wi(a.concat(_.map((g=>g.id))||[]))}}}onAction(e){var t,r=this.bi(),s=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[r])||[];this.ui.has(e)&&this.wi(s.concat(this.ui.get(e)||[]))}wi(e){var t,r=this.mi(),s=this.bi(),n=[...new Set(e)].filter((o=>!this.$i(o)));r.info("updating activated items",{activatedItems:n}),(t=this._instance)==null||(t=t.persistence)==null||t.register({[s]:n})}getActivatedIds(){var e,t=this.bi(),r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t];return r||[]}getEventToItemsMap(){return this.ai}Ei(){return this.gi}},Er=class extends wr{constructor(e){super(e)}bi(){return"$surveys_activated"}yi(){return wt.SHOWN}ci(e){var t;(t=this._instance)==null||t.getSurveys(e)}xi(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}mi(){return C}$i(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},xr=class{constructor(e){this.Si=void 0,this._surveyManager=null,this.ki=!1,this.Pi=[],this.Ti=null,this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if($(t))return C.warn("Flags not loaded yet. Not loading surveys.");var r=I(t);this.Si=r?t.length>0:t,C.info("flags response received, isSurveysEnabled: "+this.Si),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var r=localStorage.key(t);(r!=null&&r.startsWith(zn)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((s=>localStorage.removeItem(s)))}loadIfEnabled(){if(!this._surveyManager)if(this.ki)C.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)C.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())C.info("Not loading surveys in cookieless mode without consent.");else{var e=E?.__PosthogExtensions__;if(e){if(!y(this.Si)||this._instance.config.advanced_enable_surveys){var t=this.Si||this._instance.config.advanced_enable_surveys;this.ki=!0;try{var r=e.generateSurveys;if(r)return void this.Ci(r,t);var s=e.loadExternalDependency;if(!s)return void this.Ii("PostHog loadExternalDependency extension not found.");s(this._instance,"surveys",(n=>{n||!e.generateSurveys?this.Ii("Could not load surveys script",n):this.Ci(e.generateSurveys,t)}))}catch(n){throw this.Ii("Error initializing surveys",n),n}finally{this.ki=!1}}}else C.error("PostHog Extensions not found.")}}Ci(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new Er(this._instance),C.info("Surveys loaded successfully"),this.Ri({isLoaded:!0})}Ii(e,t){C.error(e,t),this.Ri({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Pi.push(e),this._surveyManager&&this.Ri({isLoaded:!0}),()=>{this.Pi=this.Pi.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return C.info("Disabled. Not loading surveys."),e([]);var r,s=this._instance.get_property(tr);if(s&&!t)return e(s,{isLoaded:!0});typeof Promise<"u"&&this.Ti?this.Ti.then((n=>{var{surveys:o,context:a}=n;return e(o,a)})):(typeof Promise<"u"&&(this.Ti=new Promise((n=>{r=n}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:n=>{var o;this.Ti=null;var a=n.statusCode;if(a!==200||!n.json){var l="Surveys API could not be loaded, status: "+a;C.error(l);var c={isLoaded:!1,error:l};return e([],c),void(r==null||r({surveys:[],context:c}))}var u,h=n.json.surveys||[],p=h.filter((g=>(function(v){return!(!v.start_date||v.end_date)})(g)&&((function(v){var w;return!((w=v.conditions)==null||(w=w.events)==null||(w=w.values)==null||!w.length)})(g)||(function(v){var w;return!((w=v.conditions)==null||(w=w.actions)==null||(w=w.values)==null||!w.length)})(g))));p.length>0&&((u=this._surveyEventReceiver)==null||u.register(p)),(o=this._instance.persistence)==null||o.register({[tr]:h});var _={isLoaded:!0};e(h,_),r?.({surveys:h,context:_})}}))}Ri(e){for(var t of this.Pi)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(r){C.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!$(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);C.warn("init was not called")}Fi(e){var t=null;return this.getSurveys((r=>{var s;t=(s=r.find((n=>n.id===e)))!==null&&s!==void 0?s:null})),t}Oi(e){if($(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.Fi(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if($(this._surveyManager))return C.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.Oi(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return $(this._surveyManager)?(C.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((r=>{this.getSurveys((s=>{var n,o=(n=s.find((l=>l.id===e)))!==null&&n!==void 0?n:null;if(o){var a=this.Oi(o);r({visible:a.eligible,disabledReason:a.reason})}else r({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t,r){var s;if($(this._surveyManager))C.warn("init was not called");else{var n=typeof e=="string"?this.Fi(e):e;if(n!=null&&n.id)if(Ta.includes(n.type)){var o=m?.querySelector(t);if(o)return(s=n.appearance)!=null&&s.surveyPopupDelaySeconds?(C.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,l;C.info("Rendering survey "+n.id+" with delay of "+((a=n.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(l=this._surveyManager)==null||l.renderSurvey(n,o,r),C.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,o,r);C.warn("Survey element not found")}else C.warn("Surveys of type "+n.type+" cannot be rendered in the app");else C.warn("Survey not found")}}displaySurvey(e,t){var r;if($(this._surveyManager))C.warn("init was not called");else{var s=this.Fi(e);if(s){var n=s;if((r=s.appearance)!=null&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=f({},s,{appearance:f({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==yr.Popover&&t.initialResponses&&C.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){var o=this.canRenderSurvey(s);if(!o.visible)return void C.warn("Survey is not eligible to be displayed: ",o.disabledReason)}t.displayType!==yr.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}else C.warn("Survey not found")}}cancelPendingSurvey(e){$(this._surveyManager)?C.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;(e=this._surveyManager)==null||e.handlePageUnload()}},se=N("[Conversations]"),kr=class{constructor(e){this.Mi=void 0,this._conversationsManager=null,this.Ai=!1,this.Di=null,this._instance=e}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;$(t)||(Ee(t)?this.Mi=t:(this.Mi=t.enabled,this.Di=t),this.loadIfEnabled())}}reset(){var e;(e=this._conversationsManager)==null||e.reset(),this._conversationsManager=null,this.Mi=void 0,this.Di=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ai||this._instance.config.disable_conversations||Sn(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=E?.__PosthogExtensions__;if(e&&!y(this.Mi)&&this.Mi)if(this.Di&&this.Di.token){this.Ai=!0;try{var t=e.initConversations;if(t)return this.ji(t),void(this.Ai=!1);var r=e.loadExternalDependency;if(!r)return void this.Li("PostHog loadExternalDependency extension not found.");r(this._instance,"conversations",(s=>{s||!e.initConversations?this.Li("Could not load conversations script",s):this.ji(e.initConversations),this.Ai=!1}))}catch(s){this.Li("Error initializing conversations",s),this.Ai=!1}}else se.error("Conversations enabled but missing token in remote config.")}}ji(e){if(this.Di)try{this._conversationsManager=e(this.Di,this._instance),se.info("Conversations loaded successfully")}catch(t){this.Li("Error completing conversations initialization",t)}else se.error("Cannot complete initialization: remote config is null")}Li(e,t){se.error(e,t),this._conversationsManager=null,this.Ai=!1}show(){this._conversationsManager?this._conversationsManager.show():se.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Mi===!0&&!ae(this._conversationsManager)}isVisible(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,r){var s=this;return fe((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,r):(se.warn("Conversations not available yet."),null)}))()}getMessages(e,t){var r=this;return fe((function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(se.warn("Conversations not available yet."),null)}))()}markAsRead(e){var t=this;return fe((function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(se.warn("Conversations not available yet."),null)}))()}getTickets(e){var t=this;return fe((function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(se.warn("Conversations not available yet."),null)}))()}requestRestoreLink(e){var t=this;return fe((function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(se.warn("Conversations not available yet."),null)}))()}restoreFromToken(e){var t=this;return fe((function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(se.warn("Conversations not available yet."),null)}))()}restoreFromUrlToken(){var e=this;return fe((function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(se.warn("Conversations not available yet."),null)}))()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)==null?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}};var Oa=(function(i){return i.SHOWN="product tour shown",i.DISMISSED="product tour dismissed",i.COMPLETED="product tour completed",i.STEP_SHOWN="product tour step shown",i.STEP_COMPLETED="product tour step completed",i.BUTTON_CLICKED="product tour button clicked",i.STEP_SELECTOR_FAILED="product tour step selector failed",i.BANNER_CONTAINER_SELECTOR_FAILED="product tour banner container selector failed",i.BANNER_ACTION_CLICKED="product tour banner action clicked",i})({}),Ds=(function(i){return i.TOUR_ID="$product_tour_id",i.TOUR_NAME="$product_tour_name",i.TOUR_ITERATION="$product_tour_iteration",i.TOUR_RENDER_REASON="$product_tour_render_reason",i.TOUR_STEP_ID="$product_tour_step_id",i.TOUR_STEP_ORDER="$product_tour_step_order",i.TOUR_STEP_TYPE="$product_tour_step_type",i.TOUR_DISMISS_REASON="$product_tour_dismiss_reason",i.TOUR_BUTTON_TEXT="$product_tour_button_text",i.TOUR_BUTTON_ACTION="$product_tour_button_action",i.TOUR_BUTTON_LINK="$product_tour_button_link",i.TOUR_BUTTON_TOUR_ID="$product_tour_button_tour_id",i.TOUR_STEPS_COUNT="$product_tour_steps_count",i.TOUR_STEP_SELECTOR="$product_tour_step_selector",i.TOUR_STEP_SELECTOR_FOUND="$product_tour_step_selector_found",i.TOUR_STEP_ELEMENT_TAG="$product_tour_step_element_tag",i.TOUR_STEP_ELEMENT_ID="$product_tour_step_element_id",i.TOUR_STEP_ELEMENT_CLASSES="$product_tour_step_element_classes",i.TOUR_STEP_ELEMENT_TEXT="$product_tour_step_element_text",i.TOUR_ERROR="$product_tour_error",i.TOUR_MATCHES_COUNT="$product_tour_matches_count",i.TOUR_FAILURE_PHASE="$product_tour_failure_phase",i.TOUR_WAITED_FOR_ELEMENT="$product_tour_waited_for_element",i.TOUR_WAIT_DURATION_MS="$product_tour_wait_duration_ms",i.TOUR_BANNER_SELECTOR="$product_tour_banner_selector",i.TOUR_LINKED_SURVEY_ID="$product_tour_linked_survey_id",i.USE_MANUAL_SELECTOR="$use_manual_selector",i.INFERENCE_DATA_PRESENT="$inference_data_present",i.TOUR_LAST_SEEN_DATE="$product_tour_last_seen_date",i.TOUR_TYPE="$product_tour_type",i})({}),Sr=class{constructor(e){var t;this.Ni=!1,this.Ui=!1,this._instance=e,this._instance&&(t=this._instance.config.logs)!=null&&t.captureConsoleLogs&&(this.Ni=!0)}onRemoteConfig(e){var t,r=(t=e.logs)==null?void 0:t.captureConsoleLogs;!$(r)&&r&&(this.Ni=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Ni&&!this.Ui){var e=N("[logs]"),t=E?.__PosthogExtensions__;if(t){var r=t.loadExternalDependency;r?r(this._instance,"logs",(s=>{var n;s||(n=t.logs)==null||!n.initializeLogs?e.error("Could not load logs script",s):(t.logs.initializeLogs(this._instance),this.Ui=!0)})):e.error("PostHog loadExternalDependency extension not found.")}else e.error("PostHog Extensions not found.")}}},Ns=N("[RateLimiter]"),Pr=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var r=t.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach((s=>{Ns.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4}))}catch(s){return void Ns.warn('could not rate limit - continuing. Error: "'+s?.message+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,r,s;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(t=(r=this.instance.persistence)==null?void 0:r.get_property(sr))!==null&&t!==void 0?t:{tokens:n,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>n&&(l.tokens=n);var c=l.tokens<1;return c||e||(l.tokens=Math.max(0,l.tokens-1)),!c||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(s=this.instance.persistence)==null||s.set_property(sr,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},pt=N("[RemoteConfig]"),oi=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=E._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}zi(e){var t,r;(t=E.__PosthogExtensions__)!=null&&t.loadExternalDependency?(r=E.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Hi(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return pt.info("Using preloaded remote config",this.remoteConfig),this.Bi(this.remoteConfig),void this.qi();if(this._instance.At())return void pt.warn("Remote config is disabled. Falling back to local config.");this.zi((e=>{if(!e)return pt.info("No config found after loading remote JS config. Falling back to JSON."),void this.Hi((t=>{this.Bi(t),this.qi()}));this.Bi(e),this.qi()}))}catch(e){pt.error("Error loading remote config",e)}}stop(){this.Wi&&(clearInterval(this.Wi),this.Wi=void 0)}refresh(){this._instance.At()||m?.visibilityState==="hidden"||this._instance.featureFlags.reloadFeatureFlags()}qi(){var e;if(!this.Wi){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.Wi=setInterval((()=>{this.refresh()}),t))}}Bi(e){e||pt.error("Failed to fetch remote config from PostHog."),this._instance.Bi(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||this._instance.featureFlags.ensureFlagsLoaded())}},Tr=3e3,Rr=class{constructor(e,t){this.Gi=!0,this.Vi=[],this.Ji=pe(t?.flush_interval_ms||Tr,250,5e3,b.createLogger("flush interval"),Tr),this.Ki=e}enqueue(e){this.Vi.push(e),this.Yi||this.Xi()}unload(){this.Qi();var e=this.Vi.length>0?this.Zi():{},t=Object.values(e);[...t.filter((r=>r.url.indexOf("/e")===0)),...t.filter((r=>r.url.indexOf("/e")!==0))].map((r=>{this.Ki(f({},r,{transport:"sendBeacon"}))}))}enable(){this.Gi=!1,this.Xi()}Xi(){var e=this;this.Gi||(this.Yi=setTimeout((()=>{if(this.Qi(),this.Vi.length>0){var t=this.Zi(),r=function(){var n=t[s],o=new Date().getTime();n.data&&I(n.data)&&A(n.data,(a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp})),e.Ki(n)};for(var s in t)r()}}),this.Ji))}Qi(){clearTimeout(this.Yi),this.Yi=void 0}Zi(){var e={};return A(this.Vi,(t=>{var r,s=t,n=(s?s.batchKey:null)||s.url;y(e[n])&&(e[n]=f({},s,{data:[]})),(r=e[n].data)==null||r.push(s.data)})),this.Vi=[],e}},$a=["retriesPerformedSoFar"],Or=class{constructor(e){this.te=!1,this.ie=3e3,this.Vi=[],this._instance=e,this.Vi=[],this.ee=!0,!y(d)&&"onLine"in d.navigator&&(this.ee=d.navigator.onLine,this.re=()=>{this.ee=!0,this.se()},this.ne=()=>{this.ee=!1},j(d,"online",this.re),j(d,"offline",this.ne))}get length(){return this.Vi.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=en(e,$a);Ye(t)&&(r.url=si(r.url,{retry_count:t})),this._instance._send_request(f({},r,{callback:s=>{s.statusCode!==200&&(s.statusCode<400||s.statusCode>=500)&&(t??0)<10?this.oe(f({retriesPerformedSoFar:t},r)):r.callback==null||r.callback(s)}}))}oe(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var r=(function(o){var a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)})(t),s=Date.now()+r;this.Vi.push({retryAt:s,requestOptions:e});var n="Enqueued failed request for retry in "+r;navigator.onLine||(n+=" (Browser is offline)"),b.warn(n),this.te||(this.te=!0,this.ae())}ae(){if(this.le&&clearTimeout(this.le),this.Vi.length===0)return this.te=!1,void(this.le=void 0);this.le=setTimeout((()=>{this.ee&&this.Vi.length>0&&this.se(),this.ae()}),this.ie)}se(){var e=Date.now(),t=[],r=this.Vi.filter((n=>n.retryAt<e||(t.push(n),!1)));if(this.Vi=t,r.length>0)for(var{requestOptions:s}of r)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.le&&(clearTimeout(this.le),this.le=void 0),this.te=!1,y(d)||(this.re&&(d.removeEventListener("online",this.re),this.re=void 0),this.ne&&(d.removeEventListener("offline",this.ne),this.ne=void 0)),this.Vi))try{this._instance._send_request(f({},e,{transport:"sendBeacon"}))}catch(t){b.error(t)}this.Vi=[]}},$r=class{constructor(e){this.ue=()=>{var t,r,s,n;this.he||(this.he={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+(o?.clientHeight||0),u=o?.scrollHeight||0;this.he.lastScrollY=Math.ceil(a),this.he.maxScrollY=Math.max(a,(t=this.he.maxScrollY)!==null&&t!==void 0?t:0),this.he.maxScrollHeight=Math.max(l,(r=this.he.maxScrollHeight)!==null&&r!==void 0?r:0),this.he.lastContentY=c,this.he.maxContentY=Math.max(c,(s=this.he.maxContentY)!==null&&s!==void 0?s:0),this.he.maxContentHeight=Math.max(u,(n=this.he.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}getContext(){return this.he}resetContext(){var e=this.he;return setTimeout(this.ue,0),e}startMeasuringScrollPosition(){j(d,"scroll",this.ue,{capture:!0}),j(d,"scrollend",this.ue,{capture:!0}),j(d,"resize",this.ue)}scrollElement(){if(!this._instance.config.scroll_root_selector)return d?.document.documentElement;var e=I(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var r=d?.document.querySelector(t);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return d&&(d.scrollY||d.pageYOffset||d.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return d&&(d.scrollX||d.pageXOffset||d.document.documentElement.scrollLeft)||0}},Ia=i=>Bn(i?.config.mask_personal_data_properties,i?.config.custom_personal_data_properties),ai=class{constructor(e,t,r,s){this.de=n=>{var o=this.ve();if(!o||o.sessionId!==n){var a={sessionId:n,props:this.ce(this._instance)};this.fe.register({[rr]:a})}},this._instance=e,this.pe=t,this.fe=r,this.ce=s||Ia,this.pe.onSessionId(this.de)}ve(){return this.fe.props[rr]}getSetOnceProps(){var e,t=(e=this.ve())==null?void 0:e.props;return t?"r"in t?Vn(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return A(qr(this.getSetOnceProps()),((t,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+Mi(r)]=t})),e}},Ri=N("[SessionId]"),li=class{on(e,t){return this._e.on(e,t)}constructor(e,t,r){var s;if(this.ge=[],this.me=void 0,this._e=new Ft,this.be=(u,h)=>!(!Ye(u)||!Ye(h))&&Math.abs(u-h)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.N=e.config,this.fe=e.persistence,this.ye=void 0,this.we=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.xe=t||Ce,this.$e=r||Ce;var n=this.N.persistence_name||this.N.token,o=this.N.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*pe(o,60,36e3,Ri.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ee(),this.Se="ph_"+n+"_window_id",this.ke="ph_"+n+"_primary_window_exists",this.Pe()){var a=B.D(this.Se),l=B.D(this.ke);a&&!l?this.ye=a:B.L(this.Se),B.j(this.ke,!0)}if((s=this.N.bootstrap)!=null&&s.sessionID)try{var c=(u=>{var h=u.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.N.bootstrap.sessionID);this.Te(this.N.bootstrap.sessionID,new Date().getTime(),c)}catch(u){Ri.error("Invalid sessionID in bootstrap",u)}this.Ce()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return y(this.ge)&&(this.ge=[]),this.ge.push(e),this.we&&e(this.we,this.ye),()=>{this.ge=this.ge.filter((t=>t!==e))}}Pe(){return this.N.persistence!=="memory"&&!this.fe.zt&&B.O()}Ie(e){e!==this.ye&&(this.ye=e,this.Pe()&&B.j(this.Se,e))}Re(){return this.ye?this.ye:this.Pe()?B.D(this.Se):null}Te(e,t,r){e===this.we&&t===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this.we=e,this.fe.register({[zt]:[t,e,r]}))}Fe(){var e=this.fe.props[zt];return I(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Te(null,null,null)}destroy(){clearTimeout(this.Oe),this.Oe=void 0,this.me&&d&&(d.removeEventListener("beforeunload",this.me,{capture:!1}),this.me=void 0),this.ge=[]}Ce(){this.me=()=>{this.Pe()&&B.L(this.ke)},j(d,"beforeunload",this.me,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.N.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||new Date().getTime(),[s,n,o]=this.Fe(),a=this.Re(),l=Ye(o)&&Math.abs(r-o)>864e5,c=!1,u=!n,h=!u&&!e&&this.be(r,s);u||h||l?(n=this.xe(),a=this.$e(),Ri.info("new session ID generated",{sessionId:n,windowId:a,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}}),o=r,c=!0):a||(a=this.$e(),c=!0);var p=Ye(s)&&e&&!l?s:r,_=Ye(o)?o:new Date().getTime();return this.Ie(a),this.Te(n,p,_),e||this.Ee(),c&&this.ge.forEach((g=>g(n,a,c?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}:void 0))),{sessionId:n,windowId:a,sessionStartTimestamp:_,changeReason:c?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}Ee(){clearTimeout(this.Oe),this.Oe=setTimeout((()=>{var[e]=this.Fe();if(this.be(new Date().getTime(),e)){var t=this.we;this.resetSessionId(),this._e.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}},Gn=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&as(t,e))return!0;try{var r=i?.userAgentData;if(r!=null&&r.brands&&r.brands.some((s=>as(s?.brand,e))))return!0}catch{}return!!i.webdriver},Et=(function(i){return i.US="us",i.EU="eu",i.CUSTOM="custom",i})({}),Ls="i.posthog.com",Ir=class{constructor(e){this.Me={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Ls,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Me[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Me[this.apiHost]=Et.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Me[this.apiHost]=Et.EU:this.Me[this.apiHost]=Et.CUSTOM),this.Me[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(this.region===Et.CUSTOM)return this.apiHost+t;var r=Ls+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}},Fa={icontains:(i,e)=>!!d&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!d&&e.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>!!d&&ni(e.href,i),not_regex:(i,e)=>!!d&&!ni(e.href,i),exact:(i,e)=>e.href===i,is_not:(i,e)=>e.href!==i},Fr=class i{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),t.getWebExperiments((s=>{i.Ae("retrieved web experiments from the server"),t.De=new Map,s.forEach((n=>{if(n.feature_flag_key){var o;t.De&&(i.Ae("setting flag key ",n.feature_flag_key," to web experiment ",n),(o=t.De)==null||o.set(n.feature_flag_key,n));var a=t._instance.getFeatureFlag(n.feature_flag_key);H(a)&&n.variants[a]&&t.je(n.name,a,n.variants[a].transforms)}else if(n.variants)for(var l in n.variants){var c=n.variants[l];i.Le(c)&&t.je(n.name,l,c.transforms)}}))}),r)},this._instance=e,this._instance.onFeatureFlags((r=>{this.onFeatureFlags(r)}))}onFeatureFlags(e){if(this._is_bot())i.Ae("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if($(this.De))return this.De=new Map,this.loadIfEnabled(),void this.previewWebExperiment();i.Ae("applying feature flags",e),e.forEach((t=>{var r;if(this.De&&(r=this.De)!=null&&r.has(t)){var s,n=this._instance.getFeatureFlag(t),o=(s=this.De)==null?void 0:s.get(t);n&&o!=null&&o.variants[n]&&this.je(o.name,n,o.variants[n].transforms)}}))}}previewWebExperiment(){var e=i.getWindowLocation();if(e!=null&&e.search){var t=Qt(e?.search,"__experiment_id"),r=Qt(e?.search,"__experiment_variant");t&&r&&(i.Ae("previewing web experiments "+t+" && "+r),this.getWebExperiments((s=>{this.Ne(parseInt(t),r,s)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this._instance.config.disable_web_experiments&&!r)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:n=>{if(n.statusCode!==200||!n.json)return e([]);var o=n.json.experiments||[];return e(o)}})}Ne(e,t,r){var s=r.filter((n=>n.id===e));s&&s.length>0&&(i.Ae("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.je(s[0].name,t,s[0].variants[t].transforms))}static Le(e){return!$(e.conditions)&&i.Ue(e)&&i.ze(e)}static Ue(e){var t;if($(e.conditions)||$((t=e.conditions)==null?void 0:t.url))return!0;var r,s,n,o=i.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||Fa[(s=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,o))}static getWindowLocation(){return d?.location}static ze(e){var t;if($(e.conditions)||$((t=e.conditions)==null?void 0:t.utm))return!0;var r=Un();if(r.utm_source){var s,n,o,a,l,c,u,h,p=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==r.utm_campaign,_=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,g=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==r.utm_medium,v=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==r.utm_term;return p&&g&&v&&_}return!1}static Ae(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];b.info("[WebExperiments] "+e,r)}je(e,t,r){this._is_bot()?i.Ae("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?r.forEach((s=>{if(s.selector){var n;i.Ae("applying transform of variant "+t+" for experiment "+e+" ",s);var o=(n=document)==null?void 0:n.querySelectorAll(s.selector);o?.forEach((a=>{var l=a;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)}))}})):i.Ae("Control variants leave the page unmodified.")}_is_bot(){return ee&&this._instance?Gn(ee,this._instance.config.custom_blocked_useragents):void 0}},Ca=N("[PostHog ExternalIntegrations]"),Aa={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Cr=class{constructor(e){this._instance=e}V(e,t){var r;(r=E.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,(s=>{if(s)return Ca.error("failed to load script",s);t()}))}startIfEnabledOrStop(){var e=this,t=function(o){var a,l,c;!s||(a=E.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.V(Aa[o],(()=>{var u;(u=E.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)})),!s&&(l=E.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=E.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.stop())};for(var[r,s]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(r)}}},St={},Oi=0,Ar=()=>{},Ke="posthog",Yn=!ha&&J?.indexOf("MSIE")===-1&&J?.indexOf("Mozilla")===-1,Us=i=>{var e;return f({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Wo(m?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ar,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:i??"unset",__preview_deferred_init_extensions:!1,debug:V&&H(V?.search)&&V.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(d==null||(e=d.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var r="Bad HTTP status: "+t.statusCode+" "+t.text;b.error(r)},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:Tr},error_tracking:{},_onCapture:Ar,__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}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(i))},js=i=>{var e={};y(i.process_person)||(e.person_profiles=i.process_person),y(i.xhr_headers)||(e.request_headers=i.xhr_headers),y(i.cookie_name)||(e.persistence_name=i.cookie_name),y(i.disable_cookie)||(e.disable_persistence=i.disable_cookie),y(i.store_google)||(e.save_campaign_params=i.store_google),y(i.verbose)||(e.debug=i.verbose);var t=U({},e,i);return I(i.property_blacklist)&&(y(i.property_denylist)?t.property_denylist=i.property_blacklist:I(i.property_denylist)?t.property_denylist=[...i.property_blacklist,...i.property_denylist]:b.error("Invalid value for property_denylist config: "+i.property_denylist)),t},Mr=class{constructor(){this.__forceAllowLocalhost=!1}get He(){return this.__forceAllowLocalhost}set He(e){b.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},nt=class i{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new Mr,this.Be=!1,this.version=ve.LIB_VERSION,this.Ft=new Ft,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Us(),this.SentryIntegration=hr,this.sentryIntegration=e=>(function(t,r){var s=Fn(t,r);return{name:In,processEvent:n=>s(n)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.qe=!1,this.We=null,this.Ge=null,this.Ve=null,this.featureFlags=new mr(this),this.toolbar=new dr(this),this.scrollManager=new $r(this),this.pageViewManager=new ti(this),this.surveys=new xr(this),this.conversations=new kr(this),this.logs=new Sr(this),this.experiments=new Fr(this),this.exceptions=new fr(this),this.rateLimiter=new Pr(this),this.requestRouter=new Ir(this),this.consent=new ur(this),this.externalIntegrations=new Cr(this),this.people={set:(e,t,r)=>{var s=H(e)?{[e]:t}:e;this.setPersonProperties(s),r?.({})},set_once:(e,t,r)=>{var s=H(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),r?.({})}},this.on("eventCaptured",(e=>b.info('send "'+e?.event+'"',e)))}init(e,t,r){if(r&&r!==Ke){var s,n=(s=St[r])!==null&&s!==void 0?s:new i;return n._init(e,t,r),St[r]=n,St[Ke][r]=n,n}return this._init(e,t,r)}_init(e,t,r){var s;if(t===void 0&&(t={}),y(e)||Di(e))return b.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Je(t.debug),this.Ke=t,this.Ye=[],t.person_profiles?this.Ge=t.person_profiles:t.process_person&&(this.Ge=t.process_person),this.set_config(U({},Us(t.defaults),js(t),{name:r,token:e})),this.config.on_xhr_error&&b.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:ye.GZipJS;var n=this.Xe();this.persistence=new kt(this.config,n),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new kt(f({},this.config,{persistence:"sessionStorage"}),n);var o=f({},this.persistence.props),a=f({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Qe=new Rr((k=>this.Ze(k)),this.config.request_queue_config),this.tr=new Or(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new li(this),this.sessionPropsManager=new ai(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(b.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.ir(l)}),0)):(b.info("Initializing extensions synchronously"),this.ir(l)),ve.DEBUG=ve.DEBUG||this.config.debug,ve.DEBUG&&b.info("Starting in debug mode",{this:this,config:t,thisC:f({},this.config),p:o,s:a}),((s=t.bootstrap)==null?void 0:s.distinctID)!==void 0){var c,u,h=this.config.get_device_id(Ce()),p=(c=t.bootstrap)!=null&&c.isIdentifiedID?h:t.bootstrap.distinctID;this.persistence.set_property(he,(u=t.bootstrap)!=null&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:p})}if(this.er()){var _,g,v=Object.keys(((_=t.bootstrap)==null?void 0:_.featureFlags)||{}).filter((k=>{var R;return!((R=t.bootstrap)==null||(R=R.featureFlags)==null||!R[k])})).reduce(((k,R)=>{var T;return k[R]=((T=t.bootstrap)==null||(T=T.featureFlags)==null?void 0:T[R])||!1,k}),{}),w=Object.keys(((g=t.bootstrap)==null?void 0:g.featureFlagPayloads)||{}).filter((k=>v[k])).reduce(((k,R)=>{var T,x;return(T=t.bootstrap)!=null&&(T=T.featureFlagPayloads)!=null&&T[R]&&(k[R]=(x=t.bootstrap)==null||(x=x.featureFlagPayloads)==null?void 0:x[R]),k}),{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:w})}if(l)this.register_once({distinct_id:ot,$device_id:null},"");else if(!this.get_distinct_id()){var S=this.config.get_device_id(Ce());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(he,"anonymous")}return j(d,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?ea(this,(()=>this.rr())):this.rr(),be(this.config._onCapture)&&this.config._onCapture!==Ar&&(b.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(k=>this.config._onCapture(k.event,k)))),this.config.ip&&b.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}ir(e){var t=performance.now(),r=f({},i.__defaultExtensionClasses,this.config.__extensionClasses);r.historyAutocapture&&(this.historyAutocapture=new r.historyAutocapture(this),this.historyAutocapture.startIfEnabled());var s=[];r.tracingHeaders&&s.push((()=>{new r.tracingHeaders(this).startIfEnabledOrStop()})),r.siteApps&&s.push((()=>{var n;this.siteApps=new r.siteApps(this),(n=this.siteApps)==null||n.init()})),!e&&r.sessionRecording&&s.push((()=>{this.sessionRecording=new r.sessionRecording(this),this.sessionRecording.startIfEnabledOrStop()})),this.config.disable_scroll_properties||s.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),r.autocapture&&s.push((()=>{this.autocapture=new r.autocapture(this),this.autocapture.startIfEnabled()})),s.push((()=>{this.surveys.loadIfEnabled()})),s.push((()=>{this.logs.loadIfEnabled()})),s.push((()=>{this.conversations.loadIfEnabled()})),r.productTours&&s.push((()=>{this.productTours=new r.productTours(this),this.productTours.loadIfEnabled()})),r.heatmaps&&s.push((()=>{this.heatmaps=new r.heatmaps(this),this.heatmaps.startIfEnabled()})),r.webVitalsAutocapture&&s.push((()=>{this.webVitalsAutocapture=new r.webVitalsAutocapture(this)})),r.exceptionObserver&&s.push((()=>{this.exceptionObserver=new r.exceptionObserver(this),this.exceptionObserver.startIfEnabledOrStop()})),r.deadClicksAutocapture&&s.push((()=>{this.deadClicksAutocapture=new r.deadClicksAutocapture(this,Qo),this.deadClicksAutocapture.startIfEnabledOrStop()})),s.push((()=>{if(this.sr){var n=this.sr;this.sr=void 0,this.Bi(n)}})),this.nr(s,t)}nr(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.nr(e,t)}),0);var r=e.shift();if(r)try{r()}catch(n){b.error("Error initializing extension:",n)}}var s=Math.round(performance.now()-t);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&b.info("PostHog extensions initialized ("+s+"ms)")}Bi(e){var t,r,s,n,o,a,l,c,u;if(!m||!m.body)return b.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Bi(e)}),500);this.config.__preview_deferred_init_extensions&&(this.sr=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=O(e.supportedCompression,ye.GZipJS)?ye.GZipJS:O(e.supportedCompression,ye.Base64)?ye.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Ge?this.Ge:"identified_only"}),(r=this.siteApps)==null||r.onRemoteConfig(e),(s=this.sessionRecording)==null||s.onRemoteConfig(e),(n=this.autocapture)==null||n.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),this.logs.onRemoteConfig(e),this.conversations.onRemoteConfig(e),(a=this.productTours)==null||a.onRemoteConfig(e),(l=this.webVitalsAutocapture)==null||l.onRemoteConfig(e),(c=this.exceptionObserver)==null||c.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}rr(){try{this.config.loaded(this)}catch(r){b.critical("`loaded` function failed",r)}if(this.ar(),this.config.internal_or_test_user_hostname&&V!=null&&V.hostname){var e=V.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.lr()}),1),this.ur=new oi(this),this.ur.load()}ar(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Qe)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Ae(this.__request_queue,(e=>this.Ze(e))),this.__request_queue=[],this.ar()}_handle_unload(){var e,t;this.surveys.handlePageUnload(),this.config.request_batching?(this.hr()&&this.capture("$pageleave"),(e=this.Qe)==null||e.unload(),(t=this.tr)==null||t.unload()):this.hr()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Yn?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=si(e.url,{ip:this.config.ip?1:0}),e.headers=f({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var r,s,n,o=f({},t);o.timeout=o.timeout||6e4,o.url=si(o.url,{_:new Date().getTime().toString(),ver:ve.LIB_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=qt.filter((u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport))),c=(s=(n=kn(l,(u=>u.transport===a)))==null?void 0:n.method)!==null&&s!==void 0?s:l[0].method;if(!c)throw new Error("No available transport method");c(o)})(f({},e,{callback:t=>{var r,s;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((r=(s=this.config).on_request_error)==null||r.call(s,t)),e.callback==null||e.callback(t)}}))))}Ze(e){this.tr?this.tr.retriableRequest(e):this._send_request(e)}_execute_array(e){Oi++;try{var t,r=[],s=[],n=[];Ae(e,(a=>{a&&(t=a[0],I(t)?n.push(a):be(a)?a.call(this):I(a)&&t==="alias"?r.push(a):I(a)&&t.indexOf("capture")!==-1&&be(this[t])?n.push(a):s.push(a))}));var o=function(a,l){Ae(a,(function(c){if(I(c[0])){var u=l;A(c,(function(h){u=u[h[0]].apply(u,h.slice(1))}))}else this[c[0]].apply(this,c.slice(1))}),l)};o(r,this),o(s,this),o(n,this)}finally{Oi--}}er(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){if(Oi>0&&I(e)&&H(e[0])){var t=i.prototype[e[0]];be(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,r){var s;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Qe){if(this.is_capturing())if(!y(e)&&H(e)){var n=!this.config.opt_out_useragent_filter&&this._is_bot();if(!(n&&!this.config.__preview_capture_bot_pageviews)){var o=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!H(t?.$current_url)&&(b.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!=="$exception"||r!=null&&r.ft||b.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,l=r?.timestamp||a,c=Ce(),u={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},l,c)};e==="$pageview"&&this.config.__preview_capture_bot_pageviews&&n&&(u.event="$bot_pageview",u.properties.$browser_type="bot"),o&&(u.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),r?.$set&&(u.$set=r?.$set);var h,p=e!=="$groupidentify",_=this.dr(r?.$set_once,p);if(_&&(u.$set_once=_),(u=Bo(u,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,y(r?.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=a),e===wt.DISMISSED||e===wt.SENT){var g=t?.[Ti.SURVEY_ID],v=t?.[Ti.SURVEY_ITERATION];h={id:g,current_iteration:v},localStorage.getItem(Ms(h))||localStorage.setItem(Ms(h),"true"),u.$set=f({},u.$set,{[Pa({id:g,current_iteration:v},e===wt.SENT?"responded":"dismissed")]:!0})}else e===wt.SHOWN&&(u.$set=f({},u.$set,{[Ti.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Oa.SHOWN){var w=t?.[Ds.TOUR_TYPE];w&&(u.$set=f({},u.$set,{[Ds.TOUR_LAST_SEEN_DATE+"/"+w]:new Date().toISOString()}))}var S=f({},u.properties.$set,u.$set);if(Xe(S)||this.setPersonPropertiesForFlags(S),!$(this.config.before_send)){var k=this.vr(u);if(!k)return;u=k}this.Ft.emit("eventCaptured",u);var R={method:"POST",url:(s=r?._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Ze(R):this.Qe.enqueue(R),u}b.critical("This capture call is ignored due to client rate limiting.")}}else b.error("No event name provided to posthog.capture")}else b.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,r,s,n){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var o=n?void 0:this.persistence.remove_event_timer(e),a=f({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=f({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!H(a.distinct_id)&&!xe(a.distinct_id)||Di(a.distinct_id))&&b.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=ga(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(n,r.getTime());a.$session_id=h,a.$window_id=p}this.sessionPropsManager&&U(a,this.sessionPropsManager.getSessionProps());try{var _;this.sessionRecording&&U(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(_=this.tr)==null?void 0:_.length}catch(S){a.$sdk_debug_error_capturing_properties=String(S)}if(this.requestRouter.region===Et.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c=e!=="$pageview"||n?e!=="$pageleave"||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),a=U(a,c),e==="$pageview"&&m&&(a.title=m.title),!y(o)){var g=r.getTime()-o;a.$duration=parseFloat((g/1e3).toFixed(3))}J&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=U({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),I(this.config.property_denylist)?A(this.config.property_denylist,(function(S){delete a[S]})):b.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(b.error("sanitize_properties is deprecated. Use before_send instead"),a=v(a,e));var w=this.cr();return a.$process_person_profile=w,w&&!n&&this.pr("_calculate_event_properties"),a}dr(e,t){var r;if(t===void 0&&(t=!0),!this.persistence||!this.cr()||this.Be)return e;var s=this.persistence.get_initial_props(),n=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=U({},s,n||{},e||{}),a=this.config.sanitize_properties;return a&&(b.error("sanitize_properties is deprecated. Use before_send instead"),o=a(o,"$set_once")),t&&(this.Be=!0),Xe(o)?void 0:o}register(e,t){var r;(r=this.persistence)==null||r.register(e,t)}register_once(e,t,r){var s;(s=this.persistence)==null||s.register_once(e,t,r)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}_r(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){return this.featureFlags.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){return this.featureFlags.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateFlags(e,t,r){var s=r!=null&&r.merge?this.featureFlags.getFlagVariants():{},n=r!=null&&r.merge?this.featureFlags.getFlagPayloads():{},o=f({},s,e),a=f({},n,t),l={};for(var[c,u]of Object.entries(o)){var h=typeof u=="string";l[c]={key:c,enabled:!!h||!!u,variant:h?u:void 0,reason:void 0,metadata:y(a?.[c])?void 0:{id:0,version:void 0,description:void 0,payload:a[c]}}}this.featureFlags.receivedFeatureFlags({flags:l})}updateEarlyAccessFeatureEnrollment(e,t,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,r)}on(e,t){return this.Ft.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,r;return(t=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){t===void 0&&(t=Ra),this.surveys.displaySurvey(e,t)}cancelPendingSurvey(e){this.surveys.cancelPendingSurvey(e)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,r){if(!this.__loaded||!this.persistence)return b.uninitializedWarning("posthog.identify");if(xe(e)&&(e=e.toString(),b.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))b.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==ot){if(this.pr("posthog.identify")){var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(vt)&&(this.unregister(vt),this.register({distinct_id:e}));var o=(this.persistence.get_property(he)||"anonymous")==="anonymous";e!==s&&o?(this.persistence.set_property(he,"identified"),this.setPersonPropertiesForFlags(f({},r||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:r||{}}),this.Ve=$s(e,t,r),this.featureFlags.setAnonymousDistinctId(s)):(t||r)&&this.setPersonProperties(t,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(Gt))}}else b.critical('The string "'+ot+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else b.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.pr("posthog.setPersonProperties")){var r=$s(this.get_distinct_id(),e,t);this.Ve!==r?(this.setPersonPropertiesForFlags(f({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ve=r):b.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,r){if(e&&t){var s=this.getGroups();s[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:f({},s,{[e]:t})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),s[e]===t||r||this.reloadFeatureFlags()}else b.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.pr("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,r,s,n,o;if(b.info("reset"),!this.__loaded)return b.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(r=this.sessionPersistence)==null||r.clear(),this.surveys.reset(),(s=this.ur)==null||s.stop(),this.featureFlags.reset(),(n=this.persistence)==null||n.set_property(he,"anonymous"),(o=this.sessionManager)==null||o.resetSessionId(),this.Ve=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:ot,$device_id:null},"");else{var l=this.config.get_device_id(Ce());this.register_once({distinct_id:l,$device_id:e?l:a},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&r){var n,o=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return s}alias(e,t){return e===this.get_property(Pn)?(b.critical("Attempting to create alias for existing People user - aborting."),-2):this.pr("posthog.alias")?(y(t)&&(t=this.get_distinct_id()),e!==t?(this._r(vt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(b.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=f({},this.config);if(q(e)){var r,s,n,o,a,l,c,u;U(this.config,js(e));var h=this.Xe();(r=this.persistence)==null||r.update_config(this.config,t,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new kt(f({},this.config,{persistence:"sessionStorage"}),h);var p=this.Je(this.config.debug);Ee(p)&&(this.config.debug=p),Ee(this.config.debug)&&(this.config.debug?(ve.DEBUG=!0,D.O()&&D.j("ph_debug","true"),b.info("set_config",{config:e,oldConfig:t,newConfig:f({},this.config)})):(ve.DEBUG=!1,D.O()&&D.L("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),(c=this.deadClicksAutocapture)==null||c.startIfEnabledOrStop(),this.surveys.loadIfEnabled(),this.gr(),(u=this.externalIntegrations)==null||u.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,r={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(r).some(Boolean)){var s,n,o,a,l;(s=this.sessionManager)==null||s.checkAndGetSessionAndWindowId(),r.sampling&&((n=this.sessionRecording)==null||n.overrideSampling()),r.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),r.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),r.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(f({},s,t))}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Ke;return t!==Ke&&(t=Ke+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(he))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(he))==="identified"}cr(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Xe(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[vt])&&((t=this.persistence)==null||(t=t.props)==null||!t[Xt]))}hr(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.cr()||this.pr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.pr("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}pr(e){return this.config.person_profiles==="never"?(b.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._r(Xt,!0),!0)}Xe(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}gr(){var e,t,r,s,n=this.Xe();return((e=this.persistence)==null?void 0:e.zt)!==n&&((r=this.persistence)==null||r.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.zt)!==n&&((s=this.sessionPersistence)==null||s.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!=="always"){if(this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()){var r,s,n,o,a;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new li(this),this.pageViewManager=new ti(this),this.persistence&&(this.sessionPropsManager=new ai(this,this.sessionManager,this.persistence));var l=(n=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&n!==void 0?n:(a=i.__defaultExtensionClasses)==null?void 0:a.sessionRecording;l&&(this.sessionRecording=new l(this),this.sessionRecording.startIfEnabledOrStop())}var c;this.consent.optInOut(!0),this.gr(),this.ar(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(y(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((c=e?.captureEventName)!==null&&c!==void 0?c:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.lr()}else b.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.gr(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:ot,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(t=this.pageViewManager)==null||t.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.lr())):b.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===me.GRANTED?"granted":e===me.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.gr()}_is_bot(){return ee?Gn(ee,this.config.custom_blocked_useragents):void 0}lr(){m&&(m.visibilityState==="visible"?this.qe||(this.qe=!0,this.capture("$pageview",{title:m.title},{send_instantly:!0}),this.We&&(m.removeEventListener("visibilitychange",this.We),this.We=null)):this.We||(this.We=this.lr.bind(this),j(m,"visibilitychange",this.We)))}debug(e){e===!1?(d?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(d?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}At(){var e,t,r,s,n,o,a,l=this.Ke||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(b.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):(r="advanced_disable_decide",s=!1,n=b,o=(t="advanced_disable_flags")in(e=l)&&!$(e[t]),a=r in e&&!$(e[r]),o?e[t]:a?(n&&n.warn("Config field '"+r+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[r]):s)}vr(e){if($(this.config.before_send))return e;var t=I(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var s of t){if(r=s(r),$(r)){var n="Event '"+e.event+"' was rejected in beforeSend function";return vo(e.event)?b.warn(n+". This can cause unexpected behavior."):b.info(n),null}r.properties&&!Xe(r.properties)||b.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.it)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}Je(e){var t=Ee(e)&&!e,r=D.O()&&D.A("ph_debug")==="true";return!t&&(!!r||e)}};nt.__defaultExtensionClasses={},(function(i,e){for(var t=0;t<e.length;t++)i.prototype[e[t]]=qo(i.prototype[e[t]])})(nt,["identify"]);function Hs(i){return i instanceof Element&&(i.id===On||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function pi(i){return!!i&&i.nodeType===1}function Me(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function Kn(i){return!!i&&i.nodeType===3}function Xn(i){return!!i&&i.nodeType===11}function Wr(i){return i?hi(i).split(/\s+/):[]}function qs(i){var e=d?.location.href;return!!(e&&i&&i.some((t=>e.match(t))))}function ci(i){var e="";switch(typeof i.className){case"string":e=i.className;break;case"object":e=(i.className&&"baseVal"in i.className?i.className.baseVal:null)||i.getAttribute("class")||"";break;default:e=""}return Wr(e)}function Jn(i){return $(i)?null:hi(i).split(/(\s+)/).filter((e=>Ct(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function At(i){var e="";return Dr(i)&&!to(i)&&i.childNodes&&i.childNodes.length&&A(i.childNodes,(function(t){var r;Kn(t)&&t.textContent&&(e+=(r=Jn(t.textContent))!==null&&r!==void 0?r:"")})),hi(e)}function Bs(i){return y(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null;var e}var zr=["a","button","form","input","select","textarea","label"];function Zn(i,e){if(y(e))return!0;var t,r=function(n){if(e.some((o=>n.matches(o))))return{v:!0}};for(var s of i)if(t=r(s))return t.v;return!1}function Qn(i){var e=i.parentNode;return!(!e||!pi(e))&&e}var Ma=["next","previous","prev",">","<"],Vs=10,Ws=[".ph-no-rageclick",".ph-no-capture"];function Da(i,e){if(!d||Gr(i))return!1;var t,r,s;if(Ee(e)?(t=!!e&&Ws,r=void 0):(t=(s=e?.css_selector_ignorelist)!==null&&s!==void 0?s:Ws,r=e?.content_ignorelist),t===!1)return!1;var{targetElementList:n}=eo(i,!1);return!(function(o,a){if(o===!1||y(o))return!1;var l;if(o===!0)l=Ma;else{if(!I(o))return!1;if(o.length>Vs)return b.error("[PostHog] content_ignorelist array cannot exceed "+Vs+" items. Use css_selector_ignorelist for more complex matching."),!1;l=o.map((c=>c.toLowerCase()))}return a.some((c=>{var{safeText:u,ariaLabel:h}=c;return l.some((p=>u.includes(p)||h.includes(p)))}))})(r,n.map((o=>{var a;return{safeText:At(o).toLowerCase(),ariaLabel:((a=o.getAttribute("aria-label"))==null?void 0:a.toLowerCase().trim())||""}})))&&!Zn(n,t)}var Gr=i=>!i||Me(i,"html")||!pi(i),eo=(i,e)=>{if(!d||Gr(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,r=[i],s=i;s.parentNode&&!Me(s,"body");)if(Xn(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Qn(s);if(!n)break;if(e||zr.indexOf(n.tagName.toLowerCase())>-1)t=!0;else{var o=d.getComputedStyle(n);o&&o.getPropertyValue("cursor")==="pointer"&&(t=!0)}r.push(n),s=n}return{parentIsUsefulElement:t,targetElementList:r}};function Na(i,e,t,r,s){var n,o,a,l;if(t===void 0&&(t=void 0),!d||Gr(i)||(n=t)!=null&&n.url_allowlist&&!qs(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&qs(t.url_ignorelist))return!1;if((a=t)!=null&&a.dom_event_allowlist){var c=t.dom_event_allowlist;if(c&&!c.some((g=>e.type===g)))return!1}var{parentIsUsefulElement:u,targetElementList:h}=eo(i,r);if(!(function(g,v){var w=v?.element_allowlist;if(y(w))return!0;var S,k=function(T){if(w.some((x=>T.tagName.toLowerCase()===x)))return{v:!0}};for(var R of g)if(S=k(R))return S.v;return!1})(h,t)||!Zn(h,(l=t)==null?void 0:l.css_selector_allowlist))return!1;var p=d.getComputedStyle(i);if(p&&p.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var _=i.tagName.toLowerCase();switch(_){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return u?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(zr.indexOf(_)>-1||i.getAttribute("contenteditable")==="true")}}function Dr(i){for(var e=i;e.parentNode&&!Me(e,"body");e=e.parentNode){var t=ci(e);if(O(t,"ph-sensitive")||O(t,"ph-no-capture"))return!1}if(O(ci(i),"ph-include"))return!0;var r=i.type||"";if(H(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=i.name||i.id||"";return!(H(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function to(i){return!!(Me(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||Me(i,"select")||Me(i,"textarea")||i.getAttribute("contenteditable")==="true")}var io="(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})",La=new RegExp("^(?:"+io+")$"),Ua=new RegExp(io),ro="\\d{3}-?\\d{2}-?\\d{4}",ja=new RegExp("^("+ro+")$"),Ha=new RegExp("("+ro+")");function Ct(i,e){return e===void 0&&(e=!0),!($(i)||H(i)&&(i=hi(i),(e?La:Ua).test((i||"").replace(/[- ]/g,""))||(e?ja:Ha).test(i)))}function so(i){var e=At(i);return Ct(e=(e+" "+no(i)).trim())?e:""}function no(i){var e="";return i&&i.childNodes&&i.childNodes.length&&A(i.childNodes,(function(t){var r;if(t&&((r=t.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=At(t);e=(e+" "+s).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+no(t)).trim())}catch(n){b.error("[AutoCapture]",n)}})),e}function qa(i){return(function(e){var t=e.map((r=>{var s,n,o="";if(r.tag_name&&(o+=r.tag_name),r.attr_class)for(var a of(r.attr_class.sort(),r.attr_class))o+="."+a.replace(/"/g,"");var l=f({},r.text?{text:r.text}:{},{"nth-child":(s=r.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(n=r.nth_of_type)!==null&&n!==void 0?n:0},r.href?{href:r.href}:{},r.attr_id?{attr_id:r.attr_id}:{},r.attributes),c={};return Ht(l).sort(((u,h)=>{var[p]=u,[_]=h;return p.localeCompare(_)})).forEach((u=>{var[h,p]=u;return c[zs(h.toString())]=zs(p.toString())})),o+=":",o+=Ht(c).map((u=>{var[h,p]=u;return h+'="'+p+'"'})).join("")}));return t.join(";")})((function(e){return e.map((t=>{var r,s,n={text:(r=t.$el_text)==null?void 0:r.slice(0,400),tag_name:t.tag_name,href:(s=t.attr__href)==null?void 0:s.slice(0,2048),attr_class:Ba(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Ht(t).filter((o=>{var[a]=o;return a.indexOf("attr__")===0})).forEach((o=>{var[a,l]=o;return n.attributes[a]=l})),n}))})(i))}function zs(i){return i.replace(/"|\\"/g,'\\"')}function Ba(i){var e=i.attr__class;return e?I(e)?e:Wr(e):void 0}var ui=class{constructor(e){this.disabled=e===!1;var t=q(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&r-s.timestamp<this.timeoutMs){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}},$i="$copy_autocapture",Gs=N("[AutoCapture]");function Ii(i,e){return e.length>i?e.slice(0,i)+"...":e}function Va(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!pi(e));return e}function Wa(i,e,t,r){var s=i.tagName.toLowerCase(),n={tag_name:s};zr.indexOf(s)>-1&&!t&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?n.$el_text=Ii(1024,so(i)):n.$el_text=Ii(1024,At(i)));var o=ci(i);o.length>0&&(n.classes=o.filter((function(u){return u!==""}))),A(i.attributes,(function(u){var h;if((!to(i)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(r==null||!r.includes(u.name))&&!e&&Ct(u.value)&&(h=u.name,!H(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var p=u.value;u.name==="class"&&(p=Wr(p).join(" ")),n["attr__"+u.name]=Ii(1024,p)}}));for(var a=1,l=1,c=i;c=Va(c);)a++,c.tagName===i.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}function za(i,e){for(var t,r,{e:s,maskAllElementAttributes:n,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[i],u=i;u.parentNode&&!Me(u,"body");)Xn(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var h,p=[],_={},g=!1,v=!1;if(A(c,(T=>{var x=Dr(T);T.tagName.toLowerCase()==="a"&&(g=T.getAttribute("href"),g=x&&g&&Ct(g)&&g),O(ci(T),"ph-no-capture")&&(v=!0),p.push(Wa(T,n,o,a));var L=(function(F){if(!Dr(F))return{};var P={};return A(F.attributes,(function(Z){if(Z.name&&Z.name.indexOf("data-ph-capture-attribute")===0){var z=Z.name.replace("data-ph-capture-attribute-",""),te=Z.value;z&&te&&Ct(te)&&(P[z]=te)}})),P})(T);U(_,L)})),v)return{props:{},explicitNoCapture:v};if(o||(i.tagName.toLowerCase()==="a"||i.tagName.toLowerCase()==="button"?p[0].$el_text=so(i):p[0].$el_text=At(i)),g){var w,S;p[0].attr__href=g;var k=(w=Zt(g))==null?void 0:w.host,R=d==null||(S=d.location)==null?void 0:S.host;k&&R&&k!==R&&(h=g)}return{props:U({$event_type:s.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:qa(p)},(t=p[0])!=null&&t.$el_text?{$el_text:(r=p[0])==null?void 0:r.$el_text}:{},h&&s.type==="click"?{$external_click_url:h}:{},_)}}var _t=N("[ExceptionAutocapture]");function Ys(i,e,t){try{if(!(e in i))return()=>{};var r=i[e],s=t(r);return be(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),i[e]=s,()=>{i[e]=r}}catch{return()=>{}}}var Ga=N("[TracingHeaders]"),$e=N("[Web Vitals]"),Ks=9e5;N("[SessionRecording]");var Nr="[SessionRecording]",Ge=N(Nr),Ya=N("[Heatmaps]");function Xs(i){return q(i)&&"clientX"in i&&"clientY"in i&&xe(i.clientX)&&xe(i.clientY)}var Js=N("[Product Tours]"),Fi="ph_product_tours",Ka=["$set_once","$set"],Ie=N("[SiteApps]"),Xa={sessionRecording:class{get started(){var i;return!((i=this.mr)==null||!i.isStarted)}get status(){return this.mr?this.mr.status:this.br?this.yr?"lazy_loading":"disabled":"pending_config"}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.br=!1,this.wr=!1,this.$r=void 0,this._instance=i,!this._instance.sessionManager)throw Ge.error("started without valid sessionManager"),new Error(Nr+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Nr+' cannot be used with cookieless_mode="always"')}get yr(){var i,e=!((i=this._instance.get_property(Dt))==null||!i.enabled),t=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return d&&e&&t&&!r}startIfEnabledOrStop(i){var e;if(this.br&&(!this.yr||(e=this.mr)==null||!e.isStarted)){var t=!y(Object.assign)&&!y(Array.from);this.yr&&t?(this.Er(i),Ge.info("starting")):this.stopRecording()}}Er(i){var e,t,r;this.yr&&(E!=null&&(e=E.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=E.__PosthogExtensions__)!=null&&t.initSessionRecording?this.Sr(i):(r=E.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.kr,(s=>{if(s)return Ge.error("could not load recorder",s);this.Sr(i)})))}stopRecording(){var i,e;(i=this.$r)==null||i.call(this),this.$r=void 0,(e=this.mr)==null||e.stop()}Pr(){var i;(i=this._instance.persistence)==null||i.unregister(Rn)}Tr(i){if(this._instance.persistence){var e,t,r=this._instance.persistence,s=()=>{var n=i.sessionRecording===!1?void 0:i.sessionRecording,o=n?.sampleRate,a=$(o)?null:parseFloat(o);$(a)&&this.Pr();var l=n?.minimumDurationMilliseconds;r.register({[Dt]:f({cache_timestamp:Date.now(),enabled:!!n},n,{networkPayloadCapture:f({capturePerformance:i.capturePerformance},n?.networkPayloadCapture),canvasRecording:{enabled:n?.recordCanvas,fps:n?.canvasFps,quality:n?.canvasQuality},sampleRate:a,minimumDurationMilliseconds:y(l)?null:l,endpoint:n?.endpoint,triggerMatchType:n?.triggerMatchType,masking:n?.masking,urlTriggers:n?.urlTriggers})})};s(),(e=this.$r)==null||e.call(this),this.$r=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(s)}}onRemoteConfig(i){"sessionRecording"in i?i.sessionRecording!==!1?(this.wr=!1,this.Tr(i),this.br=!0,this.startIfEnabledOrStop()):this.br=!0:Ge.info("skipping remote config with no sessionRecording",i)}log(i,e){var t;e===void 0&&(e="log"),(t=this.mr)!=null&&t.log?this.mr.log(i,e):Ge.warn("log called before recorder was ready")}get kr(){var i,e,t=(i=this._instance)==null||(i=i.persistence)==null?void 0:i.get_property(Dt);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}Cr(){var i,e=this._instance.get_property(Dt);if(!e)return!1;var t=(i=(typeof e=="object"?e:JSON.parse(e)).cache_timestamp)!==null&&i!==void 0?i:Date.now();return Date.now()-t<=3e5}Sr(i){var e,t;if((e=E.__PosthogExtensions__)==null||!e.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.mr||(this.mr=(t=E.__PosthogExtensions__)==null?void 0:t.initSessionRecording(this._instance),this.mr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.Cr()?this.mr.start(i):this.wr||(this.wr=!0,Ge.info("persisted remote config is stale, requesting fresh config before starting"),new oi(this._instance).load())}onRRwebEmit(i){var e;(e=this.mr)==null||e.onRRwebEmit==null||e.onRRwebEmit(i)}overrideLinkedFlag(){var i,e;this.mr||(e=this._instance.persistence)==null||e.register({$replay_override_linked_flag:!0}),(i=this.mr)==null||i.overrideLinkedFlag()}overrideSampling(){var i,e;this.mr||(e=this._instance.persistence)==null||e.register({$replay_override_sampling:!0}),(i=this.mr)==null||i.overrideSampling()}overrideTrigger(i){var e,t;this.mr||(t=this._instance.persistence)==null||t.register({[i==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.mr)==null||e.overrideTrigger(i)}get sdkDebugProperties(){var i;return((i=this.mr)==null?void 0:i.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(i,e){var t;return!((t=this.mr)==null||!t.tryAddCustomEvent(i,e))}}},Ja={autocapture:class{constructor(i){this.Ir=!1,this.Rr=null,this.Fr=!1,this.instance=i,this.rageclicks=new ui(i.config.rageclick),this.Or=null}get N(){var i,e,t=q(this.instance.config.autocapture)?this.instance.config.autocapture:{};return t.url_allowlist=(i=t.url_allowlist)==null?void 0:i.map((r=>new RegExp(r))),t.url_ignorelist=(e=t.url_ignorelist)==null?void 0:e.map((r=>new RegExp(r))),t}Mr(){if(this.isBrowserSupported()){if(d&&m){var i=t=>{t=t||d?.event;try{this.Ar(t)}catch(r){Gs.error("Failed to capture event",r)}};if(j(m,"submit",i,{capture:!0}),j(m,"change",i,{capture:!0}),j(m,"click",i,{capture:!0}),this.N.capture_copied_text){var e=t=>{t=t||d?.event,this.Ar(t,$i)};j(m,"copy",e,{capture:!0}),j(m,"cut",e,{capture:!0})}}}else Gs.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Ir&&(this.Mr(),this.Ir=!0)}onRemoteConfig(i){i.elementsChainAsString&&(this.Fr=i.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[vs]:!!i.autocapture_opt_out}),this.Rr=!!i.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(i){this.Or=i}getElementSelectors(i){var e,t=[];return(e=this.Or)==null||e.forEach((r=>{var s=m?.querySelectorAll(r);s?.forEach((n=>{i===n&&t.push(r)}))})),t}get isEnabled(){var i,e,t=(i=this.instance.persistence)==null?void 0:i.props[vs],r=this.Rr;if(ae(r)&&!Ee(t)&&!this.instance.At())return!1;var s=(e=this.Rr)!==null&&e!==void 0?e:!!t;return!!this.instance.config.autocapture&&!s}Ar(i,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var t,r=Bs(i);Kn(r)&&(r=r.parentNode||null),e==="$autocapture"&&i.type==="click"&&i instanceof MouseEvent&&this.instance.config.rageclick&&(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,i.timeStamp||new Date().getTime())&&Da(r,this.instance.config.rageclick)&&this.Ar(i,"$rageclick");var s=e===$i;if(r&&Na(r,i,this.N,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=za(r,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.N.element_attribute_ignorelist,elementsChainAsString:this.Fr});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),e===$i){var l,c=Jn(d==null||(l=d.getSelection())==null?void 0:l.toString()),u=i.type||"clipboard";if(!c)return!1;n.$selected_content=c,n.$copy_type=u}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return be(m?.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.Dr=(d==null||(e=d.location)==null?void 0:e.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(b.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.jr&&this.jr(),this.jr=void 0,b.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(d&&d.history){var t=this;(i=d.history.pushState)!=null&&i.__posthog_wrapped__||Ys(d.history,"pushState",(r=>function(s,n,o){r.call(this,s,n,o),t.Lr("pushState")})),(e=d.history.replaceState)!=null&&e.__posthog_wrapped__||Ys(d.history,"replaceState",(r=>function(s,n,o){r.call(this,s,n,o),t.Lr("replaceState")})),this.Nr()}}Lr(i){try{var e,t=d==null||(e=d.location)==null?void 0:e.pathname;if(!t)return;t!==this.Dr&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:i}),this.Dr=t}catch(r){b.error("Error capturing "+i+" pageview",r)}}Nr(){if(!this.jr){var i=()=>{this.Lr("popstate")};j(d,"popstate",i),this.jr=()=>{d&&d.removeEventListener("popstate",i)}}}},heatmaps:class{constructor(i){var e;this.Ur=!1,this.Ir=!1,this.zr=null,this.instance=i,this.Ur=!((e=this.instance.persistence)==null||!e.props[Zi]),this.rageclicks=new ui(i.config.rageclick)}get flushIntervalMilliseconds(){var i=5e3;return q(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(i=this.instance.config.capture_heatmaps.flush_interval_milliseconds),i}get isEnabled(){return $(this.instance.config.capture_heatmaps)?$(this.instance.config.enable_heatmaps)?this.Ur:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Ir)return;Ya.info("starting..."),this.Hr(),this.Br()}else{var i;clearInterval((i=this.zr)!==null&&i!==void 0?i:void 0),this.qr(),this.getAndClearBuffer()}}onRemoteConfig(i){if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Zi]:e}),this.Ur=e,this.startIfEnabled()}}getAndClearBuffer(){var i=this.R;return this.R=void 0,i}Wr(i){this.Gr(i.originalEvent,"deadclick")}Br(){this.zr&&clearInterval(this.zr),this.zr=(function(i){return i?.visibilityState==="visible"})(m)?setInterval(this.se.bind(this),this.flushIntervalMilliseconds):null}Hr(){d&&m&&(this.Vr=this.se.bind(this),j(d,"beforeunload",this.Vr),this.Jr=i=>this.Gr(i||d?.event),j(m,"click",this.Jr,{capture:!0}),this.Kr=i=>this.Yr(i||d?.event),j(m,"mousemove",this.Kr,{capture:!0}),this.Xr=new Jt(this.instance,Zo,this.Wr.bind(this)),this.Xr.startIfEnabledOrStop(),this.Qr=this.Br.bind(this),j(m,"visibilitychange",this.Qr),this.Ir=!0)}qr(){var i;d&&m&&(this.Vr&&d.removeEventListener("beforeunload",this.Vr),this.Jr&&m.removeEventListener("click",this.Jr,{capture:!0}),this.Kr&&m.removeEventListener("mousemove",this.Kr,{capture:!0}),this.Qr&&m.removeEventListener("visibilitychange",this.Qr),clearTimeout(this.Zr),(i=this.Xr)==null||i.stop(),this.Ir=!1)}ts(i,e){var t=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=(function(o,a,l){for(var c=o;c&&pi(c)&&!Me(c,"body");){if(c===l)return!1;if(O(a,d?.getComputedStyle(c).position))return!0;c=Qn(c)}return!1})(Bs(i),["fixed","sticky"],s);return{x:i.clientX+(n?0:r),y:i.clientY+(n?0:t),target_fixed:n,type:e}}Gr(i,e){var t;if(e===void 0&&(e="click"),!Hs(i.target)&&Xs(i)){var r=this.ts(i,e);(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,new Date().getTime())&&this.es(f({},r,{type:"rageclick"})),this.es(r)}}Yr(i){!Hs(i.target)&&Xs(i)&&(clearTimeout(this.Zr),this.Zr=setTimeout((()=>{this.es(this.ts(i,"mousemove"))}),500))}es(i){if(d){var e=d.location.href,t=this.instance.config.mask_personal_data_properties,r=this.instance.config.custom_personal_data_properties,s=t?it([],st,r||[]):[],n=$t(e,s,It);this.R=this.R||{},this.R[n]||(this.R[n]=[]),this.R[n].push(i)}}se(){this.R&&!Xe(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Jt,webVitalsAutocapture:class{constructor(i){var e;this.Ur=!1,this.Ir=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.rs=()=>{clearTimeout(this.ss),this.R.metrics.length!==0&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((t,r)=>f({},t,{["$web_vitals_"+r.name+"_event"]:f({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ns=t=>{var r,s=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(y(s))$e.error("Could not read session ID. Dropping metrics!");else{this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var n=this.os();y(n)||($(t?.name)||$(t?.value)?$e.error("Invalid metric received",t):this.ls&&t.value>=this.ls?$e.error("Ignoring metric with value >= "+this.ls,t):(this.R.url!==n&&(this.rs(),this.ss=setTimeout(this.rs,this.flushToCaptureTimeoutMs)),y(this.R.url)&&(this.R.url=n),this.R.firstMetricTimestamp=y(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.R.metrics.push(f({},t,{$current_url:n,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.R.metrics.length===this.allowedMetrics.length&&this.rs()))}},this.us=()=>{if(!this.Ir){var t,r,s,n,o=E.__PosthogExtensions__;y(o)||y(o.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:r,onFCP:s,onINP:n}=o.postHogWebVitalsCallbacks),t&&r&&s&&n?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.ns.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.ns.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.ns.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.ns.bind(this)),this.Ir=!0):$e.error("web vitals callbacks not loaded - not starting")}},this._instance=i,this.Ur=!((e=this._instance.persistence)==null||!e.props[ys]),this.startIfEnabled()}get allowedMetrics(){var i,e,t=q(this._instance.config.capture_performance)?(i=this._instance.config.capture_performance)==null?void 0:i.web_vitals_allowed_metrics:void 0;return $(t)?((e=this._instance.persistence)==null?void 0:e.props[ws])||["CLS","FCP","INP","LCP"]:t}get flushToCaptureTimeoutMs(){return(q(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var i=q(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_attribution:void 0;return i!=null&&i}get ls(){var i=q(this._instance.config.capture_performance)&&xe(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Ks;return 0<i&&i<=6e4?Ks:i}get isEnabled(){var i=V?.protocol;if(i!=="http:"&&i!=="https:")return $e.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=q(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Ee(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Ee(e)?e:this.Ur}startIfEnabled(){this.isEnabled&&!this.Ir&&($e.info("enabled, starting..."),this.V(this.us))}onRemoteConfig(i){if("capturePerformance"in i){var e=q(i.capturePerformance)&&!!i.capturePerformance.web_vitals,t=q(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[ys]:e}),this._instance.persistence.register({[ws]:t})),this.Ur=e,this.startIfEnabled()}}V(i){var e,t;if((e=E.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks)i();else{var r=this.useAttribution?"web-vitals-with-attribution":"web-vitals";(t=E.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,r,(s=>{s?$e.error("failed to load script",s):i()}))}}os(){var i=d?d.location.href:void 0;if(i){var e=this._instance.config.mask_personal_data_properties,t=this._instance.config.custom_personal_data_properties,r=e?it([],st,t||[]):[];return $t(i,r,It)}$e.error("Could not determine current URL")}}},Za={exceptionObserver:class{constructor(i){var e,t,r;this.us=()=>{var s;if(d&&this.isEnabled&&(s=E.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var n=E.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=E.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=E.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.hs&&this.N.capture_unhandled_errors&&(this.hs=n(this.captureException.bind(this))),!this.ds&&this.N.capture_unhandled_rejections&&(this.ds=o(this.captureException.bind(this))),!this.vs&&this.N.capture_console_errors&&(this.vs=a(this.captureException.bind(this)))}catch(l){_t.error("failed to start",l),this.cs()}}},this._instance=i,this.fs=!((e=this._instance.persistence)==null||!e.props[fs]),this.ps=new Li({refillRate:(t=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&t!==void 0?t:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,h:_t}),this.N=this._s(),this.startIfEnabledOrStop()}_s(){var i=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return q(i)?e=f({},e,i):(y(i)?this.fs:i)&&(e=f({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.N.capture_console_errors||this.N.capture_unhandled_errors||this.N.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(_t.info("enabled"),this.cs(),this.V(this.us)):this.cs()}V(i){var e,t;(e=E.__PosthogExtensions__)!=null&&e.errorWrappingFunctions&&i(),(t=E.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return _t.error("failed to load script",r);i()}))}cs(){var i,e,t;(i=this.hs)==null||i.call(this),this.hs=void 0,(e=this.ds)==null||e.call(this),this.ds=void 0,(t=this.vs)==null||t.call(this),this.vs=void 0}onRemoteConfig(i){if("autocaptureExceptions"in i){var e=i.autocaptureExceptions;this.fs=!!e||!1,this._instance.persistence&&this._instance.persistence.register({[fs]:this.fs}),this.N=this._s(),this.startIfEnabledOrStop()}}onConfigChange(){this.N=this._s()}captureException(i){var e,t,r=(e=i==null||(t=i.$exception_list)==null||(t=t[0])==null?void 0:t.type)!==null&&e!==void 0?e:"Exception";this.ps.consumeRateLimit(r)?_t.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(i)}}},Qa={productTours:class{constructor(i){this.gs=null,this.bs=null,this._instance=i}onRemoteConfig(i){"productTours"in i&&(this._instance.persistence&&this._instance.persistence.register({[bs]:!!i.productTours}),this.loadIfEnabled())}loadIfEnabled(){var i,e;this.gs||(i=this._instance).config.disable_product_tours||(e=i.persistence)==null||!e.get_property(bs)||this.V((()=>this.ys()))}V(i){var e,t;(e=E.__PosthogExtensions__)!=null&&e.generateProductTours?i():(t=E.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",(r=>{r?Js.error("Could not load product tours script",r):i()}))}ys(){var i;!this.gs&&(i=E.__PosthogExtensions__)!=null&&i.generateProductTours&&(this.gs=E.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(i,e){if(e===void 0&&(e=!1),!I(this.bs)||e){var t=this._instance.persistence;if(t){var r=t.props[Fi];if(I(r)&&!e)return this.bs=r,void i(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{var n=s.statusCode;if(n!==200||!s.json){var o="Product Tours API could not be loaded, status: "+n;return Js.error(o),void i([],{isLoaded:!1,error:o})}var a=I(s.json.product_tours)?s.json.product_tours:[];this.bs=a,t&&t.register({[Fi]:a}),i(a,{isLoaded:!0})}})}else i(this.bs,{isLoaded:!0})}getActiveProductTours(i){$(this.gs)?i([],{isLoaded:!1,error:"Product tours not loaded"}):this.gs.getActiveProductTours(i)}showProductTour(i){var e;(e=this.gs)==null||e.showTourById(i)}previewTour(i){this.gs?this.gs.previewTour(i):this.V((()=>{var e;this.ys(),(e=this.gs)==null||e.previewTour(i)}))}dismissProductTour(){var i;(i=this.gs)==null||i.dismissTour("user_clicked_skip")}nextStep(){var i;(i=this.gs)==null||i.nextStep()}previousStep(){var i;(i=this.gs)==null||i.previousStep()}clearCache(){var i;this.bs=null,(i=this._instance.persistence)==null||i.unregister(Fi)}resetTour(i){var e;(e=this.gs)==null||e.resetTour(i)}resetAllTours(){var i;(i=this.gs)==null||i.resetAllTours()}cancelPendingTour(i){var e;(e=this.gs)==null||e.cancelPendingTour(i)}}},el={siteApps:class{constructor(i){this._instance=i,this.ws=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}xs(i,e){if(e){var t=this.globalsForEvent(e);this.ws.push(t),this.ws.length>1e3&&(this.ws=this.ws.slice(10))}}get siteAppLoaders(){var i;return(i=E._POSTHOG_REMOTE_CONFIG)==null||(i=i[this._instance.config.token])==null?void 0:i.siteApps}init(){if(this.isEnabled){var i=this._instance._addCaptureHook(this.xs.bind(this));this.$s=()=>{i(),this.ws=[],this.$s=void 0}}}globalsForEvent(i){var e,t,r,s,n,o,a;if(!i)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[h,p]of Object.entries(u))l[h]={id:c[h],type:h,properties:p};var{$set_once:_,$set:g}=i;return{event:f({},en(i,Ka),{properties:f({},i.properties,g?{$set:f({},(e=(t=i.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},g)}:{},_?{$set_once:f({},(r=(s=i.properties)==null?void 0:s.$set_once)!==null&&r!==void 0?r:{},_)}:{}),elements_chain:(n=(o=i.properties)==null?void 0:o.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(a=i.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(i){var e=this.apps[i.id],t=()=>{var o;!e.errored&&this.ws.length&&(Ie.info("Processing "+this.ws.length+" events for site app with id "+i.id),this.ws.forEach((a=>e.processEvent==null?void 0:e.processEvent(a))),e.processedBuffer=!0),Object.values(this.apps).every((a=>a.processedBuffer||a.errored))&&((o=this.$s)==null||o.call(this))},r=!1,s=o=>{e.errored=!o,e.loaded=!0,Ie.info("Site app with id "+i.id+" "+(o?"loaded":"errored")),r&&t()};try{var{processEvent:n}=i.init({posthog:this._instance,callback:o=>{s(o)}});n&&(e.processEvent=n),r=!0}catch(o){Ie.error("Error while initializing PostHog app with config id "+i.id,o),s(!1)}if(r&&e.loaded)try{t()}catch(o){Ie.error("Error while processing buffered events PostHog app with config id "+i.id,o),e.errored=!0}}Es(){var i=this.siteAppLoaders||[];for(var e of i)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var t of i)this.setupSiteApp(t)}Ss(i){if(Object.keys(this.apps).length!==0){var e=this.globalsForEvent(i);for(var t of Object.values(this.apps))try{t.processEvent==null||t.processEvent(e)}catch(r){Ie.error("Error while processing event "+i.event+" for site app "+t.id,r)}}}onRemoteConfig(i){var e,t,r,s=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.Es(),void this._instance.on("eventCaptured",(l=>this.Ss(l)))):void Ie.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this.$s)==null||t.call(this),(r=i.siteApps)!=null&&r.length)if(this.isEnabled){var n=function(l){var c;E["__$$ph_site_app_"+l]=s._instance,(c=E.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(s._instance,a,(u=>{if(u)return Ie.error("Error while initializing PostHog app with config id "+l,u)}))};for(var{id:o,url:a}of i.siteApps)n(o)}else Ie.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},tl=f({},Xa,Ja,Za,Qa,el,{tracingHeaders:class{constructor(i){this.ks=void 0,this.Ps=void 0,this.us=()=>{var e,t;y(this.ks)&&((e=E.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),y(this.Ps)&&((t=E.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=i}V(i){var e,t;(e=E.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns&&i(),(t=E.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return Ga.error("failed to load script",r);i()}))}startIfEnabledOrStop(){var i,e;this._instance.config.__add_tracing_headers?this.V(this.us):((i=this.ks)==null||i.call(this),(e=this.Ps)==null||e.call(this),this.ks=void 0,this.Ps=void 0)}}});nt.__defaultExtensionClasses=f({},tl);var Zs,ke=(Zs=St[Ke]=new nt,(function(){function i(){i.done||(i.done=!0,Yn=!1,A(St,(function(e){e._dom_loaded()})))}m!=null&&m.addEventListener?m.readyState==="complete"?i():j(m,"DOMContentLoaded",i,{capture:!1}):d&&b.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),Zs);var He=class He{constructor(e,t=!1){this.has_initialized=!1;this.has_identified=!1;this.debug=!1;this.log=ts("[PostHog]",()=>this.debug);this.init=()=>{try{let{apiKey:e,api_host:t,config:r={}}=this.options;if(!e){console.warn("Posthog: No API key provided");return}let s=t||Qr();this.log("init | loading PostHog SDK",{api_host:s});let n={api_host:s,ui_host:Zr,autocapture:!0,capture_pageview:"history_change",session_recording:{recordCrossOriginIframes:!0,minimumDurationMilliseconds:3e4,...r.session_recording},before_send:o=>{if(typeof window>"u")return null;let a=window.location.hostname;if(a==="localhost"||a==="127.0.0.1")return o;let l=es.some(c=>a.endsWith(`.${c}`)||a===c);return l||this.log("init | before_send blocked event from disallowed host",{currentHost:a}),l?o:null},...r};ke.init(e,n),this.has_initialized=!0,this.log("init | PostHog SDK loaded successfully")}catch(e){console.error("Posthog: Failed to initialize",e)}};this.identifyEvent=(e,t)=>{if(!this.has_initialized){console.warn("Posthog: Cannot identify - not initialized");return}try{let r=typeof ke._isIdentified=="function"?ke._isIdentified():this.has_identified;e&&!r?(this.log("identifyEvent | identifying user",{user_id:e,traits:t}),ke.identify(e,{...t,client_id:e}),this.has_identified=!0):this.log("identifyEvent | skipped \u2014 user already identified",{user_id:e})}catch(r){console.error("Posthog: Failed to identify user",r)}};this.reset=()=>{if(this.has_initialized)try{this.log("reset | resetting PostHog session"),ke.reset(),this.has_identified=!1}catch(e){console.error("Posthog: Failed to reset",e)}};this.backfillPersonProperties=({user_id:e,email:t,country_of_residence:r})=>{if(!(!this.has_initialized||!e))try{let s=ke.get_property("$stored_person_properties")??{},n={};s.client_id||(n.client_id=e),t&&s.is_internal===void 0&&(n.is_internal=is(t)),r&&!s.country_of_residence&&(n.country_of_residence=r),Object.keys(n).length>0?(this.log("backfillPersonProperties | backfilling person properties",{user_id:e,updates:n}),ke.setPersonProperties(n)):this.log("backfillPersonProperties | skipped \u2014 all properties already present",{user_id:e,country_of_residence:r})}catch(s){console.error("Posthog: Failed to backfill person properties",s)}};this.capture=(e,t)=>{if(this.has_initialized)try{this.log("capture | sending event to PostHog",{event_name:e,properties:t}),ke.capture(e,t)}catch(r){console.error("Posthog: Failed to capture event",r)}};this.options=e,this.debug=t,this.init()}};He.getPosthogInstance=(e,t=!1)=>(He._instance||(He._instance=new He(e,t)),He._instance);var oo=He;export{oo as Posthog};
6
- //# sourceMappingURL=posthog-PBG3EMGB.mjs.map