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