PageSourceSearch

https://app.cloudsmith.com/_next/static/chunks/08z2yiuuy71r2.js

js cloudsmith.com collected 2026-09-24 17:17:22 UTC 180,720 bytes, 5 lines download raw bytes

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

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.