@funnel10x/tracking 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -5
- package/dist/gtm.html +2 -2
- package/dist/index.js +7 -7
- package/dist/tag.js +7 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var b="u">typeof window?window:void 0,be="u">typeof globalThis?globalThis:b,pe=be==null?void 0:be.navigator,$=be==null?void 0:be.document,K=be==null?void 0:be.location,Ii=be==null?void 0:be.fetch,sr=be!=null&&be.XMLHttpRequest&&"withCredentials"in new be.XMLHttpRequest?be.XMLHttpRequest:void 0,Kr=be==null?void 0:be.AbortController,Zu=be==null?void 0:be.CompressionStream,xe=pe==null?void 0:pe.userAgent,ai=typeof globalThis!="undefined"?globalThis:b;ai&&typeof self=="undefined"&&(ai.self=ai),ai&&typeof File=="undefined"&&(ai.File=function(){});var F=b!=null?b:{},Qr="0.9.2",st={DEBUG:!1,LIB_VERSION:Qr,LIB_NAME:"browser-common",JS_SDK_VERSION:Qr},Ze=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),$n=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),Yu=["$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"],Xu=["token"];function A(e,t){return e.indexOf(t)!==-1}var Zt=function(e){return e.trim()},Pn=function(e){return e.replace(/^\$/,"")};function Ra(e){var t;let i=[];return(t=JSON.stringify(e,function(s,n){if(typeof n=="bigint")return n.toString();if(typeof n!="function"&&typeof n!="symbol"){if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n=="object"){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(n))return"[Circular]";i.push(n)}return n}}))!==null&&t!==void 0?t:"null"}var Oa=Object.prototype,nr=Oa.hasOwnProperty,Ps=Oa.toString,R=Array.isArray||function(e){return Ps.call(e)==="[object Array]"},le=e=>typeof e=="function",L=e=>e===Object(e)&&!R(e),Me=e=>{if(L(e)){for(let t in e)if(nr.call(e,t))return!1;return!0}return!1},S=e=>e===void 0,D=e=>Ps.call(e)=="[object String]",yi=e=>D(e)&&e.trim().length===0,ne=e=>e===null,O=e=>S(e)||ne(e),oe=e=>Ps.call(e)=="[object Number]"&&e==e,Qe=e=>oe(e)&&e>0,Se=e=>Ps.call(e)==="[object Boolean]",Ju=e=>A(Yu,e),Ku=e=>A(Xu,e);function La(e){return e===null||typeof e!="object"}function as(e,t){return{}.toString.call(e)===`[object ${t}]`}function ii(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Da(e,Error)}}function rr(e){return"u">typeof Event&&Da(e,Event)}function Da(e,t){try{return e instanceof t}catch{return!1}}var Qu=[!0,"true",1,"1","yes"],js=e=>A(Qu,e),ed=[!1,"false",0,"0","no"];function eo(e,t,i,s,n,r,o){try{var a=e[r](o),l=a.value}catch(c){return void i(c)}a.done?t(l):Promise.resolve(l).then(s,n)}function ee(e){return function(){var t=this,i=arguments;return new Promise(function(s,n){var r=e.apply(t,i);function o(l){eo(r,s,n,o,a,"next",l)}function a(l){eo(r,s,n,o,a,"throw",l)}o(void 0)})}}var td=["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","pinterestbot","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"],Ui=new Map,to=function(e,t=[]){if(!e)return!1;let i=(function(o,a){let l="";for(let c=0;a.length>c;c++){let u=a[c];l+=u.length+":"+u}return o.length+":"+o+"|"+a.length+":"+l})(e,t),s=Ui.get(i);if(s!==void 0)return s;let n=e.toLowerCase(),r=td.concat(t).some(o=>n.indexOf(o.toLowerCase())!==-1);return 256>Ui.size||Ui.clear(),Ui.set(i,r),r};function Ye(e,t,i,s,n){return t>i&&(s.warn("min cannot be greater than max."),t=i),oe(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(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: "+n),Ye(n!=null?n:i,t,i,s))}var id=class{constructor(e){this.C={},this.I=e.I,this.R=Ye(e.bucketSize,0,100,e.A),this.$=Ye(e.refillRate,0,this.R,e.A),this.O=Ye(e.refillInterval,0,864e5,e.A)}F(e,t){let i=Math.floor((t-e.lastAccess)/this.O);i>0&&(e.tokens=Math.min(e.tokens+i*this.$,this.R),e.lastAccess=e.lastAccess+i*this.O)}consumeRateLimit(e){var t;let i=Date.now(),s=String(e),n=this.C[s];return n?this.F(n,i):(n={tokens:this.R,lastAccess:i},this.C[s]=n),n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),n.tokens===0)}stop(){this.C={}}},Yt="Mobile",Fi="Android",ls="Tablet",Na="Android Tablet",ja="iPad",Va="Apple Watch",Qi="Safari",Ms="BlackBerry",Ha="Samsung Internet",es="Chrome",Ba="Chrome iOS",Wa="Internet Explorer",Ua="Internet Explorer Mobile",za="Opera",Ga="Microsoft Edge",ts="Firefox",qa="Firefox iOS",cs="Nintendo",us="PlayStation",Ts="Xbox",Za="Android Mobile",Ya="Mobile Safari",Vs="Windows",Xa="Windows Phone",io="Nokia",Mn="Ouya",sd="Generic "+Yt.toLowerCase(),Ja="Generic "+ls.toLowerCase(),Tn="Konqueror",Ka="Oculus Browser",Qa="Vivaldi",el="Yandex",tl="Whale",il="DuckDuckGo",sl="Pale Moon",nl="Waterfox",In="Brave",rl="Claude",ol="Codex",al="ChatGPT",ll="Google Search App",Hs=new RegExp("Version/(\\d+(\\.\\d+)?)"),Bs=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),nd=new RegExp(Ts,"i"),rd=new RegExp("PlayStation \\w+","i"),od=new RegExp("Nintendo \\w+","i"),or=new RegExp("BlackBerry|PlayBook|BB10","i"),ad={"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"},cl=function(e,t,i,s){return t=t||"",(function(r){return r!=null&&r.brave?In:null})(i)||(s!=null&&s.detectGoogleSearchApp&&A(e,"GSA/")?ll:A(e," OPR/")&&A(e,"Mini")?"Opera Mini":A(e," OPR/")?za:or.test(e)?Ms:A(e,"IEMobile")||A(e,"WPDesktop")?Ua:A(e,"OculusBrowser")?Ka:A(e,"SamsungBrowser")?Ha:A(e,"Edge")||A(e,"Edg/")?Ga:A(e,"Vivaldi/")?Qa:A(e,"YaBrowser/")?el:A(e,"Whale/")?tl:A(e,"DuckDuckGo/")||A(e,"Ddg/")?il:A(e,"Claude/")?rl:A(e,"Codex/")?ol:A(e,"ChatGPT/")?al:A(e,"FBIOS")?"Facebook Mobile":A(e,"UCWEB")||A(e,"UCBrowser")?"UC Browser":A(e,"CriOS")?Ba:A(e,"CrMo")||A(e,es)?es:A(e,Fi)&&A(e,Qi)?Za:A(e,"FxiOS")?qa:A(e.toLowerCase(),Tn.toLowerCase())?Tn:A(e,"Brave/")?In:((r,o)=>o&&A(o,"Apple")||(function(a){return A(a,Qi)&&!A(a,es)&&!A(a,Fi)})(r))(e,t)?A(e,Yt)?Ya:Qi:A(e,"PaleMoon/")?sl:A(e,"Waterfox/")?nl:A(e,ts)?ts:A(e,"MSIE")||A(e,"Trident/")?Wa:A(e,"Gecko")?ts:"")},ld={[Ua]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Ga]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[es]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Ba]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Qi]:[Hs],[Ya]:[Hs],[za]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ts]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[qa]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Tn]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Ms]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Hs],[Za]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Ha]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Ka]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Qa]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[el]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[tl]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[In]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[rl]:[Bs],[ol]:[Bs],[al]:[Bs],[il]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[sl]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[nl]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[ll]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Wa]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},cd=function(e,t,i,s){let n=cl(e,t,i,s),r=ld[n];if(S(r))return null;for(let o=0;r.length>o;o++){let a=e.match(r[o]);if(a)return parseFloat(a[a.length-2])}return null},so=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[Ts,e&&e[1]||""]],[new RegExp(cs,"i"),[cs,""]],[new RegExp(us,"i"),[us,""]],[or,[Ms,""]],[new RegExp(Vs,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Xa,""];if(new RegExp(Yt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];let i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let s=ad[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[Vs,s]}return[Vs,""]}],[/((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=>{let t="";return e&&e.length>=3&&(t=S(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Fi,[e[2],e[3],e[4]||"0"].join(".")]:[Fi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],ul=function(e){for(let t=0;so.length>t;t++){let[i,s]=so[t],n=i.exec(e),r=n&&(le(s)?s(n,e):s);if(r)return r}return["",""]},dl=function(e){return od.test(e)?cs:rd.test(e)?us:nd.test(e)?Ts:new RegExp(Mn,"i").test(e)?Mn:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?Xa:/iPad/.test(e)?ja:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Va:or.test(e)?Ms:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(io,"i").test(e)?io:/(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(Yt).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)?Fi:Na:new RegExp("(pda|Mobile)","i").test(e)?sd:new RegExp(ls,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?Ja:""},ud=function(e,t){var i;let s=dl(e);return s===ja||s===Na||s==="Kobo"||s==="Kindle Fire"||s===Ja?ls:s===cs||s===Ts||s===us||s===Mn?"Console":s===Va?"Wearable":s?Yt:(t==null?void 0:t.userAgentDataPlatform)==="Android"&&((i=t==null?void 0:t.maxTouchPoints)!==null&&i!==void 0?i:0)>0?600>Math.min((n=t==null?void 0:t.screenWidth)!==null&&n!==void 0?n:0,(r=t==null?void 0:t.screenHeight)!==null&&r!==void 0?r:0)/((o=t==null?void 0:t.devicePixelRatio)!==null&&o!==void 0?o:1)?Yt:ls:"Desktop";var n,r,o},Ws=/\bFBAV\/(\d+(?:\.\d+)*)/i,no=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Ws],[/\bFBAN\/EMA\b/i,"Facebook Lite",Ws],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Ws],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],Fn="[Truncated]",Di="[Unserializable]";function zt(e){let t="";for(let i=0;e.length>i;i++){let s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"\uFFFD";else{let n=e.charCodeAt(i+1);56320>n||n>57343?t+="\uFFFD":(t+=e[i]+e[i+1],i++)}}return t}function hl(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch{i=[]}for(let s of i){let n;try{n=t[s]}catch{n=Di}Object.defineProperty(e,s,{value:n,enumerable:!0,writable:!0,configurable:!0})}return e}var is=3e5,pl=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;let t=this.isOpen(),i=Date.now(),s=Math.min(e.retryAfterMs,is);if(!t)return this.ts=i,void(this.es=i+s);this.es=Math.max(this.es,Math.min(i+s,this.ts+is))}remainingMs(){let e=Date.now();if(this.ts-5e3>e)return this.reset(),0;let t=Math.min(is,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}},dd=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ro(e,t){return typeof(i=e)=="string"&&dd.test(i)?e:t();var i}function fl(e,t){let i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return i}function yt(e){return e&&e.split("#")[0]}function oo(e){try{return e()}catch{return}}function vl(e,t){let i=setTimeout(e,t);return i!=null&&i.unref&&(i==null||i.unref()),i}function ao(e,t,i){return gl.apply(this,arguments)}function gl(){return(gl=ee(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((n,r)=>{s=vl(()=>{try{i==null||i(),n()}catch(o){r(o)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}var zi,lo,Us;function hd(e){let t=globalThis._posthogChunkIds;if(!t)return;let i=Object.keys(t);return Us&&i.length===lo||(lo=i.length,Us=i.reduce((s,n)=>{zi||(zi={});let r=zi[n];if(r)s[r[0]]=r[1];else{let o=e(n);for(let a=o.length-1;a>=0;a--){let l=o[a],c=l==null?void 0:l.filename,u=t[n];if(c&&u){s[c]=u,zi[n]=[c,u];break}}}return s},{})),Us}function bi(e){return bi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bi(e)}function pd(e,t,i){return(t=(function(s){var n=(function(r){if(bi(r)!="object"||!r)return r;var o=r[Symbol.toPrimitive];if(o!==void 0){var a=o.call(r,"string");if(bi(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(s);return bi(n)=="symbol"?n:n+""})(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function co(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),i.push.apply(i,s)}return i}function f(e){for(var t=1;arguments.length>t;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?co(Object(i),!0).forEach(function(s){pd(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):co(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var fd=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){let i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(t),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(e){var t=this;return ee(function*(){for(let i of e)i.stacktrace&&i.stacktrace.frames&&R(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:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let s,n;if(e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{n=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch{}return f(f({},e),{},{cause:s,stack:n,errors:(i=e.errors)===null||i===void 0?void 0:i.map(r=>this.parseStacktrace(r,t))})}applyChunkIds(e,t){return e.map(i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i))}applyCoercers(e,t){for(let i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return ee(function*(){let i=e;for(let s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){let i=[],s=(n,r,o)=>{var a;let l=i.length,c=r===void 0?f(f({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:n.synthetic,exception_id:l}):{type:"chained",source:o,synthetic:n.synthetic,exception_id:l,parent_id:r},u={type:n.type,value:n.value,mechanism:c};n.stack&&(u.stacktrace={type:"raw",frames:n.stack}),i.push(u),n.cause&&s(n.cause,l,"cause");for(let d of(a=n.errors)!==null&&a!==void 0?a:[])s(d,l,"member")};return s(e),i}buildParsingContext(e){var t;return{chunkIdMap:hd(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(ii(e)){let i=Object.getPrototypeOf(e);for(let s=0;i&&100>s;s++){var t;let n=(t=Object.getOwnPropertyDescriptor(i,"constructor"))===null||t===void 0?void 0:t.value;if(typeof n=="function"&&n.name==="AggregateError"){let r=e.errors;return R(r)?r:void 0}i=Object.getPrototypeOf(i)}}}catch{}}buildCoercingContext(e,t,i=0){let s=0,n=0,r=!1,o=new Set,a=[],l={},c=(h,p,v=0)=>{let _=u(p,v),g=_.apply;if(_.apply=k=>{a.push(h);try{return g(k)}finally{a.pop()}},v>4||v>0&&a.indexOf(h)!==-1)return this.coerceFallback(_);let y=typeof h=="object"&&h!==null||typeof h=="function";if(v===0&&s>=50||y&&o.has(h))return;y&&o.add(h),v===0&&s++;let m=this.getAggregateErrors(h),w,P;r||(r=!!m);try{if(w=this.applyCoercers(h,_),!w)throw l}catch(k){if(k===l)return void(v===0&&s--);if(!r)throw k;w=this.coerceFallback(_)}if(!m||s>=50)return w;try{P=m.length}catch{return w}if(!Number.isInteger(P)||0>P||P>4294967295)return w;let x=[];for(let k=0;50>s&&1e3>n&&P>k;k++){let T;n++;try{T=_.next(m[k])}catch{s++,T=this.coerceFallback(u(p+1))}T&&x.push(T)}return f(f({},w),{},{errors:x})},u=(h,p=0)=>f(f({},t),{},{syntheticException:h==0?t.syntheticException:void 0,mechanism:h==0?e:{},apply(v){let _=c(v,h,p+1);if(!_)throw l;return _},next:v=>c(v,h+1)}),d=u(i);return f(f({},d),{},{apply:h=>{var p;return(p=c(h,i))!==null&&p!==void 0?p:this.coerceFallback(d)}})}},vd=/^([a-z][a-z0-9.+-]+):/i,gd=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function _d(e){if(!e||e==="<anonymous>")return!1;let t=vd.exec(e);return!t||gd.includes(t[1].toLowerCase())}function Cn(e,t,i,s,n){let r={platform:e,filename:t,function:i==="<anonymous>"?"?":i,in_app:_d(t)};return S(s)||(r.lineno=s),S(n)||(r.colno=n),r}var _l=(e,t)=>{let i=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return i||s?[e.indexOf("@")!==-1?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},md=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,yd=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,bd=/\((\S*)(?::(\d+))(?::(\d+))\)/,wd=(e,t)=>{let i=md.exec(e);if(i){let[,n,r,o]=i;return Cn(t,n,"?",+r,+o)}let s=yd.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){let o=bd.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}let[n,r]=_l(s[1]||"?",s[2]);return Cn(t,r,n,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},xd=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,kd=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Sd=(e,t)=>{let i=xd.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){let r=kd.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}let s=i[3],n=i[1]||"?";return[n,s]=_l(n,s),Cn(t,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},uo=/\(error: (.*)\)/;function ar(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function Ed(e){for(let t=1;10>=t;t++){let i=e.length-2*t;if(0>i)break;let s=!0;for(let n=0;t>n;n++)if(!ar(e[i+n],e[i+t+n])){s=!1;break}if(s){for(let n=0;t>n;n++)e[i+n]=e[i+t+n];return e.length=i+t,{start:i,length:t}}}}function $d(e,t){let i=t.start+t.length,s=yl(e,t);s&&e.splice(i+s===e.length?i:t.start,s)}function ml(e,t){let i=t.start;for(;i>0&&ar(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function yl(e,t){let i=t.start+t.length,s=i;for(;e.length>s&&ar(e[s],e[s-t.length]);)s++;return s-i}function Pd(e,t){let i=t[0],s=e.length-(i?ml(e,i):0);for(let n of t)s-=yl(e,n);return s}function Md(e,t,i){for(let s=0;e.length>s;s++){let n=e[(t+s)%e.length],r=e[(i+s)%e.length];if(n!==r)return r>n}return!1}var Td=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let i=D(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){let t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return as(e,"DOMException")}isDOMError(e){return as(e,"DOMError")}},Id=class{match(e){return ii(e)}coerce(e,t){var i;let s=this.getStack(e),n=s===void 0?(i=t.syntheticException)===null||i===void 0?void 0:i.stack:void 0,r=!!n;return{type:this.getType(e),value:this.getMessage(e,t),stack:s!=null?s:n,cause:e.cause?t.next(e.cause):void 0,synthetic:r}}getType(e){return e.name||e.constructor.name}getMessage(e,t){let i=e.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){try{let t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;let i=e.stack;return typeof i=="string"&&i.length>0?i:void 0}catch{return}}},Fd=class{match(e){return!!as(e,"ErrorEvent")&&(e.error!=null||this.ar(e))}coerce(e,t){var i;if(e.error!=null)return t.apply(e.error);let s=t.apply(e.message);return f(f({},s),{},{stack:(i=this.lr(e))!==null&&i!==void 0?i:s.stack,synthetic:!0})}ar(e){return D(e.message)&&e.message.length>0}lr(e){var t,i;let s=e,n=(t=s.lineno)!==null&&t!==void 0?t:0,r=(i=s.colno)!==null&&i!==void 0?i:0;if(D(s.filename)&&s.filename.length!==0&&n!==0)return`Error
|
|
2
|
-
at ${s.filename}:${n}:${r}`}},Cd=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ad=class{match(e){return typeof e=="string"}coerce(e,t){var i;let[s,n]=this.getInfos(e);return{type:s!=null?s:"Error",value:n!=null?n:e,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e,s=e.match(Cd);return s&&(t=s[1],i=s[2]),[t,i]}},Rd=["fatal","error","warning","log","info","debug"];function bl(e,t=40){let i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let s=i.length;s>0;s--){let n=i.slice(0,s).join(", ");if(t>=n.length)return s===i.length?n:n.length>t?`${n.slice(0,t)}...`:n}return""}var Od=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s;let n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:(i=this.getStack(e))!==null&&i!==void 0?i:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(rr(e))return e.constructor.name;let t="name"in e?e.name:void 0;return D(t)&&!yi(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let i=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(i+=` with message: '${e.message}'`),i}if("message"in e&&typeof e.message=="string")return e.message;let t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${bl(e)}`}isSeverityLevel(e){return D(e)&&!yi(e)&&Rd.indexOf(e)>=0}getStack(e){try{return D(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:D(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(let t in e)if({}.hasOwnProperty.call(e,t)){let i=e[t];if(ii(i))return i}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Ld=class{match(e){return rr(e)}coerce(e,t){var i;let s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${bl(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},Dd=class{match(e){return La(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},Nd=class{match(e){return as(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!rr(e))return!1;try{let t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var i;let s=this.getUnhandledRejectionReason(e);return La(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},ds="$message",hs="$timestamp",jd=new Set([ds,hs]),zs={enabled:!0,max_bytes:32768};function ps(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:zs.enabled,max_bytes:Hd(e.max_bytes,zs.max_bytes)}:f({},zs)}var Vd=class{constructor(e){this.ns=[],this.ss=0,this.Mr=ps(e)}setConfig(e){this.Mr=ps(e),this.rs()}add(e){let t=(function(s){let n;try{n=Ra(s)}catch{return}try{let r=JSON.parse(n);if(!L(r))return;let o=r,a=o[ds],l=o[hs];return!D(a)||a.trim().length===0||!D(l)&&!oe(l)?void 0:{step:o,json:n}}catch{return}})(e);if(!t)return;let i=(function(s){if("u">typeof TextEncoder)return new TextEncoder().encode(s).length;let n=encodeURIComponent(s),r=0;for(let o=0;n.length>o;o++)n[o]==="%"?(r+=1,o+=2):r+=1;return r})(t.json);i>this.Mr.max_bytes||(this.ns.push({step:t.step,bytes:i}),this.ss+=i,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Mr.max_bytes&&this.ns.length>0;){let e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function Hd(e,t){if(!oe(e)||e===1/0||e===-1/0)return t;let i=Math.floor(e);return 0>i?t:i}var ho=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function po(e){return typeof e=="string"||e}function fo(e){return typeof e=="string"?e:void 0}var Bd=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server","$react_native_version"],wl="NativeGzipValidationError",An=e=>e.length>=2&&e[0]===31&&e[1]===139,vo=(e,t)=>e===$n.GZipJS||t===$n.GZipJS||t==="gzip",go=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",li,Gi=e=>{throw fl(wl,`Native gzip produced invalid output: ${e}`)},Wd=(_o=ee(function*(e,t){18>e.size&&Gi("too-short");let i=new Uint8Array(yield e.slice(0,10).arrayBuffer());An(i)&&i[2]===8||Gi("invalid-header");let s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(r=>{let o=(()=>{if(li)return li;li=[];for(let l=0;256>l;l++){let c=l;for(let u=0;8>u;u++)c=1&c?3988292384^c>>>1:c>>>1;li[l]=c>>>0}return li})(),a=4294967295;for(let l=0;r.length>l;l++)a=o[255&(a^r[l])]^a>>>8;return(4294967295^a)>>>0})(t)&&Gi("invalid-crc");let n=t.length>>>0;s.getUint32(4,!0)!==n&&Gi("invalid-size")}),function(e,t){return _o.apply(this,arguments)}),_o;function Rn(){return Rn=ee(function*(e,t=!0,i){try{let n=new TextEncoder().encode(e),r=new globalThis.CompressionStream("gzip"),o=r.writable.getWriter(),a=o.write(n).then(()=>o.close()).catch((s=ee(function*(u){try{yield o.abort(u)}catch{}throw u}),function(u){return s.apply(this,arguments)})),l=new Response(r.readable).blob(),[c]=yield Promise.all([l,a]);return yield Wd(c,n),c}catch(n){if(i!=null&&i.rethrow)throw n;return t&&console.error("Failed to gzip compress data",n),null}var s}),Rn.apply(this,arguments)}function xl(e,t){if(e==null)return{};var i,s,n=(function(o,a){if(o==null)return{};var l={};for(var c in o)if({}.hasOwnProperty.call(o,c)){if(a.includes(c))continue;l[c]=o[c]}return l})(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(s=0;r.length>s;s++)t.includes(i=r[s])||{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}var ye="[redacted]",Ud=/^[A-Za-z0-9+/\n\r]+=*$/,zd=/^[A-Za-z0-9_-]+={0,2}$/,Gd=/[-_]/,qd=/^data:[^,\s]*;base64,/i,Zd=/^[A-Za-z0-9+/_-]+={0,2}$/,Yd=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Xd=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,kl=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,Jd=/[\s<>"]/,Sl=new RegExp(kl.source,"i"),El=/[a-z][a-z0-9+.-]{0,63}:\/\//i,Kd=new RegExp(`^${El.source}`,"i"),Qd=new RegExp(El.source,"gi"),eh=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,th=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,ih=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,sh=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,nh=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,rh=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,oh=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,ah=/\b\d(?:[ ./-]?\d){12,}\b/g,mo=/\d+/g,lh=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,ch=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function On(e){return(function(t){return Xd.test(t)})(e)||eh.test(e)||th.test(e)}function Gs(e){return e.split("&",129).length>128}function uh(e,t,i){return On(e)||t.includes(";")&&(function(s){return s.split(";").some(n=>On(n.split("=",1)[0]))})(t)?ye:Sl.test(t)?i?lr(t,{allowNestedUrls:!1,stripPunctuation:!0}):ye:t}function $l(e,t){let i=new URLSearchParams,s=!1,n=!1;for(let[r,o]of new URLSearchParams(e)){let a=uh(r,o,t);s||(s=a!==o),n=On(r)||a!==o,i.append(r,a)}return{changed:s,lastFieldSensitive:n,serialized:i.toString()}}function yo(e,t){if(!e.includes("="))return{value:dh(e,t),lastFieldSensitive:!1};let i=$l(e,t);return{value:i.changed?i.serialized:e,lastFieldSensitive:i.lastFieldSensitive}}function dh(e,t){return t?lr(e,{allowNestedUrls:!1,stripPunctuation:!0}):Sl.test(e)?ye:e}function hh(e,t,i){return e==="#"?!t.fragment&&(t.fragment=!0):e==="?"&&(t.fragment?i!=="="&&!t.fragmentQuery&&(t.fragmentQuery=!0):!t.query&&(t.query=!0))}function qs(e,t){var i;if(e.length>8192&&Kd.test(e))return ye;let{address:s,suffix:n}=t.stripPunctuation?(function(g){let y=g.length;for(;y>0&&".,;:!?)]}'".includes(g[y-1]);)y--;return{address:g.slice(0,y),suffix:g.slice(y)}})(e):{address:e,suffix:""},r;try{r=new URL(s)}catch{return ye+n}let o=r.search.slice(1),a=r.hash!=="",l=(function(g){let y=g.slice(1),m=y.indexOf("?");return 0>m?{head:y,tail:null}:{head:y.slice(0,m),tail:y.slice(m+1)}})(r.hash);if(Gs(o)||Gs(l.head)||Gs((i=l.tail)!==null&&i!==void 0?i:""))return ye+n;let c=!1;(r.username||r.password)&&(r.username=ye,r.password="",c=!0);let u=$l(o,t.allowNestedUrls);u.changed&&(r.search=u.serialized,c=!0);let d=yo(l.head,t.allowNestedUrls),h=l.tail===null?null:(p=l.tail,d.lastFieldSensitive?{value:p===""?"":ye,lastFieldSensitive:!0}:yo(p,t.allowNestedUrls));var p;let v=h===null?d.value:`${d.value}?${h.value}`;v!==r.hash.slice(1)&&(r.hash=v,c=!0);let _=a?h!=null?h:d:u;return(c?r.toString():s)+(_.lastFieldSensitive?"":n)}function lr(e,t){return e.replace(kl,i=>(function(s,n){let r=(function(l){if(!l.includes("://"))return[];let c=[...l.matchAll(Qd)].map(_=>_.index),u=[],d={query:!1,fragment:!1,fragmentQuery:!1},h=0,p=!1,v="";for(let _=0;l.length>_&&c.length>h;_++){c[h]===_&&(_>0&&v!=="="&&u.push(_),h++);let g=l[_];hh(g,d,v)?(v=g,p=!0):p&&"=&".includes(g)&&(v=g)}return u})(s);if(r.length===0)return qs(s,n);let o="",a=0;for(let l of r)o+=qs(s.slice(a,l),f(f({},n),{},{stripPunctuation:!1})),a=l;return o+qs(s.slice(a),n)})(i,f(f({},t),{},{stripPunctuation:t.stripPunctuation&&i.length!==e.length})))}function ph(e,t){return(function(i){return i.length>=10240&&(Ud.test(i)||(function(s){let n=qd.exec(s);if(!n)return!1;let r;try{r=decodeURIComponent(s.slice(n[0].length))}catch{return!1}return Zd.test(r.replace(/[\r\n]/g,""))})(i)||Gd.test(i)&&zd.test(i))})(e)?"[binary data redacted - not supported by PostHog MCP analytics]":(function(i,s,n){let r=4*n.maxStringLength;if(i.length>r){let o=s(i.slice(0,(function(a,l){let c=l;for(;c>0&&!Jd.test(a[c-1]);)c--;return c})(i,r)));if(o.length>=2*n.maxStringLength)return o+n.truncationSuffix}return s(i)})(e,i=>(function(s){return lr(s,{allowNestedUrls:!0,stripPunctuation:!0})})((function(s){let n=s.replace(ih," ");return n=n.replace(sh,ye),n=n.replace(nh,ye),n=n.replace(rh,`$1${ye}`),n=n.replace(ah,vh),n=n.replace(oh,ye),n=n.replace(lh,`$1${ye}`),n=n.replace(ch,`$1${ye}`),n})((function(s){return s.replace(Yd,ye)})(i))),t)}function fh(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let n=e.charCodeAt(s)-48;if(0>n||n>9)return!1;i&&(n*=2,n>9&&(n-=9)),t+=n,i=!i}return t%10==0}function vh(e){let t=[];for(let r=mo.exec(e);r!==null;r=mo.exec(e))t.push({digits:r[0],start:r.index,end:r.index+r[0].length});let i="",s=0,n=0;for(;t.length>n;){let r="",o=-1;for(let a=n;t.length>a&&(r+=t[a].digits,19>=r.length);a++)r.length>=13&&fh(r)&&(o=a);0>o?n++:(i+=e.slice(s,t[n].start)+ye,s=t[o].end,n=o+1)}return i+e.slice(s)}var gh={}.propertyIsEnumerable;function fs(e,t){try{return Pl(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function cr(e,t,i,s){if(0>=i.remainingNodes)return{stringValue:Fn};if(i.remainingNodes--,Se(e))return{boolValue:e};if(typeof e=="bigint")return(function(n,r){let o=n.toString(),a=BigInt("9223372036854775808");return n>=a||-a>n?(r==null||r.debug(`Attribute ${o} is outside the int64 range; encoding it as a string`),{stringValue:o}):{intValue:o}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};let n=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t==null||t.debug(`Attribute ${n} is outside the int64 range; encoding it as a string`),{stringValue:n}):{intValue:n}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:zt(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:Fn};if(e instanceof Date){let n=e.getTime(),r=Number.isFinite(n)?e.toISOString():String(e);return{stringValue:typeof r=="string"?zt(r):String(r)}}i.ancestors.add(e);try{try{let n=e.toJSON;if(typeof n=="function")return cr(n.call(e),t,i,s+1)}catch{}return R(e)?{arrayValue:{values:_h(e,t,i,s+1)}}:{kvlistValue:{values:Pl(e,t,i,s+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:zt(String(e))}}function _h(e,t,i,s){let n=[],r=Math.min(e.length,1e3),o=0;for(;r>o&&i.remainingNodes>0;o++)try{let a=o in e?e[o]:void 0;if(O(a))continue;n.push(cr(a,t,i,s))}catch{n.push({stringValue:Di})}return e.length>o&&n.push({stringValue:Fn}),n}function Pl(e,t,i,s){let n=[];for(let r in e)if(gh.call(e,r)){if(!r){t==null||t.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=i.remainingNodes){t==null||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{let o=e[r];if(ne(o)||S(o))continue;n.push({key:zt(r),value:cr(o,t,i,s)})}catch{n.push({key:zt(r),value:{stringValue:Di}})}}return n}function Ml(e,t,i){return f(f(f(f({},hl({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}var mh=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function Tl(e,t){let i=hl({},e),s={};for(let n of mh)({}).hasOwnProperty.call(i,n)&&(s[n]=i[n],delete i[n]);return[...fs(i,t),...fs(s,t)]}var bo={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},Il={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},yh=Il.info;function bh(e){try{return zt(String(e))}catch{return Di}}function wh(e,t,i,s){let n=e.level||"info",{text:r,number:o}=Il[n]||yh,a=(function(h=Date.now()){return String(h)+"000000"})(oe(s)?s:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),O(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),O(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);let c=f({},l),u=e.attributes;if(u){let h=[];try{h=Object.keys(u)}catch{h=[]}for(let p of h){let v;try{v=u[p]}catch{v=Di}Object.defineProperty(c,p,{value:v,enumerable:!0,writable:!0,configurable:!0})}}let d={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:bh(e.body)},attributes:fs(c,i)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),S(e.trace_flags)||(d.flags=e.trace_flags),d}function Fl(e,t,i){return Ml(e,t,i)}function Cl(e,t,i,s){return{resourceLogs:[{resource:{attributes:Tl(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var Al=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.cs}arm(e){this.clear(),this.us=Date.now()+e,this.cs=vl(()=>{this.cs=void 0,this.ls()},e)}armNoEarlierThan(e){this.cs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function Rl(){return .75+.5*Math.random()}function Ol(e,t,i,s){let n=Math.min(Math.max(0,t-1),6),r=e*Math.pow(2,n);return Math.round((s===void 0?r:Math.min(r,Math.max(s,e)))*i)}var xh=class{constructor(e,t,i,s,n,r=()=>Promise.resolve(),o){var a;this._instance=e,this.Mr=t,this.A=i,this.hs=s,this.ds=n,this.vs=r,this.fs=o,this.ps=new Al(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new pl,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=t.maxBufferSize,this.Is=Math.max((a=t.maxQueueSize)!==null&&a!==void 0?a:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(Ze.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var i;if(this._instance.isDisabled||this._instance.optedOut||!(e!=null&&e.body))return;let s=this.Os(e);if(s===null)return;if(!s.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;let n={record:wh(s,(i=t==null?void 0:t.context)!==null&&i!==void 0?i:this.hs(),this.A,t==null?void 0:t.occurredAtMs)};this.ds(()=>this.Ls(n))}Os(e){let t=this.Mr.beforeSend;if(!t)return e;let i=R(t)?t:[t],s=e;for(let n of i)try{let r=n(s);if(!r)return this.A.info("Log was rejected in beforeSend function"),null;s=r}catch(r){return this.A.error("Error in beforeSend function for log:",r),null}return s}Ds(){if(this.Rs===void 0)return!0;let e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.Cs=!0),!1)}flush(){var e=this;return ee(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return ee(function*(){var t;e.ps.clear();let i=(t=e._instance.getPersistedProperty(Ze.LogsQueue))!==null&&t!==void 0?t:[];if(i.length===0)return;let s=i.length,n=0;for(;i.length>0&&s>n;){var r,o;let a=e._s;e.bs=0;let l=Math.min(i.length,e.Es),c=i.slice(0,l),u=Cl(c.map(h=>h.record),e.qs(),(r=e.fs)!==null&&r!==void 0?r:e._instance.getLibraryId(),e._instance.getLibraryVersion()),d=yield e._instance.js(u);if(e._s!==a)return;if(d.kind==="too-large"&&c.length>1)e.Es=Math.max(1,Math.floor(c.length/2)),e.A.warn(`Logs batch of size ${c.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(d),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),d.kind==="retry-later"||(d.kind==="too-large"?e.A.warn("Dropping a single log record with batch size 1 \u2014 the record is larger than the server cap and cannot be split further."):d.kind==="ok"&&e.Mr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Mr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(c.length),i=(o=e._instance.getPersistedProperty(Ze.LogsQueue))!==null&&o!==void 0?o:[],n+=c.length,d.kind==="fatal"))throw d.error}})()}Bs(e){var t=this;return ee(function*(){var i;let s=Math.max(0,e-t.bs),n=(i=t._instance.getPersistedProperty(Ze.LogsQueue))!==null&&i!==void 0?i:[];t._instance.setPersistedProperty(Ze.LogsQueue,n.slice(s)),yield t.vs()})()}qs(){return Fl(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;let i=(t=this._instance.getPersistedProperty(Ze.LogsQueue))!==null&&t!==void 0?t:[];this.Is>i.length||(i.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(Ze.LogsQueue,i),this.Ts>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}zs(){return Math.max(Ol(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){let e=this._instance.getPersistedProperty(Ze.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return ee(function*(){t.ps.clear();let i=t.flush().catch(()=>{});e!==void 0?yield ao(i,e):yield i})()}flushWithTimeout(e){var t=this;return ee(function*(){let i=t.flush();yield ao(i,e,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=Rl(),this.A.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.zs())})}},Zs=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function wo(e){return String(e)+"000000"}function xo(e,t,i,s){let n="";return s&&(n=Object.keys(s).sort().map(r=>`${JSON.stringify(r)}:${JSON.stringify(s[r])}`).join(",")),`${e}\0${t}\0${i!=null?i:""}\0${n}`}var kh=class{constructor(e,t,i){this._instance=e,this.Mr=t,this.A=i,this.Hs=new Map,this.ps=new Al(()=>this.flush().catch(s=>{this.A.error("Metrics flush failed:",s)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new pl,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,i){this.Qs({name:e,type:"count",value:t,unit:i==null?void 0:i.unit,attributes:i==null?void 0:i.attributes})}gauge(e,t,i){this.Qs({name:e,type:"gauge",value:t,unit:i==null?void 0:i.unit,attributes:i==null?void 0:i.attributes})}histogram(e,t,i){this.Qs({name:e,type:"histogram",value:t,unit:i==null?void 0:i.unit,attributes:i==null?void 0:i.attributes})}flush(){var e=this;let t=this.ys,i=(function(){var s=ee(function*(){t&&(yield t.catch(()=>{})),yield e.Zs()});return function(){return s.apply(this,arguments)}})()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(this.Hs.size===0)return null;let e=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(e){if(this._instance.isDisabled||this._instance.optedOut)return;let t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.A.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.A.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.A.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,s;try{i=t.attributes?f({},t.attributes):void 0,s=xo(t.type,t.name,t.unit,i)}catch(o){return void this.A.warn(`Dropping metric '${t.name}': attributes could not be serialized`,o)}let n=this.Hs.get(s);if(!n){if(!this.Ks())return;n={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this.Hs.set(s,n)}let r=this.Ws.get(t.name);r===void 0?this.Ws.set(t.name,t.type):r===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.A.warn(`Metric name '${t.name}' is already used as a ${r}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(n,t.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,t){switch(e.type){case"count":var i;e.total=((i=e.total)!==null&&i!==void 0?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Zs.length+1).fill(0)});let s=e.hist;s.count+=1,s.sum+=t,s.min=Math.min(s.min,t),s.max=Math.max(s.max,t),s.bucketCounts[(function(n,r){for(let o=0;r.length>o;o++)if(r[o]>=n)return o;return r.length})(t,Zs)]+=1;break}}}Os(e){let t=this.Mr.beforeSend;if(!t)return e;let i=R(t)?t:[t],s=e;for(let n of i)try{let r=n(s);if(!r)return this.A.info("Metric was rejected in beforeSend function"),null;s=r}catch(r){return this.A.error("Error in beforeSend function for metric:",r),null}return s}Fs(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(Ol(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Zs(){var e=this;return ee(function*(){if(e.ps.clear(),e.Hs.size===0)return;let t=e.Hs;e.Hs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;let i=e.Gs,s=yield e._instance.Ys(e.Js(t));if(i===e.Gs)switch(e.ws.record(s),s.kind==="retry-later"?(e.ks++,e.Ss=Rl()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.zs()),s.kind){case"ok":return;case"retry-later":return e.co(t),void e.ps.armNoEarlierThan(e.zs());case"too-large":return void e.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.A.error("Failed to send metrics batch:",s.error)}})()}Js(e){return t=this.ho(e),i=(function(r,o,a){return Ml(r,o,a)})(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Tl(i)},scopeMetrics:[{scope:{name:s,version:n},metrics:t}]}]};var t,i,s,n}ho(e){let t=wo(Date.now()),i=new Map;for(let o of e.values()){var s;let a=xo(o.type,o.name,o.unit,void 0),l=i.get(a);l||(l=f({name:o.name},o.unit&&{unit:o.unit}),o.type==="count"?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:o.type==="gauge"?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},i.set(a,l));let c=fs((s=o.attributes)!==null&&s!==void 0?s:{},this.A),u=wo(o.windowStartMs);if(o.type==="count"){var n;let d={attributes:c,startTimeUnixNano:u,timeUnixNano:t,asDouble:(n=o.total)!==null&&n!==void 0?n:0};l.sum.dataPoints.push(d)}else if(o.type==="gauge"){var r;let d={attributes:c,timeUnixNano:t,asDouble:(r=o.last)!==null&&r!==void 0?r:0};l.gauge.dataPoints.push(d)}else o.hist&&l.histogram.dataPoints.push({attributes:c,startTimeUnixNano:u,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Zs})}return Array.from(i.values())}co(e){for(let[s,n]of e){let r=this.Hs.get(s);if(r)switch(r.windowStartMs=Math.min(r.windowStartMs,n.windowStartMs),r.type){case"count":var t,i;r.total=((t=r.total)!==null&&t!==void 0?t:0)+((i=n.total)!==null&&i!==void 0?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(r.hist){r.hist.count+=n.hist.count,r.hist.sum+=n.hist.sum,r.hist.min=Math.min(r.hist.min,n.hist.min),r.hist.max=Math.max(r.hist.max,n.hist.max);for(let o=0;r.hist.bucketCounts.length>o;o++)r.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else r.hist=n.hist}else this.Ks()&&this.Hs.set(s,n)}}},Ll=(e,{debugEnabled:t}={})=>{let i={N(s,...n){let r;try{r=typeof window>"u"?void 0:window}catch{return}r&&(st.DEBUG||r.POSTHOG_DEBUG||t)&&!S(r.console)&&r.console&&("__rrweb_original__"in r.console[s]?r.console[s].__rrweb_original__:r.console[s])(e,...n)},debug(...s){i.N("debug",...s)},info(...s){i.N("log",...s)},warn(...s){i.N("warn",...s)},error(...s){i.N("error",...s)},critical(...s){console.error(e,...s)},uninitializedWarning(s){i.error(`You must initialize PostHog before calling ${s}`)},createLogger:(s,n)=>Ll(`${e} ${s}`,n)};return i},M=Ll("[PostHog.js]"),re=M.createLogger,Sh=re("[ExternalScriptsLoader]"),vs=e=>{let t=$==null?void 0:$.querySelectorAll("script");if(t){for(let i=0;t.length>i;i++)if(t[i].src===e||t[i].getAttribute("src")===e)return t[i]}},Pt=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return Sh.warn(`${t} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");let s=vs(t);if(s){if(s.__posthog_loading_callback_fired)return i();let r=s.__posthog_loading_error;return r?i(r):(s.addEventListener("load",o=>{s.__posthog_loading_callback_fired=!0,i(void 0,o)}),void s.addEventListener("error",o=>{s.__posthog_loading_error=o,i(o)}))}let n=()=>{if(!$)return i("document not found");if(vs(t))return Pt(e,t,i);let r=$.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=t,r.onload=a=>{r.__posthog_loading_callback_fired=!0,i(void 0,a)},r.onerror=a=>{r.__posthog_loading_error=a,i(a)},e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")$.head.appendChild(r);else{let a=$.querySelectorAll("body > script");var o;a.length>0?(o=a[0].parentNode)===null||o===void 0||o.insertBefore(r,a[0]):$.body.appendChild(r)}};$!=null&&$.body?n():$==null||$.addEventListener("DOMContentLoaded",n)},Ys={},ko=(e,t)=>{let i=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(i=`${i}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",i)};F.__PosthogExtensions__=F.__PosthogExtensions__||{},F.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if(t==="remote-config"){let n=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);return void Pt(e,n,i)}let s=e.config.strict_script_versioning;if(s){let n=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),r=Ys[n];if(s==="fallback"&&r){if(vs(r))return void Pt(e,r,i);delete Ys[n]}return void Pt(e,n,s==="fallback"?(o,a)=>{if(o)if(typeof o=="string")i(o);else{var l;let c=ko(e,t);Ys[n]=c;let u=vs(n);u==null||(l=u.parentNode)===null||l===void 0||l.removeChild(u),Pt(e,c,i)}else i(void 0,a)}:i)}Pt(e,ko(e,t),i)},F.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{let s=e.requestRouter.endpointFor("api",t);Pt(e,s,i)},st.DEBUG=!1,st.LIB_VERSION="1.438.2",st.LIB_NAME="web";var ue=st,Ln="$early_access_features",tt="$active_feature_flags",It="$feature_flag_details",Ci="$feature_flag_errors",mt="$feature_flag_evaluated_at",Ft="$feature_flag_request_id",wi="$minimal_flag_called_events",Ve="$enabled_feature_flags",ft="$stored_group_properties",vt="$stored_person_properties",gt="$flag_call_reported",gi="$flag_call_reported_session_id",_t="$feature_flag_payloads",qe="$override_feature_flags",Mt="$override_feature_flag_payloads",Ai="visibilitychange",Eh="$people_distinct_id",je="distinct_id",ur="$device_id",Xs="$device_model",gs="__alias",$h="__cmpns",So="$fbc",Gt="$fbc_persistence",Eo="$fbp",xi="$fbp_persistence",Dn="__timers",Dl="$autocapture_disabled_server_side",Nn="$heatmaps_enabled_server_side",jn="$exception_capture_enabled_server_side",Nl="$error_tracking_suppression_rules",Vn="$error_tracking_capture_extension_exceptions",Hn="$web_vitals_enabled_server_side",dr="$dead_clicks_enabled_server_side",hr="$product_tours_enabled_server_side",jl="$logs_capture_enabled_server_side",Vl="$web_vitals_allowed_metrics",ki="$session_recording_remote_config",Ph="$session_recording_enabled_server_side",Mh="$replay_sample_rate",Th="$replay_override_sampling",Ih="$replay_override_linked_flag",Fh="$replay_override_url_trigger",Ch="$replay_override_event_trigger",Ht="$sesid",Hl="$session_is_sampled",Ah="$session_past_minimum_duration",Rh="$session_recording_url_trigger_activated_session",Oh="$session_recording_event_trigger_activated_session",Lh="$debug_first_full_snapshot_timestamp",Dh="$sess_rec_flush_size",Bl="$groups",_i="$surveys",_s="$surveys_loaded_at",Wl="$surveys_activated",Ul="$surveys_activated_session",zl="$surveys_activated_timestamps",Bn="ph_product_tours",Nh="$product_tours_activated",jh="$product_tours_activated_session",Vh="$conversations_widget_session_id",Hh="$conversations_ticket_id",Bh="$conversations_widget_state",Wh="$conversations_user_traits",ke="$user_state",Wn="$client_session_props",Uh="$capture_rate_limit",Gl="$initial_campaign_params",ql="$initial_referrer_info",Bt="$initial_person_info",pr="$epp",Js="$posthog_cookieless",Zl="$cookieless_mode",Yl="$sdk_debug_extensions_init_method",Xl="$sdk_debug_extensions_init_time_ms",fr="$sdk_debug_recording_script_not_loaded",vr="$sdk_debug_replay_stale_config",Jl="$sdk_debug_replay_event_trigger_status",Kl="$sdk_debug_replay_linked_flag_trigger_status",Ql="$sdk_debug_replay_matched_recording_trigger_groups",ec="$sdk_debug_replay_pending_trigger_conditions",tc="$sdk_debug_replay_remote_trigger_matching_config",ic="$sdk_debug_replay_trigger_groups_count",sc="$sdk_debug_replay_url_trigger_status",zh="$session_recording_start_reason",gr="PostHog loadExternalDependency extension not found.",it="anonymous",ss="identified",nc="identified_only",ms="beforeunload",_r="$pageview",$o="$pageleave",rc="$identify",Po="$groupidentify";function Wt(e,t){R(e)&&e.forEach(t)}function q(e,t){if(!O(e))if(R(e))e.forEach(t);else if((i=>i instanceof FormData)(e))e.forEach((i,s)=>t(i,s));else for(let i in e)nr.call(e,i)&&t(e[i],i)}var Q=function(e,...t){for(let i of t)for(let s in i)i[s]!==void 0&&(e[s]=i[s]);return e};function ns(e){let t=Object.keys(e),i=t.length,s=new Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}var Gh=function(e){return function(...t){try{return e.apply(this,t)}catch(i){M.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),M.critical(i)}}},mr=function(e){let t={};return q(e,function(i,s){(D(i)&&i.length>0||oe(i))&&(t[s]=i)}),t};function oc(e){let t=f({},e);for(let i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch{}return t}var qh=["herokuapp.com","vercel.app","netlify.app"];function Zh(e){let t=e==null?void 0:e.hostname;if(!D(t))return!1;let i=t.split(".").slice(-2).join(".");for(let s of qh)if(i===s)return!1;return!0}function z(e,t,i,s){let{capture:n=!1,passive:r=!0}=s!=null?s:{};e==null||e.addEventListener(t,i,{capture:n,passive:r})}function Un(e){return e.name==="ph_toolbar_internal"}var Si=e=>{if($){try{let t=e+"=",i=$.cookie.split(";").filter(s=>s.length);for(let s=0;i.length>s;s++){let n=i[s];for(;n.charAt(0)==" ";)n=n.substring(1,n.length);if(n.indexOf(t)===0)return decodeURIComponent(n.substring(t.length,n.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return oe(e)&&isFinite(e)&&Math.floor(e)===e});var Yh=class zn{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,n){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(n)||0>t||0>i||0>s||0>n||t>0xffffffffffff||i>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");let r=new Uint8Array(16);return r[0]=t/Math.pow(2,40),r[1]=t/Math.pow(2,32),r[2]=t/Math.pow(2,24),r[3]=t/Math.pow(2,16),r[4]=t/256,r[5]=t,r[6]=112|i>>>8,r[7]=i,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new zn(r)}toString(){let t="";for(let i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),i!==3&&i!==5&&i!==7&&i!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new zn(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let i=0;16>i;i++){let s=this.bytes[i]-t.bytes[i];if(s!==0)return Math.sign(s)}return 0}},Xh=class{generate(){let e=this.generateOrAbort();if(!S(e))return e;{this.Ct=0;let t=this.generateOrAbort();if(S(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){let e=(()=>{let t=Date.now();return oe(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.It();else{if(this.Ct>=e+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return Yh.fromFieldsV7(this.Ct,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Tt.nextUint32())}It(){this.Mt=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.Mt=0,this.Tt=new Jh}},ac=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};b&&!S(b.crypto)&&crypto.getRandomValues&&(ac=e=>crypto.getRandomValues(e));var Jh=class{nextUint32(){return this.Rt.length>this.Et||(ac(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}},Mo,He=()=>Kh().toString(),Kh=()=>(Mo||(Mo=new Xh)).generate(),ci="",Qh=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Rt=null,se={At(){if(!ne(Rt))return Rt;if(Rt=!1,$)try{let e=`__ph_cookie_support_${He()}`;se.$t(e,"xyz"),Rt=Si(e)==='"xyz"',se.Pt(e)}catch{Rt=!1}return Rt},Dt(e){M.error("cookieStore error: "+e)},Ot:Si,Lt(e){let t;try{t=JSON.parse(se.Ot(e))||{}}catch{}return t},$t(e,t,i,s,n){if(!$)return!1;try{let r="",o="",a=(function(c,u){if(u){let d=(function(h,p=$){if(ci)return ci;if(!p||["localhost","127.0.0.1"].includes(h))return"";let v=h.split("."),_=Math.min(v.length,8),g="dmn_chk_"+He();for(;!ci&&_--;){let y=v.slice(_).join("."),m=g+"=1;domain=."+y+";path=/";p.cookie=m+";max-age=3",p.cookie.includes(g)&&(p.cookie=m+";max-age=0",ci=y)}return ci})(c);if(!d){let h=(p=>{let v=p.match(Qh);return v?v[0]:""})(c);h!==d&&M.info("Warning: cookie subdomain discovery mismatch",h,d),d=h}return d?"; domain=."+d:""}return""})($.location.hostname,s);if(i){let c=new Date;c.setTime(c.getTime()+864e5*i),r="; expires="+c.toUTCString()}n&&(o="; secure");let l=e+"="+encodeURIComponent(JSON.stringify(t))+r+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&M.warn("cookieStore warning: large cookie, len="+l.length),$.cookie=l,!0}catch{return!1}},Pt(e,t){if($!=null&&$.cookie&&(!t||!ne(Si(e))))try{se.$t(e,"",-1,t)}catch{return}}},Ks=null,H={At(){if(!ne(Ks))return Ks;let e=!0;if(S(b))e=!1;else try{let t="__mplssupport__";H.$t(t,"xyz"),H.Ot(t)!=='"xyz"'&&(e=!1),H.Pt(t)}catch{e=!1}return e||M.error("localStorage unsupported; falling back to cookie store"),Ks=e,e},Dt(e){M.error("localStorage error: "+e)},Ot(e){try{return b==null?void 0:b.localStorage.getItem(e)}catch(t){H.Dt(t)}return null},Lt(e){try{return JSON.parse(H.Ot(e))||{}}catch{}return null},$t(e,t){try{return b==null||b.localStorage.setItem(e,JSON.stringify(t)),!0}catch(i){H.Dt(i)}return!1},Pt(e){try{b==null||b.localStorage.removeItem(e)}catch(t){H.Dt(t)}}},Qs=[vt,tt,Ve,It,_t,Ft,mt,Ci,gt],Tt=[ur,je,Ht,Hl,pr,Bt,Gt,ke],ys=e=>e+"_cpm",ep=["__proto__","constructor","prototype"],en=e=>{if(!L(e))return{};let t={};return Object.keys(e).forEach(i=>{ep.indexOf(i)===-1&&(t[i]=e[i])}),t},tn=(e,t=[])=>{let i={};return[...Tt,...t].forEach(s=>{let n=e[s];S(n)||ne(n)||n===""||(i[s]=n)}),i},lc=e=>{let t=5381,i=2166136261;for(let s=0;e.length>s;s++){let n=e.charCodeAt(s);t=33*t^n,i=Math.imul(i^n,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},To=(e,t)=>({p:t,f:lc(JSON.stringify(e))}),Io=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{let i=se.Lt(ys(e)),s=(i==null?void 0:i.f)===lc(t)&&R(i.p);return{properties:s?i.p:[],isValid:s}}catch{return{properties:[],isValid:!1}}},sn=(e,t)=>t+"|"+(se.Ot(ys(e))||""),Ot={},Gn={At:()=>!0,Dt(e){M.error("memoryStorage error: "+e)},Ot:e=>e in Ot?Ot[e]:null,Lt:e=>e in Ot?Ot[e]:null,$t:(e,t)=>(Ot[e]=t,!0),Pt(e){delete Ot[e]}},xt=null,J={At(){if(!ne(xt))return xt;if(xt=!0,S(b))xt=!1;else try{let e="__support__";J.$t(e,"xyz"),J.Ot(e)!=='"xyz"'&&(xt=!1),J.Pt(e)}catch{xt=!1}return xt},Dt(e){M.error("sessionStorage error: ",e)},Ot(e){try{return b==null?void 0:b.sessionStorage.getItem(e)}catch(t){J.Dt(t)}return null},Lt(e){try{return JSON.parse(J.Ot(e))||null}catch{}return null},$t(e,t){try{return b==null||b.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(i){J.Dt(i)}return!1},Pt(e){try{b==null||b.sessionStorage.removeItem(e)}catch(t){J.Dt(t)}}},tp=class{constructor(e){this._instance=e}get Mr(){return this._instance.config}get consent(){return this.Do()?0:this.Lo}isOptedOut(){return this.Mr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Mr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Mr.opt_out_capturing_by_default}optInOut(e){this.No.$t(this.qo,e?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.No.Pt(this.qo,this.Mr.cross_subdomain_cookie)}get qo(){let{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 Lo(){let e=this.No.Ot(this.qo);return js(e)?1:A(ed,e)?0:-1}get No(){let e=this.Mr.opt_out_capturing_persistence_type,t=e==="localStorage"?H:se,i=t.At()?t:Gn;if(!this.jo||this.jo!==i){this.jo=i;let s=e==="localStorage"?se:H;s.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(js(s.Ot(this.qo))),s.Pt(this.qo,this.Mr.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Mr.respect_dnt&&[pe==null?void 0:pe.doNotTrack,pe==null?void 0:pe.msDoNotTrack,F.doNotTrack,pe==null?void 0:pe.globalPrivacyControl].some(e=>js(e))}};function cc(e,t){var i;let s=e==null||(i=e.config)===null||i===void 0?void 0:i.get_current_url;if(!le(s))return t;try{let n=s(t);return D(n)&&n?n:t}catch(n){return M.error("Error in get_current_url, falling back to window.location.href",n),t}}function Fo(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function Be(e){return!!e&&e.nodeType===1}function _e(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function uc(e){return!!e&&e.nodeType===3}function yr(e){return!!e&&e.nodeType===11&&Be(e.host)}function br(e){return e?Zt(e).split(/\s+/):[]}function Co(e,t){let i=(function(s){var n;let r=b==null||(n=b.location)===null||n===void 0?void 0:n.href;return S(r)?void 0:cc(s,r)})(t);return!!(i&&e&&e.some(s=>i.match(s)))}function Xt(e){let 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 br(t)}function dc(e){return O(e)?null:Zt(e).split(/(\s+)/).filter(t=>qt(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ri(e){let t="";return Ct(e)&&!Jt(e)&&e.childNodes&&e.childNodes.length&&q(e.childNodes,function(i){var s;uc(i)&&i.textContent&&(t+=(s=dc(i.textContent))!==null&&s!==void 0?s:"")}),Zt(t)}function Ei(e){var t;return S(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var wr=["a","button","form","input","select","textarea","label"];function qn(e,t){let i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch{return!1}}function Zn(e,t){if(S(t))return!0;for(let i of e)if(t.some(s=>qn(i,s)))return!0;return!1}function hc(e){let t=e.parentNode;return!(!t||!Be(t))&&t}var nn=[".ph-no-autocapture","[data-ph-no-autocapture]"],pc=["next","previous","prev",">","<","\u2192","\u2190","\u203A","\u2039","\xBB","\xAB","\u25B6","\u25C0","\u276F","\u276E"],xr=[...pc,"+","-","\u2212","\u2013"],Ao=xr.length+10,ip=["button","a","input","select","textarea","label"],sp=["button","link","tab","menuitem","option"],Ro=(e,t)=>/[a-z0-9]/i.test(t)?A(xr,t)?new RegExp(`\\b${t}\\b`).test(e):e.includes(t):e===t,np=e=>A(ip,e.tagName.toLowerCase())||A(sp,(e.getAttribute("role")||"").toLowerCase());function rn(e){let t="",i="",s=o=>{Be(o)&&Ct(o)&&!Jt(o)&&(t+=` ${Ri(o)}`,i=i||o.getAttribute("aria-label")||"",q(o.childNodes,s))};s(e),t=Zt(t.replace(/\s+/g," "));let n=(qt(t)?t:"").toLowerCase(),r=e.getAttribute("aria-label")||(n?"":i);return{safeText:n,ariaLabel:Zt(r).toLowerCase()}}var Oo=[".ph-no-rageclick",".ph-no-capture"],rp=["","text","search","email","password","url","tel","number"];function fc(e,t){if(!b||kr(e))return!1;let i,s,n;var r,o;if(Se(t)?(i=!!t&&Oo,s=void 0,n=!1):(i=(r=t==null?void 0:t.css_selector_ignorelist)!==null&&r!==void 0?r:Oo,s=t==null?void 0:t.content_ignorelist,n=(o=t==null?void 0:t.ignore_text_selection)!==null&&o!==void 0&&o),i===!1||n&&(function(l){return!(!l||!Be(l))&&(!!_e(l,"textarea")||(_e(l,"input")?A(rp,(l.getAttribute("type")||"").toLowerCase()):(function(c){var u;if(c.isContentEditable)return!0;let d=(u=c.getAttribute)===null||u===void 0?void 0:u.call(c,"contenteditable");return d==="true"||d===""})(l)))})(e))return!1;let{targetElementList:a}=vc(e,!1);return!(s&&(function(l,{safeText:c,ariaLabel:u}){let d;if(l===!0)d=pc;else{if(!R(l))return!1;if(l.length>Ao)return M.error(`[PostHog] content_ignorelist array cannot exceed ${Ao} items. Use css_selector_ignorelist for more complex matching.`),!1;d=l.map(h=>h.toLowerCase())}return d.some(h=>Ro(c,h)||Ro(u,h))})(s,(function(l,c){for(let u of c)if(np(u))return rn(u);for(let u of c){try{if((b==null?void 0:b.getComputedStyle(u).getPropertyValue("cursor"))!=="pointer")break}catch{break}let d=rn(u);if(d.safeText||d.ariaLabel)return d}return rn(l)})(e,a))||Zn(a,i))}var kr=e=>!e||_e(e,"html")||!Be(e),vc=(e,t)=>{if(!b||kr(e))return{parentIsUsefulElement:!1,targetElementList:[]};let i=!1,s=[e],n=e;for(;n.parentNode&&!_e(n,"body");){if(yr(n.parentNode)){s.push(n.parentNode.host),n=n.parentNode.host;continue}let r=hc(n);if(!r)break;if(t||wr.indexOf(r.tagName.toLowerCase())>-1)i=!0;else try{let o=b.getComputedStyle(r);o&&o.getPropertyValue("cursor")==="pointer"&&(i=!0)}catch{}s.push(r),n=r}return{parentIsUsefulElement:i,targetElementList:s}};function Ct(e){let t=new Set,i=0;for(let r=e;r.parentNode&&!_e(r,"body");r=r.parentNode){if(i++>=1e3||t.has(r))return!1;t.add(r);let o=Xt(r);if(A(o,"ph-sensitive")||A(o,"ph-no-capture"))return!1}if(A(Xt(e),"ph-include"))return!0;let s=e.type||"";if(D(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}let n=e.name||e.id||"";return!D(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function Jt(e){return!!(_e(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||_e(e,"select")||_e(e,"textarea")||e.getAttribute("contenteditable")==="true")}var Lo=new RegExp("^(?:(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}))$"),Do=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,op=[16,15,14,13],ap=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),No=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),jo=/[0-9A-Za-z_]/;function lp(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let n=e.charCodeAt(s)-48;i&&(n*=2,n>9&&(n-=9)),t+=n,i=!i}return t%10==0}function qt(e,t=!0){return!(O(e)||D(e)&&(e=Zt(e),(t?Lo.test((e||"").replace(/[- ]/g,"")):(function(i){let s;for(Do.lastIndex=0;s=Do.exec(i);){let n=s[2];if(!n)continue;let r=n.replace(/[- ]/g,"");for(let o=0;r.length>o;o++)for(let a of op){let l=o+a;if(r.length>=l){let c=r.slice(o,l);if(Lo.test(c)&&lp(c))return!0}}}return!1})(e))||(t?ap.test(e):(function(i){let s;for(No.lastIndex=0;s=No.exec(i);){let n=s[1],r=s[3];if(!(n&&r&&jo.test(n)&&jo.test(r)))return!0}return!1})(e))))}function Vo(e){let t=Ri(e);return t=`${t} ${gc(e)}`.trim(),qt(t)?t:""}function gc(e){let t="";return e&&e.childNodes&&e.childNodes.length&&q(e.childNodes,function(i){var s;if(i&&((s=i.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{let n=Ri(i);t=`${t} ${n}`.trim(),i.childNodes&&i.childNodes.length&&(t=`${t} ${gc(i)}`.trim())}catch(n){M.error("[AutoCapture]",n)}}),t}function Ho(e){return e.replace(/"|\\"/g,'\\"')}function cp(e){let t=e.attr__class;if(t)return R(t)?t:br(t)}var qi=re("[Dead Clicks]"),up=()=>!0,dp=e=>{var t;let i=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(dr)),s=e.instance.config.capture_dead_clicks;return Se(s)?s:!!L(s)||i},Bo=class{get lazyLoadedDeadClicksAutocapture(){return this.Bo}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[dr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Ho()}):this.stop()}zo(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this.instance,"dead-clicks-autocapture",n=>{n?qi.error("failed to load script",n):e()})}Ho(){var e;if($){if(!this.Bo&&(!((e=F.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){let t=L(this.instance.config.capture_dead_clicks)?f({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Bo=F.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Bo.start($),qi.info("starting...")}}else qi.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,qi.info("stopping..."))}},ui=re("[SegmentIntegration]");function Wo(e,t,i=!0){let s=e.config.segment;if(!s)return t();let{analytics:n,filterProperties:r}=(a=>le(a.register))(o=s)?{analytics:o}:o;var o;(function(a,l,c,u){let d=p=>{let v=()=>p.anonymousId()||He();a.config.get_device_id=v,u&&p.id()&&(a.register({distinct_id:p.id(),$device_id:v()}),a.persistence.set_property(ke,ss)),c(u?void 0:p.anonymousId()||void 0)},h=l.user();"then"in h&&le(h.then)?h.then(d):d(h)})(e,n,a=>{n.register(((l,c,{filterProperties:u}={})=>{typeof Promise!="undefined"&&Promise.resolve||ui.warn("This browser does not have Promise support, and can not use the segment integration");let d=(h,p)=>{if(!p)return h;let v=!!c&&h.event.anonymousId===c&&!h.event.userId;v||h.event.userId||h.event.anonymousId===l.get_distinct_id()||(ui.info("No userId set, resetting PostHog"),l.reset()),v||(c=void 0),h.event.userId&&h.event.userId!==l.get_distinct_id()&&(ui.info("UserId set, identifying with PostHog"),l.identify(h.event.userId));let _=l.calculateEventProperties(p,h.event.properties);if(!O(u)){let g=h.event.properties||{},y={};for(let w of Object.keys(_))nr.call(g,w)||(y[w]=_[w]);let m=((w,P)=>{let x=R(w)?w:[w],k=f({},P);for(let T of x)try{if(k=T(k),O(k))return null}catch(E){return ui.error("Error in Segment filterProperties:",E),null}return k})(u,y);if(O(m))return h;_=m}return h.event.properties=Object.assign({},_,h.event.properties),h};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(h){return d(h,h.event.event)},page(h){return d(h,_r)},identify(h){return d(h,rc)},screen(h){return d(h,"$screen")}}})(e,a,{filterProperties:r})).then(()=>{t()},l=>{ui.error("Failed to register the Segment integration",l),t()})},i)}var _c="posthog-js";function mc(e,{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,c,u,d;if(n!=="*"&&!n.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});let h=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));let p=((a=o.exception)===null||a===void 0?void 0:a.values)||[],v=p.map(y=>f(f({},y),{},{stacktrace:y.stacktrace?f(f({},y.stacktrace),{},{type:"raw",frames:(y.stacktrace.frames||[]).map(m=>f(f({},m),{},{platform:"web:javascript"}))}):void 0})),_={$exception_message:((l=p[0])===null||l===void 0?void 0:l.value)||o.message,$exception_type:(c=p[0])===null||c===void 0?void 0:c.type,$exception_level:o.level,$exception_list:v,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((u=p[0])===null||u===void 0?void 0:u.value)||o.message,$sentry_exception_type:(d=p[0])===null||d===void 0?void 0:d.type,$sentry_tags:o.tags};var g;return t&&i&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),r&&((g=e.exceptions)===null||g===void 0||g.sendExceptionEvent(_)),o}}var hp=class{constructor(e,t,i,s,n,r){this.name=_c,this.setupOnce=function(o){o(mc(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:r==null||r}))}}},Uo=class{constructor(e){this.Uo=(t,i,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&(M.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.Wo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Vo()}Vo(){var e;this.Go=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Uo)}destroy(){var e;(e=this.Go)===null||e===void 0||e.call(this),this.Go=void 0}doPageView(e,t){var i;let s=this.Qo(e,t);return this.Wo={pathname:(i=b==null?void 0:b.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Qo(e,(t=this.Wo)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Wo)===null||e===void 0?void 0:e.pageViewId}}Qo(e,t){let i=this.Wo;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:r,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=n;if(!(S(r)||S(o)||S(a)||S(l)||S(c)||S(u))){r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);let d=r>1?Ye(o/r,0,1,M):1,h=r>1?Ye(a/r,0,1,M):1,p=l>1?Ye(c/l,0,1,M):1,v=l>1?Ye(u/l,0,1,M):1;s=Q(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}},di=["flags","surveys"],pp={[Eh]:{exposure:"hidden"},[gs]:{exposure:"hidden"},[$h]:{exposure:"hidden"},[Dn]:{exposure:"hidden"},[Gt]:{exposure:"hidden"},[xi]:{exposure:"hidden"},[Dl]:{exposure:"event"},[Nn]:{exposure:"hidden"},[jl]:{exposure:"hidden"},[jn]:{exposure:"event"},[Nl]:{exposure:"hidden"},[Vn]:{exposure:"event"},[Hn]:{exposure:"event"},[dr]:{exposure:"event"},[hr]:{exposure:"hidden"},[Vl]:{exposure:"event"},[ki]:{exposure:"hidden"},[Ph]:{exposure:"hidden"},[Ht]:{exposure:"hidden"},[Hl]:{exposure:"event"},[Mh]:{exposure:"event",shouldSkipFromEventProperties:e=>ne(e)},[Ah]:{exposure:"event"},[Rh]:{exposure:"event"},[Oh]:{exposure:"event"},[Lh]:{exposure:"event"},[Dh]:{exposure:"hidden"},[Ve]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"hidden",storageGroup:"flags"},[Ln]:{exposure:"hidden"},[It]:{exposure:"hidden",storageGroup:"flags"},[_t]:{exposure:"hidden",storageGroup:"flags"},[Ft]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[wi]:{exposure:"hidden",storageGroup:"flags"},[qe]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[vt]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[_i]:{exposure:"hidden",storageGroup:"surveys"},[_s]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Wl]:{exposure:"event"},[Ul]:{exposure:"hidden"},[zl]:{exposure:"hidden"},[Bn]:{exposure:"hidden"},[Nh]:{exposure:"hidden"},[jh]:{exposure:"hidden"},[Vh]:{exposure:"event"},[Hh]:{exposure:"event"},[Bh]:{exposure:"event"},[Wh]:{exposure:"event"},[gt]:{exposure:"hidden"},[gi]:{exposure:"hidden"},[Bl]:{exposure:"event"},[Ci]:{exposure:"hidden"},[mt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ke]:{exposure:"hidden"},[Wn]:{exposure:"hidden"},[Uh]:{exposure:"hidden"},[Gl]:{exposure:"hidden"},[ql]:{exposure:"hidden"},[Bt]:{exposure:"hidden"},[pr]:{exposure:"hidden"},[Th]:{exposure:"event"},[Ih]:{exposure:"event"},[Fh]:{exposure:"event"},[Ch]:{exposure:"event"},[Yl]:{exposure:"event"},[Xl]:{exposure:"event"},[fr]:{exposure:"hidden"},[vr]:{exposure:"hidden"},[Jl]:{exposure:"hidden"},[Kl]:{exposure:"hidden"},[Ql]:{exposure:"hidden"},[ec]:{exposure:"hidden"},[tc]:{exposure:"hidden"},[ic]:{exposure:"hidden"},[sc]:{exposure:"hidden"},[zh]:{exposure:"event"}},fp=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],fe=e=>{let t=pp[e];if(t)return t;for(let[i,s]of fp)if(e.indexOf(i)===0)return s};function yc(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}var bc=()=>{try{return"u">typeof window&&window.navigator.onLine!==!1}catch{return!1}},wc=(e,t)=>e>=t&&bc(),xc=(e,t,i,s)=>{if(e===0){if(bc()){let n=t+1;return n===i&&s(),n}return t}return 0},Ut=(e,t)=>{try{let i;return JSON.stringify(e,(s,n)=>{var r;return ii(n)?((r=i)!==null&&r!==void 0||(i=new WeakMap),i.has(n)||i.set(n,oc(n)),i.get(n)):typeof n=="bigint"?n.toString():n},t)}catch{return Ra(e)}},nt=e=>{let t=$==null?void 0:$.createElement("a");return S(t)?null:(t.href=e,t)},Kt=function(e,t){let i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s;for(let n=0;i.length>n;n++){let r=i[n].split("=");if(r[0]===t){s=r;break}}if(!R(s)||2>s.length)return"";{let n=s[1];try{n=decodeURIComponent(n)}catch{M.error("Skipping decoding for malformed query param: "+n)}return n.replace(/\+/g," ")}},Oi=function(e,t,i){if(!e||!t||!t.length)return e;let s=e.split("#"),n=s[1],r=(s[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),c=[];for(let d=0;l.length>d;d++){let h=l[d].split("=");R(h)&&(t.includes(h[0])?c.push(h[0]+"="+i):c.push(l[d]))}let u=a;return o!=null&&(u+="?"+c.join("&")),n!=null&&(u+="#"+n),u},bs=function(e,t){let i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Qt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx"],vp=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Qt],Li="<masked>",gp=["li_fat_id"];function kc(e,t,i){if(!$)return{};let s=t?[...Qt,...i||[]]:[],n=Sc(Oi($.URL,s,Li),e),r=(function(){let o={};return q(gp,function(a){let l=Si(a);o[a]=l||null}),o})();return Q(r,n)}function Sc(e,t){let i=vp.concat(t||[]),s={};return q(i,function(n){let r=Kt(e,n);s[n]=r||null}),s}function Ec(e){let t=(function(n){return n?n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(e),i=t!="yahoo"?"q":"p",s={};if(!ne(t)){s.$search_engine=t;let n=$?Kt($.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function $c(){return navigator.language||navigator.userLanguage}function _p(){let e=$c();return typeof e=="string"?e.split("-")[0]:void 0}var ws="$direct";function Pc(){return($==null?void 0:$.referrer)||ws}function Mc(e,t,i=!1){let s=e?[...Qt,...t||[]]:[],n=i?yt(K==null?void 0:K.href):K==null?void 0:K.href,r=n==null?void 0:n.substring(0,1e3);return{r:Pc().substring(0,1e3),u:r?Oi(r,s,Li):void 0}}function Tc(e,t=!1){var i;let{r:s,u:n}=e,r=t?yt(n):n,o={$referrer:s,$referring_domain:s==null?void 0:s==ws?ws:(i=nt(s))===null||i===void 0?void 0:i.host};if(r){o.$current_url=r;let a=nt(r);o.$host=a==null?void 0:a.host,o.$pathname=a==null?void 0:a.pathname;let l=Sc(r);Q(o,l)}if(s){let a=Ec(s);Q(o,a)}return o}function mp(){try{return new Date().getTimezoneOffset()}catch{return}}var yp={flags:mt,surveys:_s},bp=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Zi=e=>`${e}_cookie_identity_change_pending`,Yi=e=>{let t="",i=0;for(let s of e){let n=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+n>1e3)break;t+=s,i+=n}return t},ce="main",et=[Ve,tt,It,_t,Ft,mt,wi,vt],on=e=>et.indexOf(e)!==-1,Ic=[Gt,xi],zo=e=>Ic.indexOf(e)!==-1,ut=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},Lt=e=>{if(!e)return{};let t=JSON.parse(e);return L(t)?t:{}},Go=(e,t)=>{q(e,(i,s)=>{let n=fe(s);n&&n.exposure!=="event"||{}.hasOwnProperty.call(t,s)||delete e[s]})},an=class{constructor(e,t,i=!0,s=!e.cookieless_mode){if(this.Zo={},this.Jo=!1,this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=new Map,this.ia=!1,this.na=!1,this.sa=!1,this.ra=new Set,this.oa=new Set,this.Mr=e,this.aa=i,this.props={},this.la=void 0,this.ua=(n=>{let r="";return n.token&&(r=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+r+"_posthog"})(e),this.hi=e.disable_persistence||!!t,this.No=this.ca(e),this.Xo=this.ha(e),this.load(s),this.da(),e.debug&&M.info("Persistence loaded",e.persistence,f({},this.props)),this.update_config(e,e,t),this.save(),b){let n=()=>this.flush();z(b,"beforeunload",n,{capture:!1}),z(b,"pagehide",n,{capture:!1}),this.va=r=>{if(this.Jo&&(!r.storageArea||r.storageArea===(b==null?void 0:b.localStorage))&&r.key)if(r.key!==this.ua){if(this.Xo){let o=di.find(a=>r.key===this.fa(a));o&&this.pa(r.key,o)}}else this.pa(r.key,ce)},z(b,"storage",this.va)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,i])=>{let s=this.ea.get(t);if(!on(t)||s===!0)return;if(i===!0)return void this.ga(t,!0);let n=new Set(s||[]);i.forEach(r=>n.add(r)),n.size&&this.ga(t,n)})}onCrossTabFeatureFlagChange(e){return this.oa.add(e),()=>this.oa.delete(e)}destroy(){this.va&&b&&(b.removeEventListener("storage",this.va),this.va=void 0),this.oa.clear()}pa(e,t,i=!0){if(this.hi)return!1;let s,n;try{if(n=H.Ot(e),ne(n)){let a=this.ma(t);return a.storageValue=null,t!==ce&&(a.persisted=!1),!1}s=Lt(n)}catch{return!1}let r=t===ce?s:H.Lt(this.ua);if(r&&this.ya(r))return!1;let o=this.ba(s,t,i);return t===ce&&this.Xo&&!ut(this._a().main,s)||this.wa(s,t,!0,n),o}ya(e){let t=this.props[je],i=e[je];return!S(t)&&!S(i)&&t!==i}wa(e,t,i,s){let n=this.ma(t);n.storageValue=s,t!==ce&&(n.persisted=i);try{n.fingerprint=this.ka(e,t)}catch{n.fingerprint=void 0}}ba(e,t,i){let s=!1;return et.forEach(n=>{var r;let o=(r=fe(n))===null||r===void 0?void 0:r.storageGroup;if(t===ce&&this.Xo&&o||t!==ce&&o!==t)return;let a=n in e,l=this.Sa(n,a?e[n]:void 0),c=this.ea.has(n)?n in this.props:a;c===n in this.props&&ut(l,this.props[n])||(c?this.xa(n,l,!1):this.$a(n,!1),s=!0)}),s&&i&&this.oa.forEach(n=>n()),s}Ca(){if(!this.Jo)return!1;try{this.sa=!1;let e=H.Ot(this.ua),t=this.ma(ce),i,s=!1,n=!1;if(e!==t.storageValue)if(ne(e))t.storageValue=null;else{if(i=Lt(e),this.sa=!this.na&&this.ya(i),this.sa)return!1;n=this.ba(i,ce,!1),!this.Xo||ut(this._a().main,i)?this.wa(i,ce,!0,e):t.storageValue=e,s=!0}return this.Xo&&di.forEach(r=>{let o=H.Ot(this.fa(r)),a=this.ma(r),l=i||{},c=s&&et.some(d=>{var h;return((h=fe(d))===null||h===void 0?void 0:h.storageGroup)===r&&d in l});if(o===a.storageValue&&!c)return;if(ne(o))return a.storageValue=null,a.persisted=!1,void(c&&(n=this.ba(l,r,!1)||n));let u=Lt(o);n=this.ba(u,r,!1)||n,this.wa(u,r,!0,o)}),n}catch{return!1}}ga(e,t){this.ea.set(e,t);let i=fe(e);i!=null&&i.volatile||(this.ma((this.Xo?i==null?void 0:i.storageGroup:void 0)||ce).fingerprint=void 0,this.Ta(e))}Ia(){et.forEach(e=>this.ea.set(e,!0))}da(){if(this.Jo)try{let e=H.Ot(this.ua),t=Lt(e);this.ma(ce).storageValue=e,et.forEach(i=>{var s;let n=this.Xo?(s=fe(i))===null||s===void 0?void 0:s.storageGroup:void 0,r=n?H.Ot(this.fa(n)):null;if(n){let a=this.ma(n);a.storageValue=r,a.persisted=!ne(r)}let o=n&&!ne(r)?Lt(r):t;i in this.props?this.Ma(i,o[i],this.props[i]):i in o&&this.ga(i,!0)})}catch{}}Sa(e,t){let i=this.ea.get(e);if(!i)return t;if(i===!0)return this.props[e];if(e==="$active_feature_flags"){let r=new Set(R(t)?t:[]),o=new Set(R(this.props[e])?this.props[e]:[]);return i.forEach(a=>o.has(a)?r.add(a):r.delete(a)),Array.from(r)}let s=L(t)?f({},t):{},n=L(this.props[e])?this.props[e]:{};return i.forEach(r=>{r in n?s[r]=n[r]:delete s[r]}),s}Ma(e,t,i){if(!on(e))return;let s=this.ea.get(e);if(s===!0)return;let n=t;if(this.Jo)try{var r;let a=this.Xo?(r=fe(e))===null||r===void 0?void 0:r.storageGroup:void 0,l=a?this.fa(a):this.ua;n=Lt(H.Ot(l))[e]}catch{}let o=new Set(s||[]);if(e==="$active_feature_flags"){if(!S(t)&&!R(t)||!S(n)&&!R(n)||!R(i))return void this.ga(e,!0);let a=new Set(t||[]),l=new Set(n||[]),c=new Set(i);new Set([...a,...c]).forEach(u=>{a.has(u)!==c.has(u)&&o.add(u)}),o.forEach(u=>{l.has(u)===c.has(u)&&o.delete(u)})}else{if(!L(i))return void(ut(n,i)?this.ea.delete(e):this.ga(e,!0));{if(!S(t)&&!L(t)||S(t)&&Me(i)&&S(n))return void this.ga(e,!0);let a=L(t)?t:{},l=L(n)?n:{};new Set([...Object.keys(a),...Object.keys(i)]).forEach(c=>{c in a==c in i&&ut(a[c],i[c])||o.add(c)}),o.forEach(c=>{c in l==c in i&&ut(l[c],i[c])&&o.delete(c)})}}o.size?this.ga(e,o):this.ea.delete(e)}Ea(){var e;let t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return oe(t)&&t>0?t:0}Pa(e){if(this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{let t=tn(e,this.Mr.cookie_persisted_properties||[]),i=To(t,this.Mr.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),n=se.Ot(this.ua)||void 0;n&&sn(this.ua,n)===s&&(this.Ra=s,this.Aa=n)}catch{}else try{let t=se.Ot(this.ua)||void 0;this.Ra=t?sn(this.ua,t):void 0,this.Aa=t}catch{}}syncCookieProperties(){return this.Fa(this.Mr)}Fa(e,t=!1){if(this.hi&&!t||this.ta||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let i;try{i=se.Ot(this.ua)||void 0}catch{}if(!i||i===this.Aa)return!1;let s=sn(this.ua,i),n;try{n=en(JSON.parse(i))}catch{return!1}if((se.Ot(this.ua)||void 0)!==i)return!1;this.Ra=s,this.Aa=i;let r=Io(this.ua,i),o=[...Tt,...r.properties],a={};if(Object.keys(n).forEach(_=>{let g=n[_];(S(g)||ne(g)||g===""||_==="$user_state"&&g!=="anonymous"&&g!=="identified")&&(a[_]=!0,delete n[_])}),Me(n))return!1;let l="distinct_id"in n||n.$user_state==="anonymous"||n.$user_state==="identified",c=this.props,u=c[je],d=c[ke],h=Q({},c);[...Tt,...e.cookie_persisted_properties||[]].forEach(_=>{if(o.indexOf(_)!==-1&&!(_ in n)&&!a[_]&&(l||_!=="distinct_id"&&_!=="$user_state")){let g=h[_];(r.isValid||Tt.indexOf(_)===-1||g!==!1&&g!==0)&&delete h[_]}}),this.props=Q(h,n),et.forEach(_=>{let g=_ in this.props;_ in c===g&&ut(c[_],this.props[_])||(g?this.Ma(_,c[_],this.props[_]):this.ga(_,!0))}),!l||"$user_state"in n||"$user_state"in this.props||this.xa(ke,it);let p=this.props[je],v=this.props[ke];return!l||p===u&&v===d||(this.na=!0,this.Yo=!0,J.$t(Zi(this.ua),!0),this.$a(vt),this.$a(tt),this.$a(Ve),this.$a(It),this.$a(_t),this.$a(Ft),this.$a(mt),this.$a(Ci),this.$a(gt),v!=="anonymous"||d!=="identified"&&n.$user_state!=="anonymous"&&(S(u)||p===u)||(Go(this.props,n),this.$a(ft)),v==="identified"?this.props.$user_id=p:delete this.props.$user_id,this.$a(gs)),!0}consumeCookieIdentityChange(){let e=Zi(this.ua),t=this.Yo||!!J.Ot(e);return this.Yo=!1,t&&J.Pt(e),t}Oa(e=!1){return!(this.ta||this.hi&&!e||!this.Mr.cookieWinsOnConflict||this.Mr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ta=!0,0))}Da(){this.ta&&(S(this.La)||(clearTimeout(this.La),this.La=void 0),delete this.Zo[ce],this.Na(!0))}qa(e=!0){if(this.ta)try{e?this.Da():S(this.La)||(clearTimeout(this.La),this.La=void 0)}finally{this.ta=!1}}isDisabled(){return!!this.hi}ca(e){bp.indexOf(e.persistence.toLowerCase())===-1&&(M.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");let t=((o=[],a=!1,l=()=>!1)=>{let c=[...Tt,...o];return f(f({},H),{},{Lt(u){try{let h,p={};try{h=se.Ot(u)||void 0,p=h?en(JSON.parse(h)):{}}catch{}let v=JSON.parse(H.Ot(u)||"{}"),_;if(a){let g=Io(u,h),y=[...Tt,...g.properties],m={};Object.keys(p).forEach(P=>{let x=p[P];ne(x)||x===""||P==="$user_state"&&x!=="anonymous"&&x!=="identified"||(m[P]=x)});let w="distinct_id"in m||m.$user_state==="anonymous"||m.$user_state==="identified";if(Object.keys(m).length>0){var d;let P=v[je],x=(d=v.$user_state)!==null&&d!==void 0?d:it;c.forEach(k=>{if(y.indexOf(k)!==-1&&!(k in p)&&(w||k!=="distinct_id"&&k!=="$user_state")){let T=v[k];(g.isValid||Tt.indexOf(k)===-1||T!==!1&&T!==0)&&delete v[k]}}),!w||"$user_state"in p||"$user_state"in v||(v[ke]=it),!w||("distinct_id"in m?m[je]:v[je])===P&&("$user_state"in m?m[ke]:v[ke])===x||(Qs.forEach(k=>delete v[k]),m.$user_state==="identified"&&"distinct_id"in m?v.$user_id=m[je]:delete v.$user_id,m.$user_state!=="identified"&&(delete v[Bl],delete v[ft]),delete v.__alias)}_=Q(v,m)}else _=Q(p,v);return l()||H.$t(u,_),_}catch{}return null},$t(u,d,h,p,v,_){let g=H.$t(u,d,void 0,void 0,_);try{let y=tn(d,o);if(Object.keys(y).length){if(a){let m=ys(u),w=To(y,o);if(se.$t(m,w,h,p,v,_),se.Ot(m)!==JSON.stringify(w)){se.Pt(m,p);let P=tn(d);return se.$t(u,P,h,p,v,_),g}}se.$t(u,y,h,p,v,_)}}catch(y){H.Dt(y)}return g},Pt(u,d){try{b==null||b.localStorage.removeItem(u),se.Pt(u,d),se.Pt(ys(u),d)}catch(h){H.Dt(h)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this.hi),i,s=!1,n=!1,r=e.persistence.toLowerCase();return r==="localstorage"&&H.At()?(i=H,n=!0):r==="localstorage+cookie"&&t.At()?(i=t,n=!0,s=!0):r==="sessionstorage"&&J.At()?i=J:r==="memory"?i=Gn:r==="cookie"&&se.At()?(i=se,s=!0):t.At()?(i=t,n=!0,s=!0):se.At()?(i=se,s=!0):i=Gn,this.Jo=n,this.Ko=s,i}fa(e){return`${this.ua}__${e}`}ha(e){return this.Jo&&!!e.split_storage}properties(){let e={};return q(this.props,(t,i)=>{let s=fe(i);if(!s||s.exposure==="event"){var n;if(!(s==null||(n=s.shouldSkipFromEventProperties)===null||n===void 0)&&n.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this.hi&&!e)return;let t=this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie",i=t?H.Lt(this.ua):null,s={};if(t)try{s=en(se.Lt(this.ua)),q(s,(a,l)=>{(S(a)||ne(a)||a==="")&&delete s[l]})}catch{}let n=this.No.Lt(this.ua);if(n&&(this.props=Q({},n)),this.Xo&&this.ja(),t&&n){var r,o;let a=i==null?void 0:i[je],l=(r=i==null?void 0:i.$user_state)!==null&&r!==void 0?r:it,c=n[je],u=(o=n.$user_state)!==null&&o!==void 0?o:it;if(c!==a||u!==l){this.Yo=!0,this.hi||J.$t(Zi(this.ua),!0);let d=Q({},this.props);Qs.forEach(p=>delete d[p]),u!=="anonymous"||l!=="identified"&&s.$user_state!=="anonymous"&&(S(a)||c===a)||(Go(d,s),delete d[ft]),this.props=d;let h=new Set;Qs.forEach(p=>{var v;let _=(v=fe(p))===null||v===void 0?void 0:v.storageGroup;_&&h.add(_)}),h.forEach(p=>{if(this.hi)return;let v={};q(this.props,(_,g)=>{var y;((y=fe(g))===null||y===void 0?void 0:y.storageGroup)===p&&(v[g]=_)}),Me(v)?(H.Pt(this.fa(p)),this.Zo[p]={}):H.$t(this.fa(p),v)&&(this.Zo[p]={persisted:!0,fingerprint:this.ka(v,p)})})}}J.Ot(Zi(this.ua))&&(this.Yo=!0)}ja(){for(let e of di){let t=H.Lt(this.fa(e));if(t&&!Me(t)){let i=this.ma(e);i.persisted=!0,this.Ba(e)||(i.fingerprint=this.ka(t,e)),this.za(e,t)||Q(this.props,t)}}}Ba(e){return Object.keys(this.props).some(t=>{var i;return((i=fe(t))===null||i===void 0?void 0:i.storageGroup)===e})}za(e,t){let i=yp[e];if(!i)return!1;let s=t[i],n=this.props[i];return oe(s)&&oe(n)&&n>s}refreshKey(e){var t;if(this.hi||this.ra.has(e))return;let i=this.Xo?(t=fe(e))===null||t===void 0?void 0:t.storageGroup:void 0,s=i?H.Lt(this.fa(i)):this.No.Lt(this.ua);if(s&&e in s)this.xa(e,s[e],!1);else{if(i){let n=this.No.Lt(this.ua);if(n&&e in n)return void this.xa(e,n[e],!1)}this.$a(e,!1)}}save(){if(this.hi)return;let e=this.Ea();e>0?S(this.La)&&(this.La=setTimeout(()=>{this.La=void 0,this.Na()},e)):this.Na()}flush(){S(this.La)||(clearTimeout(this.La),this.La=void 0,this.Na())}Na(e=!1){if(this.hi||this.ta&&!e)return;e||(this.syncCookieProperties(),this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie"||Ic.forEach(n=>this.refreshKey(n)));let t=!e&&!this.ia;t||(this.sa=!1);let i=!!t&&this.Ca();if(this.sa)return void(this.Mr.debug&&M.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Xo)return this.Ha(),void(i&&this.oa.forEach(n=>n()));let s=this.Ua(this.No,this.ua,this.props,ce);s==="written"&&this.Pa(this.props),s!=="failed"&&(this.ea.clear(),this.na=!1,this.ra.clear()),i&&this.oa.forEach(n=>n())}Ha(){let{main:e,groups:t}=this._a(),i=this.Ua(this.No,this.ua,e,ce);i==="written"&&this.Pa(e),i!=="failed"&&(this.na=!1,this.ra.clear(),et.forEach(n=>{var r;!((r=fe(n))===null||r===void 0)&&r.storageGroup||this.ea.delete(n)}));for(let n of di){var s;let r=t[n];if(Me(r)&&!(!((s=this.Zo[n])===null||s===void 0)&&s.persisted)){et.forEach(a=>{var l;((l=fe(a))===null||l===void 0?void 0:l.storageGroup)===n&&this.ea.delete(a)});continue}let o=this.Ua(H,this.fa(n),r,n);o!=="failed"&&et.forEach(a=>{let l=fe(a);(l==null?void 0:l.storageGroup)!==n||o!=="written"&&l.volatile||this.ea.delete(a)})}}_a(){let e={},t={flags:{},surveys:{}};return q(this.props,(i,s)=>{var n;let r=(n=fe(s))===null||n===void 0?void 0:n.storageGroup;r?t[r][s]=i:e[s]=i}),{main:e,groups:t}}ka(e,t){if(t===ce)return JSON.stringify(e)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;let i={};return q(e,(s,n)=>{var r;i[n]=!((r=fe(n))===null||r===void 0)&&r.volatile?"__volatile__":s}),JSON.stringify(i)}Ua(e,t,i,s){let n=this.ma(s);if(s!==ce&&!n.dirty&&!S(n.fingerprint))return"skipped";let r;try{if(r=this.ka(i,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch{r=void 0}return e.$t(t,i,this.Wa,this.Va,this.Ga,this.Mr.debug)?(n.dirty=!1,s!==ce&&(n.persisted=!0),S(r)||(n.fingerprint=r),this.Jo&&(n.storageValue=H.Ot(t)),"written"):(this.Mr.debug&&M.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ia(),S(this.La)||(clearTimeout(this.La),this.La=void 0),this.No.Pt(this.ua,!1),this.No.Pt(this.ua,!0),!e&&this.aa)for(let t of di)H.Pt(this.fa(t));e?delete this.Zo[ce]:this.Zo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(L(e)){this.syncCookieProperties(),S(t)&&(t="None"),this.Wa=S(i)?this.Qa:i;let s=!1;if(q(e,(n,r)=>{this.props.hasOwnProperty(r)&&this.props[r]!==t||(this.xa(r,n),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(L(e)){this.syncCookieProperties(),this.Wa=S(t)?this.Qa:t;let i=!1;if(q(e,(s,n)=>{e.hasOwnProperty(n)&&(this.props[n]!==s||L(s)||R(s))&&(this.xa(n,s),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();let t=typeof e=="string"?[e]:e,i=!1;for(let s of t)s in this.props&&(this.$a(s),i=!0);i&&this.save()}update_campaign_params(){let e=$==null?void 0:$.URL;if(e===this.la)return;let t=kc(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!Me(mr(t));return i&&this.register(t),this.la=e,i?t:void 0}update_search_keyword(){this.register((function(){let e=$==null?void 0:$.referrer;return e?Ec(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:Pc(),$referring_domain:($==null?void 0:$.referrer)&&((e=nt($.referrer))===null||e===void 0?void 0:e.host)||ws},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;let e=Mc(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[Bt]:this.Ko?{r:Yi(e.r),u:e.u?Yi(e.u):void 0}:e},void 0)}get_initial_props(){let e={};q([ql,Gl],i=>{let s=this.props[i];s&&q(s,function(n,r){e["$initial_"+Pn(r)]=n})});let t=this.props[Bt];if(t){let i=(function(s,n=!1){let r=Tc(s,n),o={};return q(r,function(a,l){o[`$initial_${Pn(l)}`]=a}),o})(t,this.Mr.disable_capture_url_hashes);Q(e,i)}return e}safe_merge(e){return q(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){let s=e.persistence!==t.persistence,n=!((p,v)=>{if(p.length!==v.length)return!1;let _=[...p].sort(),g=[...v].sort();return _.every((y,m)=>y===g[m])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this.hi&&!a;a||this.Fa(t,l),this.Mr=e,!a&&(s||n||o)&&(this.Ra=void 0,this.Aa=void 0,this.Fa(f(f({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));let c=r||o?this.ca(e):this.No;this.Za();let u=this.ha(e),d=r||u!==this.Xo,h=!a&&(d||e.cross_subdomain_cookie!==this.Va||e.secure_cookie!==this.Ga)&&this.Oa(l);this.ia=d;try{if(this.Qa=this.Wa=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){let p=this.props;this.clear(),this.No=c,this.Xo=u,this.props=p,this.save()}else o&&(this.No=c,a||(delete this.Zo[ce],this.Na()))}finally{this.ia=!1,h&&this.qa()}}Za(){let e=this.props[Bt];if(!this.Ko||!L(e)||typeof e.r!="string")return;let t=Yi(e.r),i=typeof e.u=="string"?Yi(e.u):e.u;t===e.r&&i===e.u||this.xa(Bt,f(f({},e),{},{r:t,u:i}))}set_disabled(e){this.hi=e,this.hi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Va&&(this.Va=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){let i=this.props.__timers||{};i[e]=t,this.xa(Dn,i),this.save()}remove_event_timer(e){let t=this.props.__timers||{},i=t[e];return S(i)||(delete t[e],this.xa(Dn,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.xa(e,t),this.save()}xa(e,t,i=!0){var s;let n=this.props[e];this.props[e]=t,i&&(e!=="distinct_id"&&e!=="$user_state"||n===t||(this.na=!0),zo(e)&&!ut(n,t)&&this.ra.add(e),this.Ma(e,n,t),!((s=fe(e))===null||s===void 0)&&s.volatile||this.Ta(e))}$a(e,t=!0){delete this.props[e],t&&(on(e)&&this.ga(e,!0),zo(e)&&this.ra.add(e),this.Ta(e))}Ta(e){var t;let i=(t=fe(e))===null||t===void 0?void 0:t.storageGroup;i&&(this.ma(i).dirty=!0)}ma(e){return this.Zo[e]||(this.Zo[e]={})}},Fe={GZipJS:"gzip-js",Base64:"base64"},hi={Activation:"events",Cancellation:"cancelEvents"};var ln={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"};var Ie={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},cn={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Yn={Popover:"popover",Inline:"inline"};function Xi(e){let t=!0;return{dispose(){if(t){t=!1;let i=e();i&&le(i.then)&&i.then(void 0,()=>{})}}}}var wp={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},qo={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Zo=re("[RateLimiter]"),xp=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{let i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(s=>{Zo.info(`${s||"events"} is quota limited.`),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){return void Zo.warn(`could not rate limit - continuing. Error: "${s==null?void 0:s.message}"`,{text:i})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;let{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=new Date().getTime(),a=(t=(i=this.instance.persistence)===null||i===void 0?void 0:i.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>n&&(a.tokens=n);let l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){let c=(oe(a.dropped)?a.dropped:0)+1;a.dropped=c,!this.lastEventRateLimited&&this.Ja(c)&&(a.dropped=0)}return this.lastEventRateLimited=l,(s=this.instance.persistence)===null||s===void 0||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Ka(e){let t=this.instance.config.property_denylist;return!R(t)||!t.includes(e)}Xa(){var e;if(this.Ka("$current_url")&&this.Ka("$pathname")&&(K!=null&&K.pathname))return`${(e=K.origin)!==null&&e!==void 0?e:""}${K.pathname}`}Ja(e){var t,i;let{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this.Xa(),o=this.Ka("$session_id")?(t=(i=this.instance).get_session_id)===null||t===void 0?void 0:t.call(i):void 0,a=[`${e} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){let t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},dt=re("[RemoteConfig]"),Fc=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=F._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Ya(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}tl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return dt.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void dt.warn("Remote config is disabled. Falling back to local config.");this.Ya(e=>{if(!e)return dt.info("No config found after loading remote JS config. Falling back to JSON."),void this.tl(t=>{this.el(t.json,t)});this.el(e)})}catch(e){dt.error("Error loading remote config",e),this.el()}}el(e,t){!e&&t&&(t.statusCode===0?t.error||dt.warn("Failed to fetch remote config from PostHog."):dt.error("Failed to fetch remote config from PostHog."));try{this._instance.el(e?{ok:!0,config:e}:{ok:!1})}catch(s){dt.error("Error applying remote config",s)}if((e==null?void 0:e.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;(i=this._instance.featureFlags)===null||i===void 0||i.ensureFlagsLoaded()}catch(s){dt.error("Error loading feature flags",s)}}};var Ce=Uint8Array,Ee=Uint16Array,ei=Uint32Array,Sr=new Ce([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]),Er=new Ce([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]),Yo=new Ce([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Cc=function(e,t){for(var i=new Ee(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var n=new ei(i[30]);for(s=1;30>s;++s)for(var r=i[s];i[s+1]>r;++r)n[r]=r-i[s]<<5|s;return[i,n]},Ac=Cc(Sr,2),Xn=Ac[1];Ac[0][28]=258,Xn[258]=28;for(Jn=Cc(Er,0)[1],xs=new Ee(32768),te=0;32768>te;++te)kt=(43690&te)>>>1|(21845&te)<<1,xs[te]=((65280&(kt=(61680&(kt=(52428&kt)>>>2|(13107&kt)<<2))>>>4|(3855&kt)<<4))>>>8|(255&kt)<<8)>>>1;var kt,Jn,xs,te,$i=function(e,t,i){for(var s=e.length,n=0,r=new Ee(t);s>n;++n)++r[e[n]-1];var o,a=new Ee(t);for(n=0;t>n;++n)a[n]=a[n-1]+r[n-1]<<1;if(i){o=new Ee(1<<t);var l=15-t;for(n=0;s>n;++n)if(e[n])for(var c=n<<4|e[n],u=t-e[n],d=a[e[n]-1]++<<u,h=d|(1<<u)-1;h>=d;++d)o[xs[d]>>>l]=c}else for(o=new Ee(s),n=0;s>n;++n)o[n]=xs[a[e[n]-1]++]>>>15-e[n];return o},At=new Ce(288);for(te=0;144>te;++te)At[te]=8;for(te=144;256>te;++te)At[te]=9;for(te=256;280>te;++te)At[te]=7;for(te=280;288>te;++te)At[te]=8;var ks=new Ce(32);for(te=0;32>te;++te)ks[te]=5;var kp=$i(At,9,0),Sp=$i(ks,5,0),Rc=function(e){return(e/8|0)+(7&e&&1)},Oc=function(e,t,i){(t==null||0>t)&&(t=0),(i==null||i>e.length)&&(i=e.length);var s=new(e instanceof Ee?Ee:e instanceof ei?ei:Ce)(i-t);return s.set(e.subarray(t,i)),s},Je=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},pi=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},un=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s,f:e[s]});var n=i.length,r=i.slice();if(!n)return[new Ce(0),0];if(n==1){var o=new Ce(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(x,k){return x.f-k.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=n-1;)a=i[i[d].f>i[c].f?c++:d++],l=i[c!=u&&i[d].f>i[c].f?c++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=r[0].s;for(s=1;n>s;++s)r[s].s>h&&(h=r[s].s);var p=new Ee(h+1),v=Kn(i[u-1],p,0);if(v>t){s=0;var _=0,g=v-t,y=1<<g;for(r.sort(function(x,k){return p[k.s]-p[x.s]||x.f-k.f});n>s;++s){var m=r[s].s;if(t>=p[m])break;_+=y-(1<<v-p[m]),p[m]=t}for(_>>>=g;_>0;){var w=r[s].s;t>p[w]?_-=1<<t-p[w]++-1:++s}for(;s>=0&&_;--s){var P=r[s].s;p[P]==t&&(--p[P],++_)}v=t}return[new Ce(p),v]},Kn=function(e,t,i){return e.s==-1?Math.max(Kn(e.l,t,i+1),Kn(e.r,t,i+1)):t[e.s]=i},Xo=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new Ee(++t),s=0,n=e[0],r=1,o=function(l){i[s++]=l},a=1;t>=a;++a)if(e[a]==n&&a!=t)++r;else{if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=e[a]}return[i.subarray(0,s),t]},fi=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},rs=function(e,t,i){var s=i.length,n=Rc(t+2);e[n]=255&s,e[n+1]=s>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var r=0;s>r;++r)e[n+r+4]=i[r];return 8*(n+4+s)},Jo=function(e,t,i,s,n,r,o,a,l,c,u){Je(t,u++,i),++n[256];for(var d=un(n,15),h=d[0],p=d[1],v=un(r,15),_=v[0],g=v[1],y=Xo(h),m=y[0],w=y[1],P=Xo(_),x=P[0],k=P[1],T=new Ee(19),E=0;m.length>E;++E)T[31&m[E]]++;for(E=0;x.length>E;++E)T[31&x[E]]++;for(var I=un(T,7),N=I[0],B=I[1],W=19;W>4&&!N[Yo[W-1]];--W);var Y,C,V,j,Z=c+5<<3,U=fi(n,At)+fi(r,ks)+o,ie=fi(n,h)+fi(r,_)+o+14+3*W+fi(T,N)+(2*T[16]+3*T[17]+7*T[18]);if(U>=Z&&ie>=Z)return rs(t,u,e.subarray(l,l+c));if(Je(t,u,1+(U>ie)),u+=2,U>ie){Y=$i(h,p,0),C=h,V=$i(_,g,0),j=_;var ge=$i(N,B,0);for(Je(t,u,w-257),Je(t,u+5,k-1),Je(t,u+10,W-4),u+=14,E=0;W>E;++E)Je(t,u+3*E,N[Yo[E]]);u+=3*W;for(var de=[m,x],me=0;2>me;++me){var Te=de[me];for(E=0;Te.length>E;++E)Je(t,u,ge[he=31&Te[E]]),u+=N[he],he>15&&(Je(t,u,Te[E]>>>5&127),u+=Te[E]>>>12)}}else Y=kp,C=At,V=Sp,j=ks;for(E=0;a>E;++E)if(s[E]>255){var he;pi(t,u,Y[257+(he=s[E]>>>18&31)]),u+=C[he+257],he>7&&(Je(t,u,s[E]>>>23&31),u+=Sr[he]);var Re=31&s[E];pi(t,u,V[Re]),u+=j[Re],Re>3&&(pi(t,u,s[E]>>>5&8191),u+=Er[Re])}else pi(t,u,Y[s[E]]),u+=C[s[E]];return pi(t,u,Y[256]),u+C[256]},Ep=new ei([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),$p=new Ce(0),Pp=(function(){for(var e=new ei(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e})(),dn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Mp(e,t){t===void 0&&(t={});var i=(function(){var h=4294967295;return{p(p){for(var v=h,_=0;p.length>_;++_)v=Pp[255&v^p[_]]^v>>>8;h=v},d(){return 4294967295^h}}})(),s=e.length;i.p(e);var n,r,o,a,l,c,u=(a=10+((n=t).filename&&n.filename.length+1||0),l=8,(function(h,p,v,_,g,y){var m=h.length,w=new Ce(_+m+5*(1+Math.floor(m/7e3))+g),P=w.subarray(_,w.length-g),x=0;if(!p||8>m)for(var k=0;m>=k;k+=65535){var T=k+65535;m>T?x=rs(P,x,h.subarray(k,T)):(P[k]=y,x=rs(P,x,h.subarray(k,m)))}else{for(var E=Ep[p-1],I=E>>>13,N=8191&E,B=(1<<v)-1,W=new Ee(32768),Y=new Ee(B+1),C=Math.ceil(v/3),V=2*C,j=function(Ns){return(h[Ns]^h[Ns+1]<<C^h[Ns+2]<<V)&B},Z=new ei(25e3),U=new Ee(288),ie=new Ee(32),ge=0,de=0,me=(k=0,0),Te=0,he=0;m>k;++k){var Re=j(k),ot=32767&k,at=Y[Re];if(W[ot]=at,Y[Re]=ot,k>=Te){var wt=m-k;if((ge>7e3||me>24576)&&wt>423){x=Jo(h,P,0,Z,U,ie,de,me,he,k-he,x),me=ge=de=0,he=k;for(var Pe=0;286>Pe;++Pe)U[Pe]=0;for(Pe=0;30>Pe;++Pe)ie[Pe]=0}var ze=2,Wi=0,Wu=N,lt=ot-at&32767;if(wt>2&&Re==j(k-lt))for(var Uu=Math.min(I,wt)-1,zu=Math.min(32767,k),Gu=Math.min(258,wt);zu>=lt&&--Wu&&ot!=at;){if(h[k+ze]==h[k+ze-lt]){for(var ct=0;Gu>ct&&h[k+ct]==h[k+ct-lt];++ct);if(ct>ze){if(ze=ct,Wi=lt,ct>Uu)break;var qu=Math.min(lt,ct-2),Zr=0;for(Pe=0;qu>Pe;++Pe){var Ds=k-lt+Pe+32768&32767,Yr=Ds-W[Ds]+32768&32767;Yr>Zr&&(Zr=Yr,at=Ds)}}}lt+=(ot=at)-(at=W[ot])+32768&32767}if(Wi){Z[me++]=268435456|Xn[ze]<<18|Jn[Wi];var Xr=31&Xn[ze],Jr=31&Jn[Wi];de+=Sr[Xr]+Er[Jr],++U[257+Xr],++ie[Jr],Te=k+ze,++ge}else Z[me++]=h[k],++U[h[k]]}}x=Jo(h,P,y,Z,U,ie,de,me,he,k-he,x),y||(x=rs(P,x,$p))}return Oc(w,0,_+Rc(x)+g)})(r=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+o.mem,a,l,!c)),d=u.length;return(function(h,p){var v=p.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>p.level?4:p.level==9?2:0,h[9]=3,p.mtime!=0&&dn(h,4,Math.floor(new Date(p.mtime||Date.now())/1e3)),v){h[3]=8;for(var _=0;v.length>=_;++_)h[_+10]=v.charCodeAt(_)}})(u,t),dn(u,d-8,i.d()),dn(u,d-4,s),u}var Tp=!!sr||!!Ii,Lc=new WeakMap,Dc="text/plain",hn=0,os=!1,Nc=(e,t)=>{let[i,s]=e.split("#"),[n,r]=i.split("?");if(!r)return e;let o=r.split("&").filter(a=>a.split("=")[0]!==t).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},Ni=(e,t,i=!0)=>{var s;let[n,r]=e.split("?"),o=f({},t),a=(s=r==null?void 0:r.split("&").map(c=>{var u;let[d,h]=c.split("="),p=i&&(u=o[d])!==null&&u!==void 0?u:h;return delete o[d],`${d}=${p}`}))!==null&&s!==void 0?s:[],l=(function(c,u="&"){let d,h,p=[];return q(c,function(v,_){S(v)||S(_)||_==="undefined"||(d=encodeURIComponent((g=>g instanceof File)(v)?v.name:v.toString()),h=encodeURIComponent(_),p[p.length]=h+"="+d)}),p.join(u)})(o);return l&&a.push(l),a.length>0?`${n}?${a.join("&")}`:n},pn=e=>{if(e.nl)return e.nl;let{data:t,compression:i}=e;if(!t)return;if(i===Fe.GZipJS){let n=Mp((function(r){var o=r.length;if(typeof TextEncoder!="undefined")return new TextEncoder().encode(r);for(var a=new Ce(r.length+(r.length>>>1)),l=0,c=function(p){a[l++]=p},u=0;o>u;++u){if(l+5>a.length){var d=new Ce(l+8+(o-u<<1));d.set(a),a=d}var h=r.charCodeAt(u);128>h?c(h):2048>h?(c(192|h>>>6),c(128|63&h)):h>55295&&57344>h?(c(240|(h=65536+(1047552&h)|1023&r.charCodeAt(++u))>>>18),c(128|h>>>12&63),c(128|h>>>6&63),c(128|63&h)):(c(224|h>>>12),c(128|h>>>6&63),c(128|63&h))}return Oc(a,0,l)})(Ut(t)),{mtime:0});return{contentType:Dc,body:n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength),estimatedSize:n.byteLength}}if(i===Fe.Base64){let n=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,(a,l)=>String.fromCharCode(parseInt(l,16))))})(Ut(t)),r=(o=>"data="+encodeURIComponent(typeof o=="string"?o:Ut(o)))(n);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}let s=Ut(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},jc=e=>{let t=()=>e.transport==="sendBeacon"?{url:Ni(e.url,{compression:Fe.Base64}),encodedBody:pn(f(f({},e),{},{compression:Fe.Base64,nl:void 0}))}:{url:Nc(e.url,"compression"),encodedBody:pn(f(f({},e),{},{compression:void 0,nl:void 0}))},i;try{i=pn(e)}catch(n){if(vo(e.compression,Kt(e.url,"compression")))return M.error("Failed to gzip request body, sending uncompressed payload",n),t();throw n}return i&&vo(e.compression,Kt(e.url,"compression"))&&!((s=i.body)instanceof ArrayBuffer?An(new Uint8Array(s)):ArrayBuffer.isView(s)&&An(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(os=!0,t()):{url:e.url,encodedBody:i};var s},Vc=e=>{try{return jc(e)}catch(i){var t;return M.error(i),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:i}))}},Ip=(function(){var e=ee(function*(t){let i=yield(function(n){return Rn.apply(this,arguments)})(Ut(t.data),ue.DEBUG,{rethrow:!0});if(!i)return t;let s=yield i.arrayBuffer();return f(f({},t),{},{nl:{contentType:Dc,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}})(),Fp=/Failed to fetch|NetworkError|Load failed/i,Hc=e=>(e==null?void 0:e.name)==="TypeError"&&Fp.test((e==null?void 0:e.message)||""),Bc=e=>{try{let t=(function(i,s=Date.now()){if(typeof i!="string"||!i)return;let n=i.trim(),r=/^\d+\s*,/.test(n)?n.slice(0,n.indexOf(",")).trim():n;if(/^\d+$/.test(r)){let l=1e3*Math.min(Number(r),300);return l>0?l:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r))return;let o=/^\w{3} \w{3} /.test(r)?r+" GMT":r,a=Date.parse(o)-s;return Number.isFinite(a)&&a>0?Math.min(a,is):void 0})(e());return S(t)?void 0:Math.min(t,3e4)}catch{return}},Wc=e=>{let t=Vc(e);if(!t)return;let i=new sr;Lc.set(i,!0);let{url:s,encodedBody:n}=t;i.open(e.method||"GET",s,!0);let{contentType:r,body:o}=n!=null?n:{};q(e.headers,function(a,l){i.setRequestHeader(l,a)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(i.readyState===4){var a;let l={statusCode:i.status,text:i.responseText};if(i.status===200)try{l.json=JSON.parse(i.responseText)}catch{}(a=e.callback)===null||a===void 0||a.call(e,l,Bc(()=>i.getResponseHeader("Retry-After")))}},i.send(o)},Uc=e=>{let t=Vc(e);if(!t)return;let{url:i,encodedBody:s}=t,{contentType:n,body:r,estimatedSize:o}=s!=null?s:{},a=new Headers;q(e.headers,function(v,_){a.append(_,v)}),n&&a.append("Content-Type",n);let l=null,c=!1;if(Kr){let v=new Kr;l={signal:v.signal,timeout:setTimeout(()=>{c=!0;try{v.abort(fl("AbortError","PostHog request timed out"+((_=e.timeout)?` after ${_}ms`:"")))}catch(g){d(g)}var _},e.timeout)}}let u=!1,d=v=>{var _;u||(u=!0,c&&(v==null?void 0:v.name)==="AbortError"||Hc(v)?M.warn(v):M.error(v),(_=e.callback)===null||_===void 0||_.call(e,{statusCode:0,error:v}))},h=0,p=()=>{hn-=h,h=0,l&&clearTimeout(l.timeout)};try{let v=f({method:(e==null?void 0:e.method)||"GET",headers:a,referrerPolicy:"strict-origin",body:r,signal:l==null?void 0:l.signal},e.fetchOptions),_=o!=null?o:S(r)?0:void 0;v.keepalive=v.method==="POST"&&!e.sl&&v.keepalive!==!1&&v.body===r&&!S(_)&&_>=0&&52428.8>hn+_,v.keepalive&&(h=_,hn+=h),Ii(i,v).then(g=>g.text().then(y=>{var m;if(u)return;let w={statusCode:g.status,text:y};if(g.status===200)try{w.json=JSON.parse(y)}catch(P){M.error(P)}u=!0,p(),(m=e.callback)===null||m===void 0||m.call(e,w,Bc(()=>g.headers.get("Retry-After")))})).catch(g=>{p(),d(g)}).finally(p)}catch(v){p(),d(v)}},Qn=e=>{try{var t;let{url:i,encodedBody:s}=jc(e),{contentType:n,body:r,estimatedSize:o}=s!=null?s:{};if(!r)return;let a=r instanceof Blob?r:new Blob([r],{type:n});if(pe.sendBeacon(i,a))return;let l=R(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(R(l)&&l.length>1&&(o!=null?o:0)>16384){let c=Math.ceil(l.length/2),u=d=>R(e.data)?d:f(f({},e.data),{},{batch:d});return Qn(f(f({},e),{},{data:u(l.slice(0,c))})),void Qn(f(f({},e),{},{data:u(l.slice(c))}))}M.warn(`Beacon of ~${o!=null?o:0} bytes was rejected by the browser, falling back to ${Ii?"fetch":"XHR"}`),Ii?Uc(f(f({},e),{},{sl:!0})):Wc(e)}catch(i){M.warn("Beacon send failed",i)}},Ko=(e,t,i,s)=>{let n=s==="query"?t==="POST"?"sent_at":"_":void 0;return Ni(i===Fe.GZipJS?Nc(e,"compression"):e,f(f({},n?{[n]:Date.now().toString()}:{}),i===Fe.GZipJS?{}:{compression:i}))},Cp=(()=>{let e=[];return Ii&&e.push({transport:"fetch",method:Uc}),sr&&e.push({transport:"XHR",method:Wc}),pe!=null&&pe.sendBeacon&&e.push({transport:"sendBeacon",method:Qn}),e})(),zc=!Tp&&(xe==null?void 0:xe.indexOf("MSIE"))===-1&&(xe==null?void 0:xe.indexOf("Mozilla"))===-1;function Gc(e,t,i){var s,n,r;i&&(t=f(f({},t),{},{callback:o=>i(o)})),e.__loaded?zc?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((n=t.callback)===null||n===void 0||n.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=f(f({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(s=e.compression)!==null&&s!==void 0?s:t.compressionFallback:t.compression,(S(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((o,a)=>{var l,c,u;let d=f(f({},o),{},{callback:a!=null?a:g=>{var y;return(y=o.callback)===null||y===void 0?void 0:y.call(o,g)}});d.timeout=d.timeout||6e4;let h=(l=d.transport)!==null&&l!==void 0?l:"fetch";h==="sendBeacon"&&S(d.compression)&&d.data&&(d.compression=Fe.Base64),d.method==="POST"&&d.data&&(d.timestampMode==="capture-body"?d.data=(g=>{var y,m;let w=(R(g)?g:[g]).map(x=>f(f({},x),x.timestamp instanceof Date&&!isNaN(x.timestamp.getTime())?{timestamp:x.timestamp.toISOString()}:{})),P=w[0];return{api_key:(y=P==null||(m=P.properties)===null||m===void 0?void 0:m.token)!==null&&y!==void 0?y:P==null?void 0:P.token,batch:w,sent_at:new Date().toISOString()}})(d.data):d.timestampMode==="body"&&(d.data=((g,y=new Date().toISOString())=>R(g)?g.map(m=>f(f({},m),{},{sent_at:y})):f(f({},g),{},{sent_at:y}))(d.data))),d.url=Ko(d.url,d.method,d.compression,d.timestampMode);let p=Cp.filter(g=>!d.disableTransport||!g.transport||!d.disableTransport.includes(g.transport)),v=(c=(u=(function(g,y){for(let m=0;g.length>m;m++)if(y(g[m]))return g[m]})(p,g=>g.transport===h))===null||u===void 0?void 0:u.method)!==null&&c!==void 0?c:p[0].method;if(!v)throw new Error("No available transport method");let _=g=>{try{v(g)}catch(m){var y;Hc(m)?M.warn(m):M.error(m),(y=d.callback)===null||y===void 0||y.call(d,{statusCode:0,error:m})}};h!=="sendBeacon"&&!d.preferSyncCompression&&d.data&&d.compression===Fe.GZipJS&&Zu&&typeof Promise!="undefined"&&!os?Ip(d).then(g=>{_(g)}).catch(g=>{if(go(g))return os=!0,void _(f(f({},d),{},{compression:void 0,url:Ko(o.url,o.method,void 0,o.timestampMode)}));(y=>{if(!y||typeof y!="object")return!1;let m="name"in y?String(y.name):"";return go(y)||m===wl})(g)&&(os=!0),_(d)}):_(d)})(t,(o,a)=>{var l,c,u;e.rateLimiter.checkForLimiting(o),400>o.statusCode||(l=(c=e.config).on_request_error)===null||l===void 0||l.call(c,o),i?i(o,a):(u=t.callback)===null||u===void 0||u.call(t,o)})):t.fireCallbackOnDrop&&((r=t.callback)===null||r===void 0||r.call(t,{statusCode:0}))}var Ap=class{constructor(e,t){this.rl=!0,this.ol=[],this.al=Ye((t==null?void 0:t.flush_interval_ms)||3e3,250,5e3,M.createLogger("flush interval"),3e3),this.ll=e}enqueue(e){this.ol.push(e),this.ul||this.cl()}unload(){this.hl();let e=this.ol.length>0?this.dl():{},t=Object.values(e);[...t.filter(i=>i.url.indexOf("/e")===0),...t.filter(i=>i.url.indexOf("/e")!==0)].map(i=>{this.vl(f(f({},i),{},{callback:void 0}),"sendBeacon")})}enable(){this.rl=!1,this.cl()}cl(){this.rl||(this.ul=setTimeout(()=>{this.hl(),this.fl()},this.al))}fl(){if(this.ol.length>0){let e=this.dl();for(let t in e)this.vl(e[t])}}vl(e,t){try{this.ll(e,t)}catch(i){M.error(i)}}hl(){clearTimeout(this.ul),this.ul=void 0}dl(){let e={},t={};q(this.ol,i=>{var s;let n=i,r=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");S(e[r])&&(e[r]=f(f({},n),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),t[r]=[]),(s=e[r].data)===null||s===void 0||s.push(n.data),n.callback&&t[r].push(n.callback)});for(let i in t){let s=t[i];s.length&&(e[i].callback=n=>{for(let r of s)r(n)})}return this.ol=[],e}},Rp=["retriesPerformedSoFar"],Op=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.ol=[],this.ol=[],this.ml=!0,this.resume()}resume(){if(!S(b)&&"onLine"in b.navigator){if(this.ml=b.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.fl()},this.bl=()=>{this.ml=!1},z(b,"online",this.yl),z(b,"offline",this.bl)}}get length(){return this.ol.length}retriableRequest(e,t){let{retriesPerformedSoFar:i}=e,s=xl(e,Rp);Qe(i)&&(s.url=Ni(s.url,{retry_count:i})),Gc(this._instance,t?f(f({},s),{},{transport:t}):s,(n,r)=>{var o;if(n.statusCode!==200&&(400>n.statusCode||n.statusCode>=500)){if((n.statusCode===0?3:10)>(i!=null?i:0))return void this.Ls(f({retriesPerformedSoFar:i},s),r);n.statusCode===0&&M.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${i!=null?i:0} retries.`)}(o=s.callback)===null||o===void 0||o.call(s,n)})}Ls(e,t){let i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;let s=Math.max((function(o){let a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)})(i),t!=null?t:0),n=Date.now()+s;this.ol.push({retryAt:n,requestOptions:e});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),M.warn(r),this.pl||(this.pl=!0,this._l())}_l(){if(this.wl&&clearTimeout(this.wl),this.ol.length===0)return this.pl=!1,void(this.wl=void 0);this.wl=setTimeout(()=>{this.ml&&this.ol.length>0&&this.fl(),this._l()},this.gl)}fl(){let e=Date.now(),t=[],i=this.ol.filter(s=>e>s.retryAt||(t.push(s),!1));if(this.ol=t,i.length>0)for(let{requestOptions:s}of i)this.retriableRequest(s)}unload(){this.wl&&(clearTimeout(this.wl),this.wl=void 0),this.pl=!1,S(b)||(this.yl&&(b.removeEventListener("online",this.yl),this.yl=void 0),this.bl&&(b.removeEventListener("offline",this.bl),this.bl=void 0));for(let{requestOptions:e}of this.ol)try{this._instance._send_request(f(f({},e),{},{callback:R(e.data)?void 0:e.callback,transport:"sendBeacon"}))}catch(t){M.error(t)}this.ol=[]}},Lp=class{constructor(e){this._instance=e,this.kl=()=>{var t,i,s,n;this.Sl||(this.Sl={});let r=this.scrollElement(),o=this.scrollY(),a=r?Math.max(0,r.scrollHeight-r.clientHeight):0,l=o+((r==null?void 0:r.clientHeight)||0),c=(r==null?void 0:r.scrollHeight)||0;this.Sl.lastScrollY=Math.ceil(o),this.Sl.maxScrollY=Math.max(o,(t=this.Sl.maxScrollY)!==null&&t!==void 0?t:0),this.Sl.maxScrollHeight=Math.max(a,(i=this.Sl.maxScrollHeight)!==null&&i!==void 0?i:0),this.Sl.lastContentY=l,this.Sl.maxContentY=Math.max(l,(s=this.Sl.maxContentY)!==null&&s!==void 0?s:0),this.Sl.maxContentHeight=Math.max(c,(n=this.Sl.maxContentHeight)!==null&&n!==void 0?n:0)}}get xl(){return this._instance.config.scroll_root_selector}getContext(){return this.Sl}resetContext(){let e=this.Sl;return this.Sl=void 0,setTimeout(this.kl,0),e}startMeasuringScrollPosition(){z(b,"scroll",this.kl,{capture:!0}),z(b,"scrollend",this.kl,{capture:!0}),z(b,"resize",this.kl)}scrollElement(){if(this.xl){let i=R(this.xl)?this.xl:[this.xl];for(let s of i){var e;let n=b==null||(e=b.document)===null||e===void 0?void 0:e.querySelector(s);if(n)return n}return}var t;return b==null||(t=b.document)===null||t===void 0?void 0:t.documentElement}$l(e){var t,i;let s=e==="y"?"scrollTop":"scrollLeft";if(this.xl){let n=this.scrollElement();return n&&n[s]||0}return b?e==="y"?b.scrollY||b.pageYOffset||((t=b.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:b.scrollX||b.pageXOffset||((i=b.document)===null||i===void 0||(i=i.documentElement)===null||i===void 0?void 0:i.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}},Dp=e=>Mc(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes),Qo=class{constructor(e,t,i,s){this.qe=n=>{let r=this.Cl();if(r&&r.sessionId===n)return;let o={sessionId:n,props:this.Tl(this._instance)};this.Il.register({[Wn]:o})},this._instance=e,this.Ml=t,this.Il=i,this.Tl=s||Dp,this.Ml.onSessionId(this.qe)}Cl(){return this.Il.props[Wn]}getSetOnceProps(){var e;let t=(e=this.Cl())===null||e===void 0?void 0:e.props;return t?"r"in t?Tc(t,this._instance.config.disable_capture_url_hashes):{$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(){let e={};return q(mr(this.getSetOnceProps()),(t,i)=>{i==="$current_url"&&(i="url"),e[`$session_entry_${Pn(i)}`]=t}),e}},Ss=class{on(e,t){return this.El[e]||(this.El[e]=[]),this.El[e].push(t),()=>{this.El[e]=this.El[e].filter(i=>i!==t)}}emit(e,t){for(let i of this.El[e]||[])i(t);for(let i of this.El["*"]||[])i(e,t)}constructor(){this.El={}}},Dt=re("[SessionId]"),ea=864e5,ta=class{on(e,t){return this.Pl.on(e,t)}constructor(e,t,i){var s;if(this.Rl=null,this.Al=null,this.Fl=[],this.Ol=void 0,this.Dl=!1,this.Pl=new Ss,this.Ll=(r,o)=>!(!Qe(r)||!Qe(o))&&Math.abs(r-o)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=e.config,this.Il=e.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Nl=void 0,this._sessionActivityTimestamp=null,this.ql=t||He,this.jl=i||He;let n=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Ye(this.Mr.session_idle_timeout_seconds||1800,60,36e3,Dt.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Bl(),this.zl="ph_"+n+"_window_id",this.Hl="ph_"+n+"_primary_window_exists",this.Ul()){let r=J.Lt(this.zl),o=J.Lt(this.Hl);r&&!o?this.je=r:J.Pt(this.zl),J.$t(this.Hl,!0)}!((s=this.Mr.bootstrap)===null||s===void 0)&&s.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Wl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return S(this.Fl)&&(this.Fl=[]),this.Fl.push(e),this.Xt&&e(this.Xt,this.je),()=>{this.Fl=this.Fl.filter(t=>t!==e)}}Ul(){return this.Mr.persistence!=="memory"&&!this.Il.hi&&J.At()}Vl(e){e!==this.je&&(this.je=e,this.Ul()&&J.$t(this.zl,e))}Gl(){return this.je?this.je:this.Ul()?J.Lt(this.zl):null}Ql(e){let t=this.Rl;return!ne(t)&&!ne(e)&&5e3>Math.abs(e-t)}Zl(e,t,i){let s=t!==this._sessionActivityTimestamp,n=!(e!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Xt=e,n&&!s||n&&this.Ql(t)||(this.Rl=t,this.Il.register({[Ht]:[t,e,i]}))}Jl(){var e;let t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return Qe(t)&&t>0}Kl(){this.Jl()?this.Il.refreshKey(Ht):(this.Il.flush(),this.Il.load())}Xl(){var e;if(ne(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Rl)return;this.Kl();let[,t,i]=this.Yl();t===this.Xt&&i===this._sessionStartTimestamp&&(this.Rl=this._sessionActivityTimestamp,this.Il.register({[Ht]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){let[e]=this.Yl(),t=Qe(e)?e:0,i=Qe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}eu(e){return this.Kl(),this.Ll(e,this.tu())}Yl(){let e=this.Il.props[Ht];return R(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Rl=null,this.Nl=void 0,clearTimeout(this.iu),this.iu=void 0,this.Zl(null,null,null)}setBootstrapSessionId(e,t=!1){let i=((s,n=new Date().getTime())=>{try{let r=(o=>{let a=o.replace(/-/g,"");if(a.length!==32)throw new Error("Not a valid UUID");if(a[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(a.substring(0,12),16)})(s);return r>n+6e4?void Dt.error("Bootstrap sessionID cannot be in the future"):r}catch(r){return void Dt.error("Invalid sessionID in bootstrap",r)}})(e);return!S(i)&&(t?this.Nl={sessionId:e,sessionStartTimestamp:i}:this.Zl(e,new Date().getTime(),i),!0)}destroy(){this.Dl=!0,this.Xl(),clearTimeout(this.iu),this.iu=void 0,this.Ol&&b&&(b.removeEventListener(ms,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&J.Pt(this.Hl)},z(b,ms,this.Ol,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if(this.Mr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');let s=t||new Date().getTime(),n=this.Xt;if(i)this.Al=s;else if(ne(this.Al)||this.Al>s||s-this.Al>=1e3){var r,o;(r=(o=this.Il).syncCookieProperties)===null||r===void 0||r.call(o),this.Al=s}let[,a,l]=this.Yl(),c=!S(n)&&a!==n,u=this.tu(),d=this.Gl(),h=this.Nl,p=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>ea),v=h?p:Qe(l)&&Math.abs(s-l)>ea,_=!1,g=c,y=!a||!!h,m=a,w=!y&&!e&&this.Ll(s,u);if(w&&(w=this.eu(s),w||Dt.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.Yl(),w||(y=!a||!!h)),y||w||v){g=!1;let T=h&&!p;a=T?h.sessionId:this.ql(),d=this.jl(),Dt.info("new session ID assigned",{sessionId:a,windowId:d,bootstrapped:!!T,changeReason:{noSessionId:y,activityTimeout:w,sessionPastMaximumLength:v}}),l=T?h.sessionStartTimestamp:s,this.Nl=void 0,_=!0}else d||(d=this.jl(),_=!0),g=g||a!==m,g&&(Dt.info("adopted cross-tab session id",{sessionId:a,windowId:d}),_=!0);let P=Qe(u)&&e&&!v?u:s,x=Qe(l)?l:new Date().getTime();this.Vl(d),this.Zl(a,P,x),e||this.Bl();let k={noSessionId:y,activityTimeout:w,sessionPastMaximumLength:v,crossTabAdoption:g};return _&&this.Fl.forEach(T=>T(a,d,k)),{sessionId:a,windowId:d,sessionStartTimestamp:x,changeReason:_?k:void 0,lastActivityTimestamp:u}}Bl(){this.Dl||(clearTimeout(this.iu),this.iu=setTimeout(()=>{if(!this.Dl)if(this.eu(new Date().getTime())){let e=this.Xt;this.resetSessionId(),this.Pl.emit("forcedIdleReset",{idleSessionId:e})}else this.Bl()},1.1*this.sessionTimeoutMs))}},qc=function(e,t){if(!e)return!1;let i=e.userAgent;if(i&&to(i,t))return!0;try{let s=e==null?void 0:e.userAgentData;if(s!=null&&s.brands&&s.brands.some(n=>to(n==null?void 0:n.brand,t)))return!0}catch{}return!!e.webdriver};function Zc(){return(Zc=ee(function*(){let e=pe==null?void 0:pe.userAgentData;if(e!=null&&e.getHighEntropyValues)try{let t=yield e.getHighEntropyValues(["model"]),i=t==null?void 0:t.model;return D(i)&&i.length>0?i:void 0}catch(t){return void M.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Np(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function Yc(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}var Es=(e,t)=>{if(!(i=>{try{new RegExp(i)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},Ji=e=>e.toLowerCase(),Xc={exact:(e,t)=>t.some(i=>e.some(s=>i===s)),is_not:(e,t)=>t.every(i=>e.every(s=>i!==s)),regex:(e,t)=>t.some(i=>e.some(s=>Es(i,s))),not_regex:(e,t)=>t.every(i=>e.every(s=>!Es(i,s))),icontains:(e,t)=>t.map(Ji).some(i=>e.map(Ji).some(s=>i.includes(s))),not_icontains:(e,t)=>t.map(Ji).every(i=>e.map(Ji).every(s=>!i.includes(s))),gt:(e,t)=>t.some(i=>{let s=parseFloat(i);return!isNaN(s)&&e.some(n=>s>parseFloat(n))}),lt:(e,t)=>t.some(i=>{let s=parseFloat(i);return!isNaN(s)&&e.some(n=>s<parseFloat(n))})};function Jc(e,t){return!e||Object.entries(e).every(([i,s])=>{let n=t==null?void 0:t[i];if(n==null)return!1;let r=Xc[s.operator];return!!r&&r(s.values.map(String),[String(n)])})}function fn(e,t,i){return Ut({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var er="custom",ia="i.posthog.com",jp=/^\/static\//,Vp=["/s/","/e/","/i/"],Hp=class{constructor(e){this.nu={},this.instance=e}get apiHost(){let e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){let e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${ia}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.nu[this.apiHost]||(this.nu[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":er),this.nu[this.apiHost]}su(e){if(!jp.test(e))return;let t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}ru(e){let t=nt(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}ou(e,t,i){if(e==="ui")return i;let s=i,n=this.instance.config.rewriteRequestPath;if(n){var r;let o=((r=nt(i))===null||r===void 0?void 0:r.href)||i;s=n(new URL(o)).toString()}if(n&&e==="api"&&Vp.some(o=>t.indexOf(o)===0)){let o=this.ru(s);if(o){let a=this.apiHost,l=this.au;(l==null?void 0:l.apiHost)===a&&l.rewriteRequestPath===n||(l={apiHost:a,rewriteRequestPath:n,urls:new Set},this.au=l),l.urls.add(o)}}return s}isIngestionEndpoint(e){let t=this.au,i=this.ru(e);return(t==null?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this.ou(e,t,this.uiHost+t);if(e==="flags")return this.ou(e,t,this.flagsApiHost+t);if(e==="assets"){let s=this.su(t);if(s)return this.ou(e,t,`${s}${t}`)}if(this.region===er)return this.ou(e,t,this.apiHost+t);let i=ia+t;switch(e){case"assets":return this.ou(e,t,`https://${this.region}-assets.${i}`);case"api":return this.ou(e,t,`https://${this.region}.${i}`)}}},G=re("[Surveys]"),Kc=e=>{try{let t=(i=>((s,n)=>`seenSurvey_${(function(r){return r.current_iteration&&r.current_iteration>0?`${r.id}_${r.current_iteration}`:r.id})(n)}`)(0,i))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){G.error("Failed to persist survey seen state",t)}},Bp=[ln.Popover,ln.Widget,ln.API],Wp={ignoreConditions:!1,ignoreDelay:!1,displayType:Yn.Popover},Up=re("[PostHog ExternalIntegrations]"),zp={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Gp=class{constructor(e){this._instance=e}zo(e,t){var i,s;(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,e,n=>{if(n)return Up.error("failed to load script",n);t()})}startIfEnabledOrStop(){var e;for(let[n,r]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,i,s;r&&!(!((t=F.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[n])&&this.zo(zp[n],()=>{var o;(o=F.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[n])===null||o===void 0||o.start(this._instance)}),!r&&(!((i=F.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0)&&i[n])&&((s=F.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0||(s=s[n])===null||s===void 0||s.stop())}}},qp=class{constructor(e,t){this.A=e,this.bo=t,this.lu=new Map,this.To=!1}add(e){var t=this;return ee(function*(){if(t.To)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.lu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.lu.set(e.name,e);try{let i=e.setup(t.bo);i&&(yield i)}catch(i){let s=t.lu.get(e.name)===e;s&&t.lu.delete(e.name),t.A.error(`Failed to set up browser extension "${e.name}"`,i),s&&t.uu(e)}})()}getExtension(e){return this.lu.get(e)}dispose(){if(this.To)return;this.To=!0;let e=Array.from(this.lu.values()).reverse();this.lu.clear();for(let t of e)this.uu(t)}uu(e){try{var t;let i=(t=e.dispose)===null||t===void 0?void 0:t.call(e);i&&le(i.then)&&i.then(void 0,s=>{this.A.error(`Failed to dispose browser extension "${e.name}"`,s)})}catch(i){this.A.error(`Failed to dispose browser extension "${e.name}"`,i)}}},Zp=class{constructor(e){this._instance=e}initialize(){}get(e){let t=this._instance.persistence;if(typeof e=="string")return t==null?void 0:t.get_property(e);let i={};for(let s of e){let n=t==null?void 0:t.get_property(s);S(n)||(i[s]=n)}return i}set(e,t){var i;(i=this._instance.persistence)===null||i===void 0||i.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}},sa="extensionsRemoteConfig",Yp=class{constructor(e){this.instance=e,this.To=!1,this.A=M,this.cu=e.hu,this.kv=new Zp(e),this.onEvent=t=>Xi(this.instance.on("eventCaptured",i=>{try{t({event:i.event,properties:i.properties})}catch(s){this.A.error("Browser extension event listener failed",s)}})),this.onRemoteConfig=t=>{if(this.To)return Xi(()=>{});let i=n=>{try{t(n)}catch(r){this.A.error("Browser extension remote config listener failed",r)}},s=this.instance.du.on(sa,i);return this.cu&&i(this.cu),Xi(s)},this.vu=new qp(M.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){let e=this.instance.get_property(ur);return typeof e=="string"?e:void 0}get library(){return{name:ue.LIB_NAME,version:ue.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s;let n=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=n==null?void 0:n.sessionId)!==null&&t!==void 0?t:"",windowId:(i=n==null?void 0:n.windowId)!==null&&i!==void 0?i:"",sessionStartTimestamp:(s=n==null?void 0:n.sessionStartTimestamp)!==null&&s!==void 0?s:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.vu.add(e)}getExtension(e){return this.vu.getExtension(e)}capture(e,t,i){i?this.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return Xi(this.instance.fu(e))}handleRemoteConfig(e){this.To||(this.cu=e,this.instance.du.emit(sa,e))}sendRequest(e){var t=this;return ee(function*(i,s={}){var n;let r=t.instance.requestRouter.endpointFor((n=s.target)!==null&&n!==void 0?n:"api",i),o={method:s.method,url:s.query?Ni(r,s.query):r,data:s.body,headers:s.headers,timeout:s.timeoutMs,fireCallbackOnDrop:!0,transport:s.transport,compression:s.compression,compressionFallback:s.target==="flags"&&s.compression==="best-available"?$n.Base64:void 0,timestampMode:s.sentAt};return s.transport==="sendBeacon"?(t.instance._send_request(o),{statusCode:202}):new Promise(a=>{o.callback=a,t.instance._send_request(o)})}).apply(this,arguments)}dispose(){this.To||(this.To=!0,this.vu.dispose())}},Pi={},vn=0,Mi=()=>{},na='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Nt="Surveys module not available",ra="sanitize_properties is deprecated. Use before_send instead",Qc="Invalid value for property_denylist config: ",Xp=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],Jp=["$feature_flag_called","$$heatmap","$snapshot"],oa=e=>e.charAt(0)==="$"&&!A(Jp,e),Kp=/^[A-Za-z0-9_-]{1,400}$/,aa=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,la=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Qp=["token","distinct_id",Zl],mi="posthog",ef=e=>{let t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},gn=e=>{var t;return f({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Zh($==null?void 0:$.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Mi,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e!=null?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:K&&D(K==null?void 0:K.search)&&K.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(b==null||(t=b.location)===null||t===void 0?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(i){M.error("Bad HTTP status: "+i.statusCode+" "+i.text)},get_device_id:i=>i,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:nc,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Mi},(i=>({rageclick:i&&i>="2026-05-30"?{content_ignorelist:xr,ignore_text_selection:!0}:!i||"2025-11-30">i||{content_ignorelist:!0},capture_pageview:!i||"2025-05-24">i||"history_change",session_recording:ef(i),external_scripts_inject_target:i&&i>="2026-01-30"?"head":"body",internal_or_test_user_hostname:i&&i>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:i&&i>="2026-05-30"?250:0,split_storage:!(!i||"2026-05-30">i),detect_google_search_app:!(!i||"2026-05-30">i),disable_capture_url_hashes:!(!i||"2026-06-25">i),cookieWinsOnConflict:!(!i||i==="unset"||"2026-08-29">i)}))(e))},tf=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],ca=e=>{let t={};for(let[n,r]of tf)S(e[n])||(t[r]=e[n]);let i=Q({},t,e),s=e.__preview_external_dependency_versioned_paths;return S(s)||(S(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),D(s)&&S(e.asset_host)&&(i.asset_host=s)),R(e.property_blacklist)&&(S(e.property_denylist)?i.property_denylist=e.property_blacklist:R(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:M.error(Qc+e.property_denylist)),i},sf=class{constructor(){this.__forceAllowLocalhost=!1}get pu(){return this.__forceAllowLocalhost}set pu(e){M.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Ti=class pt{gu(t){if(!t)return;let i=this.lu.indexOf(t);i!==-1&&this.lu.splice(i,1)}mu(t,i){var s;return this.gu(t),this.lu.push(i),(s=i.initialize)===null||s===void 0||s.call(i),i}yu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}bu(){if(this._u||this.config.reuseAnonymousId||this.config.segment||this.yu())return;let t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.wu)return;let i,s,n;t?(i=`persistence is set to '${this.config.persistence}'`,s=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(i="persistence is disabled (disable_persistence is true)",s="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._u=!0,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${s}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${n}`)}ku(){let t=this.persistence;if(!t||this.Su)return;if(this.yu())return void(this.config.cookieless_mode==="on_reject"&&this.get_distinct_id()!=="$posthog_cookieless"&&(this.xu(),this.$u()));if(this.get_distinct_id()!=="$posthog_cookieless")return;this.Cu()||t.load(!0);let i=this.get_distinct_id();if(!i||i==="$posthog_cookieless"){let s=this.config.get_device_id(He());this.register({distinct_id:s,$device_id:s}),t.set_property(ke,it)}this.xu()}get decideEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.Tu=!1,this.Iu=!1,this.webPerformance=new sf,this.Mu=!1,this.version=ue.LIB_VERSION,this.Eu=new Set,this.Pu="",this.du=new Ss,this.lu=[],this.Ru=[],this.Au=!1,this.wu=!1,this._u=!1,this.Su=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=gn(),this.SentryIntegration=hp,this.sentryIntegration=s=>(function(n,r){let o=mc(n,r);return{name:_c,processEvent:a=>o(a)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fu=!1,this.Ou=null,this.Du=null,this.Lu=null,this.scrollManager=new Lp(this),this.pageViewManager=new Uo(this),this.rateLimiter=new xp(this),this.requestRouter=new Hp(this),this.consent=new tp(this),this.externalIntegrations=new Gp(this);let i=(t=pt.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(s,n,r)=>{let o=D(s)?{[s]:n}:s;this.setPersonProperties(o),r==null||r({})},set_once:(s,n,r)=>{let o=D(s)?{[s]:n}:s;this.setPersonProperties(void 0,o),r==null||r({})}},this.on("eventCaptured",s=>M.info(`send "${s==null?void 0:s.event}"`,s))}init(t,i,s){if(s&&s!==mi){var n;let r=(n=Pi[s])!==null&&n!==void 0?n:new pt;return r._init(t,i,s),Pi[s]=r,Pi[mi][s]=r,r}return this._init(t,i,s)}_init(t,i={},s){var n,r,o;let a=D(t)?t.trim():"";if(!a)return M.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==((l=this.config)===null||l===void 0?void 0:l.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=gn(i.defaults),i.debug=this.Nu(i.debug),this.qu=i,this.ju=[],i.person_profiles?this.Du=i.person_profiles:i.process_person&&(this.Du=i.process_person);let c=gn(i.defaults),u=ca(i),d=Q({},c,u,{name:s,token:a});L(c.rageclick)&&L(u.rageclick)&&(d.rageclick=Q({},c.rageclick,u.rageclick)),L(c.session_recording)&&L(u.session_recording)&&(d.session_recording=Q({},c.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&M.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Fe.GZipJS;let h=this.Cu(),p=!this.yu();if(this.persistence=new an(this.config,h,!0,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new an(f(f({},this.config),{},{persistence:"sessionStorage"}),h,!1,p),this.Pu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!h&&J.At()){let m=J.Lt(this.Pu);R(m)&&m.forEach(w=>{D(w)&&this.Eu.add(w)})}else J.Pt(this.Pu);let v=f({},this.persistence.props),_=f({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Bu=new Ap((m,w)=>this.zu(m,w),this.config.request_queue_config),this.Hu=new Op(this),this.__request_queue=[];let g=this.yu();g||(this.sessionManager=new ta(this),this.sessionPropsManager=new Qo(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((m,w,P)=>{(P!=null&&P.activityTimeout||P!=null&&P.sessionPastMaximumLength||P!=null&&P.crossTabAdoption)&&this.Uu()})),this.Wu(),this.config.__preview_deferred_init_extensions?(M.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Vu(g)},0)):(M.info("Initializing extensions synchronously"),this.Vu(g)),ue.DEBUG=ue.DEBUG||this.config.debug,ue.DEBUG&&M.info("Starting in debug mode",{this:this,config:i,thisC:f({},this.config),p:v,s:_}),this.config.identity_distinct_id&&!(!((n=i.bootstrap)===null||n===void 0)&&n.distinctID)&&(i.bootstrap=f(f({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));let y=(r=i.bootstrap)===null||r===void 0?void 0:r.distinctID;if(this.wu=!!y&&!yi(y),(o=i.bootstrap)===null||o===void 0?void 0:o.distinctID){let m=i.bootstrap.distinctID,w=this.get_distinct_id(),P=this.persistence.get_property(ke);if(i.bootstrap.isIdentifiedID&&w!=null&&w!==m&&P==="anonymous")this.identify(m);else if(i.bootstrap.isIdentifiedID&&w!=null&&w!==m&&P==="identified")M.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{let x=this.config.get_device_id(He()),k=i.bootstrap.isIdentifiedID?x:m;this.persistence.set_property(ke,i.bootstrap.isIdentifiedID?ss:it),this.register({distinct_id:m,$device_id:k})}}if(g)this.register_once({distinct_id:Js,$device_id:null},"");else if(!this.get_distinct_id()){let m=this.config.get_device_id(He());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(ke,it)}return z(b,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),z(b,"pageshow",()=>{var m;this.Tu=!1,this.Iu||(m=this.Hu)===null||m===void 0||m.resume()}),i.segment?Wo(this,()=>this.Gu()):this.Gu(),le(this.config._onCapture)&&this.config._onCapture!==Mi&&(M.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",m=>this.config._onCapture(m.event,m))),this.config.ip&&M.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.config.disableDeviceModel||(function(){return Zc.apply(this,arguments)})().then(m=>{m&&this.register({[Xs]:m})}).catch(Mi),this}Qu(t){let i=t;return D(i.name)&&le(i.setup)}Zu(t,i){this.Qu(t)?i.push(()=>{this.Ju().add(t).catch(()=>{var s;return(s=t.dispose)===null||s===void 0?void 0:s.call(t)}).catch(s=>{M.error(`Failed to dispose browser extension "${t.name}"`,s)})}):this.lu.push(t)}Wu(){var t,i,s;let n=(t=(i=this.config.__extensionClasses)===null||i===void 0?void 0:i.featureFlags)!==null&&t!==void 0?t:(s=pt.__defaultExtensionClasses)===null||s===void 0?void 0:s.featureFlags;var r,o,a;n&&(this.featureFlags&&this.featureFlags instanceof n||((r=this.Ku)===null||r===void 0||r.call(this),this.Ku=void 0,this.featureFlags=new n(this)),le(this.featureFlags.onReloading)&&le(this.featureFlags.setup)?this.Ku||(this.Ku=this.featureFlags.onReloading(()=>{this.du.emit("featureFlagsReloading",!0)}),this.Ju().add(this.featureFlags)):(o=(a=this.featureFlags).initialize)===null||o===void 0||o.call(a))}Vu(t){let i=performance.now(),s=f(f({},pt.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,a,l,c,u,d,h;s.exceptions&&this.lu.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new s.exceptions(this)),s.historyAutocapture&&this.lu.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.lu.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.lu.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!t&&this.lu.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.Zu(this.autocapture=new s.autocapture(this),n),s.surveys&&this.Zu(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new s.surveys(this),n),s.logs&&this.Zu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new s.logs(this),n),s.metrics&&this.lu.push(this.metrics=(l=this.metrics)!==null&&l!==void 0?l:new s.metrics(this)),s.conversations&&this.lu.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new s.conversations(this)),s.productTours&&this.lu.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.lu.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.lu.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.lu.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.lu.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,dp)),s.toolbar&&this.lu.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new s.toolbar(this)),s.experiments&&this.lu.push(this.experiments=(d=this.experiments)!==null&&d!==void 0?d:new s.experiments(this)),s.webMCP&&this.lu.push(this.webMCP=(h=this.webMCP)!==null&&h!==void 0?h:new s.webMCP(this)),this.lu.forEach(p=>{p.initialize&&n.push(()=>{var v;(v=p.initialize)===null||v===void 0||v.call(p)})}),n.push(()=>{if(this.Xu){let p=this.Xu;this.Xu=void 0,this.lu.forEach(v=>{var _;return(_=v.onRemoteConfig)===null||_===void 0?void 0:_.call(v,p)})}}),this.Yu(n,i)}Yu(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this.Yu(t,i)},0);let n=t.shift();if(n)try{n()}catch(r){M.error("Error initializing extension:",r)}}let s=Math.round(performance.now()-i);this.register_for_session({[Yl]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Xl]:s}),this.config.__preview_deferred_init_extensions&&M.info(`PostHog extensions initialized (${s}ms)`)}el(t){var i;if(!$||!$.body)return M.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.el(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Xu=t),this.hu=t,this.compression=void 0,t.ok){var s;let n=t.config;n.supportedCompression&&!this.config.disable_compression&&(this.compression=A(n.supportedCompression,Fe.GZipJS)?Fe.GZipJS:A(n.supportedCompression,Fe.Base64)?Fe.Base64:void 0),!((s=n.analytics)===null||s===void 0)&&s.endpoint&&(this.analyticsDefaultEndpoint=n.analytics.endpoint)}this.set_config({person_profiles:this.Du?this.Du:nc}),(i=this.tc)===null||i===void 0||i.handleRemoteConfig(t),this.lu.forEach(n=>{var r;return(r=n.onRemoteConfig)===null||r===void 0?void 0:r.call(n,t)})}Gu(){try{this.config.loaded(this)}catch(t){M.critical("`loaded` function failed",t)}if(this.ec(),this.config.internal_or_test_user_hostname&&(K==null?void 0:K.hostname)){let t=K.hostname,i=this.config.internal_or_test_user_hostname;(typeof i=="string"?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.yu())&&this.nc()},1),this.sc=new Fc(this),this.sc.load()}ec(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Bu)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&Wt(this.__request_queue,t=>this.zu(t)),this.__request_queue=[],this.ec()}_handle_unload(){var t,i,s,n,r,o;this.Tu=!0,(t=this.surveys)===null||t===void 0||(i=t.handlePageUnload)===null||i===void 0||i.call(t),(s=this.metrics)===null||s===void 0||s.flush("sendBeacon"),this.config.request_batching?(this.rc()&&this.capture($o),(n=this.logs)===null||n===void 0||n.flushLogs("sendBeacon"),(r=this.Bu)===null||r===void 0||r.unload(),(o=this.Hu)===null||o===void 0||o.unload()):this.rc()&&this.capture($o,null,{transport:"sendBeacon"})}_send_request(t){Gc(this,t)}zu(t,i){this.Hu?this.Hu.retriableRequest(t,i):this._send_request(i?f(f({},t),{},{transport:i}):t)}_execute_array(t){vn++;try{let i,s=[],n=[],r=[];Wt(t,a=>{if(a)if(i=a[0],R(i))r.push(a);else if(le(a))try{a.call(this)}catch(l){M.error("Error executing queued PostHog call",a,l)}else R(a)&&i==="alias"?s.push(a):R(a)&&i.indexOf("capture")!==-1&&le(this[i])?r.push(a):n.push(a)});let o=function(a,l){Wt(a,function(c){try{if(R(c[0])){let u=l;q(c,function(d){u=u[d[0]].apply(u,d.slice(1))})}else l[c[0]].apply(l,c.slice(1))}catch(u){M.error("Error executing queued PostHog call",c,u)}})};o(s,this),o(n,this),o(r,this)}finally{vn--}}push(t){if(vn>0&&R(t)&&D(t[0])){let i=pt.prototype[t[0]];return void(le(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}get oc(){return{property:So,persistenceKey:Gt,cookieName:"_fbc",pattern:aa,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[Gt]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Gt)}}}get ac(){return{property:Eo,persistenceKey:xi,cookieName:"_fbp",pattern:la,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[xi]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(xi)}}}lc(t){var i;let s=(i=this.persistence)===null||i===void 0?void 0:i.get_property(t.persistenceKey);return D(s)&&t.pattern.test(s)?{value:s,delivered:!1}:L(s)&&D(s.value)&&t.pattern.test(s.value)?{value:s.value,delivered:s.delivered===!0}:void 0}uc(t,i,s){return i===(s==null?void 0:s.value)?{value:i,pending:!s.delivered}:(t.register(i,!1),{value:i,pending:!0})}cc(t){if(!this.config.save_campaign_params||this.yu())return;let i=Si(t.cookieName);return D(i)&&t.pattern.test(i)?i:void 0}hc(t,i,s,n){if(!this.persistence)return;let r=this.oc;this.persistence.refreshKey(r.persistenceKey);let o=this.lc(r);if(n)return void r.unregister();if(s)return D(i)&&aa.test(i)?this.uc(r,i,o):void r.unregister();let a=D(t)&&Kp.test(t)?t:void 0,l=this.cc(r);return l&&((c,u,d)=>{let h=c.split(".");if(u)return h[3]===u;if(!d)return!0;let p=d.value.split(".");return h[3]===p[3]||Number(h[2])>Number(p[2])})(l,a,o)?this.uc(r,l,o):a?(o==null?void 0:o.value.split(".")[3])===a?{value:o.value,pending:!o.delivered}:this.uc(r,`fb.1.${Date.now()}.${a}`,o):o?{value:o.value,pending:!o.delivered}:void 0}dc(t,i,s){if(!this.persistence)return;let n=this.ac;this.persistence.refreshKey(n.persistenceKey);let r=this.lc(n);if(s)return void n.unregister();if(i)return D(t)&&la.test(t)?this.uc(n,t,r):void n.unregister();let o=this.cc(n);return o?this.uc(n,o,r):r?{value:r.value,pending:!r.delivered}:void 0}vc(t,i){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);let s=this.lc(t);(s==null?void 0:s.value)!==i||s.delivered||t.register(i,!0)}capture(t,i,s){var n,r;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Bu))return void M.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(S(t)||!D(t))return void M.error("No event name provided to posthog.capture");if(this.ku(),t==="$snapshot"&&this.yu())return;let o=!this.config.opt_out_useragent_filter&&this._is_bot();if(o&&!this.config.__preview_capture_bot_pageviews)return;let a=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a!=null&&a.isRateLimited)return void M.critical("This capture call is ignored due to client rate limiting.");let l;i!=null&&i.$current_url&&!D(i==null?void 0:i.$current_url)&&(M.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),i==null||delete i.$current_url),t!=="$exception"||s!=null&&s.fc||M.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&&(l=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();let c=new Date,u=(s==null?void 0:s.timestamp)||c,d=ro(s==null?void 0:s.uuid,He),h={uuid:d,event:t,properties:this.calculateEventProperties(t,i||{},u,d)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&o&&(h.event="$bot_pageview",h.properties.$browser_type="bot"),a&&(h.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);let p=t==="$feature_flag_called"&&h.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;s!=null&&s.$set&&!p&&(h.$set=s==null?void 0:s.$set);let v=L(i==null?void 0:i.$set)?i.$set:void 0,_=R(i==null?void 0:i.$unset)?i.$unset:[],g=(s==null?void 0:s.$unset)||[],y=C=>{var V;let j=!!(s!=null&&s.$set)&&C in s.$set;return{hasProvided:j||!!v&&C in v,provided:j?s==null||(V=s.$set)===null||V===void 0?void 0:V[C]:v==null?void 0:v[C],unset:_.indexOf(C)!==-1||g.indexOf(C)!==-1}},m=y(So),w=y(Eo),P=[{channel:this.oc,hasProvided:m.hasProvided,update:this.hc(l==null?void 0:l.fbclid,m.provided,m.hasProvided,m.unset)},{channel:this.ac,hasProvided:w.hasProvided,update:this.dc(w.provided,w.hasProvided,w.unset)}];for(let{channel:C,hasProvided:V,update:j}of P)j&&h.properties.$process_person_profile===!0&&j.pending&&!V&&!p&&(h.$set=f({[C.property]:j.value},h.$set));let x=s==null?void 0:s.$unset;x&&(h.$unset=x);let k=p?void 0:this.gc(s==null?void 0:s.$set_once,t!==Po,t===rc);if(k&&(h.$set_once=k),s!=null&&s._noTruncate||(T=this.config.properties_string_max_length,h=(function(C,V){let j=new Set;return(function Z(U,ie){if(U!==Object(U))return V?V(U):U;if(j.has(U))return;let ge;if(j.add(U),R(U))ge=[],Wt(U,de=>{ge.push(Z(de))});else{let de={};q(ii(U)?oc(U):U,(me,Te)=>{j.has(me)||(de[Te]=Z(me,Te))}),ge=de}return ge})(C)})(h,C=>D(C)?C.slice(0,T):C)),h.timestamp=u,S(s==null?void 0:s.timestamp)||(h.properties.$event_time_override_provided=!0,h.properties.$event_time_override_system_time=c),p&&(h.properties=((C,V=[])=>{let j={},Z=U=>{C[U]!==void 0&&(j[U]=C[U])};return Bd.forEach(Z),V.forEach(Z),j})(h.properties,Qp)),t===Ie.DISMISSED||t===Ie.SENT){let C=i==null?void 0:i[cn.SURVEY_ID],V=i==null?void 0:i[cn.SURVEY_ITERATION];Kc({id:C,current_iteration:V}),h.$set=f(f({},h.$set),{},{[Np({id:C,current_iteration:V},t===Ie.SENT?"responded":"dismissed")]:!0})}else t===Ie.SHOWN&&(h.$set=f(f({},h.$set),{},{[cn.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var T;if(t===wp.SHOWN){let C=i==null?void 0:i[qo.TOUR_TYPE];C&&(h.$set=f(f({},h.$set),{},{[`${qo.TOUR_LAST_SEEN_DATE}/${C}`]:new Date().toISOString()}))}let E=f(f({},h.properties.$set),h.$set);if(Me(E)||this.setPersonPropertiesForFlags(E),!O(this.config.before_send)){let C=this.Os(h);if(!C)return;h=C,h.uuid=ro(h.uuid,He)}this.sessionRecording&&!this.Au&&oa(t)&&(this.Au=!0,setTimeout(()=>this.Au=!1,3e4));let I=P.filter(({channel:C,update:V})=>{var j,Z,U;let ie=(j=(Z=h.$set)===null||Z===void 0?void 0:Z[C.property])!==null&&j!==void 0?j:L((U=h.properties)===null||U===void 0?void 0:U.$set)?h.properties.$set[C.property]:void 0;return(V==null?void 0:V.pending)&&ie===V.value});this.du.emit("eventCaptured",h);let N=(n=s==null?void 0:s._url)!==null&&n!==void 0?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),B=(s==null?void 0:s._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(N),W=f(f(f({method:"POST",url:N,data:h,compression:"best-available",preferSyncCompression:s==null?void 0:s.send_instantly,timestampMode:B?"body":"capture-body",batchKey:s==null?void 0:s._batchKey},B&&(!((r=h.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:h.properties.$session_id+(h.properties.$window_id?`-${h.properties.$window_id}`:"")}:{}),s!=null&&s.transport?{transport:s.transport}:{}),I.length?{fireCallbackOnDrop:!0,callback:C=>{if(C.statusCode>=200&&300>C.statusCode)for(let{channel:V,update:j}of I)this.vc(V,j.value)}}:{});if(!this.config.request_batching||s&&!(s!=null&&s._batchKey)||s!=null&&s.send_instantly){var Y;let C;!W.transport&&!W.callback&&Me((Y=this.config.request_headers)!==null&&Y!==void 0?Y:{})&&this.Tu&&(C="sendBeacon"),this.zu(W,C)}else this.Bu.enqueue(W);return h}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return(i=this.tc)===null||i===void 0?void 0:i.getExtension(t)}Ju(){var t;return(t=this.tc)!==null&&t!==void 0?t:this.tc=new Yp(this)}fu(t){this.Ru.push(t);let i=!0;return()=>{if(!i)return;i=!1;let s=this.Ru.indexOf(t);s!==-1&&this.Ru.splice(s,1)}}mc(t=!0){var i,s,n;return!!(!((i=this.persistence)===null||i===void 0)&&i.consumeCookieIdentityChange())&&(this.Lu=null,this.persistence.get_property("$user_state")==="anonymous"&&((n=this.sessionPersistence)===null||n===void 0||n.clear(),this.Eu.clear(),this.yc()),(s=this.featureFlags)===null||s===void 0||s.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,s,n,r){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return i;this.ku(),this.persistence.syncCookieProperties(),this.mc();let o=r?void 0:this.persistence.remove_event_timer(t),a=f({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.yu()&&(a[Zl]=!0),t==="$snapshot"){let m=f(f({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=m.distinct_id,(!D(a.distinct_id)&&!oe(a.distinct_id)||yi(a.distinct_id))&&M.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}let l=(function(m,w,P,x=!1){var k,T,E,I;if(!xe)return{};let N=m?[...Qt,...w||[]]:[],[B,W]=ul(xe),[Y,C]=(function(he){for(let Re=0;no.length>Re;Re++){let[ot,at,wt]=no[Re],Pe=he.match(ot);if(Pe){let ze=wt&&he.match(wt)||Pe;return[at,(ze==null?void 0:ze[1])||""]}}return["",""]})(xe),V=(function(){let he="u">typeof navigator?navigator:void 0;return he!=null&&he.brave?{brave:!0}:{}})(),j={};S(P)||(j.detectGoogleSearchApp=P);let Z={},U=(k=navigator)===null||k===void 0||(k=k.userAgentData)===null||k===void 0?void 0:k.platform,ie=(T=navigator)===null||T===void 0?void 0:T.maxTouchPoints,ge=b==null||(E=b.screen)===null||E===void 0?void 0:E.width,de=b==null||(I=b.screen)===null||I===void 0?void 0:I.height,me=b==null?void 0:b.devicePixelRatio;S(U)||(Z.userAgentDataPlatform=U),S(ie)||(Z.maxTouchPoints=ie),S(ge)||(Z.screenWidth=ge),S(de)||(Z.screenHeight=de),S(me)||(Z.devicePixelRatio=me);let Te=Q(mr({$os:B,$os_version:W,$browser:cl(xe,navigator.vendor,V,j),$webview_app:Y,$webview_app_version:C,$device:dl(xe),$device_type:ud(xe,Z),$timezone:yc(),$timezone_offset:mp()}),{$current_url:Oi(x?yt(K==null?void 0:K.href):K==null?void 0:K.href,N,Li),$host:K==null?void 0:K.host,$pathname:K==null?void 0:K.pathname,$raw_user_agent:xe.length>1e3?xe.substring(0,997)+"...":xe,$browser_version:cd(xe,navigator.vendor,V,j),$browser_language:$c(),$browser_language_prefix:_p(),$screen_height:b==null?void 0:b.screen.height,$screen_width:b==null?void 0:b.screen.width,$viewport_height:b==null?void 0:b.innerHeight,$viewport_width:b==null?void 0:b.innerWidth,$lib:st.LIB_NAME,$lib_version:st.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return st.SDK_DIST_CHANNEL&&(Te.$sdk_dist_channel=st.SDK_DIST_CHANNEL),Te})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){let{sessionId:m,windowId:w}=this.sessionManager.checkAndGetSessionAndWindowId(r,s.getTime(),!0);a.$session_id=m,a.$window_id=w}this.sessionPropsManager&&Q(a,this.sessionPropsManager.getSessionProps());try{var c;if(this.sessionRecording){let m=this.sessionRecording.sdkDebugProperties,w=!this.Au&&oa(t);for(let P in m)(w||A(Xp,P))&&(a[P]=m[P])}a.$sdk_debug_retry_queue_size=(c=this.Hu)===null||c===void 0?void 0:c.length}catch(m){a.$sdk_debug_error_capturing_properties=String(m)}let u;if(this.requestRouter.region===er&&(a.$lib_custom_api_host=this.config.api_host),u=t!=="$pageview"||r?t!=="$pageleave"||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,n),a=Q(a,u),t==="$pageview"&&$&&(a.title=$.title),!S(o)){let m=s.getTime()-o;a.$duration=parseFloat((m/1e3).toFixed(3))}xe&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");let d=this.persistence.properties(),h=this.sessionPersistence.properties(),p=a.$groups,v=d.$groups;L(p)&&!Me(p)&&(a.$groups=f(f({},L(v)?v:{}),p)),q(["$referrer","$referring_domain"],m=>{m in d&&delete h[m]});let _={};if(this.Ru.length>0)for(let m of this.Ru.slice())try{Q(_,m())}catch(w){M.error("Failed to produce browser extension event properties",w)}a=Q({},l,d,h,f(f({},_),a)),a.$is_identified=this._isIdentified(),R(this.config.property_denylist)?q(this.config.property_denylist,function(m){delete a[m]}):M.error(Qc+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);let g=this.config.sanitize_properties;g&&(M.error(ra),a=g(a,t));let y=this.bc();return a.$process_person_profile=y,y&&!r&&this._c("_calculate_event_properties"),a}gc(t,i=!0,s=!1){var n;if(!this.persistence||!this.bc()||this.Mu&&!s)return t;let r=this.persistence.get_initial_props(),o=(n=this.sessionPropsManager)===null||n===void 0?void 0:n.getSetOnceProps(),a=Q({},r,o||{},t||{}),l=this.config.sanitize_properties;return l&&(M.error(ra),a=l(a,"$set_once")),i&&(this.Mu=!0),Me(a)?void 0:a}register(t,i){var s;(s=this.persistence)===null||s===void 0||s.register(t,i)}register_once(t,i,s){var n;(n=this.persistence)===null||n===void 0||n.register_once(t,i,s)}register_for_session(t){var i,s;(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this.mc(),(s=this.sessionPersistence)===null||s===void 0||s.register(t),Object.keys(t).forEach(n=>this.Eu.add(n)),this.yc()}unregister(t){var i;(i=this.persistence)===null||i===void 0||i.unregister(t)}unregister_for_session(t){var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t),this.Eu.delete(t),this.yc()}wc(t,i){this.register({[t]:i})}Uu(){this.Eu.forEach(t=>{var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t)}),this.Eu.clear(),this.yc()}yc(){var t;if(!this.Pu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.hi||!J.At())return void J.Pt(this.Pu);let i=[];this.Eu.forEach(s=>i.push(s)),i.length>0?J.$t(this.Pu,i):J.Pt(this.Pu)}getFeatureFlag(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,i){var s,n;return(s=(n=this.featureFlags)===null||n===void 0?void 0:n.isFeatureEnabled(t,i))!==null&&s!==void 0?s:i==null?void 0:i.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,i,s){var n;(n=this.featureFlags)===null||n===void 0||n.updateFlags(t,i,s)}updateEarlyAccessFeatureEnrollment(t,i,s){var n;(n=this.featureFlags)===null||n===void 0||n.updateEarlyAccessFeatureEnrollment(t,i,s)}getEarlyAccessFeatures(t,i=!1,s){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getEarlyAccessFeatures(t,i,s)}on(t,i){return this.du.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Nt}),()=>{})}onSessionId(t){var i,s;return(i=(s=this.sessionManager)===null||s===void 0?void 0:s.onSessionId(t))!==null&&i!==void 0?i:()=>{}}getSurveys(t,i=!1){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Nt})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Nt})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:Nt}),()=>{})}renderSurvey(t,i){var s;(s=this.surveys)===null||s===void 0||s.renderSurvey(t,i)}displaySurvey(t,i=Wp){var s;(s=this.surveys)===null||s===void 0||s.displaySurvey(t,i)}cancelPendingSurvey(t){var i;(i=this.surveys)===null||i===void 0||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,s;return(i=(s=this.surveys)===null||s===void 0?void 0:s.canRenderSurvey(t))!==null&&i!==void 0?i:{visible:!1,disabledReason:Nt}}canRenderSurveyAsync(t,i=!1){var s,n;return(s=(n=this.surveys)===null||n===void 0?void 0:n.canRenderSurveyAsync(t,i))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Nt})}kc(t){return!t||yi(t)?(M.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(M.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(M.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,i,s){if(!this.__loaded||!this.persistence)return M.uninitializedWarning("posthog.identify");if(oe(t)&&(t=t.toString(),M.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.kc(t)||!this._c("posthog.identify"))return;this.ku();let n=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,o=this.mc(!1),a=this.persistence.Oa(),l=!1;try{let u=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),t!==u&&t!==this.get_property("__alias")&&(this.unregister(gs),this.register({distinct_id:t}));let d=(this.persistence.get_property("$user_state")||"anonymous")===it,h=t!==u,p=!h&&d;if(h&&d){var c;let v=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:u};this.persistence.set_property(ke,ss),this.setPersonPropertiesForFlags({$set:i||{},$set_once:s||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",v,{$set:i||{},$set_once:s||{}})&&(this.Lu=fn(t,i,s)),(c=this.featureFlags)===null||c===void 0||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:u)}else if(p){this.persistence.set_property(ke,ss);let v=i||{},_=s||{};this.setPersonPropertiesForFlags({$set:v,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:v,$set_once:_})&&(this.Lu=fn(t,i,s))}else(i||s)&&this.setPersonProperties(i,s);h||r||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(gt)):p&&(i||s)&&this.reloadFeatureFlags(),l=!0}finally{a&&this.persistence.qa(l)}}setPersonProperties(t,i){if(!t&&!i||!this._c("posthog.setPersonProperties"))return;let s=fn(this.get_distinct_id(),t,i);this.Lu!==s?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this.Lu=s)):M.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;let s=(R(t)?t:[t]).filter(n=>D(n)&&n.length>0);s.length!==0&&this._c("posthog.unsetPersonProperties")&&((i=this.featureFlags)===null||i===void 0||i.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.Lu=null)}group(t,i,s){var n;if(!t||!i)return void M.error("posthog.group requires a group type and group key");(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.mc();let r=this.getGroups(),o=r[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:f(f({},r),{},{[t]:i})}),(o||s)&&this.bc()){let a={$group_type:t,$group_key:i};s&&(a.$group_set=s),this.capture(Po,a)}s&&this.setGroupPropertiesForFlags({[t]:s}),o&&!s&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i=!0){var s;(s=this.featureFlags)===null||s===void 0||s.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t=!0){var i;(i=this.featureFlags)===null||i===void 0||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i=!0){var s;this._c("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)===null||s===void 0||s.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;(i=this.featureFlags)===null||i===void 0||i.resetGroupPropertiesForFlags(t)}reset(t){let i=Se(t)?t:t==null?void 0:t.resetDeviceID,s=Se(t)||t==null?void 0:t.bootstrap;this.Sc(i,!1,s)}Sc(t,i=!1,s){var n,r,o,a,l,c;if(M.info("reset"),!this.__loaded)return M.uninitializedWarning("posthog.reset");let u=s==null?void 0:s.sessionID;this.config.bootstrap=s||((n=this.qu)===null||n===void 0?void 0:n.bootstrap)||{},(r=this.featureFlags)===null||r===void 0||(o=r.updateConfig)===null||o===void 0||o.call(r,this.config,this.il());let d=this.get_property(ur),h=this.get_property(Xs),p=this.get_property(ki);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();let v=this.is_capturing();i||this.consent.reset(),i||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");let _=(l=this.persistence)===null||l===void 0||(c=l.Oa)===null||c===void 0?void 0:c.call(l),g=this.Su;this.Su=g||i;let y=!1;try{var m,w,P,x,k,T,E,I,N,B,W,Y,C;if((m=this.persistence)===null||m===void 0||m.clear(),(w=this.sessionPersistence)===null||w===void 0||w.clear(),this.Eu.clear(),this.yc(),S(p)||(B=this.persistence)===null||B===void 0||B.register({$session_recording_remote_config:p}),(P=this.surveys)===null||P===void 0||P.reset(),(x=this.featureFlags)===null||x===void 0||x.reset(),(k=this.conversations)===null||k===void 0||k.reset(),(T=this.logs)===null||T===void 0||T.reset(),(E=this.metrics)===null||E===void 0||E.reset(),(I=this.persistence)===null||I===void 0||I.set_property("$user_state","anonymous"),(N=this.sessionManager)===null||N===void 0||N.resetSessionId(),this.Lu=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Js,$device_id:null},"");else{let Z=this.config.get_device_id(He());this.register_once({distinct_id:Z,$device_id:t?Z:d},""),t||S(h)||this.register({[Xs]:h})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),s&&(s.distinctID&&!this.yu()&&((C=this.persistence)===null||C===void 0||C.set_property("$user_state",s.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.distinctID})),(W=this.featureFlags)===null||W===void 0||W.initialize(),!O(u)&&!(!((Y=this.sessionManager)===null||Y===void 0)&&Y.setBootstrapSessionId(u,!0)))){let Z=f({},s);delete Z.sessionID,this.config.bootstrap=Z}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,y=!0}finally{var V,j;this.Su=g,_&&((V=this.persistence)===null||V===void 0||(j=V.qa)===null||j===void 0||j.call(V,y))}this.reloadFeatureFlags()}shutdown(t){var i=this;return ee(function*(){var s,n,r,o,a,l,c,u;if(i.__loaded){i.Iu=!0,i.Ju().dispose(),(s=i.sessionRecording)===null||s===void 0||s.dispose(),(n=i.logs)===null||n===void 0||n.flushLogs("sendBeacon"),(r=i.metrics)===null||r===void 0||r.flush("sendBeacon"),(o=i.metrics)===null||o===void 0||o.dispose(),(a=i.Bu)===null||a===void 0||a.unload(),(l=i.Hu)===null||l===void 0||l.unload();try{var d;(d=i.featureFlags)===null||d===void 0||d.destroy()}catch(h){M.error("Error while destroying feature flags",h)}(c=i.persistence)===null||c===void 0||c.destroy(),(u=i.sessionPersistence)===null||u===void 0||u.destroy()}else M.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,i){var s;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),(s=this.conversations)===null||s===void 0||s.xc()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t.$c()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return(t=(i=this.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";let{sessionId:i,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if(t!=null&&t.withTimestamp&&s){var r;let o=(r=t.timestampLookBack)!==null&&r!==void 0?r:10;if(!s)return n;n+=`?t=${Math.max(Math.floor((new Date().getTime()-s)/1e3)-o,0)}`}return n}alias(t,i){return t===this.get_property("$people_distinct_id")?(M.critical("Attempting to create alias for existing People user - aborting."),-2):this._c("posthog.alias")?(S(i)&&(i=this.get_distinct_id()),t!==i?(this.wc(gs,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(M.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){let i=f({},this.config);if(L(t)){var s,n,r,o,a,l,c,u,d,h,p,v,_,g;Q(this.config,ca(t));let x=this.Cu();if(this.persistence){let T=this.config.persistence==="sessionStorage"||this.config.persistence==="memory";var y,m;if(T&&this.sessionPersistence!==this.persistence&&((y=this.sessionPersistence)===null||y===void 0||y.remove(),(m=this.sessionPersistence)===null||m===void 0||m.destroy()),this.persistence.update_config(this.config,i,x),T)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new an(f(f({},this.config),{},{persistence:"sessionStorage"}),x,!1);else{var w;(w=this.sessionPersistence)===null||w===void 0||w.update_config(f(f({},this.config),{},{persistence:"sessionStorage"}),f(f({},i),{},{persistence:"sessionStorage"}),x)}}let k=this.Nu(this.config.debug);var P;Se(k)&&(this.config.debug=k),Se(this.config.debug)&&(this.config.debug?(ue.DEBUG=!0,H.At()&&H.$t("ph_debug",!0),M.info("set_config",{config:t,oldConfig:i,newConfig:f({},this.config)})):(ue.DEBUG=!1,H.At()&&H.Pt("ph_debug"))),(s=this.featureFlags)===null||s===void 0||(n=s.updateConfig)===null||n===void 0||n.call(s,this.config,this.il()),(r=this.exceptionObserver)===null||r===void 0||r.onConfigChange(),(o=this.exceptions)===null||o===void 0||o.onConfigChange(),(a=this.metrics)===null||a===void 0||a.onConfigChange(),(l=this.webMCP)===null||l===void 0||l.startIfEnabled(),(c=this.sessionRecording)===null||c===void 0||c.startIfEnabledOrStop(),(u=this.tracingHeaders)===null||u===void 0||u.startIfEnabledOrStop(),(d=this.autocapture)===null||d===void 0||d.startIfEnabled(),(h=this.heatmaps)===null||h===void 0||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((P=this.historyAutocapture)===null||P===void 0||P.startIfEnabledOrStop()),(p=this.exceptionObserver)===null||p===void 0||p.startIfEnabledOrStop(),(v=this.deadClicksAutocapture)===null||v===void 0||v.startIfEnabledOrStop(),(_=this.surveys)===null||_===void 0||_.loadIfEnabled(),this.xu(),(g=this.externalIntegrations)===null||g===void 0||g.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&Wo(this,Mi,!1)}}_overrideSDKInfo(t,i){ue.LIB_NAME=t,ue.LIB_VERSION=i}startSessionRecording(t){let i=t===!0,s={sampling:i||!!(t!=null&&t.sampling),linked_flag:i||!!(t!=null&&t.linked_flag),url_trigger:i||!!(t!=null&&t.url_trigger),event_trigger:i||!!(t!=null&&t.event_trigger)};var n,r,o,a,l;Object.values(s).some(Boolean)&&((n=this.sessionManager)===null||n===void 0||n.checkAndGetSessionAndWindowId(),s.sampling&&((r=this.sessionRecording)===null||r===void 0||r.overrideSampling()),s.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),s.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),s.event_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(!((t=this.sessionRecording)===null||t===void 0)&&t.started)}captureException(t,i){try{if(!this.exceptions)return;let s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(f(f({},s),i))}catch{return}}addExceptionStep(t,i){var s;(s=this.exceptions)===null||s===void 0||s.addExceptionStep(t,i)}captureLog(t){var i;(i=this.logs)===null||i===void 0||i.captureLog(t)}get logger(){var t,i;return(t=(i=this.logs)===null||i===void 0?void 0:i.logger)!==null&&t!==void 0?t:pt.Cc}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,s;return(i=(s=this.toolbar)===null||s===void 0?void 0:s.loadToolbar(t))!==null&&i!==void 0&&i}get_property(t){var i;return(i=this.persistence)===null||i===void 0?void 0:i.props[t]}getSessionProperty(t){var i;return(i=this.sessionPersistence)===null||i===void 0?void 0:i.props[t]}toString(){var t;let i=(t=this.config.name)!==null&&t!==void 0?t:mi;return i!==mi&&(i="posthog."+i),i}_isIdentified(){var t,i;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((i=this.sessionPersistence)===null||i===void 0?void 0:i.get_property("$user_state"))==="identified"}bc(){var t,i;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Me(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((i=this.persistence)===null||i===void 0||(i=i.props)===null||i===void 0)&&i.$epp))}rc(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.bc()||this._c("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._c("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_c(t){return this.config.person_profiles==="never"?(M.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.bu(),this.wc(pr,!0),!0)}Cu(){if(this.config.cookieless_mode==="always")return!0;let t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}xu(){var t,i;let s=this.Cu();var n,r,o;return this.is_capturing()||(n=this.logs)===null||n===void 0||n.Tc(),((t=this.persistence)===null||t===void 0?void 0:t.hi)!==s&&((r=this.persistence)===null||r===void 0||r.set_disabled(s)),((i=this.sessionPersistence)===null||i===void 0?void 0:i.hi)!==s&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(s)),this.yc(),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!=="always"){if(this.yu()){var s,n,r,o,a,l;(s=this.sessionRecording)===null||s===void 0||s.dispose({discardBufferedEvents:!0}),this.Sc(!0,!0),(n=this.sessionManager)===null||n===void 0||n.destroy(),(r=this.pageViewManager)===null||r===void 0||r.destroy(),this.sessionManager=new ta(this),this.pageViewManager=new Uo(this),this.persistence&&(this.sessionPropsManager=new Qo(this,this.sessionManager,this.persistence));let p=(o=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&o!==void 0?o:(l=pt.__defaultExtensionClasses)===null||l===void 0?void 0:l.sessionRecording;var c,u;p&&(this.sessionRecording=this.mu(this.sessionRecording,new p(this)),this.hu&&((c=this.sessionRecording)===null||c===void 0||(u=c.onRemoteConfig)===null||u===void 0||u.call(c,this.hu)))}var d,h;this.consent.optInOut(!0),this.xu(),this.ec(),(i=this.sessionRecording)===null||i===void 0||i.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((d=this.surveys)===null||d===void 0||d.loadIfEnabled()),(S(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((h=t==null?void 0:t.captureEventName)!==null&&h!==void 0?h:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.nc()}else M.warn(na)}opt_out_capturing(){this.config.cookieless_mode!=="always"?(this.consent.optInOut(!1),this.xu(),this.config.cookieless_mode==="on_reject"&&this.$u()):M.warn(na)}$u(){var t,i;let s=this.sessionRecording;s==null||s.dispose({discardBufferedEvents:!0}),this.get_distinct_id()!=="$posthog_cookieless"&&this.Sc(!0,!0),this.register({distinct_id:Js,$device_id:null}),this.gu(s),this.sessionRecording=void 0,(t=this.sessionManager)===null||t===void 0||t.destroy(),(i=this.pageViewManager)===null||i===void 0||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.nc(),this.ec()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){let t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return!this.Su&&(this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this.xu()}_is_bot(){return pe?qc(pe,this.config.custom_blocked_useragents):void 0}nc(){$&&($.visibilityState==="visible"?this.Fu||(this.Fu=!0,this.capture(_r,{title:$.title},{send_instantly:!0}),this.Ou&&($.removeEventListener(Ai,this.Ou),this.Ou=null)):this.Ou||(this.Ou=this.nc.bind(this),z($,Ai,this.Ou)))}debug(t){t===!1?(b==null||b.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(b==null||b.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}))}il(){let t=this.qu||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(M.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):(function(i,s,n,r,o){let a=s in i&&!O(i[s]),l=n in i&&!O(i[n]);return a?i[s]:!!l&&(o&&o.warn(`Config field '${n}' is deprecated. Please use '${s}' instead. The old field will be removed in a future major version.`),i[n])})(t,"advanced_disable_flags","advanced_disable_decide",0,M)}Os(t){var i;if(O(this.config.before_send))return t;let s=Object.keys((i=t.properties)!==null&&i!==void 0?i:{}).filter(Ku),n=R(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(let o of n)try{if(r=o(r),O(r)){let a=`Event '${t.event}' was rejected in beforeSend function`;return Ju(t.event)?M.warn(`${a}. This can cause unexpected behavior.`):M.info(a),null}r.properties&&!Me(r.properties)||M.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return M.error(`Error in beforeSend function for event '${t.event}':`,a),null}for(let o of s)if(r.properties&&O(r.properties[o]))return M.warn(`Event '${t.event}' had its '${o}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){var t;return(t=this.pageViewManager.Wo)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(s)})}Nu(t){let i=Se(t)&&!t,s=H.At()&&H.Ot("ph_debug")==="true";return!i&&(!!s||t)}};Ti.__defaultExtensionClasses={},Ti.Cc=(()=>{let e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=Gh(e.prototype[t[i]])})(Ti,["identify"]);var eu=class{constructor(e){this.disabled=e===!1;let t=L(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;let s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){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}},_n="$copy_autocapture",mn=re("[AutoCapture]");function yn(e,t){return t.length>e?t.slice(0,e)+"...":t}function nf(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Be(t));return t}function rf(e,{e:t,maskAllElementAttributes:i,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:r,disableCaptureUrlHashes:o}){var a,l;if(!Be(e))return{props:{}};let c=[e],u=new Set([e]),d=e;for(;d.parentNode&&!_e(d,"body")&&1e3>c.length;){if(yr(d.parentNode)){let k=d.parentNode.host;if(u.has(k))break;u.add(k),c.push(k),d=k;continue}if(!Be(d.parentNode)||u.has(d.parentNode))break;u.add(d.parentNode),c.push(d.parentNode),d=d.parentNode}let h=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?c.findIndex(k=>_e(k,"button")||_e(k,"a")):-1;h>0&&(s=s||c.slice(0,h+1).some(k=>!Ct(k)||Jt(k)));let p=[],v={},_,g=!1,y=!1;if(q(c,k=>{let T=Ct(k);if(_e(k,"a")&&!i&&!(n!=null&&n.includes("href"))){let E=k.getAttribute("href");g=!!(T&&E&&qt(E))&&(o?yt(E):E)}A(Xt(k),"ph-no-capture")&&(y=!0),p.push((function(E,I,N,B,W=!1){let Y=E.tagName.toLowerCase(),C={tag_name:Y};wr.indexOf(Y)>-1&&!N&&(C.$el_text=Y.toLowerCase()==="a"||Y.toLowerCase()==="button"?yn(1024,Vo(E)):yn(1024,Ri(E)));let V=Xt(E);I||B!=null&&B.includes("class")||0>=V.length||(C.classes=V.filter(function(ie){return ie!==""})),q(E.attributes,function(ie){var ge;if((!Jt(E)||["name","id","class","aria-label"].indexOf(ie.name)!==-1)&&!(B!=null&&B.includes(ie.name))&&!I&&qt(ie.value)&&(!D(ge=ie.name)||ge.substring(0,10)!=="_ngcontent"&&ge.substring(0,7)!=="_nghost")){let de=ie.value;ie.name==="class"&&(de=br(de).join(" ")),C["attr__"+ie.name]=yn(1024,ie.name==="href"&&W?yt(de):de)}});let j=1,Z=1,U=E;for(;U=nf(U);)j++,U.tagName===E.tagName&&Z++;return C.nth_child=j,C.nth_of_type=Z,C})(k,i,s,n,o)),q((function(E){if(!Ct(E))return{};let I={};return q(E.attributes,function(N){if(N.name&&N.name.indexOf("data-ph-capture-attribute")===0){let B=N.name.replace("data-ph-capture-attribute-",""),W=N.value;B&&W&&qt(W)&&(I[B]=W)}}),I})(k),(E,I)=>{({}).hasOwnProperty.call(v,I)||(v[I]=E)})}),y)return{props:{},explicitNoCapture:y};if(h>0&&(e=c[h],p.splice(0,h)),s||(p[0].$el_text=_e(e,"a")||_e(e,"button")?Vo(e):Ri(e)),g){var m,w;p[0].attr__href=g;let k=(m=nt(g))===null||m===void 0?void 0:m.host,T=b==null||(w=b.location)===null||w===void 0?void 0:w.host;k&&T&&k!==T&&(_=g)}return{props:Q((x=t.type,{$event_type:x,$ce_version:1}),r?{}:{$elements:p},{$elements_chain:(P=p,R(P)?(function(k){return k.map(T=>{var E,I;let N="";if(T.tag_name&&(N+=T.tag_name),T.attr_class){T.attr_class.sort();for(let Y of T.attr_class)N+=`.${Y.replace(/"/g,"")}`}let B=f(f(f(f({},T.text?{text:T.text}:{}),{},{"nth-child":(E=T.nth_child)!==null&&E!==void 0?E:0,"nth-of-type":(I=T.nth_of_type)!==null&&I!==void 0?I:0},T.href?{href:T.href}:{}),T.attr_id?{attr_id:T.attr_id}:{}),T.attributes),W={};return ns(B).sort(([Y],[C])=>(function(V,j){return j>V?-1:V>j?1:0})(Y,C)).forEach(([Y,C])=>W[Ho(Y.toString())]=Ho(C.toString())),N+=":",N+=ns(W).map(([Y,C])=>`${Y}="${C}"`).join(""),N}).join(";")})((function(k){return k.map(T=>{var E,I;let N={text:(E=T.$el_text)===null||E===void 0?void 0:E.slice(0,400),tag_name:T.tag_name,href:(I=T.attr__href)===null||I===void 0?void 0:I.slice(0,2048),attr_class:cp(T),attr_id:T.attr__id,nth_child:T.nth_child,nth_of_type:T.nth_of_type,attributes:{}};return ns(T).filter(([B])=>B.indexOf("attr__")===0).forEach(([B,W])=>N.attributes[B]=W),N})})(P)):"")},!((a=p[0])===null||a===void 0)&&a.$el_text?{$el_text:(l=p[0])===null||l===void 0?void 0:l.$el_text}:{},_&&t.type==="click"?{$external_click_url:_}:{},v),target:e};var P,x}var of=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(e){var t;if(!Ct(e))return!0;let i=(t=this.mo().css_selector_ignorelist)!==null&&t!==void 0?t:nn,s=new Set,n=e;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);let r=n,o=Xt(r);if(A(o,"ph-no-capture")||A(o,"ph-sensitive")||Jt(r)||i.some(l=>qn(r,l)))return!0;let a=n.parentNode;n=yr(a)?a.host:a&&Be(a)?a:null}return!1}yo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.do();if(e.type==="pointerdown"){this.do();let s=Ei(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&s&&Be(s)&&(this.vo={target:s,excluded:this.po(s),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.bo)===null||t===void 0?void 0:t.distinctId}))}let i=this.vo;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this.do():e.type==="pointerup"&&(i.released=!0,this.fo=setTimeout(()=>this.do(),0)))}_o(e){var t;let i=this.vo;this.do();let s=Ei(e);if(i!=null&&i.released&&i.target.isConnected&&i.distinctId===((t=this.bo)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&s&&(_e(s,"html")||_e(s,"body"))){var n;if(i.excluded)return null;let r=(n=this.mo().css_selector_ignorelist)!==null&&n!==void 0?n:nn;return[s,$==null?void 0:$.documentElement,$==null?void 0:$.body].some(o=>{if(!o)return!1;let a=Xt(o);return A(a,"ph-no-capture")||A(a,"ph-sensitive")||!Ct(o)||Jt(o)||r.some(l=>qn(o,l))})?null:i.target}}constructor(e){this.wo=e,this.name="autocapture",this.ko=!1,this.So=null,this.xo=!1,this.$o=new Map,this.Co=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.To=!1,this.wo.refresh(this.Mr),this.rageclicks=new eu(this.Mr.rageclick),this.Io=null}setup(e){this.Mo(),this.bo=e;let t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.To?t.dispose():(this.Eo=t,this.startIfEnabled())}dispose(){var e;this.To||(this.To=!0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.$o.clear(),this.Io=null,this.Po())}mo(){return this.wo.refresh(this.Mr),this.Mr}Mo(){var e,t;return this.mo(),this.Mr.url_allowlist=(e=this.Mr.url_allowlist)===null||e===void 0?void 0:e.map(i=>new RegExp(i)),this.Mr.url_ignorelist=(t=this.Mr.url_ignorelist)===null||t===void 0?void 0:t.map(i=>new RegExp(i)),this.Mr}Ro(){if(!this.isBrowserSupported())return void mn.info("Disabling Automatic Event Collection because this browser is not supported");if(!b||!$)return;let e=this.Ao=t=>{t=t||(b==null?void 0:b.event);try{if(t.type==="blur")return void this.do();if(t.type.indexOf("pointer")===0)return void this.yo(t);let i=t.type==="click"?this._o(t):void 0;if(ne(i))return;this.Fo(t,"$autocapture",i)}catch(i){mn.error("Failed to capture event",i)}};if(z(b,"blur",e),z($,"submit",e,{capture:!0}),z($,"change",e,{capture:!0}),z($,"click",e,{capture:!0}),q(["pointerdown","pointermove","pointerup","pointercancel"],t=>{z($,t,e,{capture:!0})}),this.mo().capture_copied_text){let t=this.Oo=i=>{i=i||(b==null?void 0:b.event);try{this.Fo(i,_n)}catch(s){mn.error("Failed to capture clipboard event",s)}};z($,"copy",t,{capture:!0}),z($,"cut",t,{capture:!0}),z($,"paste",t,{capture:!0})}}Po(){this.do(),this.Ao&&(b==null||b.removeEventListener("blur",this.Ao),q(["pointerdown","pointermove","pointerup","pointercancel"],e=>{$==null||$.removeEventListener(e,this.Ao,!0)}),$==null||$.removeEventListener("submit",this.Ao,!0),$==null||$.removeEventListener("change",this.Ao,!0),$==null||$.removeEventListener("click",this.Ao,!0),this.Ao=void 0),this.Oo&&($==null||$.removeEventListener("copy",this.Oo,!0),$==null||$.removeEventListener("cut",this.Oo,!0),$==null||$.removeEventListener("paste",this.Oo,!0),this.Oo=void 0),this.ko=!1}startIfEnabled(){this.isEnabled||this.do(),!this.To&&this.bo&&this.isEnabled&&!this.ko&&(this.Ro(),this.ko=!0)}onRemoteConfig(e){if(this.To)return;if(this.xo=!0,!e.ok)return void this.startIfEnabled();let t=e.config;t.elementsChainAsString&&(this.Co=t.elementsChainAsString);let i=t.autocapture_opt_out;var s;Se(i)&&((s=this.bo)===null||s===void 0||s.kv.set("$autocapture_disabled_server_side",i),this.So=i),this.startIfEnabled()}setElementSelectors(e,t=this){if(this.To)return;e.size?this.$o.set(t,new Set(e)):this.$o.delete(t);let i=new Set;this.$o.forEach(s=>{s.forEach(n=>i.add(n))}),this.Io=i}getElementSelectors(e,t){var i;let s=[];return(i=this.Io)===null||i===void 0||i.forEach(n=>{let r=$==null?void 0:$.querySelectorAll(n);r==null||r.forEach(o=>{e!==o&&t!==o||A(s,n)||s.push(n)})}),s}get isEnabled(){var e,t;if(this.To)return!1;let i=(e=this.bo)===null||e===void 0?void 0:e.kv.get(Dl),s=this.So,n=this.mo();if(!n.remoteRequestsDisabled&&!this.xo)return!1;let r=n.remoteRequestsDisabled&&!this.xo;if(ne(s)&&!Se(i)&&!r)return!1;let o=(t=this.So)!==null&&t!==void 0?t:!!i;return!!n.enabled&&!o}Fo(e,t="$autocapture",i){if(!this.isEnabled)return void this.do();let s=i||Ei(e);uc(s)&&(s=s.parentNode||null);let n=this.Mo();var r;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&n.rageclick&&(!((r=this.rageclicks)===null||r===void 0)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&fc(s,n.rageclick)&&this.Fo(e,"$rageclick",i);let o=t===_n,a=o?f(f({},n),{},{dom_event_allowlist:void 0}):n;if(s&&(function(d,h,p,v,_,g){var y;if(!b||kr(d)||p!=null&&p.url_allowlist&&!Co(p.url_allowlist,g)||p!=null&&p.url_ignorelist&&Co(p.url_ignorelist,g))return!1;if(p!=null&&p.dom_event_allowlist){let x=p.dom_event_allowlist;if(x&&!x.some(k=>h.type===k))return!1}let{parentIsUsefulElement:m,targetElementList:w}=vc(d,v);if(!(function(x,k){let T=k==null?void 0:k.element_allowlist;if(S(T))return!0;for(let E of x)if(T.some(I=>E.tagName.toLowerCase()===I))return!0;return!1})(w,p)||!Zn(w,p==null?void 0:p.css_selector_allowlist)||Zn(w,(y=p==null?void 0:p.css_selector_ignorelist)!==null&&y!==void 0?y:nn))return!1;try{let x=b.getComputedStyle(d);if(x&&x.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0}catch{}let P=d.tagName.toLowerCase();switch(P){case"html":return!1;case"form":return(_||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(_||["change","click"]).indexOf(h.type)>=0;default:return m?(_||["click"]).indexOf(h.type)>=0:(_||["click"]).indexOf(h.type)>=0&&(wr.indexOf(P)>-1||d.getAttribute("contenteditable")==="true")}})(s,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l;let{props:d,explicitNoCapture:h,target:p}=rf(s,{e,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.Co,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(h)return!1;let v=this.getElementSelectors(s,p);if(v&&v.length>0&&(d.$element_selectors=v),t===_n){let _=e.type||"clipboard";if(_!=="paste"){var c,u;let g=b==null||(c=b.getSelection())===null||c===void 0?void 0:c.toString(),y=dc(g);if(!y)return!1;d.$selected_content=y,d.$clipboard_text_length=(u=g==null?void 0:g.length)!==null&&u!==void 0?u:0}d.$copy_type=_}return(l=this.bo)===null||l===void 0||l.capture(t,d),!0}}isBrowserSupported(){return le($==null?void 0:$.querySelectorAll)}},af=class{constructor(e){this._instance=e}refresh(e){let t=this._instance.config,i=L(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.il(),e.url_allowlist=i==null?void 0:i.url_allowlist,e.url_ignorelist=i==null?void 0:i.url_ignorelist,e.dom_event_allowlist=i==null?void 0:i.dom_event_allowlist,e.element_allowlist=i==null?void 0:i.element_allowlist,e.css_selector_allowlist=i==null?void 0:i.css_selector_allowlist,e.css_selector_ignorelist=i==null?void 0:i.css_selector_ignorelist,e.element_attribute_ignorelist=i==null?void 0:i.element_attribute_ignorelist,e.capture_copied_text=i==null?void 0:i.capture_copied_text}},vi=re("[ExceptionAutocapture]"),ua=()=>{},da=e=>{var t;if(le(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function ti(e,t,i){try{if(!(t in e))return ua;let s={next:e[t]},n=i(function(...r){return s.next.apply(this,r)});return le(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]===n)return void(e[t]=s.next);let r=e[t],o=da(r);for(;o;){if(o.next===n)return void(o.next=s.next);r=o.next,o=da(r)}}}catch{return ua}}var lf=re("[TracingHeaders]"),St=re("[Web Vitals]"),ha=9e5,pa=["CLS","FCP","INP","LCP"],cf=["INP","LCP"],uf=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],bn="disabled",fa="lazy_loading",Ke=re("[SessionRecording]"),df=[fr,vr,Jl,Kl,Ql,ec,tc,ic,sc],hf=re("[Heatmaps]");function wn(e){return L(e)&&"clientX"in e&&"clientY"in e&&oe(e.clientX)&&oe(e.clientY)}var Ki=re("[Product Tours]"),xn=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(hr))},pf=["$set_once","$set"],Ge=re("[SiteApps]"),va="Error while initializing PostHog app with config id ",tu=(e,t)=>e!=null&&e.then?e.then(t):t(e),jt="SDK is not enabled or survey functionality is not yet loaded",ga="Disabled. Not loading surveys.",ff=class{constructor(e,t){this.wo=e,this.Ic=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Mc=!1,this.Ec=!1,this.Pc=[],this.Rc=[],this.Ac=null,this.Fc=null,this.To=!1,this.Oc=new Set,this.onRemoteConfig=i=>{if(this.To||this.Mr.disableSurveys)return;if(!i.ok)return this.Ec=!0,this.Dc({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),G.warn("Remote config unavailable. Not loading surveys.");let s=i.config.surveys;if(O(s))return G.warn("Flags not loaded yet. Not loading surveys.");this.Lc=Se(s)?s:s.length>0,G.info(`flags response received, isSurveysEnabled: ${this.Lc}`),this.loadIfEnabled()},this.Dc=i=>{this.Rc.slice().forEach(s=>this.Nc(s,i))}}setup(e){if(!this.To)return this.qc=e,tu(e.kv.initialize(),()=>{if(this.qc!==e||this.To)return;this.qc=void 0,this.bo=e;let t=e.onRemoteConfig(this.onRemoteConfig);this.To?t.dispose():(this.Eo=t,this.loadIfEnabled())})}dispose(){var e,t,i,s,n;this.To||(this.To=!0,this.qc=void 0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(i=this._surveyManager)===null||i===void 0||(s=i.dispose)===null||s===void 0||s.call(i),this._surveyManager=null,this.Pc=[],this.Rc.forEach(r=>{r.active=!1}),this.Rc=[],(n=this.jc)===null||n===void 0||n.call(this),this.jc=void 0,this.Ac=null,this.Oc.forEach(r=>clearTimeout(r)),this.Oc.clear())}get Mr(){return this.wo.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.clearInMemoryInProgressSurveyState)===null||t===void 0||t.call(e);try{var i;(i=this._surveyEventReceiver)===null||i===void 0||i.reset(),localStorage.removeItem("lastSeenSurveyDate");let s=[];for(let n=0;n<localStorage.length;n++){let r=localStorage.key(n);(r!=null&&r.startsWith("seenSurvey_")||r!=null&&r.startsWith("inProgressSurvey_"))&&s.push(r)}s.forEach(n=>localStorage.removeItem(n))}catch{}this.Dc()}loadIfEnabled(){if(this.To||!this.bo)return;let e=this.Mr;if(this._surveyManager)return;if(this.Mc)return void G.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void G.info(ga);if(e.cookielessMode&&this.wo.isOptedOut())return void G.info("Not loading surveys in cookieless mode without consent.");let t=this.wo.getExtensions();if(!t)return void this.Bc("PostHog Extensions not found.");if(S(this.Lc)&&!e.advancedEnableSurveys)return;let i=this.Lc||e.advancedEnableSurveys;this.Mc=!0,this.Ec=!1;try{let s=t.generateSurveys;if(s)return this.zc(s,i),void(this.Mc=!1);let n=t.loadExternalDependency;if(!n)return this.Bc(gr),void(this.Mc=!1);n(r=>{try{if(this.To)return;let o=this.wo.getExtensions();r||!(o!=null&&o.generateSurveys)?this.Bc("Could not load surveys script",r):this.zc(o.generateSurveys,i)}finally{this.Mc=!1}})}catch(s){throw this.Mc=!1,this.Bc("Error initializing surveys",s),s}}zc(e,t){var i,s;if(this.To)return;this._surveyManager=e(t),this._surveyEventReceiver=this.wo.createEventReceiver(this.Dc);let n=(i=(s=this.bo)!==null&&s!==void 0?s:this.Ic)===null||i===void 0?void 0:i.kv.get(_i);n&&this.Hc(n),G.info("Surveys loaded successfully"),this.Uc(),this.Dc(),this.Wc({isLoaded:!0})}Bc(e,t){this.Ec=!0,G.error(e,t),this.Dc({isLoaded:!1,error:e}),this.Wc({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Pc.push(e),this._surveyManager&&this.Wc({isLoaded:!0}),()=>{this.Pc=this.Pc.filter(t=>t!==e)}}getSurveys(e,t=!1){var i;let s=(i=this.bo)!==null&&i!==void 0?i:this.Ic;if(!s||this.To)return;if(this.Mr.disableSurveys)return G.info(ga),e([]);let n=s.kv.get(_i);if(n&&!t)return e(n,{isLoaded:!0}),void(this.Vc()&&this.getSurveys(()=>{},!0));if(this.Ac)return void this.Ac.then(({surveys:a,context:l})=>{this.To||e(a,l)}).catch(a=>G.error("Error in survey callback",a));let r=this.Gc("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(a=>{try{return this.Qc(s,a)}catch(l){return G.error("Error processing surveys response",l),this.Qc(s,{statusCode:0,error:l})}},a=>this.Qc(s,{statusCode:0,error:a}));this.Ac=r;let o=()=>{this.Ac===r&&(this.Ac=null)};r.then(a=>{o(),this.To||(this.Dc(a.context),e(a.surveys,a.context))},o).catch(a=>G.error("Error in survey callback",a))}Gc(e,t){let i=this.bo;return i?i.sendRequest(e,t):new Promise(s=>s({statusCode:0,error:new Error(jt)}))}Qc(e,t){if(this.To)return{surveys:[],context:{isLoaded:!1,error:jt}};let i=t.statusCode;if(i!==200||!t.json){let n=`Surveys API could not be loaded, status: ${i}`;return i!==0?G.error(n):t.error||G.warn(n),this.Fc=Date.now(),{surveys:[],context:{isLoaded:!1,error:n}}}this.Fc=null;let s=t.json.surveys||[];return e.kv.set({[_i]:s,[_s]:Date.now()}),this.Hc(s),{surveys:s,context:{isLoaded:!0}}}Hc(e){var t;let i=e.filter(s=>(function(n){return!(!n.start_date||n.end_date)})(s)&&(Yc(s)||(function(n){var r;return!!(!((r=n.conditions)===null||r===void 0||(r=r.actions)===null||r===void 0||(r=r.values)===null||r===void 0)&&r.length)})(s)));(t=this._surveyEventReceiver)===null||t===void 0||t.replace(i)}Vc(){return this.Zc()&&!this.Ac&&!this.Jc()}Zc(){var e,t;let i=(e=(t=this.bo)!==null&&t!==void 0?t:this.Ic)===null||e===void 0?void 0:e.kv.get(_s);return oe(i)&&Date.now()-i>3e5}Jc(){return oe(this.Fc)&&3e5>Date.now()-this.Fc}markSurveyAsSeen(e,t){var i;let s={id:e,current_iteration:(i=t==null?void 0:t.iteration)!==null&&i!==void 0?i:null};Kc(s);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Dc()}Wc(e){for(let t of this.Pc)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){G.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t=!1){if(!O(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);G.warn("init was not called")}onActiveMatchingSurveysChanged(e){var t,i;if(this.To)return()=>{};let s={callback:e,active:!0,revision:0};this.Rc.push(s),this.Uc();let n=(t=(i=this.bo)!==null&&i!==void 0?i:this.Ic)===null||t===void 0?void 0:t.kv.get(_i);return this.Mr.disableSurveys||!this._surveyManager&&this.Ec&&!this.Mc||!n&&!O(this.Fc)&&!this.Ac?this.Nc(s,{isLoaded:!1}):this._surveyManager&&this.Nc(s),()=>{var r;s.active=!1,this.Rc=this.Rc.filter(o=>o!==s),this.Rc.length===0&&((r=this.jc)===null||r===void 0||r.call(this),this.jc=void 0)}}Uc(){var e,t,i;this._surveyManager&&this.Rc.length>0&&((e=this.jc)!==null&&e!==void 0||(this.jc=(t=(i=this.wo).onMatchingConditionsChanged)===null||t===void 0?void 0:t.call(i,this.Dc)))}Nc(e,t){if(this.To||!e.active)return;let i=++e.revision,s=n=>{if(!this.To&&e.active&&i===e.revision)try{let r=t!=null?t:{isLoaded:!0},o=JSON.stringify([n,r]);if(o===e.lastResult)return;e.lastResult=o,e.callback(n,r)}catch(r){G.error("Error in active matching surveys callback",r)}};try{t&&!t.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(n){G.error("Error in active matching surveys callback",n)}}Kc(e){let t=null;return this.getSurveys(i=>{var s;t=(s=i.find(n=>n.id===e))!==null&&s!==void 0?s:null}),t}Xc(e){if(O(this._surveyManager))return{eligible:!1,reason:jt};let t=typeof e=="string"?this.Kc(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Yc(e){if(!this.wo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(O(this._surveyManager))return{eligible:!1,reason:jt};let t=typeof e=="string"?this.Kc(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(O(this._surveyManager))return G.warn("init was not called"),{visible:!1,disabledReason:jt};let t=this.Yc(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return O(this._surveyManager)?(G.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:jt})):new Promise(i=>{this.getSurveys(s=>{var n;let r=(n=s.find(o=>o.id===e))!==null&&n!==void 0?n:null;if(r){let o=this.Yc(r);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(!this.wo.isCapturing())return;if(O(this._surveyManager))return void G.warn("init was not called");let n=typeof e=="string"?this.Kc(e):e;if(!(n!=null&&n.id))return void G.warn("Survey not found");if(!Bp.includes(n.type))return void G.warn(`Surveys of type ${n.type} cannot be rendered in the app`);let r=$==null?void 0:$.querySelector(t);if(r){if(!((s=n.appearance)===null||s===void 0)&&s.surveyPopupDelaySeconds){G.info(`Rendering survey ${n.id} with delay of ${n.appearance.surveyPopupDelaySeconds} seconds`);let o=setTimeout(()=>{var a,l;this.Oc.delete(o),!this.To&&this.wo.isCapturing()&&(G.info(`Rendering survey ${n.id} with delay of ${(a=n.appearance)===null||a===void 0?void 0:a.surveyPopupDelaySeconds} seconds`),(l=this._surveyManager)===null||l===void 0||l.renderSurvey(n,r,i),G.info(`Survey ${n.id} rendered`))},1e3*n.appearance.surveyPopupDelaySeconds);return void this.Oc.add(o)}this._surveyManager.renderSurvey(n,r,i)}else G.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this.wo.isCapturing())return;if(O(this._surveyManager))return void G.warn("init was not called");let s=this.Kc(e);if(!s)return void G.warn("Survey not found");let n=s;if(!((i=s.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=f(f({},s),{},{appearance:f(f({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==Yn.Popover&&t.initialResponses&&G.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){let r=this.Xc(s);if(!r.eligible)return void G.warn("Survey is not eligible to be displayed: ",r.reason)}t.displayType!==Yn.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}cancelPendingSurvey(e){O(this._surveyManager)?G.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}};function Vt(e,t,i){if(O(e))return!1;switch(i){case"exact":return e===t;case"contains":{let s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var vf=class{constructor(e){this._instance=e,this.th=new Set,this.eh=new Set,this.ih=new Ss,this.nh=(t,i)=>this.sh(t,i)&&this.rh(t,i)&&this.oh(t,i)&&this.ah(t,i),this.sh=(t,i)=>!(i!=null&&i.event)||(t==null?void 0:t.event)===(i==null?void 0:i.event)}init(){var e,t;S((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.uh=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((i,s)=>{this.on(i,s)}))}dispose(){var e,t;(e=this.uh)===null||e===void 0||e.call(this),this.uh=void 0,(t=this._instance)===null||t===void 0||(t=t.autocapture)===null||t===void 0||t.setElementSelectors(new Set,this),this.ih=new Ss}register(e){var t,i;if(!S((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(s=>{var n;this.th.add(s),(n=s.steps)===null||n===void 0||n.forEach(r=>{this.eh.add((r==null?void 0:r.event)||"")})}),(i=this._instance)===null||i===void 0?void 0:i.autocapture)){let s=new Set;this.th.forEach(n=>{var r;(r=n.steps)===null||r===void 0||r.forEach(o=>{o!=null&&o.selector&&s.add(o.selector)})}),this._instance.autocapture.setElementSelectors(s,this)}}replace(e){this.th.clear(),this.eh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.eh.has(e)||this.eh.has(t.event))&&this.th.forEach(i=>{this.hh(t,i)&&this.ih.emit("actionCaptured",i.name)})}dh(e){this.onAction("actionCaptured",t=>e(t))}hh(e,t){if((t==null?void 0:t.steps)==null)return!1;for(let i of t.steps)if(this.nh(e,i))return!0;return!1}onAction(e,t){return this.ih.on(e,t)}rh(e,t){if(t!=null&&t.url){var i;let s=e==null||(i=e.properties)===null||i===void 0?void 0:i.$current_url;if(!s||typeof s!="string"||!Vt(s,t.url,t.url_matching||"contains"))return!1}return!0}oh(e,t){return!!this.fh(e,t)&&!!this.ph(e,t)&&!!this.gh(e,t)}fh(e,t){var i;if(!(t!=null&&t.href))return!0;let s=this.mh(e);if(s.length>0)return s.some(r=>Vt(r.href,t.href,t.href_matching||"exact"));let n=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!n&&Vt((function(r){let o=r.match(/(?::|")href="(.*?)"/);return o?o[1]:""})(n),t.href,t.href_matching||"exact")}ph(e,t){var i;if(!(t!=null&&t.text))return!0;let s=this.mh(e);if(s.length>0)return s.some(l=>Vt(l.text,t.text,t.text_matching||"exact")||Vt(l.$el_text,t.text,t.text_matching||"exact"));let n=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!n&&(r=(function(l){let c=[],u=/(?::|")text="(.*?)"/g,d;for(;!O(d=u.exec(l));)c.includes(d[1])||c.push(d[1]);return c})(n),o=t.text,a=t.text_matching||"exact",r.some(l=>Vt(l,o,a)));var r,o,a}gh(e,t){var i,s;if(!(t!=null&&t.selector))return!0;let n=e==null||(i=e.properties)===null||i===void 0?void 0:i.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;let r=(e==null||(s=e.properties)===null||s===void 0?void 0:s.$elements_chain)||"";if(t.selector_regex&&r)try{return new RegExp(t.selector_regex).test(r)}catch{return!1}return!1}mh(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e==null?void 0:e.properties.$elements}ah(e,t){return!(t!=null&&t.properties)||t.properties.length===0||Jc(t.properties.reduce((i,s)=>{let n=R(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return i[s.key]={values:n,operator:s.operator||"exact"},i},{}),e==null?void 0:e.properties)}},gf=class{constructor(e,t){var i,s;this.yh=[],this._instance=e,this.bh=t,this._h=new Map,this.wh=new Map,this.kh=new Map,this.Sh=(i=this._instance)===null||i===void 0||(s=i.onSessionId)===null||s===void 0?void 0:s.call(i,n=>this.xh(n))}$h(e){return!1}Ch(){return null}Th(e){}Ih(){}Mh(e,t){return!!e&&Jc(e.propertyFilters,t==null?void 0:t.properties)}Eh(e,t){let i=new Map;return e.forEach(s=>{var n;(n=s.conditions)===null||n===void 0||(n=n[t])===null||n===void 0||(n=n.values)===null||n===void 0||n.forEach(r=>{if(r!=null&&r.name){let o=i.get(r.name)||[];o.push(s.id),i.set(r.name,o)}})}),i}Ph(e,t,i){let s=(i===hi.Activation?this._h:this.wh).get(e),n=[];return this.Rh(r=>{n=r.filter(o=>s==null?void 0:s.includes(o.id))}),n.filter(r=>{var o;let a=(o=r.conditions)===null||o===void 0||(o=o[i])===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.find(l=>l.name===e);return this.Mh(a,t)})}register(e){this.Ah(e,!1)}replace(e){this.Ah(e,!0)}Ah(e,t){var i;S((i=this._instance)===null||i===void 0?void 0:i._addCaptureHook)||(this.Fh(e,t),this.Oh(e,t))}Oh(e,t){let i=e.filter(r=>{var o;return(o=r.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.length});var s;if(t&&this.kh.clear(),i.length===0)return void(t&&((s=this.Dh)===null||s===void 0||s.replace([])));this.Dh||(this.Dh=new vf(this._instance),this.Dh.init(),this.Dh.dh(r=>this.onAction(r)));let n=[];i.forEach(r=>{var o;(o=r.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||o.values.forEach(a=>{if(n.push(a),a.name){var l;let c=(l=this.kh.get(a.name))!==null&&l!==void 0?l:[];c.includes(r.id)||c.push(r.id),this.kh.set(a.name,c)}})}),t?this.Dh.replace(n):this.Dh.register(n)}Lh(e,t){t.forEach((i,s)=>{var n;let r=(n=e.get(s))!==null&&n!==void 0?n:[];i.forEach(o=>{r.includes(o)||r.push(o)}),e.set(s,r)})}Fh(e,t){var i,s;let n=e.filter(l=>{var c,u;return((c=l.conditions)===null||c===void 0?void 0:c.events)&&((u=l.conditions)===null||u===void 0||(u=u.events)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length)>0}),r=e.filter(l=>{var c,u;return((c=l.conditions)===null||c===void 0?void 0:c.cancelEvents)&&((u=l.conditions)===null||u===void 0||(u=u.cancelEvents)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length)>0}),o=this.Eh(e,hi.Activation),a=this.Eh(e,hi.Cancellation);t?(this._h=o,this.wh=a):(this.Lh(this._h,o),this.Lh(this.wh,a)),(n.length!==0||r.length!==0||e.some(l=>{var c;return(c=l.conditions)===null||c===void 0||(c=c.actions)===null||c===void 0||(c=c.values)===null||c===void 0?void 0:c.length}))&&((i=this.uh)!==null&&i!==void 0||(this.uh=(s=this._instance)===null||s===void 0?void 0:s._addCaptureHook((l,c)=>{this.onEvent(l,c)})))}onEvent(e,t){var i,s;let n=this.Nh(),r=(t==null||(i=t.properties)===null||i===void 0?void 0:i.$survey_id)||(t==null||(s=t.properties)===null||s===void 0?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){let a=this.qh(e,r,t);if(a==="consume")return n.info("event consumed activated item, removing it",{event:e,itemId:r}),void this.jh([r]);if(a==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:r}),this.Bh(r),void this.zh([r])}if(this.wh.has(e)){let a=this.Ph(e,t,hi.Cancellation);a.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(l=>l.id)}),this.jh(a.map(l=>l.id)),a.forEach(l=>this.Hh(l.id)))}if(!this._h.has(e))return;n.info("event name matched",{event:e,eventPayload:t,items:this._h.get(e)});let o=this.Ph(e,t,hi.Activation);this.Uh(o.map(a=>a.id))}onAction(e){this.kh.has(e)&&this.Uh(this.kh.get(e)||[])}Uh(e){var t,i;if(e.length===0)return;let s=!!(!((t=this._instance)===null||t===void 0||(i=t.get_session_id)===null||i===void 0)&&i.call(t)),n=[];for(let r of e)s&&this.$h(r)?this.Bh(r)&&this.Wh(r):n.push(r);n.length>0&&(this.yh=[...new Set([...this.yh,...n])]),this.Nh().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Vh()}Bh(e){this.yh=this.yh.filter(i=>i!==e);let t=this.Gh();return!t.includes(e)&&(this.Qh([...t,e]),this.Zh(),!0)}jh(e){let t=new Set(e);this.yh=this.yh.filter(n=>!t.has(n));let i=this.Jh(),s=i.filter(n=>!t.has(n));s.length!==i.length&&(this.Qh(s),s.length===0&&this.Kh()),this.zh(e),this.Vh()}Vh(){try{var e;(e=this.bh)===null||e===void 0||e.call(this)}catch(t){this.Nh().error("Error while handling activated items change",t)}}Xh(){var e;let t=this.Ch();if(!t)return{};let i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return i&&typeof i=="object"?i:{}}Wh(e){if(!this.Ch())return;let t=this.Xh();this.Th(f(f({},t),{},{[e]:Date.now()}))}zh(e){if(!this.Ch())return;let t=this.Xh(),i={},s=!1;for(let[n,r]of Object.entries(t))e.includes(n)?s=!0:i[n]=r;s&&(Me(i)?this.Ih():this.Th(i))}Yh(){this.Ch()&&this.Ih()}getActivationTimestamp(e){if(!this.Gh().includes(e))return;let t=this.Xh()[e];return oe(t)?t:void 0}Jh(){var e;let t=this.td();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Gh(){var e,t,i;let s=this.Jh();if(s.length===0)return[];let n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.ed()],r=(t=this._instance)===null||t===void 0||(i=t.get_session_id)===null||i===void 0?void 0:i.call(t);return r&&n===r?s:[]}Zh(){var e,t;let i=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);i&&this.nd(i)}Kh(){this.sd()}xh(e){var t;let i=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.ed()];if(i&&i!==e){let s=this.Jh(),n=this.Xh();s.length>0&&(this.Qh([]),s.filter(r=>oe(n[r])).forEach(r=>this.Hh(r))),this.Kh(),this.Yh(),s.length>0&&this.Vh()}}getActivatedIds(){return[...new Set([...this.Gh(),...this.yh])].filter(e=>!this.rd(e))}dispose(){var e,t,i;(e=this.Sh)===null||e===void 0||e.call(this),this.Sh=void 0,(t=this.uh)===null||t===void 0||t.call(this),this.uh=void 0,(i=this.Dh)===null||i===void 0||i.dispose(),this.Dh=void 0}reset(){this.yh=[],this.Jh().length>0&&this.Qh([]),this.Kh(),this.Yh(),this.Vh()}getEventToItemsMap(){return this._h}od(){return this.Dh}},_f=class extends gf{constructor(e,t){super(e,t)}td(){return Wl}ed(){return Ul}Ch(){return zl}Th(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}Ih(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}$h(e){var t;let i;this.Rh(n=>{i=n.find(r=>r.id===e)});let s=i==null||(t=i.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return oe(s)&&s>0}ad(){return Ie.SHOWN}Rh(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Hh(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}Nh(){return G}Qh(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}nd(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}sd(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}rd(){return!1}qh(e,t,i){var s;if(e===Ie.SENT&&(i==null||(s=i.properties)===null||s===void 0?void 0:s.$survey_completed)===!1)return"ignore";let n;return this.Rh(r=>{n=r.find(o=>o.id===t)}),!n||(function(r){var o;return Yc(r)&&!!(!((o=r.conditions)===null||o===void 0||(o=o.events)===null||o===void 0)&&o.repeatedActivation)||r.schedule==="always"})(n)?e===Ie.SHOWN?"consume":"ignore":e===Ie.SHOWN?"persist":e===Ie.DISMISSED||e===Ie.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},mf=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);let t={};for(let i of e){let s=this._instance.get_property(i);S(s)||(t[i]=s)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},yf=class{constructor(e){this._instance=e}get(){let e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){let e=F==null?void 0:F.__PosthogExtensions__;if(!e)return;let{generateSurveys:t,loadExternalDependency:i}=e;return{generateSurveys:t?s=>t(this._instance,s):void 0,loadExternalDependency:i?s=>i(this._instance,"surveys",s):void 0}}createEventReceiver(e){return new _f(this._instance,e)}onMatchingConditionsChanged(e){let t=this._instance._addCaptureHook(r=>{r!=="$pageview"&&r!==Ie.SHOWN&&r!==Ie.DISMISSED&&r!==Ie.SENT||e()}),i=()=>e();z(b,"PHSurveyShown",i);let s=!1,n=this._instance.onFeatureFlags(()=>{s&&e()});return s=!0,()=>{s=!1,t(),n(),b==null||b.removeEventListener("PHSurveyShown",i)}}},bf=b!=null&&b.location?bs(b.location.hash,"__posthog")||bs(location.hash,"state"):null,_a="_postHogToolbarParams",ma=re("[Toolbar]"),ya=re("[FeatureFlags]"),Et=re("[FeatureFlags]",{debugEnabled:!0}),kn=`" failed. Feature flags didn't load in time.`,wf=[502,504],ba=["click","keydown","wheel","touchstart","pointerdown"],wa="connection_error",xa=e=>{let t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},ka=e=>{let t={};for(let[i,s]of ns(e||{}))s&&(t[i]=s);return t},xf=class{constructor(e){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=ya,this.ud={},this.hd={},this.dd=[],this.vd=new Set,this.fd=new Set,this.pd=!1,this.gd=!1,this.md=0,this.yd=!1,this.bd=!1,this._d=!1,this.wd=!1,this.kd=0,this.Sd=!1,this.rn=()=>{let t=this.xd();this.kd=0,t&&this.reloadFeatureFlags()},this.$d=()=>{var t,i;let s=this.Cd,n=(t=this.Td)!==null&&t!==void 0?t:s;S(s)||S(n)||this.Mr.remoteRequestsDisabled||!this.Id||this.Id.visibilityState==="hidden"||Date.now()-((i=this.Md)!==null&&i!==void 0?i:0)<n||(this.Td=this.Sd||!this.Mr.idleRefreshBackoff?s:Math.min(2*n,36e5),this.Sd=!1,this.reloadFeatureFlags(),this.Ed())},this.Pd=()=>{this.Sd&&this.Td===this.Cd||this.Rd()},this.sn=()=>{var t;((t=this.Id)===null||t===void 0?void 0:t.visibilityState)==="visible"&&this.Rd()},this.wo=e}get Ad(){}Fd(){this.bo&&this.Od()}setup(e){try{this.Dd=typeof window>"u"?void 0:window,this.Id=typeof document>"u"?void 0:document}catch{this.Dd=void 0,this.Id=void 0}return this.qc=e,this.A=e.logger.createLogger("[FeatureFlags]"),tu(e.kv.initialize(),()=>{this.qc===e&&(this.qc=void 0,this.bo=e,this.Ld(e))})}Ld(e){var t;if(this.bo===e)return this.Dd&&z(this.Dd,"online",this.rn),this.Od(),this.Nd=e.registerDynamicEventProperties(()=>this.qd()?this.ud:this.hd),this.jd=(t=this.Ad)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Bd(),this.zd(),this.Hd()}),this.zd(),this.initialize()}Rd(){this.Sd=!0,this.Td=this.Cd,this.$d()}Od(){var e;let t=this.Mr.refreshIntervalMs,i=!this.Mr.remoteRequestsDisabled&&this.Id&&!S(t)&&t>0?t:void 0;this.Mr.idleRefreshBackoff||(this.Td=i),i!==this.Cd&&(this.Ud(),S(i)||(this.Cd=i,this.Td=i,this.Ed(),!((e=this.Id)===null||e===void 0)&&e.addEventListener&&(z(this.Id,Ai,this.sn),Wt(ba,s=>{z(this.Id,s,this.Pd,{capture:!0})}))))}Ed(){S(this.Cd)||(S(this.Wd)||clearInterval(this.Wd),this.Md=Date.now(),this.Wd=setInterval(this.$d,this.Cd))}Ud(){var e,t;S(this.Wd)||(clearInterval(this.Wd),this.Wd=void 0,(e=this.Id)===null||e===void 0||(t=e.removeEventListener)===null||t===void 0||t.call(e,"visibilitychange",this.sn),Wt(ba,i=>{var s,n;(s=this.Id)===null||s===void 0||(n=s.removeEventListener)===null||n===void 0||n.call(s,i,this.Pd,{capture:!0})})),this.Cd=void 0,this.Td=void 0,this.Sd=!1,this.Md=void 0}destroy(){this.Vd()}dispose(){this.Vd()}Vd(){var e,t,i;this.Ud(),this.md++,this.bd=!1,this.qc=void 0,this.Gd(this.vd,"cancelled"),this.Gd(this.fd,"cancelled"),this.bo&&(this.Qd(),(e=this.Nd)===null||e===void 0||e.dispose(),this.Nd=void 0,(t=this.jd)===null||t===void 0||t.call(this),this.jd=void 0,this.dd=[],(i=this.Dd)===null||i===void 0||i.removeEventListener("online",this.rn),this.bo=void 0)}get Mr(){return this.wo.get()}Zd(e){var t;return this.Jd&&e in this.Jd?this.Jd[e]:(t=this.bo)===null||t===void 0?void 0:t.kv.get(e)}Bd(){return!!this.Jd&&(this.Jd=void 0,!0)}Kd(){var e;return!S((e=this.bo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Bd()}$t(e){this.Xd(()=>{var t;return(t=this.bo)===null||t===void 0?void 0:t.kv.set(e)})}Yd(e,t,i){if(!this.Ad||!e.$enabled_feature_flags)return;let s=this.Zd("$enabled_feature_flags")||{},n=e.$enabled_feature_flags||{},r=t.flags||t.featureFlags,o=t.flags?Object.entries(t.flags).filter(([,g])=>!(g!=null&&g.failed)).map(([g])=>g):[],a=!!t.errorsWhileComputingFlags&&!!t.flags,l=a?o:i&&!R(r)?Object.keys(r||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),c=this.Zd("$feature_flag_payloads")||{},u=e.$feature_flag_payloads||{},d=a||i?l:Array.from(new Set([...Object.keys(c),...Object.keys(u)])),h=!a&&!i,p=!!h||l,v=!!h||d,_={[tt]:p,[Ve]:p,[_t]:v};e.$feature_flag_details&&(_[It]=p);for(let g of[Ft,mt,wi])S(e[g])||(_[g]=!0);this.Ad.markCrossTabFeatureFlagChanges(_)}Pt(e){this.Xd(()=>{var t;return(t=this.bo)===null||t===void 0?void 0:t.kv.remove(e)})}Xd(e){try{e()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}zd(){let e={};for(let s of[tt,_t,Ft,qe]){let n=this.Zd(s);S(n)||(e[s]=n)}this.ud=e;let t=f({},e),i=this.Zd(Ve);if(i)for(let[s,n]of Object.entries(i))t[`$feature/${s}`]=n;this.hd=t}qd(){let e=this.Mr.cacheTtlMs;if(!e||0>=e)return!1;let t=this.Zd(mt);return typeof t!="number"||Date.now()-t>e}tv(){return!!this.qd()&&(this.wd||this.gd||(this.wd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ev(){let e=this.Mr.evaluationContexts;return e!=null&&e.length?e.filter(t=>{let i=t&&typeof t=="string"&&t.trim().length>0;return i||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}iv(){let e=this.Mr.flagKeys;if(!S(e))return e.filter(t=>{let i=t&&typeof t=="string"&&t.trim().length>0;return i||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var e,t;let i=this.Mr,s=(e=(t=i.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(s).length){var n,r;let o=(n=(r=i.bootstrap)===null||r===void 0?void 0:r.featureFlagPayloads)!==null&&n!==void 0?n:{},a=Object.keys(s).filter(c=>!S(s[c])).reduce((c,u)=>(c[u]=s[u],c),{}),l=Object.keys(o).filter(c=>a[c]).reduce((c,u)=>(c[u]=o[u],c),{});return this.nv({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(e,t,i){var s,n;let r=i!=null&&i.merge&&(s=this.Zd("$enabled_feature_flags"))!==null&&s!==void 0?s:{},o=i!=null&&i.merge&&(n=this.Zd("$feature_flag_payloads"))!==null&&n!==void 0?n:{},a=f(f({},r),e),l=f(f({},o),t),c={};for(let[u,d]of Object.entries(a))c[u]={key:u,enabled:po(d),variant:fo(d),reason:void 0,metadata:S(l==null?void 0:l[u])?void 0:{id:0,version:void 0,description:void 0,payload:l[u]}};this.nv({flags:c})}get hasLoadedFlags(){return this.pd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){let e=this.Zd(It),t=this.Zd(qe),i=this.Zd(Mt);if(!i&&!t)return e||{};let s=Q({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(let a of n){var r,o;let l=s[a],c=t==null?void 0:t[a],u=S(c)?(r=l==null?void 0:l.enabled)!==null&&r!==void 0&&r:!!c,d=S(c)?l==null?void 0:l.variant:typeof c=="string"?c:void 0,h=i==null?void 0:i[a],p=f(f({},l),{},{enabled:u,variant:u?d!=null?d:l==null?void 0:l.variant:void 0});u!==(l==null?void 0:l.enabled)&&(p.original_enabled=l==null?void 0:l.enabled),d!==(l==null?void 0:l.variant)&&(p.original_variant=l==null?void 0:l.variant),h&&(p.metadata=f(f({},l==null?void 0:l.metadata),{},{payload:h,original_payload:l==null||(o=l.metadata)===null||o===void 0?void 0:o.payload})),s[a]=p}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.ld=!0),s}getAllFeatureFlags(){let e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{let s=e[i];return{key:i,enabled:po(s),variant:fo(s),payload:ho(t[i])}})}getFlagVariants(){let e=this.Zd(Ve),t=this.Zd(qe);if(!t)return e||{};let i=Q({},e||{}),s=Object.keys(t);for(let n=0;s.length>n;n++)i[s[n]]=t[s[n]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.ld=!0),i}getFlagPayloads(){let e=this.Zd(_t),t=this.Zd(Mt);if(!t)return e||{};let i=Q({},e||{}),s=Object.keys(t);for(let n=0;s.length>n;n++)i[s[n]]=t[s[n]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.ld=!0),i}reloadFeatureFlags(){this.yd||this.Mr.featureFlagsDisabled||this.xd()||(this.gd&&(this.bd=!0),this.sv||(this.dd.slice().forEach(e=>{try{e()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.sv=setTimeout(()=>{this.rv()},5)))}reloadFeatureFlagsAsync(){return!this.bo||this.yd||this.Mr.featureFlagsDisabled||this.Mr.remoteRequestsDisabled||this.xd()?Promise.resolve({status:"skipped"}):new Promise(e=>{this.vd.add(e),this.reloadFeatureFlags()})}Gd(e,t){e.forEach(i=>i({status:t})),e.clear()}Qd(){clearTimeout(this.sv),this.sv=void 0}onReloading(e){return this.dd.push(e),()=>{this.dd=this.dd.filter(t=>t!==e)}}ensureFlagsLoaded(){this.pd||this.gd||this.sv||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.yd=e}resetFlagCallReported(){this.Pt(gt)}rv(e){var t;this.Qd();let i=this.bo;if(!i||this.Mr.remoteRequestsDisabled||this.xd())return void this.Gd(this.vd,"skipped");if(this.gd)return void(this.bd=!0);let s={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:f(f(f({},i.initialPersonProperties),this.Zd("$stored_person_properties")||{}),{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Zd(ft),timezone:yc()};S(i.deviceId)||(s.$device_id=i.deviceId),(e!=null&&e.disableFlags||this.Mr.featureFlagsDisabled)&&(s.disable_flags=!0);let n=this.ev();n.length&&(s.evaluation_contexts=n);let r=this.iv();S(r)||(s.flag_keys=r);let o=this.Mr.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.md,c=this.vd;this.vd=new Set,this.fd=c,this.gd=!0;let u=()=>{this.bd&&(this.bd=!1,this.rv())},d=g=>{var y,m;let w=(y=g.json)!==null&&y!==void 0?y:{},P=g.statusCode!==200;if(this.gd=!1,l!==this.md)return void u();if(this.ov(g.statusCode),P||this.bd||(this.$anon_distinct_id=void 0),s.disable_flags&&!this.bd)return void this.Gd(c,"skipped");this._d=!P;let x=[];g.error?x.push(g.error instanceof Error&&g.error.name==="AbortError"?"timeout":g.error instanceof Error?wa:"unknown_error"):g.statusCode!==200&&x.push(`api_error_${g.statusCode}`),w.errorsWhileComputingFlags&&x.push("errors_while_computing_flags");let k=!!(!((m=w.quotaLimited)===null||m===void 0)&&m.includes("feature_flags"));k&&x.push("quota_limited"),this.$t({[Ci]:x}),k?this.A.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."):s.disable_flags||this.nv(w,P,{partialResponse:o}),this.Gd(c,s.disable_flags?"skipped":x.length||!w.flags&&!w.featureFlags?"error":"loaded"),u()},h=g=>{this.gd=!1,l===this.md&&(this.$t({[Ci]:[wa]}),this.A.error("Feature flag request failed",g),this.Kd()&&this.Hd(!0),this.Gd(c,"error")),u()},p=(t=this.Mr.requestMaxRetries)!==null&&t!==void 0?t:1,v=()=>p>0&&l===this.md,_=()=>{if(l!==this.md||!this.bo||this.Mr.remoteRequestsDisabled)return this.gd=!1,this.Gd(c,"skipped"),void u();try{i.sendRequest(a,{target:"flags",method:"POST",body:s,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(g=>{if((y=>wf.includes(y.statusCode)||(m=>m.statusCode===0&&m.error instanceof Error&&m.error.name==="AbortError")(y))(g)&&v())return p--,void setTimeout(_,500);d(g)}).catch(h)}catch(g){h(g)}};_()}xd(){return wc(this.kd,3)}ov(e){this.kd=xc(e,this.kd,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var i;if(t.fresh&&!this._d)return;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+e+kn);if(this.tv())return;let s=this.getFeatureFlagResult(e,t);return(i=s==null?void 0:s.variant)!==null&&i!==void 0?i:s==null?void 0:s.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){let t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this._d)return;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+e+kn);if(this.tv())return;let i=this.getFlagVariants(),s=e in i,n=i[e],r=this.getFlagPayloads()[e],o=String(n),a=this.Zd("$feature_flag_request_id")||void 0,l=this.Zd("$feature_flag_evaluated_at")||void 0,c,u=this.Zd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var d;let I=(d=this.bo)===null||d===void 0?void 0:d.session.sessionId,N=this.Zd(gi);I&&I!==N&&(u={},c=I)}if(!t.send_event&&"send_event"in t)c&&this.$t({[gt]:u,[gi]:c});else if(e in u&&u[e].includes(o))c&&this.$t({[gt]:u,[gi]:c});else{var h,p,v,_,g,y,m,w,P,x,k,T,E;R(u[e])?u[e].push(o):u[e]=[o],this.$t(f({[gt]:u},c?{[gi]:c}:{}));let I=this.getFeatureFlagDetails(e),N=[...(h=this.Zd("$feature_flag_errors"))!==null&&h!==void 0?h:[]];S(n)&&N.push("flag_missing");let B={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:r!=null?r:null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(p=(v=this.Mr.bootstrap)===null||v===void 0||(v=v.featureFlags)===null||v===void 0?void 0:v[e])!==null&&p!==void 0?p:null,$feature_flag_bootstrapped_payload:(_=(g=this.Mr.bootstrap)===null||g===void 0||(g=g.featureFlagPayloads)===null||g===void 0?void 0:g[e])!==null&&_!==void 0?_:null,$used_bootstrap_value:!this._d};S(I==null||(y=I.metadata)===null||y===void 0?void 0:y.has_experiment)||(B.$feature_flag_has_experiment=I.metadata.has_experiment),S(I==null||(m=I.metadata)===null||m===void 0?void 0:m.version)||(B.$feature_flag_version=I.metadata.version);let W=(w=I==null||(P=I.reason)===null||P===void 0?void 0:P.description)!==null&&w!==void 0?w:I==null||(x=I.reason)===null||x===void 0?void 0:x.code;W&&(B.$feature_flag_reason=W),!(I==null||(k=I.metadata)===null||k===void 0)&&k.id&&(B.$feature_flag_id=I.metadata.id),S(I==null?void 0:I.original_variant)&&S(I==null?void 0:I.original_enabled)||(B.$feature_flag_original_response=S(I.original_variant)?I.original_enabled:I.original_variant),!(I==null||(T=I.metadata)===null||T===void 0)&&T.original_payload&&(B.$feature_flag_original_payload=I==null||(E=I.metadata)===null||E===void 0?void 0:E.original_payload),N.length&&(B.$feature_flag_error=N.join(",")),this.av(B)}return s?{key:e,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:ho(r)}:void 0}av(e){try{var t;(t=this.bo)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(i){this.A.error("Failed to capture feature flag call",i)}}getRemoteConfigPayload(e,t){this.lv(e,t)}lv(e,t){var i=this;return ee(function*(){let s=i.bo;if(!s)return;let n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=i.ev();r.length&&(n.evaluation_contexts=r);let o=i.iv(),a;S(o)||(n.flag_keys=o);try{var l;let c=(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:i.Mr.compression,sentAt:"body",timeoutMs:i.Mr.requestTimeoutMs})).json)===null||l===void 0?void 0:l.featureFlagPayloads;a=(c==null?void 0:c[e])||void 0}catch(c){return void i.A.error("Remote config feature flag request failed",c)}try{t(a)}catch(c){i.A.error("Remote config feature flag callback failed",c)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this._d)return t.defaultValue;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+kn),t.defaultValue;let i=this.getFeatureFlag(e,t);return S(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this.nv(e,t,i)}nv(e,t,i){if(!this.bo)return;this.pd=!0;let s=((n,r={},o={},a={},l,c=ya)=>{let u=((w,P)=>{let x=w.flags;if(x){let k=Object.fromEntries(Object.keys(x).map(E=>{var I;return[E,(I=x[E].variant)!==null&&I!==void 0?I:x[E].enabled]})),T=Object.fromEntries(Object.keys(x).filter(E=>x[E].enabled).filter(E=>{var I;return!S((I=x[E].metadata)===null||I===void 0?void 0:I.payload)}).map(E=>{var I;return[E,(I=x[E].metadata)===null||I===void 0?void 0:I.payload]}));return f(f({},w),{},{featureFlags:k,featureFlagPayloads:T})}return w.featureFlags&&P.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),w})(n,c),d=u.flags,h=u.featureFlags,p=u.featureFlagPayloads;if(!h)return;let v=n.requestId,_=n.evaluatedAt;if(R(h)){c.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");let w={};if(h)for(let P=0;h.length>P;P++)w[h[P]]=!0;return{[tt]:h,[Ve]:w,[wi]:!1}}let g=h,y=p,m=d;if(l!=null&&l.partialResponse){let w=Object.keys(g),P=y||{};g=f(f({},r),g),y=f(f({},o),P),w.forEach(x=>{x in P||y==null||delete y[x]}),m=f(f({},a),m)}else if(n.errorsWhileComputingFlags)if(d){let w=new Set(Object.keys(d).filter(x=>{var k;return!(!((k=d[x])===null||k===void 0)&&k.failed)}));g=f(f({},r),Object.fromEntries(Object.entries(g).filter(([x])=>w.has(x))));let P=Object.fromEntries(Object.entries(y||{}).filter(([x])=>w.has(x)));y=f(f({},o),P),w.forEach(x=>{x in P||y==null||delete y[x]}),m=f(f({},a),Object.fromEntries(Object.entries(m||{}).filter(([x])=>w.has(x))))}else g=f(f({},r),g),y=f(f({},o),y),m=f(f({},a),m);return f(f({[tt]:Object.keys(ka(g)),[Ve]:g||{},[_t]:y||{},[It]:m||{},[wi]:n.minimalFlagCalledEvents===!0},v?{[Ft]:v}:{}),_?{[mt]:_}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.A);if(s)if((i==null?void 0:i.persist)===!1){let n=!S(this.bo.kv.get(Ve));this.Jd=s,n||this.$t(s)}else this.Bd(),this.Yd(s,e,!!(i!=null&&i.partialResponse)),this.$t(s);else t&&this.Kd();t||(this.wd=!1),this.Hd(t)}override(e,t=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.uv(e)}uv(e){if(this.bo){if(e===!1)return this.Pt([qe,Mt]),this.Hd(),void Et.info("All overrides cleared");if(R(e))return this.$t({[qe]:xa(e)}),this.Hd(),void Et.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;let i=e;this.ld=!!((t=i.suppressWarning)!==null&&t!==void 0&&t);let s={},n=i.flags,r=i.payloads;return n&&(s[qe]=R(n)?xa(n):n),r&&(s[Mt]=r),Object.keys(s).length&&this.$t(s),n===!1&&r===!1?this.Pt([qe,Mt]):n===!1?this.Pt(qe):r===!1&&this.Pt(Mt),this.Hd(),n===!1?Et.info("Flag overrides cleared"):n&&Et.info("Flag overrides set",{flags:n}),void(r===!1?Et.info("Payload overrides cleared"):r&&Et.info("Payload overrides set",{payloads:r}))}if(e&&typeof e=="object")return this.$t({[qe]:e}),this.Hd(),void Et.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.pd){let{flags:t,flagVariants:i}=this.hv();try{e(t,i)}catch(s){this.A.error("Error while running feature flags callback",s)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;let n=(this.Zd("$early_access_features")||[]).find(c=>c.flagKey===e),r={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:r};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i);let a=f(f({},this.getFlagVariants()),{},{[e]:t});(s=this.Ad)===null||s===void 0||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(r)}),this.$t({[tt]:Object.keys(ka(a)),[Ve]:a,[vt]:f(f({},this.Zd("$stored_person_properties")||{}),r)}),this.Hd();try{var l;(l=this.bo)===null||l===void 0||l.capture("$feature_enrollment_update",o)}catch(c){this.A.error("Failed to capture early access feature enrollment",c)}}getEarlyAccessFeatures(e,t=!1,i){let s=this.Zd(Ln);!s||t?this.dv(e,i):e(s)}dv(e,t){var i=this;return ee(function*(){let s=i.bo;if(!s)return;let n=t?`&${t.map(o=>`stage=${o}`).join("&")}`:"",r;try{let o=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r=o.json.earlyAccessFeatures,i.$t({[Ln]:r})}catch(o){return void i.A.error("Early access feature request failed",o)}try{e(r)}catch(o){i.A.error("Early access feature callback failed",o)}})()}hv(){let e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(i=>t[i]),flagVariants:Object.keys(t).filter(i=>t[i]).reduce((i,s)=>(i[s]=t[s],i),{})}}Hd(e){this.zd();let{flags:t,flagVariants:i}=this.hv();this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(n){this.A.error("Error while running feature flags callback",n)}})}setPersonPropertiesForFlags(e,t=!0){this.vv(e,t)}vv(e,t=!0){let i=this.Zd("$stored_person_properties")||{},s=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),n=e==null?void 0:e.$set_once,r={};if(n)for(let o in n)({}).hasOwnProperty.call(n,o)&&(o in i||(r[o]=n[o]));this.$t({[vt]:f(f(f({},i),r),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){let i=f({},this.Zd("$stored_person_properties")||{});e.forEach(s=>{delete i[s]}),this.$t({[vt]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Pt(vt),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){let i=this.Zd("$stored_group_properties")||{},s=f({},i);for(let n of Object.keys(e))s[n]=f(f({},i[n]),e[n]);this.$t({[ft]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){let t=this.Zd("$stored_group_properties")||{};this.$t({[ft]:f(f({},t),{},{[e]:{}})})}else this.Pt(ft)}reset(){this.md++,this.Gd(this.vd,"cancelled"),this.Gd(this.fd,"cancelled"),this.bd=!1,this.ud={},this.hd={},this.Jd=void 0,this.pd=!1,this.yd=!1,this._d=!1,this.$anon_distinct_id=void 0,this.Qd(),this.ld=!1,this.kd=0}},Sa=re("[FeatureFlags]"),kf=class{constructor(e,t=!1){this.fv=!1,this.update(e,t)}update(e,t){this.pv=((i,s)=>{var n,r,o,a,l,c,u,d;return{bootstrap:{featureFlags:(n=(r=i.bootstrap)===null||r===void 0?void 0:r.featureFlags)!==null&&n!==void 0?n:void 0,featureFlagPayloads:(o=(a=i.bootstrap)===null||a===void 0?void 0:a.featureFlagPayloads)!==null&&o!==void 0?o:void 0},remoteRequestsDisabled:s,featureFlagsDisabled:!!i.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!i.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!i.advanced_feature_flags_dedup_per_session,cacheTtlMs:i.feature_flag_cache_ttl_ms,refreshIntervalMs:(l=i.remote_config_refresh_interval_ms)!==null&&l!==void 0?l:3e5,idleRefreshBackoff:S(i.remote_config_refresh_interval_ms),requestTimeoutMs:i.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(c=i.feature_flag_request_max_retries)!==null&&c!==void 0?c:1),compression:i.disable_compression?void 0:"best-available",evaluationContexts:(u=(d=i.evaluation_contexts)!==null&&d!==void 0?d:i.evaluation_environments)!==null&&u!==void 0?u:[],flagKeys:R(i.flag_keys)?i.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.fv||(Sa.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.fv=!0),S(e.flag_keys)||R(e.flag_keys)||Sa.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.pv}},Ea=e=>ii(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),Ne=re("[Error tracking]"),tr="webkit-masked-url:",Sf=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Ef=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",tr],$f=["__firefox__","__gCrWeb"],$a="Refusing to render web experiment since the viewer is a likely bot",Pf={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Es(t,e),not_regex:(e,t)=>!Es(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Oe=re("[Conversations]"),$t="Conversations not available yet.";function Pa(e,t){var i,s,n,r,o,a,l;let c=(i=e==null?void 0:e.flushIntervalMs)!==null&&i!==void 0?i:3e3,u=(s=e==null?void 0:e.maxBufferSize)!==null&&s!==void 0?s:100,d=t!=null&&t.consoleCapture?void 0:(n=e==null?void 0:e.maxLogsPerInterval)!==null&&n!==void 0?n:1e3,h=S(d)?Math.max(u,2048):Math.max(u,d),p=f(f({},(function(){let v="",_="";try{let g=pe==null?void 0:pe.userAgent;g&&([v,_]=ul(g))}catch{}return(function(g,y){let m=(function(w){if(w)return{}.hasOwnProperty.call(bo,w)?bo[w]:w})(g);return f(f({},m?{"os.name":m}:{}),y?{"os.version":y}:{})})(v,_)})()),e==null?void 0:e.resourceAttributes);return{serviceName:(r=(o=p==null?void 0:p["service.name"])!==null&&o!==void 0?o:e==null?void 0:e.serviceName)!==null&&r!==void 0?r:t==null?void 0:t.serviceNameDefault,serviceVersion:(a=p==null?void 0:p["service.version"])!==null&&a!==void 0?a:e==null?void 0:e.serviceVersion,environment:(l=p==null?void 0:p["deployment.environment"])!==null&&l!==void 0?l:e==null?void 0:e.environment,resourceAttributes:p,beforeSend:e==null?void 0:e.beforeSend,flushIntervalMs:c,maxBufferSize:u,maxQueueSize:h,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Mf=["debug","log","warn","error","info"],Tf=e=>{for(;e!=null&&e.__rrweb_original__;)e=e.__rrweb_original__;return e},Ma="console",iu="__posthogHandledLogsRequestError",Sn=(e,t)=>{let i=e instanceof Error?e:new Error(t);return i[iu]=!0,i},Ta=e=>!!e&&typeof e=="object"&&e[iu]===!0,$s=re("[NetworkMetrics]"),$r=()=>{var e;return!(b==null||(e=b.performance)===null||e===void 0)&&e.now?b.performance.now():Date.now()},If={"http:":80,"https:":443},Ff=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),su=(e,t)=>{var i;let s=String(t);return{method:String(e).toUpperCase(),url:((i=nt(s))===null||i===void 0?void 0:i.href)||s}},ir=(e,t,i,s,n,r,o=!1)=>{try{var a,l;let c=n();if(!c)return;let u=i||void 0,d=$r()-s,h=nt(t.url);if(h&&h.protocol!=="http:"&&h.protocol!=="https:")return;let p={url:(h==null?void 0:h.href)||t.url,method:t.method},v=le(c.name)?c.name(p):D(c.name)?c.name:"http.client.request.duration";if(!v)return;let _=o&&!u?void 0:((y,m)=>y?400>y?void 0:String(y):(m==null?void 0:m.name)||"_OTHER")(u,r),g=f(f(f(f(f({},(y=>{let m=Ff.has(y)?y:"_OTHER";return f({"http.request.method":m},m==="_OTHER"&&y!==m?{"http.request.method_original":y}:{})})(p.method)),h?(y=>{return{"server.address":y.hostname.startsWith("[")&&y.hostname.endsWith("]")?y.hostname.slice(1,-1):y.hostname,"server.port":Number(y.port)||If[y.protocol],"url.scheme":y.protocol.slice(0,-1),"url.template":(m=y.pathname,m.split("/").map(w=>(P=>/^\d+$/.test(P)||P.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(P))(w)?":id":w).join("/"))};var m})(h):{}),u?{"http.response.status_code":u}:{}),_?{"error.type":_}:{}),(a=c.attributes)===null||a===void 0?void 0:a.call(c,p,{status:u,durationMs:d}));(l=e.metrics)===null||l===void 0||l.histogram(v,d,{unit:"ms",attributes:g})}catch(c){$s.error("Failed to record network metric",c)}},nu=()=>{},Cf=(e,t)=>le(b==null?void 0:b.fetch)?ti(b,"fetch",i=>function(...s){let n=$r(),r=i.apply(this,s);if(!t())return r;try{var o,a,l;let[c,u]=s,d=su((o=(a=u==null?void 0:u.method)!==null&&a!==void 0?a:c==null?void 0:c.method)!==null&&o!==void 0?o:"GET",(l=c==null?void 0:c.url)!==null&&l!==void 0?l:c);return r.then(h=>(ir(e,d,h==null?void 0:h.status,n,t,void 0,!0),h),h=>{throw ir(e,d,void 0,n,t,h),h})}catch(c){return $s.error("Failed to observe fetch",c),r}}):nu,Af=(e,t)=>{var i;let s=b==null||(i=b.XMLHttpRequest)===null||i===void 0?void 0:i.prototype;if(!s)return nu;let n=new WeakMap,r=ti(s,"open",a=>function(...l){try{Lc.has(this)||n.set(this,su(l[0],l[1]))}catch(c){$s.error("Failed to observe XHR open",c)}return a.apply(this,l)}),o=ti(s,"send",a=>function(...l){let c;try{let u=n.get(this);if(u&&t()){let d=$r();c=()=>{this.removeEventListener("loadend",c),ir(e,u,this.status,d,t)},z(this,"loadend",c)}}catch(u){$s.error("Failed to observe XHR send",u)}try{return a.apply(this,l)}catch(u){throw c&&this.removeEventListener("loadend",c),u}});return()=>{r(),o()}},Ia=new WeakMap,Rf={maxStringLength:2048,truncationSuffix:"..."};function Fa(e){if(e)return e===!0?{intent:!0,model:!0}:{intent:e.intent!==!1,model:e.model!==!1}}function ht(e,t){return{}.hasOwnProperty.call(e,t)}function En(e,t){let i=Object.create(e);return t&&Object.defineProperty(i,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:t}),i}function Ca(e,t,i=!1){if(!D(e))return;let s=e.trim();return s?(i?ph(s,Rf):s).slice(0,t):void 0}function Aa(e){try{return L(e)&&e.isError===!0}catch{return!1}}var Is={featureFlags:class extends xf{constructor(e){let t=new kf(e.config,e.il());super(t),this.name="featureFlags",this._instance=e,this.gv=t}get Ad(){return this._instance.persistence}updateConfig(e,t){this.gv.update(e,t),this.Fd()}}},Of={sessionRecording:class{get Mr(){return this._instance.config}get Il(){return this._instance.persistence}get started(){var e;return!!(!((e=this.mv)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.yv==="awaiting_config"||this.yv==="missing_config"?this.yv:(e=(t=this.mv)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.yv}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.yv=bn,this.bv=void 0,this._v=!1,this.Je=(()=>{var t,i;if(!($!=null&&$.visibilityState)||$.visibilityState==="visible")return!0;let s=b==null||(t=b.performance)===null||t===void 0||(i=t.getEntriesByType)===null||i===void 0?void 0:i.call(t,"visibility-state");return!(s!=null&&s.length)||s.some(n=>n.name==="visible")})(),this.sn=()=>{var t,i;($==null?void 0:$.visibilityState)==="visible"&&(this.Je=!0,(t=this.mv)===null||t===void 0||(i=t.setDocumentWasEverVisible)===null||i===void 0||i.call(t,!0))},!this._instance.sessionManager)throw Ke.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Mr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');$!=null&&$.addEventListener&&z($,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this._v=!0,$==null||(t=$.removeEventListener)===null||t===void 0||t.call($,"visibilitychange",this.sn),e?this.wv(!0):this.stopRecording()}get Sv(){var e;let t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),i=!this.Mr.disable_session_recording,s=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return b&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(this._v||this.Sv&&(!((t=this.mv)===null||t===void 0)&&t.isStarted))return;let i=!S(Object.assign)&&!S(Array.from);this.Sv&&i?(this.xv(e),Ke.info("starting")):(this.yv=bn,this.stopRecording())}xv(e){var t,i;if(this.Sv)if(this.yv!=="awaiting_config"&&this.yv!=="missing_config"&&(this.yv=fa),(F==null||(t=F.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((i=F.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording))this.$v(e);else{var s,n;let r=this._instance.sessionManager;(s=F.__PosthogExtensions__)===null||s===void 0||(n=s.loadExternalDependency)===null||n===void 0||n.call(s,this._instance,this.Cv,o=>{if(!this._v&&this.Sv&&this._instance.sessionManager===r)return o?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Ke.error("could not load recorder",o)):void this.$v(e);this.yv="disabled"})}}stopRecording(){var e,t;(e=this.bv)===null||e===void 0||e.call(this),this.bv=void 0,(t=this.mv)===null||t===void 0||t.stop()}wv(e=!1){var t,i;(t=this.bv)===null||t===void 0||t.call(this),this.bv=void 0,(i=this.mv)===null||i===void 0||i.discard({discardProducerEvents:e})}Tv(){var e,t;(e=this.Il)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.Il)===null||t===void 0||t.unregister("$replay_sample_rate")}Iv(e,t){if(O(e))return null;let i=oe(e)?e:parseFloat(e);return typeof(s=i)!="number"||!Number.isFinite(s)||0>s||s>1?(Ke.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var s}Mv(e){if(this.Il){var t,i;let s=this.Il,n=()=>{var r;let o=e.sessionRecording===!1?void 0:e.sessionRecording,a=this.Iv((r=this.Mr.session_recording)===null||r===void 0?void 0:r.sampleRate,"session_recording.sampleRate"),l=this.Iv(o==null?void 0:o.sampleRate,"remote config sampleRate"),c=a!=null?a:l;O(c)&&this.Tv();let u=o==null?void 0:o.minimumDurationMilliseconds;s.register({[ki]:f(f({cache_timestamp:Date.now(),enabled:!!o},o),{},{networkPayloadCapture:f({capturePerformance:e.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:c,minimumDurationMilliseconds:S(u)?null:u,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers,version:o==null?void 0:o.version,triggerGroups:o==null?void 0:o.triggerGroups})})};n(),(t=this.bv)===null||t===void 0||t.call(this),this.bv=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.onSessionId(n)}}onRemoteConfig(e){let t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.Mv(t),void this.wv()):(this.Mv(t),void this.startIfEnabledOrStop()):(this.yv==="awaiting_config"&&(this.yv="missing_config",this._instance.register_for_session({[vr]:!0}),Ke.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;!((i=this.mv)===null||i===void 0)&&i.log?this.mv.log(e,t):Ke.warn("log called before recorder was ready")}get Cv(){var e,t;let i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(ki);return(i==null||(t=i.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}Ev(){let e=this._instance.get_property(ki);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(i){return Ke.warn("persisted remote config for session recording is invalid and will be ignored",i),!1}return!O(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}$v(e){var t,i,s;if(!this._v&&this.Sv&&this._instance.sessionManager){if(!(!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return Ke.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[fr]:!0});var n;if(this.mv||(this.mv=(n=F.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording(this._instance,this.Je),this.mv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ev())return this.yv==="missing_config"||this.yv==="awaiting_config"?void 0:(this.yv="awaiting_config",Ke.info("persisted remote config is stale, requesting fresh config before starting"),void new Fc(this._instance).load());this.yv=fa,(i=(s=this.mv).setDocumentWasEverVisible)===null||i===void 0||i.call(s,this.Je),this.mv.start(e)}else this.yv=bn}onRRwebEmit(e){var t,i;(t=this.mv)===null||t===void 0||(i=t.onRRwebEmit)===null||i===void 0||i.call(t,e)}overrideLinkedFlag(){var e,t;this.mv||(t=this.Il)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.mv)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.mv||(t=this.Il)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.mv)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,i;this.mv||(i=this.Il)===null||i===void 0||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.mv)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;let t={};for(let s of df){var i;let n=(i=this._instance.sessionPersistence)===null||i===void 0?void 0:i.get_property(s);S(n)||(t[s]=n)}return f(f({},t),((e=this.mv)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(e,t){var i;return!!(!((i=this.mv)===null||i===void 0)&&i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.mv)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},Lf={autocapture:class extends of{constructor(e){super(new af(e)),this.instance=e}},historyAutocapture:class{constructor(e){this.Pv=!1,this._instance=e,this.Rv=this.Av()}initialize(){this.startIfEnabled()}get isEnabled(){let e=this.Fv();return!!(e.path||e.search||this.Ov(e))}startIfEnabled(){this.isEnabled&&(M.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Rv=this.Av(),this.startIfEnabled()}stop(){this.Dv&&this.Dv(),this.Dv=void 0,this.Lv&&this.Lv(),this.Lv=void 0,M.info("History API monitoring stopped")}monitorHistoryChanges(){b&&b.history&&(this.Nv("pushState"),this.Nv("replaceState"),this.qv(),this.Ov()&&this.jv())}Nv(e){var t;if(!b||!((t=b.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;let i=this;ti(b.history,e,s=>function(n,r,o){var a;i.Bv(o)&&i.zv(),s.call(this,n,r,o),i.Hv(e,!i.Pv&&(b==null||(a=b.event)===null||a===void 0?void 0:a.type)!=="popstate")})}Av(){let e=b==null?void 0:b.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}Fv(){let e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:L(e)?e:{}}Ov(e=this.Fv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}Uv(e){let t=this.Fv(),i=this.Rv;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this.Ov(t)&&e.hash!==i.hash))}Hv(e,t=!1){try{t||this.zv();let i=this.Av();if(!i)return;if(this.Uv(i)){let s=()=>this._instance.capture(_r,{navigation_type:e});t?(this.Wv=s,Promise.resolve().then(()=>this.zv())):s()}this.Rv=i}catch(i){M.error(`Error capturing ${e} pageview`,i)}}Bv(e){var t,i;return!(O(e)||!b)&&((t=nt(String(e)))===null||t===void 0?void 0:t.href)!==((i=b.location)===null||i===void 0?void 0:i.href)}zv(){let e=this.Wv;if(e){this.Wv=void 0,this.Pv=!0;try{e()}catch(t){M.error("Error capturing deferred pageview",t)}finally{this.Pv=!1}this.Rv=this.Av()}}qv(){if(this.Dv)return;let e=()=>{this.Hv("popstate")};z(b,"popstate",e),this.Dv=()=>{b&&b.removeEventListener("popstate",e)}}jv(){if(this.Lv)return;let e=()=>{this.Hv("hashchange")};z(b,"hashchange",e),this.Lv=()=>{b&&b.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(e){var t;this.Vv=!1,this.ko=!1,this.Gv=null,this.instance=e,this.Vv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[Nn]),this.rageclicks=new eu(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return L(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Mr.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return O(this.Mr.capture_heatmaps)?O(this.Mr.enable_heatmaps)?this.Vv:this.Mr.enable_heatmaps:this.Mr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ko)return;hf.info("starting..."),this.Qv(),this.sn()}else{var e;clearInterval((e=this.Gv)!==null&&e!==void 0?e:void 0),this.Zv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!("heatmaps"in t))return;let i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Nn]:i}),this.Vv=i,this.startIfEnabled()}getAndClearBuffer(){let e=this.Rt;return this.Rt=void 0,e}Jv(e){wn(e.originalEvent)&&this.Ir(e.originalEvent,"deadclick")}sn(){this.Gv&&clearInterval(this.Gv),this.Gv=($==null?void 0:$.visibilityState)==="visible"?setInterval(this.fl.bind(this),this.flushIntervalMilliseconds):null}Qv(){b&&$&&(this.Kv=this.fl.bind(this),z(b,ms,this.Kv),this.Xv=e=>this.Ir(e||(b==null?void 0:b.event)),z($,"click",this.Xv,{capture:!0}),this.Yv=e=>this.tf(e||(b==null?void 0:b.event)),z($,"mousemove",this.Yv,{capture:!0}),this.ef=new Bo(this.instance,up,this.Jv.bind(this)),this.ef.startIfEnabledOrStop(),this.if=this.sn.bind(this),z($,Ai,this.if),this.ko=!0)}Zv(){var e;b&&$&&(this.Kv&&b.removeEventListener(ms,this.Kv),this.Xv&&$.removeEventListener("click",this.Xv,{capture:!0}),this.Yv&&$.removeEventListener("mousemove",this.Yv,{capture:!0}),this.if&&$.removeEventListener(Ai,this.if),clearTimeout(this.nf),(e=this.ef)===null||e===void 0||e.stop(),this.ko=!1)}sf(e,t){let i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),r=(function(o,a,l){let c=o;for(;c&&Be(c)&&!_e(c,"body");){if(c===l)return!1;let p;try{var u,d,h;p=(u=(d=(h=c.ownerDocument)===null||h===void 0?void 0:h.defaultView)!==null&&d!==void 0?d:b)===null||u===void 0?void 0:u.getComputedStyle(c).position}catch{return!1}if(A(a,p))return!0;c=hc(c)}return!1})(Ei(e),["fixed","sticky"],n);return{x:e.clientX+(r?0:s),y:e.clientY+(r?0:i),target_fixed:r,type:t}}Ir(e,t="click"){var i;if(Fo(e.target)||!wn(e))return;let s=this.sf(e,t);!((i=this.rageclicks)===null||i===void 0)&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&fc(Ei(e),this.instance.config.rageclick)&&this.Qs(f(f({},s),{},{type:"rageclick"})),this.Qs(s)}tf(e){!Fo(e.target)&&wn(e)&&(clearTimeout(this.nf),this.nf=setTimeout(()=>{this.Qs(this.sf(e,"mousemove"))},500))}Qs(e){if(!b)return;let t=this.Mr.disable_capture_url_hashes?yt(b.location.href):b.location.href,i=this.Mr.custom_personal_data_properties,s=this.Mr.mask_personal_data_properties?[...Qt,...i||[]]:[],n=Oi(t,s,Li);this.Rt=this.Rt||{},this.Rt[n]||(this.Rt[n]=[]),this.Rt[n].push(e)}fl(){this.Rt&&!Me(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Bo,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.Vv=!1,this.ko=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.rf=()=>{clearTimeout(this.af),this.af=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",f({$current_url:this.Rt.url},this.Rt.metrics.reduce((i,s)=>f(f({},i),{},{[`$web_vitals_${s.name}_event`]:f({},s),[`$web_vitals_${s.name}_value`]:s.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.lf=i=>{var s;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},O(i==null?void 0:i.name)||O(i==null?void 0:i.value))return void St.error("Invalid metric received",i);let n=typeof i.navigationURL=="string"?i.navigationURL:void 0,r=this.uf(n);if(S(r))return;let o=oe(i.navigationId)||typeof i.navigationId=="string"?`navigation:${i.navigationId}`:`url:${r}`;if(this.cf&&i.value>=this.cf)return void St.error("Ignoring metric with value >= "+this.cf,i);this.Rt.navigationKey!==o&&(this.rf(),this.af=setTimeout(this.rf,this.flushToCaptureTimeoutMs)),S(this.Rt.navigationKey)&&(this.Rt.navigationKey=o,this.Rt.url=r),this.Rt.firstMetricTimestamp=S(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;let a=(s=this._instance.sessionManager)===null||s===void 0?void 0:s.checkAndGetSessionAndWindowId(!0),l=f(f(f({},i),n?{navigationURL:r}:{}),{},{$current_url:r,timestamp:Date.now()});if(delete l.entries,L(i.attribution)&&this.attributionMetrics.indexOf(i.name)>-1){let c={};for(let u of uf){let d=u==="url"&&typeof i.attribution[u]=="string"?this.uf(i.attribution[u]):i.attribution[u];S(d)||(c[u]=d)}l.attribution=c}else delete l.attribution;S(a)||(l.$session_id=a.sessionId,l.$window_id=a.windowId),this.Rt.metrics.push(l),this.Rt.metrics.length===this.allowedMetrics.length&&this.rf()},this.hf=()=>{if(this.ko)return;let i,s,n,r,o=!1,a=F.__PosthogExtensions__,l=a==null?void 0:a.postHogWebVitalsCallbacksByFlavor,c=(l==null?void 0:l[this.df])||(this.df==="web-vitals"&&S(l)?a==null?void 0:a.postHogWebVitalsCallbacks:void 0);if(!S(c)){let h=c.withoutAttribution,p=this.attributionMetrics;o=!S(h),i=p.indexOf("LCP")>-1?c.onLCP:(h==null?void 0:h.onLCP)||c.onLCP,s=p.indexOf("CLS")>-1?c.onCLS:(h==null?void 0:h.onCLS)||c.onCLS,n=p.indexOf("FCP")>-1?c.onFCP:(h==null?void 0:h.onFCP)||c.onFCP,r=p.indexOf("INP")>-1?c.onINP:(h==null?void 0:h.onINP)||c.onINP}if(!(i&&s&&n&&r))return void St.error("web vitals callbacks not loaded - not starting");let u={reportSoftNavs:this.useSoftNavs},d=o&&this.attributionMetrics.indexOf("INP")>-1?f(f({},u),{},{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&i(this.lf.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&s(this.lf.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&n(this.lf.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&r(this.lf.bind(this),d),this.ko=!0},this.Vv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[Hn]),this.startIfEnabled()}get vf(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;let i=L(this.vf)?(e=this.vf)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return O(i)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||pa:i}get flushToCaptureTimeoutMs(){return(L(this.vf)?this.vf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){let e=L(this.vf)?this.vf.web_vitals_attribution:void 0;return Se(e)?e?pa:[]:R(e)?e:cf}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){let e=L(this.vf)?this.vf.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get cf(){let e=L(this.vf)&&oe(this.vf.__web_vitals_max_value)?this.vf.__web_vitals_max_value:ha;return e>0&&6e4>=e?ha:e}get isEnabled(){let e=K==null?void 0:K.protocol;if(e!=="http:"&&e!=="https:")return St.info("Web Vitals are disabled on non-http/https protocols"),!1;let t=L(this.vf)?this.vf.web_vitals:Se(this.vf)?this.vf:void 0;return Se(t)?t:this.Vv}startIfEnabled(){this.isEnabled&&!this.ko&&(St.info("enabled, starting..."),this.zo(this.hf))}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!("capturePerformance"in t))return;let i=L(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=L(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Hn]:i}),this._instance.persistence.register({[Vl]:s})),this.Vv=i,this.startIfEnabled()}get df(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(e){var t;let i=F.__PosthogExtensions__,s=this.df,n=i==null?void 0:i.postHogWebVitalsCallbacksByFlavor;n!=null&&n[s]||s==="web-vitals"&&S(n)&&(i!=null&&i.postHogWebVitalsCallbacks)?e():i==null||(t=i.loadExternalDependency)===null||t===void 0||t.call(i,this._instance,s,r=>{r?St.error("failed to load script",r):e()})}uf(e){let t=e||(b==null?void 0:b.location.href);if(!t)return void St.error("Could not determine current URL");let i=this._instance.config.disable_capture_url_hashes?yt(t):t,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Qt,...s||[]]:[];return Oi(i,n,Li)}}},Df={exceptionObserver:class{constructor(e){var t;this.hf=()=>{var i;if(!b||!this.isEnabled||!(!((i=F.__PosthogExtensions__)===null||i===void 0)&&i.errorWrappingFunctions))return;let s=F.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=F.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=F.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ff&&this.Mr.capture_unhandled_errors&&(this.ff=s(this.captureException.bind(this))),!this.pf&&this.Mr.capture_unhandled_rejections&&(this.pf=n(this.captureException.bind(this))),!this.gf&&this.Mr.capture_console_errors&&(this.gf=r(this.captureException.bind(this)))}catch(o){vi.error("failed to start",o),this.mf()}},this._instance=e,this.yf=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[jn]),this.wt=new id(f(f({},(function(i={}){var s,n,r,o;return{refillRate:(s=(n=i.exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:i.__exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:1,bucketSize:(r=(o=i.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:i.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:vi})),this.Mr=this.bf(),this.startIfEnabledOrStop()}bf(){let e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return L(e)?t=f(f({},t),e):(S(e)?this.yf:e)&&(t=f(f({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(vi.info("enabled"),this.mf(),this.zo(this.hf)):this.mf()}zo(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"exception-autocapture",n=>{if(n)return vi.error("failed to load script",n);e()})}mf(){var e,t,i;(e=this.ff)===null||e===void 0||e.call(this),this.ff=void 0,(t=this.pf)===null||t===void 0||t.call(this),this.pf=void 0,(i=this.gf)===null||i===void 0||i.call(this),this.gf=void 0}onRemoteConfig(e){if(!e.ok)return;let t=e.config;"autocaptureExceptions"in t&&(this.yf=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[jn]:this.yf}),this.Mr=this.bf(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.bf()}captureException(e){try{var t,i,s;let n=(t=e==null||(i=e.$exception_list)===null||i===void 0||(i=i[0])===null||i===void 0?void 0:i.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(n))return void vi.info("Skipping exception capture because of client rate limiting.",{exception:n});(s=this._instance.exceptions)===null||s===void 0||s.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,i;this._f=[],this.wf=new fd([new Td,new Nd,new Fd,new Id,new Ld,new Od,new Ad,new Dd],(function(s,...n){return(r,o=0)=>{let a=[],l=r.split(`
|
|
3
|
-
`),c=Math.min(l.length,o+1e3),u=[];for(let p=o;c>p;p++){let v=l[p];if(v.length>1024)continue;let _=uo.test(v)?v.replace(uo,"$1"):v;if(!_.match(/\S*Error: /)){for(let g of n){let y=g(_,s);if(y){a.push(y);let m=Ed(a);if(m){for(let w=u.length-1;w>=0;w--){let P=u[w];if(m.start>=P.start+P.length)break;u.pop()}u.push(m)}break}}if(Pd(a,u)>=50)break}}let d=[...u].sort((p,v)=>v.start-p.start),h=d[d.length-1];if(h){let p=ml(a,h);a.splice(h.start-p,p);for(let v of d)v.start-=p}for(let p of d)$d(a,p);return u.some(p=>p.start===0&&a.length===p.length)&&(function(p){let v=p.map(g=>`${g.function}|${g.filename}|${g.lineno}|${g.colno}|${g.module}`),_=0;for(let g=1;v.length>g;g++)Md(v,g,_)&&(_=g);p.push(...p.splice(0,_))})(a),(function(p){if(!p.length)return[];let v=Array.from(p);return v.reverse(),v.slice(0,50).map(_=>{return f(f({},_),{},{filename:_.filename||(g=v,g[g.length-1]||{}).filename,function:_.function||"?"});var g})})(a)}})("web:javascript",wd,Sd)),this._instance=e,this._f=(t=(i=this._instance.persistence)===null||i===void 0?void 0:i.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.kf=ps(this.Sf()),this.xf=new Vd(this.kf)}onConfigChange(){this.kf=ps(this.Sf()),this.xf.setConfig(this.kf)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;let n=e.config;if(!("errorTracking"in n))return;let r=(t=(i=n.errorTracking)===null||i===void 0?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],o=(s=n.errorTracking)===null||s===void 0?void 0:s.captureExtensionExceptions;this._f=r,this._instance.persistence&&this._instance.persistence.register({[Nl]:this._f,[Vn]:o})}get $f(){var e;let t=!!this._instance.get_property(Vn),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i!=null?i:t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.wf.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.kf.enabled)try{if(!D(e)||e.trim().length===0)return void Ne.warn("Ignoring exception step because message must be a non-empty string");let{sanitizedProperties:i,droppedKeys:s}=(function(n){if(!n)return{sanitizedProperties:{},droppedKeys:[]};let r=[];return{sanitizedProperties:Object.keys(n).reduce((o,a)=>jd.has(a)?(r.push(a),o):(o[a]=n[a],o),{}),droppedKeys:r}})(this.Cf(t));s.length>0&&Ne.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.xf.add(f({[ds]:e,[hs]:new Date().toISOString()},i))}catch(i){Ne.error("Failed to add exception step. Ignoring breadcrumb.",i)}}sendExceptionEvent(e){try{let t=e.$exception_list;if(this.Tf(t)){if(this.If(t))return this.Mf("Exception dropped: matched a suppression rule"),void Ne.info("Skipping exception capture because a suppression rule matched");if(!this.$f&&this.Ef(t))return this.Mf("Exception dropped: thrown by a browser extension"),void Ne.info("Skipping exception capture because it was thrown by an extension");if(!this.$f&&this.Pf(t))return this.Mf("Exception dropped: thrown by an injected browser script"),void Ne.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Rf(t))return this.Mf("Exception dropped: thrown by the PostHog SDK"),void Ne.info("Skipping exception capture because it was thrown by the PostHog SDK")}let i=this.kf.enabled&&O(e.$exception_steps)?this.Af(e):e,s=(function(){let n=globalThis._posthogReleaseId;return typeof n=="string"&&n.length>0?n:void 0})();s&&(i.$release_id=s);try{let n=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",fc:!0});return n&&this.xf.clear(),n}catch(n){return Ea(n)||Ne.error("Failed to capture exception event. Dropping this exception.",n),void this.xf.clear()}}catch(t){return void(Ea(t)||Ne.error("Failed to process exception event. Ignoring this exception.",t))}}Af(e){try{let t=this.xf.getAttachable();return t.length===0?e:f(f({},e),{},{$exception_steps:t})}catch(t){return Ne.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Mf(e){this.kf.enabled&&this.xf.add({[ds]:e,[hs]:new Date().toISOString()})}Cf(e){return L(e)?f({},e):{}}Sf(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}If(e){if(e.length===0)return!1;try{let t=e.reduce((i,{type:s,value:n})=>(D(s)&&s.length>0&&i.$exception_types.push(s),D(n)&&n.length>0&&i.$exception_values.push(n),i),{$exception_types:[],$exception_values:[]});return this._f.some(i=>{let s=i.values.map(n=>{let r=Xc[n.operator],o=t[n.key];if(!r||!o)return!1;let a=R(n.value)?n.value:[n.value];return a.length>0&&r(a,o)});return i.type==="OR"?s.some(Boolean):s.every(Boolean)})}catch(t){return Ne.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Ef(e){let t=e.flatMap(s=>{var n,r;return(n=(r=s.stacktrace)===null||r===void 0?void 0:r.frames)!==null&&n!==void 0?n:[]}),i=t.filter(({filename:s})=>!!s&&Ef.some(n=>s.startsWith(n)));return i.length!==0&&(!i.every(({filename:s})=>!!s&&s.startsWith(tr))||e.some(({type:s,value:n})=>s==="NoResponse"||D(n)&&Sf.some(({value:r,exact:o})=>o?n===r:n.includes(r)))&&!t.some(({in_app:s,filename:n})=>s&&!(n!=null&&n.startsWith(tr))))}Pf(e){return e.some(({value:t})=>D(t)&&$f.some(i=>t.includes(i)))}Rf(e){if(e.length>0){var t,i,s,n;let r=(t=(i=e[0].stacktrace)===null||i===void 0?void 0:i.frames)!==null&&t!==void 0?t:[],o=r[r.length-1];return(s=o==null||(n=o.filename)===null||n===void 0?void 0:n.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}Tf(e){return!O(e)&&R(e)}}},Nf=f({productTours:class{get Il(){return this._instance.persistence}constructor(e){this.Ff=null,this.Of=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if("productTours"in t){var i,s;if(this.Il&&this.Il.register({[hr]:!!t.productTours}),!xn(this._instance))return!this.Ff&&O((i=this.Il)===null||i===void 0?void 0:i.props.ph_product_tours)||Ki.info("product tours disabled; stopping and clearing cached tours"),(s=this.Ff)===null||s===void 0||s.stop(),this.Ff=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Ff&&xn(this._instance)&&this.zo(()=>this.Df())}zo(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"product-tours",n=>{n?Ki.error("Could not load product tours script",n):e()})}Df(){var e;!this.Ff&&(!((e=F.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.Ff=F.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(R(this.Of)&&!t)return void e(this.Of,{isLoaded:!0});let i=this.Il;if(i){let s=i.props[Bn];if(R(s)&&!t)return this.Of=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",timestampMode:"query",callback:s=>{if(!xn(this._instance))return void e([],{isLoaded:!0});let n=s.statusCode;if(n!==200||!s.json){let o=`Product Tours API could not be loaded, status: ${n}`;return n===0?s.error||Ki.warn(o):Ki.error(o),void e([],{isLoaded:!1,error:o})}let r=R(s.json.product_tours)?s.json.product_tours:[];this.Of=r,i&&i.register({[Bn]:r}),e(r,{isLoaded:!0})}})}getActiveProductTours(e){O(this.Ff)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ff.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ff)===null||t===void 0||t.showTourById(e)}previewTour(e){this.Ff?this.Ff.previewTour(e):this.zo(()=>{var t;this.Df(),(t=this.Ff)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.Ff)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Ff)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.Ff)===null||e===void 0||e.previousStep()}clearCache(){var e;this.Of=null,(e=this.Il)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.Ff)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.Ff)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Ff)===null||t===void 0||t.cancelPendingTour(e)}}},Is),jf={siteApps:class{constructor(e){this._instance=e,this.Lf=0,this.Nf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}qf(e,t){if(!t)return;let i=this.globalsForEvent(t);this.Nf.push(i),this.Nf.length>1e3&&(this.Nf=this.Nf.slice(10))}get siteAppLoaders(){var e;return(e=F._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){let e=this._instance._addCaptureHook(this.qf.bind(this));this.jf=()=>{e(),this.Nf=[],this.jf=void 0}}}globalsForEvent(e){var t,i,s,n,r,o,a;if(!e)throw new Error("Event payload is required");let l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(let[p,v]of Object.entries(u))l[p]={id:c[p],type:p,properties:v};let{$set_once:d,$set:h}=e;return{event:f(f({},xl(e,pf)),{},{properties:f(f(f({},e.properties),h?{$set:f(f({},(t=(i=e.properties)===null||i===void 0?void 0:i.$set)!==null&&t!==void 0?t:{}),h)}:{}),d?{$set_once:f(f({},(s=(n=e.properties)===null||n===void 0?void 0:n.$set_once)!==null&&s!==void 0?s:{}),d)}:{}),elements_chain:(r=(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&r!==void 0?r:"",distinct_id:(a=e.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}Bf(e){var t;let i=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return i==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Ge.error("prepare_external_dependency_stylesheet returned null"),null):i==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Ge.error("prepare_external_dependency_script returned null"),null):e}zf(){var e,t,i,s,n,r,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};let l=$==null?void 0:$.defaultView,c=l==null||(e=l.Node)===null||e===void 0?void 0:e.prototype;if(!l||!c)return()=>{};if(this.Lf++,this.Hf)return this.Uf();let u=[],d=this,h=new WeakSet,p=(g,y,m)=>{if(!(g!=null&&g[y]))return;let w=g[y];g[y]=m(w),u.push(()=>{g[y]=w})},v=g=>{if(h.has(g))return g;let y=d.Bf(g);return y&&h.add(y),y},_=g=>g.map(y=>typeof y=="string"?y:v(y)).filter(y=>!ne(y));return p(c,"appendChild",g=>function(y){let m=v(y);return m?g.call(this,m):y}),p(c,"insertBefore",g=>function(y,m){let w=v(y);return w?g.call(this,w,m):y}),p(c,"replaceChild",g=>function(y,m){let w=v(y);return w?g.call(this,w,m):m}),[(t=l.Element)===null||t===void 0?void 0:t.prototype,(i=l.Document)===null||i===void 0?void 0:i.prototype,(s=l.DocumentFragment)===null||s===void 0?void 0:s.prototype].forEach(g=>{p(g,"append",y=>function(...m){return y.apply(this,_(m))}),p(g,"prepend",y=>function(...m){return y.apply(this,_(m))})}),[(n=l.Element)===null||n===void 0?void 0:n.prototype,(r=l.CharacterData)===null||r===void 0?void 0:r.prototype,(o=l.DocumentType)===null||o===void 0?void 0:o.prototype].forEach(g=>{p(g,"before",y=>function(...m){return y.apply(this,_(m))}),p(g,"after",y=>function(...m){return y.apply(this,_(m))}),p(g,"replaceWith",y=>function(...m){let w=_(m);return m.length&&!w.length?void 0:y.apply(this,w)})}),p((a=l.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",g=>function(y,m){let w=v(m);return w?g.call(this,y,w):null}),this.Hf=()=>{u.forEach(g=>g()),this.Hf=void 0},this.Uf()}Uf(){let e=!1;return()=>{var t;e||(e=!0,this.Lf--,this.Lf===0&&((t=this.Hf)===null||t===void 0||t.call(this)))}}Wf(e,t=!0){let i=this.zf();try{let s=e(i);return t&&i(),s}catch(s){throw i(),s}}setupSiteApp(e){let t=this.apps[e.id],i=()=>{var r;!t.errored&&this.Nf.length&&(Ge.info(`Processing ${this.Nf.length} events for site app with id ${e.id}`),this.Nf.forEach(o=>this.Wf(()=>{var a;return(a=t.processEvent)===null||a===void 0?void 0:a.call(t,o)})),t.processedBuffer=!0),Object.values(this.apps).every(o=>o.processedBuffer||o.errored)&&((r=this.jf)===null||r===void 0||r.call(this))},s=!1,n=r=>{t.errored=!r,t.loaded=!0,Ge.info(`Site app with id ${e.id} ${r?"loaded":"errored"}`),s&&i()};try{let{processEvent:r}=this.Wf(o=>e.init({posthog:this._instance,callback(a){o(),n(a)}}),!1);r&&(t.processEvent=r),s=!0}catch(r){Ge.error(va+e.id,r),n(!1)}if(s&&t.loaded)try{i()}catch(r){Ge.error(`Error while processing buffered events PostHog app with config id ${e.id}`,r),t.errored=!0}}Vf(){let e=this.siteAppLoaders||[];for(let t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(let t of e)this.setupSiteApp(t)}Gf(e){if(Object.keys(this.apps).length===0)return;let t=this.globalsForEvent(e);for(let i of Object.values(this.apps))try{this.Wf(()=>{var s;return(s=i.processEvent)===null||s===void 0?void 0:s.call(i,t)})}catch(s){Ge.error(`Error while processing event ${e.event} for site app ${i.id}`,s)}}onRemoteConfig(e){var t,i,s;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.Vf(),void this._instance.on("eventCaptured",a=>this.Gf(a))):void Ge.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.jf)===null||i===void 0||i.call(this),!e.ok)return;let n=e.config;if(!((s=n.siteApps)===null||s===void 0)&&s.length)if(this.isEnabled)for(let{id:a,url:l}of n.siteApps){var r,o;F[`__$$ph_site_app_${a}`]=this._instance,(r=F.__PosthogExtensions__)===null||r===void 0||(o=r.loadSiteApp)===null||o===void 0||o.call(r,this._instance,l,c=>{if(c)return Ge.error(va+a,c)})}else Ge.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Vf={tracingHeaders:class{constructor(e){this._instance=e,this.Qf=void 0,this.Zf=void 0,this.Jf=void 0,this.hf=()=>{let t=this.Kf();var i,s;t?(S(this.Qf)&&(this.Qf=(i=F.__PosthogExtensions__)===null||i===void 0||(i=i.tracingHeadersPatchFns)===null||i===void 0?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),S(this.Zf)&&(this.Zf=(s=F.__PosthogExtensions__)===null||s===void 0||(s=s.tracingHeadersPatchFns)===null||s===void 0?void 0:s._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.mf()}}initialize(){this.startIfEnabledOrStop()}zo(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"tracing-headers",n=>{if(n)return lf.error("failed to load script",n);e()})}Xf(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Kf(){let e=this.Xf();return R(e)?(R(this.Jf)?this.Jf.splice(0,this.Jf.length,...e):this.Jf=[...e],e.length>0?this.Jf:void 0):(R(this.Jf)&&this.Jf.splice(0),this.Jf=e||void 0,this.Jf)}mf(){var e,t;(e=this.Qf)===null||e===void 0||e.call(this),(t=this.Zf)===null||t===void 0||t.call(this),this.Qf=void 0,this.Zf=void 0}startIfEnabledOrStop(){this.Kf()?this.zo(this.hf):this.mf()}}},Hf=f({surveys:class extends ff{constructor(e){var t;super(new yf(e),(t=e,{get projectToken(){return t.config.token},kv:new mf(t)})),this._instance=e}Gc(e,t){let i=t.query?Ni(e,t.query):e;return new Promise(s=>{var n;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((n=t.target)!==null&&n!==void 0?n:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:s})})}}},Is),Bf={toolbar:class{constructor(e){this.instance=e}Yf(e){F.ph_toolbar_state=e}tp(){var e;return(e=F.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,i=void 0){var s,n;if(Un(this.instance.config)||!b||!$)return!1;e=(s=e)!==null&&s!==void 0?s:b.location,i=(n=i)!==null&&n!==void 0?n:b.history;try{if(!t){try{b.localStorage.setItem("test","test"),b.localStorage.removeItem("test")}catch{return!1}t=b==null?void 0:b.localStorage}let r=bf||bs(e.hash,"__posthog")||bs(e.hash,"state"),o,a=r?oo(()=>JSON.parse(atob(decodeURIComponent(r))))||oo(()=>JSON.parse(decodeURIComponent(r))):null;return a&&a.action==="ph_authorize"?(o=a,o.source="url",o&&Object.keys(o).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):(o=JSON.parse(t.getItem(_a)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}ep(e){let t=F.ph_load_toolbar||F.ph_load_editor;!O(t)&&le(t)?t(e,this.instance):ma.warn("No toolbar load function found")}loadToolbar(e){let t=!!($!=null&&$.getElementById("__POSTHOG_TOOLBAR__"));if(!b||t)return!1;let i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=f(f({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(b.localStorage.setItem(_a,JSON.stringify(f(f({},s),{},{source:void 0}))),this.tp()===2)this.ep(s);else if(this.tp()===0){var n,r;this.Yf(1),(n=F.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this.instance,"toolbar",o=>{if(o)return ma.error("[Toolbar] Failed to load",o),void this.Yf(0);this.Yf(2),this.ep(s)}),z(b,"turbolinks:load",()=>{this.Yf(0),this.loadToolbar(s)})}return!0}np(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},Wf=f({experiments:class we{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(i=!1)=>{this.getWebExperiments(s=>{we.sp("retrieved web experiments from the server"),this.rp=new Map,s.forEach(n=>{if(n.feature_flag_key){var r;this.rp&&(we.sp("setting flag key ",n.feature_flag_key," to web experiment ",n),(r=this.rp)===null||r===void 0||r.set(n.feature_flag_key,n));let o=this._instance.getFeatureFlag(n.feature_flag_key);D(o)&&n.variants[o]&&this.op(n.name,o,n.variants[o].transforms)}else if(n.variants)for(let o in n.variants){let a=n.variants[o];we.ap(a,this._instance)&&this.op(n.name,o,a.transforms)}})},i)},this._instance.onFeatureFlags(i=>{this.onFeatureFlags(i)})}initialize(){}onFeatureFlags(t){if(this._is_bot())we.sp($a);else if(!this.Mr.disable_web_experiments){if(O(this.rp))return this.rp=new Map,this.loadIfEnabled(),void this.previewWebExperiment();we.sp("applying feature flags",t),t.forEach(i=>{var s;if(this.rp&&(!((s=this.rp)===null||s===void 0)&&s.has(i))){var n;let r=this._instance.getFeatureFlag(i),o=(n=this.rp)===null||n===void 0?void 0:n.get(i);r&&(o!=null&&o.variants[r])&&this.op(o.name,r,o.variants[r].transforms)}})}}previewWebExperiment(){let t=we.getWindowLocation();if(t!=null&&t.search){let i=Kt(t==null?void 0:t.search,"__experiment_id"),s=Kt(t==null?void 0:t.search,"__experiment_variant");i&&s&&(we.sp(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(n=>{this.lp(parseInt(i),s,n)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,s){if(this.Mr.disable_web_experiments&&!s)return t([]);let n=this._instance.get_property("$web_experiments");if(n&&!i)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:r=>t(r.statusCode===200&&r.json&&r.json.experiments||[])})}lp(t,i,s){let n=s.filter(r=>r.id===t);n&&n.length>0&&(we.sp(`Previewing web experiment [${n[0].name}] with variant [${i}]`),this.op(n[0].name,i,n[0].variants[i].transforms))}static ap(t,i){return!O(t.conditions)&&we.up(t,i)&&we.cp(t)}static up(t,i){var s;if(O(t.conditions)||O((s=t.conditions)===null||s===void 0?void 0:s.url))return!0;let n=we.getWindowLocation();if(n){var r,o,a;let l=cc(i,n.href);return!(!((r=t.conditions)===null||r===void 0)&&r.url)||Pf[(o=(a=t.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,l)}return!1}static getWindowLocation(){return b==null?void 0:b.location}static cp(t){var i;if(O(t.conditions)||O((i=t.conditions)===null||i===void 0?void 0:i.utm))return!0;let s=kc();if(s.utm_source){var n,r,o,a,l,c,u,d;let h=!(!((n=t.conditions)===null||n===void 0||(n=n.utm)===null||n===void 0)&&n.utm_campaign)||((r=t.conditions)===null||r===void 0||(r=r.utm)===null||r===void 0?void 0:r.utm_campaign)==s.utm_campaign,p=!(!((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0)&&o.utm_source)||((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==s.utm_source,v=!(!((l=t.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0)&&l.utm_medium)||((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0?void 0:c.utm_medium)==s.utm_medium,_=!(!((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0)&&u.utm_term)||((d=t.conditions)===null||d===void 0||(d=d.utm)===null||d===void 0?void 0:d.utm_term)==s.utm_term;return h&&v&&_&&p}return!1}static sp(t,...i){M.info(`[WebExperiments] ${t}`,i)}op(t,i,s){this._is_bot()?we.sp($a):i!=="control"?s.forEach(n=>{if(n.selector){var r;we.sp(`applying transform of variant ${i} for experiment ${t} `,n);let o=(r=document)===null||r===void 0?void 0:r.querySelectorAll(n.selector);o==null||o.forEach(a=>{let l=a;n.html&&(l.innerHTML=n.html),n.css&&l.setAttribute("style",n.css)})}}):we.sp("Control variants leave the page unmodified.")}_is_bot(){return pe&&this._instance?qc(pe,this.Mr.custom_blocked_useragents):void 0}}},Is),Uf={conversations:class{constructor(e){this._instance=e,this.hp=void 0,this._conversationsManager=null,this.dp=!1,this.ne=null,this.vp=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.fp=e.ok,!e.ok))return;let t=e.config.conversations;O(t)||(Se(t)?this.hp=t:(this.hp=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.hp=void 0,this.ne=null,this.fp=void 0,this.vp=!1}loadIfEnabled(){if(this._conversationsManager||this.dp||this._instance.config.disable_conversations||Un(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;let e=F==null?void 0:F.__PosthogExtensions__;if(e&&!S(this.hp)&&this.hp)if(this.ne&&this.ne.token){this.dp=!0;try{let t=e.initConversations;if(t)return this.pp(t),void(this.dp=!1);let i=e.loadExternalDependency;if(!i)return void this.gp(gr);i(this._instance,"conversations",s=>{s||!e.initConversations?this.gp("Could not load conversations script",s):this.pp(e.initConversations),this.dp=!1})}catch(t){this.gp("Error initializing conversations",t),this.dp=!1}}else Oe.error("Conversations enabled but missing token in remote config.")}pp(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.vp=!1,Oe.info("Conversations loaded successfully")}catch(t){this.gp("Error completing conversations initialization",t)}else Oe.error("Cannot complete initialization: remote config is null")}gp(e,t){Oe.error(e,t),this._conversationsManager=null,this.dp=!1,this.vp=!0}show(){this._conversationsManager?this._conversationsManager.show():Oe.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.hp===!0&&!ne(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Un(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.fp===!1?"remote_config_failed":S(this.hp)?this.fp?"disabled_in_project":"remote_config_pending":this.hp?O(this.ne)||!this.ne.token?"missing_token":F!=null&&F.__PosthogExtensions__?this.dp?"initializing":this.vp?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,i){var s=this;return ee(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(Oe.warn($t),null)})()}getMessages(e,t){var i=this;return ee(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(Oe.warn($t),null)})()}markAsRead(e){var t=this;return ee(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Oe.warn($t),null)})()}getTickets(e){var t=this;return ee(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Oe.warn($t),null)})()}requestRestoreLink(e){var t=this;return ee(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Oe.warn($t),null)})()}restoreFromToken(e){var t=this;return ee(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Oe.warn($t),null)})()}restoreFromUrlToken(){var e=this;return ee(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Oe.warn($t),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}xc(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}$c(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},zf={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.mp=!1,this.yp=!1,this.bp=!1,this.A=re("[logs]"),this._p=f(f({},this.A),{},{error:(...i)=>{i.some(Ta)||this.A.error(...i)}}),this.ol=[],this.wp=[],this.kd=0,this.To=!1,this.kp=[],this.Sp=[],this.xp=!1,this.$p=!1,this.Cp=()=>{var i,s;this.To||(this.kd=0,(i=this.Tp)===null||i===void 0||i.onReconnect(),(s=this.Ip)===null||s===void 0||s.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this.mp=!0),b&&z(b,"online",this.Cp)}Mp(e,t,i,s){var n;let r=Pa((n=this._instance)===null||n===void 0||(n=n.config)===null||n===void 0?void 0:n.logs,i);return[new xh(this.Ep(e,t),r,this._p,()=>this.Pp(),o=>o(),void 0,s),r]}Rp(){var e;let t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var i;return this.Tp&&this.Ap===t||((i=this.Tp)===null||i===void 0||i.reset(),this.Ap=t,[this.Tp,this.Fp]=this.Mp(()=>this.ol,s=>{this.ol=s})),this.Tp}Op(){var e;let t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var i;return this.Ip&&this.Dp===t||((i=this.Ip)===null||i===void 0||i.reset(),this.Dp=t,[this.Ip,this.Lp]=this.Mp(()=>this.wp,s=>{this.wp=s},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Ma)),this.Ip}setup(e){var t;if(this.To)return;this.bo=e,!((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0||(t=t.logs)===null||t===void 0)&&t.captureConsoleLogs&&(this.mp=!0),(this.mp||this.Np()&&this.qp())&&this.jp();let i=!1,s=e.onRemoteConfig(n=>{var r;i=n.ok&&((r=n.config.logs)===null||r===void 0?void 0:r.captureConsoleLogs)===!0,this.onRemoteConfig(n)});this.To?s.dispose():(this.Eo=s,i||this.loadIfEnabled())}dispose(){var e,t,i,s;this.To||(this.To=!0,this.Bp(),(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.bo=void 0,this.bp=!1,b==null||b.removeEventListener("online",this.Cp),(t=this.zp)===null||t===void 0||t.call(this),this.zp=void 0,(i=this.Tp)===null||i===void 0||i.reset(),(s=this.Ip)===null||s===void 0||s.reset())}onRemoteConfig(e){var t,i;if(this.To)return;let s=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;O(s)?this.Hp():((i=this._instance)===null||i===void 0||(i=i.persistence)===null||i===void 0||i.register({$logs_capture_enabled_server_side:!!s}),s?(this.mp=!0,this.yp||this.jp(),this.loadIfEnabled()):this.Hp())}reset(){var e,t,i,s;this.Bp(),(e=this.Tp)===null||e===void 0||e.clearQueue(),this.ol=[],(t=this.Tp)===null||t===void 0||t.reset(),(i=this.Ip)===null||i===void 0||i.clearQueue(),this.wp=[],(s=this.Ip)===null||s===void 0||s.reset(),this.kd=0}captureLog(e){this.To||this.Rp().captureLog(e)}captureConsoleLog(e){this.To||this.Op().captureLog(e)}captureBufferedConsoleLog(e,t,i){this.To||this.Op().captureLog(e,{context:t,occurredAtMs:i})}qp(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[jl])}Np(){var e,t,i;return!(!((e=this._instance)===null||e===void 0||(t=e.il)===null||t===void 0)&&t.call(e))||!!(!((i=F._POSTHOG_REMOTE_CONFIG)===null||i===void 0||(i=i[this._instance.config.token])===null||i===void 0)&&i.config)}Tc(){var e;this.Bp(),(e=this.Ip)===null||e===void 0||e.clearQueue(),this.wp=[]}Hp(){this.mp||this.Bp()}jp(){var e;if(this.xp||!(F!=null&&F.console))return;let t=Pa((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize,i=!0;this.Sp.push(()=>{i=!1});for(let s of Mf){let n;try{n=Tf(F.console[s])}catch{continue}n&&this.Sp.push(ti(F.console,s,r=>{let o=(...a)=>{try{i&&this.Up(s,a,t)}catch{}return r.apply(F.console,a)};return o.__rrweb_original__=n,o}))}this.xp=!0,this.Wp=setTimeout(()=>{this.Bp()},3e4)}Up(e,t,i){var s;if(this.xp&&!this.$p&&t.length!==0)if(!((s=this._instance)===null||s===void 0)&&s.is_capturing()){if(i>this.kp.length){this.$p=!0;try{this.kp.push({level:e,args:t,occurredAtMs:Date.now(),context:this.Pp()})}finally{this.$p=!1}}}else this.Bp()}Bp(){if(this.kp=[],this.xp){this.xp=!1,this.Wp&&(clearTimeout(this.Wp),this.Wp=void 0);for(let e of this.Sp)e();this.Sp=[]}}Vp(){let e=this.kp;return this.Bp(),e}get logger(){return this.Gp||(this.Gp={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Gp}flushLogs(e){e?this.Qp(e):(this.Tp&&this.Tp.flush().catch(t=>this.Zp(t)),this.Ip&&this.Ip.flush().catch(t=>this.Zp(t)))}Zp(e){Ta(e)||this.A.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.To||!this.mp||this.yp||this.bp)return;let e=F==null?void 0:F.__PosthogExtensions__;if(!e)return this.A.error("PostHog Extensions not found."),void this.Bp();let t=e.loadExternalDependency;if(!t)return this.A.error(gr),void this.Bp();this.bp=!0;try{t(this._instance,"logs",i=>{if(this.bp=!1,this.To||!this.mp)return;let s=e.logs;if(i||!(s!=null&&s.initializeLogs))this.A.error("Could not load logs script",i),this.Bp();else{var n;let a=this.Vp();var r,o;this.zp=s.initializeLogs((n=this.bo)!==null&&n!==void 0?n:this._instance),this.yp=!0,a.length>0&&((r=s.replayConsoleBuffer)===null||r===void 0||r.call(s,(o=this.bo)!==null&&o!==void 0?o:this._instance,a))}})}catch(i){throw this.bp=!1,i}}Ep(e,t){let i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:s=>s===Ze.LogsQueue?e():void 0,setPersistedProperty(s,n){var r;s===Ze.LogsQueue&&t((r=n)!==null&&r!==void 0?r:[])},js:s=>this.js(s),getLibraryId:()=>ue.LIB_NAME,getLibraryVersion:()=>ue.LIB_VERSION}}js(e){return new Promise(t=>{if(wc(this.kd,3))return void t({kind:"fatal",error:Sn(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1,s=r=>{i||(i=!0,clearTimeout(n),t(r))},n=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:Sn(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Jp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:r=>{let o=r.statusCode;if(this.Kp(o),o>=200&&300>o)s({kind:"ok"});else if(o===413)s({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)s({kind:"fatal",error:new Error(`logs request failed with status ${o}`)});else{var a;o===0?(r.error||this.A.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:Sn(r.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:(a=r.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${o}`)})}}})})}Kp(e){(e!==0||this._instance.__loaded)&&(this.kd=xc(e,this.kd,3,()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Qp(e){this.ol.length>0&&this.Xp(e,this.ol,this.Fp,ue.LIB_NAME,t=>{this.ol=t}),this.wp.length>0&&this.Xp(e,this.wp,this.Lp,Ma,t=>{this.wp=t})}Xp(e,t,i,s,n){if(t.length===0)return;let r=t.map(a=>a.record);n([]);let o=Cl(r,Fl(i,ue.LIB_NAME,ue.LIB_VERSION),s,ue.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Jp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}Jp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Pp(){var e;let t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){let{sessionId:i,windowId:s,sessionStartTimestamp:n,lastActivityTimestamp:r}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i,t.windowId=s,O(n)||(t.sessionStartTimestamp=n),O(r)||(t.lastActivityTimestamp=r)}if(!(F==null||(e=F.location)===null||e===void 0)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?yt(F.location.href):F.location.href),this._instance.featureFlags){let i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}},Gf={metrics:class{constructor(e){this._instance=e,this.A=re("[metrics]"),this.To=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.To)return;let t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.Yp?this.Yp=(i=>{let s=!0,n=()=>s?(a=>{var l;let c=(l=a.config.metrics)===null||l===void 0?void 0:l.network;return c===!0?{}:c||void 0})(i):void 0,r=Cf(i,n),o=Af(i,n);return()=>{s=!1,r(),o()}})(this._instance):!t&&this.Yp&&(this.Yp(),this.Yp=void 0)}Rp(){var e;let t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var i;return this.Tp&&this.Ap===t||((i=this.Tp)===null||i===void 0||i.reset(),this.Ap=t,this.Tp=new kh(this.Ep(),(function(s){var n,r,o,a,l;let c=s==null?void 0:s.resourceAttributes;return{serviceName:(n=c==null?void 0:c["service.name"])!==null&&n!==void 0?n:s==null?void 0:s.serviceName,serviceVersion:(r=c==null?void 0:c["service.version"])!==null&&r!==void 0?r:s==null?void 0:s.serviceVersion,environment:(o=c==null?void 0:c["deployment.environment"])!==null&&o!==void 0?o:s==null?void 0:s.environment,resourceAttributes:c,beforeSend:s==null?void 0:s.beforeSend,flushIntervalMs:(a=s==null?void 0:s.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(l=s==null?void 0:s.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(t),this.A)),this.Tp}count(e,t=1,i){this.Rp().count(e,t,i)}gauge(e,t,i){this.Rp().gauge(e,t,i)}histogram(e,t,i){this.Rp().histogram(e,t,i)}flush(e){if(!this.Tp)return Promise.resolve();if(e){let t=this.Tp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.Tp.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.Tp)===null||e===void 0||e.reset()}dispose(){var e,t;this.To=!0,(e=this.Yp)===null||e===void 0||e.call(this),this.Yp=void 0,(t=this.Tp)===null||t===void 0||t.reset()}Ep(){let e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:i=>t.Ys(i),getLibraryId:()=>ue.LIB_NAME,getLibraryVersion:()=>ue.LIB_VERSION}}Ys(e,t){return new Promise(i=>{let s=!1,n=o=>{s||(s=!0,clearTimeout(r),i(o))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(f(f({method:"POST",url:this.tg(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(o){let a=o.statusCode;if(a>=200&&300>a)n({kind:"ok"});else if(a===413)n({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)n({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var l;n({kind:"retry-later",error:(l=o.error)!==null&&l!==void 0?l:new Error(`metrics request failed with status ${a}`)})}}}))})}tg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},qf={webMCP:class{constructor(e){this._instance=e,this.eg=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.eg)return;let e=$==null?void 0:$.modelContext;if(!e||!le(e.registerTool))return;let t=Ia.get(e);if(t)return t.instances.add(this._instance),void(this.eg=!0);let i={instances:new Set([this._instance])},s=e.registerTool,n=this;ti(e,"registerTool",r=>{let o=r;return function(a,...l){let c=a;try{c=n.ig(a,i)}catch{return o.call(this,a,...l)}return o.call(this,c,...l)}}),e.registerTool!==s&&(Ia.set(e,i),this.eg=!0)}ig(e,t){if(!e||!le(e.execute))return e;let i=e.execute,s=this,{tool:n,injected:r}=(function(o,a){let l={intent:!1,model:!1},c=o.inputSchema;if(c&&(ht(c,"$ref")||ht(c,"oneOf")||ht(c,"anyOf")||ht(c,"allOf")||c.additionalProperties===!0||L(c.additionalProperties)||c.type&&c.type!=="object"||c.properties&&!L(c.properties)||c.required&&!R(c.required))||!S(c)&&!L(c))return{tool:En(o),injected:l};let u=(c==null?void 0:c.properties)||{};if(l.intent=a.intent&&!ht(u,"context"),l.model=a.model&&!ht(u,"llm_model"),!l.intent&&!l.model)return{tool:En(o),injected:l};let d=f({},u),h=R(c==null?void 0:c.required)?[...c.required]:[];return l.intent&&(d.context={type:"string",description:`Explain why this tool is called and how it supports the user's goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".`},h.includes("context")||h.push("context")),l.model&&(d.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},h.includes("llm_model")||h.push("llm_model")),{tool:En(o,f(f({},c),{},{type:(c==null?void 0:c.type)||"object",properties:d,required:h})),injected:l}})(e,(function(o){let a={intent:!1,model:!1};for(let l of o.instances){let c=Fa(l.config.capture_webmcp);a.intent||(a.intent=(c==null?void 0:c.intent)===!0),a.model||(a.model=(c==null?void 0:c.model)===!0)}return a})(t));return Object.defineProperty(n,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){let a=new Date,l=(function(h,p){if(!L(h))return{};try{let v=p.intent?Ca(h.context,2048,!0):void 0,_=p.model?Ca(h.llm_model,256):void 0;return f(f({},v&&v!=="{}"?{intent:v}:{}),_&&_.toLowerCase()!=="unknown"?{model:_}:{})}catch{return{}}})(o[0],r),c=(function(h,p){let v=h[0];if(!L(v))return h;try{let _=p.intent&&ht(v,"context"),g=p.model&&ht(v,"llm_model");if(!_&&!g)return h;let y=f({},v);return _&&delete y.context,g&&delete y.llm_model,[y,...h.slice(1)]}catch{return h}})(o,r),u;try{u=i.apply(this===n?e:this,c)}catch(h){throw s.ng(t,n,a,!0,l),h}return(d=u)&&typeof d.then=="function"?Promise.resolve(u).then(h=>(s.ng(t,n,a,Aa(h),l),h),h=>{throw s.ng(t,n,a,!0,l),h}):(s.ng(t,n,a,Aa(u),l),u);var d}}),n}ng(e,t,i,s,n){let r=Date.now()-i.getTime();for(let o of e.instances){let a=Fa(o.config.capture_webmcp);if(a)try{o.capture("$mcp_tool_call",f(f({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:t.name,$mcp_resource_name:t.name,$mcp_tool_description:t.description,$mcp_server_name:K==null?void 0:K.hostname,$mcp_duration_ms:r,$mcp_is_error:s},a.intent&&n.intent?{$mcp_intent:n.intent,$mcp_intent_source:"context_parameter"}:{}),a.model&&n.model?{$mcp_llm_model:n.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:i})}catch{continue}}}}};Ti.__defaultExtensionClasses=f({},f(f(f(f(f(f(f(f(f(f(f(f(f(f({},Is),Of),Lf),Df),Nf),jf),Hf),Vf),Bf),Wf),Uf),zf),Gf),qf));var Zf=(function(){ue.SDK_DIST_CHANNEL="npm";let e=Pi[mi]=new Ti;return(function(){function t(){t.done||(t.done=!0,zc=!1,q(Pi,function(i){i._dom_loaded()}))}$!=null&&$.addEventListener?$.readyState==="complete"?t():z($,"DOMContentLoaded",t,{capture:!1}):b&&M.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})(),Xe=Zf;var mu="5.3.0";function Yf(e,t){for(let i=0,s=e.length;i<s;++i)if(e[i]===t)return!0;return!1}function Xf(e,t){return!Yf(e,t)}function Cr(e){return parseInt(e)}function We(e){return parseFloat(e)}function rt(e,t){return typeof e=="number"&&isNaN(e)?t:e}function ve(e){return e.reduce((t,i)=>t+(i?1:0),0)}function yu(e,t=1){if(Math.abs(t)>=1)return Math.round(e/t)*t;{let i=1/t;return Math.round(e*i)/i}}function Jf(e){var t,i;let s=`Unexpected syntax '${e}'`,n=/^\s*([a-z-]*)(.*)$/i.exec(e),r=n[1]||void 0,o={},a=/([.:#][\w-]+|\[.+?\])/gi,l=(c,u)=>{o[c]=o[c]||[],o[c].push(u)};for(;;){let c=a.exec(n[2]);if(!c)break;let u=c[0];switch(u[0]){case".":l("class",u.slice(1));break;case"#":l("id",u.slice(1));break;case"[":{let d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(u);if(d)l(d[1],(i=(t=d[4])!==null&&t!==void 0?t:d[5])!==null&&i!==void 0?i:"");else throw new Error(s);break}default:throw new Error(s)}}return[r,o]}function Kf(e){let t=new Uint8Array(e.length);for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);if(s>127)return new TextEncoder().encode(e);t[i]=s}return t}function Qf(e){var t;return{name:e.name,message:e.message,stack:(t=e.stack)===null||t===void 0?void 0:t.split(`
|
|
4
|
-
`),...e}}function ev(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function bu(){let e=window,t=navigator;return ve(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function tv(){let e=window,t=navigator;return ve(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!bu()}function oi(){let e=window,t=navigator;return ve(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,(t.vendor||"").indexOf("Google")===0,"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function Ue(){let e=window,t=navigator;return ve(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,t.vendor.indexOf("Apple")===0,"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function Ar(){let e=window,{HTMLElement:t,Document:i}=e;return ve(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),i&&"pointerLockElement"in i.prototype])>=4}function Vi(){let e=window;return ev(e.print)&&String(e.browser)==="[object WebPageNamespace]"}function Hi(){var e,t;let i=window;return ve(["buildID"in navigator,"MozAppearance"in((t=(e=document.documentElement)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{}),"onmozfullscreenchange"in i,"mozInnerScreenX"in i,"CSSMozDocumentRule"in i,"CanvasCaptureMediaStream"in i])>=4}function iv(){let e=window,t=navigator,{CSS:i}=e;return ve(["userActivation"in t,i.supports("color","light-dark(#000, #fff)"),i.supports("height","1lh"),"globalPrivacyControl"in t])>=3}function wu(){let{CSS:e}=window;return ve([e.supports("selector(::details-content)"),e.supports("selector(::before::marker)"),e.supports("selector(::after::marker)"),!("locale"in CompositionEvent.prototype)])>=3}function sv(){let e=window;return ve([!("MediaSettingsRange"in e),"RTCEncodedAudioFrame"in e,`${e.Intl}`=="[object Intl]",`${e.Reflect}`=="[object Reflect]"])>=3}function nv(){let e=window,{URLPattern:t}=e;return ve(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}function rv(){let e=window,t=document,{CSS:i,Promise:s,AudioContext:n}=e;return ve([s&&"try"in s,"caretPositionFromPoint"in t,n&&"onerror"in n.prototype,i.supports("ruby-align","space-around")])>=3}function ov(){let e=window;return ve(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}function Bi(){let e=window,t=navigator,{CSS:i,HTMLButtonElement:s}=e;return ve([!("getStorageUpdates"in t),s&&"popover"in s.prototype,"CSSCounterStyleRule"in e,i.supports("font-size-adjust: ex-height 0.5"),i.supports("text-transform: full-width")])>=4}function av(){if(navigator.platform==="iPad")return!0;let e=screen,t=e.width/e.height;return ve(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function lv(){let e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function cv(){let e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function Os(){var e,t;let i=oi(),s=Hi(),n=window,r=navigator;return i?ve([dv(),"HTMLInputElement"in n&&"capture"in HTMLInputElement.prototype,"NetworkInformation"in n&&"ontypechange"in((t=(e=n.NetworkInformation)===null||e===void 0?void 0:e.prototype)!==null&&t!==void 0?t:{}),!("sinkId"in new Audio)])>=2:s?ve(["onorientationchange"in n,"orientation"in n,/android/i.test(r.appVersion)])>=2:!1}function uv(){let e=navigator,t=window,i=Audio.prototype,{visualViewport:s}=t;return ve(["srLatency"in i,"srChannelCount"in i,"devicePosture"in e,s&&"segments"in s,"getTextInformation"in Image.prototype])>=3}function dv(){var e,t;try{return!!(!((t=(e=window.Intl)===null||e===void 0?void 0:e.supportedValuesOf)===null||t===void 0)&&t.call(e,"collation").includes("dict"))}catch{return!1}}var hv="$ if upgrade to Pro: https://fingerprint.com/github/?utm_source=oss&utm_medium=referral&utm_campaign=confidence_score";function pv(e){let t=fv(e),i=vv(t);return{score:t,comment:hv.replace(/\$/g,`${i}`)}}function fv(e){if(Os())return .4;if(Ue())return Ar()&&!(Bi()&&Vi())?.5:.3;let t="value"in e.platform?e.platform.value:"";return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function vv(e){return yu(.99+.01*e,1e-4)}function Rs(e,t){return new Promise(i=>setTimeout(i,e,t))}function gv(){return new Promise(e=>{let t=new MessageChannel;t.port1.onmessage=()=>e(),t.port2.postMessage(null)})}function _v(e,t=1/0){let{requestIdleCallback:i}=window;return i?new Promise(s=>i.call(window,()=>s(),{timeout:t})):Rs(Math.min(e,t))}function xu(e){return!!e&&typeof e.then=="function"}function ru(e,t){try{let i=e();xu(i)?i.then(s=>t(!0,s),s=>t(!1,s)):t(!0,i)}catch(i){t(!1,i)}}async function ou(e,t,i=16){let s=Array(e.length),n=Date.now();for(let r=0;r<e.length;++r){s[r]=t(e[r],r);let o=Date.now();o>=n+i&&(n=o,await gv())}return s}function ji(e){return e.then(void 0,()=>{}),e}function mv(e){return typeof e!="function"}function yv(e,t){let i=ji(new Promise(s=>{let n=Date.now();ru(e.bind(null,t),(...r)=>{let o=Date.now()-n;if(!r[0])return s(()=>({error:r[1],duration:o}));let a=r[1];if(mv(a))return s(()=>({value:a,duration:o}));s(()=>new Promise(l=>{let c=Date.now();ru(a,(...u)=>{let d=o+Date.now()-c;if(!u[0])return l({error:u[1],duration:d});l({value:u[1],duration:d})})}))})}));return function(){return i.then(n=>n())}}function bv(e,t,i,s){let n=Object.keys(e).filter(o=>Xf(i,o)),r=ji(ou(n,o=>yv(e[o],t),s));return async function(){let a=await r,l=await ou(a,d=>ji(d()),s),c=await Promise.all(l),u={};for(let d=0;d<n.length;++d)u[n[d]]=c[d];return u}}async function ku(e,t,i=50){var s,n,r;let o=document;for(;!o.body;)await Rs(i);let a=o.createElement("iframe");try{for(await new Promise((l,c)=>{let u=!1,d=()=>{u=!0,l()},h=_=>{u=!0,c(_)};a.onload=d,a.onerror=h;let{style:p}=a;p.setProperty("display","block","important"),p.position="absolute",p.top="0",p.left="0",p.visibility="hidden",t&&"srcdoc"in a?a.srcdoc=t:a.src="about:blank",o.body.appendChild(a);let v=()=>{var _,g;u||(((g=(_=a.contentWindow)===null||_===void 0?void 0:_.document)===null||g===void 0?void 0:g.readyState)==="complete"?d():setTimeout(v,10))};v()});!(!((n=(s=a.contentWindow)===null||s===void 0?void 0:s.document)===null||n===void 0)&&n.body);)await Rs(i);return await e(a,a.contentWindow)}finally{(r=a.parentNode)===null||r===void 0||r.removeChild(a)}}function wv(e){let[t,i]=Jf(e),s=document.createElement(t!=null?t:"div");for(let n of Object.keys(i)){let r=i[n].join(" ");n==="style"?xv(s.style,r):s.setAttribute(n,r)}return s}function xv(e,t){for(let i of t.split(";")){let s=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(i);if(s){let[,n,r,,o]=s;e.setProperty(n,r,o||"")}}}function kv(){let e=window;for(;;){let t=e.parent;if(!t||t===e)return!1;try{if(t.location.origin!==e.location.origin)return!0}catch(i){if(i instanceof Error&&i.name==="SecurityError")return!0;throw i}e=t}}function Sv(){let{ApplePaySession:e}=window;if(typeof(e==null?void 0:e.canMakePayments)!="function")return-1;if(Ev())return-3;try{return e.canMakePayments()?1:0}catch(t){return $v(t)}}var Ev=kv;function $v(e){if(e instanceof Error&&e.name==="InvalidAccessError"&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function Pv(){let e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function Mv(){return Fv()?-4:Tv()}function Tv(){let e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(Iv())return-1;let i=4500,s=5e3,n=new t(1,s,44100),r=n.createOscillator();r.type="triangle",r.frequency.value=1e4;let o=n.createDynamicsCompressor();o.threshold.value=-50,o.knee.value=40,o.ratio.value=12,o.attack.value=0,o.release.value=.25,r.connect(o),o.connect(n.destination),r.start(0);let[a,l]=Cv(n),c=ji(a.then(u=>Av(u.getChannelData(0).subarray(i)),u=>{if(u.name==="timeout"||u.name==="suspended")return-3;throw u}));return()=>(l(),c)}function Iv(){return Ue()&&!Ar()&&!ov()}function Fv(){return Ue()&&Bi()&&Vi()||oi()&&uv()&&nv()}function Cv(e){let r=()=>{};return[new Promise((a,l)=>{let c=!1,u=0,d=0;e.oncomplete=v=>a(v.renderedBuffer);let h=()=>{setTimeout(()=>l(au("timeout")),Math.min(500,d+5e3-Date.now()))},p=()=>{try{let v=e.startRendering();switch(xu(v)&&ji(v),e.state){case"running":d=Date.now(),c&&h();break;case"suspended":document.hidden||u++,c&&u>=3?l(au("suspended")):setTimeout(p,500);break}}catch(v){l(v)}};p(),r=()=>{c||(c=!0,d>0&&h())}}),r]}function Av(e){let t=0;for(let i=0;i<e.length;++i)t+=Math.abs(e[i]);return t}function au(e){let t=new Error(e);return t.name=e,t}function Rv(){if(!(Os()||Ue()))return-2;if(!window.AudioContext)return-1;let t=new AudioContext().baseLatency;return t==null?-1:isFinite(t)?t:-3}function Ov(){return Lv(Wv())}function Lv(e){let t=!1,i,s,[n,r]=Dv();return Nv(n,r)?(t=jv(r),e?i=s="skipped":[i,s]=Vv(n,r)):i=s="unsupported",{winding:t,geometry:i,text:s}}function Dv(){let e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}function Nv(e,t){return!!(t&&e.toDataURL)}function jv(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}function Vv(e,t){Hv(e,t);let i=Pr(e),s=Pr(e);return i!==s?["unstable","unstable"]:(Bv(e,t),[Pr(e),i])}function Hv(e,t){e.width=240,e.height=60,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"';let i="Cwm fjordbank gly \u{1F603}";t.fillText(i,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(i,4,45)}function Bv(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(let[i,s,n]of[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]])t.fillStyle=i,t.beginPath(),t.arc(s,n,40,0,Math.PI*2,!0),t.closePath(),t.fill();t.fillStyle="#f9c",t.arc(60,60,60,0,Math.PI*2,!0),t.arc(60,60,20,0,Math.PI*2,!0),t.fill("evenodd")}function Pr(e){return e.toDataURL()}function Wv(){let e=Ue()&&Bi()&&Vi(),t=Hi()&&iv();return e||t}function Uv(){return window.screen.colorDepth}function zv(){for(let e of["rec2020","p3","srgb"])if(matchMedia(`(color-gamut: ${e})`).matches)return e}function Gv(){if(si("no-preference"))return 0;if(si("high")||si("more"))return 1;if(si("low")||si("less"))return-1;if(si("forced"))return 10}function si(e){return matchMedia(`(prefers-contrast: ${e})`).matches}function qv(){let e=document;try{e.cookie="cookietest=1; SameSite=Strict;";let t=e.cookie.indexOf("cookietest=")!==-1;return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch{return!1}}function Zv(){return navigator.cpuClass}function Yv(){if(!window.Intl)return-1;let e=window.Intl.DateTimeFormat;if(!e)return-2;let t=e().resolvedOptions().locale;return!t&&t!==""?-3:t}function Xv(){return rt(We(navigator.deviceMemory),void 0)}function Jv(){let e=atob;return{abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',e("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",e("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",e("LnNwb25zb3JpdA=="),".ylamainos",e("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",e("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",e("LmhlYWRlci1ibG9ja2VkLWFk"),e("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",e("I2FkXzMwMFgyNTA="),e("I2Jhbm5lcmZsb2F0MjI="),e("I2NhbXBhaWduLWJhbm5lcg=="),e("I0FkLUNvbnRlbnQ=")],adGuardChinese:[e("LlppX2FkX2FfSA=="),e("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",e("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),e("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",e("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",e("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",e("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),e("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),e("LmFkZ29vZ2xl"),e("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[e("YW1wLWF1dG8tYWRz"),e("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",e("I2FkX2ludmlld19hcmVh")],adGuardRussian:[e("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),e("LnJlY2xhbWE="),'div[id^="smi2adblock"]',e("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[e("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),e("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",e("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),e("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),e("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",e("I3Jla2xhbWk="),e("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),e("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),e("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[e("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",e("LndpZGdldF9wb19hZHNfd2lkZ2V0"),e("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",e("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[e("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),e("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",e("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",e("I3Jla2xhbW5pLWJveA=="),e("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",e("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[e("I2FkdmVydGVudGll"),e("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",e("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",e("LnNwb25zb3JsaW5rZ3J1ZW4="),e("I3dlcmJ1bmdza3k="),e("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),e("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[e("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",e("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[e("LnJla2xhbW9zX3RhcnBhcw=="),e("LnJla2xhbW9zX251b3JvZG9z"),e("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),e("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),e("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[e("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[e("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),e("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",e("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[e("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),e("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),e("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",e("LmFkX19tYWlu"),e("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[e("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[e("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),e("I2xpdmVyZUFkV3JhcHBlcg=="),e("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),e("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[e("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",e("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),e("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),e("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[e("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),e("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),e("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",e("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),e("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),e("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),e("ZGl2I3NrYXBpZWNfYWQ=")],ro:[e("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),e("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[e("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),e("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),e("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",e("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),e("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",e("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]}}async function Kv({debug:e}={}){if(!Qv())return;let t=Jv(),i=Object.keys(t),s=[].concat(...i.map(o=>t[o])),n=await eg(s);e&&tg(t,n);let r=i.filter(o=>{let a=t[o];return ve(a.map(c=>n[c]))>a.length*.6});return r.sort(),r}function Qv(){return Ue()||Os()}async function eg(e){var t;let i=document,s=i.createElement("div"),n=new Array(e.length),r={};lu(s);for(let o=0;o<e.length;++o){let a=wv(e[o]);a.tagName==="DIALOG"&&a.show();let l=i.createElement("div");lu(l),l.appendChild(a),s.appendChild(l),n[o]=a}for(;!i.body;)await Rs(50);i.body.appendChild(s);try{for(let o=0;o<e.length;++o)n[o].offsetParent||(r[e[o]]=!0)}finally{(t=s.parentNode)===null||t===void 0||t.removeChild(s)}return r}function lu(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function tg(e,t){let i="DOM blockers debug:\n```";for(let s of Object.keys(e)){i+=`
|
|
1
|
+
var b="u">typeof window?window:void 0,be="u">typeof globalThis?globalThis:b,pe=be==null?void 0:be.navigator,E=be==null?void 0:be.document,K=be==null?void 0:be.location,Ii=be==null?void 0:be.fetch,sr=be!=null&&be.XMLHttpRequest&&"withCredentials"in new be.XMLHttpRequest?be.XMLHttpRequest:void 0,to=be==null?void 0:be.AbortController,id=be==null?void 0:be.CompressionStream,xe=pe==null?void 0:pe.userAgent,ai=typeof globalThis!="undefined"?globalThis:b;ai&&typeof self=="undefined"&&(ai.self=ai),ai&&typeof File=="undefined"&&(ai.File=function(){});var F=b!=null?b:{},io="0.9.2",st={DEBUG:!1,LIB_VERSION:io,LIB_NAME:"browser-common",JS_SDK_VERSION:io},Ye=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),$n=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),sd=["$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"],nd=["token"];function A(e,t){return e.indexOf(t)!==-1}var Zt=function(e){return e.trim()},Pn=function(e){return e.replace(/^\$/,"")};function Da(e){var t;let i=[];return(t=JSON.stringify(e,function(s,n){if(typeof n=="bigint")return n.toString();if(typeof n!="function"&&typeof n!="symbol"){if(n instanceof Error)return{name:n.name,message:n.message,stack:n.stack};if(n&&typeof n=="object"){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(n))return"[Circular]";i.push(n)}return n}}))!==null&&t!==void 0?t:"null"}var Na=Object.prototype,nr=Na.hasOwnProperty,Ps=Na.toString,O=Array.isArray||function(e){return Ps.call(e)==="[object Array]"},le=e=>typeof e=="function",j=e=>e===Object(e)&&!O(e),Me=e=>{if(j(e)){for(let t in e)if(nr.call(e,t))return!1;return!0}return!1},x=e=>e===void 0,V=e=>Ps.call(e)=="[object String]",yi=e=>V(e)&&e.trim().length===0,ne=e=>e===null,L=e=>x(e)||ne(e),oe=e=>Ps.call(e)=="[object Number]"&&e==e,Qe=e=>oe(e)&&e>0,Se=e=>Ps.call(e)==="[object Boolean]",rd=e=>A(sd,e),od=e=>A(nd,e);function ja(e){return e===null||typeof e!="object"}function as(e,t){return{}.toString.call(e)===`[object ${t}]`}function ii(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return Va(e,Error)}}function rr(e){return"u">typeof Event&&Va(e,Event)}function Va(e,t){try{return e instanceof t}catch{return!1}}var ad=[!0,"true",1,"1","yes"],js=e=>A(ad,e),ld=[!1,"false",0,"0","no"];function so(e,t,i,s,n,r,o){try{var a=e[r](o),l=a.value}catch(c){return void i(c)}a.done?t(l):Promise.resolve(l).then(s,n)}function ee(e){return function(){var t=this,i=arguments;return new Promise(function(s,n){var r=e.apply(t,i);function o(l){so(r,s,n,o,a,"next",l)}function a(l){so(r,s,n,o,a,"throw",l)}o(void 0)})}}var cd=["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","pinterestbot","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"],Ui=new Map,no=function(e,t=[]){if(!e)return!1;let i=(function(o,a){let l="";for(let c=0;a.length>c;c++){let u=a[c];l+=u.length+":"+u}return o.length+":"+o+"|"+a.length+":"+l})(e,t),s=Ui.get(i);if(s!==void 0)return s;let n=e.toLowerCase(),r=cd.concat(t).some(o=>n.indexOf(o.toLowerCase())!==-1);return 256>Ui.size||Ui.clear(),Ui.set(i,r),r};function Xe(e,t,i,s,n){return t>i&&(s.warn("min cannot be greater than max."),t=i),oe(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(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: "+n),Xe(n!=null?n:i,t,i,s))}var ud=class{constructor(e){this.C={},this.I=e.I,this.R=Xe(e.bucketSize,0,100,e.A),this.$=Xe(e.refillRate,0,this.R,e.A),this.O=Xe(e.refillInterval,0,864e5,e.A)}F(e,t){let i=Math.floor((t-e.lastAccess)/this.O);i>0&&(e.tokens=Math.min(e.tokens+i*this.$,this.R),e.lastAccess=e.lastAccess+i*this.O)}consumeRateLimit(e){var t;let i=Date.now(),s=String(e),n=this.C[s];return n?this.F(n,i):(n={tokens:this.R,lastAccess:i},this.C[s]=n),n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),n.tokens===0)}stop(){this.C={}}},Yt="Mobile",Ci="Android",ls="Tablet",Ha="Android Tablet",Wa="iPad",Ba="Apple Watch",Qi="Safari",Ms="BlackBerry",Ua="Samsung Internet",es="Chrome",za="Chrome iOS",Ga="Internet Explorer",qa="Internet Explorer Mobile",Za="Opera",Ya="Microsoft Edge",ts="Firefox",Xa="Firefox iOS",cs="Nintendo",us="PlayStation",Ts="Xbox",Ja="Android Mobile",Ka="Mobile Safari",Vs="Windows",Qa="Windows Phone",ro="Nokia",Mn="Ouya",dd="Generic "+Yt.toLowerCase(),el="Generic "+ls.toLowerCase(),Tn="Konqueror",tl="Oculus Browser",il="Vivaldi",sl="Yandex",nl="Whale",rl="DuckDuckGo",ol="Pale Moon",al="Waterfox",In="Brave",ll="Claude",cl="Codex",ul="ChatGPT",dl="Google Search App",Hs=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ws=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),hd=new RegExp(Ts,"i"),pd=new RegExp("PlayStation \\w+","i"),fd=new RegExp("Nintendo \\w+","i"),or=new RegExp("BlackBerry|PlayBook|BB10","i"),vd={"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"},hl=function(e,t,i,s){return t=t||"",(function(r){return r!=null&&r.brave?In:null})(i)||(s!=null&&s.detectGoogleSearchApp&&A(e,"GSA/")?dl:A(e," OPR/")&&A(e,"Mini")?"Opera Mini":A(e," OPR/")?Za:or.test(e)?Ms:A(e,"IEMobile")||A(e,"WPDesktop")?qa:A(e,"OculusBrowser")?tl:A(e,"SamsungBrowser")?Ua:A(e,"Edge")||A(e,"Edg/")?Ya:A(e,"Vivaldi/")?il:A(e,"YaBrowser/")?sl:A(e,"Whale/")?nl:A(e,"DuckDuckGo/")||A(e,"Ddg/")?rl:A(e,"Claude/")?ll:A(e,"Codex/")?cl:A(e,"ChatGPT/")?ul:A(e,"FBIOS")?"Facebook Mobile":A(e,"UCWEB")||A(e,"UCBrowser")?"UC Browser":A(e,"CriOS")?za:A(e,"CrMo")||A(e,es)?es:A(e,Ci)&&A(e,Qi)?Ja:A(e,"FxiOS")?Xa:A(e.toLowerCase(),Tn.toLowerCase())?Tn:A(e,"Brave/")?In:((r,o)=>o&&A(o,"Apple")||(function(a){return A(a,Qi)&&!A(a,es)&&!A(a,Ci)})(r))(e,t)?A(e,Yt)?Ka:Qi:A(e,"PaleMoon/")?ol:A(e,"Waterfox/")?al:A(e,ts)?ts:A(e,"MSIE")||A(e,"Trident/")?Ga:A(e,"Gecko")?ts:"")},gd={[qa]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Ya]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[es]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[za]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Qi]:[Hs],[Ka]:[Hs],[Za]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ts]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Xa]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Tn]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Ms]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Hs],[Ja]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Ua]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[tl]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[il]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[sl]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[nl]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[In]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[ll]:[Ws],[cl]:[Ws],[ul]:[Ws],[rl]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[ol]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[al]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[dl]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Ga]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},_d=function(e,t,i,s){let n=hl(e,t,i,s),r=gd[n];if(x(r))return null;for(let o=0;r.length>o;o++){let a=e.match(r[o]);if(a)return parseFloat(a[a.length-2])}return null},oo=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[Ts,e&&e[1]||""]],[new RegExp(cs,"i"),[cs,""]],[new RegExp(us,"i"),[us,""]],[or,[Ms,""]],[new RegExp(Vs,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Qa,""];if(new RegExp(Yt).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];let i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let s=vd[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[Vs,s]}return[Vs,""]}],[/((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=>{let t="";return e&&e.length>=3&&(t=x(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Ci,[e[2],e[3],e[4]||"0"].join(".")]:[Ci,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],pl=function(e){for(let t=0;oo.length>t;t++){let[i,s]=oo[t],n=i.exec(e),r=n&&(le(s)?s(n,e):s);if(r)return r}return["",""]},fl=function(e){return fd.test(e)?cs:pd.test(e)?us:hd.test(e)?Ts:new RegExp(Mn,"i").test(e)?Mn:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?Qa:/iPad/.test(e)?Wa:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?Ba:or.test(e)?Ms:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(ro,"i").test(e)?ro:/(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(Yt).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)?Ci:Ha:new RegExp("(pda|Mobile)","i").test(e)?dd:new RegExp(ls,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?el:""},md=function(e,t){var i;let s=fl(e);return s===Wa||s===Ha||s==="Kobo"||s==="Kindle Fire"||s===el?ls:s===cs||s===Ts||s===us||s===Mn?"Console":s===Ba?"Wearable":s?Yt:(t==null?void 0:t.userAgentDataPlatform)==="Android"&&((i=t==null?void 0:t.maxTouchPoints)!==null&&i!==void 0?i:0)>0?600>Math.min((n=t==null?void 0:t.screenWidth)!==null&&n!==void 0?n:0,(r=t==null?void 0:t.screenHeight)!==null&&r!==void 0?r:0)/((o=t==null?void 0:t.devicePixelRatio)!==null&&o!==void 0?o:1)?Yt:ls:"Desktop";var n,r,o},Bs=/\bFBAV\/(\d+(?:\.\d+)*)/i,ao=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Bs],[/\bFBAN\/EMA\b/i,"Facebook Lite",Bs],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Bs],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],Cn="[Truncated]",Di="[Unserializable]";function zt(e){let t="";for(let i=0;e.length>i;i++){let s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"\uFFFD";else{let n=e.charCodeAt(i+1);56320>n||n>57343?t+="\uFFFD":(t+=e[i]+e[i+1],i++)}}return t}function vl(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch{i=[]}for(let s of i){let n;try{n=t[s]}catch{n=Di}Object.defineProperty(e,s,{value:n,enumerable:!0,writable:!0,configurable:!0})}return e}var is=3e5,gl=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;let t=this.isOpen(),i=Date.now(),s=Math.min(e.retryAfterMs,is);if(!t)return this.ts=i,void(this.es=i+s);this.es=Math.max(this.es,Math.min(i+s,this.ts+is))}remainingMs(){let e=Date.now();if(this.ts-5e3>e)return this.reset(),0;let t=Math.min(is,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}},yd=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function lo(e,t){return typeof(i=e)=="string"&&yd.test(i)?e:t();var i}function _l(e,t){let i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return i}function yt(e){return e&&e.split("#")[0]}function co(e){try{return e()}catch{return}}function ml(e,t){let i=setTimeout(e,t);return i!=null&&i.unref&&(i==null||i.unref()),i}function uo(e,t,i){return yl.apply(this,arguments)}function yl(){return(yl=ee(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((n,r)=>{s=ml(()=>{try{i==null||i(),n()}catch(o){r(o)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}var zi,ho,Us;function bd(e){let t=globalThis._posthogChunkIds;if(!t)return;let i=Object.keys(t);return Us&&i.length===ho||(ho=i.length,Us=i.reduce((s,n)=>{zi||(zi={});let r=zi[n];if(r)s[r[0]]=r[1];else{let o=e(n);for(let a=o.length-1;a>=0;a--){let l=o[a],c=l==null?void 0:l.filename,u=t[n];if(c&&u){s[c]=u,zi[n]=[c,u];break}}}return s},{})),Us}function bi(e){return bi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bi(e)}function wd(e,t,i){return(t=(function(s){var n=(function(r){if(bi(r)!="object"||!r)return r;var o=r[Symbol.toPrimitive];if(o!==void 0){var a=o.call(r,"string");if(bi(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)})(s);return bi(n)=="symbol"?n:n+""})(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function po(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),i.push.apply(i,s)}return i}function f(e){for(var t=1;arguments.length>t;t++){var i=arguments[t]!=null?arguments[t]:{};t%2?po(Object(i),!0).forEach(function(s){wd(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):po(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var xd=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){let i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),n=this.buildParsingContext(t),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(e){var t=this;return ee(function*(){for(let i of e)i.stacktrace&&i.stacktrace.frames&&O(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:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let s,n;if(e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{n=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch{}return f(f({},e),{},{cause:s,stack:n,errors:(i=e.errors)===null||i===void 0?void 0:i.map(r=>this.parseStacktrace(r,t))})}applyChunkIds(e,t){return e.map(i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i))}applyCoercers(e,t){for(let i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return ee(function*(){let i=e;for(let s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){let i=[],s=(n,r,o)=>{var a;let l=i.length,c=r===void 0?f(f({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:n.synthetic,exception_id:l}):{type:"chained",source:o,synthetic:n.synthetic,exception_id:l,parent_id:r},u={type:n.type,value:n.value,mechanism:c};n.stack&&(u.stacktrace={type:"raw",frames:n.stack}),i.push(u),n.cause&&s(n.cause,l,"cause");for(let d of(a=n.errors)!==null&&a!==void 0?a:[])s(d,l,"member")};return s(e),i}buildParsingContext(e){var t;return{chunkIdMap:bd(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(ii(e)){let i=Object.getPrototypeOf(e);for(let s=0;i&&100>s;s++){var t;let n=(t=Object.getOwnPropertyDescriptor(i,"constructor"))===null||t===void 0?void 0:t.value;if(typeof n=="function"&&n.name==="AggregateError"){let r=e.errors;return O(r)?r:void 0}i=Object.getPrototypeOf(i)}}}catch{}}buildCoercingContext(e,t,i=0){let s=0,n=0,r=!1,o=new Set,a=[],l={},c=(h,p,v=0)=>{let _=u(p,v),g=_.apply;if(_.apply=k=>{a.push(h);try{return g(k)}finally{a.pop()}},v>4||v>0&&a.indexOf(h)!==-1)return this.coerceFallback(_);let y=typeof h=="object"&&h!==null||typeof h=="function";if(v===0&&s>=50||y&&o.has(h))return;y&&o.add(h),v===0&&s++;let m=this.getAggregateErrors(h),w,M;r||(r=!!m);try{if(w=this.applyCoercers(h,_),!w)throw l}catch(k){if(k===l)return void(v===0&&s--);if(!r)throw k;w=this.coerceFallback(_)}if(!m||s>=50)return w;try{M=m.length}catch{return w}if(!Number.isInteger(M)||0>M||M>4294967295)return w;let P=[];for(let k=0;50>s&&1e3>n&&M>k;k++){let I;n++;try{I=_.next(m[k])}catch{s++,I=this.coerceFallback(u(p+1))}I&&P.push(I)}return f(f({},w),{},{errors:P})},u=(h,p=0)=>f(f({},t),{},{syntheticException:h==0?t.syntheticException:void 0,mechanism:h==0?e:{},apply(v){let _=c(v,h,p+1);if(!_)throw l;return _},next:v=>c(v,h+1)}),d=u(i);return f(f({},d),{},{apply:h=>{var p;return(p=c(h,i))!==null&&p!==void 0?p:this.coerceFallback(d)}})}},kd=/^([a-z][a-z0-9.+-]+):/i,Sd=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function Ed(e){if(!e||e==="<anonymous>")return!1;let t=kd.exec(e);return!t||Sd.includes(t[1].toLowerCase())}function Fn(e,t,i,s,n){let r={platform:e,filename:t,function:i==="<anonymous>"?"?":i,in_app:Ed(t)};return x(s)||(r.lineno=s),x(n)||(r.colno=n),r}var bl=(e,t)=>{let i=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return i||s?[e.indexOf("@")!==-1?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},$d=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Pd=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Md=/\((\S*)(?::(\d+))(?::(\d+))\)/,Td=(e,t)=>{let i=$d.exec(e);if(i){let[,n,r,o]=i;return Fn(t,n,"?",+r,+o)}let s=Pd.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){let o=Md.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}let[n,r]=bl(s[1]||"?",s[2]);return Fn(t,r,n,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},Id=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Cd=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Fd=(e,t)=>{let i=Id.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){let r=Cd.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}let s=i[3],n=i[1]||"?";return[n,s]=bl(n,s),Fn(t,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},fo=/\(error: (.*)\)/;function ar(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function Ad(e){for(let t=1;10>=t;t++){let i=e.length-2*t;if(0>i)break;let s=!0;for(let n=0;t>n;n++)if(!ar(e[i+n],e[i+t+n])){s=!1;break}if(s){for(let n=0;t>n;n++)e[i+n]=e[i+t+n];return e.length=i+t,{start:i,length:t}}}}function Od(e,t){let i=t.start+t.length,s=xl(e,t);s&&e.splice(i+s===e.length?i:t.start,s)}function wl(e,t){let i=t.start;for(;i>0&&ar(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function xl(e,t){let i=t.start+t.length,s=i;for(;e.length>s&&ar(e[s],e[s-t.length]);)s++;return s-i}function Rd(e,t){let i=t[0],s=e.length-(i?wl(e,i):0);for(let n of t)s-=xl(e,n);return s}function Ld(e,t,i){for(let s=0;e.length>s;s++){let n=e[(t+s)%e.length],r=e[(i+s)%e.length];if(n!==r)return r>n}return!1}var Dd=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let i=V(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){let t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return as(e,"DOMException")}isDOMError(e){return as(e,"DOMError")}},Nd=class{match(e){return ii(e)}coerce(e,t){var i;let s=this.getStack(e),n=s===void 0?(i=t.syntheticException)===null||i===void 0?void 0:i.stack:void 0,r=!!n;return{type:this.getType(e),value:this.getMessage(e,t),stack:s!=null?s:n,cause:e.cause?t.next(e.cause):void 0,synthetic:r}}getType(e){return e.name||e.constructor.name}getMessage(e,t){let i=e.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){try{let t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;let i=e.stack;return typeof i=="string"&&i.length>0?i:void 0}catch{return}}},jd=class{match(e){return!!as(e,"ErrorEvent")&&(e.error!=null||this.ar(e))}coerce(e,t){var i;if(e.error!=null)return t.apply(e.error);let s=t.apply(e.message);return f(f({},s),{},{stack:(i=this.lr(e))!==null&&i!==void 0?i:s.stack,synthetic:!0})}ar(e){return V(e.message)&&e.message.length>0}lr(e){var t,i;let s=e,n=(t=s.lineno)!==null&&t!==void 0?t:0,r=(i=s.colno)!==null&&i!==void 0?i:0;if(V(s.filename)&&s.filename.length!==0&&n!==0)return`Error
|
|
2
|
+
at ${s.filename}:${n}:${r}`}},Vd=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Hd=class{match(e){return typeof e=="string"}coerce(e,t){var i;let[s,n]=this.getInfos(e);return{type:s!=null?s:"Error",value:n!=null?n:e,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e,s=e.match(Vd);return s&&(t=s[1],i=s[2]),[t,i]}},Wd=["fatal","error","warning","log","info","debug"];function kl(e,t=40){let i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let s=i.length;s>0;s--){let n=i.slice(0,s).join(", ");if(t>=n.length)return s===i.length?n:n.length>t?`${n.slice(0,t)}...`:n}return""}var Bd=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s;let n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:(i=this.getStack(e))!==null&&i!==void 0?i:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(rr(e))return e.constructor.name;let t="name"in e?e.name:void 0;return V(t)&&!yi(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let i=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(i+=` with message: '${e.message}'`),i}if("message"in e&&typeof e.message=="string")return e.message;let t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${kl(e)}`}isSeverityLevel(e){return V(e)&&!yi(e)&&Wd.indexOf(e)>=0}getStack(e){try{return V(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:V(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(let t in e)if({}.hasOwnProperty.call(e,t)){let i=e[t];if(ii(i))return i}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Ud=class{match(e){return rr(e)}coerce(e,t){var i;let s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${kl(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},zd=class{match(e){return ja(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},Gd=class{match(e){return as(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!rr(e))return!1;try{let t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var i;let s=this.getUnhandledRejectionReason(e);return ja(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},ds="$message",hs="$timestamp",qd=new Set([ds,hs]),zs={enabled:!0,max_bytes:32768};function ps(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:zs.enabled,max_bytes:Yd(e.max_bytes,zs.max_bytes)}:f({},zs)}var Zd=class{constructor(e){this.ns=[],this.ss=0,this.Mr=ps(e)}setConfig(e){this.Mr=ps(e),this.rs()}add(e){let t=(function(s){let n;try{n=Da(s)}catch{return}try{let r=JSON.parse(n);if(!j(r))return;let o=r,a=o[ds],l=o[hs];return!V(a)||a.trim().length===0||!V(l)&&!oe(l)?void 0:{step:o,json:n}}catch{return}})(e);if(!t)return;let i=(function(s){if("u">typeof TextEncoder)return new TextEncoder().encode(s).length;let n=encodeURIComponent(s),r=0;for(let o=0;n.length>o;o++)n[o]==="%"?(r+=1,o+=2):r+=1;return r})(t.json);i>this.Mr.max_bytes||(this.ns.push({step:t.step,bytes:i}),this.ss+=i,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Mr.max_bytes&&this.ns.length>0;){let e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function Yd(e,t){if(!oe(e)||e===1/0||e===-1/0)return t;let i=Math.floor(e);return 0>i?t:i}var vo=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function go(e){return typeof e=="string"||e}function _o(e){return typeof e=="string"?e:void 0}var Xd=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server","$react_native_version"],Sl="NativeGzipValidationError",An=e=>e.length>=2&&e[0]===31&&e[1]===139,mo=(e,t)=>e===$n.GZipJS||t===$n.GZipJS||t==="gzip",yo=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",li,Gi=e=>{throw _l(Sl,`Native gzip produced invalid output: ${e}`)},Jd=(bo=ee(function*(e,t){18>e.size&&Gi("too-short");let i=new Uint8Array(yield e.slice(0,10).arrayBuffer());An(i)&&i[2]===8||Gi("invalid-header");let s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(r=>{let o=(()=>{if(li)return li;li=[];for(let l=0;256>l;l++){let c=l;for(let u=0;8>u;u++)c=1&c?3988292384^c>>>1:c>>>1;li[l]=c>>>0}return li})(),a=4294967295;for(let l=0;r.length>l;l++)a=o[255&(a^r[l])]^a>>>8;return(4294967295^a)>>>0})(t)&&Gi("invalid-crc");let n=t.length>>>0;s.getUint32(4,!0)!==n&&Gi("invalid-size")}),function(e,t){return bo.apply(this,arguments)}),bo;function On(){return On=ee(function*(e,t=!0,i){try{let n=new TextEncoder().encode(e),r=new globalThis.CompressionStream("gzip"),o=r.writable.getWriter(),a=o.write(n).then(()=>o.close()).catch((s=ee(function*(u){try{yield o.abort(u)}catch{}throw u}),function(u){return s.apply(this,arguments)})),l=new Response(r.readable).blob(),[c]=yield Promise.all([l,a]);return yield Jd(c,n),c}catch(n){if(i!=null&&i.rethrow)throw n;return t&&console.error("Failed to gzip compress data",n),null}var s}),On.apply(this,arguments)}function El(e,t){if(e==null)return{};var i,s,n=(function(o,a){if(o==null)return{};var l={};for(var c in o)if({}.hasOwnProperty.call(o,c)){if(a.includes(c))continue;l[c]=o[c]}return l})(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(s=0;r.length>s;s++)t.includes(i=r[s])||{}.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}var ye="[redacted]",Kd=/^[A-Za-z0-9+/\n\r]+=*$/,Qd=/^[A-Za-z0-9_-]+={0,2}$/,eh=/[-_]/,th=/^data:[^,\s]*;base64,/i,ih=/^[A-Za-z0-9+/_-]+={0,2}$/,sh=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,nh=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,$l=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,rh=/[\s<>"]/,Pl=new RegExp($l.source,"i"),Ml=/[a-z][a-z0-9+.-]{0,63}:\/\//i,oh=new RegExp(`^${Ml.source}`,"i"),ah=new RegExp(Ml.source,"gi"),lh=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,ch=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,uh=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,dh=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,hh=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,ph=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,fh=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,vh=/\b\d(?:[ ./-]?\d){12,}\b/g,wo=/\d+/g,gh=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,_h=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function Rn(e){return(function(t){return nh.test(t)})(e)||lh.test(e)||ch.test(e)}function Gs(e){return e.split("&",129).length>128}function mh(e,t,i){return Rn(e)||t.includes(";")&&(function(s){return s.split(";").some(n=>Rn(n.split("=",1)[0]))})(t)?ye:Pl.test(t)?i?lr(t,{allowNestedUrls:!1,stripPunctuation:!0}):ye:t}function Tl(e,t){let i=new URLSearchParams,s=!1,n=!1;for(let[r,o]of new URLSearchParams(e)){let a=mh(r,o,t);s||(s=a!==o),n=Rn(r)||a!==o,i.append(r,a)}return{changed:s,lastFieldSensitive:n,serialized:i.toString()}}function xo(e,t){if(!e.includes("="))return{value:yh(e,t),lastFieldSensitive:!1};let i=Tl(e,t);return{value:i.changed?i.serialized:e,lastFieldSensitive:i.lastFieldSensitive}}function yh(e,t){return t?lr(e,{allowNestedUrls:!1,stripPunctuation:!0}):Pl.test(e)?ye:e}function bh(e,t,i){return e==="#"?!t.fragment&&(t.fragment=!0):e==="?"&&(t.fragment?i!=="="&&!t.fragmentQuery&&(t.fragmentQuery=!0):!t.query&&(t.query=!0))}function qs(e,t){var i;if(e.length>8192&&oh.test(e))return ye;let{address:s,suffix:n}=t.stripPunctuation?(function(g){let y=g.length;for(;y>0&&".,;:!?)]}'".includes(g[y-1]);)y--;return{address:g.slice(0,y),suffix:g.slice(y)}})(e):{address:e,suffix:""},r;try{r=new URL(s)}catch{return ye+n}let o=r.search.slice(1),a=r.hash!=="",l=(function(g){let y=g.slice(1),m=y.indexOf("?");return 0>m?{head:y,tail:null}:{head:y.slice(0,m),tail:y.slice(m+1)}})(r.hash);if(Gs(o)||Gs(l.head)||Gs((i=l.tail)!==null&&i!==void 0?i:""))return ye+n;let c=!1;(r.username||r.password)&&(r.username=ye,r.password="",c=!0);let u=Tl(o,t.allowNestedUrls);u.changed&&(r.search=u.serialized,c=!0);let d=xo(l.head,t.allowNestedUrls),h=l.tail===null?null:(p=l.tail,d.lastFieldSensitive?{value:p===""?"":ye,lastFieldSensitive:!0}:xo(p,t.allowNestedUrls));var p;let v=h===null?d.value:`${d.value}?${h.value}`;v!==r.hash.slice(1)&&(r.hash=v,c=!0);let _=a?h!=null?h:d:u;return(c?r.toString():s)+(_.lastFieldSensitive?"":n)}function lr(e,t){return e.replace($l,i=>(function(s,n){let r=(function(l){if(!l.includes("://"))return[];let c=[...l.matchAll(ah)].map(_=>_.index),u=[],d={query:!1,fragment:!1,fragmentQuery:!1},h=0,p=!1,v="";for(let _=0;l.length>_&&c.length>h;_++){c[h]===_&&(_>0&&v!=="="&&u.push(_),h++);let g=l[_];bh(g,d,v)?(v=g,p=!0):p&&"=&".includes(g)&&(v=g)}return u})(s);if(r.length===0)return qs(s,n);let o="",a=0;for(let l of r)o+=qs(s.slice(a,l),f(f({},n),{},{stripPunctuation:!1})),a=l;return o+qs(s.slice(a),n)})(i,f(f({},t),{},{stripPunctuation:t.stripPunctuation&&i.length!==e.length})))}function wh(e,t){return(function(i){return i.length>=10240&&(Kd.test(i)||(function(s){let n=th.exec(s);if(!n)return!1;let r;try{r=decodeURIComponent(s.slice(n[0].length))}catch{return!1}return ih.test(r.replace(/[\r\n]/g,""))})(i)||eh.test(i)&&Qd.test(i))})(e)?"[binary data redacted - not supported by PostHog MCP analytics]":(function(i,s,n){let r=4*n.maxStringLength;if(i.length>r){let o=s(i.slice(0,(function(a,l){let c=l;for(;c>0&&!rh.test(a[c-1]);)c--;return c})(i,r)));if(o.length>=2*n.maxStringLength)return o+n.truncationSuffix}return s(i)})(e,i=>(function(s){return lr(s,{allowNestedUrls:!0,stripPunctuation:!0})})((function(s){let n=s.replace(uh," ");return n=n.replace(dh,ye),n=n.replace(hh,ye),n=n.replace(ph,`$1${ye}`),n=n.replace(vh,kh),n=n.replace(fh,ye),n=n.replace(gh,`$1${ye}`),n=n.replace(_h,`$1${ye}`),n})((function(s){return s.replace(sh,ye)})(i))),t)}function xh(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let n=e.charCodeAt(s)-48;if(0>n||n>9)return!1;i&&(n*=2,n>9&&(n-=9)),t+=n,i=!i}return t%10==0}function kh(e){let t=[];for(let r=wo.exec(e);r!==null;r=wo.exec(e))t.push({digits:r[0],start:r.index,end:r.index+r[0].length});let i="",s=0,n=0;for(;t.length>n;){let r="",o=-1;for(let a=n;t.length>a&&(r+=t[a].digits,19>=r.length);a++)r.length>=13&&xh(r)&&(o=a);0>o?n++:(i+=e.slice(s,t[n].start)+ye,s=t[o].end,n=o+1)}return i+e.slice(s)}var Sh={}.propertyIsEnumerable;function fs(e,t){try{return Il(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function cr(e,t,i,s){if(0>=i.remainingNodes)return{stringValue:Cn};if(i.remainingNodes--,Se(e))return{boolValue:e};if(typeof e=="bigint")return(function(n,r){let o=n.toString(),a=BigInt("9223372036854775808");return n>=a||-a>n?(r==null||r.debug(`Attribute ${o} is outside the int64 range; encoding it as a string`),{stringValue:o}):{intValue:o}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};let n=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t==null||t.debug(`Attribute ${n} is outside the int64 range; encoding it as a string`),{stringValue:n}):{intValue:n}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:zt(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:Cn};if(e instanceof Date){let n=e.getTime(),r=Number.isFinite(n)?e.toISOString():String(e);return{stringValue:typeof r=="string"?zt(r):String(r)}}i.ancestors.add(e);try{try{let n=e.toJSON;if(typeof n=="function")return cr(n.call(e),t,i,s+1)}catch{}return O(e)?{arrayValue:{values:Eh(e,t,i,s+1)}}:{kvlistValue:{values:Il(e,t,i,s+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:zt(String(e))}}function Eh(e,t,i,s){let n=[],r=Math.min(e.length,1e3),o=0;for(;r>o&&i.remainingNodes>0;o++)try{let a=o in e?e[o]:void 0;if(L(a))continue;n.push(cr(a,t,i,s))}catch{n.push({stringValue:Di})}return e.length>o&&n.push({stringValue:Cn}),n}function Il(e,t,i,s){let n=[];for(let r in e)if(Sh.call(e,r)){if(!r){t==null||t.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=i.remainingNodes){t==null||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{let o=e[r];if(ne(o)||x(o))continue;n.push({key:zt(r),value:cr(o,t,i,s)})}catch{n.push({key:zt(r),value:{stringValue:Di}})}}return n}function Cl(e,t,i){return f(f(f(f({},vl({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}var $h=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function Fl(e,t){let i=vl({},e),s={};for(let n of $h)({}).hasOwnProperty.call(i,n)&&(s[n]=i[n],delete i[n]);return[...fs(i,t),...fs(s,t)]}var ko={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},Al={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Ph=Al.info;function Mh(e){try{return zt(String(e))}catch{return Di}}function Th(e,t,i,s){let n=e.level||"info",{text:r,number:o}=Al[n]||Ph,a=(function(h=Date.now()){return String(h)+"000000"})(oe(s)?s:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),L(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),L(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);let c=f({},l),u=e.attributes;if(u){let h=[];try{h=Object.keys(u)}catch{h=[]}for(let p of h){let v;try{v=u[p]}catch{v=Di}Object.defineProperty(c,p,{value:v,enumerable:!0,writable:!0,configurable:!0})}}let d={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:Mh(e.body)},attributes:fs(c,i)};return e.trace_id&&(d.traceId=e.trace_id),e.span_id&&(d.spanId=e.span_id),x(e.trace_flags)||(d.flags=e.trace_flags),d}function Ol(e,t,i){return Cl(e,t,i)}function Rl(e,t,i,s){return{resourceLogs:[{resource:{attributes:Fl(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var Ll=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.cs}arm(e){this.clear(),this.us=Date.now()+e,this.cs=ml(()=>{this.cs=void 0,this.ls()},e)}armNoEarlierThan(e){this.cs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function Dl(){return .75+.5*Math.random()}function Nl(e,t,i,s){let n=Math.min(Math.max(0,t-1),6),r=e*Math.pow(2,n);return Math.round((s===void 0?r:Math.min(r,Math.max(s,e)))*i)}var Ih=class{constructor(e,t,i,s,n,r=()=>Promise.resolve(),o){var a;this._instance=e,this.Mr=t,this.A=i,this.hs=s,this.ds=n,this.vs=r,this.fs=o,this.ps=new Ll(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new gl,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=t.maxBufferSize,this.Is=Math.max((a=t.maxQueueSize)!==null&&a!==void 0?a:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(Ye.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Mr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var i;if(this._instance.isDisabled||this._instance.optedOut||!(e!=null&&e.body))return;let s=this.Os(e);if(s===null)return;if(!s.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;let n={record:Th(s,(i=t==null?void 0:t.context)!==null&&i!==void 0?i:this.hs(),this.A,t==null?void 0:t.occurredAtMs)};this.ds(()=>this.Ls(n))}Os(e){let t=this.Mr.beforeSend;if(!t)return e;let i=O(t)?t:[t],s=e;for(let n of i)try{let r=n(s);if(!r)return this.A.info("Log was rejected in beforeSend function"),null;s=r}catch(r){return this.A.error("Error in beforeSend function for log:",r),null}return s}Ds(){if(this.Rs===void 0)return!0;let e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.Cs=!0),!1)}flush(){var e=this;return ee(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return ee(function*(){var t;e.ps.clear();let i=(t=e._instance.getPersistedProperty(Ye.LogsQueue))!==null&&t!==void 0?t:[];if(i.length===0)return;let s=i.length,n=0;for(;i.length>0&&s>n;){var r,o;let a=e._s;e.bs=0;let l=Math.min(i.length,e.Es),c=i.slice(0,l),u=Rl(c.map(h=>h.record),e.qs(),(r=e.fs)!==null&&r!==void 0?r:e._instance.getLibraryId(),e._instance.getLibraryVersion()),d=yield e._instance.js(u);if(e._s!==a)return;if(d.kind==="too-large"&&c.length>1)e.Es=Math.max(1,Math.floor(c.length/2)),e.A.warn(`Logs batch of size ${c.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(d),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),d.kind==="retry-later"||(d.kind==="too-large"?e.A.warn("Dropping a single log record with batch size 1 \u2014 the record is larger than the server cap and cannot be split further."):d.kind==="ok"&&e.Mr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Mr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(c.length),i=(o=e._instance.getPersistedProperty(Ye.LogsQueue))!==null&&o!==void 0?o:[],n+=c.length,d.kind==="fatal"))throw d.error}})()}Bs(e){var t=this;return ee(function*(){var i;let s=Math.max(0,e-t.bs),n=(i=t._instance.getPersistedProperty(Ye.LogsQueue))!==null&&i!==void 0?i:[];t._instance.setPersistedProperty(Ye.LogsQueue,n.slice(s)),yield t.vs()})()}qs(){return Ol(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;let i=(t=this._instance.getPersistedProperty(Ye.LogsQueue))!==null&&t!==void 0?t:[];this.Is>i.length||(i.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(Ye.LogsQueue,i),this.Ts>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}zs(){return Math.max(Nl(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){let e=this._instance.getPersistedProperty(Ye.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return ee(function*(){t.ps.clear();let i=t.flush().catch(()=>{});e!==void 0?yield uo(i,e):yield i})()}flushWithTimeout(e){var t=this;return ee(function*(){let i=t.flush();yield uo(i,e,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=Dl(),this.A.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.zs())})}},Zs=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function So(e){return String(e)+"000000"}function Eo(e,t,i,s){let n="";return s&&(n=Object.keys(s).sort().map(r=>`${JSON.stringify(r)}:${JSON.stringify(s[r])}`).join(",")),`${e}\0${t}\0${i!=null?i:""}\0${n}`}var Ch=class{constructor(e,t,i){this._instance=e,this.Mr=t,this.A=i,this.Hs=new Map,this.ps=new Ll(()=>this.flush().catch(s=>{this.A.error("Metrics flush failed:",s)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new gl,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,i){this.Qs({name:e,type:"count",value:t,unit:i==null?void 0:i.unit,attributes:i==null?void 0:i.attributes})}gauge(e,t,i){this.Qs({name:e,type:"gauge",value:t,unit:i==null?void 0:i.unit,attributes:i==null?void 0:i.attributes})}histogram(e,t,i){this.Qs({name:e,type:"histogram",value:t,unit:i==null?void 0:i.unit,attributes:i==null?void 0:i.attributes})}flush(){var e=this;let t=this.ys,i=(function(){var s=ee(function*(){t&&(yield t.catch(()=>{})),yield e.Zs()});return function(){return s.apply(this,arguments)}})()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(this.Hs.size===0)return null;let e=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(e){if(this._instance.isDisabled||this._instance.optedOut)return;let t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.A.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.A.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.A.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,s;try{i=t.attributes?f({},t.attributes):void 0,s=Eo(t.type,t.name,t.unit,i)}catch(o){return void this.A.warn(`Dropping metric '${t.name}': attributes could not be serialized`,o)}let n=this.Hs.get(s);if(!n){if(!this.Ks())return;n={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this.Hs.set(s,n)}let r=this.Ws.get(t.name);r===void 0?this.Ws.set(t.name,t.type):r===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.A.warn(`Metric name '${t.name}' is already used as a ${r}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(n,t.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Mr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,t){switch(e.type){case"count":var i;e.total=((i=e.total)!==null&&i!==void 0?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Zs.length+1).fill(0)});let s=e.hist;s.count+=1,s.sum+=t,s.min=Math.min(s.min,t),s.max=Math.max(s.max,t),s.bucketCounts[(function(n,r){for(let o=0;r.length>o;o++)if(r[o]>=n)return o;return r.length})(t,Zs)]+=1;break}}}Os(e){let t=this.Mr.beforeSend;if(!t)return e;let i=O(t)?t:[t],s=e;for(let n of i)try{let r=n(s);if(!r)return this.A.info("Metric was rejected in beforeSend function"),null;s=r}catch(r){return this.A.error("Error in beforeSend function for metric:",r),null}return s}Fs(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(Nl(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Zs(){var e=this;return ee(function*(){if(e.ps.clear(),e.Hs.size===0)return;let t=e.Hs;e.Hs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;let i=e.Gs,s=yield e._instance.Ys(e.Js(t));if(i===e.Gs)switch(e.ws.record(s),s.kind==="retry-later"?(e.ks++,e.Ss=Dl()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.zs()),s.kind){case"ok":return;case"retry-later":return e.co(t),void e.ps.armNoEarlierThan(e.zs());case"too-large":return void e.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.A.error("Failed to send metrics batch:",s.error)}})()}Js(e){return t=this.ho(e),i=(function(r,o,a){return Cl(r,o,a)})(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Fl(i)},scopeMetrics:[{scope:{name:s,version:n},metrics:t}]}]};var t,i,s,n}ho(e){let t=So(Date.now()),i=new Map;for(let o of e.values()){var s;let a=Eo(o.type,o.name,o.unit,void 0),l=i.get(a);l||(l=f({name:o.name},o.unit&&{unit:o.unit}),o.type==="count"?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:o.type==="gauge"?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},i.set(a,l));let c=fs((s=o.attributes)!==null&&s!==void 0?s:{},this.A),u=So(o.windowStartMs);if(o.type==="count"){var n;let d={attributes:c,startTimeUnixNano:u,timeUnixNano:t,asDouble:(n=o.total)!==null&&n!==void 0?n:0};l.sum.dataPoints.push(d)}else if(o.type==="gauge"){var r;let d={attributes:c,timeUnixNano:t,asDouble:(r=o.last)!==null&&r!==void 0?r:0};l.gauge.dataPoints.push(d)}else o.hist&&l.histogram.dataPoints.push({attributes:c,startTimeUnixNano:u,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Zs})}return Array.from(i.values())}co(e){for(let[s,n]of e){let r=this.Hs.get(s);if(r)switch(r.windowStartMs=Math.min(r.windowStartMs,n.windowStartMs),r.type){case"count":var t,i;r.total=((t=r.total)!==null&&t!==void 0?t:0)+((i=n.total)!==null&&i!==void 0?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(r.hist){r.hist.count+=n.hist.count,r.hist.sum+=n.hist.sum,r.hist.min=Math.min(r.hist.min,n.hist.min),r.hist.max=Math.max(r.hist.max,n.hist.max);for(let o=0;r.hist.bucketCounts.length>o;o++)r.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else r.hist=n.hist}else this.Ks()&&this.Hs.set(s,n)}}},jl=(e,{debugEnabled:t}={})=>{let i={N(s,...n){let r;try{r=typeof window>"u"?void 0:window}catch{return}r&&(st.DEBUG||r.POSTHOG_DEBUG||t)&&!x(r.console)&&r.console&&("__rrweb_original__"in r.console[s]?r.console[s].__rrweb_original__:r.console[s])(e,...n)},debug(...s){i.N("debug",...s)},info(...s){i.N("log",...s)},warn(...s){i.N("warn",...s)},error(...s){i.N("error",...s)},critical(...s){console.error(e,...s)},uninitializedWarning(s){i.error(`You must initialize PostHog before calling ${s}`)},createLogger:(s,n)=>jl(`${e} ${s}`,n)};return i},T=jl("[PostHog.js]"),re=T.createLogger,Fh=re("[ExternalScriptsLoader]"),vs=e=>{let t=E==null?void 0:E.querySelectorAll("script");if(t){for(let i=0;t.length>i;i++)if(t[i].src===e||t[i].getAttribute("src")===e)return t[i]}},Pt=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return Fh.warn(`${t} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");let s=vs(t);if(s){if(s.__posthog_loading_callback_fired)return i();let r=s.__posthog_loading_error;return r?i(r):(s.addEventListener("load",o=>{s.__posthog_loading_callback_fired=!0,i(void 0,o)}),void s.addEventListener("error",o=>{s.__posthog_loading_error=o,i(o)}))}let n=()=>{if(!E)return i("document not found");if(vs(t))return Pt(e,t,i);let r=E.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=t,r.onload=a=>{r.__posthog_loading_callback_fired=!0,i(void 0,a)},r.onerror=a=>{r.__posthog_loading_error=a,i(a)},e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")E.head.appendChild(r);else{let a=E.querySelectorAll("body > script");var o;a.length>0?(o=a[0].parentNode)===null||o===void 0||o.insertBefore(r,a[0]):E.body.appendChild(r)}};E!=null&&E.body?n():E==null||E.addEventListener("DOMContentLoaded",n)},Ys={},$o=(e,t)=>{let i=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(i=`${i}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",i)};F.__PosthogExtensions__=F.__PosthogExtensions__||{},F.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if(t==="remote-config"){let n=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);return void Pt(e,n,i)}let s=e.config.strict_script_versioning;if(s){let n=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),r=Ys[n];if(s==="fallback"&&r){if(vs(r))return void Pt(e,r,i);delete Ys[n]}return void Pt(e,n,s==="fallback"?(o,a)=>{if(o)if(typeof o=="string")i(o);else{var l;let c=$o(e,t);Ys[n]=c;let u=vs(n);u==null||(l=u.parentNode)===null||l===void 0||l.removeChild(u),Pt(e,c,i)}else i(void 0,a)}:i)}Pt(e,$o(e,t),i)},F.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{let s=e.requestRouter.endpointFor("api",t);Pt(e,s,i)},st.DEBUG=!1,st.LIB_VERSION="1.438.2",st.LIB_NAME="web";var ue=st,Ln="$early_access_features",tt="$active_feature_flags",It="$feature_flag_details",Fi="$feature_flag_errors",mt="$feature_flag_evaluated_at",Ct="$feature_flag_request_id",wi="$minimal_flag_called_events",He="$enabled_feature_flags",ft="$stored_group_properties",vt="$stored_person_properties",gt="$flag_call_reported",gi="$flag_call_reported_session_id",_t="$feature_flag_payloads",Ze="$override_feature_flags",Mt="$override_feature_flag_payloads",Ai="visibilitychange",Ah="$people_distinct_id",Ve="distinct_id",ur="$device_id",Xs="$device_model",gs="__alias",Oh="__cmpns",Po="$fbc",Gt="$fbc_persistence",Mo="$fbp",xi="$fbp_persistence",Dn="__timers",Vl="$autocapture_disabled_server_side",Nn="$heatmaps_enabled_server_side",jn="$exception_capture_enabled_server_side",Hl="$error_tracking_suppression_rules",Vn="$error_tracking_capture_extension_exceptions",Hn="$web_vitals_enabled_server_side",dr="$dead_clicks_enabled_server_side",hr="$product_tours_enabled_server_side",Wl="$logs_capture_enabled_server_side",Bl="$web_vitals_allowed_metrics",ki="$session_recording_remote_config",Rh="$session_recording_enabled_server_side",Lh="$replay_sample_rate",Dh="$replay_override_sampling",Nh="$replay_override_linked_flag",jh="$replay_override_url_trigger",Vh="$replay_override_event_trigger",Ht="$sesid",Ul="$session_is_sampled",Hh="$session_past_minimum_duration",Wh="$session_recording_url_trigger_activated_session",Bh="$session_recording_event_trigger_activated_session",Uh="$debug_first_full_snapshot_timestamp",zh="$sess_rec_flush_size",zl="$groups",_i="$surveys",_s="$surveys_loaded_at",Gl="$surveys_activated",ql="$surveys_activated_session",Zl="$surveys_activated_timestamps",Wn="ph_product_tours",Gh="$product_tours_activated",qh="$product_tours_activated_session",Zh="$conversations_widget_session_id",Yh="$conversations_ticket_id",Xh="$conversations_widget_state",Jh="$conversations_user_traits",ke="$user_state",Bn="$client_session_props",Kh="$capture_rate_limit",Yl="$initial_campaign_params",Xl="$initial_referrer_info",Wt="$initial_person_info",pr="$epp",Js="$posthog_cookieless",Jl="$cookieless_mode",Kl="$sdk_debug_extensions_init_method",Ql="$sdk_debug_extensions_init_time_ms",fr="$sdk_debug_recording_script_not_loaded",vr="$sdk_debug_replay_stale_config",ec="$sdk_debug_replay_event_trigger_status",tc="$sdk_debug_replay_linked_flag_trigger_status",ic="$sdk_debug_replay_matched_recording_trigger_groups",sc="$sdk_debug_replay_pending_trigger_conditions",nc="$sdk_debug_replay_remote_trigger_matching_config",rc="$sdk_debug_replay_trigger_groups_count",oc="$sdk_debug_replay_url_trigger_status",Qh="$session_recording_start_reason",gr="PostHog loadExternalDependency extension not found.",it="anonymous",ss="identified",ac="identified_only",ms="beforeunload",_r="$pageview",To="$pageleave",lc="$identify",Io="$groupidentify";function Bt(e,t){O(e)&&e.forEach(t)}function Z(e,t){if(!L(e))if(O(e))e.forEach(t);else if((i=>i instanceof FormData)(e))e.forEach((i,s)=>t(i,s));else for(let i in e)nr.call(e,i)&&t(e[i],i)}var Q=function(e,...t){for(let i of t)for(let s in i)i[s]!==void 0&&(e[s]=i[s]);return e};function ns(e){let t=Object.keys(e),i=t.length,s=new Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}var ep=function(e){return function(...t){try{return e.apply(this,t)}catch(i){T.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),T.critical(i)}}},mr=function(e){let t={};return Z(e,function(i,s){(V(i)&&i.length>0||oe(i))&&(t[s]=i)}),t};function cc(e){let t=f({},e);for(let i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch{}return t}var tp=["herokuapp.com","vercel.app","netlify.app"];function ip(e){let t=e==null?void 0:e.hostname;if(!V(t))return!1;let i=t.split(".").slice(-2).join(".");for(let s of tp)if(i===s)return!1;return!0}function G(e,t,i,s){let{capture:n=!1,passive:r=!0}=s!=null?s:{};e==null||e.addEventListener(t,i,{capture:n,passive:r})}function Un(e){return e.name==="ph_toolbar_internal"}var Si=e=>{if(E){try{let t=e+"=",i=E.cookie.split(";").filter(s=>s.length);for(let s=0;i.length>s;s++){let n=i[s];for(;n.charAt(0)==" ";)n=n.substring(1,n.length);if(n.indexOf(t)===0)return decodeURIComponent(n.substring(t.length,n.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return oe(e)&&isFinite(e)&&Math.floor(e)===e});var sp=class zn{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,n){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(n)||0>t||0>i||0>s||0>n||t>0xffffffffffff||i>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");let r=new Uint8Array(16);return r[0]=t/Math.pow(2,40),r[1]=t/Math.pow(2,32),r[2]=t/Math.pow(2,24),r[3]=t/Math.pow(2,16),r[4]=t/256,r[5]=t,r[6]=112|i>>>8,r[7]=i,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new zn(r)}toString(){let t="";for(let i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),i!==3&&i!==5&&i!==7&&i!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new zn(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let i=0;16>i;i++){let s=this.bytes[i]-t.bytes[i];if(s!==0)return Math.sign(s)}return 0}},np=class{generate(){let e=this.generateOrAbort();if(!x(e))return e;{this.Ct=0;let t=this.generateOrAbort();if(x(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){let e=(()=>{let t=Date.now();return oe(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.It();else{if(this.Ct>=e+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Ct++,this.It())}return sp.fromFieldsV7(this.Ct,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Tt.nextUint32())}It(){this.Mt=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.Mt=0,this.Tt=new rp}},uc=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};b&&!x(b.crypto)&&crypto.getRandomValues&&(uc=e=>crypto.getRandomValues(e));var rp=class{nextUint32(){return this.Rt.length>this.Et||(uc(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}},Co,We=()=>op().toString(),op=()=>(Co||(Co=new np)).generate(),ci="",ap=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Ot=null,se={At(){if(!ne(Ot))return Ot;if(Ot=!1,E)try{let e=`__ph_cookie_support_${We()}`;se.$t(e,"xyz"),Ot=Si(e)==='"xyz"',se.Pt(e)}catch{Ot=!1}return Ot},Dt(e){T.error("cookieStore error: "+e)},Ot:Si,Lt(e){let t;try{t=JSON.parse(se.Ot(e))||{}}catch{}return t},$t(e,t,i,s,n){if(!E)return!1;try{let r="",o="",a=(function(c,u){if(u){let d=(function(h,p=E){if(ci)return ci;if(!p||["localhost","127.0.0.1"].includes(h))return"";let v=h.split("."),_=Math.min(v.length,8),g="dmn_chk_"+We();for(;!ci&&_--;){let y=v.slice(_).join("."),m=g+"=1;domain=."+y+";path=/";p.cookie=m+";max-age=3",p.cookie.includes(g)&&(p.cookie=m+";max-age=0",ci=y)}return ci})(c);if(!d){let h=(p=>{let v=p.match(ap);return v?v[0]:""})(c);h!==d&&T.info("Warning: cookie subdomain discovery mismatch",h,d),d=h}return d?"; domain=."+d:""}return""})(E.location.hostname,s);if(i){let c=new Date;c.setTime(c.getTime()+864e5*i),r="; expires="+c.toUTCString()}n&&(o="; secure");let l=e+"="+encodeURIComponent(JSON.stringify(t))+r+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&T.warn("cookieStore warning: large cookie, len="+l.length),E.cookie=l,!0}catch{return!1}},Pt(e,t){if(E!=null&&E.cookie&&(!t||!ne(Si(e))))try{se.$t(e,"",-1,t)}catch{return}}},Ks=null,U={At(){if(!ne(Ks))return Ks;let e=!0;if(x(b))e=!1;else try{let t="__mplssupport__";U.$t(t,"xyz"),U.Ot(t)!=='"xyz"'&&(e=!1),U.Pt(t)}catch{e=!1}return e||T.error("localStorage unsupported; falling back to cookie store"),Ks=e,e},Dt(e){T.error("localStorage error: "+e)},Ot(e){try{return b==null?void 0:b.localStorage.getItem(e)}catch(t){U.Dt(t)}return null},Lt(e){try{return JSON.parse(U.Ot(e))||{}}catch{}return null},$t(e,t){try{return b==null||b.localStorage.setItem(e,JSON.stringify(t)),!0}catch(i){U.Dt(i)}return!1},Pt(e){try{b==null||b.localStorage.removeItem(e)}catch(t){U.Dt(t)}}},Qs=[vt,tt,He,It,_t,Ct,mt,Fi,gt],Tt=[ur,Ve,Ht,Ul,pr,Wt,Gt,ke],ys=e=>e+"_cpm",lp=["__proto__","constructor","prototype"],en=e=>{if(!j(e))return{};let t={};return Object.keys(e).forEach(i=>{lp.indexOf(i)===-1&&(t[i]=e[i])}),t},tn=(e,t=[])=>{let i={};return[...Tt,...t].forEach(s=>{let n=e[s];x(n)||ne(n)||n===""||(i[s]=n)}),i},dc=e=>{let t=5381,i=2166136261;for(let s=0;e.length>s;s++){let n=e.charCodeAt(s);t=33*t^n,i=Math.imul(i^n,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},Fo=(e,t)=>({p:t,f:dc(JSON.stringify(e))}),Ao=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{let i=se.Lt(ys(e)),s=(i==null?void 0:i.f)===dc(t)&&O(i.p);return{properties:s?i.p:[],isValid:s}}catch{return{properties:[],isValid:!1}}},sn=(e,t)=>t+"|"+(se.Ot(ys(e))||""),Rt={},Gn={At:()=>!0,Dt(e){T.error("memoryStorage error: "+e)},Ot:e=>e in Rt?Rt[e]:null,Lt:e=>e in Rt?Rt[e]:null,$t:(e,t)=>(Rt[e]=t,!0),Pt(e){delete Rt[e]}},xt=null,J={At(){if(!ne(xt))return xt;if(xt=!0,x(b))xt=!1;else try{let e="__support__";J.$t(e,"xyz"),J.Ot(e)!=='"xyz"'&&(xt=!1),J.Pt(e)}catch{xt=!1}return xt},Dt(e){T.error("sessionStorage error: ",e)},Ot(e){try{return b==null?void 0:b.sessionStorage.getItem(e)}catch(t){J.Dt(t)}return null},Lt(e){try{return JSON.parse(J.Ot(e))||null}catch{}return null},$t(e,t){try{return b==null||b.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(i){J.Dt(i)}return!1},Pt(e){try{b==null||b.sessionStorage.removeItem(e)}catch(t){J.Dt(t)}}},cp=class{constructor(e){this._instance=e}get Mr(){return this._instance.config}get consent(){return this.Do()?0:this.Lo}isOptedOut(){return this.Mr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Mr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Mr.opt_out_capturing_by_default}optInOut(e){this.No.$t(this.qo,e?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.No.Pt(this.qo,this.Mr.cross_subdomain_cookie)}get qo(){let{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 Lo(){let e=this.No.Ot(this.qo);return js(e)?1:A(ld,e)?0:-1}get No(){let e=this.Mr.opt_out_capturing_persistence_type,t=e==="localStorage"?U:se,i=t.At()?t:Gn;if(!this.jo||this.jo!==i){this.jo=i;let s=e==="localStorage"?se:U;s.Ot(this.qo)&&(this.jo.Ot(this.qo)||this.optInOut(js(s.Ot(this.qo))),s.Pt(this.qo,this.Mr.cross_subdomain_cookie))}return this.jo}Do(){return!!this.Mr.respect_dnt&&[pe==null?void 0:pe.doNotTrack,pe==null?void 0:pe.msDoNotTrack,F.doNotTrack,pe==null?void 0:pe.globalPrivacyControl].some(e=>js(e))}};function hc(e,t){var i;let s=e==null||(i=e.config)===null||i===void 0?void 0:i.get_current_url;if(!le(s))return t;try{let n=s(t);return V(n)&&n?n:t}catch(n){return T.error("Error in get_current_url, falling back to window.location.href",n),t}}function Oo(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function Be(e){return!!e&&e.nodeType===1}function _e(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function pc(e){return!!e&&e.nodeType===3}function yr(e){return!!e&&e.nodeType===11&&Be(e.host)}function br(e){return e?Zt(e).split(/\s+/):[]}function Ro(e,t){let i=(function(s){var n;let r=b==null||(n=b.location)===null||n===void 0?void 0:n.href;return x(r)?void 0:hc(s,r)})(t);return!!(i&&e&&e.some(s=>i.match(s)))}function Xt(e){let 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 br(t)}function fc(e){return L(e)?null:Zt(e).split(/(\s+)/).filter(t=>qt(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Oi(e){let t="";return Ft(e)&&!Jt(e)&&e.childNodes&&e.childNodes.length&&Z(e.childNodes,function(i){var s;pc(i)&&i.textContent&&(t+=(s=fc(i.textContent))!==null&&s!==void 0?s:"")}),Zt(t)}function Ei(e){var t;return x(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var wr=["a","button","form","input","select","textarea","label"];function qn(e,t){let i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch{return!1}}function Zn(e,t){if(x(t))return!0;for(let i of e)if(t.some(s=>qn(i,s)))return!0;return!1}function vc(e){let t=e.parentNode;return!(!t||!Be(t))&&t}var nn=[".ph-no-autocapture","[data-ph-no-autocapture]"],gc=["next","previous","prev",">","<","\u2192","\u2190","\u203A","\u2039","\xBB","\xAB","\u25B6","\u25C0","\u276F","\u276E"],xr=[...gc,"+","-","\u2212","\u2013"],Lo=xr.length+10,up=["button","a","input","select","textarea","label"],dp=["button","link","tab","menuitem","option"],Do=(e,t)=>/[a-z0-9]/i.test(t)?A(xr,t)?new RegExp(`\\b${t}\\b`).test(e):e.includes(t):e===t,hp=e=>A(up,e.tagName.toLowerCase())||A(dp,(e.getAttribute("role")||"").toLowerCase());function rn(e){let t="",i="",s=o=>{Be(o)&&Ft(o)&&!Jt(o)&&(t+=` ${Oi(o)}`,i=i||o.getAttribute("aria-label")||"",Z(o.childNodes,s))};s(e),t=Zt(t.replace(/\s+/g," "));let n=(qt(t)?t:"").toLowerCase(),r=e.getAttribute("aria-label")||(n?"":i);return{safeText:n,ariaLabel:Zt(r).toLowerCase()}}var No=[".ph-no-rageclick",".ph-no-capture"],pp=["","text","search","email","password","url","tel","number"];function _c(e,t){if(!b||kr(e))return!1;let i,s,n;var r,o;if(Se(t)?(i=!!t&&No,s=void 0,n=!1):(i=(r=t==null?void 0:t.css_selector_ignorelist)!==null&&r!==void 0?r:No,s=t==null?void 0:t.content_ignorelist,n=(o=t==null?void 0:t.ignore_text_selection)!==null&&o!==void 0&&o),i===!1||n&&(function(l){return!(!l||!Be(l))&&(!!_e(l,"textarea")||(_e(l,"input")?A(pp,(l.getAttribute("type")||"").toLowerCase()):(function(c){var u;if(c.isContentEditable)return!0;let d=(u=c.getAttribute)===null||u===void 0?void 0:u.call(c,"contenteditable");return d==="true"||d===""})(l)))})(e))return!1;let{targetElementList:a}=mc(e,!1);return!(s&&(function(l,{safeText:c,ariaLabel:u}){let d;if(l===!0)d=gc;else{if(!O(l))return!1;if(l.length>Lo)return T.error(`[PostHog] content_ignorelist array cannot exceed ${Lo} items. Use css_selector_ignorelist for more complex matching.`),!1;d=l.map(h=>h.toLowerCase())}return d.some(h=>Do(c,h)||Do(u,h))})(s,(function(l,c){for(let u of c)if(hp(u))return rn(u);for(let u of c){try{if((b==null?void 0:b.getComputedStyle(u).getPropertyValue("cursor"))!=="pointer")break}catch{break}let d=rn(u);if(d.safeText||d.ariaLabel)return d}return rn(l)})(e,a))||Zn(a,i))}var kr=e=>!e||_e(e,"html")||!Be(e),mc=(e,t)=>{if(!b||kr(e))return{parentIsUsefulElement:!1,targetElementList:[]};let i=!1,s=[e],n=e;for(;n.parentNode&&!_e(n,"body");){if(yr(n.parentNode)){s.push(n.parentNode.host),n=n.parentNode.host;continue}let r=vc(n);if(!r)break;if(t||wr.indexOf(r.tagName.toLowerCase())>-1)i=!0;else try{let o=b.getComputedStyle(r);o&&o.getPropertyValue("cursor")==="pointer"&&(i=!0)}catch{}s.push(r),n=r}return{parentIsUsefulElement:i,targetElementList:s}};function Ft(e){let t=new Set,i=0;for(let r=e;r.parentNode&&!_e(r,"body");r=r.parentNode){if(i++>=1e3||t.has(r))return!1;t.add(r);let o=Xt(r);if(A(o,"ph-sensitive")||A(o,"ph-no-capture"))return!1}if(A(Xt(e),"ph-include"))return!0;let s=e.type||"";if(V(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}let n=e.name||e.id||"";return!V(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function Jt(e){return!!(_e(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||_e(e,"select")||_e(e,"textarea")||e.getAttribute("contenteditable")==="true")}var jo=new RegExp("^(?:(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}))$"),Vo=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,fp=[16,15,14,13],vp=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Ho=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Wo=/[0-9A-Za-z_]/;function gp(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let n=e.charCodeAt(s)-48;i&&(n*=2,n>9&&(n-=9)),t+=n,i=!i}return t%10==0}function qt(e,t=!0){return!(L(e)||V(e)&&(e=Zt(e),(t?jo.test((e||"").replace(/[- ]/g,"")):(function(i){let s;for(Vo.lastIndex=0;s=Vo.exec(i);){let n=s[2];if(!n)continue;let r=n.replace(/[- ]/g,"");for(let o=0;r.length>o;o++)for(let a of fp){let l=o+a;if(r.length>=l){let c=r.slice(o,l);if(jo.test(c)&&gp(c))return!0}}}return!1})(e))||(t?vp.test(e):(function(i){let s;for(Ho.lastIndex=0;s=Ho.exec(i);){let n=s[1],r=s[3];if(!(n&&r&&Wo.test(n)&&Wo.test(r)))return!0}return!1})(e))))}function Bo(e){let t=Oi(e);return t=`${t} ${yc(e)}`.trim(),qt(t)?t:""}function yc(e){let t="";return e&&e.childNodes&&e.childNodes.length&&Z(e.childNodes,function(i){var s;if(i&&((s=i.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{let n=Oi(i);t=`${t} ${n}`.trim(),i.childNodes&&i.childNodes.length&&(t=`${t} ${yc(i)}`.trim())}catch(n){T.error("[AutoCapture]",n)}}),t}function Uo(e){return e.replace(/"|\\"/g,'\\"')}function _p(e){let t=e.attr__class;if(t)return O(t)?t:br(t)}var qi=re("[Dead Clicks]"),mp=()=>!0,yp=e=>{var t;let i=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(dr)),s=e.instance.config.capture_dead_clicks;return Se(s)?s:!!j(s)||i},zo=class{get lazyLoadedDeadClicksAutocapture(){return this.Bo}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[dr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Ho()}):this.stop()}zo(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this.instance,"dead-clicks-autocapture",n=>{n?qi.error("failed to load script",n):e()})}Ho(){var e;if(E){if(!this.Bo&&(!((e=F.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){let t=j(this.instance.config.capture_dead_clicks)?f({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Bo=F.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Bo.start(E),qi.info("starting...")}}else qi.error("`document` not found. Cannot start.")}stop(){this.Bo&&(this.Bo.stop(),this.Bo=void 0,qi.info("stopping..."))}},ui=re("[SegmentIntegration]");function Go(e,t,i=!0){let s=e.config.segment;if(!s)return t();let{analytics:n,filterProperties:r}=(a=>le(a.register))(o=s)?{analytics:o}:o;var o;(function(a,l,c,u){let d=p=>{let v=()=>p.anonymousId()||We();a.config.get_device_id=v,u&&p.id()&&(a.register({distinct_id:p.id(),$device_id:v()}),a.persistence.set_property(ke,ss)),c(u?void 0:p.anonymousId()||void 0)},h=l.user();"then"in h&&le(h.then)?h.then(d):d(h)})(e,n,a=>{n.register(((l,c,{filterProperties:u}={})=>{typeof Promise!="undefined"&&Promise.resolve||ui.warn("This browser does not have Promise support, and can not use the segment integration");let d=(h,p)=>{if(!p)return h;let v=!!c&&h.event.anonymousId===c&&!h.event.userId;v||h.event.userId||h.event.anonymousId===l.get_distinct_id()||(ui.info("No userId set, resetting PostHog"),l.reset()),v||(c=void 0),h.event.userId&&h.event.userId!==l.get_distinct_id()&&(ui.info("UserId set, identifying with PostHog"),l.identify(h.event.userId));let _=l.calculateEventProperties(p,h.event.properties);if(!L(u)){let g=h.event.properties||{},y={};for(let w of Object.keys(_))nr.call(g,w)||(y[w]=_[w]);let m=((w,M)=>{let P=O(w)?w:[w],k=f({},M);for(let I of P)try{if(k=I(k),L(k))return null}catch(S){return ui.error("Error in Segment filterProperties:",S),null}return k})(u,y);if(L(m))return h;_=m}return h.event.properties=Object.assign({},_,h.event.properties),h};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(h){return d(h,h.event.event)},page(h){return d(h,_r)},identify(h){return d(h,lc)},screen(h){return d(h,"$screen")}}})(e,a,{filterProperties:r})).then(()=>{t()},l=>{ui.error("Failed to register the Segment integration",l),t()})},i)}var bc="posthog-js";function wc(e,{organization:t,projectId:i,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,c,u,d;if(n!=="*"&&!n.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});let h=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));let p=((a=o.exception)===null||a===void 0?void 0:a.values)||[],v=p.map(y=>f(f({},y),{},{stacktrace:y.stacktrace?f(f({},y.stacktrace),{},{type:"raw",frames:(y.stacktrace.frames||[]).map(m=>f(f({},m),{},{platform:"web:javascript"}))}):void 0})),_={$exception_message:((l=p[0])===null||l===void 0?void 0:l.value)||o.message,$exception_type:(c=p[0])===null||c===void 0?void 0:c.type,$exception_level:o.level,$exception_list:v,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((u=p[0])===null||u===void 0?void 0:u.value)||o.message,$sentry_exception_type:(d=p[0])===null||d===void 0?void 0:d.type,$sentry_tags:o.tags};var g;return t&&i&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),r&&((g=e.exceptions)===null||g===void 0||g.sendExceptionEvent(_)),o}}var bp=class{constructor(e,t,i,s,n,r){this.name=bc,this.setupOnce=function(o){o(wc(e,{organization:t,projectId:i,prefix:s,severityAllowList:n,sendExceptionsToPostHog:r==null||r}))}}},qo=class{constructor(e){this.Uo=(t,i,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&(T.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.Wo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Vo()}Vo(){var e;this.Go=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Uo)}destroy(){var e;(e=this.Go)===null||e===void 0||e.call(this),this.Go=void 0}doPageView(e,t){var i;let s=this.Qo(e,t);return this.Wo={pathname:(i=b==null?void 0:b.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Qo(e,(t=this.Wo)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Wo)===null||e===void 0?void 0:e.pageViewId}}Qo(e,t){let i=this.Wo;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:r,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=n;if(!(x(r)||x(o)||x(a)||x(l)||x(c)||x(u))){r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);let d=r>1?Xe(o/r,0,1,T):1,h=r>1?Xe(a/r,0,1,T):1,p=l>1?Xe(c/l,0,1,T):1,v=l>1?Xe(u/l,0,1,T):1;s=Q(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}},di=["flags","surveys"],wp={[Ah]:{exposure:"hidden"},[gs]:{exposure:"hidden"},[Oh]:{exposure:"hidden"},[Dn]:{exposure:"hidden"},[Gt]:{exposure:"hidden"},[xi]:{exposure:"hidden"},[Vl]:{exposure:"event"},[Nn]:{exposure:"hidden"},[Wl]:{exposure:"hidden"},[jn]:{exposure:"event"},[Hl]:{exposure:"hidden"},[Vn]:{exposure:"event"},[Hn]:{exposure:"event"},[dr]:{exposure:"event"},[hr]:{exposure:"hidden"},[Bl]:{exposure:"event"},[ki]:{exposure:"hidden"},[Rh]:{exposure:"hidden"},[Ht]:{exposure:"hidden"},[Ul]:{exposure:"event"},[Lh]:{exposure:"event",shouldSkipFromEventProperties:e=>ne(e)},[Hh]:{exposure:"event"},[Wh]:{exposure:"event"},[Bh]:{exposure:"event"},[Uh]:{exposure:"event"},[zh]:{exposure:"hidden"},[He]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"hidden",storageGroup:"flags"},[Ln]:{exposure:"hidden"},[It]:{exposure:"hidden",storageGroup:"flags"},[_t]:{exposure:"hidden",storageGroup:"flags"},[Ct]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[wi]:{exposure:"hidden",storageGroup:"flags"},[Ze]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[vt]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[_i]:{exposure:"hidden",storageGroup:"surveys"},[_s]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Gl]:{exposure:"event"},[ql]:{exposure:"hidden"},[Zl]:{exposure:"hidden"},[Wn]:{exposure:"hidden"},[Gh]:{exposure:"hidden"},[qh]:{exposure:"hidden"},[Zh]:{exposure:"event"},[Yh]:{exposure:"event"},[Xh]:{exposure:"event"},[Jh]:{exposure:"event"},[gt]:{exposure:"hidden"},[gi]:{exposure:"hidden"},[zl]:{exposure:"event"},[Fi]:{exposure:"hidden"},[mt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ke]:{exposure:"hidden"},[Bn]:{exposure:"hidden"},[Kh]:{exposure:"hidden"},[Yl]:{exposure:"hidden"},[Xl]:{exposure:"hidden"},[Wt]:{exposure:"hidden"},[pr]:{exposure:"hidden"},[Dh]:{exposure:"event"},[Nh]:{exposure:"event"},[jh]:{exposure:"event"},[Vh]:{exposure:"event"},[Kl]:{exposure:"event"},[Ql]:{exposure:"event"},[fr]:{exposure:"hidden"},[vr]:{exposure:"hidden"},[ec]:{exposure:"hidden"},[tc]:{exposure:"hidden"},[ic]:{exposure:"hidden"},[sc]:{exposure:"hidden"},[nc]:{exposure:"hidden"},[rc]:{exposure:"hidden"},[oc]:{exposure:"hidden"},[Qh]:{exposure:"event"}},xp=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],fe=e=>{let t=wp[e];if(t)return t;for(let[i,s]of xp)if(e.indexOf(i)===0)return s};function xc(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}var kc=()=>{try{return"u">typeof window&&window.navigator.onLine!==!1}catch{return!1}},Sc=(e,t)=>e>=t&&kc(),Ec=(e,t,i,s)=>{if(e===0){if(kc()){let n=t+1;return n===i&&s(),n}return t}return 0},Ut=(e,t)=>{try{let i;return JSON.stringify(e,(s,n)=>{var r;return ii(n)?((r=i)!==null&&r!==void 0||(i=new WeakMap),i.has(n)||i.set(n,cc(n)),i.get(n)):typeof n=="bigint"?n.toString():n},t)}catch{return Da(e)}},nt=e=>{let t=E==null?void 0:E.createElement("a");return x(t)?null:(t.href=e,t)},Kt=function(e,t){let i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s;for(let n=0;i.length>n;n++){let r=i[n].split("=");if(r[0]===t){s=r;break}}if(!O(s)||2>s.length)return"";{let n=s[1];try{n=decodeURIComponent(n)}catch{T.error("Skipping decoding for malformed query param: "+n)}return n.replace(/\+/g," ")}},Ri=function(e,t,i){if(!e||!t||!t.length)return e;let s=e.split("#"),n=s[1],r=(s[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),c=[];for(let d=0;l.length>d;d++){let h=l[d].split("=");O(h)&&(t.includes(h[0])?c.push(h[0]+"="+i):c.push(l[d]))}let u=a;return o!=null&&(u+="?"+c.join("&")),n!=null&&(u+="#"+n),u},bs=function(e,t){let i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Qt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","irclid","_kx"],kp=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Qt],Li="<masked>",Sp=["li_fat_id"];function $c(e,t,i){if(!E)return{};let s=t?[...Qt,...i||[]]:[],n=Pc(Ri(E.URL,s,Li),e),r=(function(){let o={};return Z(Sp,function(a){let l=Si(a);o[a]=l||null}),o})();return Q(r,n)}function Pc(e,t){let i=kp.concat(t||[]),s={};return Z(i,function(n){let r=Kt(e,n);s[n]=r||null}),s}function Mc(e){let t=(function(n){return n?n.search("https?://(.*)google.([^/?]*)")===0?"google":n.search("https?://(.*)bing.com")===0?"bing":n.search("https?://(.*)yahoo.com")===0?"yahoo":n.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(e),i=t!="yahoo"?"q":"p",s={};if(!ne(t)){s.$search_engine=t;let n=E?Kt(E.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function Tc(){return navigator.language||navigator.userLanguage}function Ep(){let e=Tc();return typeof e=="string"?e.split("-")[0]:void 0}var ws="$direct";function Ic(){return(E==null?void 0:E.referrer)||ws}function Cc(e,t,i=!1){let s=e?[...Qt,...t||[]]:[],n=i?yt(K==null?void 0:K.href):K==null?void 0:K.href,r=n==null?void 0:n.substring(0,1e3);return{r:Ic().substring(0,1e3),u:r?Ri(r,s,Li):void 0}}function Fc(e,t=!1){var i;let{r:s,u:n}=e,r=t?yt(n):n,o={$referrer:s,$referring_domain:s==null?void 0:s==ws?ws:(i=nt(s))===null||i===void 0?void 0:i.host};if(r){o.$current_url=r;let a=nt(r);o.$host=a==null?void 0:a.host,o.$pathname=a==null?void 0:a.pathname;let l=Pc(r);Q(o,l)}if(s){let a=Mc(s);Q(o,a)}return o}function $p(){try{return new Date().getTimezoneOffset()}catch{return}}var Pp={flags:mt,surveys:_s},Mp=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Zi=e=>`${e}_cookie_identity_change_pending`,Yi=e=>{let t="",i=0;for(let s of e){let n=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+n>1e3)break;t+=s,i+=n}return t},ce="main",et=[He,tt,It,_t,Ct,mt,wi,vt],on=e=>et.indexOf(e)!==-1,Ac=[Gt,xi],Zo=e=>Ac.indexOf(e)!==-1,ut=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},Lt=e=>{if(!e)return{};let t=JSON.parse(e);return j(t)?t:{}},Yo=(e,t)=>{Z(e,(i,s)=>{let n=fe(s);n&&n.exposure!=="event"||{}.hasOwnProperty.call(t,s)||delete e[s]})},an=class{constructor(e,t,i=!0,s=!e.cookieless_mode){if(this.Zo={},this.Jo=!1,this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=new Map,this.ia=!1,this.na=!1,this.sa=!1,this.ra=new Set,this.oa=new Set,this.Mr=e,this.aa=i,this.props={},this.la=void 0,this.ua=(n=>{let r="";return n.token&&(r=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+r+"_posthog"})(e),this.hi=e.disable_persistence||!!t,this.No=this.ca(e),this.Xo=this.ha(e),this.load(s),this.da(),e.debug&&T.info("Persistence loaded",e.persistence,f({},this.props)),this.update_config(e,e,t),this.save(),b){let n=()=>this.flush();G(b,"beforeunload",n,{capture:!1}),G(b,"pagehide",n,{capture:!1}),this.va=r=>{if(this.Jo&&(!r.storageArea||r.storageArea===(b==null?void 0:b.localStorage))&&r.key)if(r.key!==this.ua){if(this.Xo){let o=di.find(a=>r.key===this.fa(a));o&&this.pa(r.key,o)}}else this.pa(r.key,ce)},G(b,"storage",this.va)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,i])=>{let s=this.ea.get(t);if(!on(t)||s===!0)return;if(i===!0)return void this.ga(t,!0);let n=new Set(s||[]);i.forEach(r=>n.add(r)),n.size&&this.ga(t,n)})}onCrossTabFeatureFlagChange(e){return this.oa.add(e),()=>this.oa.delete(e)}destroy(){this.va&&b&&(b.removeEventListener("storage",this.va),this.va=void 0),this.oa.clear()}pa(e,t,i=!0){if(this.hi)return!1;let s,n;try{if(n=U.Ot(e),ne(n)){let a=this.ma(t);return a.storageValue=null,t!==ce&&(a.persisted=!1),!1}s=Lt(n)}catch{return!1}let r=t===ce?s:U.Lt(this.ua);if(r&&this.ya(r))return!1;let o=this.ba(s,t,i);return t===ce&&this.Xo&&!ut(this._a().main,s)||this.wa(s,t,!0,n),o}ya(e){let t=this.props[Ve],i=e[Ve];return!x(t)&&!x(i)&&t!==i}wa(e,t,i,s){let n=this.ma(t);n.storageValue=s,t!==ce&&(n.persisted=i);try{n.fingerprint=this.ka(e,t)}catch{n.fingerprint=void 0}}ba(e,t,i){let s=!1;return et.forEach(n=>{var r;let o=(r=fe(n))===null||r===void 0?void 0:r.storageGroup;if(t===ce&&this.Xo&&o||t!==ce&&o!==t)return;let a=n in e,l=this.Sa(n,a?e[n]:void 0),c=this.ea.has(n)?n in this.props:a;c===n in this.props&&ut(l,this.props[n])||(c?this.xa(n,l,!1):this.$a(n,!1),s=!0)}),s&&i&&this.oa.forEach(n=>n()),s}Ca(){if(!this.Jo)return!1;try{this.sa=!1;let e=U.Ot(this.ua),t=this.ma(ce),i,s=!1,n=!1;if(e!==t.storageValue)if(ne(e))t.storageValue=null;else{if(i=Lt(e),this.sa=!this.na&&this.ya(i),this.sa)return!1;n=this.ba(i,ce,!1),!this.Xo||ut(this._a().main,i)?this.wa(i,ce,!0,e):t.storageValue=e,s=!0}return this.Xo&&di.forEach(r=>{let o=U.Ot(this.fa(r)),a=this.ma(r),l=i||{},c=s&&et.some(d=>{var h;return((h=fe(d))===null||h===void 0?void 0:h.storageGroup)===r&&d in l});if(o===a.storageValue&&!c)return;if(ne(o))return a.storageValue=null,a.persisted=!1,void(c&&(n=this.ba(l,r,!1)||n));let u=Lt(o);n=this.ba(u,r,!1)||n,this.wa(u,r,!0,o)}),n}catch{return!1}}ga(e,t){this.ea.set(e,t);let i=fe(e);i!=null&&i.volatile||(this.ma((this.Xo?i==null?void 0:i.storageGroup:void 0)||ce).fingerprint=void 0,this.Ta(e))}Ia(){et.forEach(e=>this.ea.set(e,!0))}da(){if(this.Jo)try{let e=U.Ot(this.ua),t=Lt(e);this.ma(ce).storageValue=e,et.forEach(i=>{var s;let n=this.Xo?(s=fe(i))===null||s===void 0?void 0:s.storageGroup:void 0,r=n?U.Ot(this.fa(n)):null;if(n){let a=this.ma(n);a.storageValue=r,a.persisted=!ne(r)}let o=n&&!ne(r)?Lt(r):t;i in this.props?this.Ma(i,o[i],this.props[i]):i in o&&this.ga(i,!0)})}catch{}}Sa(e,t){let i=this.ea.get(e);if(!i)return t;if(i===!0)return this.props[e];if(e==="$active_feature_flags"){let r=new Set(O(t)?t:[]),o=new Set(O(this.props[e])?this.props[e]:[]);return i.forEach(a=>o.has(a)?r.add(a):r.delete(a)),Array.from(r)}let s=j(t)?f({},t):{},n=j(this.props[e])?this.props[e]:{};return i.forEach(r=>{r in n?s[r]=n[r]:delete s[r]}),s}Ma(e,t,i){if(!on(e))return;let s=this.ea.get(e);if(s===!0)return;let n=t;if(this.Jo)try{var r;let a=this.Xo?(r=fe(e))===null||r===void 0?void 0:r.storageGroup:void 0,l=a?this.fa(a):this.ua;n=Lt(U.Ot(l))[e]}catch{}let o=new Set(s||[]);if(e==="$active_feature_flags"){if(!x(t)&&!O(t)||!x(n)&&!O(n)||!O(i))return void this.ga(e,!0);let a=new Set(t||[]),l=new Set(n||[]),c=new Set(i);new Set([...a,...c]).forEach(u=>{a.has(u)!==c.has(u)&&o.add(u)}),o.forEach(u=>{l.has(u)===c.has(u)&&o.delete(u)})}else{if(!j(i))return void(ut(n,i)?this.ea.delete(e):this.ga(e,!0));{if(!x(t)&&!j(t)||x(t)&&Me(i)&&x(n))return void this.ga(e,!0);let a=j(t)?t:{},l=j(n)?n:{};new Set([...Object.keys(a),...Object.keys(i)]).forEach(c=>{c in a==c in i&&ut(a[c],i[c])||o.add(c)}),o.forEach(c=>{c in l==c in i&&ut(l[c],i[c])&&o.delete(c)})}}o.size?this.ga(e,o):this.ea.delete(e)}Ea(){var e;let t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return oe(t)&&t>0?t:0}Pa(e){if(this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{let t=tn(e,this.Mr.cookie_persisted_properties||[]),i=Fo(t,this.Mr.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),n=se.Ot(this.ua)||void 0;n&&sn(this.ua,n)===s&&(this.Ra=s,this.Aa=n)}catch{}else try{let t=se.Ot(this.ua)||void 0;this.Ra=t?sn(this.ua,t):void 0,this.Aa=t}catch{}}syncCookieProperties(){return this.Fa(this.Mr)}Fa(e,t=!1){if(this.hi&&!t||this.ta||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let i;try{i=se.Ot(this.ua)||void 0}catch{}if(!i||i===this.Aa)return!1;let s=sn(this.ua,i),n;try{n=en(JSON.parse(i))}catch{return!1}if((se.Ot(this.ua)||void 0)!==i)return!1;this.Ra=s,this.Aa=i;let r=Ao(this.ua,i),o=[...Tt,...r.properties],a={};if(Object.keys(n).forEach(_=>{let g=n[_];(x(g)||ne(g)||g===""||_==="$user_state"&&g!=="anonymous"&&g!=="identified")&&(a[_]=!0,delete n[_])}),Me(n))return!1;let l="distinct_id"in n||n.$user_state==="anonymous"||n.$user_state==="identified",c=this.props,u=c[Ve],d=c[ke],h=Q({},c);[...Tt,...e.cookie_persisted_properties||[]].forEach(_=>{if(o.indexOf(_)!==-1&&!(_ in n)&&!a[_]&&(l||_!=="distinct_id"&&_!=="$user_state")){let g=h[_];(r.isValid||Tt.indexOf(_)===-1||g!==!1&&g!==0)&&delete h[_]}}),this.props=Q(h,n),et.forEach(_=>{let g=_ in this.props;_ in c===g&&ut(c[_],this.props[_])||(g?this.Ma(_,c[_],this.props[_]):this.ga(_,!0))}),!l||"$user_state"in n||"$user_state"in this.props||this.xa(ke,it);let p=this.props[Ve],v=this.props[ke];return!l||p===u&&v===d||(this.na=!0,this.Yo=!0,J.$t(Zi(this.ua),!0),this.$a(vt),this.$a(tt),this.$a(He),this.$a(It),this.$a(_t),this.$a(Ct),this.$a(mt),this.$a(Fi),this.$a(gt),v!=="anonymous"||d!=="identified"&&n.$user_state!=="anonymous"&&(x(u)||p===u)||(Yo(this.props,n),this.$a(ft)),v==="identified"?this.props.$user_id=p:delete this.props.$user_id,this.$a(gs)),!0}consumeCookieIdentityChange(){let e=Zi(this.ua),t=this.Yo||!!J.Ot(e);return this.Yo=!1,t&&J.Pt(e),t}Oa(e=!1){return!(this.ta||this.hi&&!e||!this.Mr.cookieWinsOnConflict||this.Mr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ta=!0,0))}Da(){this.ta&&(x(this.La)||(clearTimeout(this.La),this.La=void 0),delete this.Zo[ce],this.Na(!0))}qa(e=!0){if(this.ta)try{e?this.Da():x(this.La)||(clearTimeout(this.La),this.La=void 0)}finally{this.ta=!1}}isDisabled(){return!!this.hi}ca(e){Mp.indexOf(e.persistence.toLowerCase())===-1&&(T.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");let t=((o=[],a=!1,l=()=>!1)=>{let c=[...Tt,...o];return f(f({},U),{},{Lt(u){try{let h,p={};try{h=se.Ot(u)||void 0,p=h?en(JSON.parse(h)):{}}catch{}let v=JSON.parse(U.Ot(u)||"{}"),_;if(a){let g=Ao(u,h),y=[...Tt,...g.properties],m={};Object.keys(p).forEach(M=>{let P=p[M];ne(P)||P===""||M==="$user_state"&&P!=="anonymous"&&P!=="identified"||(m[M]=P)});let w="distinct_id"in m||m.$user_state==="anonymous"||m.$user_state==="identified";if(Object.keys(m).length>0){var d;let M=v[Ve],P=(d=v.$user_state)!==null&&d!==void 0?d:it;c.forEach(k=>{if(y.indexOf(k)!==-1&&!(k in p)&&(w||k!=="distinct_id"&&k!=="$user_state")){let I=v[k];(g.isValid||Tt.indexOf(k)===-1||I!==!1&&I!==0)&&delete v[k]}}),!w||"$user_state"in p||"$user_state"in v||(v[ke]=it),!w||("distinct_id"in m?m[Ve]:v[Ve])===M&&("$user_state"in m?m[ke]:v[ke])===P||(Qs.forEach(k=>delete v[k]),m.$user_state==="identified"&&"distinct_id"in m?v.$user_id=m[Ve]:delete v.$user_id,m.$user_state!=="identified"&&(delete v[zl],delete v[ft]),delete v.__alias)}_=Q(v,m)}else _=Q(p,v);return l()||U.$t(u,_),_}catch{}return null},$t(u,d,h,p,v,_){let g=U.$t(u,d,void 0,void 0,_);try{let y=tn(d,o);if(Object.keys(y).length){if(a){let m=ys(u),w=Fo(y,o);if(se.$t(m,w,h,p,v,_),se.Ot(m)!==JSON.stringify(w)){se.Pt(m,p);let M=tn(d);return se.$t(u,M,h,p,v,_),g}}se.$t(u,y,h,p,v,_)}}catch(y){U.Dt(y)}return g},Pt(u,d){try{b==null||b.localStorage.removeItem(u),se.Pt(u,d),se.Pt(ys(u),d)}catch(h){U.Dt(h)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict,()=>!!this.hi),i,s=!1,n=!1,r=e.persistence.toLowerCase();return r==="localstorage"&&U.At()?(i=U,n=!0):r==="localstorage+cookie"&&t.At()?(i=t,n=!0,s=!0):r==="sessionstorage"&&J.At()?i=J:r==="memory"?i=Gn:r==="cookie"&&se.At()?(i=se,s=!0):t.At()?(i=t,n=!0,s=!0):se.At()?(i=se,s=!0):i=Gn,this.Jo=n,this.Ko=s,i}fa(e){return`${this.ua}__${e}`}ha(e){return this.Jo&&!!e.split_storage}properties(){let e={};return Z(this.props,(t,i)=>{let s=fe(i);if(!s||s.exposure==="event"){var n;if(!(s==null||(n=s.shouldSkipFromEventProperties)===null||n===void 0)&&n.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this.hi&&!e)return;let t=this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie",i=t?U.Lt(this.ua):null,s={};if(t)try{s=en(se.Lt(this.ua)),Z(s,(a,l)=>{(x(a)||ne(a)||a==="")&&delete s[l]})}catch{}let n=this.No.Lt(this.ua);if(n&&(this.props=Q({},n)),this.Xo&&this.ja(),t&&n){var r,o;let a=i==null?void 0:i[Ve],l=(r=i==null?void 0:i.$user_state)!==null&&r!==void 0?r:it,c=n[Ve],u=(o=n.$user_state)!==null&&o!==void 0?o:it;if(c!==a||u!==l){this.Yo=!0,this.hi||J.$t(Zi(this.ua),!0);let d=Q({},this.props);Qs.forEach(p=>delete d[p]),u!=="anonymous"||l!=="identified"&&s.$user_state!=="anonymous"&&(x(a)||c===a)||(Yo(d,s),delete d[ft]),this.props=d;let h=new Set;Qs.forEach(p=>{var v;let _=(v=fe(p))===null||v===void 0?void 0:v.storageGroup;_&&h.add(_)}),h.forEach(p=>{if(this.hi)return;let v={};Z(this.props,(_,g)=>{var y;((y=fe(g))===null||y===void 0?void 0:y.storageGroup)===p&&(v[g]=_)}),Me(v)?(U.Pt(this.fa(p)),this.Zo[p]={}):U.$t(this.fa(p),v)&&(this.Zo[p]={persisted:!0,fingerprint:this.ka(v,p)})})}}J.Ot(Zi(this.ua))&&(this.Yo=!0)}ja(){for(let e of di){let t=U.Lt(this.fa(e));if(t&&!Me(t)){let i=this.ma(e);i.persisted=!0,this.Ba(e)||(i.fingerprint=this.ka(t,e)),this.za(e,t)||Q(this.props,t)}}}Ba(e){return Object.keys(this.props).some(t=>{var i;return((i=fe(t))===null||i===void 0?void 0:i.storageGroup)===e})}za(e,t){let i=Pp[e];if(!i)return!1;let s=t[i],n=this.props[i];return oe(s)&&oe(n)&&n>s}refreshKey(e){var t;if(this.hi||this.ra.has(e))return;let i=this.Xo?(t=fe(e))===null||t===void 0?void 0:t.storageGroup:void 0,s=i?U.Lt(this.fa(i)):this.No.Lt(this.ua);if(s&&e in s)this.xa(e,s[e],!1);else{if(i){let n=this.No.Lt(this.ua);if(n&&e in n)return void this.xa(e,n[e],!1)}this.$a(e,!1)}}save(){if(this.hi)return;let e=this.Ea();e>0?x(this.La)&&(this.La=setTimeout(()=>{this.La=void 0,this.Na()},e)):this.Na()}flush(){x(this.La)||(clearTimeout(this.La),this.La=void 0,this.Na())}Na(e=!1){if(this.hi||this.ta&&!e)return;e||(this.syncCookieProperties(),this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie"||Ac.forEach(n=>this.refreshKey(n)));let t=!e&&!this.ia;t||(this.sa=!1);let i=!!t&&this.Ca();if(this.sa)return void(this.Mr.debug&&T.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Xo)return this.Ha(),void(i&&this.oa.forEach(n=>n()));let s=this.Ua(this.No,this.ua,this.props,ce);s==="written"&&this.Pa(this.props),s!=="failed"&&(this.ea.clear(),this.na=!1,this.ra.clear()),i&&this.oa.forEach(n=>n())}Ha(){let{main:e,groups:t}=this._a(),i=this.Ua(this.No,this.ua,e,ce);i==="written"&&this.Pa(e),i!=="failed"&&(this.na=!1,this.ra.clear(),et.forEach(n=>{var r;!((r=fe(n))===null||r===void 0)&&r.storageGroup||this.ea.delete(n)}));for(let n of di){var s;let r=t[n];if(Me(r)&&!(!((s=this.Zo[n])===null||s===void 0)&&s.persisted)){et.forEach(a=>{var l;((l=fe(a))===null||l===void 0?void 0:l.storageGroup)===n&&this.ea.delete(a)});continue}let o=this.Ua(U,this.fa(n),r,n);o!=="failed"&&et.forEach(a=>{let l=fe(a);(l==null?void 0:l.storageGroup)!==n||o!=="written"&&l.volatile||this.ea.delete(a)})}}_a(){let e={},t={flags:{},surveys:{}};return Z(this.props,(i,s)=>{var n;let r=(n=fe(s))===null||n===void 0?void 0:n.storageGroup;r?t[r][s]=i:e[s]=i}),{main:e,groups:t}}ka(e,t){if(t===ce)return JSON.stringify(e)+"|"+this.Wa+"|"+this.Va+"|"+this.Ga;let i={};return Z(e,(s,n)=>{var r;i[n]=!((r=fe(n))===null||r===void 0)&&r.volatile?"__volatile__":s}),JSON.stringify(i)}Ua(e,t,i,s){let n=this.ma(s);if(s!==ce&&!n.dirty&&!x(n.fingerprint))return"skipped";let r;try{if(r=this.ka(i,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch{r=void 0}return e.$t(t,i,this.Wa,this.Va,this.Ga,this.Mr.debug)?(n.dirty=!1,s!==ce&&(n.persisted=!0),x(r)||(n.fingerprint=r),this.Jo&&(n.storageValue=U.Ot(t)),"written"):(this.Mr.debug&&T.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ia(),x(this.La)||(clearTimeout(this.La),this.La=void 0),this.No.Pt(this.ua,!1),this.No.Pt(this.ua,!0),!e&&this.aa)for(let t of di)U.Pt(this.fa(t));e?delete this.Zo[ce]:this.Zo={},this.Ra=void 0,this.Aa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(j(e)){this.syncCookieProperties(),x(t)&&(t="None"),this.Wa=x(i)?this.Qa:i;let s=!1;if(Z(e,(n,r)=>{this.props.hasOwnProperty(r)&&this.props[r]!==t||(this.xa(r,n),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(j(e)){this.syncCookieProperties(),this.Wa=x(t)?this.Qa:t;let i=!1;if(Z(e,(s,n)=>{e.hasOwnProperty(n)&&(this.props[n]!==s||j(s)||O(s))&&(this.xa(n,s),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();let t=typeof e=="string"?[e]:e,i=!1;for(let s of t)s in this.props&&(this.$a(s),i=!0);i&&this.save()}update_campaign_params(){let e=E==null?void 0:E.URL;if(e===this.la)return;let t=$c(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),i=!Me(mr(t));return i&&this.register(t),this.la=e,i?t:void 0}update_search_keyword(){this.register((function(){let e=E==null?void 0:E.referrer;return e?Mc(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:Ic(),$referring_domain:(E==null?void 0:E.referrer)&&((e=nt(E.referrer))===null||e===void 0?void 0:e.host)||ws},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;let e=Cc(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[Wt]:this.Ko?{r:Yi(e.r),u:e.u?Yi(e.u):void 0}:e},void 0)}get_initial_props(){let e={};Z([Xl,Yl],i=>{let s=this.props[i];s&&Z(s,function(n,r){e["$initial_"+Pn(r)]=n})});let t=this.props[Wt];if(t){let i=(function(s,n=!1){let r=Fc(s,n),o={};return Z(r,function(a,l){o[`$initial_${Pn(l)}`]=a}),o})(t,this.Mr.disable_capture_url_hashes);Q(e,i)}return e}safe_merge(e){return Z(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){let s=e.persistence!==t.persistence,n=!((p,v)=>{if(p.length!==v.length)return!1;let _=[...p].sort(),g=[...v].sort();return _.every((y,m)=>y===g[m])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s||n,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this.hi&&!a;a||this.Fa(t,l),this.Mr=e,!a&&(s||n||o)&&(this.Ra=void 0,this.Aa=void 0,this.Fa(f(f({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));let c=r||o?this.ca(e):this.No;this.Za();let u=this.ha(e),d=r||u!==this.Xo,h=!a&&(d||e.cross_subdomain_cookie!==this.Va||e.secure_cookie!==this.Ga)&&this.Oa(l);this.ia=d;try{if(this.Qa=this.Wa=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),d){let p=this.props;this.clear(),this.No=c,this.Xo=u,this.props=p,this.save()}else o&&(this.No=c,a||(delete this.Zo[ce],this.Na()))}finally{this.ia=!1,h&&this.qa()}}Za(){let e=this.props[Wt];if(!this.Ko||!j(e)||typeof e.r!="string")return;let t=Yi(e.r),i=typeof e.u=="string"?Yi(e.u):e.u;t===e.r&&i===e.u||this.xa(Wt,f(f({},e),{},{r:t,u:i}))}set_disabled(e){this.hi=e,this.hi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Va&&(this.Va=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){let i=this.props.__timers||{};i[e]=t,this.xa(Dn,i),this.save()}remove_event_timer(e){let t=this.props.__timers||{},i=t[e];return x(i)||(delete t[e],this.xa(Dn,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.xa(e,t),this.save()}xa(e,t,i=!0){var s;let n=this.props[e];this.props[e]=t,i&&(e!=="distinct_id"&&e!=="$user_state"||n===t||(this.na=!0),Zo(e)&&!ut(n,t)&&this.ra.add(e),this.Ma(e,n,t),!((s=fe(e))===null||s===void 0)&&s.volatile||this.Ta(e))}$a(e,t=!0){delete this.props[e],t&&(on(e)&&this.ga(e,!0),Zo(e)&&this.ra.add(e),this.Ta(e))}Ta(e){var t;let i=(t=fe(e))===null||t===void 0?void 0:t.storageGroup;i&&(this.ma(i).dirty=!0)}ma(e){return this.Zo[e]||(this.Zo[e]={})}},Ce={GZipJS:"gzip-js",Base64:"base64"},hi={Activation:"events",Cancellation:"cancelEvents"};var ln={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"};var Ie={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},cn={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Yn={Popover:"popover",Inline:"inline"};function Xi(e){let t=!0;return{dispose(){if(t){t=!1;let i=e();i&&le(i.then)&&i.then(void 0,()=>{})}}}}var Tp={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Xo={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Jo=re("[RateLimiter]"),Ip=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{let i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(s=>{Jo.info(`${s||"events"} is quota limited.`),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){return void Jo.warn(`could not rate limit - continuing. Error: "${s==null?void 0:s.message}"`,{text:i})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;let{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=new Date().getTime(),a=(t=(i=this.instance.persistence)===null||i===void 0?void 0:i.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:n,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>n&&(a.tokens=n);let l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){let c=(oe(a.dropped)?a.dropped:0)+1;a.dropped=c,!this.lastEventRateLimited&&this.Ja(c)&&(a.dropped=0)}return this.lastEventRateLimited=l,(s=this.instance.persistence)===null||s===void 0||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Ka(e){let t=this.instance.config.property_denylist;return!O(t)||!t.includes(e)}Xa(){var e;if(this.Ka("$current_url")&&this.Ka("$pathname")&&(K!=null&&K.pathname))return`${(e=K.origin)!==null&&e!==void 0?e:""}${K.pathname}`}Ja(e){var t,i;let{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this.Xa(),o=this.Ka("$session_id")?(t=(i=this.instance).get_session_id)===null||t===void 0?void 0:t.call(i):void 0,a=[`${e} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){let t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},dt=re("[RemoteConfig]"),Oc=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=F._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Ya(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}tl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return dt.info("Using preloaded remote config",this.remoteConfig),void this.el(this.remoteConfig);if(this._instance.il())return void dt.warn("Remote config is disabled. Falling back to local config.");this.Ya(e=>{if(!e)return dt.info("No config found after loading remote JS config. Falling back to JSON."),void this.tl(t=>{this.el(t.json,t)});this.el(e)})}catch(e){dt.error("Error loading remote config",e),this.el()}}el(e,t){!e&&t&&(t.statusCode===0?t.error||dt.warn("Failed to fetch remote config from PostHog."):dt.error("Failed to fetch remote config from PostHog."));try{this._instance.el(e?{ok:!0,config:e}:{ok:!1})}catch(s){dt.error("Error applying remote config",s)}if((e==null?void 0:e.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;(i=this._instance.featureFlags)===null||i===void 0||i.ensureFlagsLoaded()}catch(s){dt.error("Error loading feature flags",s)}}};var Fe=Uint8Array,Ee=Uint16Array,ei=Uint32Array,Sr=new Fe([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]),Er=new Fe([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]),Ko=new Fe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Rc=function(e,t){for(var i=new Ee(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var n=new ei(i[30]);for(s=1;30>s;++s)for(var r=i[s];i[s+1]>r;++r)n[r]=r-i[s]<<5|s;return[i,n]},Lc=Rc(Sr,2),Xn=Lc[1];Lc[0][28]=258,Xn[258]=28;for(Jn=Rc(Er,0)[1],xs=new Ee(32768),te=0;32768>te;++te)kt=(43690&te)>>>1|(21845&te)<<1,xs[te]=((65280&(kt=(61680&(kt=(52428&kt)>>>2|(13107&kt)<<2))>>>4|(3855&kt)<<4))>>>8|(255&kt)<<8)>>>1;var kt,Jn,xs,te,$i=function(e,t,i){for(var s=e.length,n=0,r=new Ee(t);s>n;++n)++r[e[n]-1];var o,a=new Ee(t);for(n=0;t>n;++n)a[n]=a[n-1]+r[n-1]<<1;if(i){o=new Ee(1<<t);var l=15-t;for(n=0;s>n;++n)if(e[n])for(var c=n<<4|e[n],u=t-e[n],d=a[e[n]-1]++<<u,h=d|(1<<u)-1;h>=d;++d)o[xs[d]>>>l]=c}else for(o=new Ee(s),n=0;s>n;++n)o[n]=xs[a[e[n]-1]++]>>>15-e[n];return o},At=new Fe(288);for(te=0;144>te;++te)At[te]=8;for(te=144;256>te;++te)At[te]=9;for(te=256;280>te;++te)At[te]=7;for(te=280;288>te;++te)At[te]=8;var ks=new Fe(32);for(te=0;32>te;++te)ks[te]=5;var Cp=$i(At,9,0),Fp=$i(ks,5,0),Dc=function(e){return(e/8|0)+(7&e&&1)},Nc=function(e,t,i){(t==null||0>t)&&(t=0),(i==null||i>e.length)&&(i=e.length);var s=new(e instanceof Ee?Ee:e instanceof ei?ei:Fe)(i-t);return s.set(e.subarray(t,i)),s},Je=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},pi=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},un=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s,f:e[s]});var n=i.length,r=i.slice();if(!n)return[new Fe(0),0];if(n==1){var o=new Fe(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(P,k){return P.f-k.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=n-1;)a=i[i[d].f>i[c].f?c++:d++],l=i[c!=u&&i[d].f>i[c].f?c++:d++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var h=r[0].s;for(s=1;n>s;++s)r[s].s>h&&(h=r[s].s);var p=new Ee(h+1),v=Kn(i[u-1],p,0);if(v>t){s=0;var _=0,g=v-t,y=1<<g;for(r.sort(function(P,k){return p[k.s]-p[P.s]||P.f-k.f});n>s;++s){var m=r[s].s;if(t>=p[m])break;_+=y-(1<<v-p[m]),p[m]=t}for(_>>>=g;_>0;){var w=r[s].s;t>p[w]?_-=1<<t-p[w]++-1:++s}for(;s>=0&&_;--s){var M=r[s].s;p[M]==t&&(--p[M],++_)}v=t}return[new Fe(p),v]},Kn=function(e,t,i){return e.s==-1?Math.max(Kn(e.l,t,i+1),Kn(e.r,t,i+1)):t[e.s]=i},Qo=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new Ee(++t),s=0,n=e[0],r=1,o=function(l){i[s++]=l},a=1;t>=a;++a)if(e[a]==n&&a!=t)++r;else{if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=e[a]}return[i.subarray(0,s),t]},fi=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},rs=function(e,t,i){var s=i.length,n=Dc(t+2);e[n]=255&s,e[n+1]=s>>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var r=0;s>r;++r)e[n+r+4]=i[r];return 8*(n+4+s)},ea=function(e,t,i,s,n,r,o,a,l,c,u){Je(t,u++,i),++n[256];for(var d=un(n,15),h=d[0],p=d[1],v=un(r,15),_=v[0],g=v[1],y=Qo(h),m=y[0],w=y[1],M=Qo(_),P=M[0],k=M[1],I=new Ee(19),S=0;m.length>S;++S)I[31&m[S]]++;for(S=0;P.length>S;++S)I[31&P[S]]++;for(var $=un(I,7),D=$[0],R=$[1],N=19;N>4&&!D[Ko[N-1]];--N);var W,C,H,B,Y=c+5<<3,z=fi(n,At)+fi(r,ks)+o,ie=fi(n,h)+fi(r,_)+o+14+3*N+fi(I,D)+(2*I[16]+3*I[17]+7*I[18]);if(z>=Y&&ie>=Y)return rs(t,u,e.subarray(l,l+c));if(Je(t,u,1+(z>ie)),u+=2,z>ie){W=$i(h,p,0),C=h,H=$i(_,g,0),B=_;var ge=$i(D,R,0);for(Je(t,u,w-257),Je(t,u+5,k-1),Je(t,u+10,N-4),u+=14,S=0;N>S;++S)Je(t,u+3*S,D[Ko[S]]);u+=3*N;for(var de=[m,P],me=0;2>me;++me){var Te=de[me];for(S=0;Te.length>S;++S)Je(t,u,ge[he=31&Te[S]]),u+=D[he],he>15&&(Je(t,u,Te[S]>>>5&127),u+=Te[S]>>>12)}}else W=Cp,C=At,H=Fp,B=ks;for(S=0;a>S;++S)if(s[S]>255){var he;pi(t,u,W[257+(he=s[S]>>>18&31)]),u+=C[he+257],he>7&&(Je(t,u,s[S]>>>23&31),u+=Sr[he]);var Re=31&s[S];pi(t,u,H[Re]),u+=B[Re],Re>3&&(pi(t,u,s[S]>>>5&8191),u+=Er[Re])}else pi(t,u,W[s[S]]),u+=C[s[S]];return pi(t,u,W[256]),u+C[256]},Ap=new ei([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Op=new Fe(0),Rp=(function(){for(var e=new ei(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e})(),dn=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Lp(e,t){t===void 0&&(t={});var i=(function(){var h=4294967295;return{p(p){for(var v=h,_=0;p.length>_;++_)v=Rp[255&v^p[_]]^v>>>8;h=v},d(){return 4294967295^h}}})(),s=e.length;i.p(e);var n,r,o,a,l,c,u=(a=10+((n=t).filename&&n.filename.length+1||0),l=8,(function(h,p,v,_,g,y){var m=h.length,w=new Fe(_+m+5*(1+Math.floor(m/7e3))+g),M=w.subarray(_,w.length-g),P=0;if(!p||8>m)for(var k=0;m>=k;k+=65535){var I=k+65535;m>I?P=rs(M,P,h.subarray(k,I)):(M[k]=y,P=rs(M,P,h.subarray(k,m)))}else{for(var S=Ap[p-1],$=S>>>13,D=8191&S,R=(1<<v)-1,N=new Ee(32768),W=new Ee(R+1),C=Math.ceil(v/3),H=2*C,B=function(Ns){return(h[Ns]^h[Ns+1]<<C^h[Ns+2]<<H)&R},Y=new ei(25e3),z=new Ee(288),ie=new Ee(32),ge=0,de=0,me=(k=0,0),Te=0,he=0;m>k;++k){var Re=B(k),ot=32767&k,at=W[Re];if(N[ot]=at,W[Re]=ot,k>=Te){var wt=m-k;if((ge>7e3||me>24576)&&wt>423){P=ea(h,M,0,Y,z,ie,de,me,he,k-he,P),me=ge=de=0,he=k;for(var Pe=0;286>Pe;++Pe)z[Pe]=0;for(Pe=0;30>Pe;++Pe)ie[Pe]=0}var Ge=2,Bi=0,Ju=D,lt=ot-at&32767;if(wt>2&&Re==B(k-lt))for(var Ku=Math.min($,wt)-1,Qu=Math.min(32767,k),ed=Math.min(258,wt);Qu>=lt&&--Ju&&ot!=at;){if(h[k+Ge]==h[k+Ge-lt]){for(var ct=0;ed>ct&&h[k+ct]==h[k+ct-lt];++ct);if(ct>Ge){if(Ge=ct,Bi=lt,ct>Ku)break;var td=Math.min(lt,ct-2),Jr=0;for(Pe=0;td>Pe;++Pe){var Ds=k-lt+Pe+32768&32767,Kr=Ds-N[Ds]+32768&32767;Kr>Jr&&(Jr=Kr,at=Ds)}}}lt+=(ot=at)-(at=N[ot])+32768&32767}if(Bi){Y[me++]=268435456|Xn[Ge]<<18|Jn[Bi];var Qr=31&Xn[Ge],eo=31&Jn[Bi];de+=Sr[Qr]+Er[eo],++z[257+Qr],++ie[eo],Te=k+Ge,++ge}else Y[me++]=h[k],++z[h[k]]}}P=ea(h,M,y,Y,z,ie,de,me,he,k-he,P),y||(P=rs(M,P,Op))}return Nc(w,0,_+Dc(P)+g)})(r=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+o.mem,a,l,!c)),d=u.length;return(function(h,p){var v=p.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>p.level?4:p.level==9?2:0,h[9]=3,p.mtime!=0&&dn(h,4,Math.floor(new Date(p.mtime||Date.now())/1e3)),v){h[3]=8;for(var _=0;v.length>=_;++_)h[_+10]=v.charCodeAt(_)}})(u,t),dn(u,d-8,i.d()),dn(u,d-4,s),u}var Dp=!!sr||!!Ii,jc=new WeakMap,Vc="text/plain",hn=0,os=!1,Hc=(e,t)=>{let[i,s]=e.split("#"),[n,r]=i.split("?");if(!r)return e;let o=r.split("&").filter(a=>a.split("=")[0]!==t).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},Ni=(e,t,i=!0)=>{var s;let[n,r]=e.split("?"),o=f({},t),a=(s=r==null?void 0:r.split("&").map(c=>{var u;let[d,h]=c.split("="),p=i&&(u=o[d])!==null&&u!==void 0?u:h;return delete o[d],`${d}=${p}`}))!==null&&s!==void 0?s:[],l=(function(c,u="&"){let d,h,p=[];return Z(c,function(v,_){x(v)||x(_)||_==="undefined"||(d=encodeURIComponent((g=>g instanceof File)(v)?v.name:v.toString()),h=encodeURIComponent(_),p[p.length]=h+"="+d)}),p.join(u)})(o);return l&&a.push(l),a.length>0?`${n}?${a.join("&")}`:n},pn=e=>{if(e.nl)return e.nl;let{data:t,compression:i}=e;if(!t)return;if(i===Ce.GZipJS){let n=Lp((function(r){var o=r.length;if(typeof TextEncoder!="undefined")return new TextEncoder().encode(r);for(var a=new Fe(r.length+(r.length>>>1)),l=0,c=function(p){a[l++]=p},u=0;o>u;++u){if(l+5>a.length){var d=new Fe(l+8+(o-u<<1));d.set(a),a=d}var h=r.charCodeAt(u);128>h?c(h):2048>h?(c(192|h>>>6),c(128|63&h)):h>55295&&57344>h?(c(240|(h=65536+(1047552&h)|1023&r.charCodeAt(++u))>>>18),c(128|h>>>12&63),c(128|h>>>6&63),c(128|63&h)):(c(224|h>>>12),c(128|h>>>6&63),c(128|63&h))}return Nc(a,0,l)})(Ut(t)),{mtime:0});return{contentType:Vc,body:n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength),estimatedSize:n.byteLength}}if(i===Ce.Base64){let n=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,(a,l)=>String.fromCharCode(parseInt(l,16))))})(Ut(t)),r=(o=>"data="+encodeURIComponent(typeof o=="string"?o:Ut(o)))(n);return{contentType:"application/x-www-form-urlencoded",body:r,estimatedSize:new Blob([r]).size}}let s=Ut(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},Wc=e=>{let t=()=>e.transport==="sendBeacon"?{url:Ni(e.url,{compression:Ce.Base64}),encodedBody:pn(f(f({},e),{},{compression:Ce.Base64,nl:void 0}))}:{url:Hc(e.url,"compression"),encodedBody:pn(f(f({},e),{},{compression:void 0,nl:void 0}))},i;try{i=pn(e)}catch(n){if(mo(e.compression,Kt(e.url,"compression")))return T.error("Failed to gzip request body, sending uncompressed payload",n),t();throw n}return i&&mo(e.compression,Kt(e.url,"compression"))&&!((s=i.body)instanceof ArrayBuffer?An(new Uint8Array(s)):ArrayBuffer.isView(s)&&An(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(os=!0,t()):{url:e.url,encodedBody:i};var s},Bc=e=>{try{return Wc(e)}catch(i){var t;return T.error(i),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:i}))}},Np=(function(){var e=ee(function*(t){let i=yield(function(n){return On.apply(this,arguments)})(Ut(t.data),ue.DEBUG,{rethrow:!0});if(!i)return t;let s=yield i.arrayBuffer();return f(f({},t),{},{nl:{contentType:Vc,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}})(),jp=/Failed to fetch|NetworkError|Load failed/i,Uc=e=>(e==null?void 0:e.name)==="TypeError"&&jp.test((e==null?void 0:e.message)||""),zc=e=>{try{let t=(function(i,s=Date.now()){if(typeof i!="string"||!i)return;let n=i.trim(),r=/^\d+\s*,/.test(n)?n.slice(0,n.indexOf(",")).trim():n;if(/^\d+$/.test(r)){let l=1e3*Math.min(Number(r),300);return l>0?l:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(r))return;let o=/^\w{3} \w{3} /.test(r)?r+" GMT":r,a=Date.parse(o)-s;return Number.isFinite(a)&&a>0?Math.min(a,is):void 0})(e());return x(t)?void 0:Math.min(t,3e4)}catch{return}},Gc=e=>{let t=Bc(e);if(!t)return;let i=new sr;jc.set(i,!0);let{url:s,encodedBody:n}=t;i.open(e.method||"GET",s,!0);let{contentType:r,body:o}=n!=null?n:{};Z(e.headers,function(a,l){i.setRequestHeader(l,a)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(i.readyState===4){var a;let l={statusCode:i.status,text:i.responseText};if(i.status===200)try{l.json=JSON.parse(i.responseText)}catch{}(a=e.callback)===null||a===void 0||a.call(e,l,zc(()=>i.getResponseHeader("Retry-After")))}},i.send(o)},qc=e=>{let t=Bc(e);if(!t)return;let{url:i,encodedBody:s}=t,{contentType:n,body:r,estimatedSize:o}=s!=null?s:{},a=new Headers;Z(e.headers,function(v,_){a.append(_,v)}),n&&a.append("Content-Type",n);let l=null,c=!1;if(to){let v=new to;l={signal:v.signal,timeout:setTimeout(()=>{c=!0;try{v.abort(_l("AbortError","PostHog request timed out"+((_=e.timeout)?` after ${_}ms`:"")))}catch(g){d(g)}var _},e.timeout)}}let u=!1,d=v=>{var _;u||(u=!0,c&&(v==null?void 0:v.name)==="AbortError"||Uc(v)?T.warn(v):T.error(v),(_=e.callback)===null||_===void 0||_.call(e,{statusCode:0,error:v}))},h=0,p=()=>{hn-=h,h=0,l&&clearTimeout(l.timeout)};try{let v=f({method:(e==null?void 0:e.method)||"GET",headers:a,referrerPolicy:"strict-origin",body:r,signal:l==null?void 0:l.signal},e.fetchOptions),_=o!=null?o:x(r)?0:void 0;v.keepalive=v.method==="POST"&&!e.sl&&v.keepalive!==!1&&v.body===r&&!x(_)&&_>=0&&52428.8>hn+_,v.keepalive&&(h=_,hn+=h),Ii(i,v).then(g=>g.text().then(y=>{var m;if(u)return;let w={statusCode:g.status,text:y};if(g.status===200)try{w.json=JSON.parse(y)}catch(M){T.error(M)}u=!0,p(),(m=e.callback)===null||m===void 0||m.call(e,w,zc(()=>g.headers.get("Retry-After")))})).catch(g=>{p(),d(g)}).finally(p)}catch(v){p(),d(v)}},Qn=e=>{try{var t;let{url:i,encodedBody:s}=Wc(e),{contentType:n,body:r,estimatedSize:o}=s!=null?s:{};if(!r)return;let a=r instanceof Blob?r:new Blob([r],{type:n});if(pe.sendBeacon(i,a))return;let l=O(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(O(l)&&l.length>1&&(o!=null?o:0)>16384){let c=Math.ceil(l.length/2),u=d=>O(e.data)?d:f(f({},e.data),{},{batch:d});return Qn(f(f({},e),{},{data:u(l.slice(0,c))})),void Qn(f(f({},e),{},{data:u(l.slice(c))}))}T.warn(`Beacon of ~${o!=null?o:0} bytes was rejected by the browser, falling back to ${Ii?"fetch":"XHR"}`),Ii?qc(f(f({},e),{},{sl:!0})):Gc(e)}catch(i){T.warn("Beacon send failed",i)}},ta=(e,t,i,s)=>{let n=s==="query"?t==="POST"?"sent_at":"_":void 0;return Ni(i===Ce.GZipJS?Hc(e,"compression"):e,f(f({},n?{[n]:Date.now().toString()}:{}),i===Ce.GZipJS?{}:{compression:i}))},Vp=(()=>{let e=[];return Ii&&e.push({transport:"fetch",method:qc}),sr&&e.push({transport:"XHR",method:Gc}),pe!=null&&pe.sendBeacon&&e.push({transport:"sendBeacon",method:Qn}),e})(),Zc=!Dp&&(xe==null?void 0:xe.indexOf("MSIE"))===-1&&(xe==null?void 0:xe.indexOf("Mozilla"))===-1;function Yc(e,t,i){var s,n,r;i&&(t=f(f({},t),{},{callback:o=>i(o)})),e.__loaded?Zc?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((n=t.callback)===null||n===void 0||n.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=f(f({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(s=e.compression)!==null&&s!==void 0?s:t.compressionFallback:t.compression,(x(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((o,a)=>{var l,c,u;let d=f(f({},o),{},{callback:a!=null?a:g=>{var y;return(y=o.callback)===null||y===void 0?void 0:y.call(o,g)}});d.timeout=d.timeout||6e4;let h=(l=d.transport)!==null&&l!==void 0?l:"fetch";h==="sendBeacon"&&x(d.compression)&&d.data&&(d.compression=Ce.Base64),d.method==="POST"&&d.data&&(d.timestampMode==="capture-body"?d.data=(g=>{var y,m;let w=(O(g)?g:[g]).map(P=>f(f({},P),P.timestamp instanceof Date&&!isNaN(P.timestamp.getTime())?{timestamp:P.timestamp.toISOString()}:{})),M=w[0];return{api_key:(y=M==null||(m=M.properties)===null||m===void 0?void 0:m.token)!==null&&y!==void 0?y:M==null?void 0:M.token,batch:w,sent_at:new Date().toISOString()}})(d.data):d.timestampMode==="body"&&(d.data=((g,y=new Date().toISOString())=>O(g)?g.map(m=>f(f({},m),{},{sent_at:y})):f(f({},g),{},{sent_at:y}))(d.data))),d.url=ta(d.url,d.method,d.compression,d.timestampMode);let p=Vp.filter(g=>!d.disableTransport||!g.transport||!d.disableTransport.includes(g.transport)),v=(c=(u=(function(g,y){for(let m=0;g.length>m;m++)if(y(g[m]))return g[m]})(p,g=>g.transport===h))===null||u===void 0?void 0:u.method)!==null&&c!==void 0?c:p[0].method;if(!v)throw new Error("No available transport method");let _=g=>{try{v(g)}catch(m){var y;Uc(m)?T.warn(m):T.error(m),(y=d.callback)===null||y===void 0||y.call(d,{statusCode:0,error:m})}};h!=="sendBeacon"&&!d.preferSyncCompression&&d.data&&d.compression===Ce.GZipJS&&id&&typeof Promise!="undefined"&&!os?Np(d).then(g=>{_(g)}).catch(g=>{if(yo(g))return os=!0,void _(f(f({},d),{},{compression:void 0,url:ta(o.url,o.method,void 0,o.timestampMode)}));(y=>{if(!y||typeof y!="object")return!1;let m="name"in y?String(y.name):"";return yo(y)||m===Sl})(g)&&(os=!0),_(d)}):_(d)})(t,(o,a)=>{var l,c,u;e.rateLimiter.checkForLimiting(o),400>o.statusCode||(l=(c=e.config).on_request_error)===null||l===void 0||l.call(c,o),i?i(o,a):(u=t.callback)===null||u===void 0||u.call(t,o)})):t.fireCallbackOnDrop&&((r=t.callback)===null||r===void 0||r.call(t,{statusCode:0}))}var Hp=class{constructor(e,t){this.rl=!0,this.ol=[],this.al=Xe((t==null?void 0:t.flush_interval_ms)||3e3,250,5e3,T.createLogger("flush interval"),3e3),this.ll=e}enqueue(e){this.ol.push(e),this.ul||this.cl()}unload(){this.hl();let e=this.ol.length>0?this.dl():{},t=Object.values(e);[...t.filter(i=>i.url.indexOf("/e")===0),...t.filter(i=>i.url.indexOf("/e")!==0)].map(i=>{this.vl(f(f({},i),{},{callback:void 0}),"sendBeacon")})}enable(){this.rl=!1,this.cl()}cl(){this.rl||(this.ul=setTimeout(()=>{this.hl(),this.fl()},this.al))}fl(){if(this.ol.length>0){let e=this.dl();for(let t in e)this.vl(e[t])}}vl(e,t){try{this.ll(e,t)}catch(i){T.error(i)}}hl(){clearTimeout(this.ul),this.ul=void 0}dl(){let e={},t={};Z(this.ol,i=>{var s;let n=i,r=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");x(e[r])&&(e[r]=f(f({},n),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),t[r]=[]),(s=e[r].data)===null||s===void 0||s.push(n.data),n.callback&&t[r].push(n.callback)});for(let i in t){let s=t[i];s.length&&(e[i].callback=n=>{for(let r of s)r(n)})}return this.ol=[],e}},Wp=["retriesPerformedSoFar"],Bp=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.ol=[],this.ol=[],this.ml=!0,this.resume()}resume(){if(!x(b)&&"onLine"in b.navigator){if(this.ml=b.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.fl()},this.bl=()=>{this.ml=!1},G(b,"online",this.yl),G(b,"offline",this.bl)}}get length(){return this.ol.length}retriableRequest(e,t){let{retriesPerformedSoFar:i}=e,s=El(e,Wp);Qe(i)&&(s.url=Ni(s.url,{retry_count:i})),Yc(this._instance,t?f(f({},s),{},{transport:t}):s,(n,r)=>{var o;if(n.statusCode!==200&&(400>n.statusCode||n.statusCode>=500)){if((n.statusCode===0?3:10)>(i!=null?i:0))return void this.Ls(f({retriesPerformedSoFar:i},s),r);n.statusCode===0&&T.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${i!=null?i:0} retries.`)}(o=s.callback)===null||o===void 0||o.call(s,n)})}Ls(e,t){let i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;let s=Math.max((function(o){let a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)})(i),t!=null?t:0),n=Date.now()+s;this.ol.push({retryAt:n,requestOptions:e});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),T.warn(r),this.pl||(this.pl=!0,this._l())}_l(){if(this.wl&&clearTimeout(this.wl),this.ol.length===0)return this.pl=!1,void(this.wl=void 0);this.wl=setTimeout(()=>{this.ml&&this.ol.length>0&&this.fl(),this._l()},this.gl)}fl(){let e=Date.now(),t=[],i=this.ol.filter(s=>e>s.retryAt||(t.push(s),!1));if(this.ol=t,i.length>0)for(let{requestOptions:s}of i)this.retriableRequest(s)}unload(){this.wl&&(clearTimeout(this.wl),this.wl=void 0),this.pl=!1,x(b)||(this.yl&&(b.removeEventListener("online",this.yl),this.yl=void 0),this.bl&&(b.removeEventListener("offline",this.bl),this.bl=void 0));for(let{requestOptions:e}of this.ol)try{this._instance._send_request(f(f({},e),{},{callback:O(e.data)?void 0:e.callback,transport:"sendBeacon"}))}catch(t){T.error(t)}this.ol=[]}},Up=class{constructor(e){this._instance=e,this.kl=()=>{var t,i,s,n;this.Sl||(this.Sl={});let r=this.scrollElement(),o=this.scrollY(),a=r?Math.max(0,r.scrollHeight-r.clientHeight):0,l=o+((r==null?void 0:r.clientHeight)||0),c=(r==null?void 0:r.scrollHeight)||0;this.Sl.lastScrollY=Math.ceil(o),this.Sl.maxScrollY=Math.max(o,(t=this.Sl.maxScrollY)!==null&&t!==void 0?t:0),this.Sl.maxScrollHeight=Math.max(a,(i=this.Sl.maxScrollHeight)!==null&&i!==void 0?i:0),this.Sl.lastContentY=l,this.Sl.maxContentY=Math.max(l,(s=this.Sl.maxContentY)!==null&&s!==void 0?s:0),this.Sl.maxContentHeight=Math.max(c,(n=this.Sl.maxContentHeight)!==null&&n!==void 0?n:0)}}get xl(){return this._instance.config.scroll_root_selector}getContext(){return this.Sl}resetContext(){let e=this.Sl;return this.Sl=void 0,setTimeout(this.kl,0),e}startMeasuringScrollPosition(){G(b,"scroll",this.kl,{capture:!0}),G(b,"scrollend",this.kl,{capture:!0}),G(b,"resize",this.kl)}scrollElement(){if(this.xl){let i=O(this.xl)?this.xl:[this.xl];for(let s of i){var e;let n=b==null||(e=b.document)===null||e===void 0?void 0:e.querySelector(s);if(n)return n}return}var t;return b==null||(t=b.document)===null||t===void 0?void 0:t.documentElement}$l(e){var t,i;let s=e==="y"?"scrollTop":"scrollLeft";if(this.xl){let n=this.scrollElement();return n&&n[s]||0}return b?e==="y"?b.scrollY||b.pageYOffset||((t=b.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:b.scrollX||b.pageXOffset||((i=b.document)===null||i===void 0||(i=i.documentElement)===null||i===void 0?void 0:i.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}},zp=e=>Cc(e==null?void 0:e.config.mask_personal_data_properties,e==null?void 0:e.config.custom_personal_data_properties,e==null?void 0:e.config.disable_capture_url_hashes),ia=class{constructor(e,t,i,s){this.qe=n=>{let r=this.Cl();if(r&&r.sessionId===n)return;let o={sessionId:n,props:this.Tl(this._instance)};this.Il.register({[Bn]:o})},this._instance=e,this.Ml=t,this.Il=i,this.Tl=s||zp,this.Ml.onSessionId(this.qe)}Cl(){return this.Il.props[Bn]}getSetOnceProps(){var e;let t=(e=this.Cl())===null||e===void 0?void 0:e.props;return t?"r"in t?Fc(t,this._instance.config.disable_capture_url_hashes):{$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(){let e={};return Z(mr(this.getSetOnceProps()),(t,i)=>{i==="$current_url"&&(i="url"),e[`$session_entry_${Pn(i)}`]=t}),e}},Ss=class{on(e,t){return this.El[e]||(this.El[e]=[]),this.El[e].push(t),()=>{this.El[e]=this.El[e].filter(i=>i!==t)}}emit(e,t){for(let i of this.El[e]||[])i(t);for(let i of this.El["*"]||[])i(e,t)}constructor(){this.El={}}},Dt=re("[SessionId]"),sa=864e5,na=class{on(e,t){return this.Pl.on(e,t)}constructor(e,t,i){var s;if(this.Rl=null,this.Al=null,this.Fl=[],this.Ol=void 0,this.Dl=!1,this.Pl=new Ss,this.Ll=(r,o)=>!(!Qe(r)||!Qe(o))&&Math.abs(r-o)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Mr=e.config,this.Il=e.persistence,this.je=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Nl=void 0,this._sessionActivityTimestamp=null,this.ql=t||We,this.jl=i||We;let n=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Xe(this.Mr.session_idle_timeout_seconds||1800,60,36e3,Dt.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Bl(),this.zl="ph_"+n+"_window_id",this.Hl="ph_"+n+"_primary_window_exists",this.Ul()){let r=J.Lt(this.zl),o=J.Lt(this.Hl);r&&!o?this.je=r:J.Pt(this.zl),J.$t(this.Hl,!0)}!((s=this.Mr.bootstrap)===null||s===void 0)&&s.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Wl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return x(this.Fl)&&(this.Fl=[]),this.Fl.push(e),this.Xt&&e(this.Xt,this.je),()=>{this.Fl=this.Fl.filter(t=>t!==e)}}Ul(){return this.Mr.persistence!=="memory"&&!this.Il.hi&&J.At()}Vl(e){e!==this.je&&(this.je=e,this.Ul()&&J.$t(this.zl,e))}Gl(){return this.je?this.je:this.Ul()?J.Lt(this.zl):null}Ql(e){let t=this.Rl;return!ne(t)&&!ne(e)&&5e3>Math.abs(e-t)}Zl(e,t,i){let s=t!==this._sessionActivityTimestamp,n=!(e!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Xt=e,n&&!s||n&&this.Ql(t)||(this.Rl=t,this.Il.register({[Ht]:[t,e,i]}))}Jl(){var e;let t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return Qe(t)&&t>0}Kl(){this.Jl()?this.Il.refreshKey(Ht):(this.Il.flush(),this.Il.load())}Xl(){var e;if(ne(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Rl)return;this.Kl();let[,t,i]=this.Yl();t===this.Xt&&i===this._sessionStartTimestamp&&(this.Rl=this._sessionActivityTimestamp,this.Il.register({[Ht]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Il.flush())}tu(){let[e]=this.Yl(),t=Qe(e)?e:0,i=Qe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}eu(e){return this.Kl(),this.Ll(e,this.tu())}Yl(){let e=this.Il.props[Ht];return O(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Rl=null,this.Nl=void 0,clearTimeout(this.iu),this.iu=void 0,this.Zl(null,null,null)}setBootstrapSessionId(e,t=!1){let i=((s,n=new Date().getTime())=>{try{let r=(o=>{let a=o.replace(/-/g,"");if(a.length!==32)throw new Error("Not a valid UUID");if(a[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(a.substring(0,12),16)})(s);return r>n+6e4?void Dt.error("Bootstrap sessionID cannot be in the future"):r}catch(r){return void Dt.error("Invalid sessionID in bootstrap",r)}})(e);return!x(i)&&(t?this.Nl={sessionId:e,sessionStartTimestamp:i}:this.Zl(e,new Date().getTime(),i),!0)}destroy(){this.Dl=!0,this.Xl(),clearTimeout(this.iu),this.iu=void 0,this.Ol&&b&&(b.removeEventListener(ms,this.Ol,{capture:!1}),this.Ol=void 0),this.Fl=[]}Wl(){this.Ol=()=>{this.Xl(),this.Ul()&&J.Pt(this.Hl)},G(b,ms,this.Ol,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if(this.Mr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');let s=t||new Date().getTime(),n=this.Xt;if(i)this.Al=s;else if(ne(this.Al)||this.Al>s||s-this.Al>=1e3){var r,o;(r=(o=this.Il).syncCookieProperties)===null||r===void 0||r.call(o),this.Al=s}let[,a,l]=this.Yl(),c=!x(n)&&a!==n,u=this.tu(),d=this.Gl(),h=this.Nl,p=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>sa),v=h?p:Qe(l)&&Math.abs(s-l)>sa,_=!1,g=c,y=!a||!!h,m=a,w=!y&&!e&&this.Ll(s,u);if(w&&(w=this.eu(s),w||Dt.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.Yl(),w||(y=!a||!!h)),y||w||v){g=!1;let I=h&&!p;a=I?h.sessionId:this.ql(),d=this.jl(),Dt.info("new session ID assigned",{sessionId:a,windowId:d,bootstrapped:!!I,changeReason:{noSessionId:y,activityTimeout:w,sessionPastMaximumLength:v}}),l=I?h.sessionStartTimestamp:s,this.Nl=void 0,_=!0}else d||(d=this.jl(),_=!0),g=g||a!==m,g&&(Dt.info("adopted cross-tab session id",{sessionId:a,windowId:d}),_=!0);let M=Qe(u)&&e&&!v?u:s,P=Qe(l)?l:new Date().getTime();this.Vl(d),this.Zl(a,M,P),e||this.Bl();let k={noSessionId:y,activityTimeout:w,sessionPastMaximumLength:v,crossTabAdoption:g};return _&&this.Fl.forEach(I=>I(a,d,k)),{sessionId:a,windowId:d,sessionStartTimestamp:P,changeReason:_?k:void 0,lastActivityTimestamp:u}}Bl(){this.Dl||(clearTimeout(this.iu),this.iu=setTimeout(()=>{if(!this.Dl)if(this.eu(new Date().getTime())){let e=this.Xt;this.resetSessionId(),this.Pl.emit("forcedIdleReset",{idleSessionId:e})}else this.Bl()},1.1*this.sessionTimeoutMs))}},Xc=function(e,t){if(!e)return!1;let i=e.userAgent;if(i&&no(i,t))return!0;try{let s=e==null?void 0:e.userAgentData;if(s!=null&&s.brands&&s.brands.some(n=>no(n==null?void 0:n.brand,t)))return!0}catch{}return!!e.webdriver};function Jc(){return(Jc=ee(function*(){let e=pe==null?void 0:pe.userAgentData;if(e!=null&&e.getHighEntropyValues)try{let t=yield e.getHighEntropyValues(["model"]),i=t==null?void 0:t.model;return V(i)&&i.length>0?i:void 0}catch(t){return void T.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Gp(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function Kc(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}var Es=(e,t)=>{if(!(i=>{try{new RegExp(i)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},Ji=e=>e.toLowerCase(),Qc={exact:(e,t)=>t.some(i=>e.some(s=>i===s)),is_not:(e,t)=>t.every(i=>e.every(s=>i!==s)),regex:(e,t)=>t.some(i=>e.some(s=>Es(i,s))),not_regex:(e,t)=>t.every(i=>e.every(s=>!Es(i,s))),icontains:(e,t)=>t.map(Ji).some(i=>e.map(Ji).some(s=>i.includes(s))),not_icontains:(e,t)=>t.map(Ji).every(i=>e.map(Ji).every(s=>!i.includes(s))),gt:(e,t)=>t.some(i=>{let s=parseFloat(i);return!isNaN(s)&&e.some(n=>s>parseFloat(n))}),lt:(e,t)=>t.some(i=>{let s=parseFloat(i);return!isNaN(s)&&e.some(n=>s<parseFloat(n))})};function eu(e,t){return!e||Object.entries(e).every(([i,s])=>{let n=t==null?void 0:t[i];if(n==null)return!1;let r=Qc[s.operator];return!!r&&r(s.values.map(String),[String(n)])})}function fn(e,t,i){return Ut({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var er="custom",ra="i.posthog.com",qp=/^\/static\//,Zp=["/s/","/e/","/i/"],Yp=class{constructor(e){this.nu={},this.instance=e}get apiHost(){let e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){let e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${ra}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.nu[this.apiHost]||(this.nu[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":er),this.nu[this.apiHost]}su(e){if(!qp.test(e))return;let t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}ru(e){let t=nt(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}ou(e,t,i){if(e==="ui")return i;let s=i,n=this.instance.config.rewriteRequestPath;if(n){var r;let o=((r=nt(i))===null||r===void 0?void 0:r.href)||i;s=n(new URL(o)).toString()}if(n&&e==="api"&&Zp.some(o=>t.indexOf(o)===0)){let o=this.ru(s);if(o){let a=this.apiHost,l=this.au;(l==null?void 0:l.apiHost)===a&&l.rewriteRequestPath===n||(l={apiHost:a,rewriteRequestPath:n,urls:new Set},this.au=l),l.urls.add(o)}}return s}isIngestionEndpoint(e){let t=this.au,i=this.ru(e);return(t==null?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this.ou(e,t,this.uiHost+t);if(e==="flags")return this.ou(e,t,this.flagsApiHost+t);if(e==="assets"){let s=this.su(t);if(s)return this.ou(e,t,`${s}${t}`)}if(this.region===er)return this.ou(e,t,this.apiHost+t);let i=ra+t;switch(e){case"assets":return this.ou(e,t,`https://${this.region}-assets.${i}`);case"api":return this.ou(e,t,`https://${this.region}.${i}`)}}},q=re("[Surveys]"),tu=e=>{try{let t=(i=>((s,n)=>`seenSurvey_${(function(r){return r.current_iteration&&r.current_iteration>0?`${r.id}_${r.current_iteration}`:r.id})(n)}`)(0,i))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){q.error("Failed to persist survey seen state",t)}},Xp=[ln.Popover,ln.Widget,ln.API],Jp={ignoreConditions:!1,ignoreDelay:!1,displayType:Yn.Popover},Kp=re("[PostHog ExternalIntegrations]"),Qp={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},ef=class{constructor(e){this._instance=e}zo(e,t){var i,s;(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,e,n=>{if(n)return Kp.error("failed to load script",n);t()})}startIfEnabledOrStop(){var e;for(let[n,r]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,i,s;r&&!(!((t=F.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[n])&&this.zo(Qp[n],()=>{var o;(o=F.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[n])===null||o===void 0||o.start(this._instance)}),!r&&(!((i=F.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0)&&i[n])&&((s=F.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0||(s=s[n])===null||s===void 0||s.stop())}}},tf=class{constructor(e,t){this.A=e,this.bo=t,this.lu=new Map,this.To=!1}add(e){var t=this;return ee(function*(){if(t.To)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.lu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.lu.set(e.name,e);try{let i=e.setup(t.bo);i&&(yield i)}catch(i){let s=t.lu.get(e.name)===e;s&&t.lu.delete(e.name),t.A.error(`Failed to set up browser extension "${e.name}"`,i),s&&t.uu(e)}})()}getExtension(e){return this.lu.get(e)}dispose(){if(this.To)return;this.To=!0;let e=Array.from(this.lu.values()).reverse();this.lu.clear();for(let t of e)this.uu(t)}uu(e){try{var t;let i=(t=e.dispose)===null||t===void 0?void 0:t.call(e);i&&le(i.then)&&i.then(void 0,s=>{this.A.error(`Failed to dispose browser extension "${e.name}"`,s)})}catch(i){this.A.error(`Failed to dispose browser extension "${e.name}"`,i)}}},sf=class{constructor(e){this._instance=e}initialize(){}get(e){let t=this._instance.persistence;if(typeof e=="string")return t==null?void 0:t.get_property(e);let i={};for(let s of e){let n=t==null?void 0:t.get_property(s);x(n)||(i[s]=n)}return i}set(e,t){var i;(i=this._instance.persistence)===null||i===void 0||i.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}},oa="extensionsRemoteConfig",nf=class{constructor(e){this.instance=e,this.To=!1,this.A=T,this.cu=e.hu,this.kv=new sf(e),this.onEvent=t=>Xi(this.instance.on("eventCaptured",i=>{try{t({event:i.event,properties:i.properties})}catch(s){this.A.error("Browser extension event listener failed",s)}})),this.onRemoteConfig=t=>{if(this.To)return Xi(()=>{});let i=n=>{try{t(n)}catch(r){this.A.error("Browser extension remote config listener failed",r)}},s=this.instance.du.on(oa,i);return this.cu&&i(this.cu),Xi(s)},this.vu=new tf(T.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){let e=this.instance.get_property(ur);return typeof e=="string"?e:void 0}get library(){return{name:ue.LIB_NAME,version:ue.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s;let n=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=n==null?void 0:n.sessionId)!==null&&t!==void 0?t:"",windowId:(i=n==null?void 0:n.windowId)!==null&&i!==void 0?i:"",sessionStartTimestamp:(s=n==null?void 0:n.sessionStartTimestamp)!==null&&s!==void 0?s:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.vu.add(e)}getExtension(e){return this.vu.getExtension(e)}capture(e,t,i){i?this.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return Xi(this.instance.fu(e))}handleRemoteConfig(e){this.To||(this.cu=e,this.instance.du.emit(oa,e))}sendRequest(e){var t=this;return ee(function*(i,s={}){var n;let r=t.instance.requestRouter.endpointFor((n=s.target)!==null&&n!==void 0?n:"api",i),o={method:s.method,url:s.query?Ni(r,s.query):r,data:s.body,headers:s.headers,timeout:s.timeoutMs,fireCallbackOnDrop:!0,transport:s.transport,compression:s.compression,compressionFallback:s.target==="flags"&&s.compression==="best-available"?$n.Base64:void 0,timestampMode:s.sentAt};return s.transport==="sendBeacon"?(t.instance._send_request(o),{statusCode:202}):new Promise(a=>{o.callback=a,t.instance._send_request(o)})}).apply(this,arguments)}dispose(){this.To||(this.To=!0,this.vu.dispose())}},Pi={},vn=0,Mi=()=>{},aa='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Nt="Surveys module not available",la="sanitize_properties is deprecated. Use before_send instead",iu="Invalid value for property_denylist config: ",rf=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],of=["$feature_flag_called","$$heatmap","$snapshot"],ca=e=>e.charAt(0)==="$"&&!A(of,e),af=/^[A-Za-z0-9_-]{1,400}$/,ua=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,da=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,lf=["token","distinct_id",Jl],mi="posthog",cf=e=>{let t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},gn=e=>{var t;return f({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:ip(E==null?void 0:E.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Mi,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e!=null?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:K&&V(K==null?void 0:K.search)&&K.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(b==null||(t=b.location)===null||t===void 0?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(i){T.error("Bad HTTP status: "+i.statusCode+" "+i.text)},get_device_id:i=>i,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:ac,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Mi},(i=>({rageclick:i&&i>="2026-05-30"?{content_ignorelist:xr,ignore_text_selection:!0}:!i||"2025-11-30">i||{content_ignorelist:!0},capture_pageview:!i||"2025-05-24">i||"history_change",session_recording:cf(i),external_scripts_inject_target:i&&i>="2026-01-30"?"head":"body",internal_or_test_user_hostname:i&&i>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:i&&i>="2026-05-30"?250:0,split_storage:!(!i||"2026-05-30">i),detect_google_search_app:!(!i||"2026-05-30">i),disable_capture_url_hashes:!(!i||"2026-06-25">i),cookieWinsOnConflict:!(!i||i==="unset"||"2026-08-29">i)}))(e))},uf=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],ha=e=>{let t={};for(let[n,r]of uf)x(e[n])||(t[r]=e[n]);let i=Q({},t,e),s=e.__preview_external_dependency_versioned_paths;return x(s)||(x(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),V(s)&&x(e.asset_host)&&(i.asset_host=s)),O(e.property_blacklist)&&(x(e.property_denylist)?i.property_denylist=e.property_blacklist:O(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:T.error(iu+e.property_denylist)),i},df=class{constructor(){this.__forceAllowLocalhost=!1}get pu(){return this.__forceAllowLocalhost}set pu(e){T.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Ti=class pt{gu(t){if(!t)return;let i=this.lu.indexOf(t);i!==-1&&this.lu.splice(i,1)}mu(t,i){var s;return this.gu(t),this.lu.push(i),(s=i.initialize)===null||s===void 0||s.call(i),i}yu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}bu(){if(this._u||this.config.reuseAnonymousId||this.config.segment||this.yu())return;let t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.wu)return;let i,s,n;t?(i=`persistence is set to '${this.config.persistence}'`,s=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(i="persistence is disabled (disable_persistence is true)",s="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this._u=!0,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${s}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${n}`)}ku(){let t=this.persistence;if(!t||this.Su)return;if(this.yu())return void(this.config.cookieless_mode==="on_reject"&&this.get_distinct_id()!=="$posthog_cookieless"&&(this.xu(),this.$u()));if(this.get_distinct_id()!=="$posthog_cookieless")return;this.Cu()||t.load(!0);let i=this.get_distinct_id();if(!i||i==="$posthog_cookieless"){let s=this.config.get_device_id(We());this.register({distinct_id:s,$device_id:s}),t.set_property(ke,it)}this.xu()}get decideEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.Tu=!1,this.Iu=!1,this.webPerformance=new df,this.Mu=!1,this.version=ue.LIB_VERSION,this.Eu=new Set,this.Pu="",this.du=new Ss,this.lu=[],this.Ru=[],this.Au=!1,this.wu=!1,this._u=!1,this.Su=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=gn(),this.SentryIntegration=bp,this.sentryIntegration=s=>(function(n,r){let o=wc(n,r);return{name:bc,processEvent:a=>o(a)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fu=!1,this.Ou=null,this.Du=null,this.Lu=null,this.scrollManager=new Up(this),this.pageViewManager=new qo(this),this.rateLimiter=new Ip(this),this.requestRouter=new Yp(this),this.consent=new cp(this),this.externalIntegrations=new ef(this);let i=(t=pt.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(s,n,r)=>{let o=V(s)?{[s]:n}:s;this.setPersonProperties(o),r==null||r({})},set_once:(s,n,r)=>{let o=V(s)?{[s]:n}:s;this.setPersonProperties(void 0,o),r==null||r({})}},this.on("eventCaptured",s=>T.info(`send "${s==null?void 0:s.event}"`,s))}init(t,i,s){if(s&&s!==mi){var n;let r=(n=Pi[s])!==null&&n!==void 0?n:new pt;return r._init(t,i,s),Pi[s]=r,Pi[mi][s]=r,r}return this._init(t,i,s)}_init(t,i={},s){var n,r,o;let a=V(t)?t.trim():"";if(!a)return T.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==((l=this.config)===null||l===void 0?void 0:l.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=gn(i.defaults),i.debug=this.Nu(i.debug),this.qu=i,this.ju=[],i.person_profiles?this.Du=i.person_profiles:i.process_person&&(this.Du=i.process_person);let c=gn(i.defaults),u=ha(i),d=Q({},c,u,{name:s,token:a});j(c.rageclick)&&j(u.rageclick)&&(d.rageclick=Q({},c.rageclick,u.rageclick)),j(c.session_recording)&&j(u.session_recording)&&(d.session_recording=Q({},c.session_recording,u.session_recording)),this.set_config(d),this.config.on_xhr_error&&T.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Ce.GZipJS;let h=this.Cu(),p=!this.yu();if(this.persistence=new an(this.config,h,!0,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new an(f(f({},this.config),{},{persistence:"sessionStorage"}),h,!1,p),this.Pu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!h&&J.At()){let m=J.Lt(this.Pu);O(m)&&m.forEach(w=>{V(w)&&this.Eu.add(w)})}else J.Pt(this.Pu);let v=f({},this.persistence.props),_=f({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Bu=new Hp((m,w)=>this.zu(m,w),this.config.request_queue_config),this.Hu=new Bp(this),this.__request_queue=[];let g=this.yu();g||(this.sessionManager=new na(this),this.sessionPropsManager=new ia(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((m,w,M)=>{(M!=null&&M.activityTimeout||M!=null&&M.sessionPastMaximumLength||M!=null&&M.crossTabAdoption)&&this.Uu()})),this.Wu(),this.config.__preview_deferred_init_extensions?(T.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Vu(g)},0)):(T.info("Initializing extensions synchronously"),this.Vu(g)),ue.DEBUG=ue.DEBUG||this.config.debug,ue.DEBUG&&T.info("Starting in debug mode",{this:this,config:i,thisC:f({},this.config),p:v,s:_}),this.config.identity_distinct_id&&!(!((n=i.bootstrap)===null||n===void 0)&&n.distinctID)&&(i.bootstrap=f(f({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));let y=(r=i.bootstrap)===null||r===void 0?void 0:r.distinctID;if(this.wu=!!y&&!yi(y),(o=i.bootstrap)===null||o===void 0?void 0:o.distinctID){let m=i.bootstrap.distinctID,w=this.get_distinct_id(),M=this.persistence.get_property(ke);if(i.bootstrap.isIdentifiedID&&w!=null&&w!==m&&M==="anonymous")this.identify(m);else if(i.bootstrap.isIdentifiedID&&w!=null&&w!==m&&M==="identified")T.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{let P=this.config.get_device_id(We()),k=i.bootstrap.isIdentifiedID?P:m;this.persistence.set_property(ke,i.bootstrap.isIdentifiedID?ss:it),this.register({distinct_id:m,$device_id:k})}}if(g)this.register_once({distinct_id:Js,$device_id:null},"");else if(!this.get_distinct_id()){let m=this.config.get_device_id(We());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(ke,it)}return G(b,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),G(b,"pageshow",()=>{var m;this.Tu=!1,this.Iu||(m=this.Hu)===null||m===void 0||m.resume()}),i.segment?Go(this,()=>this.Gu()):this.Gu(),le(this.config._onCapture)&&this.config._onCapture!==Mi&&(T.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",m=>this.config._onCapture(m.event,m))),this.config.ip&&T.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.config.disableDeviceModel||(function(){return Jc.apply(this,arguments)})().then(m=>{m&&this.register({[Xs]:m})}).catch(Mi),this}Qu(t){let i=t;return V(i.name)&&le(i.setup)}Zu(t,i){this.Qu(t)?i.push(()=>{this.Ju().add(t).catch(()=>{var s;return(s=t.dispose)===null||s===void 0?void 0:s.call(t)}).catch(s=>{T.error(`Failed to dispose browser extension "${t.name}"`,s)})}):this.lu.push(t)}Wu(){var t,i,s;let n=(t=(i=this.config.__extensionClasses)===null||i===void 0?void 0:i.featureFlags)!==null&&t!==void 0?t:(s=pt.__defaultExtensionClasses)===null||s===void 0?void 0:s.featureFlags;var r,o,a;n&&(this.featureFlags&&this.featureFlags instanceof n||((r=this.Ku)===null||r===void 0||r.call(this),this.Ku=void 0,this.featureFlags=new n(this)),le(this.featureFlags.onReloading)&&le(this.featureFlags.setup)?this.Ku||(this.Ku=this.featureFlags.onReloading(()=>{this.du.emit("featureFlagsReloading",!0)}),this.Ju().add(this.featureFlags)):(o=(a=this.featureFlags).initialize)===null||o===void 0||o.call(a))}Vu(t){let i=performance.now(),s=f(f({},pt.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,a,l,c,u,d,h;s.exceptions&&this.lu.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new s.exceptions(this)),s.historyAutocapture&&this.lu.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.lu.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.lu.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!t&&this.lu.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.Zu(this.autocapture=new s.autocapture(this),n),s.surveys&&this.Zu(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new s.surveys(this),n),s.logs&&this.Zu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new s.logs(this),n),s.metrics&&this.lu.push(this.metrics=(l=this.metrics)!==null&&l!==void 0?l:new s.metrics(this)),s.conversations&&this.lu.push(this.conversations=(c=this.conversations)!==null&&c!==void 0?c:new s.conversations(this)),s.productTours&&this.lu.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.lu.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.lu.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.lu.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.lu.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,yp)),s.toolbar&&this.lu.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new s.toolbar(this)),s.experiments&&this.lu.push(this.experiments=(d=this.experiments)!==null&&d!==void 0?d:new s.experiments(this)),s.webMCP&&this.lu.push(this.webMCP=(h=this.webMCP)!==null&&h!==void 0?h:new s.webMCP(this)),this.lu.forEach(p=>{p.initialize&&n.push(()=>{var v;(v=p.initialize)===null||v===void 0||v.call(p)})}),n.push(()=>{if(this.Xu){let p=this.Xu;this.Xu=void 0,this.lu.forEach(v=>{var _;return(_=v.onRemoteConfig)===null||_===void 0?void 0:_.call(v,p)})}}),this.Yu(n,i)}Yu(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this.Yu(t,i)},0);let n=t.shift();if(n)try{n()}catch(r){T.error("Error initializing extension:",r)}}let s=Math.round(performance.now()-i);this.register_for_session({[Kl]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ql]:s}),this.config.__preview_deferred_init_extensions&&T.info(`PostHog extensions initialized (${s}ms)`)}el(t){var i;if(!E||!E.body)return T.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.el(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Xu=t),this.hu=t,this.compression=void 0,t.ok){var s;let n=t.config;n.supportedCompression&&!this.config.disable_compression&&(this.compression=A(n.supportedCompression,Ce.GZipJS)?Ce.GZipJS:A(n.supportedCompression,Ce.Base64)?Ce.Base64:void 0),!((s=n.analytics)===null||s===void 0)&&s.endpoint&&(this.analyticsDefaultEndpoint=n.analytics.endpoint)}this.set_config({person_profiles:this.Du?this.Du:ac}),(i=this.tc)===null||i===void 0||i.handleRemoteConfig(t),this.lu.forEach(n=>{var r;return(r=n.onRemoteConfig)===null||r===void 0?void 0:r.call(n,t)})}Gu(){try{this.config.loaded(this)}catch(t){T.critical("`loaded` function failed",t)}if(this.ec(),this.config.internal_or_test_user_hostname&&(K==null?void 0:K.hostname)){let t=K.hostname,i=this.config.internal_or_test_user_hostname;(typeof i=="string"?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.yu())&&this.nc()},1),this.sc=new Oc(this),this.sc.load()}ec(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Bu)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&Bt(this.__request_queue,t=>this.zu(t)),this.__request_queue=[],this.ec()}_handle_unload(){var t,i,s,n,r,o;this.Tu=!0,(t=this.surveys)===null||t===void 0||(i=t.handlePageUnload)===null||i===void 0||i.call(t),(s=this.metrics)===null||s===void 0||s.flush("sendBeacon"),this.config.request_batching?(this.rc()&&this.capture(To),(n=this.logs)===null||n===void 0||n.flushLogs("sendBeacon"),(r=this.Bu)===null||r===void 0||r.unload(),(o=this.Hu)===null||o===void 0||o.unload()):this.rc()&&this.capture(To,null,{transport:"sendBeacon"})}_send_request(t){Yc(this,t)}zu(t,i){this.Hu?this.Hu.retriableRequest(t,i):this._send_request(i?f(f({},t),{},{transport:i}):t)}_execute_array(t){vn++;try{let i,s=[],n=[],r=[];Bt(t,a=>{if(a)if(i=a[0],O(i))r.push(a);else if(le(a))try{a.call(this)}catch(l){T.error("Error executing queued PostHog call",a,l)}else O(a)&&i==="alias"?s.push(a):O(a)&&i.indexOf("capture")!==-1&&le(this[i])?r.push(a):n.push(a)});let o=function(a,l){Bt(a,function(c){try{if(O(c[0])){let u=l;Z(c,function(d){u=u[d[0]].apply(u,d.slice(1))})}else l[c[0]].apply(l,c.slice(1))}catch(u){T.error("Error executing queued PostHog call",c,u)}})};o(s,this),o(n,this),o(r,this)}finally{vn--}}push(t){if(vn>0&&O(t)&&V(t[0])){let i=pt.prototype[t[0]];return void(le(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}get oc(){return{property:Po,persistenceKey:Gt,cookieName:"_fbc",pattern:ua,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[Gt]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Gt)}}}get ac(){return{property:Mo,persistenceKey:xi,cookieName:"_fbp",pattern:da,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[xi]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(xi)}}}lc(t){var i;let s=(i=this.persistence)===null||i===void 0?void 0:i.get_property(t.persistenceKey);return V(s)&&t.pattern.test(s)?{value:s,delivered:!1}:j(s)&&V(s.value)&&t.pattern.test(s.value)?{value:s.value,delivered:s.delivered===!0}:void 0}uc(t,i,s){return i===(s==null?void 0:s.value)?{value:i,pending:!s.delivered}:(t.register(i,!1),{value:i,pending:!0})}cc(t){if(!this.config.save_campaign_params||this.yu())return;let i=Si(t.cookieName);return V(i)&&t.pattern.test(i)?i:void 0}hc(t,i,s,n){if(!this.persistence)return;let r=this.oc;this.persistence.refreshKey(r.persistenceKey);let o=this.lc(r);if(n)return void r.unregister();if(s)return V(i)&&ua.test(i)?this.uc(r,i,o):void r.unregister();let a=V(t)&&af.test(t)?t:void 0,l=this.cc(r);return l&&((c,u,d)=>{let h=c.split(".");if(u)return h[3]===u;if(!d)return!0;let p=d.value.split(".");return h[3]===p[3]||Number(h[2])>Number(p[2])})(l,a,o)?this.uc(r,l,o):a?(o==null?void 0:o.value.split(".")[3])===a?{value:o.value,pending:!o.delivered}:this.uc(r,`fb.1.${Date.now()}.${a}`,o):o?{value:o.value,pending:!o.delivered}:void 0}dc(t,i,s){if(!this.persistence)return;let n=this.ac;this.persistence.refreshKey(n.persistenceKey);let r=this.lc(n);if(s)return void n.unregister();if(i)return V(t)&&da.test(t)?this.uc(n,t,r):void n.unregister();let o=this.cc(n);return o?this.uc(n,o,r):r?{value:r.value,pending:!r.delivered}:void 0}vc(t,i){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);let s=this.lc(t);(s==null?void 0:s.value)!==i||s.delivered||t.register(i,!0)}capture(t,i,s){var n,r;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Bu))return void T.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(x(t)||!V(t))return void T.error("No event name provided to posthog.capture");if(this.ku(),t==="$snapshot"&&this.yu())return;let o=!this.config.opt_out_useragent_filter&&this._is_bot();if(o&&!this.config.__preview_capture_bot_pageviews)return;let a=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a!=null&&a.isRateLimited)return void T.critical("This capture call is ignored due to client rate limiting.");let l;i!=null&&i.$current_url&&!V(i==null?void 0:i.$current_url)&&(T.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),i==null||delete i.$current_url),t!=="$exception"||s!=null&&s.fc||T.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&&(l=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();let c=new Date,u=(s==null?void 0:s.timestamp)||c,d=lo(s==null?void 0:s.uuid,We),h={uuid:d,event:t,properties:this.calculateEventProperties(t,i||{},u,d)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&o&&(h.event="$bot_pageview",h.properties.$browser_type="bot"),a&&(h.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);let p=t==="$feature_flag_called"&&h.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;s!=null&&s.$set&&!p&&(h.$set=s==null?void 0:s.$set);let v=j(i==null?void 0:i.$set)?i.$set:void 0,_=O(i==null?void 0:i.$unset)?i.$unset:[],g=(s==null?void 0:s.$unset)||[],y=C=>{var H;let B=!!(s!=null&&s.$set)&&C in s.$set;return{hasProvided:B||!!v&&C in v,provided:B?s==null||(H=s.$set)===null||H===void 0?void 0:H[C]:v==null?void 0:v[C],unset:_.indexOf(C)!==-1||g.indexOf(C)!==-1}},m=y(Po),w=y(Mo),M=[{channel:this.oc,hasProvided:m.hasProvided,update:this.hc(l==null?void 0:l.fbclid,m.provided,m.hasProvided,m.unset)},{channel:this.ac,hasProvided:w.hasProvided,update:this.dc(w.provided,w.hasProvided,w.unset)}];for(let{channel:C,hasProvided:H,update:B}of M)B&&h.properties.$process_person_profile===!0&&B.pending&&!H&&!p&&(h.$set=f({[C.property]:B.value},h.$set));let P=s==null?void 0:s.$unset;P&&(h.$unset=P);let k=p?void 0:this.gc(s==null?void 0:s.$set_once,t!==Io,t===lc);if(k&&(h.$set_once=k),s!=null&&s._noTruncate||(I=this.config.properties_string_max_length,h=(function(C,H){let B=new Set;return(function Y(z,ie){if(z!==Object(z))return H?H(z):z;if(B.has(z))return;let ge;if(B.add(z),O(z))ge=[],Bt(z,de=>{ge.push(Y(de))});else{let de={};Z(ii(z)?cc(z):z,(me,Te)=>{B.has(me)||(de[Te]=Y(me,Te))}),ge=de}return ge})(C)})(h,C=>V(C)?C.slice(0,I):C)),h.timestamp=u,x(s==null?void 0:s.timestamp)||(h.properties.$event_time_override_provided=!0,h.properties.$event_time_override_system_time=c),p&&(h.properties=((C,H=[])=>{let B={},Y=z=>{C[z]!==void 0&&(B[z]=C[z])};return Xd.forEach(Y),H.forEach(Y),B})(h.properties,lf)),t===Ie.DISMISSED||t===Ie.SENT){let C=i==null?void 0:i[cn.SURVEY_ID],H=i==null?void 0:i[cn.SURVEY_ITERATION];tu({id:C,current_iteration:H}),h.$set=f(f({},h.$set),{},{[Gp({id:C,current_iteration:H},t===Ie.SENT?"responded":"dismissed")]:!0})}else t===Ie.SHOWN&&(h.$set=f(f({},h.$set),{},{[cn.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var I;if(t===Tp.SHOWN){let C=i==null?void 0:i[Xo.TOUR_TYPE];C&&(h.$set=f(f({},h.$set),{},{[`${Xo.TOUR_LAST_SEEN_DATE}/${C}`]:new Date().toISOString()}))}let S=f(f({},h.properties.$set),h.$set);if(Me(S)||this.setPersonPropertiesForFlags(S),!L(this.config.before_send)){let C=this.Os(h);if(!C)return;h=C,h.uuid=lo(h.uuid,We)}this.sessionRecording&&!this.Au&&ca(t)&&(this.Au=!0,setTimeout(()=>this.Au=!1,3e4));let $=M.filter(({channel:C,update:H})=>{var B,Y,z;let ie=(B=(Y=h.$set)===null||Y===void 0?void 0:Y[C.property])!==null&&B!==void 0?B:j((z=h.properties)===null||z===void 0?void 0:z.$set)?h.properties.$set[C.property]:void 0;return(H==null?void 0:H.pending)&&ie===H.value});this.du.emit("eventCaptured",h);let D=(n=s==null?void 0:s._url)!==null&&n!==void 0?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),R=(s==null?void 0:s._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(D),N=f(f(f({method:"POST",url:D,data:h,compression:"best-available",preferSyncCompression:s==null?void 0:s.send_instantly,timestampMode:R?"body":"capture-body",batchKey:s==null?void 0:s._batchKey},R&&(!((r=h.properties)===null||r===void 0)&&r.$session_id)?{batchGroup:h.properties.$session_id+(h.properties.$window_id?`-${h.properties.$window_id}`:"")}:{}),s!=null&&s.transport?{transport:s.transport}:{}),$.length?{fireCallbackOnDrop:!0,callback:C=>{if(C.statusCode>=200&&300>C.statusCode)for(let{channel:H,update:B}of $)this.vc(H,B.value)}}:{});if(!this.config.request_batching||s&&!(s!=null&&s._batchKey)||s!=null&&s.send_instantly){var W;let C;!N.transport&&!N.callback&&Me((W=this.config.request_headers)!==null&&W!==void 0?W:{})&&this.Tu&&(C="sendBeacon"),this.zu(N,C)}else this.Bu.enqueue(N);return h}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return(i=this.tc)===null||i===void 0?void 0:i.getExtension(t)}Ju(){var t;return(t=this.tc)!==null&&t!==void 0?t:this.tc=new nf(this)}fu(t){this.Ru.push(t);let i=!0;return()=>{if(!i)return;i=!1;let s=this.Ru.indexOf(t);s!==-1&&this.Ru.splice(s,1)}}mc(t=!0){var i,s,n;return!!(!((i=this.persistence)===null||i===void 0)&&i.consumeCookieIdentityChange())&&(this.Lu=null,this.persistence.get_property("$user_state")==="anonymous"&&((n=this.sessionPersistence)===null||n===void 0||n.clear(),this.Eu.clear(),this.yc()),(s=this.featureFlags)===null||s===void 0||s.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,s,n,r){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return i;this.ku(),this.persistence.syncCookieProperties(),this.mc();let o=r?void 0:this.persistence.remove_event_timer(t),a=f({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.yu()&&(a[Jl]=!0),t==="$snapshot"){let m=f(f({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=m.distinct_id,(!V(a.distinct_id)&&!oe(a.distinct_id)||yi(a.distinct_id))&&T.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}let l=(function(m,w,M,P=!1){var k,I,S,$;if(!xe)return{};let D=m?[...Qt,...w||[]]:[],[R,N]=pl(xe),[W,C]=(function(he){for(let Re=0;ao.length>Re;Re++){let[ot,at,wt]=ao[Re],Pe=he.match(ot);if(Pe){let Ge=wt&&he.match(wt)||Pe;return[at,(Ge==null?void 0:Ge[1])||""]}}return["",""]})(xe),H=(function(){let he="u">typeof navigator?navigator:void 0;return he!=null&&he.brave?{brave:!0}:{}})(),B={};x(M)||(B.detectGoogleSearchApp=M);let Y={},z=(k=navigator)===null||k===void 0||(k=k.userAgentData)===null||k===void 0?void 0:k.platform,ie=(I=navigator)===null||I===void 0?void 0:I.maxTouchPoints,ge=b==null||(S=b.screen)===null||S===void 0?void 0:S.width,de=b==null||($=b.screen)===null||$===void 0?void 0:$.height,me=b==null?void 0:b.devicePixelRatio;x(z)||(Y.userAgentDataPlatform=z),x(ie)||(Y.maxTouchPoints=ie),x(ge)||(Y.screenWidth=ge),x(de)||(Y.screenHeight=de),x(me)||(Y.devicePixelRatio=me);let Te=Q(mr({$os:R,$os_version:N,$browser:hl(xe,navigator.vendor,H,B),$webview_app:W,$webview_app_version:C,$device:fl(xe),$device_type:md(xe,Y),$timezone:xc(),$timezone_offset:$p()}),{$current_url:Ri(P?yt(K==null?void 0:K.href):K==null?void 0:K.href,D,Li),$host:K==null?void 0:K.host,$pathname:K==null?void 0:K.pathname,$raw_user_agent:xe.length>1e3?xe.substring(0,997)+"...":xe,$browser_version:_d(xe,navigator.vendor,H,B),$browser_language:Tc(),$browser_language_prefix:Ep(),$screen_height:b==null?void 0:b.screen.height,$screen_width:b==null?void 0:b.screen.width,$viewport_height:b==null?void 0:b.innerHeight,$viewport_width:b==null?void 0:b.innerWidth,$lib:st.LIB_NAME,$lib_version:st.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return st.SDK_DIST_CHANNEL&&(Te.$sdk_dist_channel=st.SDK_DIST_CHANNEL),Te})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){let{sessionId:m,windowId:w}=this.sessionManager.checkAndGetSessionAndWindowId(r,s.getTime(),!0);a.$session_id=m,a.$window_id=w}this.sessionPropsManager&&Q(a,this.sessionPropsManager.getSessionProps());try{var c;if(this.sessionRecording){let m=this.sessionRecording.sdkDebugProperties,w=!this.Au&&ca(t);for(let M in m)(w||A(rf,M))&&(a[M]=m[M])}a.$sdk_debug_retry_queue_size=(c=this.Hu)===null||c===void 0?void 0:c.length}catch(m){a.$sdk_debug_error_capturing_properties=String(m)}let u;if(this.requestRouter.region===er&&(a.$lib_custom_api_host=this.config.api_host),u=t!=="$pageview"||r?t!=="$pageleave"||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,n),a=Q(a,u),t==="$pageview"&&E&&(a.title=E.title),!x(o)){let m=s.getTime()-o;a.$duration=parseFloat((m/1e3).toFixed(3))}xe&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");let d=this.persistence.properties(),h=this.sessionPersistence.properties(),p=a.$groups,v=d.$groups;j(p)&&!Me(p)&&(a.$groups=f(f({},j(v)?v:{}),p)),Z(["$referrer","$referring_domain"],m=>{m in d&&delete h[m]});let _={};if(this.Ru.length>0)for(let m of this.Ru.slice())try{Q(_,m())}catch(w){T.error("Failed to produce browser extension event properties",w)}a=Q({},l,d,h,f(f({},_),a)),a.$is_identified=this._isIdentified(),O(this.config.property_denylist)?Z(this.config.property_denylist,function(m){delete a[m]}):T.error(iu+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);let g=this.config.sanitize_properties;g&&(T.error(la),a=g(a,t));let y=this.bc();return a.$process_person_profile=y,y&&!r&&this._c("_calculate_event_properties"),a}gc(t,i=!0,s=!1){var n;if(!this.persistence||!this.bc()||this.Mu&&!s)return t;let r=this.persistence.get_initial_props(),o=(n=this.sessionPropsManager)===null||n===void 0?void 0:n.getSetOnceProps(),a=Q({},r,o||{},t||{}),l=this.config.sanitize_properties;return l&&(T.error(la),a=l(a,"$set_once")),i&&(this.Mu=!0),Me(a)?void 0:a}register(t,i){var s;(s=this.persistence)===null||s===void 0||s.register(t,i)}register_once(t,i,s){var n;(n=this.persistence)===null||n===void 0||n.register_once(t,i,s)}register_for_session(t){var i,s;(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this.mc(),(s=this.sessionPersistence)===null||s===void 0||s.register(t),Object.keys(t).forEach(n=>this.Eu.add(n)),this.yc()}unregister(t){var i;(i=this.persistence)===null||i===void 0||i.unregister(t)}unregister_for_session(t){var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t),this.Eu.delete(t),this.yc()}wc(t,i){this.register({[t]:i})}Uu(){this.Eu.forEach(t=>{var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t)}),this.Eu.clear(),this.yc()}yc(){var t;if(!this.Pu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.hi||!J.At())return void J.Pt(this.Pu);let i=[];this.Eu.forEach(s=>i.push(s)),i.length>0?J.$t(this.Pu,i):J.Pt(this.Pu)}getFeatureFlag(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,i){var s,n;return(s=(n=this.featureFlags)===null||n===void 0?void 0:n.isFeatureEnabled(t,i))!==null&&s!==void 0?s:i==null?void 0:i.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,i,s){var n;(n=this.featureFlags)===null||n===void 0||n.updateFlags(t,i,s)}updateEarlyAccessFeatureEnrollment(t,i,s){var n;(n=this.featureFlags)===null||n===void 0||n.updateEarlyAccessFeatureEnrollment(t,i,s)}getEarlyAccessFeatures(t,i=!1,s){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getEarlyAccessFeatures(t,i,s)}on(t,i){return this.du.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Nt}),()=>{})}onSessionId(t){var i,s;return(i=(s=this.sessionManager)===null||s===void 0?void 0:s.onSessionId(t))!==null&&i!==void 0?i:()=>{}}getSurveys(t,i=!1){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Nt})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Nt})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:Nt}),()=>{})}renderSurvey(t,i){var s;(s=this.surveys)===null||s===void 0||s.renderSurvey(t,i)}displaySurvey(t,i=Jp){var s;(s=this.surveys)===null||s===void 0||s.displaySurvey(t,i)}cancelPendingSurvey(t){var i;(i=this.surveys)===null||i===void 0||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,s;return(i=(s=this.surveys)===null||s===void 0?void 0:s.canRenderSurvey(t))!==null&&i!==void 0?i:{visible:!1,disabledReason:Nt}}canRenderSurveyAsync(t,i=!1){var s,n;return(s=(n=this.surveys)===null||n===void 0?void 0:n.canRenderSurveyAsync(t,i))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Nt})}kc(t){return!t||yi(t)?(T.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(T.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(T.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,i,s){if(!this.__loaded||!this.persistence)return T.uninitializedWarning("posthog.identify");if(oe(t)&&(t=t.toString(),T.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.kc(t)||!this._c("posthog.identify"))return;this.ku();let n=this.get_distinct_id(),r=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,o=this.mc(!1),a=this.persistence.Oa(),l=!1;try{let u=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),t!==u&&t!==this.get_property("__alias")&&(this.unregister(gs),this.register({distinct_id:t}));let d=(this.persistence.get_property("$user_state")||"anonymous")===it,h=t!==u,p=!h&&d;if(h&&d){var c;let v=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:u};this.persistence.set_property(ke,ss),this.setPersonPropertiesForFlags({$set:i||{},$set_once:s||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$identify",v,{$set:i||{},$set_once:s||{}})&&(this.Lu=fn(t,i,s)),(c=this.featureFlags)===null||c===void 0||c.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:u)}else if(p){this.persistence.set_property(ke,ss);let v=i||{},_=s||{};this.setPersonPropertiesForFlags({$set:v,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.Da(),this.capture("$set",{$set:v,$set_once:_})&&(this.Lu=fn(t,i,s))}else(i||s)&&this.setPersonProperties(i,s);h||r||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(gt)):p&&(i||s)&&this.reloadFeatureFlags(),l=!0}finally{a&&this.persistence.qa(l)}}setPersonProperties(t,i){if(!t&&!i||!this._c("posthog.setPersonProperties"))return;let s=fn(this.get_distinct_id(),t,i);this.Lu!==s?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this.Lu=s)):T.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;let s=(O(t)?t:[t]).filter(n=>V(n)&&n.length>0);s.length!==0&&this._c("posthog.unsetPersonProperties")&&((i=this.featureFlags)===null||i===void 0||i.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.Lu=null)}group(t,i,s){var n;if(!t||!i)return void T.error("posthog.group requires a group type and group key");(n=this.persistence)===null||n===void 0||n.syncCookieProperties(),this.mc();let r=this.getGroups(),o=r[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:f(f({},r),{},{[t]:i})}),(o||s)&&this.bc()){let a={$group_type:t,$group_key:i};s&&(a.$group_set=s),this.capture(Io,a)}s&&this.setGroupPropertiesForFlags({[t]:s}),o&&!s&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i=!0){var s;(s=this.featureFlags)===null||s===void 0||s.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t=!0){var i;(i=this.featureFlags)===null||i===void 0||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i=!0){var s;this._c("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)===null||s===void 0||s.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;(i=this.featureFlags)===null||i===void 0||i.resetGroupPropertiesForFlags(t)}reset(t){let i=Se(t)?t:t==null?void 0:t.resetDeviceID,s=Se(t)||t==null?void 0:t.bootstrap;this.Sc(i,!1,s)}Sc(t,i=!1,s){var n,r,o,a,l,c;if(T.info("reset"),!this.__loaded)return T.uninitializedWarning("posthog.reset");let u=s==null?void 0:s.sessionID;this.config.bootstrap=s||((n=this.qu)===null||n===void 0?void 0:n.bootstrap)||{},(r=this.featureFlags)===null||r===void 0||(o=r.updateConfig)===null||o===void 0||o.call(r,this.config,this.il());let d=this.get_property(ur),h=this.get_property(Xs),p=this.get_property(ki);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();let v=this.is_capturing();i||this.consent.reset(),i||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");let _=(l=this.persistence)===null||l===void 0||(c=l.Oa)===null||c===void 0?void 0:c.call(l),g=this.Su;this.Su=g||i;let y=!1;try{var m,w,M,P,k,I,S,$,D,R,N,W,C;if((m=this.persistence)===null||m===void 0||m.clear(),(w=this.sessionPersistence)===null||w===void 0||w.clear(),this.Eu.clear(),this.yc(),x(p)||(R=this.persistence)===null||R===void 0||R.register({$session_recording_remote_config:p}),(M=this.surveys)===null||M===void 0||M.reset(),(P=this.featureFlags)===null||P===void 0||P.reset(),(k=this.conversations)===null||k===void 0||k.reset(),(I=this.logs)===null||I===void 0||I.reset(),(S=this.metrics)===null||S===void 0||S.reset(),($=this.persistence)===null||$===void 0||$.set_property("$user_state","anonymous"),(D=this.sessionManager)===null||D===void 0||D.resetSessionId(),this.Lu=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:Js,$device_id:null},"");else{let Y=this.config.get_device_id(We());this.register_once({distinct_id:Y,$device_id:t?Y:d},""),t||x(h)||this.register({[Xs]:h})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),s&&(s.distinctID&&!this.yu()&&((C=this.persistence)===null||C===void 0||C.set_property("$user_state",s.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.distinctID})),(N=this.featureFlags)===null||N===void 0||N.initialize(),!L(u)&&!(!((W=this.sessionManager)===null||W===void 0)&&W.setBootstrapSessionId(u,!0)))){let Y=f({},s);delete Y.sessionID,this.config.bootstrap=Y}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,y=!0}finally{var H,B;this.Su=g,_&&((H=this.persistence)===null||H===void 0||(B=H.qa)===null||B===void 0||B.call(H,y))}this.reloadFeatureFlags()}shutdown(t){var i=this;return ee(function*(){var s,n,r,o,a,l,c,u;if(i.__loaded){i.Iu=!0,i.Ju().dispose(),(s=i.sessionRecording)===null||s===void 0||s.dispose(),(n=i.logs)===null||n===void 0||n.flushLogs("sendBeacon"),(r=i.metrics)===null||r===void 0||r.flush("sendBeacon"),(o=i.metrics)===null||o===void 0||o.dispose(),(a=i.Bu)===null||a===void 0||a.unload(),(l=i.Hu)===null||l===void 0||l.unload();try{var d;(d=i.featureFlags)===null||d===void 0||d.destroy()}catch(h){T.error("Error while destroying feature flags",h)}(c=i.persistence)===null||c===void 0||c.destroy(),(u=i.sessionPersistence)===null||u===void 0||u.destroy()}else T.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,i){var s;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),(s=this.conversations)===null||s===void 0||s.xc()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t.$c()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return(t=(i=this.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";let{sessionId:i,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if(t!=null&&t.withTimestamp&&s){var r;let o=(r=t.timestampLookBack)!==null&&r!==void 0?r:10;if(!s)return n;n+=`?t=${Math.max(Math.floor((new Date().getTime()-s)/1e3)-o,0)}`}return n}alias(t,i){return t===this.get_property("$people_distinct_id")?(T.critical("Attempting to create alias for existing People user - aborting."),-2):this._c("posthog.alias")?(x(i)&&(i=this.get_distinct_id()),t!==i?(this.wc(gs,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(T.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){let i=f({},this.config);if(j(t)){var s,n,r,o,a,l,c,u,d,h,p,v,_,g;Q(this.config,ha(t));let P=this.Cu();if(this.persistence){let I=this.config.persistence==="sessionStorage"||this.config.persistence==="memory";var y,m;if(I&&this.sessionPersistence!==this.persistence&&((y=this.sessionPersistence)===null||y===void 0||y.remove(),(m=this.sessionPersistence)===null||m===void 0||m.destroy()),this.persistence.update_config(this.config,i,P),I)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new an(f(f({},this.config),{},{persistence:"sessionStorage"}),P,!1);else{var w;(w=this.sessionPersistence)===null||w===void 0||w.update_config(f(f({},this.config),{},{persistence:"sessionStorage"}),f(f({},i),{},{persistence:"sessionStorage"}),P)}}let k=this.Nu(this.config.debug);var M;Se(k)&&(this.config.debug=k),Se(this.config.debug)&&(this.config.debug?(ue.DEBUG=!0,U.At()&&U.$t("ph_debug",!0),T.info("set_config",{config:t,oldConfig:i,newConfig:f({},this.config)})):(ue.DEBUG=!1,U.At()&&U.Pt("ph_debug"))),(s=this.featureFlags)===null||s===void 0||(n=s.updateConfig)===null||n===void 0||n.call(s,this.config,this.il()),(r=this.exceptionObserver)===null||r===void 0||r.onConfigChange(),(o=this.exceptions)===null||o===void 0||o.onConfigChange(),(a=this.metrics)===null||a===void 0||a.onConfigChange(),(l=this.webMCP)===null||l===void 0||l.startIfEnabled(),(c=this.sessionRecording)===null||c===void 0||c.startIfEnabledOrStop(),(u=this.tracingHeaders)===null||u===void 0||u.startIfEnabledOrStop(),(d=this.autocapture)===null||d===void 0||d.startIfEnabled(),(h=this.heatmaps)===null||h===void 0||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((M=this.historyAutocapture)===null||M===void 0||M.startIfEnabledOrStop()),(p=this.exceptionObserver)===null||p===void 0||p.startIfEnabledOrStop(),(v=this.deadClicksAutocapture)===null||v===void 0||v.startIfEnabledOrStop(),(_=this.surveys)===null||_===void 0||_.loadIfEnabled(),this.xu(),(g=this.externalIntegrations)===null||g===void 0||g.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&Go(this,Mi,!1)}}_overrideSDKInfo(t,i){ue.LIB_NAME=t,ue.LIB_VERSION=i}startSessionRecording(t){let i=t===!0,s={sampling:i||!!(t!=null&&t.sampling),linked_flag:i||!!(t!=null&&t.linked_flag),url_trigger:i||!!(t!=null&&t.url_trigger),event_trigger:i||!!(t!=null&&t.event_trigger)};var n,r,o,a,l;Object.values(s).some(Boolean)&&((n=this.sessionManager)===null||n===void 0||n.checkAndGetSessionAndWindowId(),s.sampling&&((r=this.sessionRecording)===null||r===void 0||r.overrideSampling()),s.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),s.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),s.event_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(!((t=this.sessionRecording)===null||t===void 0)&&t.started)}captureException(t,i){try{if(!this.exceptions)return;let s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(f(f({},s),i))}catch{return}}addExceptionStep(t,i){var s;(s=this.exceptions)===null||s===void 0||s.addExceptionStep(t,i)}captureLog(t){var i;(i=this.logs)===null||i===void 0||i.captureLog(t)}get logger(){var t,i;return(t=(i=this.logs)===null||i===void 0?void 0:i.logger)!==null&&t!==void 0?t:pt.Cc}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,s;return(i=(s=this.toolbar)===null||s===void 0?void 0:s.loadToolbar(t))!==null&&i!==void 0&&i}get_property(t){var i;return(i=this.persistence)===null||i===void 0?void 0:i.props[t]}getSessionProperty(t){var i;return(i=this.sessionPersistence)===null||i===void 0?void 0:i.props[t]}toString(){var t;let i=(t=this.config.name)!==null&&t!==void 0?t:mi;return i!==mi&&(i="posthog."+i),i}_isIdentified(){var t,i;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((i=this.sessionPersistence)===null||i===void 0?void 0:i.get_property("$user_state"))==="identified"}bc(){var t,i;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Me(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((i=this.persistence)===null||i===void 0||(i=i.props)===null||i===void 0)&&i.$epp))}rc(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.bc()||this._c("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this._c("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}_c(t){return this.config.person_profiles==="never"?(T.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.bu(),this.wc(pr,!0),!0)}Cu(){if(this.config.cookieless_mode==="always")return!0;let t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}xu(){var t,i;let s=this.Cu();var n,r,o;return this.is_capturing()||(n=this.logs)===null||n===void 0||n.Tc(),((t=this.persistence)===null||t===void 0?void 0:t.hi)!==s&&((r=this.persistence)===null||r===void 0||r.set_disabled(s)),((i=this.sessionPersistence)===null||i===void 0?void 0:i.hi)!==s&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(s)),this.yc(),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!=="always"){if(this.yu()){var s,n,r,o,a,l;(s=this.sessionRecording)===null||s===void 0||s.dispose({discardBufferedEvents:!0}),this.Sc(!0,!0),(n=this.sessionManager)===null||n===void 0||n.destroy(),(r=this.pageViewManager)===null||r===void 0||r.destroy(),this.sessionManager=new na(this),this.pageViewManager=new qo(this),this.persistence&&(this.sessionPropsManager=new ia(this,this.sessionManager,this.persistence));let p=(o=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&o!==void 0?o:(l=pt.__defaultExtensionClasses)===null||l===void 0?void 0:l.sessionRecording;var c,u;p&&(this.sessionRecording=this.mu(this.sessionRecording,new p(this)),this.hu&&((c=this.sessionRecording)===null||c===void 0||(u=c.onRemoteConfig)===null||u===void 0||u.call(c,this.hu)))}var d,h;this.consent.optInOut(!0),this.xu(),this.ec(),(i=this.sessionRecording)===null||i===void 0||i.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((d=this.surveys)===null||d===void 0||d.loadIfEnabled()),(x(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((h=t==null?void 0:t.captureEventName)!==null&&h!==void 0?h:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.nc()}else T.warn(aa)}opt_out_capturing(){this.config.cookieless_mode!=="always"?(this.consent.optInOut(!1),this.xu(),this.config.cookieless_mode==="on_reject"&&this.$u()):T.warn(aa)}$u(){var t,i;let s=this.sessionRecording;s==null||s.dispose({discardBufferedEvents:!0}),this.get_distinct_id()!=="$posthog_cookieless"&&this.Sc(!0,!0),this.register({distinct_id:Js,$device_id:null}),this.gu(s),this.sessionRecording=void 0,(t=this.sessionManager)===null||t===void 0||t.destroy(),(i=this.pageViewManager)===null||i===void 0||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.nc(),this.ec()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){let t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return!this.Su&&(this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this.xu()}_is_bot(){return pe?Xc(pe,this.config.custom_blocked_useragents):void 0}nc(){E&&(E.visibilityState==="visible"?this.Fu||(this.Fu=!0,this.capture(_r,{title:E.title},{send_instantly:!0}),this.Ou&&(E.removeEventListener(Ai,this.Ou),this.Ou=null)):this.Ou||(this.Ou=this.nc.bind(this),G(E,Ai,this.Ou)))}debug(t){t===!1?(b==null||b.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(b==null||b.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}))}il(){let t=this.qu||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(T.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):(function(i,s,n,r,o){let a=s in i&&!L(i[s]),l=n in i&&!L(i[n]);return a?i[s]:!!l&&(o&&o.warn(`Config field '${n}' is deprecated. Please use '${s}' instead. The old field will be removed in a future major version.`),i[n])})(t,"advanced_disable_flags","advanced_disable_decide",0,T)}Os(t){var i;if(L(this.config.before_send))return t;let s=Object.keys((i=t.properties)!==null&&i!==void 0?i:{}).filter(od),n=O(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(let o of n)try{if(r=o(r),L(r)){let a=`Event '${t.event}' was rejected in beforeSend function`;return rd(t.event)?T.warn(`${a}. This can cause unexpected behavior.`):T.info(a),null}r.properties&&!Me(r.properties)||T.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return T.error(`Error in beforeSend function for event '${t.event}':`,a),null}for(let o of s)if(r.properties&&L(r.properties[o]))return T.warn(`Event '${t.event}' had its '${o}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return r}getPageViewId(){var t;return(t=this.pageViewManager.Wo)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(s)})}Nu(t){let i=Se(t)&&!t,s=U.At()&&U.Ot("ph_debug")==="true";return!i&&(!!s||t)}};Ti.__defaultExtensionClasses={},Ti.Cc=(()=>{let e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=ep(e.prototype[t[i]])})(Ti,["identify"]);var su=class{constructor(e){this.disabled=e===!1;let t=j(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;let s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){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}},_n="$copy_autocapture",mn=re("[AutoCapture]");function yn(e,t){return t.length>e?t.slice(0,e)+"...":t}function hf(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Be(t));return t}function pf(e,{e:t,maskAllElementAttributes:i,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:r,disableCaptureUrlHashes:o}){var a,l;if(!Be(e))return{props:{}};let c=[e],u=new Set([e]),d=e;for(;d.parentNode&&!_e(d,"body")&&1e3>c.length;){if(yr(d.parentNode)){let k=d.parentNode.host;if(u.has(k))break;u.add(k),c.push(k),d=k;continue}if(!Be(d.parentNode)||u.has(d.parentNode))break;u.add(d.parentNode),c.push(d.parentNode),d=d.parentNode}let h=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?c.findIndex(k=>_e(k,"button")||_e(k,"a")):-1;h>0&&(s=s||c.slice(0,h+1).some(k=>!Ft(k)||Jt(k)));let p=[],v={},_,g=!1,y=!1;if(Z(c,k=>{let I=Ft(k);if(_e(k,"a")&&!i&&!(n!=null&&n.includes("href"))){let S=k.getAttribute("href");g=!!(I&&S&&qt(S))&&(o?yt(S):S)}A(Xt(k),"ph-no-capture")&&(y=!0),p.push((function(S,$,D,R,N=!1){let W=S.tagName.toLowerCase(),C={tag_name:W};wr.indexOf(W)>-1&&!D&&(C.$el_text=W.toLowerCase()==="a"||W.toLowerCase()==="button"?yn(1024,Bo(S)):yn(1024,Oi(S)));let H=Xt(S);$||R!=null&&R.includes("class")||0>=H.length||(C.classes=H.filter(function(ie){return ie!==""})),Z(S.attributes,function(ie){var ge;if((!Jt(S)||["name","id","class","aria-label"].indexOf(ie.name)!==-1)&&!(R!=null&&R.includes(ie.name))&&!$&&qt(ie.value)&&(!V(ge=ie.name)||ge.substring(0,10)!=="_ngcontent"&&ge.substring(0,7)!=="_nghost")){let de=ie.value;ie.name==="class"&&(de=br(de).join(" ")),C["attr__"+ie.name]=yn(1024,ie.name==="href"&&N?yt(de):de)}});let B=1,Y=1,z=S;for(;z=hf(z);)B++,z.tagName===S.tagName&&Y++;return C.nth_child=B,C.nth_of_type=Y,C})(k,i,s,n,o)),Z((function(S){if(!Ft(S))return{};let $={};return Z(S.attributes,function(D){if(D.name&&D.name.indexOf("data-ph-capture-attribute")===0){let R=D.name.replace("data-ph-capture-attribute-",""),N=D.value;R&&N&&qt(N)&&($[R]=N)}}),$})(k),(S,$)=>{({}).hasOwnProperty.call(v,$)||(v[$]=S)})}),y)return{props:{},explicitNoCapture:y};if(h>0&&(e=c[h],p.splice(0,h)),s||(p[0].$el_text=_e(e,"a")||_e(e,"button")?Bo(e):Oi(e)),g){var m,w;p[0].attr__href=g;let k=(m=nt(g))===null||m===void 0?void 0:m.host,I=b==null||(w=b.location)===null||w===void 0?void 0:w.host;k&&I&&k!==I&&(_=g)}return{props:Q((P=t.type,{$event_type:P,$ce_version:1}),r?{}:{$elements:p},{$elements_chain:(M=p,O(M)?(function(k){return k.map(I=>{var S,$;let D="";if(I.tag_name&&(D+=I.tag_name),I.attr_class){I.attr_class.sort();for(let W of I.attr_class)D+=`.${W.replace(/"/g,"")}`}let R=f(f(f(f({},I.text?{text:I.text}:{}),{},{"nth-child":(S=I.nth_child)!==null&&S!==void 0?S:0,"nth-of-type":($=I.nth_of_type)!==null&&$!==void 0?$:0},I.href?{href:I.href}:{}),I.attr_id?{attr_id:I.attr_id}:{}),I.attributes),N={};return ns(R).sort(([W],[C])=>(function(H,B){return B>H?-1:H>B?1:0})(W,C)).forEach(([W,C])=>N[Uo(W.toString())]=Uo(C.toString())),D+=":",D+=ns(N).map(([W,C])=>`${W}="${C}"`).join(""),D}).join(";")})((function(k){return k.map(I=>{var S,$;let D={text:(S=I.$el_text)===null||S===void 0?void 0:S.slice(0,400),tag_name:I.tag_name,href:($=I.attr__href)===null||$===void 0?void 0:$.slice(0,2048),attr_class:_p(I),attr_id:I.attr__id,nth_child:I.nth_child,nth_of_type:I.nth_of_type,attributes:{}};return ns(I).filter(([R])=>R.indexOf("attr__")===0).forEach(([R,N])=>D.attributes[R]=N),D})})(M)):"")},!((a=p[0])===null||a===void 0)&&a.$el_text?{$el_text:(l=p[0])===null||l===void 0?void 0:l.$el_text}:{},_&&t.type==="click"?{$external_click_url:_}:{},v),target:e};var M,P}var ff=class{do(){this.vo=void 0,clearTimeout(this.fo),this.fo=void 0}po(e){var t;if(!Ft(e))return!0;let i=(t=this.mo().css_selector_ignorelist)!==null&&t!==void 0?t:nn,s=new Set,n=e;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);let r=n,o=Xt(r);if(A(o,"ph-no-capture")||A(o,"ph-sensitive")||Jt(r)||i.some(l=>qn(r,l)))return!0;let a=n.parentNode;n=yr(a)?a.host:a&&Be(a)?a:null}return!1}yo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.do();if(e.type==="pointerdown"){this.do();let s=Ei(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&s&&Be(s)&&(this.vo={target:s,excluded:this.po(s),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.bo)===null||t===void 0?void 0:t.distinctId}))}let i=this.vo;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this.do():e.type==="pointerup"&&(i.released=!0,this.fo=setTimeout(()=>this.do(),0)))}_o(e){var t;let i=this.vo;this.do();let s=Ei(e);if(i!=null&&i.released&&i.target.isConnected&&i.distinctId===((t=this.bo)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&s&&(_e(s,"html")||_e(s,"body"))){var n;if(i.excluded)return null;let r=(n=this.mo().css_selector_ignorelist)!==null&&n!==void 0?n:nn;return[s,E==null?void 0:E.documentElement,E==null?void 0:E.body].some(o=>{if(!o)return!1;let a=Xt(o);return A(a,"ph-no-capture")||A(a,"ph-sensitive")||!Ft(o)||Jt(o)||r.some(l=>qn(o,l))})?null:i.target}}constructor(e){this.wo=e,this.name="autocapture",this.ko=!1,this.So=null,this.xo=!1,this.$o=new Map,this.Co=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.To=!1,this.wo.refresh(this.Mr),this.rageclicks=new su(this.Mr.rageclick),this.Io=null}setup(e){this.Mo(),this.bo=e;let t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.To?t.dispose():(this.Eo=t,this.startIfEnabled())}dispose(){var e;this.To||(this.To=!0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.$o.clear(),this.Io=null,this.Po())}mo(){return this.wo.refresh(this.Mr),this.Mr}Mo(){var e,t;return this.mo(),this.Mr.url_allowlist=(e=this.Mr.url_allowlist)===null||e===void 0?void 0:e.map(i=>new RegExp(i)),this.Mr.url_ignorelist=(t=this.Mr.url_ignorelist)===null||t===void 0?void 0:t.map(i=>new RegExp(i)),this.Mr}Ro(){if(!this.isBrowserSupported())return void mn.info("Disabling Automatic Event Collection because this browser is not supported");if(!b||!E)return;let e=this.Ao=t=>{t=t||(b==null?void 0:b.event);try{if(t.type==="blur")return void this.do();if(t.type.indexOf("pointer")===0)return void this.yo(t);let i=t.type==="click"?this._o(t):void 0;if(ne(i))return;this.Fo(t,"$autocapture",i)}catch(i){mn.error("Failed to capture event",i)}};if(G(b,"blur",e),G(E,"submit",e,{capture:!0}),G(E,"change",e,{capture:!0}),G(E,"click",e,{capture:!0}),Z(["pointerdown","pointermove","pointerup","pointercancel"],t=>{G(E,t,e,{capture:!0})}),this.mo().capture_copied_text){let t=this.Oo=i=>{i=i||(b==null?void 0:b.event);try{this.Fo(i,_n)}catch(s){mn.error("Failed to capture clipboard event",s)}};G(E,"copy",t,{capture:!0}),G(E,"cut",t,{capture:!0}),G(E,"paste",t,{capture:!0})}}Po(){this.do(),this.Ao&&(b==null||b.removeEventListener("blur",this.Ao),Z(["pointerdown","pointermove","pointerup","pointercancel"],e=>{E==null||E.removeEventListener(e,this.Ao,!0)}),E==null||E.removeEventListener("submit",this.Ao,!0),E==null||E.removeEventListener("change",this.Ao,!0),E==null||E.removeEventListener("click",this.Ao,!0),this.Ao=void 0),this.Oo&&(E==null||E.removeEventListener("copy",this.Oo,!0),E==null||E.removeEventListener("cut",this.Oo,!0),E==null||E.removeEventListener("paste",this.Oo,!0),this.Oo=void 0),this.ko=!1}startIfEnabled(){this.isEnabled||this.do(),!this.To&&this.bo&&this.isEnabled&&!this.ko&&(this.Ro(),this.ko=!0)}onRemoteConfig(e){if(this.To)return;if(this.xo=!0,!e.ok)return void this.startIfEnabled();let t=e.config;t.elementsChainAsString&&(this.Co=t.elementsChainAsString);let i=t.autocapture_opt_out;var s;Se(i)&&((s=this.bo)===null||s===void 0||s.kv.set("$autocapture_disabled_server_side",i),this.So=i),this.startIfEnabled()}setElementSelectors(e,t=this){if(this.To)return;e.size?this.$o.set(t,new Set(e)):this.$o.delete(t);let i=new Set;this.$o.forEach(s=>{s.forEach(n=>i.add(n))}),this.Io=i}getElementSelectors(e,t){var i;let s=[];return(i=this.Io)===null||i===void 0||i.forEach(n=>{let r=E==null?void 0:E.querySelectorAll(n);r==null||r.forEach(o=>{e!==o&&t!==o||A(s,n)||s.push(n)})}),s}get isEnabled(){var e,t;if(this.To)return!1;let i=(e=this.bo)===null||e===void 0?void 0:e.kv.get(Vl),s=this.So,n=this.mo();if(!n.remoteRequestsDisabled&&!this.xo)return!1;let r=n.remoteRequestsDisabled&&!this.xo;if(ne(s)&&!Se(i)&&!r)return!1;let o=(t=this.So)!==null&&t!==void 0?t:!!i;return!!n.enabled&&!o}Fo(e,t="$autocapture",i){if(!this.isEnabled)return void this.do();let s=i||Ei(e);pc(s)&&(s=s.parentNode||null);let n=this.Mo();var r;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&n.rageclick&&(!((r=this.rageclicks)===null||r===void 0)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&_c(s,n.rageclick)&&this.Fo(e,"$rageclick",i);let o=t===_n,a=o?f(f({},n),{},{dom_event_allowlist:void 0}):n;if(s&&(function(d,h,p,v,_,g){var y;if(!b||kr(d)||p!=null&&p.url_allowlist&&!Ro(p.url_allowlist,g)||p!=null&&p.url_ignorelist&&Ro(p.url_ignorelist,g))return!1;if(p!=null&&p.dom_event_allowlist){let P=p.dom_event_allowlist;if(P&&!P.some(k=>h.type===k))return!1}let{parentIsUsefulElement:m,targetElementList:w}=mc(d,v);if(!(function(P,k){let I=k==null?void 0:k.element_allowlist;if(x(I))return!0;for(let S of P)if(I.some($=>S.tagName.toLowerCase()===$))return!0;return!1})(w,p)||!Zn(w,p==null?void 0:p.css_selector_allowlist)||Zn(w,(y=p==null?void 0:p.css_selector_ignorelist)!==null&&y!==void 0?y:nn))return!1;try{let P=b.getComputedStyle(d);if(P&&P.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0}catch{}let M=d.tagName.toLowerCase();switch(M){case"html":return!1;case"form":return(_||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(_||["change","click"]).indexOf(h.type)>=0;default:return m?(_||["click"]).indexOf(h.type)>=0:(_||["click"]).indexOf(h.type)>=0&&(wr.indexOf(M)>-1||d.getAttribute("contenteditable")==="true")}})(s,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var l;let{props:d,explicitNoCapture:h,target:p}=pf(s,{e,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.Co,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(h)return!1;let v=this.getElementSelectors(s,p);if(v&&v.length>0&&(d.$element_selectors=v),t===_n){let _=e.type||"clipboard";if(_!=="paste"){var c,u;let g=b==null||(c=b.getSelection())===null||c===void 0?void 0:c.toString(),y=fc(g);if(!y)return!1;d.$selected_content=y,d.$clipboard_text_length=(u=g==null?void 0:g.length)!==null&&u!==void 0?u:0}d.$copy_type=_}return(l=this.bo)===null||l===void 0||l.capture(t,d),!0}}isBrowserSupported(){return le(E==null?void 0:E.querySelectorAll)}},vf=class{constructor(e){this._instance=e}refresh(e){let t=this._instance.config,i=j(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.il(),e.url_allowlist=i==null?void 0:i.url_allowlist,e.url_ignorelist=i==null?void 0:i.url_ignorelist,e.dom_event_allowlist=i==null?void 0:i.dom_event_allowlist,e.element_allowlist=i==null?void 0:i.element_allowlist,e.css_selector_allowlist=i==null?void 0:i.css_selector_allowlist,e.css_selector_ignorelist=i==null?void 0:i.css_selector_ignorelist,e.element_attribute_ignorelist=i==null?void 0:i.element_attribute_ignorelist,e.capture_copied_text=i==null?void 0:i.capture_copied_text}},vi=re("[ExceptionAutocapture]"),pa=()=>{},fa=e=>{var t;if(le(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function ti(e,t,i){try{if(!(t in e))return pa;let s={next:e[t]},n=i(function(...r){return s.next.apply(this,r)});return le(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=n,()=>{if(e[t]===n)return void(e[t]=s.next);let r=e[t],o=fa(r);for(;o;){if(o.next===n)return void(o.next=s.next);r=o.next,o=fa(r)}}}catch{return pa}}var gf=re("[TracingHeaders]"),St=re("[Web Vitals]"),va=9e5,ga=["CLS","FCP","INP","LCP"],_f=["INP","LCP"],mf=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],bn="disabled",_a="lazy_loading",Ke=re("[SessionRecording]"),yf=[fr,vr,ec,tc,ic,sc,nc,rc,oc],bf=re("[Heatmaps]");function wn(e){return j(e)&&"clientX"in e&&"clientY"in e&&oe(e.clientX)&&oe(e.clientY)}var Ki=re("[Product Tours]"),xn=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(hr))},wf=["$set_once","$set"],qe=re("[SiteApps]"),ma="Error while initializing PostHog app with config id ",nu=(e,t)=>e!=null&&e.then?e.then(t):t(e),jt="SDK is not enabled or survey functionality is not yet loaded",ya="Disabled. Not loading surveys.",xf=class{constructor(e,t){this.wo=e,this.Ic=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Mc=!1,this.Ec=!1,this.Pc=[],this.Rc=[],this.Ac=null,this.Fc=null,this.To=!1,this.Oc=new Set,this.onRemoteConfig=i=>{if(this.To||this.Mr.disableSurveys)return;if(!i.ok)return this.Ec=!0,this.Dc({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),q.warn("Remote config unavailable. Not loading surveys.");let s=i.config.surveys;if(L(s))return q.warn("Flags not loaded yet. Not loading surveys.");this.Lc=Se(s)?s:s.length>0,q.info(`flags response received, isSurveysEnabled: ${this.Lc}`),this.loadIfEnabled()},this.Dc=i=>{this.Rc.slice().forEach(s=>this.Nc(s,i))}}setup(e){if(!this.To)return this.qc=e,nu(e.kv.initialize(),()=>{if(this.qc!==e||this.To)return;this.qc=void 0,this.bo=e;let t=e.onRemoteConfig(this.onRemoteConfig);this.To?t.dispose():(this.Eo=t,this.loadIfEnabled())})}dispose(){var e,t,i,s,n;this.To||(this.To=!0,this.qc=void 0,this.bo=void 0,(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(i=this._surveyManager)===null||i===void 0||(s=i.dispose)===null||s===void 0||s.call(i),this._surveyManager=null,this.Pc=[],this.Rc.forEach(r=>{r.active=!1}),this.Rc=[],(n=this.jc)===null||n===void 0||n.call(this),this.jc=void 0,this.Ac=null,this.Oc.forEach(r=>clearTimeout(r)),this.Oc.clear())}get Mr(){return this.wo.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.clearInMemoryInProgressSurveyState)===null||t===void 0||t.call(e);try{var i;(i=this._surveyEventReceiver)===null||i===void 0||i.reset(),localStorage.removeItem("lastSeenSurveyDate");let s=[];for(let n=0;n<localStorage.length;n++){let r=localStorage.key(n);(r!=null&&r.startsWith("seenSurvey_")||r!=null&&r.startsWith("inProgressSurvey_"))&&s.push(r)}s.forEach(n=>localStorage.removeItem(n))}catch{}this.Dc()}loadIfEnabled(){if(this.To||!this.bo)return;let e=this.Mr;if(this._surveyManager)return;if(this.Mc)return void q.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void q.info(ya);if(e.cookielessMode&&this.wo.isOptedOut())return void q.info("Not loading surveys in cookieless mode without consent.");let t=this.wo.getExtensions();if(!t)return void this.Bc("PostHog Extensions not found.");if(x(this.Lc)&&!e.advancedEnableSurveys)return;let i=this.Lc||e.advancedEnableSurveys;this.Mc=!0,this.Ec=!1;try{let s=t.generateSurveys;if(s)return this.zc(s,i),void(this.Mc=!1);let n=t.loadExternalDependency;if(!n)return this.Bc(gr),void(this.Mc=!1);n(r=>{try{if(this.To)return;let o=this.wo.getExtensions();r||!(o!=null&&o.generateSurveys)?this.Bc("Could not load surveys script",r):this.zc(o.generateSurveys,i)}finally{this.Mc=!1}})}catch(s){throw this.Mc=!1,this.Bc("Error initializing surveys",s),s}}zc(e,t){var i,s;if(this.To)return;this._surveyManager=e(t),this._surveyEventReceiver=this.wo.createEventReceiver(this.Dc);let n=(i=(s=this.bo)!==null&&s!==void 0?s:this.Ic)===null||i===void 0?void 0:i.kv.get(_i);n&&this.Hc(n),q.info("Surveys loaded successfully"),this.Uc(),this.Dc(),this.Wc({isLoaded:!0})}Bc(e,t){this.Ec=!0,q.error(e,t),this.Dc({isLoaded:!1,error:e}),this.Wc({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Pc.push(e),this._surveyManager&&this.Wc({isLoaded:!0}),()=>{this.Pc=this.Pc.filter(t=>t!==e)}}getSurveys(e,t=!1){var i;let s=(i=this.bo)!==null&&i!==void 0?i:this.Ic;if(!s||this.To)return;if(this.Mr.disableSurveys)return q.info(ya),e([]);let n=s.kv.get(_i);if(n&&!t)return e(n,{isLoaded:!0}),void(this.Vc()&&this.getSurveys(()=>{},!0));if(this.Ac)return void this.Ac.then(({surveys:a,context:l})=>{this.To||e(a,l)}).catch(a=>q.error("Error in survey callback",a));let r=this.Gc("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(a=>{try{return this.Qc(s,a)}catch(l){return q.error("Error processing surveys response",l),this.Qc(s,{statusCode:0,error:l})}},a=>this.Qc(s,{statusCode:0,error:a}));this.Ac=r;let o=()=>{this.Ac===r&&(this.Ac=null)};r.then(a=>{o(),this.To||(this.Dc(a.context),e(a.surveys,a.context))},o).catch(a=>q.error("Error in survey callback",a))}Gc(e,t){let i=this.bo;return i?i.sendRequest(e,t):new Promise(s=>s({statusCode:0,error:new Error(jt)}))}Qc(e,t){if(this.To)return{surveys:[],context:{isLoaded:!1,error:jt}};let i=t.statusCode;if(i!==200||!t.json){let n=`Surveys API could not be loaded, status: ${i}`;return i!==0?q.error(n):t.error||q.warn(n),this.Fc=Date.now(),{surveys:[],context:{isLoaded:!1,error:n}}}this.Fc=null;let s=t.json.surveys||[];return e.kv.set({[_i]:s,[_s]:Date.now()}),this.Hc(s),{surveys:s,context:{isLoaded:!0}}}Hc(e){var t;let i=e.filter(s=>(function(n){return!(!n.start_date||n.end_date)})(s)&&(Kc(s)||(function(n){var r;return!!(!((r=n.conditions)===null||r===void 0||(r=r.actions)===null||r===void 0||(r=r.values)===null||r===void 0)&&r.length)})(s)));(t=this._surveyEventReceiver)===null||t===void 0||t.replace(i)}Vc(){return this.Zc()&&!this.Ac&&!this.Jc()}Zc(){var e,t;let i=(e=(t=this.bo)!==null&&t!==void 0?t:this.Ic)===null||e===void 0?void 0:e.kv.get(_s);return oe(i)&&Date.now()-i>3e5}Jc(){return oe(this.Fc)&&3e5>Date.now()-this.Fc}markSurveyAsSeen(e,t){var i;let s={id:e,current_iteration:(i=t==null?void 0:t.iteration)!==null&&i!==void 0?i:null};tu(s);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}this.Dc()}Wc(e){for(let t of this.Pc)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){q.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t=!1){if(!L(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);q.warn("init was not called")}onActiveMatchingSurveysChanged(e){var t,i;if(this.To)return()=>{};let s={callback:e,active:!0,revision:0};this.Rc.push(s),this.Uc();let n=(t=(i=this.bo)!==null&&i!==void 0?i:this.Ic)===null||t===void 0?void 0:t.kv.get(_i);return this.Mr.disableSurveys||!this._surveyManager&&this.Ec&&!this.Mc||!n&&!L(this.Fc)&&!this.Ac?this.Nc(s,{isLoaded:!1}):this._surveyManager&&this.Nc(s),()=>{var r;s.active=!1,this.Rc=this.Rc.filter(o=>o!==s),this.Rc.length===0&&((r=this.jc)===null||r===void 0||r.call(this),this.jc=void 0)}}Uc(){var e,t,i;this._surveyManager&&this.Rc.length>0&&((e=this.jc)!==null&&e!==void 0||(this.jc=(t=(i=this.wo).onMatchingConditionsChanged)===null||t===void 0?void 0:t.call(i,this.Dc)))}Nc(e,t){if(this.To||!e.active)return;let i=++e.revision,s=n=>{if(!this.To&&e.active&&i===e.revision)try{let r=t!=null?t:{isLoaded:!0},o=JSON.stringify([n,r]);if(o===e.lastResult)return;e.lastResult=o,e.callback(n,r)}catch(r){q.error("Error in active matching surveys callback",r)}};try{t&&!t.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(n){q.error("Error in active matching surveys callback",n)}}Kc(e){let t=null;return this.getSurveys(i=>{var s;t=(s=i.find(n=>n.id===e))!==null&&s!==void 0?s:null}),t}Xc(e){if(L(this._surveyManager))return{eligible:!1,reason:jt};let t=typeof e=="string"?this.Kc(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Yc(e){if(!this.wo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(L(this._surveyManager))return{eligible:!1,reason:jt};let t=typeof e=="string"?this.Kc(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(L(this._surveyManager))return q.warn("init was not called"),{visible:!1,disabledReason:jt};let t=this.Yc(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return L(this._surveyManager)?(q.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:jt})):new Promise(i=>{this.getSurveys(s=>{var n;let r=(n=s.find(o=>o.id===e))!==null&&n!==void 0?n:null;if(r){let o=this.Yc(r);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(!this.wo.isCapturing())return;if(L(this._surveyManager))return void q.warn("init was not called");let n=typeof e=="string"?this.Kc(e):e;if(!(n!=null&&n.id))return void q.warn("Survey not found");if(!Xp.includes(n.type))return void q.warn(`Surveys of type ${n.type} cannot be rendered in the app`);let r=E==null?void 0:E.querySelector(t);if(r){if(!((s=n.appearance)===null||s===void 0)&&s.surveyPopupDelaySeconds){q.info(`Rendering survey ${n.id} with delay of ${n.appearance.surveyPopupDelaySeconds} seconds`);let o=setTimeout(()=>{var a,l;this.Oc.delete(o),!this.To&&this.wo.isCapturing()&&(q.info(`Rendering survey ${n.id} with delay of ${(a=n.appearance)===null||a===void 0?void 0:a.surveyPopupDelaySeconds} seconds`),(l=this._surveyManager)===null||l===void 0||l.renderSurvey(n,r,i),q.info(`Survey ${n.id} rendered`))},1e3*n.appearance.surveyPopupDelaySeconds);return void this.Oc.add(o)}this._surveyManager.renderSurvey(n,r,i)}else q.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this.wo.isCapturing())return;if(L(this._surveyManager))return void q.warn("init was not called");let s=this.Kc(e);if(!s)return void q.warn("Survey not found");let n=s;if(!((i=s.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(n=f(f({},s),{},{appearance:f(f({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==Yn.Popover&&t.initialResponses&&q.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){let r=this.Xc(s);if(!r.eligible)return void q.warn("Survey is not eligible to be displayed: ",r.reason)}t.displayType!==Yn.Inline?this._surveyManager.handlePopoverSurvey(n,t):this.renderSurvey(n,t.selector,t.properties)}cancelPendingSurvey(e){L(this._surveyManager)?q.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}};function Vt(e,t,i){if(L(e))return!1;switch(i){case"exact":return e===t;case"contains":{let s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var kf=class{constructor(e){this._instance=e,this.th=new Set,this.eh=new Set,this.ih=new Ss,this.nh=(t,i)=>this.sh(t,i)&&this.rh(t,i)&&this.oh(t,i)&&this.ah(t,i),this.sh=(t,i)=>!(i!=null&&i.event)||(t==null?void 0:t.event)===(i==null?void 0:i.event)}init(){var e,t;x((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.uh=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((i,s)=>{this.on(i,s)}))}dispose(){var e,t;(e=this.uh)===null||e===void 0||e.call(this),this.uh=void 0,(t=this._instance)===null||t===void 0||(t=t.autocapture)===null||t===void 0||t.setElementSelectors(new Set,this),this.ih=new Ss}register(e){var t,i;if(!x((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(s=>{var n;this.th.add(s),(n=s.steps)===null||n===void 0||n.forEach(r=>{this.eh.add((r==null?void 0:r.event)||"")})}),(i=this._instance)===null||i===void 0?void 0:i.autocapture)){let s=new Set;this.th.forEach(n=>{var r;(r=n.steps)===null||r===void 0||r.forEach(o=>{o!=null&&o.selector&&s.add(o.selector)})}),this._instance.autocapture.setElementSelectors(s,this)}}replace(e){this.th.clear(),this.eh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.eh.has(e)||this.eh.has(t.event))&&this.th.forEach(i=>{this.hh(t,i)&&this.ih.emit("actionCaptured",i.name)})}dh(e){this.onAction("actionCaptured",t=>e(t))}hh(e,t){if((t==null?void 0:t.steps)==null)return!1;for(let i of t.steps)if(this.nh(e,i))return!0;return!1}onAction(e,t){return this.ih.on(e,t)}rh(e,t){if(t!=null&&t.url){var i;let s=e==null||(i=e.properties)===null||i===void 0?void 0:i.$current_url;if(!s||typeof s!="string"||!Vt(s,t.url,t.url_matching||"contains"))return!1}return!0}oh(e,t){return!!this.fh(e,t)&&!!this.ph(e,t)&&!!this.gh(e,t)}fh(e,t){var i;if(!(t!=null&&t.href))return!0;let s=this.mh(e);if(s.length>0)return s.some(r=>Vt(r.href,t.href,t.href_matching||"exact"));let n=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!n&&Vt((function(r){let o=r.match(/(?::|")href="(.*?)"/);return o?o[1]:""})(n),t.href,t.href_matching||"exact")}ph(e,t){var i;if(!(t!=null&&t.text))return!0;let s=this.mh(e);if(s.length>0)return s.some(l=>Vt(l.text,t.text,t.text_matching||"exact")||Vt(l.$el_text,t.text,t.text_matching||"exact"));let n=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!n&&(r=(function(l){let c=[],u=/(?::|")text="(.*?)"/g,d;for(;!L(d=u.exec(l));)c.includes(d[1])||c.push(d[1]);return c})(n),o=t.text,a=t.text_matching||"exact",r.some(l=>Vt(l,o,a)));var r,o,a}gh(e,t){var i,s;if(!(t!=null&&t.selector))return!0;let n=e==null||(i=e.properties)===null||i===void 0?void 0:i.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;let r=(e==null||(s=e.properties)===null||s===void 0?void 0:s.$elements_chain)||"";if(t.selector_regex&&r)try{return new RegExp(t.selector_regex).test(r)}catch{return!1}return!1}mh(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e==null?void 0:e.properties.$elements}ah(e,t){return!(t!=null&&t.properties)||t.properties.length===0||eu(t.properties.reduce((i,s)=>{let n=O(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return i[s.key]={values:n,operator:s.operator||"exact"},i},{}),e==null?void 0:e.properties)}},Sf=class{constructor(e,t){var i,s;this.yh=[],this._instance=e,this.bh=t,this._h=new Map,this.wh=new Map,this.kh=new Map,this.Sh=(i=this._instance)===null||i===void 0||(s=i.onSessionId)===null||s===void 0?void 0:s.call(i,n=>this.xh(n))}$h(e){return!1}Ch(){return null}Th(e){}Ih(){}Mh(e,t){return!!e&&eu(e.propertyFilters,t==null?void 0:t.properties)}Eh(e,t){let i=new Map;return e.forEach(s=>{var n;(n=s.conditions)===null||n===void 0||(n=n[t])===null||n===void 0||(n=n.values)===null||n===void 0||n.forEach(r=>{if(r!=null&&r.name){let o=i.get(r.name)||[];o.push(s.id),i.set(r.name,o)}})}),i}Ph(e,t,i){let s=(i===hi.Activation?this._h:this.wh).get(e),n=[];return this.Rh(r=>{n=r.filter(o=>s==null?void 0:s.includes(o.id))}),n.filter(r=>{var o;let a=(o=r.conditions)===null||o===void 0||(o=o[i])===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.find(l=>l.name===e);return this.Mh(a,t)})}register(e){this.Ah(e,!1)}replace(e){this.Ah(e,!0)}Ah(e,t){var i;x((i=this._instance)===null||i===void 0?void 0:i._addCaptureHook)||(this.Fh(e,t),this.Oh(e,t))}Oh(e,t){let i=e.filter(r=>{var o;return(o=r.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.length});var s;if(t&&this.kh.clear(),i.length===0)return void(t&&((s=this.Dh)===null||s===void 0||s.replace([])));this.Dh||(this.Dh=new kf(this._instance),this.Dh.init(),this.Dh.dh(r=>this.onAction(r)));let n=[];i.forEach(r=>{var o;(o=r.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||o.values.forEach(a=>{if(n.push(a),a.name){var l;let c=(l=this.kh.get(a.name))!==null&&l!==void 0?l:[];c.includes(r.id)||c.push(r.id),this.kh.set(a.name,c)}})}),t?this.Dh.replace(n):this.Dh.register(n)}Lh(e,t){t.forEach((i,s)=>{var n;let r=(n=e.get(s))!==null&&n!==void 0?n:[];i.forEach(o=>{r.includes(o)||r.push(o)}),e.set(s,r)})}Fh(e,t){var i,s;let n=e.filter(l=>{var c,u;return((c=l.conditions)===null||c===void 0?void 0:c.events)&&((u=l.conditions)===null||u===void 0||(u=u.events)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length)>0}),r=e.filter(l=>{var c,u;return((c=l.conditions)===null||c===void 0?void 0:c.cancelEvents)&&((u=l.conditions)===null||u===void 0||(u=u.cancelEvents)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length)>0}),o=this.Eh(e,hi.Activation),a=this.Eh(e,hi.Cancellation);t?(this._h=o,this.wh=a):(this.Lh(this._h,o),this.Lh(this.wh,a)),(n.length!==0||r.length!==0||e.some(l=>{var c;return(c=l.conditions)===null||c===void 0||(c=c.actions)===null||c===void 0||(c=c.values)===null||c===void 0?void 0:c.length}))&&((i=this.uh)!==null&&i!==void 0||(this.uh=(s=this._instance)===null||s===void 0?void 0:s._addCaptureHook((l,c)=>{this.onEvent(l,c)})))}onEvent(e,t){var i,s;let n=this.Nh(),r=(t==null||(i=t.properties)===null||i===void 0?void 0:i.$survey_id)||(t==null||(s=t.properties)===null||s===void 0?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){let a=this.qh(e,r,t);if(a==="consume")return n.info("event consumed activated item, removing it",{event:e,itemId:r}),void this.jh([r]);if(a==="persist")return n.info("shown item promoted to persisted activation",{event:e,itemId:r}),this.Bh(r),void this.zh([r])}if(this.wh.has(e)){let a=this.Ph(e,t,hi.Cancellation);a.length>0&&(n.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(l=>l.id)}),this.jh(a.map(l=>l.id)),a.forEach(l=>this.Hh(l.id)))}if(!this._h.has(e))return;n.info("event name matched",{event:e,eventPayload:t,items:this._h.get(e)});let o=this.Ph(e,t,hi.Activation);this.Uh(o.map(a=>a.id))}onAction(e){this.kh.has(e)&&this.Uh(this.kh.get(e)||[])}Uh(e){var t,i;if(e.length===0)return;let s=!!(!((t=this._instance)===null||t===void 0||(i=t.get_session_id)===null||i===void 0)&&i.call(t)),n=[];for(let r of e)s&&this.$h(r)?this.Bh(r)&&this.Wh(r):n.push(r);n.length>0&&(this.yh=[...new Set([...this.yh,...n])]),this.Nh().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.Vh()}Bh(e){this.yh=this.yh.filter(i=>i!==e);let t=this.Gh();return!t.includes(e)&&(this.Qh([...t,e]),this.Zh(),!0)}jh(e){let t=new Set(e);this.yh=this.yh.filter(n=>!t.has(n));let i=this.Jh(),s=i.filter(n=>!t.has(n));s.length!==i.length&&(this.Qh(s),s.length===0&&this.Kh()),this.zh(e),this.Vh()}Vh(){try{var e;(e=this.bh)===null||e===void 0||e.call(this)}catch(t){this.Nh().error("Error while handling activated items change",t)}}Xh(){var e;let t=this.Ch();if(!t)return{};let i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return i&&typeof i=="object"?i:{}}Wh(e){if(!this.Ch())return;let t=this.Xh();this.Th(f(f({},t),{},{[e]:Date.now()}))}zh(e){if(!this.Ch())return;let t=this.Xh(),i={},s=!1;for(let[n,r]of Object.entries(t))e.includes(n)?s=!0:i[n]=r;s&&(Me(i)?this.Ih():this.Th(i))}Yh(){this.Ch()&&this.Ih()}getActivationTimestamp(e){if(!this.Gh().includes(e))return;let t=this.Xh()[e];return oe(t)?t:void 0}Jh(){var e;let t=this.td();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Gh(){var e,t,i;let s=this.Jh();if(s.length===0)return[];let n=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.ed()],r=(t=this._instance)===null||t===void 0||(i=t.get_session_id)===null||i===void 0?void 0:i.call(t);return r&&n===r?s:[]}Zh(){var e,t;let i=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);i&&this.nd(i)}Kh(){this.sd()}xh(e){var t;let i=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.ed()];if(i&&i!==e){let s=this.Jh(),n=this.Xh();s.length>0&&(this.Qh([]),s.filter(r=>oe(n[r])).forEach(r=>this.Hh(r))),this.Kh(),this.Yh(),s.length>0&&this.Vh()}}getActivatedIds(){return[...new Set([...this.Gh(),...this.yh])].filter(e=>!this.rd(e))}dispose(){var e,t,i;(e=this.Sh)===null||e===void 0||e.call(this),this.Sh=void 0,(t=this.uh)===null||t===void 0||t.call(this),this.uh=void 0,(i=this.Dh)===null||i===void 0||i.dispose(),this.Dh=void 0}reset(){this.yh=[],this.Jh().length>0&&this.Qh([]),this.Kh(),this.Yh(),this.Vh()}getEventToItemsMap(){return this._h}od(){return this.Dh}},Ef=class extends Sf{constructor(e,t){super(e,t)}td(){return Gl}ed(){return ql}Ch(){return Zl}Th(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}Ih(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}$h(e){var t;let i;this.Rh(n=>{i=n.find(r=>r.id===e)});let s=i==null||(t=i.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return oe(s)&&s>0}ad(){return Ie.SHOWN}Rh(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Hh(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}Nh(){return q}Qh(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}nd(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}sd(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}rd(){return!1}qh(e,t,i){var s;if(e===Ie.SENT&&(i==null||(s=i.properties)===null||s===void 0?void 0:s.$survey_completed)===!1)return"ignore";let n;return this.Rh(r=>{n=r.find(o=>o.id===t)}),!n||(function(r){var o;return Kc(r)&&!!(!((o=r.conditions)===null||o===void 0||(o=o.events)===null||o===void 0)&&o.repeatedActivation)||r.schedule==="always"})(n)?e===Ie.SHOWN?"consume":"ignore":e===Ie.SHOWN?"persist":e===Ie.DISMISSED||e===Ie.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},$f=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);let t={};for(let i of e){let s=this._instance.get_property(i);x(s)||(t[i]=s)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},Pf=class{constructor(e){this._instance=e}get(){let e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){let e=F==null?void 0:F.__PosthogExtensions__;if(!e)return;let{generateSurveys:t,loadExternalDependency:i}=e;return{generateSurveys:t?s=>t(this._instance,s):void 0,loadExternalDependency:i?s=>i(this._instance,"surveys",s):void 0}}createEventReceiver(e){return new Ef(this._instance,e)}onMatchingConditionsChanged(e){let t=this._instance._addCaptureHook(r=>{r!=="$pageview"&&r!==Ie.SHOWN&&r!==Ie.DISMISSED&&r!==Ie.SENT||e()}),i=()=>e();G(b,"PHSurveyShown",i);let s=!1,n=this._instance.onFeatureFlags(()=>{s&&e()});return s=!0,()=>{s=!1,t(),n(),b==null||b.removeEventListener("PHSurveyShown",i)}}},Mf=b!=null&&b.location?bs(b.location.hash,"__posthog")||bs(location.hash,"state"):null,ba="_postHogToolbarParams",wa=re("[Toolbar]"),xa=re("[FeatureFlags]"),Et=re("[FeatureFlags]",{debugEnabled:!0}),kn=`" failed. Feature flags didn't load in time.`,Tf=[502,504],ka=["click","keydown","wheel","touchstart","pointerdown"],Sa="connection_error",Ea=e=>{let t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},$a=e=>{let t={};for(let[i,s]of ns(e||{}))s&&(t[i]=s);return t},If=class{constructor(e){this.name="featureFlags",this.ld=!1,this.featureFlagEventHandlers=[],this.A=xa,this.ud={},this.hd={},this.dd=[],this.vd=new Set,this.fd=new Set,this.pd=!1,this.gd=!1,this.md=0,this.yd=!1,this.bd=!1,this._d=!1,this.wd=!1,this.kd=0,this.Sd=!1,this.rn=()=>{let t=this.xd();this.kd=0,t&&this.reloadFeatureFlags()},this.$d=()=>{var t,i;let s=this.Cd,n=(t=this.Td)!==null&&t!==void 0?t:s;x(s)||x(n)||this.Mr.remoteRequestsDisabled||!this.Id||this.Id.visibilityState==="hidden"||Date.now()-((i=this.Md)!==null&&i!==void 0?i:0)<n||(this.Td=this.Sd||!this.Mr.idleRefreshBackoff?s:Math.min(2*n,36e5),this.Sd=!1,this.reloadFeatureFlags(),this.Ed())},this.Pd=()=>{this.Sd&&this.Td===this.Cd||this.Rd()},this.sn=()=>{var t;((t=this.Id)===null||t===void 0?void 0:t.visibilityState)==="visible"&&this.Rd()},this.wo=e}get Ad(){}Fd(){this.bo&&this.Od()}setup(e){try{this.Dd=typeof window>"u"?void 0:window,this.Id=typeof document>"u"?void 0:document}catch{this.Dd=void 0,this.Id=void 0}return this.qc=e,this.A=e.logger.createLogger("[FeatureFlags]"),nu(e.kv.initialize(),()=>{this.qc===e&&(this.qc=void 0,this.bo=e,this.Ld(e))})}Ld(e){var t;if(this.bo===e)return this.Dd&&G(this.Dd,"online",this.rn),this.Od(),this.Nd=e.registerDynamicEventProperties(()=>this.qd()?this.ud:this.hd),this.jd=(t=this.Ad)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Bd(),this.zd(),this.Hd()}),this.zd(),this.initialize()}Rd(){this.Sd=!0,this.Td=this.Cd,this.$d()}Od(){var e;let t=this.Mr.refreshIntervalMs,i=!this.Mr.remoteRequestsDisabled&&this.Id&&!x(t)&&t>0?t:void 0;this.Mr.idleRefreshBackoff||(this.Td=i),i!==this.Cd&&(this.Ud(),x(i)||(this.Cd=i,this.Td=i,this.Ed(),!((e=this.Id)===null||e===void 0)&&e.addEventListener&&(G(this.Id,Ai,this.sn),Bt(ka,s=>{G(this.Id,s,this.Pd,{capture:!0})}))))}Ed(){x(this.Cd)||(x(this.Wd)||clearInterval(this.Wd),this.Md=Date.now(),this.Wd=setInterval(this.$d,this.Cd))}Ud(){var e,t;x(this.Wd)||(clearInterval(this.Wd),this.Wd=void 0,(e=this.Id)===null||e===void 0||(t=e.removeEventListener)===null||t===void 0||t.call(e,"visibilitychange",this.sn),Bt(ka,i=>{var s,n;(s=this.Id)===null||s===void 0||(n=s.removeEventListener)===null||n===void 0||n.call(s,i,this.Pd,{capture:!0})})),this.Cd=void 0,this.Td=void 0,this.Sd=!1,this.Md=void 0}destroy(){this.Vd()}dispose(){this.Vd()}Vd(){var e,t,i;this.Ud(),this.md++,this.bd=!1,this.qc=void 0,this.Gd(this.vd,"cancelled"),this.Gd(this.fd,"cancelled"),this.bo&&(this.Qd(),(e=this.Nd)===null||e===void 0||e.dispose(),this.Nd=void 0,(t=this.jd)===null||t===void 0||t.call(this),this.jd=void 0,this.dd=[],(i=this.Dd)===null||i===void 0||i.removeEventListener("online",this.rn),this.bo=void 0)}get Mr(){return this.wo.get()}Zd(e){var t;return this.Jd&&e in this.Jd?this.Jd[e]:(t=this.bo)===null||t===void 0?void 0:t.kv.get(e)}Bd(){return!!this.Jd&&(this.Jd=void 0,!0)}Kd(){var e;return!x((e=this.bo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Bd()}$t(e){this.Xd(()=>{var t;return(t=this.bo)===null||t===void 0?void 0:t.kv.set(e)})}Yd(e,t,i){if(!this.Ad||!e.$enabled_feature_flags)return;let s=this.Zd("$enabled_feature_flags")||{},n=e.$enabled_feature_flags||{},r=t.flags||t.featureFlags,o=t.flags?Object.entries(t.flags).filter(([,g])=>!(g!=null&&g.failed)).map(([g])=>g):[],a=!!t.errorsWhileComputingFlags&&!!t.flags,l=a?o:i&&!O(r)?Object.keys(r||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),c=this.Zd("$feature_flag_payloads")||{},u=e.$feature_flag_payloads||{},d=a||i?l:Array.from(new Set([...Object.keys(c),...Object.keys(u)])),h=!a&&!i,p=!!h||l,v=!!h||d,_={[tt]:p,[He]:p,[_t]:v};e.$feature_flag_details&&(_[It]=p);for(let g of[Ct,mt,wi])x(e[g])||(_[g]=!0);this.Ad.markCrossTabFeatureFlagChanges(_)}Pt(e){this.Xd(()=>{var t;return(t=this.bo)===null||t===void 0?void 0:t.kv.remove(e)})}Xd(e){try{e()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}zd(){let e={};for(let s of[tt,_t,Ct,Ze]){let n=this.Zd(s);x(n)||(e[s]=n)}this.ud=e;let t=f({},e),i=this.Zd(He);if(i)for(let[s,n]of Object.entries(i))t[`$feature/${s}`]=n;this.hd=t}qd(){let e=this.Mr.cacheTtlMs;if(!e||0>=e)return!1;let t=this.Zd(mt);return typeof t!="number"||Date.now()-t>e}tv(){return!!this.qd()&&(this.wd||this.gd||(this.wd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ev(){let e=this.Mr.evaluationContexts;return e!=null&&e.length?e.filter(t=>{let i=t&&typeof t=="string"&&t.trim().length>0;return i||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}iv(){let e=this.Mr.flagKeys;if(!x(e))return e.filter(t=>{let i=t&&typeof t=="string"&&t.trim().length>0;return i||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var e,t;let i=this.Mr,s=(e=(t=i.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(s).length){var n,r;let o=(n=(r=i.bootstrap)===null||r===void 0?void 0:r.featureFlagPayloads)!==null&&n!==void 0?n:{},a=Object.keys(s).filter(c=>!x(s[c])).reduce((c,u)=>(c[u]=s[u],c),{}),l=Object.keys(o).filter(c=>a[c]).reduce((c,u)=>(c[u]=o[u],c),{});return this.nv({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(e,t,i){var s,n;let r=i!=null&&i.merge&&(s=this.Zd("$enabled_feature_flags"))!==null&&s!==void 0?s:{},o=i!=null&&i.merge&&(n=this.Zd("$feature_flag_payloads"))!==null&&n!==void 0?n:{},a=f(f({},r),e),l=f(f({},o),t),c={};for(let[u,d]of Object.entries(a))c[u]={key:u,enabled:go(d),variant:_o(d),reason:void 0,metadata:x(l==null?void 0:l[u])?void 0:{id:0,version:void 0,description:void 0,payload:l[u]}};this.nv({flags:c})}get hasLoadedFlags(){return this.pd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){let e=this.Zd(It),t=this.Zd(Ze),i=this.Zd(Mt);if(!i&&!t)return e||{};let s=Q({},e||{}),n=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(let a of n){var r,o;let l=s[a],c=t==null?void 0:t[a],u=x(c)?(r=l==null?void 0:l.enabled)!==null&&r!==void 0&&r:!!c,d=x(c)?l==null?void 0:l.variant:typeof c=="string"?c:void 0,h=i==null?void 0:i[a],p=f(f({},l),{},{enabled:u,variant:u?d!=null?d:l==null?void 0:l.variant:void 0});u!==(l==null?void 0:l.enabled)&&(p.original_enabled=l==null?void 0:l.enabled),d!==(l==null?void 0:l.variant)&&(p.original_variant=l==null?void 0:l.variant),h&&(p.metadata=f(f({},l==null?void 0:l.metadata),{},{payload:h,original_payload:l==null||(o=l.metadata)===null||o===void 0?void 0:o.payload})),s[a]=p}return this.ld||(this.A.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.ld=!0),s}getAllFeatureFlags(){let e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{let s=e[i];return{key:i,enabled:go(s),variant:_o(s),payload:vo(t[i])}})}getFlagVariants(){let e=this.Zd(He),t=this.Zd(Ze);if(!t)return e||{};let i=Q({},e||{}),s=Object.keys(t);for(let n=0;s.length>n;n++)i[s[n]]=t[s[n]];return this.ld||(this.A.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.ld=!0),i}getFlagPayloads(){let e=this.Zd(_t),t=this.Zd(Mt);if(!t)return e||{};let i=Q({},e||{}),s=Object.keys(t);for(let n=0;s.length>n;n++)i[s[n]]=t[s[n]];return this.ld||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.ld=!0),i}reloadFeatureFlags(){this.yd||this.Mr.featureFlagsDisabled||this.xd()||(this.gd&&(this.bd=!0),this.sv||(this.dd.slice().forEach(e=>{try{e()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.sv=setTimeout(()=>{this.rv()},5)))}reloadFeatureFlagsAsync(){return!this.bo||this.yd||this.Mr.featureFlagsDisabled||this.Mr.remoteRequestsDisabled||this.xd()?Promise.resolve({status:"skipped"}):new Promise(e=>{this.vd.add(e),this.reloadFeatureFlags()})}Gd(e,t){e.forEach(i=>i({status:t})),e.clear()}Qd(){clearTimeout(this.sv),this.sv=void 0}onReloading(e){return this.dd.push(e),()=>{this.dd=this.dd.filter(t=>t!==e)}}ensureFlagsLoaded(){this.pd||this.gd||this.sv||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.yd=e}resetFlagCallReported(){this.Pt(gt)}rv(e){var t;this.Qd();let i=this.bo;if(!i||this.Mr.remoteRequestsDisabled||this.xd())return void this.Gd(this.vd,"skipped");if(this.gd)return void(this.bd=!0);let s={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:f(f(f({},i.initialPersonProperties),this.Zd("$stored_person_properties")||{}),{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Zd(ft),timezone:xc()};x(i.deviceId)||(s.$device_id=i.deviceId),(e!=null&&e.disableFlags||this.Mr.featureFlagsDisabled)&&(s.disable_flags=!0);let n=this.ev();n.length&&(s.evaluation_contexts=n);let r=this.iv();x(r)||(s.flag_keys=r);let o=this.Mr.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.md,c=this.vd;this.vd=new Set,this.fd=c,this.gd=!0;let u=()=>{this.bd&&(this.bd=!1,this.rv())},d=g=>{var y,m;let w=(y=g.json)!==null&&y!==void 0?y:{},M=g.statusCode!==200;if(this.gd=!1,l!==this.md)return void u();if(this.ov(g.statusCode),M||this.bd||(this.$anon_distinct_id=void 0),s.disable_flags&&!this.bd)return void this.Gd(c,"skipped");this._d=!M;let P=[];g.error?P.push(g.error instanceof Error&&g.error.name==="AbortError"?"timeout":g.error instanceof Error?Sa:"unknown_error"):g.statusCode!==200&&P.push(`api_error_${g.statusCode}`),w.errorsWhileComputingFlags&&P.push("errors_while_computing_flags");let k=!!(!((m=w.quotaLimited)===null||m===void 0)&&m.includes("feature_flags"));k&&P.push("quota_limited"),this.$t({[Fi]:P}),k?this.A.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."):s.disable_flags||this.nv(w,M,{partialResponse:o}),this.Gd(c,s.disable_flags?"skipped":P.length||!w.flags&&!w.featureFlags?"error":"loaded"),u()},h=g=>{this.gd=!1,l===this.md&&(this.$t({[Fi]:[Sa]}),this.A.error("Feature flag request failed",g),this.Kd()&&this.Hd(!0),this.Gd(c,"error")),u()},p=(t=this.Mr.requestMaxRetries)!==null&&t!==void 0?t:1,v=()=>p>0&&l===this.md,_=()=>{if(l!==this.md||!this.bo||this.Mr.remoteRequestsDisabled)return this.gd=!1,this.Gd(c,"skipped"),void u();try{i.sendRequest(a,{target:"flags",method:"POST",body:s,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(g=>{if((y=>Tf.includes(y.statusCode)||(m=>m.statusCode===0&&m.error instanceof Error&&m.error.name==="AbortError")(y))(g)&&v())return p--,void setTimeout(_,500);d(g)}).catch(h)}catch(g){h(g)}};_()}xd(){return Sc(this.kd,3)}ov(e){this.kd=Ec(e,this.kd,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var i;if(t.fresh&&!this._d)return;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+e+kn);if(this.tv())return;let s=this.getFeatureFlagResult(e,t);return(i=s==null?void 0:s.variant)!==null&&i!==void 0?i:s==null?void 0:s.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){let t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this._d)return;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+e+kn);if(this.tv())return;let i=this.getFlagVariants(),s=e in i,n=i[e],r=this.getFlagPayloads()[e],o=String(n),a=this.Zd("$feature_flag_request_id")||void 0,l=this.Zd("$feature_flag_evaluated_at")||void 0,c,u=this.Zd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var d;let $=(d=this.bo)===null||d===void 0?void 0:d.session.sessionId,D=this.Zd(gi);$&&$!==D&&(u={},c=$)}if(!t.send_event&&"send_event"in t)c&&this.$t({[gt]:u,[gi]:c});else if(e in u&&u[e].includes(o))c&&this.$t({[gt]:u,[gi]:c});else{var h,p,v,_,g,y,m,w,M,P,k,I,S;O(u[e])?u[e].push(o):u[e]=[o],this.$t(f({[gt]:u},c?{[gi]:c}:{}));let $=this.getFeatureFlagDetails(e),D=[...(h=this.Zd("$feature_flag_errors"))!==null&&h!==void 0?h:[]];x(n)&&D.push("flag_missing");let R={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:r!=null?r:null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(p=(v=this.Mr.bootstrap)===null||v===void 0||(v=v.featureFlags)===null||v===void 0?void 0:v[e])!==null&&p!==void 0?p:null,$feature_flag_bootstrapped_payload:(_=(g=this.Mr.bootstrap)===null||g===void 0||(g=g.featureFlagPayloads)===null||g===void 0?void 0:g[e])!==null&&_!==void 0?_:null,$used_bootstrap_value:!this._d};x($==null||(y=$.metadata)===null||y===void 0?void 0:y.has_experiment)||(R.$feature_flag_has_experiment=$.metadata.has_experiment),x($==null||(m=$.metadata)===null||m===void 0?void 0:m.version)||(R.$feature_flag_version=$.metadata.version);let N=(w=$==null||(M=$.reason)===null||M===void 0?void 0:M.description)!==null&&w!==void 0?w:$==null||(P=$.reason)===null||P===void 0?void 0:P.code;N&&(R.$feature_flag_reason=N),!($==null||(k=$.metadata)===null||k===void 0)&&k.id&&(R.$feature_flag_id=$.metadata.id),x($==null?void 0:$.original_variant)&&x($==null?void 0:$.original_enabled)||(R.$feature_flag_original_response=x($.original_variant)?$.original_enabled:$.original_variant),!($==null||(I=$.metadata)===null||I===void 0)&&I.original_payload&&(R.$feature_flag_original_payload=$==null||(S=$.metadata)===null||S===void 0?void 0:S.original_payload),D.length&&(R.$feature_flag_error=D.join(",")),this.av(R)}return s?{key:e,enabled:!!n,variant:typeof n=="string"?n:void 0,payload:vo(r)}:void 0}av(e){try{var t;(t=this.bo)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(i){this.A.error("Failed to capture feature flag call",i)}}getRemoteConfigPayload(e,t){this.lv(e,t)}lv(e,t){var i=this;return ee(function*(){let s=i.bo;if(!s)return;let n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=i.ev();r.length&&(n.evaluation_contexts=r);let o=i.iv(),a;x(o)||(n.flag_keys=o);try{var l;let c=(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:i.Mr.compression,sentAt:"body",timeoutMs:i.Mr.requestTimeoutMs})).json)===null||l===void 0?void 0:l.featureFlagPayloads;a=(c==null?void 0:c[e])||void 0}catch(c){return void i.A.error("Remote config feature flag request failed",c)}try{t(a)}catch(c){i.A.error("Remote config feature flag callback failed",c)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this._d)return t.defaultValue;if(!(this.pd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+e+kn),t.defaultValue;let i=this.getFeatureFlag(e,t);return x(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this.nv(e,t,i)}nv(e,t,i){if(!this.bo)return;this.pd=!0;let s=((n,r={},o={},a={},l,c=xa)=>{let u=((w,M)=>{let P=w.flags;if(P){let k=Object.fromEntries(Object.keys(P).map(S=>{var $;return[S,($=P[S].variant)!==null&&$!==void 0?$:P[S].enabled]})),I=Object.fromEntries(Object.keys(P).filter(S=>P[S].enabled).filter(S=>{var $;return!x(($=P[S].metadata)===null||$===void 0?void 0:$.payload)}).map(S=>{var $;return[S,($=P[S].metadata)===null||$===void 0?void 0:$.payload]}));return f(f({},w),{},{featureFlags:k,featureFlagPayloads:I})}return w.featureFlags&&M.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),w})(n,c),d=u.flags,h=u.featureFlags,p=u.featureFlagPayloads;if(!h)return;let v=n.requestId,_=n.evaluatedAt;if(O(h)){c.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");let w={};if(h)for(let M=0;h.length>M;M++)w[h[M]]=!0;return{[tt]:h,[He]:w,[wi]:!1}}let g=h,y=p,m=d;if(l!=null&&l.partialResponse){let w=Object.keys(g),M=y||{};g=f(f({},r),g),y=f(f({},o),M),w.forEach(P=>{P in M||y==null||delete y[P]}),m=f(f({},a),m)}else if(n.errorsWhileComputingFlags)if(d){let w=new Set(Object.keys(d).filter(P=>{var k;return!(!((k=d[P])===null||k===void 0)&&k.failed)}));g=f(f({},r),Object.fromEntries(Object.entries(g).filter(([P])=>w.has(P))));let M=Object.fromEntries(Object.entries(y||{}).filter(([P])=>w.has(P)));y=f(f({},o),M),w.forEach(P=>{P in M||y==null||delete y[P]}),m=f(f({},a),Object.fromEntries(Object.entries(m||{}).filter(([P])=>w.has(P))))}else g=f(f({},r),g),y=f(f({},o),y),m=f(f({},a),m);return f(f({[tt]:Object.keys($a(g)),[He]:g||{},[_t]:y||{},[It]:m||{},[wi]:n.minimalFlagCalledEvents===!0},v?{[Ct]:v}:{}),_?{[mt]:_}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.A);if(s)if((i==null?void 0:i.persist)===!1){let n=!x(this.bo.kv.get(He));this.Jd=s,n||this.$t(s)}else this.Bd(),this.Yd(s,e,!!(i!=null&&i.partialResponse)),this.$t(s);else t&&this.Kd();t||(this.wd=!1),this.Hd(t)}override(e,t=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.uv(e)}uv(e){if(this.bo){if(e===!1)return this.Pt([Ze,Mt]),this.Hd(),void Et.info("All overrides cleared");if(O(e))return this.$t({[Ze]:Ea(e)}),this.Hd(),void Et.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;let i=e;this.ld=!!((t=i.suppressWarning)!==null&&t!==void 0&&t);let s={},n=i.flags,r=i.payloads;return n&&(s[Ze]=O(n)?Ea(n):n),r&&(s[Mt]=r),Object.keys(s).length&&this.$t(s),n===!1&&r===!1?this.Pt([Ze,Mt]):n===!1?this.Pt(Ze):r===!1&&this.Pt(Mt),this.Hd(),n===!1?Et.info("Flag overrides cleared"):n&&Et.info("Flag overrides set",{flags:n}),void(r===!1?Et.info("Payload overrides cleared"):r&&Et.info("Payload overrides set",{payloads:r}))}if(e&&typeof e=="object")return this.$t({[Ze]:e}),this.Hd(),void Et.info("Flag overrides set",{flags:e});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.pd){let{flags:t,flagVariants:i}=this.hv();try{e(t,i)}catch(s){this.A.error("Error while running feature flags callback",s)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;let n=(this.Zd("$early_access_features")||[]).find(c=>c.flagKey===e),r={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:r};n&&(o.$early_access_feature_name=n.name),i&&(o.$feature_enrollment_stage=i);let a=f(f({},this.getFlagVariants()),{},{[e]:t});(s=this.Ad)===null||s===void 0||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(r)}),this.$t({[tt]:Object.keys($a(a)),[He]:a,[vt]:f(f({},this.Zd("$stored_person_properties")||{}),r)}),this.Hd();try{var l;(l=this.bo)===null||l===void 0||l.capture("$feature_enrollment_update",o)}catch(c){this.A.error("Failed to capture early access feature enrollment",c)}}getEarlyAccessFeatures(e,t=!1,i){let s=this.Zd(Ln);!s||t?this.dv(e,i):e(s)}dv(e,t){var i=this;return ee(function*(){let s=i.bo;if(!s)return;let n=t?`&${t.map(o=>`stage=${o}`).join("&")}`:"",r;try{let o=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;r=o.json.earlyAccessFeatures,i.$t({[Ln]:r})}catch(o){return void i.A.error("Early access feature request failed",o)}try{e(r)}catch(o){i.A.error("Early access feature callback failed",o)}})()}hv(){let e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(i=>t[i]),flagVariants:Object.keys(t).filter(i=>t[i]).reduce((i,s)=>(i[s]=t[s],i),{})}}Hd(e){this.zd();let{flags:t,flagVariants:i}=this.hv();this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(n){this.A.error("Error while running feature flags callback",n)}})}setPersonPropertiesForFlags(e,t=!0){this.vv(e,t)}vv(e,t=!0){let i=this.Zd("$stored_person_properties")||{},s=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),n=e==null?void 0:e.$set_once,r={};if(n)for(let o in n)({}).hasOwnProperty.call(n,o)&&(o in i||(r[o]=n[o]));this.$t({[vt]:f(f(f({},i),r),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){let i=f({},this.Zd("$stored_person_properties")||{});e.forEach(s=>{delete i[s]}),this.$t({[vt]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Pt(vt),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){let i=this.Zd("$stored_group_properties")||{},s=f({},i);for(let n of Object.keys(e))s[n]=f(f({},i[n]),e[n]);this.$t({[ft]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){let t=this.Zd("$stored_group_properties")||{};this.$t({[ft]:f(f({},t),{},{[e]:{}})})}else this.Pt(ft)}reset(){this.md++,this.Gd(this.vd,"cancelled"),this.Gd(this.fd,"cancelled"),this.bd=!1,this.ud={},this.hd={},this.Jd=void 0,this.pd=!1,this.yd=!1,this._d=!1,this.$anon_distinct_id=void 0,this.Qd(),this.ld=!1,this.kd=0}},Pa=re("[FeatureFlags]"),Cf=class{constructor(e,t=!1){this.fv=!1,this.update(e,t)}update(e,t){this.pv=((i,s)=>{var n,r,o,a,l,c,u,d;return{bootstrap:{featureFlags:(n=(r=i.bootstrap)===null||r===void 0?void 0:r.featureFlags)!==null&&n!==void 0?n:void 0,featureFlagPayloads:(o=(a=i.bootstrap)===null||a===void 0?void 0:a.featureFlagPayloads)!==null&&o!==void 0?o:void 0},remoteRequestsDisabled:s,featureFlagsDisabled:!!i.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!i.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!i.advanced_feature_flags_dedup_per_session,cacheTtlMs:i.feature_flag_cache_ttl_ms,refreshIntervalMs:(l=i.remote_config_refresh_interval_ms)!==null&&l!==void 0?l:3e5,idleRefreshBackoff:x(i.remote_config_refresh_interval_ms),requestTimeoutMs:i.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(c=i.feature_flag_request_max_retries)!==null&&c!==void 0?c:1),compression:i.disable_compression?void 0:"best-available",evaluationContexts:(u=(d=i.evaluation_contexts)!==null&&d!==void 0?d:i.evaluation_environments)!==null&&u!==void 0?u:[],flagKeys:O(i.flag_keys)?i.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.fv||(Pa.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.fv=!0),x(e.flag_keys)||O(e.flag_keys)||Pa.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.pv}},Ma=e=>ii(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),je=re("[Error tracking]"),tr="webkit-masked-url:",Ff=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Af=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",tr],Of=["__firefox__","__gCrWeb"],Ta="Refusing to render web experiment since the viewer is a likely bot",Rf={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Es(t,e),not_regex:(e,t)=>!Es(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Le=re("[Conversations]"),$t="Conversations not available yet.";function Ia(e,t){var i,s,n,r,o,a,l;let c=(i=e==null?void 0:e.flushIntervalMs)!==null&&i!==void 0?i:3e3,u=(s=e==null?void 0:e.maxBufferSize)!==null&&s!==void 0?s:100,d=t!=null&&t.consoleCapture?void 0:(n=e==null?void 0:e.maxLogsPerInterval)!==null&&n!==void 0?n:1e3,h=x(d)?Math.max(u,2048):Math.max(u,d),p=f(f({},(function(){let v="",_="";try{let g=pe==null?void 0:pe.userAgent;g&&([v,_]=pl(g))}catch{}return(function(g,y){let m=(function(w){if(w)return{}.hasOwnProperty.call(ko,w)?ko[w]:w})(g);return f(f({},m?{"os.name":m}:{}),y?{"os.version":y}:{})})(v,_)})()),e==null?void 0:e.resourceAttributes);return{serviceName:(r=(o=p==null?void 0:p["service.name"])!==null&&o!==void 0?o:e==null?void 0:e.serviceName)!==null&&r!==void 0?r:t==null?void 0:t.serviceNameDefault,serviceVersion:(a=p==null?void 0:p["service.version"])!==null&&a!==void 0?a:e==null?void 0:e.serviceVersion,environment:(l=p==null?void 0:p["deployment.environment"])!==null&&l!==void 0?l:e==null?void 0:e.environment,resourceAttributes:p,beforeSend:e==null?void 0:e.beforeSend,flushIntervalMs:c,maxBufferSize:u,maxQueueSize:h,maxBatchRecordsPerPost:100,rateCapWindowMs:c,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Lf=["debug","log","warn","error","info"],Df=e=>{for(;e!=null&&e.__rrweb_original__;)e=e.__rrweb_original__;return e},Ca="console",ru="__posthogHandledLogsRequestError",Sn=(e,t)=>{let i=e instanceof Error?e:new Error(t);return i[ru]=!0,i},Fa=e=>!!e&&typeof e=="object"&&e[ru]===!0,$s=re("[NetworkMetrics]"),$r=()=>{var e;return!(b==null||(e=b.performance)===null||e===void 0)&&e.now?b.performance.now():Date.now()},Nf={"http:":80,"https:":443},jf=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),ou=(e,t)=>{var i;let s=String(t);return{method:String(e).toUpperCase(),url:((i=nt(s))===null||i===void 0?void 0:i.href)||s}},ir=(e,t,i,s,n,r,o=!1)=>{try{var a,l;let c=n();if(!c)return;let u=i||void 0,d=$r()-s,h=nt(t.url);if(h&&h.protocol!=="http:"&&h.protocol!=="https:")return;let p={url:(h==null?void 0:h.href)||t.url,method:t.method},v=le(c.name)?c.name(p):V(c.name)?c.name:"http.client.request.duration";if(!v)return;let _=o&&!u?void 0:((y,m)=>y?400>y?void 0:String(y):(m==null?void 0:m.name)||"_OTHER")(u,r),g=f(f(f(f(f({},(y=>{let m=jf.has(y)?y:"_OTHER";return f({"http.request.method":m},m==="_OTHER"&&y!==m?{"http.request.method_original":y}:{})})(p.method)),h?(y=>{return{"server.address":y.hostname.startsWith("[")&&y.hostname.endsWith("]")?y.hostname.slice(1,-1):y.hostname,"server.port":Number(y.port)||Nf[y.protocol],"url.scheme":y.protocol.slice(0,-1),"url.template":(m=y.pathname,m.split("/").map(w=>(M=>/^\d+$/.test(M)||M.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(M))(w)?":id":w).join("/"))};var m})(h):{}),u?{"http.response.status_code":u}:{}),_?{"error.type":_}:{}),(a=c.attributes)===null||a===void 0?void 0:a.call(c,p,{status:u,durationMs:d}));(l=e.metrics)===null||l===void 0||l.histogram(v,d,{unit:"ms",attributes:g})}catch(c){$s.error("Failed to record network metric",c)}},au=()=>{},Vf=(e,t)=>le(b==null?void 0:b.fetch)?ti(b,"fetch",i=>function(...s){let n=$r(),r=i.apply(this,s);if(!t())return r;try{var o,a,l;let[c,u]=s,d=ou((o=(a=u==null?void 0:u.method)!==null&&a!==void 0?a:c==null?void 0:c.method)!==null&&o!==void 0?o:"GET",(l=c==null?void 0:c.url)!==null&&l!==void 0?l:c);return r.then(h=>(ir(e,d,h==null?void 0:h.status,n,t,void 0,!0),h),h=>{throw ir(e,d,void 0,n,t,h),h})}catch(c){return $s.error("Failed to observe fetch",c),r}}):au,Hf=(e,t)=>{var i;let s=b==null||(i=b.XMLHttpRequest)===null||i===void 0?void 0:i.prototype;if(!s)return au;let n=new WeakMap,r=ti(s,"open",a=>function(...l){try{jc.has(this)||n.set(this,ou(l[0],l[1]))}catch(c){$s.error("Failed to observe XHR open",c)}return a.apply(this,l)}),o=ti(s,"send",a=>function(...l){let c;try{let u=n.get(this);if(u&&t()){let d=$r();c=()=>{this.removeEventListener("loadend",c),ir(e,u,this.status,d,t)},G(this,"loadend",c)}}catch(u){$s.error("Failed to observe XHR send",u)}try{return a.apply(this,l)}catch(u){throw c&&this.removeEventListener("loadend",c),u}});return()=>{r(),o()}},Aa=new WeakMap,Wf={maxStringLength:2048,truncationSuffix:"..."};function Oa(e){if(e)return e===!0?{intent:!0,model:!0}:{intent:e.intent!==!1,model:e.model!==!1}}function ht(e,t){return{}.hasOwnProperty.call(e,t)}function En(e,t){let i=Object.create(e);return t&&Object.defineProperty(i,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:t}),i}function Ra(e,t,i=!1){if(!V(e))return;let s=e.trim();return s?(i?wh(s,Wf):s).slice(0,t):void 0}function La(e){try{return j(e)&&e.isError===!0}catch{return!1}}var Is={featureFlags:class extends If{constructor(e){let t=new Cf(e.config,e.il());super(t),this.name="featureFlags",this._instance=e,this.gv=t}get Ad(){return this._instance.persistence}updateConfig(e,t){this.gv.update(e,t),this.Fd()}}},Bf={sessionRecording:class{get Mr(){return this._instance.config}get Il(){return this._instance.persistence}get started(){var e;return!!(!((e=this.mv)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.yv==="awaiting_config"||this.yv==="missing_config"?this.yv:(e=(t=this.mv)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.yv}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.yv=bn,this.bv=void 0,this._v=!1,this.Je=(()=>{var t,i;if(!(E!=null&&E.visibilityState)||E.visibilityState==="visible")return!0;let s=b==null||(t=b.performance)===null||t===void 0||(i=t.getEntriesByType)===null||i===void 0?void 0:i.call(t,"visibility-state");return!(s!=null&&s.length)||s.some(n=>n.name==="visible")})(),this.sn=()=>{var t,i;(E==null?void 0:E.visibilityState)==="visible"&&(this.Je=!0,(t=this.mv)===null||t===void 0||(i=t.setDocumentWasEverVisible)===null||i===void 0||i.call(t,!0))},!this._instance.sessionManager)throw Ke.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Mr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');E!=null&&E.addEventListener&&G(E,"visibilitychange",this.sn)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this._v=!0,E==null||(t=E.removeEventListener)===null||t===void 0||t.call(E,"visibilitychange",this.sn),e?this.wv(!0):this.stopRecording()}get Sv(){var e;let t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),i=!this.Mr.disable_session_recording,s=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return b&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(this._v||this.Sv&&(!((t=this.mv)===null||t===void 0)&&t.isStarted))return;let i=!x(Object.assign)&&!x(Array.from);this.Sv&&i?(this.xv(e),Ke.info("starting")):(this.yv=bn,this.stopRecording())}xv(e){var t,i;if(this.Sv)if(this.yv!=="awaiting_config"&&this.yv!=="missing_config"&&(this.yv=_a),(F==null||(t=F.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((i=F.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording))this.$v(e);else{var s,n;let r=this._instance.sessionManager;(s=F.__PosthogExtensions__)===null||s===void 0||(n=s.loadExternalDependency)===null||n===void 0||n.call(s,this._instance,this.Cv,o=>{if(!this._v&&this.Sv&&this._instance.sessionManager===r)return o?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Ke.error("could not load recorder",o)):void this.$v(e);this.yv="disabled"})}}stopRecording(){var e,t;(e=this.bv)===null||e===void 0||e.call(this),this.bv=void 0,(t=this.mv)===null||t===void 0||t.stop()}wv(e=!1){var t,i;(t=this.bv)===null||t===void 0||t.call(this),this.bv=void 0,(i=this.mv)===null||i===void 0||i.discard({discardProducerEvents:e})}Tv(){var e,t;(e=this.Il)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.Il)===null||t===void 0||t.unregister("$replay_sample_rate")}Iv(e,t){if(L(e))return null;let i=oe(e)?e:parseFloat(e);return typeof(s=i)!="number"||!Number.isFinite(s)||0>s||s>1?(Ke.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var s}Mv(e){if(this.Il){var t,i;let s=this.Il,n=()=>{var r;let o=e.sessionRecording===!1?void 0:e.sessionRecording,a=this.Iv((r=this.Mr.session_recording)===null||r===void 0?void 0:r.sampleRate,"session_recording.sampleRate"),l=this.Iv(o==null?void 0:o.sampleRate,"remote config sampleRate"),c=a!=null?a:l;L(c)&&this.Tv();let u=o==null?void 0:o.minimumDurationMilliseconds;s.register({[ki]:f(f({cache_timestamp:Date.now(),enabled:!!o},o),{},{networkPayloadCapture:f({capturePerformance:e.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:c,minimumDurationMilliseconds:x(u)?null:u,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers,version:o==null?void 0:o.version,triggerGroups:o==null?void 0:o.triggerGroups})})};n(),(t=this.bv)===null||t===void 0||t.call(this),this.bv=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.onSessionId(n)}}onRemoteConfig(e){let t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.Mv(t),void this.wv()):(this.Mv(t),void this.startIfEnabledOrStop()):(this.yv==="awaiting_config"&&(this.yv="missing_config",this._instance.register_for_session({[vr]:!0}),Ke.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;!((i=this.mv)===null||i===void 0)&&i.log?this.mv.log(e,t):Ke.warn("log called before recorder was ready")}get Cv(){var e,t;let i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(ki);return(i==null||(t=i.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}Ev(){let e=this._instance.get_property(ki);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(i){return Ke.warn("persisted remote config for session recording is invalid and will be ignored",i),!1}return!L(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}$v(e){var t,i,s;if(!this._v&&this.Sv&&this._instance.sessionManager){if(!(!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return Ke.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[fr]:!0});var n;if(this.mv||(this.mv=(n=F.__PosthogExtensions__)===null||n===void 0?void 0:n.initSessionRecording(this._instance,this.Je),this.mv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Ev())return this.yv==="missing_config"||this.yv==="awaiting_config"?void 0:(this.yv="awaiting_config",Ke.info("persisted remote config is stale, requesting fresh config before starting"),void new Oc(this._instance).load());this.yv=_a,(i=(s=this.mv).setDocumentWasEverVisible)===null||i===void 0||i.call(s,this.Je),this.mv.start(e)}else this.yv=bn}onRRwebEmit(e){var t,i;(t=this.mv)===null||t===void 0||(i=t.onRRwebEmit)===null||i===void 0||i.call(t,e)}overrideLinkedFlag(){var e,t;this.mv||(t=this.Il)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.mv)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.mv||(t=this.Il)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.mv)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,i;this.mv||(i=this.Il)===null||i===void 0||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.mv)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;let t={};for(let s of yf){var i;let n=(i=this._instance.sessionPersistence)===null||i===void 0?void 0:i.get_property(s);x(n)||(t[s]=n)}return f(f({},t),((e=this.mv)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(e,t){var i;return!!(!((i=this.mv)===null||i===void 0)&&i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.mv)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},Uf={autocapture:class extends ff{constructor(e){super(new vf(e)),this.instance=e}},historyAutocapture:class{constructor(e){this.Pv=!1,this._instance=e,this.Rv=this.Av()}initialize(){this.startIfEnabled()}get isEnabled(){let e=this.Fv();return!!(e.path||e.search||this.Ov(e))}startIfEnabled(){this.isEnabled&&(T.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Rv=this.Av(),this.startIfEnabled()}stop(){this.Dv&&this.Dv(),this.Dv=void 0,this.Lv&&this.Lv(),this.Lv=void 0,T.info("History API monitoring stopped")}monitorHistoryChanges(){b&&b.history&&(this.Nv("pushState"),this.Nv("replaceState"),this.qv(),this.Ov()&&this.jv())}Nv(e){var t;if(!b||!((t=b.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;let i=this;ti(b.history,e,s=>function(n,r,o){var a;i.Bv(o)&&i.zv(),s.call(this,n,r,o),i.Hv(e,!i.Pv&&(b==null||(a=b.event)===null||a===void 0?void 0:a.type)!=="popstate")})}Av(){let e=b==null?void 0:b.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}Fv(){let e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:j(e)?e:{}}Ov(e=this.Fv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}Uv(e){let t=this.Fv(),i=this.Rv;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this.Ov(t)&&e.hash!==i.hash))}Hv(e,t=!1){try{t||this.zv();let i=this.Av();if(!i)return;if(this.Uv(i)){let s=()=>this._instance.capture(_r,{navigation_type:e});t?(this.Wv=s,Promise.resolve().then(()=>this.zv())):s()}this.Rv=i}catch(i){T.error(`Error capturing ${e} pageview`,i)}}Bv(e){var t,i;return!(L(e)||!b)&&((t=nt(String(e)))===null||t===void 0?void 0:t.href)!==((i=b.location)===null||i===void 0?void 0:i.href)}zv(){let e=this.Wv;if(e){this.Wv=void 0,this.Pv=!0;try{e()}catch(t){T.error("Error capturing deferred pageview",t)}finally{this.Pv=!1}this.Rv=this.Av()}}qv(){if(this.Dv)return;let e=()=>{this.Hv("popstate")};G(b,"popstate",e),this.Dv=()=>{b&&b.removeEventListener("popstate",e)}}jv(){if(this.Lv)return;let e=()=>{this.Hv("hashchange")};G(b,"hashchange",e),this.Lv=()=>{b&&b.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(e){var t;this.Vv=!1,this.ko=!1,this.Gv=null,this.instance=e,this.Vv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[Nn]),this.rageclicks=new su(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return j(this.Mr.capture_heatmaps)&&this.Mr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Mr.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return L(this.Mr.capture_heatmaps)?L(this.Mr.enable_heatmaps)?this.Vv:this.Mr.enable_heatmaps:this.Mr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ko)return;bf.info("starting..."),this.Qv(),this.sn()}else{var e;clearInterval((e=this.Gv)!==null&&e!==void 0?e:void 0),this.Zv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!("heatmaps"in t))return;let i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Nn]:i}),this.Vv=i,this.startIfEnabled()}getAndClearBuffer(){let e=this.Rt;return this.Rt=void 0,e}Jv(e){wn(e.originalEvent)&&this.Ir(e.originalEvent,"deadclick")}sn(){this.Gv&&clearInterval(this.Gv),this.Gv=(E==null?void 0:E.visibilityState)==="visible"?setInterval(this.fl.bind(this),this.flushIntervalMilliseconds):null}Qv(){b&&E&&(this.Kv=this.fl.bind(this),G(b,ms,this.Kv),this.Xv=e=>this.Ir(e||(b==null?void 0:b.event)),G(E,"click",this.Xv,{capture:!0}),this.Yv=e=>this.tf(e||(b==null?void 0:b.event)),G(E,"mousemove",this.Yv,{capture:!0}),this.ef=new zo(this.instance,mp,this.Jv.bind(this)),this.ef.startIfEnabledOrStop(),this.if=this.sn.bind(this),G(E,Ai,this.if),this.ko=!0)}Zv(){var e;b&&E&&(this.Kv&&b.removeEventListener(ms,this.Kv),this.Xv&&E.removeEventListener("click",this.Xv,{capture:!0}),this.Yv&&E.removeEventListener("mousemove",this.Yv,{capture:!0}),this.if&&E.removeEventListener(Ai,this.if),clearTimeout(this.nf),(e=this.ef)===null||e===void 0||e.stop(),this.ko=!1)}sf(e,t){let i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),r=(function(o,a,l){let c=o;for(;c&&Be(c)&&!_e(c,"body");){if(c===l)return!1;let p;try{var u,d,h;p=(u=(d=(h=c.ownerDocument)===null||h===void 0?void 0:h.defaultView)!==null&&d!==void 0?d:b)===null||u===void 0?void 0:u.getComputedStyle(c).position}catch{return!1}if(A(a,p))return!0;c=vc(c)}return!1})(Ei(e),["fixed","sticky"],n);return{x:e.clientX+(r?0:s),y:e.clientY+(r?0:i),target_fixed:r,type:t}}Ir(e,t="click"){var i;if(Oo(e.target)||!wn(e))return;let s=this.sf(e,t);!((i=this.rageclicks)===null||i===void 0)&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&_c(Ei(e),this.instance.config.rageclick)&&this.Qs(f(f({},s),{},{type:"rageclick"})),this.Qs(s)}tf(e){!Oo(e.target)&&wn(e)&&(clearTimeout(this.nf),this.nf=setTimeout(()=>{this.Qs(this.sf(e,"mousemove"))},500))}Qs(e){if(!b)return;let t=this.Mr.disable_capture_url_hashes?yt(b.location.href):b.location.href,i=this.Mr.custom_personal_data_properties,s=this.Mr.mask_personal_data_properties?[...Qt,...i||[]]:[],n=Ri(t,s,Li);this.Rt=this.Rt||{},this.Rt[n]||(this.Rt[n]=[]),this.Rt[n].push(e)}fl(){this.Rt&&!Me(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:zo,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.Vv=!1,this.ko=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.rf=()=>{clearTimeout(this.af),this.af=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",f({$current_url:this.Rt.url},this.Rt.metrics.reduce((i,s)=>f(f({},i),{},{[`$web_vitals_${s.name}_event`]:f({},s),[`$web_vitals_${s.name}_value`]:s.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.lf=i=>{var s;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},L(i==null?void 0:i.name)||L(i==null?void 0:i.value))return void St.error("Invalid metric received",i);let n=typeof i.navigationURL=="string"?i.navigationURL:void 0,r=this.uf(n);if(x(r))return;let o=oe(i.navigationId)||typeof i.navigationId=="string"?`navigation:${i.navigationId}`:`url:${r}`;if(this.cf&&i.value>=this.cf)return void St.error("Ignoring metric with value >= "+this.cf,i);this.Rt.navigationKey!==o&&(this.rf(),this.af=setTimeout(this.rf,this.flushToCaptureTimeoutMs)),x(this.Rt.navigationKey)&&(this.Rt.navigationKey=o,this.Rt.url=r),this.Rt.firstMetricTimestamp=x(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;let a=(s=this._instance.sessionManager)===null||s===void 0?void 0:s.checkAndGetSessionAndWindowId(!0),l=f(f(f({},i),n?{navigationURL:r}:{}),{},{$current_url:r,timestamp:Date.now()});if(delete l.entries,j(i.attribution)&&this.attributionMetrics.indexOf(i.name)>-1){let c={};for(let u of mf){let d=u==="url"&&typeof i.attribution[u]=="string"?this.uf(i.attribution[u]):i.attribution[u];x(d)||(c[u]=d)}l.attribution=c}else delete l.attribution;x(a)||(l.$session_id=a.sessionId,l.$window_id=a.windowId),this.Rt.metrics.push(l),this.Rt.metrics.length===this.allowedMetrics.length&&this.rf()},this.hf=()=>{if(this.ko)return;let i,s,n,r,o=!1,a=F.__PosthogExtensions__,l=a==null?void 0:a.postHogWebVitalsCallbacksByFlavor,c=(l==null?void 0:l[this.df])||(this.df==="web-vitals"&&x(l)?a==null?void 0:a.postHogWebVitalsCallbacks:void 0);if(!x(c)){let h=c.withoutAttribution,p=this.attributionMetrics;o=!x(h),i=p.indexOf("LCP")>-1?c.onLCP:(h==null?void 0:h.onLCP)||c.onLCP,s=p.indexOf("CLS")>-1?c.onCLS:(h==null?void 0:h.onCLS)||c.onCLS,n=p.indexOf("FCP")>-1?c.onFCP:(h==null?void 0:h.onFCP)||c.onFCP,r=p.indexOf("INP")>-1?c.onINP:(h==null?void 0:h.onINP)||c.onINP}if(!(i&&s&&n&&r))return void St.error("web vitals callbacks not loaded - not starting");let u={reportSoftNavs:this.useSoftNavs},d=o&&this.attributionMetrics.indexOf("INP")>-1?f(f({},u),{},{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&i(this.lf.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&s(this.lf.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&n(this.lf.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&r(this.lf.bind(this),d),this.ko=!0},this.Vv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[Hn]),this.startIfEnabled()}get vf(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;let i=j(this.vf)?(e=this.vf)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return L(i)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||ga:i}get flushToCaptureTimeoutMs(){return(j(this.vf)?this.vf.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){let e=j(this.vf)?this.vf.web_vitals_attribution:void 0;return Se(e)?e?ga:[]:O(e)?e:_f}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){let e=j(this.vf)?this.vf.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get cf(){let e=j(this.vf)&&oe(this.vf.__web_vitals_max_value)?this.vf.__web_vitals_max_value:va;return e>0&&6e4>=e?va:e}get isEnabled(){let e=K==null?void 0:K.protocol;if(e!=="http:"&&e!=="https:")return St.info("Web Vitals are disabled on non-http/https protocols"),!1;let t=j(this.vf)?this.vf.web_vitals:Se(this.vf)?this.vf:void 0;return Se(t)?t:this.Vv}startIfEnabled(){this.isEnabled&&!this.ko&&(St.info("enabled, starting..."),this.zo(this.hf))}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if(!("capturePerformance"in t))return;let i=j(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=j(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Hn]:i}),this._instance.persistence.register({[Bl]:s})),this.Vv=i,this.startIfEnabled()}get df(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(e){var t;let i=F.__PosthogExtensions__,s=this.df,n=i==null?void 0:i.postHogWebVitalsCallbacksByFlavor;n!=null&&n[s]||s==="web-vitals"&&x(n)&&(i!=null&&i.postHogWebVitalsCallbacks)?e():i==null||(t=i.loadExternalDependency)===null||t===void 0||t.call(i,this._instance,s,r=>{r?St.error("failed to load script",r):e()})}uf(e){let t=e||(b==null?void 0:b.location.href);if(!t)return void St.error("Could not determine current URL");let i=this._instance.config.disable_capture_url_hashes?yt(t):t,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Qt,...s||[]]:[];return Ri(i,n,Li)}}},zf={exceptionObserver:class{constructor(e){var t;this.hf=()=>{var i;if(!b||!this.isEnabled||!(!((i=F.__PosthogExtensions__)===null||i===void 0)&&i.errorWrappingFunctions))return;let s=F.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=F.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=F.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ff&&this.Mr.capture_unhandled_errors&&(this.ff=s(this.captureException.bind(this))),!this.pf&&this.Mr.capture_unhandled_rejections&&(this.pf=n(this.captureException.bind(this))),!this.gf&&this.Mr.capture_console_errors&&(this.gf=r(this.captureException.bind(this)))}catch(o){vi.error("failed to start",o),this.mf()}},this._instance=e,this.yf=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[jn]),this.wt=new ud(f(f({},(function(i={}){var s,n,r,o;return{refillRate:(s=(n=i.exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:i.__exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:1,bucketSize:(r=(o=i.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:i.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:vi})),this.Mr=this.bf(),this.startIfEnabledOrStop()}bf(){let e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return j(e)?t=f(f({},t),e):(x(e)?this.yf:e)&&(t=f(f({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Mr.capture_console_errors||this.Mr.capture_unhandled_errors||this.Mr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(vi.info("enabled"),this.mf(),this.zo(this.hf)):this.mf()}zo(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"exception-autocapture",n=>{if(n)return vi.error("failed to load script",n);e()})}mf(){var e,t,i;(e=this.ff)===null||e===void 0||e.call(this),this.ff=void 0,(t=this.pf)===null||t===void 0||t.call(this),this.pf=void 0,(i=this.gf)===null||i===void 0||i.call(this),this.gf=void 0}onRemoteConfig(e){if(!e.ok)return;let t=e.config;"autocaptureExceptions"in t&&(this.yf=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[jn]:this.yf}),this.Mr=this.bf(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.bf()}captureException(e){try{var t,i,s;let n=(t=e==null||(i=e.$exception_list)===null||i===void 0||(i=i[0])===null||i===void 0?void 0:i.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(n))return void vi.info("Skipping exception capture because of client rate limiting.",{exception:n});(s=this._instance.exceptions)===null||s===void 0||s.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,i;this._f=[],this.wf=new xd([new Dd,new Gd,new jd,new Nd,new Ud,new Bd,new Hd,new zd],(function(s,...n){return(r,o=0)=>{let a=[],l=r.split(`
|
|
3
|
+
`),c=Math.min(l.length,o+1e3),u=[];for(let p=o;c>p;p++){let v=l[p];if(v.length>1024)continue;let _=fo.test(v)?v.replace(fo,"$1"):v;if(!_.match(/\S*Error: /)){for(let g of n){let y=g(_,s);if(y){a.push(y);let m=Ad(a);if(m){for(let w=u.length-1;w>=0;w--){let M=u[w];if(m.start>=M.start+M.length)break;u.pop()}u.push(m)}break}}if(Rd(a,u)>=50)break}}let d=[...u].sort((p,v)=>v.start-p.start),h=d[d.length-1];if(h){let p=wl(a,h);a.splice(h.start-p,p);for(let v of d)v.start-=p}for(let p of d)Od(a,p);return u.some(p=>p.start===0&&a.length===p.length)&&(function(p){let v=p.map(g=>`${g.function}|${g.filename}|${g.lineno}|${g.colno}|${g.module}`),_=0;for(let g=1;v.length>g;g++)Ld(v,g,_)&&(_=g);p.push(...p.splice(0,_))})(a),(function(p){if(!p.length)return[];let v=Array.from(p);return v.reverse(),v.slice(0,50).map(_=>{return f(f({},_),{},{filename:_.filename||(g=v,g[g.length-1]||{}).filename,function:_.function||"?"});var g})})(a)}})("web:javascript",Td,Fd)),this._instance=e,this._f=(t=(i=this._instance.persistence)===null||i===void 0?void 0:i.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.kf=ps(this.Sf()),this.xf=new Zd(this.kf)}onConfigChange(){this.kf=ps(this.Sf()),this.xf.setConfig(this.kf)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;let n=e.config;if(!("errorTracking"in n))return;let r=(t=(i=n.errorTracking)===null||i===void 0?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],o=(s=n.errorTracking)===null||s===void 0?void 0:s.captureExtensionExceptions;this._f=r,this._instance.persistence&&this._instance.persistence.register({[Hl]:this._f,[Vn]:o})}get $f(){var e;let t=!!this._instance.get_property(Vn),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i!=null?i:t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.wf.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.kf.enabled)try{if(!V(e)||e.trim().length===0)return void je.warn("Ignoring exception step because message must be a non-empty string");let{sanitizedProperties:i,droppedKeys:s}=(function(n){if(!n)return{sanitizedProperties:{},droppedKeys:[]};let r=[];return{sanitizedProperties:Object.keys(n).reduce((o,a)=>qd.has(a)?(r.push(a),o):(o[a]=n[a],o),{}),droppedKeys:r}})(this.Cf(t));s.length>0&&je.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.xf.add(f({[ds]:e,[hs]:new Date().toISOString()},i))}catch(i){je.error("Failed to add exception step. Ignoring breadcrumb.",i)}}sendExceptionEvent(e){try{let t=e.$exception_list;if(this.Tf(t)){if(this.If(t))return this.Mf("Exception dropped: matched a suppression rule"),void je.info("Skipping exception capture because a suppression rule matched");if(!this.$f&&this.Ef(t))return this.Mf("Exception dropped: thrown by a browser extension"),void je.info("Skipping exception capture because it was thrown by an extension");if(!this.$f&&this.Pf(t))return this.Mf("Exception dropped: thrown by an injected browser script"),void je.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Rf(t))return this.Mf("Exception dropped: thrown by the PostHog SDK"),void je.info("Skipping exception capture because it was thrown by the PostHog SDK")}let i=this.kf.enabled&&L(e.$exception_steps)?this.Af(e):e,s=(function(){let n=globalThis._posthogReleaseId;return typeof n=="string"&&n.length>0?n:void 0})();s&&(i.$release_id=s);try{let n=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",fc:!0});return n&&this.xf.clear(),n}catch(n){return Ma(n)||je.error("Failed to capture exception event. Dropping this exception.",n),void this.xf.clear()}}catch(t){return void(Ma(t)||je.error("Failed to process exception event. Ignoring this exception.",t))}}Af(e){try{let t=this.xf.getAttachable();return t.length===0?e:f(f({},e),{},{$exception_steps:t})}catch(t){return je.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Mf(e){this.kf.enabled&&this.xf.add({[ds]:e,[hs]:new Date().toISOString()})}Cf(e){return j(e)?f({},e):{}}Sf(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}If(e){if(e.length===0)return!1;try{let t=e.reduce((i,{type:s,value:n})=>(V(s)&&s.length>0&&i.$exception_types.push(s),V(n)&&n.length>0&&i.$exception_values.push(n),i),{$exception_types:[],$exception_values:[]});return this._f.some(i=>{let s=i.values.map(n=>{let r=Qc[n.operator],o=t[n.key];if(!r||!o)return!1;let a=O(n.value)?n.value:[n.value];return a.length>0&&r(a,o)});return i.type==="OR"?s.some(Boolean):s.every(Boolean)})}catch(t){return je.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Ef(e){let t=e.flatMap(s=>{var n,r;return(n=(r=s.stacktrace)===null||r===void 0?void 0:r.frames)!==null&&n!==void 0?n:[]}),i=t.filter(({filename:s})=>!!s&&Af.some(n=>s.startsWith(n)));return i.length!==0&&(!i.every(({filename:s})=>!!s&&s.startsWith(tr))||e.some(({type:s,value:n})=>s==="NoResponse"||V(n)&&Ff.some(({value:r,exact:o})=>o?n===r:n.includes(r)))&&!t.some(({in_app:s,filename:n})=>s&&!(n!=null&&n.startsWith(tr))))}Pf(e){return e.some(({value:t})=>V(t)&&Of.some(i=>t.includes(i)))}Rf(e){if(e.length>0){var t,i,s,n;let r=(t=(i=e[0].stacktrace)===null||i===void 0?void 0:i.frames)!==null&&t!==void 0?t:[],o=r[r.length-1];return(s=o==null||(n=o.filename)===null||n===void 0?void 0:n.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}Tf(e){return!L(e)&&O(e)}}},Gf=f({productTours:class{get Il(){return this._instance.persistence}constructor(e){this.Ff=null,this.Of=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;let t=e.config;if("productTours"in t){var i,s;if(this.Il&&this.Il.register({[hr]:!!t.productTours}),!xn(this._instance))return!this.Ff&&L((i=this.Il)===null||i===void 0?void 0:i.props.ph_product_tours)||Ki.info("product tours disabled; stopping and clearing cached tours"),(s=this.Ff)===null||s===void 0||s.stop(),this.Ff=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Ff&&xn(this._instance)&&this.zo(()=>this.Df())}zo(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"product-tours",n=>{n?Ki.error("Could not load product tours script",n):e()})}Df(){var e;!this.Ff&&(!((e=F.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.Ff=F.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(O(this.Of)&&!t)return void e(this.Of,{isLoaded:!0});let i=this.Il;if(i){let s=i.props[Wn];if(O(s)&&!t)return this.Of=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",timestampMode:"query",callback:s=>{if(!xn(this._instance))return void e([],{isLoaded:!0});let n=s.statusCode;if(n!==200||!s.json){let o=`Product Tours API could not be loaded, status: ${n}`;return n===0?s.error||Ki.warn(o):Ki.error(o),void e([],{isLoaded:!1,error:o})}let r=O(s.json.product_tours)?s.json.product_tours:[];this.Of=r,i&&i.register({[Wn]:r}),e(r,{isLoaded:!0})}})}getActiveProductTours(e){L(this.Ff)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ff.getActiveProductTours(e)}showProductTour(e){var t;(t=this.Ff)===null||t===void 0||t.showTourById(e)}previewTour(e){this.Ff?this.Ff.previewTour(e):this.zo(()=>{var t;this.Df(),(t=this.Ff)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.Ff)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.Ff)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.Ff)===null||e===void 0||e.previousStep()}clearCache(){var e;this.Of=null,(e=this.Il)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.Ff)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.Ff)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.Ff)===null||t===void 0||t.cancelPendingTour(e)}}},Is),qf={siteApps:class{constructor(e){this._instance=e,this.Lf=0,this.Nf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}qf(e,t){if(!t)return;let i=this.globalsForEvent(t);this.Nf.push(i),this.Nf.length>1e3&&(this.Nf=this.Nf.slice(10))}get siteAppLoaders(){var e;return(e=F._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){let e=this._instance._addCaptureHook(this.qf.bind(this));this.jf=()=>{e(),this.Nf=[],this.jf=void 0}}}globalsForEvent(e){var t,i,s,n,r,o,a;if(!e)throw new Error("Event payload is required");let l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(let[p,v]of Object.entries(u))l[p]={id:c[p],type:p,properties:v};let{$set_once:d,$set:h}=e;return{event:f(f({},El(e,wf)),{},{properties:f(f(f({},e.properties),h?{$set:f(f({},(t=(i=e.properties)===null||i===void 0?void 0:i.$set)!==null&&t!==void 0?t:{}),h)}:{}),d?{$set_once:f(f({},(s=(n=e.properties)===null||n===void 0?void 0:n.$set_once)!==null&&s!==void 0?s:{}),d)}:{}),elements_chain:(r=(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&r!==void 0?r:"",distinct_id:(a=e.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}Bf(e){var t;let i=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return i==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(qe.error("prepare_external_dependency_stylesheet returned null"),null):i==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(qe.error("prepare_external_dependency_script returned null"),null):e}zf(){var e,t,i,s,n,r,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};let l=E==null?void 0:E.defaultView,c=l==null||(e=l.Node)===null||e===void 0?void 0:e.prototype;if(!l||!c)return()=>{};if(this.Lf++,this.Hf)return this.Uf();let u=[],d=this,h=new WeakSet,p=(g,y,m)=>{if(!(g!=null&&g[y]))return;let w=g[y];g[y]=m(w),u.push(()=>{g[y]=w})},v=g=>{if(h.has(g))return g;let y=d.Bf(g);return y&&h.add(y),y},_=g=>g.map(y=>typeof y=="string"?y:v(y)).filter(y=>!ne(y));return p(c,"appendChild",g=>function(y){let m=v(y);return m?g.call(this,m):y}),p(c,"insertBefore",g=>function(y,m){let w=v(y);return w?g.call(this,w,m):y}),p(c,"replaceChild",g=>function(y,m){let w=v(y);return w?g.call(this,w,m):m}),[(t=l.Element)===null||t===void 0?void 0:t.prototype,(i=l.Document)===null||i===void 0?void 0:i.prototype,(s=l.DocumentFragment)===null||s===void 0?void 0:s.prototype].forEach(g=>{p(g,"append",y=>function(...m){return y.apply(this,_(m))}),p(g,"prepend",y=>function(...m){return y.apply(this,_(m))})}),[(n=l.Element)===null||n===void 0?void 0:n.prototype,(r=l.CharacterData)===null||r===void 0?void 0:r.prototype,(o=l.DocumentType)===null||o===void 0?void 0:o.prototype].forEach(g=>{p(g,"before",y=>function(...m){return y.apply(this,_(m))}),p(g,"after",y=>function(...m){return y.apply(this,_(m))}),p(g,"replaceWith",y=>function(...m){let w=_(m);return m.length&&!w.length?void 0:y.apply(this,w)})}),p((a=l.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",g=>function(y,m){let w=v(m);return w?g.call(this,y,w):null}),this.Hf=()=>{u.forEach(g=>g()),this.Hf=void 0},this.Uf()}Uf(){let e=!1;return()=>{var t;e||(e=!0,this.Lf--,this.Lf===0&&((t=this.Hf)===null||t===void 0||t.call(this)))}}Wf(e,t=!0){let i=this.zf();try{let s=e(i);return t&&i(),s}catch(s){throw i(),s}}setupSiteApp(e){let t=this.apps[e.id],i=()=>{var r;!t.errored&&this.Nf.length&&(qe.info(`Processing ${this.Nf.length} events for site app with id ${e.id}`),this.Nf.forEach(o=>this.Wf(()=>{var a;return(a=t.processEvent)===null||a===void 0?void 0:a.call(t,o)})),t.processedBuffer=!0),Object.values(this.apps).every(o=>o.processedBuffer||o.errored)&&((r=this.jf)===null||r===void 0||r.call(this))},s=!1,n=r=>{t.errored=!r,t.loaded=!0,qe.info(`Site app with id ${e.id} ${r?"loaded":"errored"}`),s&&i()};try{let{processEvent:r}=this.Wf(o=>e.init({posthog:this._instance,callback(a){o(),n(a)}}),!1);r&&(t.processEvent=r),s=!0}catch(r){qe.error(ma+e.id,r),n(!1)}if(s&&t.loaded)try{i()}catch(r){qe.error(`Error while processing buffered events PostHog app with config id ${e.id}`,r),t.errored=!0}}Vf(){let e=this.siteAppLoaders||[];for(let t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(let t of e)this.setupSiteApp(t)}Gf(e){if(Object.keys(this.apps).length===0)return;let t=this.globalsForEvent(e);for(let i of Object.values(this.apps))try{this.Wf(()=>{var s;return(s=i.processEvent)===null||s===void 0?void 0:s.call(i,t)})}catch(s){qe.error(`Error while processing event ${e.event} for site app ${i.id}`,s)}}onRemoteConfig(e){var t,i,s;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.Vf(),void this._instance.on("eventCaptured",a=>this.Gf(a))):void qe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.jf)===null||i===void 0||i.call(this),!e.ok)return;let n=e.config;if(!((s=n.siteApps)===null||s===void 0)&&s.length)if(this.isEnabled)for(let{id:a,url:l}of n.siteApps){var r,o;F[`__$$ph_site_app_${a}`]=this._instance,(r=F.__PosthogExtensions__)===null||r===void 0||(o=r.loadSiteApp)===null||o===void 0||o.call(r,this._instance,l,c=>{if(c)return qe.error(ma+a,c)})}else qe.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Zf={tracingHeaders:class{constructor(e){this._instance=e,this.Qf=void 0,this.Zf=void 0,this.Jf=void 0,this.hf=()=>{let t=this.Kf();var i,s;t?(x(this.Qf)&&(this.Qf=(i=F.__PosthogExtensions__)===null||i===void 0||(i=i.tracingHeadersPatchFns)===null||i===void 0?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),x(this.Zf)&&(this.Zf=(s=F.__PosthogExtensions__)===null||s===void 0||(s=s.tracingHeadersPatchFns)===null||s===void 0?void 0:s._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.mf()}}initialize(){this.startIfEnabledOrStop()}zo(e){var t,i,s;!((t=F.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(i=F.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"tracing-headers",n=>{if(n)return gf.error("failed to load script",n);e()})}Xf(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Kf(){let e=this.Xf();return O(e)?(O(this.Jf)?this.Jf.splice(0,this.Jf.length,...e):this.Jf=[...e],e.length>0?this.Jf:void 0):(O(this.Jf)&&this.Jf.splice(0),this.Jf=e||void 0,this.Jf)}mf(){var e,t;(e=this.Qf)===null||e===void 0||e.call(this),(t=this.Zf)===null||t===void 0||t.call(this),this.Qf=void 0,this.Zf=void 0}startIfEnabledOrStop(){this.Kf()?this.zo(this.hf):this.mf()}}},Yf=f({surveys:class extends xf{constructor(e){var t;super(new Pf(e),(t=e,{get projectToken(){return t.config.token},kv:new $f(t)})),this._instance=e}Gc(e,t){let i=t.query?Ni(e,t.query):e;return new Promise(s=>{var n;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((n=t.target)!==null&&n!==void 0?n:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:s})})}}},Is),Xf={toolbar:class{constructor(e){this.instance=e}Yf(e){F.ph_toolbar_state=e}tp(){var e;return(e=F.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,i=void 0){var s,n;if(Un(this.instance.config)||!b||!E)return!1;e=(s=e)!==null&&s!==void 0?s:b.location,i=(n=i)!==null&&n!==void 0?n:b.history;try{if(!t){try{b.localStorage.setItem("test","test"),b.localStorage.removeItem("test")}catch{return!1}t=b==null?void 0:b.localStorage}let r=Mf||bs(e.hash,"__posthog")||bs(e.hash,"state"),o,a=r?co(()=>JSON.parse(atob(decodeURIComponent(r))))||co(()=>JSON.parse(decodeURIComponent(r))):null;return a&&a.action==="ph_authorize"?(o=a,o.source="url",o&&Object.keys(o).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):(o=JSON.parse(t.getItem(ba)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}ep(e){let t=F.ph_load_toolbar||F.ph_load_editor;!L(t)&&le(t)?t(e,this.instance):wa.warn("No toolbar load function found")}loadToolbar(e){let t=!!(E!=null&&E.getElementById("__POSTHOG_TOOLBAR__"));if(!b||t)return!1;let i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=f(f({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(b.localStorage.setItem(ba,JSON.stringify(f(f({},s),{},{source:void 0}))),this.tp()===2)this.ep(s);else if(this.tp()===0){var n,r;this.Yf(1),(n=F.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this.instance,"toolbar",o=>{if(o)return wa.error("[Toolbar] Failed to load",o),void this.Yf(0);this.Yf(2),this.ep(s)}),G(b,"turbolinks:load",()=>{this.Yf(0),this.loadToolbar(s)})}return!0}np(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},Jf=f({experiments:class we{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(i=!1)=>{this.getWebExperiments(s=>{we.sp("retrieved web experiments from the server"),this.rp=new Map,s.forEach(n=>{if(n.feature_flag_key){var r;this.rp&&(we.sp("setting flag key ",n.feature_flag_key," to web experiment ",n),(r=this.rp)===null||r===void 0||r.set(n.feature_flag_key,n));let o=this._instance.getFeatureFlag(n.feature_flag_key);V(o)&&n.variants[o]&&this.op(n.name,o,n.variants[o].transforms)}else if(n.variants)for(let o in n.variants){let a=n.variants[o];we.ap(a,this._instance)&&this.op(n.name,o,a.transforms)}})},i)},this._instance.onFeatureFlags(i=>{this.onFeatureFlags(i)})}initialize(){}onFeatureFlags(t){if(this._is_bot())we.sp(Ta);else if(!this.Mr.disable_web_experiments){if(L(this.rp))return this.rp=new Map,this.loadIfEnabled(),void this.previewWebExperiment();we.sp("applying feature flags",t),t.forEach(i=>{var s;if(this.rp&&(!((s=this.rp)===null||s===void 0)&&s.has(i))){var n;let r=this._instance.getFeatureFlag(i),o=(n=this.rp)===null||n===void 0?void 0:n.get(i);r&&(o!=null&&o.variants[r])&&this.op(o.name,r,o.variants[r].transforms)}})}}previewWebExperiment(){let t=we.getWindowLocation();if(t!=null&&t.search){let i=Kt(t==null?void 0:t.search,"__experiment_id"),s=Kt(t==null?void 0:t.search,"__experiment_variant");i&&s&&(we.sp(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(n=>{this.lp(parseInt(i),s,n)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,s){if(this.Mr.disable_web_experiments&&!s)return t([]);let n=this._instance.get_property("$web_experiments");if(n&&!i)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:r=>t(r.statusCode===200&&r.json&&r.json.experiments||[])})}lp(t,i,s){let n=s.filter(r=>r.id===t);n&&n.length>0&&(we.sp(`Previewing web experiment [${n[0].name}] with variant [${i}]`),this.op(n[0].name,i,n[0].variants[i].transforms))}static ap(t,i){return!L(t.conditions)&&we.up(t,i)&&we.cp(t)}static up(t,i){var s;if(L(t.conditions)||L((s=t.conditions)===null||s===void 0?void 0:s.url))return!0;let n=we.getWindowLocation();if(n){var r,o,a;let l=hc(i,n.href);return!(!((r=t.conditions)===null||r===void 0)&&r.url)||Rf[(o=(a=t.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,l)}return!1}static getWindowLocation(){return b==null?void 0:b.location}static cp(t){var i;if(L(t.conditions)||L((i=t.conditions)===null||i===void 0?void 0:i.utm))return!0;let s=$c();if(s.utm_source){var n,r,o,a,l,c,u,d;let h=!(!((n=t.conditions)===null||n===void 0||(n=n.utm)===null||n===void 0)&&n.utm_campaign)||((r=t.conditions)===null||r===void 0||(r=r.utm)===null||r===void 0?void 0:r.utm_campaign)==s.utm_campaign,p=!(!((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0)&&o.utm_source)||((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==s.utm_source,v=!(!((l=t.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0)&&l.utm_medium)||((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0?void 0:c.utm_medium)==s.utm_medium,_=!(!((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0)&&u.utm_term)||((d=t.conditions)===null||d===void 0||(d=d.utm)===null||d===void 0?void 0:d.utm_term)==s.utm_term;return h&&v&&_&&p}return!1}static sp(t,...i){T.info(`[WebExperiments] ${t}`,i)}op(t,i,s){this._is_bot()?we.sp(Ta):i!=="control"?s.forEach(n=>{if(n.selector){var r;we.sp(`applying transform of variant ${i} for experiment ${t} `,n);let o=(r=document)===null||r===void 0?void 0:r.querySelectorAll(n.selector);o==null||o.forEach(a=>{let l=a;n.html&&(l.innerHTML=n.html),n.css&&l.setAttribute("style",n.css)})}}):we.sp("Control variants leave the page unmodified.")}_is_bot(){return pe&&this._instance?Xc(pe,this.Mr.custom_blocked_useragents):void 0}}},Is),Kf={conversations:class{constructor(e){this._instance=e,this.hp=void 0,this._conversationsManager=null,this.dp=!1,this.ne=null,this.vp=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.fp=e.ok,!e.ok))return;let t=e.config.conversations;L(t)||(Se(t)?this.hp=t:(this.hp=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.hp=void 0,this.ne=null,this.fp=void 0,this.vp=!1}loadIfEnabled(){if(this._conversationsManager||this.dp||this._instance.config.disable_conversations||Un(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;let e=F==null?void 0:F.__PosthogExtensions__;if(e&&!x(this.hp)&&this.hp)if(this.ne&&this.ne.token){this.dp=!0;try{let t=e.initConversations;if(t)return this.pp(t),void(this.dp=!1);let i=e.loadExternalDependency;if(!i)return void this.gp(gr);i(this._instance,"conversations",s=>{s||!e.initConversations?this.gp("Could not load conversations script",s):this.pp(e.initConversations),this.dp=!1})}catch(t){this.gp("Error initializing conversations",t),this.dp=!1}}else Le.error("Conversations enabled but missing token in remote config.")}pp(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.vp=!1,Le.info("Conversations loaded successfully")}catch(t){this.gp("Error completing conversations initialization",t)}else Le.error("Cannot complete initialization: remote config is null")}gp(e,t){Le.error(e,t),this._conversationsManager=null,this.dp=!1,this.vp=!0}show(){this._conversationsManager?this._conversationsManager.show():Le.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.hp===!0&&!ne(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Un(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.fp===!1?"remote_config_failed":x(this.hp)?this.fp?"disabled_in_project":"remote_config_pending":this.hp?L(this.ne)||!this.ne.token?"missing_token":F!=null&&F.__PosthogExtensions__?this.dp?"initializing":this.vp?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,i){var s=this;return ee(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(Le.warn($t),null)})()}getMessages(e,t){var i=this;return ee(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(Le.warn($t),null)})()}markAsRead(e){var t=this;return ee(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Le.warn($t),null)})()}getTickets(e){var t=this;return ee(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Le.warn($t),null)})()}requestRestoreLink(e){var t=this;return ee(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Le.warn($t),null)})()}restoreFromToken(e){var t=this;return ee(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Le.warn($t),null)})()}restoreFromUrlToken(){var e=this;return ee(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Le.warn($t),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}xc(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}$c(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},Qf={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.mp=!1,this.yp=!1,this.bp=!1,this.A=re("[logs]"),this._p=f(f({},this.A),{},{error:(...i)=>{i.some(Fa)||this.A.error(...i)}}),this.ol=[],this.wp=[],this.kd=0,this.To=!1,this.kp=[],this.Sp=[],this.xp=!1,this.$p=!1,this.Cp=()=>{var i,s;this.To||(this.kd=0,(i=this.Tp)===null||i===void 0||i.onReconnect(),(s=this.Ip)===null||s===void 0||s.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this.mp=!0),b&&G(b,"online",this.Cp)}Mp(e,t,i,s){var n;let r=Ia((n=this._instance)===null||n===void 0||(n=n.config)===null||n===void 0?void 0:n.logs,i);return[new Ih(this.Ep(e,t),r,this._p,()=>this.Pp(),o=>o(),void 0,s),r]}Rp(){var e;let t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var i;return this.Tp&&this.Ap===t||((i=this.Tp)===null||i===void 0||i.reset(),this.Ap=t,[this.Tp,this.Fp]=this.Mp(()=>this.ol,s=>{this.ol=s})),this.Tp}Op(){var e;let t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var i;return this.Ip&&this.Dp===t||((i=this.Ip)===null||i===void 0||i.reset(),this.Dp=t,[this.Ip,this.Lp]=this.Mp(()=>this.wp,s=>{this.wp=s},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Ca)),this.Ip}setup(e){var t;if(this.To)return;this.bo=e,!((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0||(t=t.logs)===null||t===void 0)&&t.captureConsoleLogs&&(this.mp=!0),(this.mp||this.Np()&&this.qp())&&this.jp();let i=!1,s=e.onRemoteConfig(n=>{var r;i=n.ok&&((r=n.config.logs)===null||r===void 0?void 0:r.captureConsoleLogs)===!0,this.onRemoteConfig(n)});this.To?s.dispose():(this.Eo=s,i||this.loadIfEnabled())}dispose(){var e,t,i,s;this.To||(this.To=!0,this.Bp(),(e=this.Eo)===null||e===void 0||e.dispose(),this.Eo=void 0,this.bo=void 0,this.bp=!1,b==null||b.removeEventListener("online",this.Cp),(t=this.zp)===null||t===void 0||t.call(this),this.zp=void 0,(i=this.Tp)===null||i===void 0||i.reset(),(s=this.Ip)===null||s===void 0||s.reset())}onRemoteConfig(e){var t,i;if(this.To)return;let s=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;L(s)?this.Hp():((i=this._instance)===null||i===void 0||(i=i.persistence)===null||i===void 0||i.register({$logs_capture_enabled_server_side:!!s}),s?(this.mp=!0,this.yp||this.jp(),this.loadIfEnabled()):this.Hp())}reset(){var e,t,i,s;this.Bp(),(e=this.Tp)===null||e===void 0||e.clearQueue(),this.ol=[],(t=this.Tp)===null||t===void 0||t.reset(),(i=this.Ip)===null||i===void 0||i.clearQueue(),this.wp=[],(s=this.Ip)===null||s===void 0||s.reset(),this.kd=0}captureLog(e){this.To||this.Rp().captureLog(e)}captureConsoleLog(e){this.To||this.Op().captureLog(e)}captureBufferedConsoleLog(e,t,i){this.To||this.Op().captureLog(e,{context:t,occurredAtMs:i})}qp(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[Wl])}Np(){var e,t,i;return!(!((e=this._instance)===null||e===void 0||(t=e.il)===null||t===void 0)&&t.call(e))||!!(!((i=F._POSTHOG_REMOTE_CONFIG)===null||i===void 0||(i=i[this._instance.config.token])===null||i===void 0)&&i.config)}Tc(){var e;this.Bp(),(e=this.Ip)===null||e===void 0||e.clearQueue(),this.wp=[]}Hp(){this.mp||this.Bp()}jp(){var e;if(this.xp||!(F!=null&&F.console))return;let t=Ia((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize,i=!0;this.Sp.push(()=>{i=!1});for(let s of Lf){let n;try{n=Df(F.console[s])}catch{continue}n&&this.Sp.push(ti(F.console,s,r=>{let o=(...a)=>{try{i&&this.Up(s,a,t)}catch{}return r.apply(F.console,a)};return o.__rrweb_original__=n,o}))}this.xp=!0,this.Wp=setTimeout(()=>{this.Bp()},3e4)}Up(e,t,i){var s;if(this.xp&&!this.$p&&t.length!==0)if(!((s=this._instance)===null||s===void 0)&&s.is_capturing()){if(i>this.kp.length){this.$p=!0;try{this.kp.push({level:e,args:t,occurredAtMs:Date.now(),context:this.Pp()})}finally{this.$p=!1}}}else this.Bp()}Bp(){if(this.kp=[],this.xp){this.xp=!1,this.Wp&&(clearTimeout(this.Wp),this.Wp=void 0);for(let e of this.Sp)e();this.Sp=[]}}Vp(){let e=this.kp;return this.Bp(),e}get logger(){return this.Gp||(this.Gp={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Gp}flushLogs(e){e?this.Qp(e):(this.Tp&&this.Tp.flush().catch(t=>this.Zp(t)),this.Ip&&this.Ip.flush().catch(t=>this.Zp(t)))}Zp(e){Fa(e)||this.A.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.To||!this.mp||this.yp||this.bp)return;let e=F==null?void 0:F.__PosthogExtensions__;if(!e)return this.A.error("PostHog Extensions not found."),void this.Bp();let t=e.loadExternalDependency;if(!t)return this.A.error(gr),void this.Bp();this.bp=!0;try{t(this._instance,"logs",i=>{if(this.bp=!1,this.To||!this.mp)return;let s=e.logs;if(i||!(s!=null&&s.initializeLogs))this.A.error("Could not load logs script",i),this.Bp();else{var n;let a=this.Vp();var r,o;this.zp=s.initializeLogs((n=this.bo)!==null&&n!==void 0?n:this._instance),this.yp=!0,a.length>0&&((r=s.replayConsoleBuffer)===null||r===void 0||r.call(s,(o=this.bo)!==null&&o!==void 0?o:this._instance,a))}})}catch(i){throw this.bp=!1,i}}Ep(e,t){let i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:s=>s===Ye.LogsQueue?e():void 0,setPersistedProperty(s,n){var r;s===Ye.LogsQueue&&t((r=n)!==null&&r!==void 0?r:[])},js:s=>this.js(s),getLibraryId:()=>ue.LIB_NAME,getLibraryVersion:()=>ue.LIB_VERSION}}js(e){return new Promise(t=>{if(Sc(this.kd,3))return void t({kind:"fatal",error:Sn(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1,s=r=>{i||(i=!0,clearTimeout(n),t(r))},n=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:Sn(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Jp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:r=>{let o=r.statusCode;if(this.Kp(o),o>=200&&300>o)s({kind:"ok"});else if(o===413)s({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)s({kind:"fatal",error:new Error(`logs request failed with status ${o}`)});else{var a;o===0?(r.error||this.A.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:Sn(r.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:(a=r.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${o}`)})}}})})}Kp(e){(e!==0||this._instance.__loaded)&&(this.kd=Ec(e,this.kd,3,()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Qp(e){this.ol.length>0&&this.Xp(e,this.ol,this.Fp,ue.LIB_NAME,t=>{this.ol=t}),this.wp.length>0&&this.Xp(e,this.wp,this.Lp,Ca,t=>{this.wp=t})}Xp(e,t,i,s,n){if(t.length===0)return;let r=t.map(a=>a.record);n([]);let o=Rl(r,Ol(i,ue.LIB_NAME,ue.LIB_VERSION),s,ue.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Jp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}Jp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Pp(){var e;let t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){let{sessionId:i,windowId:s,sessionStartTimestamp:n,lastActivityTimestamp:r}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i,t.windowId=s,L(n)||(t.sessionStartTimestamp=n),L(r)||(t.lastActivityTimestamp=r)}if(!(F==null||(e=F.location)===null||e===void 0)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?yt(F.location.href):F.location.href),this._instance.featureFlags){let i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}},ev={metrics:class{constructor(e){this._instance=e,this.A=re("[metrics]"),this.To=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.To)return;let t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.Yp?this.Yp=(i=>{let s=!0,n=()=>s?(a=>{var l;let c=(l=a.config.metrics)===null||l===void 0?void 0:l.network;return c===!0?{}:c||void 0})(i):void 0,r=Vf(i,n),o=Hf(i,n);return()=>{s=!1,r(),o()}})(this._instance):!t&&this.Yp&&(this.Yp(),this.Yp=void 0)}Rp(){var e;let t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var i;return this.Tp&&this.Ap===t||((i=this.Tp)===null||i===void 0||i.reset(),this.Ap=t,this.Tp=new Ch(this.Ep(),(function(s){var n,r,o,a,l;let c=s==null?void 0:s.resourceAttributes;return{serviceName:(n=c==null?void 0:c["service.name"])!==null&&n!==void 0?n:s==null?void 0:s.serviceName,serviceVersion:(r=c==null?void 0:c["service.version"])!==null&&r!==void 0?r:s==null?void 0:s.serviceVersion,environment:(o=c==null?void 0:c["deployment.environment"])!==null&&o!==void 0?o:s==null?void 0:s.environment,resourceAttributes:c,beforeSend:s==null?void 0:s.beforeSend,flushIntervalMs:(a=s==null?void 0:s.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(l=s==null?void 0:s.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(t),this.A)),this.Tp}count(e,t=1,i){this.Rp().count(e,t,i)}gauge(e,t,i){this.Rp().gauge(e,t,i)}histogram(e,t,i){this.Rp().histogram(e,t,i)}flush(e){if(!this.Tp)return Promise.resolve();if(e){let t=this.Tp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.Tp.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.Tp)===null||e===void 0||e.reset()}dispose(){var e,t;this.To=!0,(e=this.Yp)===null||e===void 0||e.call(this),this.Yp=void 0,(t=this.Tp)===null||t===void 0||t.reset()}Ep(){let e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:i=>t.Ys(i),getLibraryId:()=>ue.LIB_NAME,getLibraryVersion:()=>ue.LIB_VERSION}}Ys(e,t){return new Promise(i=>{let s=!1,n=o=>{s||(s=!0,clearTimeout(r),i(o))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(f(f({method:"POST",url:this.tg(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(o){let a=o.statusCode;if(a>=200&&300>a)n({kind:"ok"});else if(a===413)n({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)n({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var l;n({kind:"retry-later",error:(l=o.error)!==null&&l!==void 0?l:new Error(`metrics request failed with status ${a}`)})}}}))})}tg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},tv={webMCP:class{constructor(e){this._instance=e,this.eg=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.eg)return;let e=E==null?void 0:E.modelContext;if(!e||!le(e.registerTool))return;let t=Aa.get(e);if(t)return t.instances.add(this._instance),void(this.eg=!0);let i={instances:new Set([this._instance])},s=e.registerTool,n=this;ti(e,"registerTool",r=>{let o=r;return function(a,...l){let c=a;try{c=n.ig(a,i)}catch{return o.call(this,a,...l)}return o.call(this,c,...l)}}),e.registerTool!==s&&(Aa.set(e,i),this.eg=!0)}ig(e,t){if(!e||!le(e.execute))return e;let i=e.execute,s=this,{tool:n,injected:r}=(function(o,a){let l={intent:!1,model:!1},c=o.inputSchema;if(c&&(ht(c,"$ref")||ht(c,"oneOf")||ht(c,"anyOf")||ht(c,"allOf")||c.additionalProperties===!0||j(c.additionalProperties)||c.type&&c.type!=="object"||c.properties&&!j(c.properties)||c.required&&!O(c.required))||!x(c)&&!j(c))return{tool:En(o),injected:l};let u=(c==null?void 0:c.properties)||{};if(l.intent=a.intent&&!ht(u,"context"),l.model=a.model&&!ht(u,"llm_model"),!l.intent&&!l.model)return{tool:En(o),injected:l};let d=f({},u),h=O(c==null?void 0:c.required)?[...c.required]:[];return l.intent&&(d.context={type:"string",description:`Explain why this tool is called and how it supports the user's goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".`},h.includes("context")||h.push("context")),l.model&&(d.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},h.includes("llm_model")||h.push("llm_model")),{tool:En(o,f(f({},c),{},{type:(c==null?void 0:c.type)||"object",properties:d,required:h})),injected:l}})(e,(function(o){let a={intent:!1,model:!1};for(let l of o.instances){let c=Oa(l.config.capture_webmcp);a.intent||(a.intent=(c==null?void 0:c.intent)===!0),a.model||(a.model=(c==null?void 0:c.model)===!0)}return a})(t));return Object.defineProperty(n,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){let a=new Date,l=(function(h,p){if(!j(h))return{};try{let v=p.intent?Ra(h.context,2048,!0):void 0,_=p.model?Ra(h.llm_model,256):void 0;return f(f({},v&&v!=="{}"?{intent:v}:{}),_&&_.toLowerCase()!=="unknown"?{model:_}:{})}catch{return{}}})(o[0],r),c=(function(h,p){let v=h[0];if(!j(v))return h;try{let _=p.intent&&ht(v,"context"),g=p.model&&ht(v,"llm_model");if(!_&&!g)return h;let y=f({},v);return _&&delete y.context,g&&delete y.llm_model,[y,...h.slice(1)]}catch{return h}})(o,r),u;try{u=i.apply(this===n?e:this,c)}catch(h){throw s.ng(t,n,a,!0,l),h}return(d=u)&&typeof d.then=="function"?Promise.resolve(u).then(h=>(s.ng(t,n,a,La(h),l),h),h=>{throw s.ng(t,n,a,!0,l),h}):(s.ng(t,n,a,La(u),l),u);var d}}),n}ng(e,t,i,s,n){let r=Date.now()-i.getTime();for(let o of e.instances){let a=Oa(o.config.capture_webmcp);if(a)try{o.capture("$mcp_tool_call",f(f({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:t.name,$mcp_resource_name:t.name,$mcp_tool_description:t.description,$mcp_server_name:K==null?void 0:K.hostname,$mcp_duration_ms:r,$mcp_is_error:s},a.intent&&n.intent?{$mcp_intent:n.intent,$mcp_intent_source:"context_parameter"}:{}),a.model&&n.model?{$mcp_llm_model:n.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:i})}catch{continue}}}}};Ti.__defaultExtensionClasses=f({},f(f(f(f(f(f(f(f(f(f(f(f(f(f({},Is),Bf),Uf),zf),Gf),qf),Yf),Zf),Xf),Jf),Kf),Qf),ev),tv));var iv=(function(){ue.SDK_DIST_CHANNEL="npm";let e=Pi[mi]=new Ti;return(function(){function t(){t.done||(t.done=!0,Zc=!1,Z(Pi,function(i){i._dom_loaded()}))}E!=null&&E.addEventListener?E.readyState==="complete"?t():G(E,"DOMContentLoaded",t,{capture:!1}):b&&T.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})(),Ae=iv;var wu="5.3.0";function sv(e,t){for(let i=0,s=e.length;i<s;++i)if(e[i]===t)return!0;return!1}function nv(e,t){return!sv(e,t)}function Fr(e){return parseInt(e)}function Ue(e){return parseFloat(e)}function rt(e,t){return typeof e=="number"&&isNaN(e)?t:e}function ve(e){return e.reduce((t,i)=>t+(i?1:0),0)}function xu(e,t=1){if(Math.abs(t)>=1)return Math.round(e/t)*t;{let i=1/t;return Math.round(e*i)/i}}function rv(e){var t,i;let s=`Unexpected syntax '${e}'`,n=/^\s*([a-z-]*)(.*)$/i.exec(e),r=n[1]||void 0,o={},a=/([.:#][\w-]+|\[.+?\])/gi,l=(c,u)=>{o[c]=o[c]||[],o[c].push(u)};for(;;){let c=a.exec(n[2]);if(!c)break;let u=c[0];switch(u[0]){case".":l("class",u.slice(1));break;case"#":l("id",u.slice(1));break;case"[":{let d=/^\[([\w-]+)([~|^$*]?=("(.*?)"|([\w-]+)))?(\s+[is])?\]$/.exec(u);if(d)l(d[1],(i=(t=d[4])!==null&&t!==void 0?t:d[5])!==null&&i!==void 0?i:"");else throw new Error(s);break}default:throw new Error(s)}}return[r,o]}function ov(e){let t=new Uint8Array(e.length);for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);if(s>127)return new TextEncoder().encode(e);t[i]=s}return t}function av(e){var t;return{name:e.name,message:e.message,stack:(t=e.stack)===null||t===void 0?void 0:t.split(`
|
|
4
|
+
`),...e}}function lv(e){return/^function\s.*?\{\s*\[native code]\s*}$/.test(String(e))}function ku(){let e=window,t=navigator;return ve(["MSCSSMatrix"in e,"msSetImmediate"in e,"msIndexedDB"in e,"msMaxTouchPoints"in t,"msPointerEnabled"in t])>=4}function cv(){let e=window,t=navigator;return ve(["msWriteProfilerMark"in e,"MSStream"in e,"msLaunchUri"in t,"msSaveBlob"in t])>=3&&!ku()}function oi(){let e=window,t=navigator;return ve(["webkitPersistentStorage"in t,"webkitTemporaryStorage"in t,(t.vendor||"").indexOf("Google")===0,"webkitResolveLocalFileSystemURL"in e,"BatteryManager"in e,"webkitMediaStream"in e,"webkitSpeechGrammar"in e])>=5}function ze(){let e=window,t=navigator;return ve(["ApplePayError"in e,"CSSPrimitiveValue"in e,"Counter"in e,t.vendor.indexOf("Apple")===0,"RGBColor"in e,"WebKitMediaKeys"in e])>=4}function Ar(){let e=window,{HTMLElement:t,Document:i}=e;return ve(["safari"in e,!("ongestureend"in e),!("TouchEvent"in e),!("orientation"in e),t&&!("autocapitalize"in t.prototype),i&&"pointerLockElement"in i.prototype])>=4}function Vi(){let e=window;return lv(e.print)&&String(e.browser)==="[object WebPageNamespace]"}function Hi(){var e,t;let i=window;return ve(["buildID"in navigator,"MozAppearance"in((t=(e=document.documentElement)===null||e===void 0?void 0:e.style)!==null&&t!==void 0?t:{}),"onmozfullscreenchange"in i,"mozInnerScreenX"in i,"CSSMozDocumentRule"in i,"CanvasCaptureMediaStream"in i])>=4}function uv(){let e=window,t=navigator,{CSS:i}=e;return ve(["userActivation"in t,i.supports("color","light-dark(#000, #fff)"),i.supports("height","1lh"),"globalPrivacyControl"in t])>=3}function Su(){let{CSS:e}=window;return ve([e.supports("selector(::details-content)"),e.supports("selector(::before::marker)"),e.supports("selector(::after::marker)"),!("locale"in CompositionEvent.prototype)])>=3}function dv(){let e=window;return ve([!("MediaSettingsRange"in e),"RTCEncodedAudioFrame"in e,`${e.Intl}`=="[object Intl]",`${e.Reflect}`=="[object Reflect]"])>=3}function hv(){let e=window,{URLPattern:t}=e;return ve(["union"in Set.prototype,"Iterator"in e,t&&"hasRegExpGroups"in t.prototype,"RGB8"in WebGLRenderingContext.prototype])>=3}function pv(){let e=window,t=document,{CSS:i,Promise:s,AudioContext:n}=e;return ve([s&&"try"in s,"caretPositionFromPoint"in t,n&&"onerror"in n.prototype,i.supports("ruby-align","space-around")])>=3}function fv(){let e=window;return ve(["DOMRectList"in e,"RTCPeerConnectionIceEvent"in e,"SVGGeometryElement"in e,"ontransitioncancel"in e])>=3}function Wi(){let e=window,t=navigator,{CSS:i,HTMLButtonElement:s}=e;return ve([!("getStorageUpdates"in t),s&&"popover"in s.prototype,"CSSCounterStyleRule"in e,i.supports("font-size-adjust: ex-height 0.5"),i.supports("text-transform: full-width")])>=4}function vv(){if(navigator.platform==="iPad")return!0;let e=screen,t=e.width/e.height;return ve(["MediaSource"in window,!!Element.prototype.webkitRequestFullscreen,t>.65&&t<1.53])>=2}function gv(){let e=document;return e.fullscreenElement||e.msFullscreenElement||e.mozFullScreenElement||e.webkitFullscreenElement||null}function _v(){let e=document;return(e.exitFullscreen||e.msExitFullscreen||e.mozCancelFullScreen||e.webkitExitFullscreen).call(e)}function Rs(){var e,t;let i=oi(),s=Hi(),n=window,r=navigator;return i?ve([yv(),"HTMLInputElement"in n&&"capture"in HTMLInputElement.prototype,"NetworkInformation"in n&&"ontypechange"in((t=(e=n.NetworkInformation)===null||e===void 0?void 0:e.prototype)!==null&&t!==void 0?t:{}),!("sinkId"in new Audio)])>=2:s?ve(["onorientationchange"in n,"orientation"in n,/android/i.test(r.appVersion)])>=2:!1}function mv(){let e=navigator,t=window,i=Audio.prototype,{visualViewport:s}=t;return ve(["srLatency"in i,"srChannelCount"in i,"devicePosture"in e,s&&"segments"in s,"getTextInformation"in Image.prototype])>=3}function yv(){var e,t;try{return!!(!((t=(e=window.Intl)===null||e===void 0?void 0:e.supportedValuesOf)===null||t===void 0)&&t.call(e,"collation").includes("dict"))}catch{return!1}}var bv="$ if upgrade to Pro: https://fingerprint.com/github/?utm_source=oss&utm_medium=referral&utm_campaign=confidence_score";function wv(e){let t=xv(e),i=kv(t);return{score:t,comment:bv.replace(/\$/g,`${i}`)}}function xv(e){if(Rs())return .4;if(ze())return Ar()&&!(Wi()&&Vi())?.5:.3;let t="value"in e.platform?e.platform.value:"";return/^Win/.test(t)?.6:/^Mac/.test(t)?.5:.7}function kv(e){return xu(.99+.01*e,1e-4)}function Os(e,t){return new Promise(i=>setTimeout(i,e,t))}function Sv(){return new Promise(e=>{let t=new MessageChannel;t.port1.onmessage=()=>e(),t.port2.postMessage(null)})}function Ev(e,t=1/0){let{requestIdleCallback:i}=window;return i?new Promise(s=>i.call(window,()=>s(),{timeout:t})):Os(Math.min(e,t))}function Eu(e){return!!e&&typeof e.then=="function"}function lu(e,t){try{let i=e();Eu(i)?i.then(s=>t(!0,s),s=>t(!1,s)):t(!0,i)}catch(i){t(!1,i)}}async function cu(e,t,i=16){let s=Array(e.length),n=Date.now();for(let r=0;r<e.length;++r){s[r]=t(e[r],r);let o=Date.now();o>=n+i&&(n=o,await Sv())}return s}function ji(e){return e.then(void 0,()=>{}),e}function $v(e){return typeof e!="function"}function Pv(e,t){let i=ji(new Promise(s=>{let n=Date.now();lu(e.bind(null,t),(...r)=>{let o=Date.now()-n;if(!r[0])return s(()=>({error:r[1],duration:o}));let a=r[1];if($v(a))return s(()=>({value:a,duration:o}));s(()=>new Promise(l=>{let c=Date.now();lu(a,(...u)=>{let d=o+Date.now()-c;if(!u[0])return l({error:u[1],duration:d});l({value:u[1],duration:d})})}))})}));return function(){return i.then(n=>n())}}function Mv(e,t,i,s){let n=Object.keys(e).filter(o=>nv(i,o)),r=ji(cu(n,o=>Pv(e[o],t),s));return async function(){let a=await r,l=await cu(a,d=>ji(d()),s),c=await Promise.all(l),u={};for(let d=0;d<n.length;++d)u[n[d]]=c[d];return u}}async function $u(e,t,i=50){var s,n,r;let o=document;for(;!o.body;)await Os(i);let a=o.createElement("iframe");try{for(await new Promise((l,c)=>{let u=!1,d=()=>{u=!0,l()},h=_=>{u=!0,c(_)};a.onload=d,a.onerror=h;let{style:p}=a;p.setProperty("display","block","important"),p.position="absolute",p.top="0",p.left="0",p.visibility="hidden",t&&"srcdoc"in a?a.srcdoc=t:a.src="about:blank",o.body.appendChild(a);let v=()=>{var _,g;u||(((g=(_=a.contentWindow)===null||_===void 0?void 0:_.document)===null||g===void 0?void 0:g.readyState)==="complete"?d():setTimeout(v,10))};v()});!(!((n=(s=a.contentWindow)===null||s===void 0?void 0:s.document)===null||n===void 0)&&n.body);)await Os(i);return await e(a,a.contentWindow)}finally{(r=a.parentNode)===null||r===void 0||r.removeChild(a)}}function Tv(e){let[t,i]=rv(e),s=document.createElement(t!=null?t:"div");for(let n of Object.keys(i)){let r=i[n].join(" ");n==="style"?Iv(s.style,r):s.setAttribute(n,r)}return s}function Iv(e,t){for(let i of t.split(";")){let s=/^\s*([\w-]+)\s*:\s*(.+?)(\s*!([\w-]+))?\s*$/.exec(i);if(s){let[,n,r,,o]=s;e.setProperty(n,r,o||"")}}}function Cv(){let e=window;for(;;){let t=e.parent;if(!t||t===e)return!1;try{if(t.location.origin!==e.location.origin)return!0}catch(i){if(i instanceof Error&&i.name==="SecurityError")return!0;throw i}e=t}}function Fv(){let{ApplePaySession:e}=window;if(typeof(e==null?void 0:e.canMakePayments)!="function")return-1;if(Av())return-3;try{return e.canMakePayments()?1:0}catch(t){return Ov(t)}}var Av=Cv;function Ov(e){if(e instanceof Error&&e.name==="InvalidAccessError"&&/\bfrom\b.*\binsecure\b/i.test(e.message))return-2;throw e}function Rv(){let e=new Float32Array(1),t=new Uint8Array(e.buffer);return e[0]=1/0,e[0]=e[0]-e[0],t[3]}function Lv(){return jv()?-4:Dv()}function Dv(){let e=window,t=e.OfflineAudioContext||e.webkitOfflineAudioContext;if(!t)return-2;if(Nv())return-1;let i=4500,s=5e3,n=new t(1,s,44100),r=n.createOscillator();r.type="triangle",r.frequency.value=1e4;let o=n.createDynamicsCompressor();o.threshold.value=-50,o.knee.value=40,o.ratio.value=12,o.attack.value=0,o.release.value=.25,r.connect(o),o.connect(n.destination),r.start(0);let[a,l]=Vv(n),c=ji(a.then(u=>Hv(u.getChannelData(0).subarray(i)),u=>{if(u.name==="timeout"||u.name==="suspended")return-3;throw u}));return()=>(l(),c)}function Nv(){return ze()&&!Ar()&&!fv()}function jv(){return ze()&&Wi()&&Vi()||oi()&&mv()&&hv()}function Vv(e){let r=()=>{};return[new Promise((a,l)=>{let c=!1,u=0,d=0;e.oncomplete=v=>a(v.renderedBuffer);let h=()=>{setTimeout(()=>l(uu("timeout")),Math.min(500,d+5e3-Date.now()))},p=()=>{try{let v=e.startRendering();switch(Eu(v)&&ji(v),e.state){case"running":d=Date.now(),c&&h();break;case"suspended":document.hidden||u++,c&&u>=3?l(uu("suspended")):setTimeout(p,500);break}}catch(v){l(v)}};p(),r=()=>{c||(c=!0,d>0&&h())}}),r]}function Hv(e){let t=0;for(let i=0;i<e.length;++i)t+=Math.abs(e[i]);return t}function uu(e){let t=new Error(e);return t.name=e,t}function Wv(){if(!(Rs()||ze()))return-2;if(!window.AudioContext)return-1;let t=new AudioContext().baseLatency;return t==null?-1:isFinite(t)?t:-3}function Bv(){return Uv(Jv())}function Uv(e){let t=!1,i,s,[n,r]=zv();return Gv(n,r)?(t=qv(r),e?i=s="skipped":[i,s]=Zv(n,r)):i=s="unsupported",{winding:t,geometry:i,text:s}}function zv(){let e=document.createElement("canvas");return e.width=1,e.height=1,[e,e.getContext("2d")]}function Gv(e,t){return!!(t&&e.toDataURL)}function qv(e){return e.rect(0,0,10,10),e.rect(2,2,6,6),!e.isPointInPath(5,5,"evenodd")}function Zv(e,t){Yv(e,t);let i=Pr(e),s=Pr(e);return i!==s?["unstable","unstable"]:(Xv(e,t),[Pr(e),i])}function Yv(e,t){e.width=240,e.height=60,t.textBaseline="alphabetic",t.fillStyle="#f60",t.fillRect(100,1,62,20),t.fillStyle="#069",t.font='11pt "Times New Roman"';let i="Cwm fjordbank gly \u{1F603}";t.fillText(i,2,15),t.fillStyle="rgba(102, 204, 0, 0.2)",t.font="18pt Arial",t.fillText(i,4,45)}function Xv(e,t){e.width=122,e.height=110,t.globalCompositeOperation="multiply";for(let[i,s,n]of[["#f2f",40,40],["#2ff",80,40],["#ff2",60,80]])t.fillStyle=i,t.beginPath(),t.arc(s,n,40,0,Math.PI*2,!0),t.closePath(),t.fill();t.fillStyle="#f9c",t.arc(60,60,60,0,Math.PI*2,!0),t.arc(60,60,20,0,Math.PI*2,!0),t.fill("evenodd")}function Pr(e){return e.toDataURL()}function Jv(){let e=ze()&&Wi()&&Vi(),t=Hi()&&uv();return e||t}function Kv(){return window.screen.colorDepth}function Qv(){for(let e of["rec2020","p3","srgb"])if(matchMedia(`(color-gamut: ${e})`).matches)return e}function eg(){if(si("no-preference"))return 0;if(si("high")||si("more"))return 1;if(si("low")||si("less"))return-1;if(si("forced"))return 10}function si(e){return matchMedia(`(prefers-contrast: ${e})`).matches}function tg(){let e=document;try{e.cookie="cookietest=1; SameSite=Strict;";let t=e.cookie.indexOf("cookietest=")!==-1;return e.cookie="cookietest=1; SameSite=Strict; expires=Thu, 01-Jan-1970 00:00:01 GMT",t}catch{return!1}}function ig(){return navigator.cpuClass}function sg(){if(!window.Intl)return-1;let e=window.Intl.DateTimeFormat;if(!e)return-2;let t=e().resolvedOptions().locale;return!t&&t!==""?-3:t}function ng(){return rt(Ue(navigator.deviceMemory),void 0)}function rg(){let e=atob;return{abpIndo:["#Iklan-Melayang","#Kolom-Iklan-728","#SidebarIklan-wrapper",'[title="ALIENBOLA" i]',e("I0JveC1CYW5uZXItYWRz")],abpvn:[".quangcao","#mobileCatfish",e("LmNsb3NlLWFkcw=="),'[id^="bn_bottom_fixed_"]',"#pmadv"],adBlockFinland:[".mainostila",e("LnNwb25zb3JpdA=="),".ylamainos",e("YVtocmVmKj0iL2NsaWNrdGhyZ2guYXNwPyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hcHAucmVhZHBlYWsuY29tL2FkcyJd")],adBlockPersian:["#navbar_notice_50",".kadr",'TABLE[width="140px"]',"#divAgahi",e("YVtocmVmXj0iaHR0cDovL2cxLnYuZndtcm0ubmV0L2FkLyJd")],adBlockWarningRemoval:["#adblock-honeypot",".adblocker-root",".wp_adblock_detect",e("LmhlYWRlci1ibG9ja2VkLWFk"),e("I2FkX2Jsb2NrZXI=")],adGuardAnnoyances:[".hs-sosyal","#cookieconsentdiv",'div[class^="app_gdpr"]',".as-oil",'[data-cypress="soft-push-notification-modal"]'],adGuardBase:[".BetterJsPopOverlay",e("I2FkXzMwMFgyNTA="),e("I2Jhbm5lcmZsb2F0MjI="),e("I2NhbXBhaWduLWJhbm5lcg=="),e("I0FkLUNvbnRlbnQ=")],adGuardChinese:[e("LlppX2FkX2FfSA=="),e("YVtocmVmKj0iLmh0aGJldDM0LmNvbSJd"),"#widget-quan",e("YVtocmVmKj0iLzg0OTkyMDIwLnh5eiJd"),e("YVtocmVmKj0iLjE5NTZobC5jb20vIl0=")],adGuardFrench:["#pavePub",e("LmFkLWRlc2t0b3AtcmVjdGFuZ2xl"),".mobile_adhesion",".widgetadv",e("LmFkc19iYW4=")],adGuardGerman:['aside[data-portal-id="leaderboard"]'],adGuardJapanese:["#kauli_yad_1",e("YVtocmVmXj0iaHR0cDovL2FkMi50cmFmZmljZ2F0ZS5uZXQvIl0="),e("Ll9wb3BJbl9pbmZpbml0ZV9hZA=="),e("LmFkZ29vZ2xl"),e("Ll9faXNib29zdFJldHVybkFk")],adGuardMobile:[e("YW1wLWF1dG8tYWRz"),e("LmFtcF9hZA=="),'amp-embed[type="24smi"]',"#mgid_iframe1",e("I2FkX2ludmlld19hcmVh")],adGuardRussian:[e("YVtocmVmXj0iaHR0cHM6Ly9hZC5sZXRtZWFkcy5jb20vIl0="),e("LnJlY2xhbWE="),'div[id^="smi2adblock"]',e("ZGl2W2lkXj0iQWRGb3hfYmFubmVyXyJd"),"#psyduckpockeball"],adGuardSocial:[e("YVtocmVmXj0iLy93d3cuc3R1bWJsZXVwb24uY29tL3N1Ym1pdD91cmw9Il0="),e("YVtocmVmXj0iLy90ZWxlZ3JhbS5tZS9zaGFyZS91cmw/Il0="),".etsy-tweet","#inlineShare",".popup-social"],adGuardSpanishPortuguese:["#barraPublicidade","#Publicidade","#publiEspecial","#queTooltip",".cnt-publi"],adGuardTrackingProtection:["#qoo-counter",e("YVtocmVmXj0iaHR0cDovL2NsaWNrLmhvdGxvZy5ydS8iXQ=="),e("YVtocmVmXj0iaHR0cDovL2hpdGNvdW50ZXIucnUvdG9wL3N0YXQucGhwIl0="),e("YVtocmVmXj0iaHR0cDovL3RvcC5tYWlsLnJ1L2p1bXAiXQ=="),"#top100counter"],adGuardTurkish:["#backkapat",e("I3Jla2xhbWk="),e("YVtocmVmXj0iaHR0cDovL2Fkc2Vydi5vbnRlay5jb20udHIvIl0="),e("YVtocmVmXj0iaHR0cDovL2l6bGVuemkuY29tL2NhbXBhaWduLyJd"),e("YVtocmVmXj0iaHR0cDovL3d3dy5pbnN0YWxsYWRzLm5ldC8iXQ==")],bulgarian:[e("dGQjZnJlZW5ldF90YWJsZV9hZHM="),"#ea_intext_div",".lapni-pop-over","#xenium_hot_offers"],easyList:[".yb-floorad",e("LndpZGdldF9wb19hZHNfd2lkZ2V0"),e("LnRyYWZmaWNqdW5reS1hZA=="),".textad_headline",e("LnNwb25zb3JlZC10ZXh0LWxpbmtz")],easyListChina:[e("LmFwcGd1aWRlLXdyYXBbb25jbGljayo9ImJjZWJvcy5jb20iXQ=="),e("LmZyb250cGFnZUFkdk0="),"#taotaole","#aafoot.top_box",".cfa_popup"],easyListCookie:[".ezmob-footer",".cc-CookieWarning","[data-cookie-number]",e("LmF3LWNvb2tpZS1iYW5uZXI="),".sygnal24-gdpr-modal-wrap"],easyListCzechSlovak:["#onlajny-stickers",e("I3Jla2xhbW5pLWJveA=="),e("LnJla2xhbWEtbWVnYWJvYXJk"),".sklik",e("W2lkXj0ic2tsaWtSZWtsYW1hIl0=")],easyListDutch:[e("I2FkdmVydGVudGll"),e("I3ZpcEFkbWFya3RCYW5uZXJCbG9jaw=="),".adstekst",e("YVtocmVmXj0iaHR0cHM6Ly94bHR1YmUubmwvY2xpY2svIl0="),"#semilo-lrectangle"],easyListGermany:["#SSpotIMPopSlider",e("LnNwb25zb3JsaW5rZ3J1ZW4="),e("I3dlcmJ1bmdza3k="),e("I3Jla2xhbWUtcmVjaHRzLW1pdHRl"),e("YVtocmVmXj0iaHR0cHM6Ly9iZDc0Mi5jb20vIl0=")],easyListItaly:[e("LmJveF9hZHZfYW5udW5jaQ=="),".sb-box-pubbliredazionale",e("YVtocmVmXj0iaHR0cDovL2FmZmlsaWF6aW9uaWFkcy5zbmFpLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZHNlcnZlci5odG1sLml0LyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9hZmZpbGlhemlvbmlhZHMuc25haS5pdC8iXQ==")],easyListLithuania:[e("LnJla2xhbW9zX3RhcnBhcw=="),e("LnJla2xhbW9zX251b3JvZG9z"),e("aW1nW2FsdD0iUmVrbGFtaW5pcyBza3lkZWxpcyJd"),e("aW1nW2FsdD0iRGVkaWt1b3RpLmx0IHNlcnZlcmlhaSJd"),e("aW1nW2FsdD0iSG9zdGluZ2FzIFNlcnZlcmlhaS5sdCJd")],estonian:[e("QVtocmVmKj0iaHR0cDovL3BheTRyZXN1bHRzMjQuZXUiXQ==")],fanboyAnnoyances:["#ac-lre-player",".navigate-to-top","#subscribe_popup",".newsletter_holder","#back-top"],fanboyAntiFacebook:[".util-bar-module-firefly-visible"],fanboyEnhancedTrackers:[".open.pushModal","#issuem-leaky-paywall-articles-zero-remaining-nag","#sovrn_container",'div[class$="-hide"][zoompage-fontsize][style="display: block;"]',".BlockNag__Card"],fanboySocial:["#FollowUs","#meteored_share","#social_follow",".article-sharer",".community__social-desc"],frellwitSwedish:[e("YVtocmVmKj0iY2FzaW5vcHJvLnNlIl1bdGFyZ2V0PSJfYmxhbmsiXQ=="),e("YVtocmVmKj0iZG9rdG9yLXNlLm9uZWxpbmsubWUiXQ=="),"article.category-samarbete",e("ZGl2LmhvbGlkQWRz"),"ul.adsmodern"],greekAdBlock:[e("QVtocmVmKj0iYWRtYW4ub3RlbmV0LmdyL2NsaWNrPyJd"),e("QVtocmVmKj0iaHR0cDovL2F4aWFiYW5uZXJzLmV4b2R1cy5nci8iXQ=="),e("QVtocmVmKj0iaHR0cDovL2ludGVyYWN0aXZlLmZvcnRobmV0LmdyL2NsaWNrPyJd"),"DIV.agores300","TABLE.advright"],hungarian:["#cemp_doboz",".optimonk-iframe-container",e("LmFkX19tYWlu"),e("W2NsYXNzKj0iR29vZ2xlQWRzIl0="),"#hirdetesek_box"],iDontCareAboutCookies:['.alert-info[data-block-track*="CookieNotice"]',".ModuleTemplateCookieIndicator",".o--cookies--container","#cookies-policy-sticky","#stickyCookieBar"],icelandicAbp:[e("QVtocmVmXj0iL2ZyYW1ld29yay9yZXNvdXJjZXMvZm9ybXMvYWRzLmFzcHgiXQ==")],latvian:[e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiAxMjBweDsgaGVpZ2h0OiA0MHB4OyBvdmVyZmxvdzogaGlkZGVuOyBwb3NpdGlvbjogcmVsYXRpdmU7Il0="),e("YVtocmVmPSJodHRwOi8vd3d3LnNhbGlkemluaS5sdi8iXVtzdHlsZT0iZGlzcGxheTogYmxvY2s7IHdpZHRoOiA4OHB4OyBoZWlnaHQ6IDMxcHg7IG92ZXJmbG93OiBoaWRkZW47IHBvc2l0aW9uOiByZWxhdGl2ZTsiXQ==")],listKr:[e("YVtocmVmKj0iLy9hZC5wbGFuYnBsdXMuY28ua3IvIl0="),e("I2xpdmVyZUFkV3JhcHBlcg=="),e("YVtocmVmKj0iLy9hZHYuaW1hZHJlcC5jby5rci8iXQ=="),e("aW5zLmZhc3R2aWV3LWFk"),".revenue_unit_item.dable"],listeAr:[e("LmdlbWluaUxCMUFk"),".right-and-left-sponsers",e("YVtocmVmKj0iLmFmbGFtLmluZm8iXQ=="),e("YVtocmVmKj0iYm9vcmFxLm9yZyJd"),e("YVtocmVmKj0iZHViaXp6bGUuY29tL2FyLz91dG1fc291cmNlPSJd")],listeFr:[e("YVtocmVmXj0iaHR0cDovL3Byb21vLnZhZG9yLmNvbS8iXQ=="),e("I2FkY29udGFpbmVyX3JlY2hlcmNoZQ=="),e("YVtocmVmKj0id2Vib3JhbWEuZnIvZmNnaS1iaW4vIl0="),".site-pub-interstitiel",'div[id^="crt-"][data-criteo-id]'],officialPolish:["#ceneo-placeholder-ceneo-12",e("W2hyZWZePSJodHRwczovL2FmZi5zZW5kaHViLnBsLyJd"),e("YVtocmVmXj0iaHR0cDovL2Fkdm1hbmFnZXIudGVjaGZ1bi5wbC9yZWRpcmVjdC8iXQ=="),e("YVtocmVmXj0iaHR0cDovL3d3dy50cml6ZXIucGwvP3V0bV9zb3VyY2UiXQ=="),e("ZGl2I3NrYXBpZWNfYWQ=")],ro:[e("YVtocmVmXj0iLy9hZmZ0cmsuYWx0ZXgucm8vQ291bnRlci9DbGljayJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ibGFja2ZyaWRheXNhbGVzLnJvL3Ryay9zaG9wLyJd"),e("YVtocmVmXj0iaHR0cHM6Ly9ldmVudC4ycGVyZm9ybWFudC5jb20vZXZlbnRzL2NsaWNrIl0="),e("YVtocmVmXj0iaHR0cHM6Ly9sLnByb2ZpdHNoYXJlLnJvLyJd"),'a[href^="/url/"]'],ruAd:[e("YVtocmVmKj0iLy9mZWJyYXJlLnJ1LyJd"),e("YVtocmVmKj0iLy91dGltZy5ydS8iXQ=="),e("YVtocmVmKj0iOi8vY2hpa2lkaWtpLnJ1Il0="),"#pgeldiz",".yandex-rtb-block"],thaiAds:["a[href*=macau-uta-popup]",e("I2Fkcy1nb29nbGUtbWlkZGxlX3JlY3RhbmdsZS1ncm91cA=="),e("LmFkczMwMHM="),".bumq",".img-kosana"],webAnnoyancesUltralist:["#mod-social-share-2","#social-tools",e("LmN0cGwtZnVsbGJhbm5lcg=="),".zergnet-recommend",".yt.btn-link.btn-md.btn"]}}async function og({debug:e}={}){if(!ag())return;let t=rg(),i=Object.keys(t),s=[].concat(...i.map(o=>t[o])),n=await lg(s);e&&cg(t,n);let r=i.filter(o=>{let a=t[o];return ve(a.map(c=>n[c]))>a.length*.6});return r.sort(),r}function ag(){return ze()||Rs()}async function lg(e){var t;let i=document,s=i.createElement("div"),n=new Array(e.length),r={};du(s);for(let o=0;o<e.length;++o){let a=Tv(e[o]);a.tagName==="DIALOG"&&a.show();let l=i.createElement("div");du(l),l.appendChild(a),s.appendChild(l),n[o]=a}for(;!i.body;)await Os(50);i.body.appendChild(s);try{for(let o=0;o<e.length;++o)n[o].offsetParent||(r[e[o]]=!0)}finally{(t=s.parentNode)===null||t===void 0||t.removeChild(s)}return r}function du(e){e.style.setProperty("visibility","hidden","important"),e.style.setProperty("display","block","important")}function cg(e,t){let i="DOM blockers debug:\n```";for(let s of Object.keys(e)){i+=`
|
|
5
5
|
${s}:`;for(let n of e[s])i+=`
|
|
6
6
|
${t[n]?"\u{1F6AB}":"\u27A1\uFE0F"} ${n}`}console.log(`${i}
|
|
7
|
-
\`\`\``)}var ig="mmMwWLliI0fiflO&1",Mr={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};function sg(){return rg((e,t,i)=>{let s={},n={};for(let o of Object.keys(Mr)){let[a={},l=ig]=Mr[o],c=e.createElement("span");c.textContent=l,c.style.whiteSpace="nowrap";for(let u of Object.keys(a)){let d=a[u];d!==void 0&&(c.style[u]=d)}s[o]=c,t.append(e.createElement("br"),c)}let r=oi()&&rv();for(let o of Object.keys(Mr)){let a=s[o].getBoundingClientRect().width;n[o]=r?ng(a*i.devicePixelRatio):a}return n})}function ng(e){let t=Os()?0:3,i=Math.pow(10,t);return Math.floor(e*i)/i}function rg(e,t=4e3){return ku((i,s)=>{let n=s.document,r=n.body,o=r.style;o.width=`${t}px`,o.webkitTextSizeAdjust=o.textSizeAdjust="none",oi()?r.style.zoom=`${1/s.devicePixelRatio}`:Ue()&&(r.style.zoom="reset");let a=n.createElement("div");return a.textContent=[...Array(t/20<<0)].map(()=>"word").join(" "),r.appendChild(a),e(n,r,s)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}var og="mmMwWLliI0O&1",ag="48px",ni=["monospace","sans-serif","serif"],cu=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function lg(){return ku((e,{document:t})=>{let i=t.body;i.style.fontSize=ag;let s=t.createElement("div");s.style.setProperty("visibility","hidden","important");let n={},r={},o=p=>{let v=t.createElement("span"),{style:_}=v;return _.position="absolute",_.top="0",_.left="0",_.fontFamily=p,v.textContent=og,s.appendChild(v),v},a=(p,v)=>o(`'${p}',${v}`),l=()=>ni.map(o),c=()=>{let p={};for(let v of cu)p[v]=ni.map(_=>a(v,_));return p},u=p=>ni.some((v,_)=>p[_].offsetWidth!==n[v]||p[_].offsetHeight!==r[v]),d=l(),h=c();i.appendChild(s);for(let p=0;p<ni.length;p++)n[ni[p]]=d[p].offsetWidth,r[ni[p]]=d[p].offsetHeight;return cu.filter(p=>u(h[p]))})}function cg(){if(uu("active"))return!0;if(uu("none"))return!1}function uu(e){return matchMedia(`(forced-colors: ${e})`).matches}function ug(){let e=dg();return e!==void 0&&Hi()&&wu()?e>=8?8:4:e}function dg(){return rt(Cr(navigator.hardwareConcurrency),void 0)}function hg(){if(du("high"))return!0;if(du("standard"))return!1}function du(e){return matchMedia(`(dynamic-range: ${e})`).matches}function pg(){if(!(bu()||tv()))try{return!!window.indexedDB}catch{return!0}}function fg(){if(hu("inverted"))return!0;if(hu("none"))return!1}function hu(e){return matchMedia(`(inverted-colors: ${e})`).matches}function vg(){let e=navigator,t=[],i=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(i!==void 0&&t.push([i]),Array.isArray(e.languages))oi()&&sv()||t.push(e.languages);else if(typeof e.languages=="string"){let s=e.languages;s&&t.push(s.split(","))}return t}function gg(){try{return!!window.localStorage}catch{return!0}}var X=Math,$e=()=>0;function _g(){let e=X.acos||$e,t=X.acosh||$e,i=X.asin||$e,s=X.asinh||$e,n=X.atanh||$e,r=X.atan||$e,o=X.sin||$e,a=X.sinh||$e,l=X.cos||$e,c=X.cosh||$e,u=X.tan||$e,d=X.tanh||$e,h=X.exp||$e,p=X.expm1||$e,v=X.log1p||$e,_=E=>X.pow(X.PI,E),g=E=>X.log(E+X.sqrt(E*E-1)),y=E=>X.log(E+X.sqrt(E*E+1)),m=E=>X.log((1+E)/(1-E))/2,w=E=>X.exp(E)-1/X.exp(E)/2,P=E=>(X.exp(E)+1/X.exp(E))/2,x=E=>X.exp(E)-1,k=E=>(X.exp(2*E)-1)/(X.exp(2*E)+1),T=E=>X.log(1+E);return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:g(1e154),asin:i(.12312423423423424),asinh:s(1),asinhPf:y(1),atanh:n(.5),atanhPf:m(.5),atan:r(.5),sin:o(-1e300),sinh:a(1),sinhPf:w(1),cos:l(10.000000000123),cosh:c(1),coshPf:P(1),tan:u(-1e300),tanh:d(1),tanhPf:k(1),exp:h(1),expm1:p(1),expm1Pf:x(1),log1p:v(10),log1pPf:T(10),powPI:_(-100)}}var mg=100;function yg(){if(matchMedia("(min-monochrome: 0)").matches){for(let e=0;e<=mg;++e)if(matchMedia(`(max-monochrome: ${e})`).matches)return e;throw new Error("Too high value")}}function bg(){return!!window.openDatabase}function wg(){return navigator.oscpu}function xg(){return navigator.pdfViewerEnabled}function kg(){let{platform:e}=navigator;return e==="MacIntel"&&Ue()&&!Ar()?av()?"iPad":"iPhone":e}function Sg(){let e=navigator.plugins;if(!e)return;let t=[];for(let i=0;i<e.length;++i){let s=e[i];if(!s)continue;let n=[];for(let r=0;r<s.length;++r){let o=s[r];n.push({type:o.type,suffixes:o.suffixes})}t.push({name:s.name,description:s.description,mimeTypes:n})}return t}function Eg(){var e;let t=document.createElement("a"),i=(e=t.attributionSourceId)!==null&&e!==void 0?e:t.attributionsourceid;return i===void 0?void 0:String(i)}function $g(){if(pu("reduce"))return!0;if(pu("no-preference"))return!1}function pu(e){return matchMedia(`(prefers-reduced-motion: ${e})`).matches}function Pg(){if(fu("reduce"))return!0;if(fu("no-preference"))return!1}function fu(e){return matchMedia(`(prefers-reduced-transparency: ${e})`).matches}var Mg=2500,Tg=10,As,Tr;function Ig(){if(Tr!==void 0)return;let e=()=>{let t=Ir();Fr(t)?Tr=setTimeout(e,Mg):(As=t,Tr=void 0)};e()}function Fg(){return Ig(),async()=>{let e=Ir();if(Fr(e)){if(As)return[...As];lv()&&(await cv(),e=Ir())}return Fr(e)||(As=e),e}}function Cg(){let e=Ue()&&Bi()&&Vi(),t=Hi()&&wu();if(e||t)return()=>Promise.resolve(void 0);let i=Fg();return async()=>{let s=await i(),n=r=>r===null?null:yu(r,Tg);return[n(s[0]),n(s[1]),n(s[2]),n(s[3])]}}function Ir(){let e=screen;return[rt(We(e.availTop),null),rt(We(e.width)-We(e.availWidth)-rt(We(e.availLeft),0),null),rt(We(e.height)-We(e.availHeight)-rt(We(e.availTop),0),null),rt(We(e.availLeft),null)]}function Fr(e){for(let t=0;t<4;++t)if(e[t])return!1;return!0}function Ag(){if(!(Ue()&&Bi()&&Vi()))return Rg()}function Rg(){let e=screen,t=s=>rt(Cr(s),null),i=[t(e.width),t(e.height)];return i.sort().reverse(),i}function Og(){try{return!!window.sessionStorage}catch{return!0}}function Lg(){var e;let t=(e=window.Intl)===null||e===void 0?void 0:e.DateTimeFormat;if(t){let s=new t().resolvedOptions().timeZone;if(s)return s}let i=-Dg();return`UTC${i>=0?"+":""}${i}`}function Dg(){let e=new Date().getFullYear();return Math.max(We(new Date(e,0,1).getTimezoneOffset()),We(new Date(e,6,1).getTimezoneOffset()))}function Ng(){let e=navigator,t=0,i;e.maxTouchPoints!==void 0?t=Cr(e.maxTouchPoints):e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints);try{document.createEvent("TouchEvent"),i=!0}catch{i=!1}let s="ontouchstart"in window;return{maxTouchPoints:t,touchEvent:i,touchStart:s}}function jg(e){return/not/i.test(e)}async function Vg(){let e=navigator.userAgentData;if(!e)return;let t=e.brands.filter(({brand:n})=>!jg(n)).map(({brand:n})=>n),s={brands:t.length>1?t.filter(n=>n!=="Chromium"):t,mobile:e.mobile,platform:e.platform};if(e.getHighEntropyValues)try{let n=await e.getHighEntropyValues(["architecture","bitness","model","platformVersion"]);s.architecture=n.architecture,s.bitness=n.bitness,s.model=n.model,s.platformVersion=n.platformVersion}catch(n){if(n instanceof DOMException&&n.name==="NotAllowedError")s.highEntropyStatus="not_allowed";else throw n}return s}function Hg(){return navigator.vendor||""}function Bg(){let e=[];for(let t of["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"]){let i=window[t];i&&typeof i=="object"&&e.push(t)}return e.sort()}var Su=-1,Eu=-2,Wg=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),Ug=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),zg=["FRAGMENT_SHADER","VERTEX_SHADER"],Gg=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],$u="WEBGL_debug_renderer_info",qg="WEBGL_polygon_mode";function Zg({cache:e}){var t,i,s,n,r,o;let a=Pu(e);if(!a)return Su;if(!Tu(a))return Eu;let l=Mu()?null:a.getExtension($u);return{version:((t=a.getParameter(a.VERSION))===null||t===void 0?void 0:t.toString())||"",vendor:((i=a.getParameter(a.VENDOR))===null||i===void 0?void 0:i.toString())||"",vendorUnmasked:l?(s=a.getParameter(l.UNMASKED_VENDOR_WEBGL))===null||s===void 0?void 0:s.toString():"",renderer:((n=a.getParameter(a.RENDERER))===null||n===void 0?void 0:n.toString())||"",rendererUnmasked:l?(r=a.getParameter(l.UNMASKED_RENDERER_WEBGL))===null||r===void 0?void 0:r.toString():"",shadingLanguageVersion:((o=a.getParameter(a.SHADING_LANGUAGE_VERSION))===null||o===void 0?void 0:o.toString())||""}}function Yg({cache:e}){let t=Pu(e);if(!t)return Su;if(!Tu(t))return Eu;let i=t.getSupportedExtensions(),s=t.getContextAttributes(),n=[],r=[],o=[],a=[],l=[];if(s)for(let u of Object.keys(s))r.push(`${u}=${s[u]}`);let c=vu(t);for(let u of c){let d=t[u];o.push(`${u}=${d}${Wg.has(d)?`=${t.getParameter(d)}`:""}`)}if(i)for(let u of i){if(u===$u&&Mu()||u===qg&&Kg())continue;let d=t.getExtension(u);if(!d){n.push(u);continue}for(let h of vu(d)){let p=d[h];a.push(`${h}=${p}${Ug.has(p)?`=${t.getParameter(p)}`:""}`)}}for(let u of zg)for(let d of Gg){let h=Xg(t,u,d);l.push(`${u}.${d}=${h.join(",")}`)}return a.sort(),o.sort(),{contextAttributes:r,parameters:o,shaderPrecisions:l,extensions:i,extensionParameters:a,unsupportedExtensions:n}}function Pu(e){if(e.webgl)return e.webgl.context;let t=document.createElement("canvas"),i;t.addEventListener("webglCreateContextError",()=>i=void 0);for(let s of["webgl","experimental-webgl"]){try{i=t.getContext(s)}catch{}if(i)break}return e.webgl={context:i},i}function Xg(e,t,i){let s=e.getShaderPrecisionFormat(e[t],e[i]);return s?[s.rangeMin,s.rangeMax,s.precision]:[]}function vu(e){return Object.keys(e.__proto__).filter(Jg)}function Jg(e){return typeof e=="string"&&!e.match(/[^A-Z0-9_x]/)}function Mu(){return Hi()}function Kg(){return oi()||Ue()}function Tu(e){return typeof e.getParameter=="function"}var Qg={userAgentData:Vg,fonts:lg,domBlockers:Kv,fontPreferences:sg,audio:Mv,screenFrame:Cg,canvas:Ov,osCpu:wg,languages:vg,colorDepth:Uv,deviceMemory:Xv,screenResolution:Ag,hardwareConcurrency:ug,timezone:Lg,sessionStorage:Og,localStorage:gg,indexedDB:pg,openDatabase:bg,cpuClass:Zv,platform:kg,plugins:Sg,touchSupport:Ng,vendor:Hg,vendorFlavors:Bg,cookiesEnabled:qv,colorGamut:zv,invertedColors:fg,forcedColors:cg,monochrome:yg,contrast:Gv,reducedMotion:$g,reducedTransparency:Pg,hdr:hg,math:_g,pdfViewerEnabled:xg,architecture:Pv,applePay:Sv,privateClickMeasurement:Eg,audioBaseLatency:Rv,dateTimeLocale:Yv,webGlBasics:Zg,webGlExtensions:Yg};function e_(e){return bv(Qg,e,[])}function bt(e,t){let i=e[0]>>>16,s=e[0]&65535,n=e[1]>>>16,r=e[1]&65535,o=t[0]>>>16,a=t[0]&65535,l=t[1]>>>16,c=t[1]&65535,u=0,d=0,h=0,p=0;p+=r+c,h+=p>>>16,p&=65535,h+=n+l,d+=h>>>16,h&=65535,d+=s+a,u+=d>>>16,d&=65535,u+=i+o,u&=65535,e[0]=u<<16|d,e[1]=h<<16|p}function Le(e,t){let i=e[0]>>>16,s=e[0]&65535,n=e[1]>>>16,r=e[1]&65535,o=t[0]>>>16,a=t[0]&65535,l=t[1]>>>16,c=t[1]&65535,u=0,d=0,h=0,p=0;p+=r*c,h+=p>>>16,p&=65535,h+=n*c,d+=h>>>16,h&=65535,h+=r*l,d+=h>>>16,h&=65535,d+=s*c,u+=d>>>16,d&=65535,d+=n*l,u+=d>>>16,d&=65535,d+=r*a,u+=d>>>16,d&=65535,u+=i*c+s*l+n*a+r*o,u&=65535,e[0]=u<<16|d,e[1]=h<<16|p}function ri(e,t){let i=e[0];t%=64,t===32?(e[0]=e[1],e[1]=i):t<32?(e[0]=i<<t|e[1]>>>32-t,e[1]=e[1]<<t|i>>>32-t):(t-=32,e[0]=e[1]<<t|i>>>32-t,e[1]=i<<t|e[1]>>>32-t)}function Ae(e,t){t%=64,t!==0&&(t<32?(e[0]=e[1]>>>32-t,e[1]=e[1]<<t):(e[0]=e[1]<<t-32,e[1]=0))}function ae(e,t){e[0]^=t[0],e[1]^=t[1]}var t_=[4283543511,3981806797],i_=[3301882366,444984403];function gu(e){let t=[0,e[0]>>>1];ae(e,t),Le(e,t_),t[1]=e[0]>>>1,ae(e,t),Le(e,i_),t[1]=e[0]>>>1,ae(e,t)}var Fs=[2277735313,289559509],Cs=[1291169091,658871167],_u=[0,5],s_=[0,1390208809],n_=[0,944331445];function r_(e,t){let i=Kf(e);t=t||0;let s=[0,i.length],n=s[1]%16,r=s[1]-n,o=[0,t],a=[0,t],l=[0,0],c=[0,0],u;for(u=0;u<r;u=u+16)l[0]=i[u+4]|i[u+5]<<8|i[u+6]<<16|i[u+7]<<24,l[1]=i[u]|i[u+1]<<8|i[u+2]<<16|i[u+3]<<24,c[0]=i[u+12]|i[u+13]<<8|i[u+14]<<16|i[u+15]<<24,c[1]=i[u+8]|i[u+9]<<8|i[u+10]<<16|i[u+11]<<24,Le(l,Fs),ri(l,31),Le(l,Cs),ae(o,l),ri(o,27),bt(o,a),Le(o,_u),bt(o,s_),Le(c,Cs),ri(c,33),Le(c,Fs),ae(a,c),ri(a,31),bt(a,o),Le(a,_u),bt(a,n_);l[0]=0,l[1]=0,c[0]=0,c[1]=0;let d=[0,0];switch(n){case 15:d[1]=i[u+14],Ae(d,48),ae(c,d);case 14:d[1]=i[u+13],Ae(d,40),ae(c,d);case 13:d[1]=i[u+12],Ae(d,32),ae(c,d);case 12:d[1]=i[u+11],Ae(d,24),ae(c,d);case 11:d[1]=i[u+10],Ae(d,16),ae(c,d);case 10:d[1]=i[u+9],Ae(d,8),ae(c,d);case 9:d[1]=i[u+8],ae(c,d),Le(c,Cs),ri(c,33),Le(c,Fs),ae(a,c);case 8:d[1]=i[u+7],Ae(d,56),ae(l,d);case 7:d[1]=i[u+6],Ae(d,48),ae(l,d);case 6:d[1]=i[u+5],Ae(d,40),ae(l,d);case 5:d[1]=i[u+4],Ae(d,32),ae(l,d);case 4:d[1]=i[u+3],Ae(d,24),ae(l,d);case 3:d[1]=i[u+2],Ae(d,16),ae(l,d);case 2:d[1]=i[u+1],Ae(d,8),ae(l,d);case 1:d[1]=i[u],ae(l,d),Le(l,Fs),ri(l,31),Le(l,Cs),ae(o,l)}return ae(o,s),ae(a,s),bt(o,a),bt(a,o),gu(o),gu(a),bt(o,a),bt(a,o),`00000000${(o[0]>>>0).toString(16)}`.slice(-8)+`00000000${(o[1]>>>0).toString(16)}`.slice(-8)+`00000000${(a[0]>>>0).toString(16)}`.slice(-8)+`00000000${(a[1]>>>0).toString(16)}`.slice(-8)}function o_(e){let t="";for(let i of Object.keys(e).sort()){let s=e[i],n="error"in s?"error":JSON.stringify(s.value);t+=`${t?"|":""}${i.replace(/([:|\\])/g,"\\$1")}:${n}`}return t}function Iu(e){return JSON.stringify(e,(t,i)=>i instanceof Error?Qf(i):i,2)}function Fu(e){return r_(o_(e))}function a_(e){let t,i=pv(e);return{get visitorId(){return t===void 0&&(t=Fu(this.components)),t},set visitorId(s){t=s},confidence:i,components:e,version:mu}}function l_(e=50){return _v(e,e*2)}function c_(e,t){let i=Date.now();return{async get(s){let n=Date.now(),r=await e(),o=a_(r);return(t||s!=null&&s.debug)&&console.log(`Copy the text below to get the debug data:
|
|
7
|
+
\`\`\``)}var ug="mmMwWLliI0fiflO&1",Mr={default:[],apple:[{font:"-apple-system-body"}],serif:[{fontFamily:"serif"}],sans:[{fontFamily:"sans-serif"}],mono:[{fontFamily:"monospace"}],min:[{fontSize:"1px"}],system:[{fontFamily:"system-ui"}]};function dg(){return pg((e,t,i)=>{let s={},n={};for(let o of Object.keys(Mr)){let[a={},l=ug]=Mr[o],c=e.createElement("span");c.textContent=l,c.style.whiteSpace="nowrap";for(let u of Object.keys(a)){let d=a[u];d!==void 0&&(c.style[u]=d)}s[o]=c,t.append(e.createElement("br"),c)}let r=oi()&&pv();for(let o of Object.keys(Mr)){let a=s[o].getBoundingClientRect().width;n[o]=r?hg(a*i.devicePixelRatio):a}return n})}function hg(e){let t=Rs()?0:3,i=Math.pow(10,t);return Math.floor(e*i)/i}function pg(e,t=4e3){return $u((i,s)=>{let n=s.document,r=n.body,o=r.style;o.width=`${t}px`,o.webkitTextSizeAdjust=o.textSizeAdjust="none",oi()?r.style.zoom=`${1/s.devicePixelRatio}`:ze()&&(r.style.zoom="reset");let a=n.createElement("div");return a.textContent=[...Array(t/20<<0)].map(()=>"word").join(" "),r.appendChild(a),e(n,r,s)},'<!doctype html><html><head><meta name="viewport" content="width=device-width, initial-scale=1">')}var fg="mmMwWLliI0O&1",vg="48px",ni=["monospace","sans-serif","serif"],hu=["sans-serif-thin","ARNO PRO","Agency FB","Arabic Typesetting","Arial Unicode MS","AvantGarde Bk BT","BankGothic Md BT","Batang","Bitstream Vera Sans Mono","Calibri","Century","Century Gothic","Clarendon","EUROSTILE","Franklin Gothic","Futura Bk BT","Futura Md BT","GOTHAM","Gill Sans","HELV","Haettenschweiler","Helvetica Neue","Humanst521 BT","Leelawadee","Letter Gothic","Levenim MT","Lucida Bright","Lucida Sans","Menlo","MS Mincho","MS Outlook","MS Reference Specialty","MS UI Gothic","MT Extra","MYRIAD PRO","Marlett","Meiryo UI","Microsoft Uighur","Minion Pro","Monotype Corsiva","PMingLiU","Pristina","SCRIPTINA","Segoe UI Light","Serifa","SimHei","Small Fonts","Staccato222 BT","TRAJAN PRO","Univers CE 55 Medium","Vrinda","ZWAdobeF"];function gg(){return $u((e,{document:t})=>{let i=t.body;i.style.fontSize=vg;let s=t.createElement("div");s.style.setProperty("visibility","hidden","important");let n={},r={},o=p=>{let v=t.createElement("span"),{style:_}=v;return _.position="absolute",_.top="0",_.left="0",_.fontFamily=p,v.textContent=fg,s.appendChild(v),v},a=(p,v)=>o(`'${p}',${v}`),l=()=>ni.map(o),c=()=>{let p={};for(let v of hu)p[v]=ni.map(_=>a(v,_));return p},u=p=>ni.some((v,_)=>p[_].offsetWidth!==n[v]||p[_].offsetHeight!==r[v]),d=l(),h=c();i.appendChild(s);for(let p=0;p<ni.length;p++)n[ni[p]]=d[p].offsetWidth,r[ni[p]]=d[p].offsetHeight;return hu.filter(p=>u(h[p]))})}function _g(){if(pu("active"))return!0;if(pu("none"))return!1}function pu(e){return matchMedia(`(forced-colors: ${e})`).matches}function mg(){let e=yg();return e!==void 0&&Hi()&&Su()?e>=8?8:4:e}function yg(){return rt(Fr(navigator.hardwareConcurrency),void 0)}function bg(){if(fu("high"))return!0;if(fu("standard"))return!1}function fu(e){return matchMedia(`(dynamic-range: ${e})`).matches}function wg(){if(!(ku()||cv()))try{return!!window.indexedDB}catch{return!0}}function xg(){if(vu("inverted"))return!0;if(vu("none"))return!1}function vu(e){return matchMedia(`(inverted-colors: ${e})`).matches}function kg(){let e=navigator,t=[],i=e.language||e.userLanguage||e.browserLanguage||e.systemLanguage;if(i!==void 0&&t.push([i]),Array.isArray(e.languages))oi()&&dv()||t.push(e.languages);else if(typeof e.languages=="string"){let s=e.languages;s&&t.push(s.split(","))}return t}function Sg(){try{return!!window.localStorage}catch{return!0}}var X=Math,$e=()=>0;function Eg(){let e=X.acos||$e,t=X.acosh||$e,i=X.asin||$e,s=X.asinh||$e,n=X.atanh||$e,r=X.atan||$e,o=X.sin||$e,a=X.sinh||$e,l=X.cos||$e,c=X.cosh||$e,u=X.tan||$e,d=X.tanh||$e,h=X.exp||$e,p=X.expm1||$e,v=X.log1p||$e,_=S=>X.pow(X.PI,S),g=S=>X.log(S+X.sqrt(S*S-1)),y=S=>X.log(S+X.sqrt(S*S+1)),m=S=>X.log((1+S)/(1-S))/2,w=S=>X.exp(S)-1/X.exp(S)/2,M=S=>(X.exp(S)+1/X.exp(S))/2,P=S=>X.exp(S)-1,k=S=>(X.exp(2*S)-1)/(X.exp(2*S)+1),I=S=>X.log(1+S);return{acos:e(.12312423423423424),acosh:t(1e308),acoshPf:g(1e154),asin:i(.12312423423423424),asinh:s(1),asinhPf:y(1),atanh:n(.5),atanhPf:m(.5),atan:r(.5),sin:o(-1e300),sinh:a(1),sinhPf:w(1),cos:l(10.000000000123),cosh:c(1),coshPf:M(1),tan:u(-1e300),tanh:d(1),tanhPf:k(1),exp:h(1),expm1:p(1),expm1Pf:P(1),log1p:v(10),log1pPf:I(10),powPI:_(-100)}}var $g=100;function Pg(){if(matchMedia("(min-monochrome: 0)").matches){for(let e=0;e<=$g;++e)if(matchMedia(`(max-monochrome: ${e})`).matches)return e;throw new Error("Too high value")}}function Mg(){return!!window.openDatabase}function Tg(){return navigator.oscpu}function Ig(){return navigator.pdfViewerEnabled}function Cg(){let{platform:e}=navigator;return e==="MacIntel"&&ze()&&!Ar()?vv()?"iPad":"iPhone":e}function Fg(){let e=navigator.plugins;if(!e)return;let t=[];for(let i=0;i<e.length;++i){let s=e[i];if(!s)continue;let n=[];for(let r=0;r<s.length;++r){let o=s[r];n.push({type:o.type,suffixes:o.suffixes})}t.push({name:s.name,description:s.description,mimeTypes:n})}return t}function Ag(){var e;let t=document.createElement("a"),i=(e=t.attributionSourceId)!==null&&e!==void 0?e:t.attributionsourceid;return i===void 0?void 0:String(i)}function Og(){if(gu("reduce"))return!0;if(gu("no-preference"))return!1}function gu(e){return matchMedia(`(prefers-reduced-motion: ${e})`).matches}function Rg(){if(_u("reduce"))return!0;if(_u("no-preference"))return!1}function _u(e){return matchMedia(`(prefers-reduced-transparency: ${e})`).matches}var Lg=2500,Dg=10,As,Tr;function Ng(){if(Tr!==void 0)return;let e=()=>{let t=Ir();Cr(t)?Tr=setTimeout(e,Lg):(As=t,Tr=void 0)};e()}function jg(){return Ng(),async()=>{let e=Ir();if(Cr(e)){if(As)return[...As];gv()&&(await _v(),e=Ir())}return Cr(e)||(As=e),e}}function Vg(){let e=ze()&&Wi()&&Vi(),t=Hi()&&Su();if(e||t)return()=>Promise.resolve(void 0);let i=jg();return async()=>{let s=await i(),n=r=>r===null?null:xu(r,Dg);return[n(s[0]),n(s[1]),n(s[2]),n(s[3])]}}function Ir(){let e=screen;return[rt(Ue(e.availTop),null),rt(Ue(e.width)-Ue(e.availWidth)-rt(Ue(e.availLeft),0),null),rt(Ue(e.height)-Ue(e.availHeight)-rt(Ue(e.availTop),0),null),rt(Ue(e.availLeft),null)]}function Cr(e){for(let t=0;t<4;++t)if(e[t])return!1;return!0}function Hg(){if(!(ze()&&Wi()&&Vi()))return Wg()}function Wg(){let e=screen,t=s=>rt(Fr(s),null),i=[t(e.width),t(e.height)];return i.sort().reverse(),i}function Bg(){try{return!!window.sessionStorage}catch{return!0}}function Ug(){var e;let t=(e=window.Intl)===null||e===void 0?void 0:e.DateTimeFormat;if(t){let s=new t().resolvedOptions().timeZone;if(s)return s}let i=-zg();return`UTC${i>=0?"+":""}${i}`}function zg(){let e=new Date().getFullYear();return Math.max(Ue(new Date(e,0,1).getTimezoneOffset()),Ue(new Date(e,6,1).getTimezoneOffset()))}function Gg(){let e=navigator,t=0,i;e.maxTouchPoints!==void 0?t=Fr(e.maxTouchPoints):e.msMaxTouchPoints!==void 0&&(t=e.msMaxTouchPoints);try{document.createEvent("TouchEvent"),i=!0}catch{i=!1}let s="ontouchstart"in window;return{maxTouchPoints:t,touchEvent:i,touchStart:s}}function qg(e){return/not/i.test(e)}async function Zg(){let e=navigator.userAgentData;if(!e)return;let t=e.brands.filter(({brand:n})=>!qg(n)).map(({brand:n})=>n),s={brands:t.length>1?t.filter(n=>n!=="Chromium"):t,mobile:e.mobile,platform:e.platform};if(e.getHighEntropyValues)try{let n=await e.getHighEntropyValues(["architecture","bitness","model","platformVersion"]);s.architecture=n.architecture,s.bitness=n.bitness,s.model=n.model,s.platformVersion=n.platformVersion}catch(n){if(n instanceof DOMException&&n.name==="NotAllowedError")s.highEntropyStatus="not_allowed";else throw n}return s}function Yg(){return navigator.vendor||""}function Xg(){let e=[];for(let t of["chrome","safari","__crWeb","__gCrWeb","yandex","__yb","__ybro","__firefox__","__edgeTrackingPreventionStatistics","webkit","oprt","samsungAr","ucweb","UCShellJava","puffinDevice"]){let i=window[t];i&&typeof i=="object"&&e.push(t)}return e.sort()}var Pu=-1,Mu=-2,Jg=new Set([10752,2849,2884,2885,2886,2928,2929,2930,2931,2932,2960,2961,2962,2963,2964,2965,2966,2967,2968,2978,3024,3042,3088,3089,3106,3107,32773,32777,32777,32823,32824,32936,32937,32938,32939,32968,32969,32970,32971,3317,33170,3333,3379,3386,33901,33902,34016,34024,34076,3408,3410,3411,3412,3413,3414,3415,34467,34816,34817,34818,34819,34877,34921,34930,35660,35661,35724,35738,35739,36003,36004,36005,36347,36348,36349,37440,37441,37443,7936,7937,7938]),Kg=new Set([34047,35723,36063,34852,34853,34854,34229,36392,36795,38449]),Qg=["FRAGMENT_SHADER","VERTEX_SHADER"],e_=["LOW_FLOAT","MEDIUM_FLOAT","HIGH_FLOAT","LOW_INT","MEDIUM_INT","HIGH_INT"],Tu="WEBGL_debug_renderer_info",t_="WEBGL_polygon_mode";function i_({cache:e}){var t,i,s,n,r,o;let a=Iu(e);if(!a)return Pu;if(!Fu(a))return Mu;let l=Cu()?null:a.getExtension(Tu);return{version:((t=a.getParameter(a.VERSION))===null||t===void 0?void 0:t.toString())||"",vendor:((i=a.getParameter(a.VENDOR))===null||i===void 0?void 0:i.toString())||"",vendorUnmasked:l?(s=a.getParameter(l.UNMASKED_VENDOR_WEBGL))===null||s===void 0?void 0:s.toString():"",renderer:((n=a.getParameter(a.RENDERER))===null||n===void 0?void 0:n.toString())||"",rendererUnmasked:l?(r=a.getParameter(l.UNMASKED_RENDERER_WEBGL))===null||r===void 0?void 0:r.toString():"",shadingLanguageVersion:((o=a.getParameter(a.SHADING_LANGUAGE_VERSION))===null||o===void 0?void 0:o.toString())||""}}function s_({cache:e}){let t=Iu(e);if(!t)return Pu;if(!Fu(t))return Mu;let i=t.getSupportedExtensions(),s=t.getContextAttributes(),n=[],r=[],o=[],a=[],l=[];if(s)for(let u of Object.keys(s))r.push(`${u}=${s[u]}`);let c=mu(t);for(let u of c){let d=t[u];o.push(`${u}=${d}${Jg.has(d)?`=${t.getParameter(d)}`:""}`)}if(i)for(let u of i){if(u===Tu&&Cu()||u===t_&&o_())continue;let d=t.getExtension(u);if(!d){n.push(u);continue}for(let h of mu(d)){let p=d[h];a.push(`${h}=${p}${Kg.has(p)?`=${t.getParameter(p)}`:""}`)}}for(let u of Qg)for(let d of e_){let h=n_(t,u,d);l.push(`${u}.${d}=${h.join(",")}`)}return a.sort(),o.sort(),{contextAttributes:r,parameters:o,shaderPrecisions:l,extensions:i,extensionParameters:a,unsupportedExtensions:n}}function Iu(e){if(e.webgl)return e.webgl.context;let t=document.createElement("canvas"),i;t.addEventListener("webglCreateContextError",()=>i=void 0);for(let s of["webgl","experimental-webgl"]){try{i=t.getContext(s)}catch{}if(i)break}return e.webgl={context:i},i}function n_(e,t,i){let s=e.getShaderPrecisionFormat(e[t],e[i]);return s?[s.rangeMin,s.rangeMax,s.precision]:[]}function mu(e){return Object.keys(e.__proto__).filter(r_)}function r_(e){return typeof e=="string"&&!e.match(/[^A-Z0-9_x]/)}function Cu(){return Hi()}function o_(){return oi()||ze()}function Fu(e){return typeof e.getParameter=="function"}var a_={userAgentData:Zg,fonts:gg,domBlockers:og,fontPreferences:dg,audio:Lv,screenFrame:Vg,canvas:Bv,osCpu:Tg,languages:kg,colorDepth:Kv,deviceMemory:ng,screenResolution:Hg,hardwareConcurrency:mg,timezone:Ug,sessionStorage:Bg,localStorage:Sg,indexedDB:wg,openDatabase:Mg,cpuClass:ig,platform:Cg,plugins:Fg,touchSupport:Gg,vendor:Yg,vendorFlavors:Xg,cookiesEnabled:tg,colorGamut:Qv,invertedColors:xg,forcedColors:_g,monochrome:Pg,contrast:eg,reducedMotion:Og,reducedTransparency:Rg,hdr:bg,math:Eg,pdfViewerEnabled:Ig,architecture:Rv,applePay:Fv,privateClickMeasurement:Ag,audioBaseLatency:Wv,dateTimeLocale:sg,webGlBasics:i_,webGlExtensions:s_};function l_(e){return Mv(a_,e,[])}function bt(e,t){let i=e[0]>>>16,s=e[0]&65535,n=e[1]>>>16,r=e[1]&65535,o=t[0]>>>16,a=t[0]&65535,l=t[1]>>>16,c=t[1]&65535,u=0,d=0,h=0,p=0;p+=r+c,h+=p>>>16,p&=65535,h+=n+l,d+=h>>>16,h&=65535,d+=s+a,u+=d>>>16,d&=65535,u+=i+o,u&=65535,e[0]=u<<16|d,e[1]=h<<16|p}function De(e,t){let i=e[0]>>>16,s=e[0]&65535,n=e[1]>>>16,r=e[1]&65535,o=t[0]>>>16,a=t[0]&65535,l=t[1]>>>16,c=t[1]&65535,u=0,d=0,h=0,p=0;p+=r*c,h+=p>>>16,p&=65535,h+=n*c,d+=h>>>16,h&=65535,h+=r*l,d+=h>>>16,h&=65535,d+=s*c,u+=d>>>16,d&=65535,d+=n*l,u+=d>>>16,d&=65535,d+=r*a,u+=d>>>16,d&=65535,u+=i*c+s*l+n*a+r*o,u&=65535,e[0]=u<<16|d,e[1]=h<<16|p}function ri(e,t){let i=e[0];t%=64,t===32?(e[0]=e[1],e[1]=i):t<32?(e[0]=i<<t|e[1]>>>32-t,e[1]=e[1]<<t|i>>>32-t):(t-=32,e[0]=e[1]<<t|i>>>32-t,e[1]=i<<t|e[1]>>>32-t)}function Oe(e,t){t%=64,t!==0&&(t<32?(e[0]=e[1]>>>32-t,e[1]=e[1]<<t):(e[0]=e[1]<<t-32,e[1]=0))}function ae(e,t){e[0]^=t[0],e[1]^=t[1]}var c_=[4283543511,3981806797],u_=[3301882366,444984403];function yu(e){let t=[0,e[0]>>>1];ae(e,t),De(e,c_),t[1]=e[0]>>>1,ae(e,t),De(e,u_),t[1]=e[0]>>>1,ae(e,t)}var Cs=[2277735313,289559509],Fs=[1291169091,658871167],bu=[0,5],d_=[0,1390208809],h_=[0,944331445];function p_(e,t){let i=ov(e);t=t||0;let s=[0,i.length],n=s[1]%16,r=s[1]-n,o=[0,t],a=[0,t],l=[0,0],c=[0,0],u;for(u=0;u<r;u=u+16)l[0]=i[u+4]|i[u+5]<<8|i[u+6]<<16|i[u+7]<<24,l[1]=i[u]|i[u+1]<<8|i[u+2]<<16|i[u+3]<<24,c[0]=i[u+12]|i[u+13]<<8|i[u+14]<<16|i[u+15]<<24,c[1]=i[u+8]|i[u+9]<<8|i[u+10]<<16|i[u+11]<<24,De(l,Cs),ri(l,31),De(l,Fs),ae(o,l),ri(o,27),bt(o,a),De(o,bu),bt(o,d_),De(c,Fs),ri(c,33),De(c,Cs),ae(a,c),ri(a,31),bt(a,o),De(a,bu),bt(a,h_);l[0]=0,l[1]=0,c[0]=0,c[1]=0;let d=[0,0];switch(n){case 15:d[1]=i[u+14],Oe(d,48),ae(c,d);case 14:d[1]=i[u+13],Oe(d,40),ae(c,d);case 13:d[1]=i[u+12],Oe(d,32),ae(c,d);case 12:d[1]=i[u+11],Oe(d,24),ae(c,d);case 11:d[1]=i[u+10],Oe(d,16),ae(c,d);case 10:d[1]=i[u+9],Oe(d,8),ae(c,d);case 9:d[1]=i[u+8],ae(c,d),De(c,Fs),ri(c,33),De(c,Cs),ae(a,c);case 8:d[1]=i[u+7],Oe(d,56),ae(l,d);case 7:d[1]=i[u+6],Oe(d,48),ae(l,d);case 6:d[1]=i[u+5],Oe(d,40),ae(l,d);case 5:d[1]=i[u+4],Oe(d,32),ae(l,d);case 4:d[1]=i[u+3],Oe(d,24),ae(l,d);case 3:d[1]=i[u+2],Oe(d,16),ae(l,d);case 2:d[1]=i[u+1],Oe(d,8),ae(l,d);case 1:d[1]=i[u],ae(l,d),De(l,Cs),ri(l,31),De(l,Fs),ae(o,l)}return ae(o,s),ae(a,s),bt(o,a),bt(a,o),yu(o),yu(a),bt(o,a),bt(a,o),`00000000${(o[0]>>>0).toString(16)}`.slice(-8)+`00000000${(o[1]>>>0).toString(16)}`.slice(-8)+`00000000${(a[0]>>>0).toString(16)}`.slice(-8)+`00000000${(a[1]>>>0).toString(16)}`.slice(-8)}function f_(e){let t="";for(let i of Object.keys(e).sort()){let s=e[i],n="error"in s?"error":JSON.stringify(s.value);t+=`${t?"|":""}${i.replace(/([:|\\])/g,"\\$1")}:${n}`}return t}function Au(e){return JSON.stringify(e,(t,i)=>i instanceof Error?av(i):i,2)}function Ou(e){return p_(f_(e))}function v_(e){let t,i=wv(e);return{get visitorId(){return t===void 0&&(t=Ou(this.components)),t},set visitorId(s){t=s},confidence:i,components:e,version:wu}}function g_(e=50){return Ev(e,e*2)}function __(e,t){let i=Date.now();return{async get(s){let n=Date.now(),r=await e(),o=v_(r);return(t||s!=null&&s.debug)&&console.log(`Copy the text below to get the debug data:
|
|
8
8
|
|
|
9
9
|
\`\`\`
|
|
10
10
|
version: ${o.version}
|
|
11
11
|
userAgent: ${navigator.userAgent}
|
|
12
12
|
timeBetweenLoadAndGet: ${n-i}
|
|
13
13
|
visitorId: ${o.visitorId}
|
|
14
|
-
components: ${
|
|
15
|
-
\`\`\``),o}}}function u_(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{let e=new XMLHttpRequest;e.open("get",`https://m1.openfpcdn.io/fingerprintjs/v${mu}/npm-monitoring`,!0),e.send()}catch(e){console.error(e)}}async function d_(e={}){let{delayFallback:t,debug:i,monitoring:s=!0}=e;s&&u_(),await l_(t);let n=e_({cache:{},debug:i});return c_(n,i)}var Cu={load:d_,hashComponents:Fu,componentsToDebugString:Iu};var h_=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_placement"],p_=["fbclid","gclid","gbraid","wbraid","gad_source","gad_campaignid","msclkid","ctwa_clid"],Lr=["ad_id","adset_id","campaign_id","adgroup_id","h_ad_id","fbc_id"],f_=["lp"],Ru=[...h_,...p_,...Lr,...f_],Ou=new Set(Ru),v_=e=>Ou.has(String(e).toLowerCase()),Rr=e=>e.split(/[?#]/)[0],g_=/^[a-z][a-z0-9+.-]*:/i;function De(e,t){if(typeof e!="string"||e==="")return e;let i=g_.test(e),s;try{s=new URL(e,t||void 0)}catch{return Rr(e)}if(s.protocol!=="http:"&&s.protocol!=="https:")return i?e:Rr(e);let n=new URLSearchParams;for(let[r,o]of s.searchParams)v_(r)&&n.append(r,o);return s.search=n.toString(),s.hash="",i||e.startsWith("//")?s.href:e.startsWith("/")?s.pathname+s.search:Rr(e)+s.search}function Dr(e){let t={},i;try{i=new URL(e)}catch{return t}for(let[s,n]of i.searchParams){let r=s.toLowerCase();Ou.has(r)&&n!==""&&!(r in t)&&(t[r]=n)}return t}var __=new Set(["href","attr__href","action","attr__action"]),m_=/((?:attr__)?(?:href|action))="((?:[^"\\]|\\.)*)"/g,Au={event:8,snapshot:400},y_=/\.(png|jpe?g|gif|webp|avif|svg|ico|bmp|mp4|webm|mov|m4v|mp3|wav|ogg|js|mjs|css|woff2?|ttf|otf|json)$/i;function b_(e,t){try{return y_.test(new URL(e,t).pathname)}catch{return!1}}function w_(e,t,i,s){return t==="$elements_chain"?e.replace(m_,(n,r,o)=>`${r}="${De(o,i)}"`):__.has(t)?De(e,i):s&&(t==="src"||t==="rr_src")?e.startsWith("data:")||b_(e,i)?e:De(e,i):!s&&/^https?:\/\//i.test(e)?De(e):e}var x_=/^https?:\/\//i;function Or(e,t,i,s,n){if(typeof e=="string")return w_(e,t,i,s);if(!e||typeof e!="object"||n>(s?Au.snapshot:Au.event))return e;if(Array.isArray(e)){for(let r=0;r<e.length;r++)e[r]=Or(e[r],t,i,s,n+1);return e}for(let r of Object.keys(e)){let o=Or(e[r],r,i,s,n+1),a=x_.test(r)?De(r):r;if(a===r){e[r]=o;continue}delete e[r];let l=e[a];Array.isArray(l)&&Array.isArray(o)?e[a]=l.concat(o):l&&o&&typeof l=="object"&&typeof o=="object"?e[a]={...l,...o}:e[a]=o}return e}function Nr(e,t){if(!e||typeof e!="object")return e;let i=e.event==="$snapshot";for(let s of["properties","$set","$set_once"])e[s]&&typeof e[s]=="object"&&(e[s]=Or(e[s],s,t,i,0));return e}var Vr=["ph_anon_id","ph_distinct_id","ph_session_id","contact_id"],k_=/\/widget\/(form|survey|booking)\//,ju=["buy.stripe.com","checkout.stripe.com"],S_="input[type=email], input[type=tel], input[name*=email i], input[name*=phone i]",Lu="data-f10x-field";function Du(e,t,i){if(!e||e.hasAttribute("data-f10x-skip"))return;let s=i&&e.querySelector(S_);for(let[n,r]of Object.entries(t)){let o=e.querySelector(`[name="${CSS.escape(n)}"]`);if(o)o.tagName==="INPUT"&&(o.type==="hidden"||o.value===""||o.hasAttribute(Lu))&&(o.value=r);else if(s){let a=document.createElement("input");a.type="hidden",a.name=n,a.value=r,a.setAttribute(Lu,""),e.appendChild(a)}}}function jr(e,t,i){let s;try{s=new URL(e,i)}catch{return null}if(s.protocol!=="http:"&&s.protocol!=="https:")return null;let n=s.href;for(let[r,o]of Object.entries(t))Vr.includes(r)?s.searchParams.set(r,o):s.searchParams.has(r)||s.searchParams.set(r,o);return ju.includes(s.hostname)&&t.ph_distinct_id&&!s.searchParams.has("client_reference_id")&&s.searchParams.set("client_reference_id",t.ph_distinct_id),s.href===n?null:s.href}var Nu=e=>{try{return new URL(e,location.href).hostname}catch{return""}};function Hr({values:e,checkoutHosts:t,addFields:i}){let s=new Set([...ju,...t||[]].map(u=>u.toLowerCase())),n=!1,r=0,o=u=>{for(let d of document.querySelectorAll("a[href]")){if(!s.has(Nu(d.getAttribute("href"))))continue;let h=jr(d.getAttribute("href"),u,location.href);h&&d.setAttribute("href",h)}},a=u=>{for(let d of document.querySelectorAll("iframe[src]")){let h=d.getAttribute("src");if(!k_.test(h))continue;let p=jr(h,u,location.href);p&&d.setAttribute("src",p)}},l=(u={})=>{u.iframes&&(n=!0);let d=e();for(let h of document.forms)Du(h,d,i);o(d),n&&a(d)},c=()=>{r||(r=setTimeout(()=>{r=0,l()},50))};return new MutationObserver(c).observe(document.documentElement,{childList:!0,subtree:!0}),document.addEventListener("submit",u=>Du(u.target,e(),i),!0),document.addEventListener("click",u=>{let d=u.target instanceof Element?u.target.closest("a[href]"):null;if(!d||!s.has(Nu(d.getAttribute("href"))))return;let h=jr(d.getAttribute("href"),e(),location.href);h&&d.setAttribute("href",h)},!0),l(),{refresh:l}}var zr="1.0.0",Br="f10x_consent",Gr="f10x_contact_id",E_="contact_id",$_=/^[A-Za-z0-9_-]{6,128}$/,P_=1e3,M_={defaults:"2026-08-30",person_profiles:"identified_only",advanced_disable_feature_flags:!0,disable_surveys:!0,disable_conversations:!0,disable_product_tours:!0,disable_web_experiments:!0},qr=e=>{try{return e==="session"?window.sessionStorage:window.localStorage}catch{return null}},Vu=(e,t)=>{var i,s;try{return(s=(i=qr(e))==null?void 0:i.getItem(t))!=null?s:null}catch{return null}},Wr=(e,t,i)=>{var s;try{(s=qr(e))==null||s.setItem(t,i)}catch{}};function Hu(e){let t={};try{let i=new URL(e).searchParams;for(let s of Vr){let n=i.get(s);n&&$_.test(n)&&(t[s]=n)}}catch{}return t}var Ur=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null&&t!==""));function T_(){for(let i of["local","session"]){let s=qr(i);if(s)try{for(let n of Object.keys(s))(n.startsWith("ph_")||n===Gr)&&s.removeItem(n)}catch{}}let e=location.hostname.split("."),t=e.map((i,s)=>e.slice(s).join(".")).filter(i=>i.includes("."));for(let i of document.cookie.split(";")){let s=i.split("=")[0].trim();if(s.startsWith("ph_")){document.cookie=`${s}=; Max-Age=0; path=/`;for(let n of t)document.cookie=`${s}=; Max-Age=0; path=/; domain=.${n}`}}}function Y0(e={}){if(window.__f10xTracking)return Ls(window.__f10xTracking);let t,i=typeof e.consent=="boolean",s=location.href;if(i&&/_\d+\/?$/.test(location.pathname))return t=Bu("preview"),Ls(t);let n=!1;try{n=window.top!==window.self}catch{n=!0}if(n){let x=Ur({...Dr(s),...Hu(s)});return Hr({values:()=>x,checkoutHosts:e.checkoutHosts,addFields:e.addFields!==!1}),t=Bu("frame",()=>x),Ls(t)}let r=Dr(s),o=Hu(s)[E_]||null,a=[],l=!1,c=null,u=null,d=()=>{let x={...r};return l&&(x.ph_anon_id=Xe.get_property("$device_id"),x.ph_distinct_id=Xe.get_distinct_id(),x.ph_session_id=Xe.get_session_id(),u&&(x.contact_id=u)),Ur(x)},h=Hr({values:d,checkoutHosts:e.checkoutHosts,addFields:e.addFields!==!1}),p=Ur({tracking_version:zr,page_version:i?e.pageVersion||1:void 0,ab_test:i&&e.test||void 0}),v=x=>x&&(x.event!=="$snapshot"&&(x.properties={...x.properties,...p,...c?{fingerprint:c}:{}}),Nr(x,location.href)),_=()=>{let x=Vu("local",Br);return x==="granted"||x==="denied"?x:null},g=!i||e.consent===!1||_()==="granted",y=!1,m=!1,w=x=>{var k;return{...x,compress_events:!1,...((k=e.posthog)==null?void 0:k.session_recording)||{},maskCapturedNetworkRequestFn:T=>({...T,name:De(T.name,location.href),requestBody:void 0,responseBody:void 0})}};async function P(){if(y||m)return;y=!0;try{let T=await Cu.load({monitoring:!1}),E=await Promise.race([T.get(),new Promise(I=>setTimeout(I,P_))]);c=(E==null?void 0:E.visitorId)||null}catch{c=null}if(y=!1,!g)return;m=!0;let{session_recording:x,...k}=e.posthog||{};Xe.init(e.key,{api_host:e.apiHost||"https://us.i.posthog.com",ui_host:"https://us.posthog.com",...M_,custom_campaign_params:[...Lr,"utm_id","utm_placement","lp"],...k,before_send:v,loaded:T=>{T.set_config({session_recording:w(T.config.session_recording)}),T.has_opted_out_capturing()&&T.opt_in_capturing({captureEventName:!1});let E=T.get_property("$initial_person_info"),I=document.referrer?De(document.referrer):"$direct";T.register({$initial_person_info:E&&typeof E=="object"?{...E,r:De(E.r),u:De(E.u)}:{r:I,u:De(location.href)}}),u=o||Vu("session",Gr),o&&(Wr("session",Gr,o),T.get_distinct_id()!==o&&T.identify(o)),l=!0,h.refresh({iframes:!0});for(let N of a.splice(0))N(!0)}})}return g?P():h.refresh({iframes:!0}),t={version:zr,mode:i?"direct":"tag",consent:()=>i&&e.consent?_():null,grant(){Wr("local",Br,"granted"),g=!0,m?l||(Xe.opt_in_capturing({captureEventName:!1}),l=!0,h.refresh({iframes:!0})):P()},deny(){var x,k;Wr("local",Br,"denied"),g=!1,m&&(Xe.opt_out_capturing(),(k=(x=Xe).stopSessionRecording)==null||k.call(x),T_(),l=!1,u=null,h.refresh())},onReady(x){l?x(!0):a.push(x)},fields:d,capture(x,k){l&&Xe.capture(x,k)},posthog:Xe},Ls(t)}function Ls(e){return window.__f10xTracking=e,window.f10xTracking=e,e}function Bu(e,t=()=>({})){return{version:zr,mode:e,consent:()=>null,grant(){},deny(){},onReady(){},fields:t,capture(){},posthog:null}}export{Ru as ALLOWED_PARAMS,Br as CONSENT_KEY,zr as VERSION,Nr as cleanEvent,De as cleanUrl,Y0 as init};
|
|
14
|
+
components: ${Au(r)}
|
|
15
|
+
\`\`\``),o}}}function m_(){if(!(window.__fpjs_d_m||Math.random()>=.001))try{let e=new XMLHttpRequest;e.open("get",`https://m1.openfpcdn.io/fingerprintjs/v${wu}/npm-monitoring`,!0),e.send()}catch(e){console.error(e)}}async function y_(e={}){let{delayFallback:t,debug:i,monitoring:s=!0}=e;s&&m_(),await g_(t);let n=l_({cache:{},debug:i});return __(n,i)}var Ru={load:y_,hashComponents:Ou,componentsToDebugString:Au};var b_=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_placement"],w_=["fbclid","gclid","gbraid","wbraid","gad_source","gad_campaignid","msclkid","ctwa_clid"],Lr=["ad_id","adset_id","campaign_id","adgroup_id","h_ad_id","fbc_id"],x_=["lp"],Du=[...b_,...w_,...Lr,...x_],Nu=new Set(Du),k_=e=>Nu.has(String(e).toLowerCase()),Or=e=>e.split(/[?#]/)[0],S_=/^[a-z][a-z0-9+.-]*:/i;function Ne(e,t){if(typeof e!="string"||e==="")return e;let i=S_.test(e),s;try{s=new URL(e,t||void 0)}catch{return Or(e)}if(s.protocol!=="http:"&&s.protocol!=="https:")return i?e:Or(e);let n=new URLSearchParams;for(let[r,o]of s.searchParams)k_(r)&&n.append(r,o);return s.search=n.toString(),s.hash="",i||e.startsWith("//")?s.href:e.startsWith("/")?s.pathname+s.search:Or(e)+s.search}function Dr(e){let t={},i;try{i=new URL(e)}catch{return t}for(let[s,n]of i.searchParams){let r=s.toLowerCase();Nu.has(r)&&n!==""&&!(r in t)&&(t[r]=n)}return t}var E_=new Set(["href","attr__href","action","attr__action"]),$_=/((?:attr__)?(?:href|action))="((?:[^"\\]|\\.)*)"/g,Lu={event:8,snapshot:400},P_=/\.(png|jpe?g|gif|webp|avif|svg|ico|bmp|mp4|webm|mov|m4v|mp3|wav|ogg|js|mjs|css|woff2?|ttf|otf|json)$/i;function M_(e,t){try{return P_.test(new URL(e,t).pathname)}catch{return!1}}function T_(e,t,i,s){return t==="$elements_chain"?e.replace($_,(n,r,o)=>`${r}="${Ne(o,i)}"`):E_.has(t)?Ne(e,i):s&&(t==="src"||t==="rr_src")?e.startsWith("data:")||M_(e,i)?e:Ne(e,i):!s&&/^https?:\/\//i.test(e)?Ne(e):e}var I_=/^https?:\/\//i;function Rr(e,t,i,s,n){if(typeof e=="string")return T_(e,t,i,s);if(!e||typeof e!="object"||n>(s?Lu.snapshot:Lu.event))return e;if(Array.isArray(e)){for(let r=0;r<e.length;r++)e[r]=Rr(e[r],t,i,s,n+1);return e}for(let r of Object.keys(e)){let o=Rr(e[r],r,i,s,n+1),a=I_.test(r)?Ne(r):r;if(a===r){e[r]=o;continue}delete e[r];let l=e[a];Array.isArray(l)&&Array.isArray(o)?e[a]=l.concat(o):l&&o&&typeof l=="object"&&typeof o=="object"?e[a]={...l,...o}:e[a]=o}return e}function Nr(e,t){if(!e||typeof e!="object")return e;let i=e.event==="$snapshot";for(let s of["properties","$set","$set_once"])e[s]&&typeof e[s]=="object"&&(e[s]=Rr(e[s],s,t,i,0));return e}var C_=/^[^\s@<>()]+@[^\s@<>()]+\.[^\s@<>()]{2,}$/,F_=["email"],A_=["phone","phonenumber","phone_number","tel","telefone"];function jr(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();return C_.test(t)&&t.length<=254?t:null}function Vr(e,t){if(typeof e!="string")return null;let i=e.trim().replace(/\s*(ext\.?|x|#)\s*\d+$/i,""),s=i.replace(/\D/g,"");i.startsWith("00")&&(s=s.slice(2));let n=i.startsWith("+")||i.startsWith("00");if(!n&&t){let r=String(t).replace(/\D/g,""),o=["39","378","379"].includes(r);r&&!s.startsWith(r)&&(s=r+(o?s:s.replace(/^0/,"")))}return s.length<7||s.length>15?null:n||t?`+${s}`:s}function ju(e){let t={},i;try{i=new URL(e)}catch{return t}for(let[s,n]of i.searchParams){let r=s.toLowerCase();!t.email&&F_.includes(r)&&(t.email=jr(n)||void 0),!t.phone&&A_.includes(r)&&(t.phone=Vr(n)||void 0)}return Object.fromEntries(Object.entries(t).filter(([,s])=>s))}var Br=["ph_anon_id","ph_distinct_id","ph_session_id","contact_id"],O_=/\/widget\/(form|survey|booking)\//,Uu=["buy.stripe.com","checkout.stripe.com"],R_="input[type=email], input[type=tel], input[name*=email i], input[name*=phone i]",Wr="data-f10x-field";function Vu(e,t,i){if(!e||e.hasAttribute("data-f10x-skip"))return;let s=i&&e.querySelector(R_);for(let[n,r]of Object.entries(t)){let o=e.querySelector(`[name="${CSS.escape(n)}"]`);if(o)o.tagName==="INPUT"&&(o.type==="hidden"||o.value===""||o.hasAttribute(Wr))&&(o.value=r);else if(s){let a=document.createElement("input");a.type="hidden",a.name=n,a.value=r,a.setAttribute(Wr,""),e.appendChild(a)}}}var Hu=new WeakMap;function L_(e){for(let t of document.querySelectorAll("input[data-q]")){let i=e[t.getAttribute("data-q")];if(i==null)continue;let s=Hu.get(t);s!==i&&(s===void 0&&t.value!==""||(t.value=i,Hu.set(t,i),t.setAttribute(Wr,""),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))))}}function Hr(e,t,i){let s;try{s=new URL(e,i)}catch{return null}if(s.protocol!=="http:"&&s.protocol!=="https:")return null;let n=s.href;for(let[r,o]of Object.entries(t))Br.includes(r)?s.searchParams.set(r,o):s.searchParams.has(r)||s.searchParams.set(r,o);return Uu.includes(s.hostname)&&t.ph_distinct_id&&!s.searchParams.has("client_reference_id")&&s.searchParams.set("client_reference_id",t.ph_distinct_id),s.href===n?null:s.href}var Wu=e=>{try{return new URL(e,location.href).hostname}catch{return""}};function Ur({values:e,checkoutHosts:t,addFields:i}){let s=new Set([...Uu,...t||[]].map(u=>u.toLowerCase())),n=!1,r=0,o=u=>{for(let d of document.querySelectorAll("a[href]")){if(!s.has(Wu(d.getAttribute("href"))))continue;let h=Hr(d.getAttribute("href"),u,location.href);h&&d.setAttribute("href",h)}},a=u=>{for(let d of document.querySelectorAll("iframe[src]")){let h=d.getAttribute("src");if(!O_.test(h))continue;let p=Hr(h,u,location.href);p&&d.setAttribute("src",p)}},l=(u={})=>{u.iframes&&(n=!0);let d=e();for(let h of document.forms)Vu(h,d,i);L_(d),o(d),n&&a(d)},c=()=>{r||(r=setTimeout(()=>{r=0,l()},50))};return new MutationObserver(c).observe(document.documentElement,{childList:!0,subtree:!0}),document.addEventListener("submit",u=>Vu(u.target,e(),i),!0),document.addEventListener("click",u=>{let d=u.target instanceof Element?u.target.closest("a[href]"):null;if(!d||!s.has(Wu(d.getAttribute("href"))))return;let h=Hr(d.getAttribute("href"),e(),location.href);h&&d.setAttribute("href",h)},!0),l(),{refresh:l}}var D_=/e-?mail/i,N_=/phone|telefone|telem[oó]vel|celular|whatsapp|(^|[\s_.-])(tel|mobile)($|[\s_.-])/i,j_=new Set(["hidden","password","checkbox","radio","search","submit","button","file","reset","image"]),zu=e=>[e.name,e.id,e.getAttribute("data-q"),e.getAttribute("autocomplete")].filter(Boolean).join(" "),V_=e=>e.type==="email"||D_.test(zu(e)),H_=e=>e.type==="tel"||e.type!=="email"&&N_.test(zu(e));function W_(e){let t=e.closest(".iti")||e.closest('.form-builder--item, [class*="phone"]')||e.parentElement,i=t&&t.querySelector('.iti__selected-dial-code, [class*="dial-code"], [class*="dialCode"]'),s=i&&i.textContent;if(s&&/\+?\d{1,4}/.test(s))return s.match(/\d{1,4}/)[0];let n=t&&t.querySelector(".iti__selected-flag, .iti__selected-country"),r=n&&(n.getAttribute("title")||n.getAttribute("aria-label")||"").match(/\+(\d{1,4})/);return r?r[1]:null}function Bu(e){if(!(e instanceof HTMLInputElement)||j_.has(e.type))return{};if(V_(e)){let t=jr(e.value);return t?{email:t}:{}}if(H_(e)){let t=Vr(e.value,W_(e));return t?{phone:t}:{}}return{}}function Gu(e){document.addEventListener("change",t=>{let i=Bu(t.target);(i.email||i.phone)&&e(i,"field")},!0),document.addEventListener("submit",t=>{if(!(t.target instanceof HTMLFormElement))return;let i={};for(let s of t.target.querySelectorAll("input")){let n=Bu(s);n.email&&!i.email&&(i.email=n.email),n.phone&&!i.phone&&(i.phone=n.phone)}(i.email||i.phone)&&e(i,"form")},!0)}var Zr="1.1.0",zr="f10x_consent",Yr="f10x_contact_id",B_="contact_id",U_=/^[A-Za-z0-9_-]{6,128}$/,z_=1e3,G_={defaults:"2026-08-30",person_profiles:"identified_only",advanced_disable_feature_flags:!0,disable_surveys:!0,disable_conversations:!0,disable_product_tours:!0,disable_web_experiments:!0},Xr=e=>{try{return e==="session"?window.sessionStorage:window.localStorage}catch{return null}},qu=(e,t)=>{var i,s;try{return(s=(i=Xr(e))==null?void 0:i.getItem(t))!=null?s:null}catch{return null}},Gr=(e,t,i)=>{var s;try{(s=Xr(e))==null||s.setItem(t,i)}catch{}};function Zu(e){let t={};try{let i=new URL(e).searchParams;for(let s of Br){let n=i.get(s);n&&U_.test(n)&&(t[s]=n)}}catch{}return t}var qr=e=>Object.fromEntries(Object.entries(e).filter(([,t])=>t!=null&&t!==""));function Yu(){for(let i of["local","session"]){let s=Xr(i);if(s)try{for(let n of Object.keys(s))(n.startsWith("ph_")||n===Yr)&&s.removeItem(n)}catch{}}let e=location.hostname.split("."),t=e.map((i,s)=>e.slice(s).join(".")).filter(i=>i.includes("."));for(let i of document.cookie.split(";")){let s=i.split("=")[0].trim();if(s.startsWith("ph_")){document.cookie=`${s}=; Max-Age=0; path=/`;for(let n of t)document.cookie=`${s}=; Max-Age=0; path=/; domain=.${n}`}}}function vm(e={}){if(window.__f10xTracking)return Ls(window.__f10xTracking);let t,i=typeof e.consent=="boolean",s=location.href;if(i&&/_\d+\/?$/.test(location.pathname))return t=Xu("preview"),Ls(t);let n=!1;try{n=window.top!==window.self}catch{n=!0}if(n){let $=qr({...Dr(s),...Zu(s)});return Ur({values:()=>$,checkoutHosts:e.checkoutHosts,addFields:e.addFields!==!1}),t=Xu("frame",()=>$),Ls(t)}let r=Dr(s),o=Zu(s)[B_]||null,a=[],l=!1,c=null,u=null,d=()=>{let $={...r};return l&&($.ph_anon_id=Ae.get_property("$device_id"),$.ph_distinct_id=Ae.get_distinct_id(),$.ph_session_id=Ae.get_session_id(),u&&($.contact_id=u)),qr($)},h=Ur({values:d,checkoutHosts:e.checkoutHosts,addFields:e.addFields!==!1}),p=new Set,v=[],_=($,D)=>{if(!l){i&&w()==="denied"||v.push([$,D]);return}let R=Object.fromEntries(Object.entries($).filter(([N,W])=>W&&!p.has(`${N}:${W}`)));if(Object.keys(R).length){for(let[N,W]of Object.entries(R))p.add(`${N}:${W}`);Ae.capture("contact_captured",{...R,contact_source:D})}},g=ju(s);Gu(_);let y=qr({tracking_version:Zr,page_version:i?e.pageVersion||1:void 0,ab_test:i&&e.test||void 0}),m=$=>$&&($.event!=="$snapshot"&&($.properties={...$.properties,...y,...c?{fingerprint:c}:{}}),Nr($,location.href)),w=()=>{let $=qu("local",zr);return $==="granted"||$==="denied"?$:null},M=!i||e.consent===!1||w()==="granted",P=!1,k=!1,I=$=>{var D;return{...$,compress_events:!1,...((D=e.posthog)==null?void 0:D.session_recording)||{},maskCapturedNetworkRequestFn:R=>({...R,name:Ne(R.name,location.href),requestBody:void 0,responseBody:void 0})}};async function S(){if(P||k)return;P=!0;try{let R=await Ru.load({monitoring:!1}),N=await Promise.race([R.get(),new Promise(W=>setTimeout(W,z_))]);c=(N==null?void 0:N.visitorId)||null}catch{c=null}if(P=!1,!M)return;k=!0;let{session_recording:$,...D}=e.posthog||{};Ae.init(e.key,{api_host:e.apiHost||"https://us.i.posthog.com",ui_host:"https://us.posthog.com",...G_,custom_campaign_params:[...Lr,"utm_id","utm_placement","lp"],...D,before_send:m,loaded:R=>{R.set_config({session_recording:I(R.config.session_recording)}),R.has_opted_out_capturing()&&R.opt_in_capturing({captureEventName:!1});let N=R.get_property("$initial_person_info"),W=document.referrer?Ne(document.referrer):"$direct";R.register({$initial_person_info:N&&typeof N=="object"?{...N,r:Ne(N.r),u:Ne(N.u)}:{r:W,u:Ne(location.href)}}),u=o||qu("session",Yr),o&&(Gr("session",Yr,o),R.get_distinct_id()!==o&&R.identify(o)),l=!0,h.refresh({iframes:!0}),_(g,"url");for(let[C,H]of v.splice(0))_(C,H);for(let C of a.splice(0))C(!0)}})}return M?S():(w()==="denied"&&Yu(),h.refresh({iframes:!0})),t={version:Zr,mode:i?"direct":"tag",consent:()=>i&&e.consent?w():null,grant(){Gr("local",zr,"granted"),M=!0,k?l||(Ae.set_config({disable_persistence:!1}),Ae.opt_in_capturing({captureEventName:!1}),l=!0,h.refresh({iframes:!0})):S()},deny(){var $,D;Gr("local",zr,"denied"),M=!1,v=[],k&&(Ae.opt_out_capturing(),(D=($=Ae).stopSessionRecording)==null||D.call($),Ae.set_config({disable_persistence:!0}),Yu(),l=!1,u=null,h.refresh())},onReady($){l?$(!0):a.push($)},fields:d,capture($,D){l&&Ae.capture($,D)},posthog:Ae},Ls(t)}function Ls(e){return window.__f10xTracking=e,window.f10xTracking=e,e}function Xu(e,t=()=>({})){return{version:Zr,mode:e,consent:()=>null,grant(){},deny(){},onReady(){},fields:t,capture(){},posthog:null}}export{Du as ALLOWED_PARAMS,zr as CONSENT_KEY,Zr as VERSION,Nr as cleanEvent,Ne as cleanUrl,vm as init};
|