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