PageSourceSearch

https://cpgio.com/assets/vendor-posthog-BfjysNwK.js

js cpgio.com collected 2026-10-09 23:28:22 UTC 305,899 bytes, 3 lines download raw bytes

1const y="u">typeof window?window:void 0,ye="u">typeof globalThis?globalThis:y,pe=ye==null?void 0:ye.navigator,w=ye==null?void 0:ye.document,ee=ye==null?void 0:ye.location,ns=ye==null?void 0:ye.fetch,br=ye!=null&&ye.XMLHttpRequest&&"withCredentials"in new ye.XMLHttpRequest?ye.XMLHttpRequest:void 0,Vr=ye==null?void 0:ye.AbortController,Il=ye==null?void 0:ye.CompressionStream,we=pe==null?void 0:pe.userAgent;function fo(){return!(!y||y.navigator.onLine===!1)}const Dt=typeof globalThis<"u"?globalThis:y;Dt&&typeof self>"u"&&(Dt.self=Dt),Dt&&typeof File>"u"&&(Dt.File=function(){});const C=y??{},Rl="0.8.3",Ye={DEBUG:!1,LIB_VERSION:Rl,LIB_NAME:"browser-common"};var je=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.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e}({}),qi=function(e){return e.GZipJS="gzip-js",e.Base64="base64",e}({});const Tl=["$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"],Al=["token"];function R(e,t){return e.indexOf(t)!==-1}const Xs=function(e){return e.trim()},zi=function(e){return e.replace(/^\$/,"")};function vo(e){var t;const s=[];return(t=JSON.stringify(e,function(i,r){if(typeof r=="bigint")return r.toString();if(typeof r!="function"&&typeof r!="symbol"){if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&typeof r=="object"){for(;s.length>0&&s[s.length-1]!==this;)s.pop();if(s.includes(r))return"[Circular]";s.push(r)}return r}}))!==null&&t!==void 0?t:"null"}const go=Object.prototype,wr=go.hasOwnProperty,Qs=go.toString,I=Array.isArray||function(e){return Qs.call(e)==="[object Array]"},de=e=>typeof e=="function",L=e=>e===Object(e)&&!I(e),ke=e=>{if(L(e)){for(const t in e)if(wr.call(e,t))return!1;return!0}return!1},b=e=>e===void 0,A=e=>Qs.call(e)=="[object String]",Yt=e=>A(e)&&e.trim().length===0,re=e=>e===null,T=e=>b(e)||re(e),ne=e=>Qs.call(e)=="[object Number]"&&e==e,Ve=e=>ne(e)&&e>0,$e=e=>Qs.call(e)==="[object Boolean]",Ll=e=>R(Tl,e),Dl=e=>R(Al,e);function _o(e){return e===null||typeof e!="object"}function Rs(e,t){return{}.toString.call(e)===`[object ${t}]`}function fs(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 mo(e,Error)}}function xr(e){return"u">typeof Event&&mo(e,Event)}function mo(e,t){try{return e instanceof t}catch{return!1}}const Nl=[!0,"true",1,"1","yes"],ni=e=>R(Nl,e),jl=[!1,"false",0,"0","no"];function Wr(e,t,s,i,r,n,o){try{var a=e[n](o),l=a.value}catch(u){return void s(u)}a.done?t(l):Promise.resolve(l).then(i,r)}function J(e){return function(){var t=this,s=arguments;return new Promise(function(i,r){var n=e.apply(t,s);function o(l){Wr(n,i,r,o,a,"next",l)}function a(l){Wr(n,i,r,o,a,"throw",l)}o(void 0)})}}const Bl=["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","hub
1spot","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"],Ur=function(e,t=[]){if(!e)return!1;const s=e.toLowerCase();return Bl.concat(t).some(i=>{const r=i.toLowerCase();return s.indexOf(r)!==-1})};function Be(e,t,s,i,r){return t>s&&(i.warn("min cannot be greater than max."),t=s),ne(e)?e>s?(i.warn(" cannot be  greater than max: "+s+". Using max value instead."),s):t>e?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(i.warn(" must be a number. using max or fallback. max: "+s+", fallback: "+r),Be(r??s,t,s,i))}var Hl=class{constructor(e){this.C={},this.I=e.I,this.R=Be(e.bucketSize,0,100,e.$),this.A=Be(e.refillRate,0,this.R,e.$),this.O=Be(e.refillInterval,0,864e5,e.$)}F(e,t){const s=Math.floor((t-e.lastAccess)/this.O);s>0&&(e.tokens=Math.min(e.tokens+s*this.A,this.R),e.lastAccess=e.lastAccess+s*this.O)}consumeRateLimit(e){var t;const s=Date.now(),i=String(e);let r=this.C[i];return r?this.F(r,s):(r={tokens:this.R,lastAccess:s},this.C[i]=r),r.tokens===0||(r.tokens--,r.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),r.tokens===0)}stop(){this.C={}}};const It="Mobile",os="Android",Ts="Tablet",yo="Android Tablet",bo="iPad",wo="Apple Watch",Ms="Safari",ei="BlackBerry",xo="Samsung Internet",Ps="Chrome",$o="Chrome iOS",ko="Internet Explorer",Eo="Internet Explorer Mobile",So="Opera",Mo="Microsoft Edge",Fs="Firefox",Po="Firefox iOS",As="Nintendo",Ls="PlayStation",ti="Xbox",Fo="Android Mobile",Oo="Mobile Safari",oi="Windows",Co="Windows Phone",Gr="Nokia",Vi="Ouya",ql="Generic "+It.toLowerCase(),Io="Generic "+Ts.toLowerCase(),Wi="Konqueror",Ro="Oculus Browser",To="Vivaldi",Ao="Yandex",Lo="Whale",Do="DuckDuckGo",No="Pale Moon",jo="Waterfox",Ui="Brave",Bo="Claude",Ho="Codex",qo="ChatGPT",zo="Google Search App",ai=new RegExp("Version/(\\d+(\\.\\d+)?)"),li=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),zl=new RegExp(ti,"i"),Vl=new RegExp("PlayStation \\w+","i"),Wl=new RegExp("Nintendo \\w+","i"),$r=new RegExp("BlackBerry|PlayBook|BB10","i"),Ul={"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"},Vo=function(e,t,s,i){return t=t||"",function(n){return n!=null&&n.brave?Ui:null}(s)||(i!=null&&i.detectGoogleSearchApp&&R(e,"GSA/")?zo:R(e," OPR/")&&R(e,"Mini")?"Opera Mini":R(e," OPR/")?So:$r.test(e)?ei:R(e,"IEMobile")||R(e,"WPDesktop")?Eo:R(e,"OculusBrowser")?Ro:R(e,"SamsungBrowser")?xo:R(e,"Edge")||R(e,"Edg/")?Mo:R(e,"Vivaldi/")?To:R(e,"YaBrowser/")?Ao:R(e,"Whale/")?Lo:R(e,"DuckDuckGo/")||R(e,"Ddg/")?Do:R(e,"Claude/")?Bo:R(e,"Codex/")?Ho:R(e,"ChatGPT/")?qo:R(e,"FBIOS")?"Facebook Mobile":R(e,"UCWEB")||R(e,"UCBrowser")?"UC Browser":R(e,"CriOS")?$o:R(e,"CrMo")||R(e,Ps)?Ps:R(e,os)&&R(e,Ms)?Fo:R(e,"FxiOS")?Po:R(e.toLowerCase(),Wi.toLowerCase())?Wi:R(e,"Brave/")?Ui:((n,o)=>o&&R(o,"Apple")||function(a){return R(a,Ms)&&!R(a,Ps)&&!R(a,os)}(n))(e,t)?R(e,It)?Oo:Ms:R(e,"PaleMoon/")?No:R(e,"Waterfox/")?jo:R(e,Fs)?Fs:R(e,"MSIE")||R(e,"Trident/")?ko:R(e,"Gecko")?Fs:"")},Gl={[Eo]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Mo]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Ps]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[$o]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Ms]:[ai],[Oo]:[ai],[So]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Fs]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Po]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Wi]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ei]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),ai],[Fo]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[xo]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Ro]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[To]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ao]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Lo]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ui]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Bo]:[li],[Ho]:[li],[qo]:[li],[Do]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[No]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[jo]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[zo]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ko]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Kl=function(e,t,s,i){const r=Vo(e,t,s,i),n=Gl[r];
vendor: 4,632 bytes, line 1
1if(b(n))return null;for(let o=0;n.length>o;o++){const a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Kr=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[ti,e&&e[1]||""]],[new RegExp(As,"i"),[As,""]],[new RegExp(Ls,"i"),[Ls,""]],[$r,[ei,""]],[new RegExp(oi,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Co,""];if(new RegExp(It).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const s=/Windows NT ([0-9.]+)/i.exec(t);if(s&&s[1]){let i=Ul[s[1]]||"";return/arm/i.test(t)&&(i="RT"),[oi,i]}return[oi,""]}],[/((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=b(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[os,[e[2],e[3],e[4]||"0"].join(".")]:[os,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const 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",""]]],Wo=function(e){for(let t=0;Kr.length>t;t++){const[s,i]=Kr[t],r=s.exec(e),n=r&&(de(i)?i(r,e):i);if(n)return n}return["",""]},Uo=function(e){return Wl.test(e)?As:Vl.test(e)?Ls:zl.test(e)?ti:new RegExp(Vi,"i").test(e)?Vi:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?Co:/iPad/.test(e)?bo:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?wo:$r.test(e)?ei:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Gr,"i").test(e)?Gr:/(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(It).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)?os:yo:new RegExp("(pda|Mobile)","i").test(e)?ql:new RegExp(Ts,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?Io:""},Yl=function(e,t){var s;const i=Uo(e);return i===bo||i===yo||i==="Kobo"||i==="Kindle Fire"||i===Io?Ts:i===As||i===ti||i===Ls||i===Vi?"Console":i===wo?"Wearable":i?It:(t==null?void 0:t.userAgentDataPlatform)==="Android"&&((s=t==null?void 0:t.maxTouchPoints)!==null&&s!==void 0?s:0)>0?600>Math.min((r=t==null?void 0:t.screenWidth)!==null&&r!==void 0?r:0,(n=t==null?void 0:t.screenHeight)!==null&&n!==void 0?n:0)/((o=t==null?void 0:t.devicePixelRatio)!==null&&o!==void 0?o:1)?It:Ts:"Desktop";var r,n,o},ui=/\bFBAV\/(\d+(?:\.\d+)*)/i,Yr=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",ui],[/\bFBAN\/EMA\b/i,"Facebook Lite",ui],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",ui],[/\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"]],Gi="[Truncated]",vs="[Unserializable]";function Ot(e){let t="";for(let s=0;e.length>s;s++){const i=e.charCodeAt(s);if(55296>i||i>56319)t+=56320>i||i>57343?e[s]:"�";else{const r=e.charCodeAt(s+1);56320>r||r>57343?t+="�":(t+=e[s]+e[s+1],s++)}}return t}function Go(e,t){if(!t)return e;let s=[];try{s=Object.keys(t)}catch{s=[]}for(const i of s){let r;try{r=t[i]}catch{r=vs}Object.defineProperty(e,i,{value:r,enumerable:!0,writable:!0,configurable:!0})}return e}const Jl=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Jr(e,t){return typeof(s=e)=="string"&&Jl.test(s)?e:t();var s}function Ko(e,t){const s=new Error(t);try{Object.defineProperty(s,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return s}function ot(e){return e&&e.split("#")[0]}function Zr(e){try{return e()}catch{return}}function Yo(e,t){const s=setTimeout(e,t);return s!=null&&s.unref&&(s==null||s.unref()),s}
1function Xr(e,t,s){return Jo.apply(this,arguments)}function Jo(){return(Jo=J(function*(e,t,s){let i;try{return yield Promise.race([e,new Promise((r,n)=>{i=Yo(()=>{try{s==null||s(),r()}catch(o){n(o)}},t)})])}finally{clearTimeout(i)}})).apply(this,arguments)}let _s,Qr,ci;function Zl(e){const t=globalThis._posthogChunkIds;if(!t)return;const s=Object.keys(t);return ci&&s.length===Qr||(Qr=s.length,ci=s.reduce((i,r)=>{_s||(_s={});const n=_s[r];if(n)i[n[0]]=n[1];else{const o=e(r);for(let a=o.length-1;a>=0;a--){const l=o[a],u=l==null?void 0:l.filename,c=t[r];if(u&&c){i[u]=c,_s[r]=[u,c];break}}}return i},{})),ci}function Jt(e){return Jt=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},Jt(e)}function Xl(e,t,s){return(t=function(i){var r=function(n){if(Jt(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var a=o.call(n,"string");if(Jt(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(i);return Jt(r)=="symbol"?r:r+""}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function en(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),s.push.apply(s,i)}return s}function f(e){for(var t=1;arguments.length>t;t++){var s=arguments[t]!=null?arguments[t]:{};t%2?en(Object(s),!0).forEach(function(i){Xl(e,i,s[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):en(Object(s)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(s,i))})}return e}var Ql=class{constructor(e,t,s=[]){this.coercers=e,this.stackParser=t,this.modifiers=s}buildFromUnknown(e,t={}){const s=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(s,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(i,r);return{$exception_list:this.convertToExceptionList(n,s),$exception_level:"error"}}modifyFrames(e){var t=this;return J(function*(){for(const s of e)s.stacktrace&&s.stacktrace.frames&&I(s.stacktrace.frames)&&(s.stacktrace.frames=yield t.applyModifiers(s.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){let s,i;return e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),f(f({},e),{},{cause:s,stack:i})}applyChunkIds(e,t){return e.map(s=>(s.filename&&t&&(s.chunk_id=t[s.filename]),s))}applyCoercers(e,t){for(const s of this.coercers)if(s.match(e))return s.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return J(function*(){let s=e;for(const i of t.modifiers)s=yield i(s);return s})()}convertToExceptionList(e,t){var s,i,r;const n={type:e.type,value:e.value,mechanism:{type:(s=t.type)!==null&&s!==void 0?s:"generic",handled:(i=t.handled)===null||i===void 0||i,synthetic:(r=e.synthetic)!==null&&r!==void 0&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});const o=[n];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,f(f({},t),{},{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:Zl(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,s=0){const i=(r,n)=>{if(4>=n){const o=this.buildCoercingContext(e,t,n);return this.applyCoercers(r,o)}};return f(f({},t),{},{syntheticException:s==0?t.syntheticException:void 0,mechanism:e,apply:r=>i(r,s),next:r=>i(r,s+1)})}};const eu=/^([a-z][a-z0-9.+-]+):/i,tu=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function su(e){if(!e||e==="<anonymous>")return!1;const t=eu.exec(e);return!t||tu.includes(t[1].toLowerCase())}function Ki(e,t,s,i,r){const n={platform:e,filename:t,function:s==="<anonymous>"?"?":s,in_app:su(t)};return b(i)||(n.lineno=i),b(r)||(n.colno=r),n}const Zo=(e,t)=>{const s=e.indexOf("safari-extension")!==-1,i=e.indexOf("safari-web-extension")!==-1;return s||i?[e.indexOf("@")!==-1?e.split("@")[0]:"?",s?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},iu=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ru=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,nu=/\((\S*)(?::(\d+))(?::(\d+))\)/,ou=(e,t)=>{const s=iu.exec(e);if(s){const[,r,n,o]=s;return Ki(t,r,"?",+n,+o)}const i=ru.exec(e);if(i){if(i[2]&&i[2].indexOf("eval")===0){const o=nu.exec(i[2]);o&&(i[2]=o[1],i[3]=o[2],i[4]=o[3])}const[r,n]=Zo(i[1]||"?",i[2]);return Ki(t,n,r,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},au=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,lu=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,uu=(e,t)=>
1{const s=au.exec(e);if(s){if(s[3]&&s[3].indexOf(" > eval")>-1){const n=lu.exec(s[3]);n&&(s[1]=s[1]||"eval",s[3]=n[1],s[4]=n[2],s[5]="")}let i=s[3],r=s[1]||"?";return[r,i]=Zo(r,i),Ki(t,i,r,s[4]?+s[4]:void 0,s[5]?+s[5]:void 0)}},tn=/\(error: (.*)\)/;function kr(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function cu(e){for(let t=1;10>=t;t++){const s=e.length-2*t;if(0>s)break;let i=!0;for(let r=0;t>r;r++)if(!kr(e[s+r],e[s+t+r])){i=!1;break}if(i){for(let r=0;t>r;r++)e[s+r]=e[s+t+r];return e.length=s+t,{start:s,length:t}}}}function hu(e,t){const s=t.start+t.length,i=Qo(e,t);i&&e.splice(s+i===e.length?s:t.start,i)}function Xo(e,t){let s=t.start;for(;s>0&&kr(e[s-1],e[s-1+t.length]);)s--;return t.start-s}function Qo(e,t){const s=t.start+t.length;let i=s;for(;e.length>i&&kr(e[i],e[i-t.length]);)i++;return i-s}function du(e,t){const s=t[0];let i=e.length-(s?Xo(e,s):0);for(const r of t)i-=Qo(e,r);return i}function pu(e,t,s){for(let i=0;e.length>i;i++){const r=e[(t+i)%e.length],n=e[(s+i)%e.length];if(r!==n)return n>r}return!1}var fu=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const s=A(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:s?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){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Rs(e,"DOMException")}isDOMError(e){return Rs(e,"DOMError")}},vu=class{match(e){return fs(e)}coerce(e,t){var s;const i=this.getStack(e),r=i===void 0;return{type:this.getType(e),value:this.getMessage(e,t),stack:i??((s=t.syntheticException)===null||s===void 0?void 0:s.stack),cause:e.cause?t.next(e.cause):void 0,synthetic:r}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const s=e.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(e){return e.stacktrace||e.stack||void 0}},gu=class{match(e){return!!Rs(e,"ErrorEvent")&&(e.error!=null||this.lr(e))}coerce(e,t){var s;if(e.error!=null)return t.apply(e.error);const i=t.apply(e.message);return f(f({},i),{},{stack:(s=this.ur(e))!==null&&s!==void 0?s:i.stack,synthetic:!0})}lr(e){return A(e.message)&&e.message.length>0}ur(e){var t,s;const i=e,r=(t=i.lineno)!==null&&t!==void 0?t:0,n=(s=i.colno)!==null&&s!==void 0?s:0;if(A(i.filename)&&i.filename.length!==0&&r!==0)return`Error
2    at ${i.filename}:${r}:${n}`}};const _u=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var mu=class{match(e){return typeof e=="string"}coerce(e,t){var s;const[i,r]=this.getInfos(e);return{type:i??"Error",value:r??e,stack:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,synthetic:!0}}getInfos(e){let t="Error",s=e;const i=e.match(_u);return i&&(t=i[1],s=i[2]),[t,s]}};const yu=["fatal","error","warning","log","info","debug"];function ea(e,t=40){const s=Object.keys(e);if(s.sort(),!s.length)return"[object has no keys]";for(let i=s.length;i>0;i--){const r=s.slice(0,i).join(", ");if(t>=r.length)return i===s.length?r:r.length>t?`${r.slice(0,t)}...`:r}return""}var bu=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var s,i;const r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(s=this.getStack(e))!==null&&s!==void 0?s:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(xr(e))return e.constructor.name;const t="name"in e?e.name:void 0;return A(t)&&!Yt(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let s=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(s+=` with message: '${e.message}'`),s}if("message"in e&&typeof e.message=="string")return e.message;const t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${ea(e)}`}isSeverityLevel(e){return A(e)&&!Yt(e)&&yu.indexOf(e)>=0}getStack(e){try{return A(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:A(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const s=e[t];if(fs(s))return s}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},wu=class{match(e){return xr(e)}coerce(e,t){var s;const i=e.constructor.name;return{type:i,value:`${i} captured as exception with keys: ${ea(e)}`,stack:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,synthetic:!0}}},xu=class{match(e){return _o(e)}coerce(e,t){var s;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,synthetic:!0}}},$u=class{match(e){return Rs(e,"PromiseRejectionEvent")||this.isCu
2stomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!xr(e))return!1;try{const t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var s;const i=this.getUnhandledRejectionReason(e);return _o(i)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(i)}`,stack:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,synthetic:!0}:t.apply(i)}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}};const Ds="$message",Ns="$timestamp",ku=new Set([Ds,Ns]),hi={enabled:!0,max_bytes:32768};function js(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:hi.enabled,max_bytes:Su(e.max_bytes,hi.max_bytes)}:f({},hi)}var Eu=class{constructor(e){this.ts=[],this.es=0,this.Mr=js(e)}setConfig(e){this.Mr=js(e),this.ns()}add(e){const t=function(i){let r;try{r=vo(i)}catch{return}try{const n=JSON.parse(r);if(!L(n))return;const o=n,a=o[Ds],l=o[Ns];return!A(a)||a.trim().length===0||!A(l)&&!ne(l)?void 0:{step:o,json:r}}catch{return}}(e);if(!t)return;const s=function(i){if("u">typeof TextEncoder)return new TextEncoder().encode(i).length;const r=encodeURIComponent(i);let n=0;for(let o=0;r.length>o;o++)r[o]==="%"?(n+=1,o+=2):n+=1;return n}(t.json);s>this.Mr.max_bytes||(this.ts.push({step:t.step,bytes:s}),this.es+=s,this.ns())}getAttachable(){return this.ts.map(e=>e.step)}clear(){this.ts=[],this.es=0}size(){return this.ts.length}ns(){for(;this.es>this.Mr.max_bytes&&this.ts.length>0;){const e=this.ts.shift();e&&(this.es-=e.bytes)}}};function Su(e,t){if(!ne(e)||e===1/0||e===-1/0)return t;const s=Math.floor(e);return 0>s?t:s}const sn=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function rn(e){return typeof e=="string"||e}function nn(e){return typeof e=="string"?e:void 0}const Mu=["$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","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],ta="NativeGzipValidationError",Yi=e=>e.length>=2&&e[0]===31&&e[1]===139,on=(e,t)=>e===qi.GZipJS||t===qi.GZipJS||t==="gzip",an=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError";let Nt;const ms=e=>{throw Ko(ta,`Native gzip produced invalid output: ${e}`)},Pu=(ln=J(function*(e,t){18>e.size&&ms("too-short");const s=new Uint8Array(yield e.slice(0,10).arrayBuffer());Yi(s)&&s[2]===8||ms("invalid-header");const i=new DataView(yield e.slice(e.size-8).arrayBuffer());i.getUint32(0,!0)!==(n=>{const o=(()=>{if(Nt)return Nt;Nt=[];for(let l=0;256>l;l++){let u=l;for(let c=0;8>c;c++)u=1&u?3988292384^u>>>1:u>>>1;Nt[l]=u>>>0}return Nt})();let a=4294967295;for(let l=0;n.length>l;l++)a=o[255&(a^n[l])]^a>>>8;return(4294967295^a)>>>0})(t)&&ms("invalid-crc");const r=t.length>>>0;i.getUint32(4,!0)!==r&&ms("invalid-size")}),function(e,t){return ln.apply(this,arguments)});var ln;function Ji(){return Ji=J(function*(e,t=!0,s){try{const r=new TextEncoder().encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch((i=J(function*(c){try{yield o.abort(c)}catch{}throw c}),function(c){return i.apply(this,arguments)})),l=new Response(n.readable).blob(),[u]=yield Promise.all([l,a]);return yield Pu(u,r),u}catch(r){if(s!=null&&s.rethrow)throw r;return null}var i}),Ji.apply(this,arguments)}const di=3e5;var sa=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),s=Date.now(),i=Math.min(e.retryAfterMs,di);if(!t)return this.ss=s,void(this.rs=s+i);this.rs=Math.max(this.rs,Math.min(s+i,this.ss+di))}remainingMs(){const e=Date.now();if(this.ss-5e3>e)return this.reset(),0;const t=Math.min(di,Math.max(0,this.rs-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.rs=0,this.ss=0}constructor(){this.rs=0,this.ss=0}};function ia(e,t){if(e==null)return{};var s,i,r=function(o,a){if(o==null)return{};var l={};for(var u in o)if({}.hasOwnProperty.call(o,u)){if(a.includes(u))continue;l[u]=o[u]}return l}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(i=0;n.length>i;i++)t.includes(s=n[i])||{}.propertyIsEnumerable.call(e,s)&&(r[s]=e[s])}return r}const Fu={}.propertyIsEnumerable;function Bs(e,t){try{return ra(e,t,{ancestors:new WeakSet,remainingNodes:1e4}
vendor: 5,352 bytes, line 2
2,0)}catch{return[]}}function Er(e,t,s,i){if(0>=s.remainingNodes)return{stringValue:Gi};if(s.remainingNodes--,$e(e))return{boolValue:e};if(typeof e=="bigint")return function(r,n){const o=r.toString(),a=BigInt("9223372036854775808");return r>=a||-a>r?(n==null||n.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)};const r=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t==null||t.debug(`Attribute ${r} is outside the int64 range; encoding it as a string`),{stringValue:r}):{intValue:r}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:Ot(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(s.ancestors.has(e))return{stringValue:"[Circular]"};if(i>=20)return{stringValue:Gi};if(e instanceof Date){const r=e.getTime(),n=Number.isFinite(r)?e.toISOString():String(e);return{stringValue:typeof n=="string"?Ot(n):String(n)}}s.ancestors.add(e);try{try{const r=e.toJSON;if(typeof r=="function")return Er(r.call(e),t,s,i+1)}catch{}return I(e)?{arrayValue:{values:Ou(e,t,s,i+1)}}:{kvlistValue:{values:ra(e,t,s,i+1)}}}finally{s.ancestors.delete(e)}}return{stringValue:Ot(String(e))}}function Ou(e,t,s,i){const r=[],n=Math.min(e.length,1e3);let o=0;for(;n>o&&s.remainingNodes>0;o++)try{const a=o in e?e[o]:void 0;if(T(a))continue;r.push(Er(a,t,s,i))}catch{r.push({stringValue:vs})}return e.length>o&&r.push({stringValue:Gi}),r}function ra(e,t,s,i){const r=[];for(const n in e)if(Fu.call(e,n)){if(!n){t==null||t.debug("Dropping an attribute with an empty key");continue}if(r.length>=1e3||0>=s.remainingNodes){t==null||t.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[n];if(re(o)||b(o))continue;r.push({key:Ot(n),value:Er(o,t,s,i)})}catch{r.push({key:Ot(n),value:{stringValue:vs}})}}return r}function na(e,t,s){return f(f(f(f({},Go({},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":s})}const Cu=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function oa(e,t){const s=Go({},e),i={};for(const r of Cu)({}).hasOwnProperty.call(s,r)&&(i[r]=s[r],delete s[r]);return[...Bs(s,t),...Bs(i,t)]}const un={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"},aa={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}},Iu=aa.info;function Ru(e){try{return Ot(String(e))}catch{return vs}}function Tu(e,t,s,i){const r=e.level||"info",{text:n,number:o}=aa[r]||Iu,a=function(p=Date.now()){return String(p)+"000000"}(ne(i)?i:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),T(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),T(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);const u=f({},l),c=e.attributes;if(c){let p=[];try{p=Object.keys(c)}catch{p=[]}for(const d of p){let g;try{g=c[d]}catch{g=vs}Object.defineProperty(u,d,{value:g,enumerable:!0,writable:!0,configurable:!0})}}const h={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:n,body:{stringValue:Ru(e.body)},attributes:Bs(u,s)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),b(e.trace_flags)||(h.flags=e.trace_flags),h}function la(e,t,s){return na(e,t,s)}function ua(e,t,s,i){return{resourceLogs:[{resource:{attributes:oa(t)},scopeLogs:[{scope:{name:s,version:i},logRecords:e}]}]}}var ca=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=Yo(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function ha(){return .75+.5*Math.random()}function da(e,t,s,i){const r=Math.min(Math.max(0,t-1),6),n=e*Math.pow(2,r);return Math.round(Math.min(n,Math.max(i,e))*s)}var Au=class{constructor(e,t,s,i,r,n=()=>Promise.resolve(),o){var a;this._instance=e,this.Mr=t,this.$=s,this.cs=i,this.ds=r,this.vs=n,this.fs=o,this.ps=new ca(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new sa,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!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}
2clearQueue(){this._s++,this._instance.setPersistedProperty(je.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!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 s;if(this._instance.isDisabled||this._instance.optedOut||!(e!=null&&e.body))return;const i=this.Os(e);if(i===null)return;if(!i.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const r={record:Tu(i,(s=t==null?void 0:t.context)!==null&&s!==void 0?s:this.cs(),this.$,t==null?void 0:t.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const t=this.Mr.beforeSend;if(!t)return e;const s=I(t)?t:[t];let i=e;for(const r of s)try{const n=r(i);if(!n)return this.$.info("Log was rejected in beforeSend function"),null;i=n}catch(n){return this.$.error("Error in beforeSend function for log:",n),null}return i}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return J(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return J(function*(){var t;e.ps.clear();let s=(t=e._instance.getPersistedProperty(je.LogsQueue))!==null&&t!==void 0?t:[];if(s.length===0)return;const i=s.length;let r=0;for(;s.length>0&&i>r;){var n,o;const a=e._s;e.bs=0;const l=Math.min(s.length,e.Es),u=s.slice(0,l),c=ua(u.map(p=>p.record),e.qs(),(n=e.fs)!==null&&n!==void 0?n:e._instance.getLibraryId(),e._instance.getLibraryVersion()),h=yield e._instance.js(c);if(e._s!==a)return;if(h.kind==="too-large"&&u.length>1)e.Es=Math.max(1,Math.floor(u.length/2)),e.$.warn(`Logs batch of size ${u.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(h),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),h.kind==="retry-later"||(h.kind==="too-large"?e.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):h.kind==="ok"&&e.Mr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Mr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(u.length),s=(o=e._instance.getPersistedProperty(je.LogsQueue))!==null&&o!==void 0?o:[],r+=u.length,h.kind==="fatal"))throw h.error}})()}Bs(e){var t=this;return J(function*(){var s;const i=Math.max(0,e-t.bs),r=(s=t._instance.getPersistedProperty(je.LogsQueue))!==null&&s!==void 0?s:[];t._instance.setPersistedProperty(je.LogsQueue,r.slice(i)),yield t.vs()})()}qs(){return la(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const s=(t=this._instance.getPersistedProperty(je.LogsQueue))!==null&&t!==void 0?t:[];this.Is>s.length||(s.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),s.push(e),this._instance.setPersistedProperty(je.LogsQueue,s),this.Ts>s.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(da(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(je.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return J(function*(){t.ps.clear();const s=t.flush().catch(()=>{});e!==void 0?yield Xr(s,e):yield s})()}flushWithTimeout(e){var t=this;return J(function*(){const s=t.flush();yield Xr(s,e,()=>{s.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=ha(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const pi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function cn(e){return String(e)+"000000"}function hn(e,t,s,i){let r="";return i&&(r=Object.keys(i).sort().map(n=>`${JSON.stringify(n)}:${JSON.stringify(i[n])}`).join(",")),`${e}\0${t}\0${s??""}\0${r}`}var Lu=class{constructor(e,t,s){this._instance=e,this.Mr=t,this.$=s,this.zs=new Map,this.ps=new ca(()=>this.flush().catch(i=>{this.$.error("Metrics flush failed:",i)}
vendor: 6,198 bytes, line 2
2)),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new sa,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,s){this.Zs({name:e,type:"count",value:t,unit:s==null?void 0:s.unit,attributes:s==null?void 0:s.attributes})}gauge(e,t,s){this.Zs({name:e,type:"gauge",value:t,unit:s==null?void 0:s.unit,attributes:s==null?void 0:s.attributes})}histogram(e,t,s){this.Zs({name:e,type:"histogram",value:t,unit:s==null?void 0:s.unit,attributes:s==null?void 0:s.attributes})}flush(){var e=this;const t=this.ys,s=function(){var i=J(function*(){t&&(yield t.catch(()=>{})),yield e.Qs()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this.ys===s&&(this.ys=null)});return this.ys=s,s}drainWindow(){if(this.zs.size===0)return null;const e=this.zs;return this.zs=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.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.$.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.$.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let s,i;try{s=t.attributes?f({},t.attributes):void 0,i=hn(t.type,t.name,t.unit,s)}catch(o){return void this.$.warn(`Dropping metric '${t.name}': attributes could not be serialized`,o)}let r=this.zs.get(i);if(!r){if(!this.Ks())return;r={name:t.name,type:t.type,unit:t.unit,attributes:s,windowStartMs:Date.now()},this.zs.set(i,r)}const n=this.Ws.get(t.name);n===void 0?this.Ws.set(t.name,t.type):n===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.$.warn(`Metric name '${t.name}' is already used as a ${n}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(r,t.value),this.Fs()}Ks(){return this.Mr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.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 s;e.total=((s=e.total)!==null&&s!==void 0?s: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(pi.length+1).fill(0)});const i=e.hist;i.count+=1,i.sum+=t,i.min=Math.min(i.min,t),i.max=Math.max(i.max,t),i.bucketCounts[function(r,n){for(let o=0;n.length>o;o++)if(n[o]>=r)return o;return n.length}(t,pi)]+=1;break}}}Os(e){const t=this.Mr.beforeSend;if(!t)return e;const s=I(t)?t:[t];let i=e;for(const r of s)try{const n=r(i);if(!n)return this.$.info("Metric was rejected in beforeSend function"),null;i=n}catch(n){return this.$.error("Error in beforeSend function for metric:",n),null}return i}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(da(this.Mr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return J(function*(){if(e.ps.clear(),e.zs.size===0)return;const t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const s=e.Gs,i=yield e._instance.Ys(e.Js(t));if(s===e.Gs)switch(e.ws.record(i),i.kind==="retry-later"?(e.ks++,e.Ss=ha()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),i.kind){case"ok":return;case"retry-later":return e.lo(t),void e.ps.armNoEarlierThan(e.Hs());case"too-large":return void e.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.$.error("Failed to send metrics batch:",i.error)}})()}Js(e){return t=this.ao(e),s=function(n,o,a){return na(n,o,a)}(this.Mr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),i=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:oa(s)},scopeMetrics:[{scope:{name:i,version:r},metrics:t}]}]};var t,s,i,r}ao(e){const t=cn(Date.now()),s=new Map;for(const o of e.values()){var i;const a=hn(o.type,o.name,o.unit,void 0);let l=s.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:[]},s.set(a,l));const u=Bs((i=o.attributes)!==null&&i!==void 0?i:{},this.$),c=cn(o.windowStartMs);if(o.type==="count"){var r;const h={attributes:u,startTimeUnixNano:c,timeUnixNano:t,asDouble:(r=o.total)!==null&&r!==void 0?r:0};l.sum.dataPoints.push(h)}else if(o.type==="gauge"){var n;const h={attributes:u,timeUnixNano:t,asDouble:(n=o.last)!==null&&n!==void 0?n:0};l.gauge.dataPoints.push(h)}else o.hist&&l.histogram.dataPoints.push({attributes:u,startTimeUnixNano:c,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:pi})}return Array.from(s.values())}lo(e){for(const[i,r]of e){const n=this.zs.get(i);if(n)switch(n.windowStartMs=Math.min(n.windowStartMs,r.windowStartMs),n.type){case"count":var t,s;n.total=((t=n.total)!==null&&t!==void 0?t:0)+((s=r.total)!==null&&s!==void 0?s:0);break;case"gauge":break;case"histogram":if(r.hist)if(n.hist){n.hist.count+=r.hist.count,n.hist.sum+=r.hist.sum,n.hist.min=Math.min(n.hist.min,r.hist.min),n.hist.max=Math.max(n.hist.max,r.hist.max);for(let o=0;n.hist.bucketCounts.length>o;o++)n.hist.bucketCounts[o]+=r.hist.bucketCounts[o]}else n.hist=r.hist}else this.Ks()&&this.zs.set(i,r)}}};const pa=(e,{debugEnabled:t}={})=>{const s={N(i,...r){y&&(Ye.DEBUG||y.POSTHOG_DEBUG||t)&&!b(y.console)&&y.console&&("__rrweb_original__"in y.console[i]?y.console[i].__rrweb_original__:y.console[i])(e,...r)},debug(...i){s.N("debug",...i)},info(...i){s.N("log",...i)},warn(...i){s.N("warn",...i)},error(...i){s.N("error",...i)},critical(...i){},uninitializedWarning(i){s.error(`You must initialize PostHog before calling ${i}`)},createLogger:(i,r)=>pa(`${e} ${i}`,r)};return s},E=pa("[PostHog.js]"),se=E.createLogger,Du=se("[ExternalScriptsLoader]"),Hs=e=>{const t=w==null?void 0:w.querySelectorAll("script");
2if(t){for(let s=0;t.length>s;s++)if(t[s].src===e||t[s].getAttribute("src")===e)return t[s]}},pt=(e,t,s)=>{if(e.config.disable_external_dependency_loading)return Du.warn(`${t} was requested but loading of external scripts is disabled.`),s("Loading of external scripts is disabled");const i=Hs(t);if(i){if(i.__posthog_loading_callback_fired)return s();const n=i.__posthog_loading_error;return n?s(n):(i.addEventListener("load",o=>{i.__posthog_loading_callback_fired=!0,s(void 0,o)}),void i.addEventListener("error",o=>{i.__posthog_loading_error=o,s(o)}))}const r=()=>{if(!w)return s("document not found");if(Hs(t))return pt(e,t,s);let n=w.createElement("script");if(n.type="text/javascript",n.crossOrigin="anonymous",n.src=t,n.onload=a=>{n.__posthog_loading_callback_fired=!0,s(void 0,a)},n.onerror=a=>{n.__posthog_loading_error=a,s(a)},e.config.prepare_external_dependency_script&&(n=e.config.prepare_external_dependency_script(n)),!n)return s("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")w.head.appendChild(n);else{const a=w.querySelectorAll("body > script");var o;a.length>0?(o=a[0].parentNode)===null||o===void 0||o.insertBefore(n,a[0]):w.body.appendChild(n)}};w!=null&&w.body?r():w==null||w.addEventListener("DOMContentLoaded",r)},fi={},dn=(e,t)=>{let s=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(s=`${s}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",s)};C.__PosthogExtensions__=C.__PosthogExtensions__||{},C.__PosthogExtensions__.loadExternalDependency=(e,t,s)=>{if(t==="remote-config"){const r=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);return void pt(e,r,s)}const i=e.config.strict_script_versioning;if(i){const r=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),n=fi[r];if(i==="fallback"&&n){if(Hs(n))return void pt(e,n,s);delete fi[r]}return void pt(e,r,i==="fallback"?(o,a)=>{if(o)if(typeof o=="string")s(o);else{var l;const u=dn(e,t);fi[r]=u;const c=Hs(r);c==null||(l=c.parentNode)===null||l===void 0||l.removeChild(c),pt(e,u,s)}else s(void 0,a)}:s)}pt(e,dn(e,t),s)},C.__PosthogExtensions__.loadSiteApp=(e,t,s)=>{const i=e.requestRouter.endpointFor("api",t);pt(e,i,s)},Ye.DEBUG=!1,Ye.LIB_VERSION="1.431.8",Ye.LIB_NAME="web";var ce=Ye;const Nu="$people_distinct_id",Re="distinct_id",Sr="$device_id",vi="$device_model",qs="__alias",ju="__cmpns",ys="$fbc",Te="$fbc_persistence",Zi="__timers",fa="$autocapture_disabled_server_side",Xi="$heatmaps_enabled_server_side",Qi="$exception_capture_enabled_server_side",va="$error_tracking_suppression_rules",er="$error_tracking_capture_extension_exceptions",tr="$web_vitals_enabled_server_side",Mr="$dead_clicks_enabled_server_side",Pr="$product_tours_enabled_server_side",ga="$logs_capture_enabled_server_side",_a="$web_vitals_allowed_metrics",Zt="$session_recording_remote_config",Bu="$session_recording_enabled_server_side",Hu="$replay_sample_rate",qu="$replay_override_sampling",zu="$replay_override_linked_flag",Vu="$replay_override_url_trigger",Wu="$replay_override_event_trigger",St="$sesid",ma="$session_is_sampled",Uu="$session_past_minimum_duration",Gu="$session_recording_url_trigger_activated_session",Ku="$session_recording_event_trigger_activated_session",Yu="$debug_first_full_snapshot_timestamp",Ju="$sess_rec_flush_size",Ae="$enabled_feature_flags",Ue="$active_feature_flags",sr="$early_access_features",gt="$feature_flag_details",tt="$feature_flag_payloads",_t="$feature_flag_request_id",Xt="$minimal_flag_called_events",Ne="$override_feature_flags",ft="$override_feature_flag_payloads",st="$stored_person_properties",it="$stored_group_properties",ya="$groups",ir="$surveys",zs="$surveys_loaded_at",ba="$surveys_activated",wa="$surveys_activated_session",xa="$surveys_activated_timestamps",rr="ph_product_tours",Zu="$product_tours_activated",Xu="$product_tours_activated_session",Qu="$conversations_widget_session_id",ec="$conversations_ticket_id",tc="$conversations_widget_state",sc="$conversations_user_traits",rt="$flag_call_reported",Gt="$flag_call_reported_session_id",as="$feature_flag_errors",nt="$feature_flag_evaluated_at",xe="$user_state",nr="$client_session_props",ic="$capture_rate_limit",$a="$initial_campaign_params",ka="$initial_referrer_info",Mt="$initial_person_info",Fr="$epp",gi="$posthog_cookieless",Ea="$co
2okieless_mode",Sa="$sdk_debug_extensions_init_method",Ma="$sdk_debug_extensions_init_time_ms",Pa="$sdk_debug_recording_script_not_loaded",rc="$sdk_debug_replay_event_trigger_status",nc="$sdk_debug_replay_linked_flag_trigger_status",oc="$sdk_debug_replay_matched_recording_trigger_groups",ac="$sdk_debug_replay_pending_trigger_conditions",lc="$sdk_debug_replay_remote_trigger_matching_config",uc="$sdk_debug_replay_trigger_groups_count",cc="$sdk_debug_replay_url_trigger_status",hc="$session_recording_start_reason",Or="PostHog loadExternalDependency extension not found.",Ge="anonymous",Os="identified",Fa="identified_only",ls="visibilitychange",Vs="beforeunload",Cr="$pageview",pn="$pageleave",Oa="$identify",fn="$groupidentify";function Pt(e,t){I(e)&&e.forEach(t)}function W(e,t){if(!T(e))if(I(e))e.forEach(t);else if((s=>s instanceof FormData)(e))e.forEach((s,i)=>t(s,i));else for(const s in e)wr.call(e,s)&&t(e[s],s)}const Y=function(e,...t){for(const s of t)for(const i in s)s[i]!==void 0&&(e[i]=s[i]);return e};function Cs(e){const t=Object.keys(e);let s=t.length;const i=new Array(s);for(;s--;)i[s]=[t[s],e[t[s]]];return i}const dc=function(e){return function(...t){try{return e.apply(this,t)}catch(s){E.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),E.critical(s)}}},Ir=function(e){const t={};return W(e,function(s,i){(A(s)&&s.length>0||ne(s))&&(t[i]=s)}),t};function Ca(e){const t=f({},e);for(const s of["name","message","stack","cause","errors"])try{s in e&&(t[s]=e[s])}catch{}return t}const pc=["herokuapp.com","vercel.app","netlify.app"];function fc(e){const t=e==null?void 0:e.hostname;if(!A(t))return!1;const s=t.split(".").slice(-2).join(".");for(const i of pc)if(s===i)return!1;return!0}function H(e,t,s,i){const{capture:r=!1,passive:n=!0}=i??{};e==null||e.addEventListener(t,s,{capture:r,passive:n})}function or(e){return e.name==="ph_toolbar_internal"}const ar=e=>{if(w){try{const t=e+"=",s=w.cookie.split(";").filter(i=>i.length);for(let i=0;s.length>i;i++){let r=s[i];for(;r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.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 ne(e)&&isFinite(e)&&Math.floor(e)===e});var vc=class lr{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,s,i,r){if(!Number.isInteger(t)||!Number.isInteger(s)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>s||0>i||0>r||t>0xffffffffffff||s>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");const n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/256,n[5]=t,n[6]=112|s>>>8,n[7]=s,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new lr(n)}toString(){let t="";for(let s=0;this.bytes.length>s;s++)t=t+(this.bytes[s]>>>4).toString(16)+(15&this.bytes[s]).toString(16),s!==3&&s!==5&&s!==7&&s!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new lr(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let s=0;16>s;s++){const i=this.bytes[s]-t.bytes[s];if(i!==0)return Math.sign(i)}return 0}},gc=class{generate(){const e=this.generateOrAbort();if(!b(e))return e;{this.Ct=0;const t=this.generateOrAbort();if(b(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const e=(()=>{const t=Date.now();return ne(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return vc.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new _c}};let Ia=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};y&&!b(y.crypto)&&crypto.getRandomValues&&(Ia=e=>crypto.getRandomValues(e));var _c=class{nextUint32(){return this.Rt.length>this.$t||(Ia(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let vn;const Le=()=>mc().toString(),mc=()=>(vn||(vn=new gc)).generate();let jt="";const yc=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let yt=null;const Q={Et(){if(!re(yt))return yt;if(yt=!1,w)try{const e=`__ph_cookie_support_${Le()}`;Q.At(e,"xyz"),yt=ar(e)==='"xyz"',Q.Lt(e)}catch{yt=!1}return yt},Pt(e){E.error("cookieStore error: "+e)},Ot:ar,Dt(e){let t;try{t=JSON.parse(Q.Ot(e))||{}}catch{}return t},At(e,t,s,i,r){if(!w)return!1;try{let n="",o="";
2const a=function(u,c){if(c){let h=function(p,d=w){if(jt)return jt;if(!d||["localhost","127.0.0.1"].includes(p))return"";const g=p.split(".");let m=Math.min(g.length,8);const v="dmn_chk_"+Le();for(;!jt&&m--;){const _=g.slice(m).join("."),x=v+"=1;domain=."+_+";path=/";d.cookie=x+";max-age=3",d.cookie.includes(v)&&(d.cookie=x+";max-age=0",jt=_)}return jt}(u);if(!h){const p=(d=>{const g=d.match(yc);return g?g[0]:""})(u);p!==h&&E.info("Warning: cookie subdomain discovery mismatch",p,h),h=p}return h?"; domain=."+h:""}return""}(w.location.hostname,i);if(s){const u=new Date;u.setTime(u.getTime()+864e5*s),n="; expires="+u.toUTCString()}r&&(o="; secure");const l=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&E.warn("cookieStore warning: large cookie, len="+l.length),w.cookie=l,!0}catch{return!1}},Lt(e,t){if(w!=null&&w.cookie)try{Q.At(e,"",-1,t)}catch{return}}};let _i=null;const N={Et(){if(!re(_i))return _i;let e=!0;if(b(y))e=!1;else try{const t="__mplssupport__";N.At(t,"xyz"),N.Ot(t)!=='"xyz"'&&(e=!1),N.Lt(t)}catch{e=!1}return e||E.error("localStorage unsupported; falling back to cookie store"),_i=e,e},Pt(e){E.error("localStorage error: "+e)},Ot(e){try{return y==null?void 0:y.localStorage.getItem(e)}catch(t){N.Pt(t)}return null},Dt(e){try{return JSON.parse(N.Ot(e))||{}}catch{}return null},At(e,t){try{return y==null||y.localStorage.setItem(e,JSON.stringify(t)),!0}catch(s){N.Pt(s)}return!1},Lt(e){try{y==null||y.localStorage.removeItem(e)}catch(t){N.Pt(t)}}},mi=[st,Ue,Ae,gt,tt,_t,nt,as,rt],vt=[Sr,Re,St,ma,Fr,Mt,Te,xe],Ws=e=>e+"_cpm",bc=["__proto__","constructor","prototype"],yi=e=>{if(!L(e))return{};const t={};return Object.keys(e).forEach(s=>{bc.indexOf(s)===-1&&(t[s]=e[s])}),t},bi=(e,t=[])=>{const s={};return[...vt,...t].forEach(i=>{const r=e[i];b(r)||re(r)||r===""||(s[i]=r)}),s},Ra=e=>{let t=5381,s=2166136261;for(let i=0;e.length>i;i++){const r=e.charCodeAt(i);t=33*t^r,s=Math.imul(s^r,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(s>>>0).toString(36)},gn=(e,t)=>({p:t,f:Ra(JSON.stringify(e))}),_n=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const s=Q.Dt(Ws(e)),i=(s==null?void 0:s.f)===Ra(t)&&I(s.p);return{properties:i?s.p:[],isValid:i}}catch{return{properties:[],isValid:!1}}},wi=(e,t)=>t+"|"+(Q.Ot(Ws(e))||""),bt={},ur={Et:()=>!0,Pt(e){E.error("memoryStorage error: "+e)},Ot:e=>e in bt?bt[e]:null,Dt:e=>e in bt?bt[e]:null,At:(e,t)=>(bt[e]=t,!0),Lt(e){delete bt[e]}};let ut=null;const K={Et(){if(!re(ut))return ut;if(ut=!0,b(y))ut=!1;else try{const e="__support__";K.At(e,"xyz"),K.Ot(e)!=='"xyz"'&&(ut=!1),K.Lt(e)}catch{ut=!1}return ut},Pt(e){E.error("sessionStorage error: ",e)},Ot(e){try{return y==null?void 0:y.sessionStorage.getItem(e)}catch(t){K.Pt(t)}return null},Dt(e){try{return JSON.parse(K.Ot(e))||null}catch{}return null},At(e,t){try{return y==null||y.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(s){K.Pt(s)}return!1},Lt(e){try{y==null||y.sessionStorage.removeItem(e)}catch(t){K.Pt(t)}}};var wc=class{constructor(e){this._instance=e}get Mr(){return this._instance.config}get consent(){return this.Ro()?0:this.Ao}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.Fo.At(this.Oo,e?1:0,this.Mr.cookie_expiration,this.Mr.cross_subdomain_cookie,this.Mr.secure_cookie)}reset(){this.Fo.Lt(this.Oo,this.Mr.cross_subdomain_cookie)}get Oo(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:s}=this._instance.config;return s||(t?t+e:"__ph_opt_in_out_"+e)}get Ao(){const e=this.Fo.Ot(this.Oo);return ni(e)?1:R(jl,e)?0:-1}get Fo(){const e=this.Mr.opt_out_capturing_persistence_type,t=e==="localStorage"?N:Q,s=t.Et()?t:ur;if(!this.Do||this.Do!==s){this.Do=s;const i=e==="localStorage"?Q:N;i.Ot(this.Oo)&&(this.Do.Ot(this.Oo)||this.optInOut(ni(i.Ot(this.Oo))),i.Lt(this.Oo,this.Mr.cross_subdomain_cookie))}return this.Do}Ro(){return!!this.Mr.respect_dnt&&[pe==null?void 0:pe.doNotTrack,pe==null?void 0:pe.msDoNotTrack,C.doNotTrack,pe==null?void 0:pe.globalPrivacyControl].some(e=>ni(e))}};function Ta(e,t){var s;const i=e==null||(s=e.config)===null||s===void 0?void 0:s.get_current_url;if(!de(i))return t;try{const r=i(t);return A(r)&&r?r:t}catch(r){return E.error("Error in get_current_url, falling back to window.location.href",r),t}}function mn(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 He(e){return!!e&&e.nodeType===1}function ge(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Aa(e){return!!e&&e.nodeType===3}function Rr(e){return!!e&&e.nodeType===11&&He(e.host)}function Tr(e){return e?Xs(e).split(/\s+/):[]}function yn(e,t){const s=function(i){var r;const n=y==null||(r=y.location)===null||r===void 0?void 0:r.href;return b(n)?void 0:Ta(i,n)}(t);return!!(s&&e&&e.some(i=>s.match(i)))}function Rt(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 Tr(t)}function La(e){return T(e)?null:Xs(e).split(/(\s+)/).filter(t=>es(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function us(e){let t="";return Ct(e)&&!cs(e)&&e.childNodes&&e.childNodes.length&&W(e.childNodes,function(s){var i;Aa(s)&&s.textContent&&(t+=(i=La(s.textContent))!==null&&i!==void 0?i:"")}),Xs(t)}function Qt(e){var t;return b(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}const Ar=["a","button","form","input","select","textarea","label"];function cr(e,t){const s=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!s&&s.call(e,t)}catch{return!1}}function hr(e,t){if(b(t))return!0;for(const s of e)if(t.some(i=>cr(s,i)))return!0;return!1}function Da(e){const t=e.parentNode;return!(!t||!He(t))&&t}const xi=[".ph-no-autocapture","[data-ph-no-autocapture]"],Na=["next","previous","prev",">","<"],xc=[...Na,"+","-","−","–"],bn=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,wn=[".ph-no-rageclick",".ph-no-capture"],$c=["","text","search","email","password","url","tel","number"];function ja(e,t){if(!y||Lr(e))return!1;let s,i,r;var n,o;if($e(t)?(s=!!t&&wn,i=void 0,r=!1):(s=(n=t==null?void 0:t.css_selector_ignorelist)!==null&&n!==void 0?n:wn,i=t==null?void 0:t.content_ignorelist,r=(o=t==null?void 0:t.ignore_text_selection)!==null&&o!==void 0&&o),s===!1||r&&function(l){return!(!l||!He(l))&&(!!ge(l,"textarea")||(ge(l,"
2input")?R($c,(l.getAttribute("type")||"").toLowerCase()):function(u){var c;if(u.isContentEditable)return!0;const h=(c=u.getAttribute)===null||c===void 0?void 0:c.call(u,"contenteditable");return h==="true"||h===""}(l)))}(e))return!1;const{targetElementList:a}=Ba(e,!1);return!function(l,u){if(l===!1||b(l))return!1;let c;if(l===!0)c=Na;else{if(!I(l))return!1;if(l.length>10)return E.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;c=l.map(h=>h.toLowerCase())}return u.some(({safeText:h,ariaLabel:p})=>c.some(d=>bn(h,d)||bn(p,d)))}(i,a.map(l=>{var u;return{safeText:us(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))===null||u===void 0?void 0:u.toLowerCase().trim())||""}}))&&!hr(a,s)}const Lr=e=>!e||ge(e,"html")||!He(e),Ba=(e,t)=>{if(!y||Lr(e))return{parentIsUsefulElement:!1,targetElementList:[]};let s=!1;const i=[e];let r=e;for(;r.parentNode&&!ge(r,"body");){if(Rr(r.parentNode)){i.push(r.parentNode.host),r=r.parentNode.host;continue}const n=Da(r);if(!n)break;if(t||Ar.indexOf(n.tagName.toLowerCase())>-1)s=!0;else try{const o=y.getComputedStyle(n);o&&o.getPropertyValue("cursor")==="pointer"&&(s=!0)}catch{}i.push(n),r=n}return{parentIsUsefulElement:s,targetElementList:i}};function Ct(e){const t=new Set;let s=0;for(let n=e;n.parentNode&&!ge(n,"body");n=n.parentNode){if(s++>=1e3||t.has(n))return!1;t.add(n);const o=Rt(n);if(R(o,"ph-sensitive")||R(o,"ph-no-capture"))return!1}if(R(Rt(e),"ph-include"))return!0;const i=e.type||"";if(A(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}const r=e.name||e.id||"";return!A(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function cs(e){return!!(ge(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ge(e,"select")||ge(e,"textarea")||e.getAttribute("contenteditable")==="true")}const xn=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}))$"),$n=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,kc=[16,15,14,13],Ec=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),kn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),En=/[0-9A-Za-z_]/;function Sc(e){let t=0,s=!1;for(let i=e.length-1;i>=0;i--){let r=e.charCodeAt(i)-48;s&&(r*=2,r>9&&(r-=9)),t+=r,s=!s}return t%10==0}function es(e,t=!0){return!(T(e)||A(e)&&(e=Xs(e),(t?xn.test((e||"").replace(/[- ]/g,"")):function(s){let i;for($n.lastIndex=0;i=$n.exec(s);){const r=i[2];if(!r)continue;const n=r.replace(/[- ]/g,"");for(let o=0;n.length>o;o++)for(const a of kc){const l=o+a;if(n.length>=l){const u=n.slice(o,l);if(xn.test(u)&&Sc(u))return!0}}}return!1}(e))||(t?Ec.test(e):function(s){let i;for(kn.lastIndex=0;i=kn.exec(s);){const r=i[1],n=i[3];if(!(r&&n&&En.test(r)&&En.test(n)))return!0}return!1}(e))))}function Sn(e){let t=us(e);return t=`${t} ${Ha(e)}`.trim(),es(t)?t:""}function Ha(e){let t="";return e&&e.childNodes&&e.childNodes.length&&W(e.childNodes,function(s){var i;if(s&&((i=s.tagName)===null||i===void 0?void 0:i.toLowerCase())==="span")try{const r=us(s);t=`${t} ${r}`.trim(),s.childNodes&&s.childNodes.length&&(t=`${t} ${Ha(s)}`.trim())}catch(r){E.error("[AutoCapture]",r)}}),t}function Mn(e){return e.replace(/"|\\"/g,'\\"')}function Mc(e){const t=e.attr__class;if(t)return I(t)?t:Tr(t)}const bs=se("[Dead Clicks]"),Pc=()=>!0,Fc=e=>{var t;const s=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(Mr)),i=e.instance.config.capture_dead_clicks;return $e(i)?i:!!L(i)||s};var Pn=class{get lazyLoadedDeadClicksAutocapture(){return this.Lo}constructor(e,t,s){this.instance=e,this.isEnabled=t,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Mr]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.No(()=>{this.qo()}):this.stop()}No(e){var t,s,i;!((t=C.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(s=C.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this.instance,"dead-clicks-autocapture",r=>{r?bs.error("failed to load script",r):e()})}qo(){var e;if(w){if(!this.Lo&&(!((e=C.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const 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.Lo=C.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Lo.start(w),bs.info("starting...")}}else bs.error("`document` not found. Cannot start.")}stop(){this.Lo&&(this.Lo.stop(),this.Lo=void 0,bs.info("stopping..."))}};const Bt=se("[SegmentIntegration]");function Fn(e,t,s=!0){const i=e.config.segment;if(!i)return t();const{analytics:r,filterProperties:n}=(a=>de(a.register))(o=i)?{analytics:o}:o;var o;(function(a,l,u,c){const h=d=>{const g=()=>d.anonymousId()||Le();a.config.get_device_id=g,c&&d.id()&&(a.register({distinct_id:d.id(),$device_id:g()}),a.persistence.set_property(xe,Os)),u(c?void 0:d.anonymousId()||void 0)},p=l.user();"then"in p&&de(p.then)?p.then(h):h(p)})(e,r,a=>{r.register(((l,u,{filterProperties:c}={})=>{typeof Promise<"u"&&Promise.resolve||Bt.warn("This browser does not have Promise support, and can not use the segment integration");const h=(p,d)=>
vendor: 3,964 bytes, line 2
2{if(!d)return p;const g=!!u&&p.event.anonymousId===u&&!p.event.userId;g||p.event.userId||p.event.anonymousId===l.get_distinct_id()||(Bt.info("No userId set, resetting PostHog"),l.reset()),g||(u=void 0),p.event.userId&&p.event.userId!==l.get_distinct_id()&&(Bt.info("UserId set, identifying with PostHog"),l.identify(p.event.userId));let m=l.calculateEventProperties(d,p.event.properties);if(!T(c)){const v=p.event.properties||{},_={};for(const $ of Object.keys(m))wr.call(v,$)||(_[$]=m[$]);const x=(($,O)=>{const k=I($)?$:[$];let P=f({},O);for(const F of k)try{if(P=F(P),T(P))return null}catch(S){return Bt.error("Error in Segment filterProperties:",S),null}return P})(c,_);if(T(x))return p;m=x}return p.event.properties=Object.assign({},m,p.event.properties),p};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(p){return h(p,p.event.event)},page(p){return h(p,Cr)},identify(p){return h(p,Oa)},screen(p){return h(p,"$screen")}}})(e,a,{filterProperties:n})).then(()=>{t()},l=>{Bt.error("Failed to register the Segment integration",l),t()})},s)}const qa="posthog-js";function za(e,{organization:t,projectId:s,prefix:i,severityAllowList:r=["error"],sendExceptionsToPostHog:n=!0}={}){return o=>{var a,l,u,c,h;if(r!=="*"&&!r.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const p=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=p,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const d=((a=o.exception)===null||a===void 0?void 0:a.values)||[],g=d.map(_=>f(f({},_),{},{stacktrace:_.stacktrace?f(f({},_.stacktrace),{},{type:"raw",frames:(_.stacktrace.frames||[]).map(x=>f(f({},x),{},{platform:"web:javascript"}))}):void 0})),m={$exception_message:((l=d[0])===null||l===void 0?void 0:l.value)||o.message,$exception_type:(u=d[0])===null||u===void 0?void 0:u.type,$exception_level:o.level,$exception_list:g,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((c=d[0])===null||c===void 0?void 0:c.value)||o.message,$sentry_exception_type:(h=d[0])===null||h===void 0?void 0:h.type,$sentry_tags:o.tags};var v;return t&&s&&(m.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+s+"&query="+o.event_id),n&&((v=e.exceptions)===null||v===void 0||v.sendExceptionEvent(m)),o}}var Oc=class{constructor(e,t,s,i,r,n){this.name=qa,this.setupOnce=function(o){o(za(e,{organization:t,projectId:s,prefix:i,severityAllowList:r,sendExceptionsToPostHog:n==null||n}))}}},On=class{constructor(e){this.jo=(t,s,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(E.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Bo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Ho()}Ho(){var e;this.zo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.jo)}destroy(){var e;(e=this.zo)===null||e===void 0||e.call(this),this.zo=void 0}doPageView(e,t){var s;const i=this.Uo(e,t);return this.Bo={pathname:(s=y==null?void 0:y.location.pathname)!==null&&s!==void 0?s:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var t;return this.Uo(e,(t=this.Bo)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Bo)===null||e===void 0?void 0:e.pageViewId}}Uo(e,t){const s=this.Bo;if(!s)return{$pageview_id:t};let i={$pageview_id:t,$prev_pageview_id:s.pageViewId};const r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:c}=r;if(!(b(n)||b(o)||b(a)||b(l)||b(u)||b(c))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);const h=n>1?Be(o/n,0,1,E):1,p=n>
21?Be(a/n,0,1,E):1,d=l>1?Be(u/l,0,1,E):1,g=l>1?Be(c/l,0,1,E):1;i=Y(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:p,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:d,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:g})}}return s.pathname&&(i.$prev_pageview_pathname=s.pathname),s.timestamp&&(i.$prev_pageview_duration=(e.getTime()-s.timestamp.getTime())/1e3),i}};const Ht=["flags","surveys"],Cc={[Nu]:{exposure:"hidden"},[qs]:{exposure:"hidden"},[ju]:{exposure:"hidden"},[Zi]:{exposure:"hidden"},[Te]:{exposure:"hidden"},[fa]:{exposure:"event"},[Xi]:{exposure:"hidden"},[ga]:{exposure:"hidden"},[Qi]:{exposure:"event"},[va]:{exposure:"hidden"},[er]:{exposure:"event"},[tr]:{exposure:"event"},[Mr]:{exposure:"event"},[Pr]:{exposure:"hidden"},[_a]:{exposure:"event"},[Zt]:{exposure:"hidden"},[Bu]:{exposure:"hidden"},[St]:{exposure:"hidden"},[ma]:{exposure:"event"},[Hu]:{exposure:"event",shouldSkipFromEventProperties:e=>re(e)},[Uu]:{exposure:"event"},[Gu]:{exposure:"event"},[Ku]:{exposure:"event"},[Yu]:{exposure:"event"},[Ju]:{exposure:"hidden"},[Ae]:{exposure:"hidden",storageGroup:"flags"},[Ue]:{exposure:"hidden",storageGroup:"flags"},[sr]:{exposure:"hidden"},[gt]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"hidden",storageGroup:"flags"},[_t]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Xt]:{exposure:"hidden",storageGroup:"flags"},[Ne]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[st]:{exposure:"hidden"},[it]:{exposure:"hidden"},[ir]:{exposure:"hidden",storageGroup:"surveys"},[zs]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ba]:{exposure:"event"},[wa]:{exposure:"hidden"},[xa]:{exposure:"hidden"},[rr]:{exposure:"hidden"},[Zu]:{exposure:"hidden"},[Xu]:{exposure:"hidden"},[Qu]:{exposure:"event"},[ec]:{exposure:"event"},[tc]:{exposure:"event"},[sc]:{exposure:"event"},[rt]:{exposure:"hidden"},[Gt]:{exposure:"hidden"},[ya]:{exposure:"event"},[as]:{exposure:"hidden"},[nt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[xe]:{exposure:"hidden"},[nr]:{exposure:"hidden"},[ic]:{exposure:"hidden"},[$a]:{exposure:"hidden"},[ka]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Fr]:{exposure:"hidden"},[qu]:{exposure:"event"},[zu]:{exposure:"event"},[Vu]:{exposure:"event"},[Wu]:{exposure:"event"},[Sa]:{exposure:"event"},[Ma]:{exposure:"event"},[Pa]:{exposure:"event"},[rc]:{exposure:"event"},[nc]:{exposure:"event"},[oc]:{exposure:"event"},[ac]:{exposure:"event"},[lc]:{exposure:"event"},[uc]:{exposure:"event"},[cc]:{exposure:"event"},[hc]:{exposure:"event"}},Ic=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],fe=e=>{const t=Cc[e];if(t)return t;for(const[s,i]of Ic)if(e.indexOf(s)===0)return i},Ft=(e,t)=>{try{let s;return JSON.stringify(e,(i,r)=>{var n;return fs(r)?((n=s)!==null&&n!==void 0||(s=new WeakMap),s.has(r)||s.set(r,Ca(r)),s.get(r)):typeof r=="bigint"?r.toString():r},t)}catch{return vo(e)}},at=e=>{const t=w==null?void 0:w.createElement("a");return b(t)?null:(t.href=e,t)},Tt=function(e,t){const s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let i;for(let r=0;s.length>r;r++){const n=s[r].split("=");if(n[0]===t){i=n;break}}if(!I(i)||2>i.length)return"";{let r=i[1];try{r=decodeURIComponent(r)}catch{E.error("Skipping decoding for malformed query param: "+r)}return r.replace(/\+/g," ")}},hs=function(e,t,s){if(!e||!t||!t.length)return e;const i=e.split("#"),r=i[1],n=(i[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[];for(let h=0;l.length>h;h++){const p=l[h].split("=");I(p)&&(t.includes(p[0])?u.push(p[0]+"="+s):u.push(l[h]))}let c=a;return o!=null&&(c+="?"+u.join("&")),r!=null&&(c+="#"+r),c},Us=function(e,t){const s=e.match(new RegExp(t+"=([^&]*)"));return s?s[1]:null},Va=(e,t)=>e>=t&&fo(),Wa=(e,t,s,i)=>{if(e===0){if(fo()){const r=t+1;return r===s&&i(),r}return t}return 0},At=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Rc=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...At],ds="<masked>",Tc=["li_fat_id"];function Ua(e,t,s){if(!w)return{};const i=t?[...At,...s||[]]:[],r=Ga(hs(w.URL,i,ds),e),n=function(){const o={};return W(Tc,function(a){const l=ar(a);o[a]=l||null}),o}();return Y(n,r)}function Ga(e,t){const s=Rc.concat(t||[]),i={};return W(s,function(r){const n=Tt(e,r);i[r]=n||null}),i}function Ka(e){const t=function(r){return r?r.search("https?://(.*)google.([^/?]*)")===0?"google":r.search("https?://(.*)bing.com")===0?"bing":r.search("https?://(.*)yahoo.com")===0?"yahoo":r.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null}(e),s=t!="yahoo"?"q":"p",i={};if(!re(t)){i.$search_engine=t;const r=w?Tt(w.referrer,s):"";r.length&&(i.ph_keyword=r)}return i}function Ya(){return navigator.language||navigator.userLanguage}function Ac(){const e=Ya();return typeof e=="string"?e.split("-")[0]:void 0}const Gs="$direct";function Ja(){return(w==null?void 0:w.referrer)||Gs}function Za(e,t,s=!1){const i=e?[...At,...t||[]]:[],r=s?ot(ee==null?void 0:ee.href):ee==null?void 0:ee.href,n=r==null?void 0:r.substring(0,1e3);return{r:Ja().substring(0,1e3),u:n?hs(n,i,ds):void 0}}function Xa(e,t=!1){var s;const{r:i,u:r}=e,n=t?ot(r):r,o={$referrer:i,$referring_domain:i==null?void 0:i==Gs?Gs:(s=at(i))===null||s===void 0?void 0:s.host};
vendor: 4,461 bytes, line 2
2if(n){o.$current_url=n;const a=at(n);o.$host=a==null?void 0:a.host,o.$pathname=a==null?void 0:a.pathname;const l=Ga(n);Y(o,l)}if(i){const a=Ka(i);Y(o,a)}return o}function Qa(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Lc(){try{return new Date().getTimezoneOffset()}catch{return}}const Dc={flags:nt,surveys:zs},Nc=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ws=e=>`${e}_cookie_identity_change_pending`,xs=e=>{let t="",s=0;for(const i of e){const r=encodeURIComponent(JSON.stringify(i).slice(1,-1)).length;if(s+r>1e3)break;t+=i,s+=r}return t},ue="main",We=[Ae,Ue,gt,tt,_t,nt,Xt,st],$i=e=>We.indexOf(e)!==-1,Xe=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},wt=e=>{if(!e)return{};const t=JSON.parse(e);return L(t)?t:{}},Cn=(e,t)=>{W(e,(s,i)=>{const r=fe(i);r&&r.exposure!=="event"||{}.hasOwnProperty.call(t,i)||delete e[i]})};var ki=class{constructor(e,t,s=!0){if(this.Wo={},this.Vo=!1,this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=new Map,this.Xo=!1,this.Yo=!1,this.tl=!1,this.el=!1,this.il=new Set,this.Mr=e,this.nl=s,this.props={},this.sl=void 0,this.rl=(i=>{let r="";return i.token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"})(e),this.Fo=this.ol(e),this.Zo=this.ll(e),this.load(),this.al(),e.debug&&E.info("Persistence loaded",e.persistence,f({},this.props)),this.update_config(e,e,t),this.save(),y){const i=()=>this.flush();H(y,"beforeunload",i,{capture:!1}),H(y,"pagehide",i,{capture:!1}),this.ul=r=>{if(this.Vo&&(!r.storageArea||r.storageArea===(y==null?void 0:y.localStorage))&&r.key)if(r.key!==this.rl){if(this.Zo){const n=Ht.find(o=>r.key===this.hl(o));n&&this.cl(r.key,n)}}else this.cl(r.key,ue)},H(y,"storage",this.ul)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,s])=>{const i=this.Ko.get(t);if(!$i(t)||i===!0)return;if(s===!0)return void this.dl(t,!0);const r=new Set(i||[]);s.forEach(n=>r.add(n)),r.size&&this.dl(t,r)})}onCrossTabFeatureFlagChange(e){return this.il.add(e),()=>this.il.delete(e)}destroy(){this.ul&&y&&(y.removeEventListener("storage",this.ul),this.ul=void 0),this.il.clear()}cl(e,t,s=!0){if(this.pi)return!1;let i,r;try{if(r=N.Ot(e),re(r)){const a=this.vl(t);return a.storageValue=null,t!==ue&&(a.persisted=!1),!1}i=wt(r)}catch{return!1}const n=t===ue?i:N.Dt(this.rl);if(n&&this.fl(n))return!1;const o=this.pl(i,t,s);return t===ue&&this.Zo&&!Xe(this.gl().main,i)||this.ml(i,t,!0,r),o}fl(e){const t=this.props[Re],s=e[Re];return!b(t)&&!b(s)&&t!==s}ml(e,t,s,i){const r=this.vl(t);r.storageValue=i,t!==ue&&(r.persisted=s);try{r.fingerprint=this.yl(e,t)}catch{r.fingerprint=void 0}}pl(e,t,s){let i=!1;return We.forEach(r=>{var n;const o=(n=fe(r))===null||n===void 0?void 0:n.storageGroup;if(t===ue&&this.Zo&&o||t!==ue&&o!==t)return;const a=r in e,l=this.bl(r,a?e[r]:void 0),u=this.Ko.has(r)?r in this.props:a;u===r in this.props&&Xe(l,this.props[r])||(u?this._l(r,l,!1):this.wl(r,!1),i=!0)}),i&&s&&this.il.forEach(r=>r()),i}kl(){if(!this.Vo)return!1;try{this.tl=!1;const e=N.Ot(this.rl),t=this.vl(ue);let s,i=!1,r=!1;if(e!==t.storageValue)if(re(e))t.storageValue=null;else{if(s=wt(e),this.tl=!this.Yo&&this.fl(s),this.tl)return!1;r=this.pl(s,ue,!1),!this.Zo||Xe(this.gl().main,s)?this.ml(s,ue,!0,e):t.storageValue=e,i=!0}return this.Zo&&Ht.forEach(n=>{const o=N.Ot(this.hl(n)),a=this.vl(n),l=s||{},u=i&&We.some(h=>{var p;return((p=fe(h))===null||p===void 0?void 0:p.storageGroup)===n&&h in l});if(o===a.storageValue&&!u)return;if(re(o))return a.storageValue=null,a.persisted=!1,void(u&&(r=this.pl(l,n,!1)||r));const c=wt(o);r=this.pl(c,n,!1)||r,this.ml(c,n,!0,o)}),r}catch{return!1}}dl(e,t){this.Ko.set(e,t);const s=fe(e);s!=null&&s.volatile||(this.vl((this.Zo?s==null?void 0:s.storageGroup:void 0)||ue).fingerprint=void 0,this.Sl(e))}xl(){We.forEach(e=>this.Ko.set(e,!0))}al(){if(this.Vo)try{const e=N.Ot(this.rl),t=wt(e);this.vl(ue).storageValue=e,We.forEach(s=>{var i;const r=this.Zo?(i=fe(s))===null||i===void 0?void 0:i.storageGroup:void 0,n=r?N.Ot(this.hl(r)):null;if(r){const a=this.vl(r);a.storageValue=n,a.persisted=!re(n)}const o=r&&!re(n)?wt(n):t;s in this.props?this.Cl(s,o[s],this.props[s]):s in o&&this.dl(s,!0)})}catch{}}bl(e,t){const s=this.Ko.get(e);if(!s)return t;if(s===!0)return this.props[e];if(e==="$active_feature_flags"){const n=new Set(I(t)?t:[]),o=new Set(I(this.props[e])?this.props[e]:[]);
2return s.forEach(a=>o.has(a)?n.add(a):n.delete(a)),Array.from(n)}const i=L(t)?f({},t):{},r=L(this.props[e])?this.props[e]:{};return s.forEach(n=>{n in r?i[n]=r[n]:delete i[n]}),i}Cl(e,t,s){if(!$i(e))return;const i=this.Ko.get(e);if(i===!0)return;let r=t;if(this.Vo)try{var n;const a=this.Zo?(n=fe(e))===null||n===void 0?void 0:n.storageGroup:void 0,l=a?this.hl(a):this.rl;r=wt(N.Ot(l))[e]}catch{}const o=new Set(i||[]);if(e==="$active_feature_flags"){if(!b(t)&&!I(t)||!b(r)&&!I(r)||!I(s))return void this.dl(e,!0);const a=new Set(t||[]),l=new Set(r||[]),u=new Set(s);new Set([...a,...u]).forEach(c=>{a.has(c)!==u.has(c)&&o.add(c)}),o.forEach(c=>{l.has(c)===u.has(c)&&o.delete(c)})}else{if(!L(s))return void(Xe(r,s)?this.Ko.delete(e):this.dl(e,!0));{if(!b(t)&&!L(t)||b(t)&&ke(s)&&b(r))return void this.dl(e,!0);const a=L(t)?t:{},l=L(r)?r:{};new Set([...Object.keys(a),...Object.keys(s)]).forEach(u=>{u in a==u in s&&Xe(a[u],s[u])||o.add(u)}),o.forEach(u=>{u in l==u in s&&Xe(l[u],s[u])&&o.delete(u)})}}o.size?this.dl(e,o):this.Ko.delete(e)}$l(){var e;const t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return ne(t)&&t>0?t:0}Tl(e){if(this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=bi(e,this.Mr.cookie_persisted_properties||[]),s=gn(t,this.Mr.cookie_persisted_properties||[]),i=JSON.stringify(t)+"|"+JSON.stringify(s),r=Q.Ot(this.rl)||void 0;r&&wi(this.rl,r)===i&&(this.Il=i,this.Ml=r)}catch{}else try{const t=Q.Ot(this.rl)||void 0;this.Il=t?wi(this.rl,t):void 0,this.Ml=t}catch{}}syncCookieProperties(){return this.El(this.Mr)}El(e,t=!1){if(this.pi&&!t||this.Jo||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let s;try{s=Q.Ot(this.rl)||void 0}catch{}if(!s||s===this.Ml)return!1;const i=wi(this.rl,s);let r;try{r=yi(JSON.parse(s))}catch{return!1}if((Q.Ot(this.rl)||void 0)!==s)return!1;this.Il=i,this.Ml=s;const n=_n(this.rl,s),o=[...vt,...n.properties],a={};if(Object.keys(r).forEach(m=>{const v=r[m];(b(v)||re(v)||v===""||m==="$user_state"&&v!=="anonymous"&&v!=="identified")&&(a[m]=!0,delete r[m])}),ke(r))return!1;const l="distinct_id"in r||r.$user_state==="anonymous"||r.$user_state==="identified",u=this.props,c=u[Re],h=u[xe],p=Y({},u);[...vt,...e.cookie_persisted_properties||[]].forEach(m=>{if(o.indexOf(m)!==-1&&!(m in r)&&!a[m]&&(l||m!=="distinct_id"&&m!=="$user_state")){const v=p[m];(n.isValid||vt.indexOf(m)===-1||v!==!1&&v!==0)&&delete p[m]}}),this.props=Y(p,r),We.forEach(m=>{const v=m in this.props;m in u===v&&Xe(u[m],this.props[m])||(v?this.Cl(m,u[m],this.props[m]):this.dl(m,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this._l(xe,Ge);const d=this.props[Re],g=this.props[xe];return!l||d===c&&g===h||(this.Yo=!0,this.Qo=!0,K.At(ws(this.rl),!0),this.wl(st),this.wl(Ue),this.wl(Ae),this.wl(gt),this.wl(tt),this.wl(_t),this.wl(nt),this.wl(as),this.wl(rt),g!=="anonymous"||h!=="identified"&&r.$user_state!=="anonymous"&&(b(c)||d===c)||(Cn(this.props,r),this.wl(it)),g==="identified"?this.props.$user_id=d:delete this.props.$user_id,this.wl(qs)),!0}
2consumeCookieIdentityChange(){const e=ws(this.rl),t=this.Qo||!!K.Ot(e);return this.Qo=!1,t&&K.Lt(e),t}Pl(e=!1){return!(this.Jo||this.pi&&!e||!this.Mr.cookieWinsOnConflict||this.Mr.persistence.toLowerCase()!=="localstorage+cookie"||(this.Jo=!0,0))}Rl(){this.Jo&&(b(this.Al)||(clearTimeout(this.Al),this.Al=void 0),delete this.Wo[ue],this.Fl(!0))}Ol(e=!0){if(this.Jo)try{e?this.Rl():b(this.Al)||(clearTimeout(this.Al),this.Al=void 0)}finally{this.Jo=!1}}isDisabled(){return!!this.pi}ol(e){Nc.indexOf(e.persistence.toLowerCase())===-1&&(E.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((o=[],a=!1)=>{const l=[...vt,...o];return f(f({},N),{},{Dt(u){try{let h,p={};try{h=Q.Ot(u)||void 0,p=h?yi(JSON.parse(h)):{}}catch{}const d=JSON.parse(N.Ot(u)||"{}");let g;if(a){const m=_n(u,h),v=[...vt,...m.properties],_={};Object.keys(p).forEach($=>{const O=p[$];re(O)||O===""||$==="$user_state"&&O!=="anonymous"&&O!=="identified"||(_[$]=O)});const x="distinct_id"in _||_.$user_state==="anonymous"||_.$user_state==="identified";if(Object.keys(_).length>0){var c;const $=d[Re],O=(c=d.$user_state)!==null&&c!==void 0?c:Ge;l.forEach(k=>{if(v.indexOf(k)!==-1&&!(k in p)&&(x||k!=="distinct_id"&&k!=="$user_state")){const P=d[k];(m.isValid||vt.indexOf(k)===-1||P!==!1&&P!==0)&&delete d[k]}}),!x||"$user_state"in p||"$user_state"in d||(d[xe]=Ge),!x||("distinct_id"in _?_[Re]:d[Re])===$&&("$user_state"in _?_[xe]:d[xe])===O||(mi.forEach(k=>delete d[k]),_.$user_state==="identified"&&"distinct_id"in _?d.$user_id=_[Re]:delete d.$user_id,_.$user_state!=="identified"&&(delete d[ya],delete d[it]),delete d.__alias)}g=Y(d,_)}else g=Y(p,d);return N.At(u,g),g}catch{}return null},At(u,c,h,p,d,g){const m=N.At(u,c,void 0,void 0,g);try{const v=bi(c,o);if(Object.keys(v).length){if(a){const _=Ws(u),x=gn(v,o);if(Q.At(_,x,h,p,d,g),Q.Ot(_)!==JSON.stringify(x)){Q.Lt(_,p);const $=bi(c);return Q.At(u,$,h,p,d,g),m}}Q.At(u,v,h,p,d,g)}}catch(v){N.Pt(v)}return m},Lt(u,c){try{y==null||y.localStorage.removeItem(u),Q.Lt(u,c),Q.Lt(Ws(u),c)}catch(h){N.Pt(h)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let s,i=!1,r=!1;const n=e.persistence.toLowerCase();return n==="localstorage"&&N.Et()?(s=N,r=!0):n==="localstorage+cookie"&&t.Et()?(s=t,r=!0,i=!0):n==="sessionstorage"&&K.Et()?s=K:n==="memory"?s=ur:n==="cookie"&&Q.Et()?(s=Q,i=!0):t.Et()?(s=t,r=!0,i=!0):Q.Et()?(s=Q,i=!0):s=ur,this.Vo=r,this.Go=i,s}hl(e){return`${this.rl}__${e}`}ll(e){return this.Vo&&!!e.split_storage}properties(){const e={};return W(this.props,(t,s)=>{const i=fe(s);if(!i||i.exposure==="event"){var r;if(!(i==null||(r=i.shouldSkipFromEventProperties)===null||r===void 0)&&r.call(i,t))return;e[s]=t}}),e}load(e=!1){if(this.pi&&!e)return;const t=this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie",s=t?N.Dt(this.rl):null;let i={};if(t)try{i=yi(Q.Dt(this.rl)),W(i,(a,l)=>{(b(a)||re(a)||a==="")&&delete i[l]})}catch{}const r=this.Fo.Dt(this.rl);if(r&&(this.props=Y({},r)),this.Zo&&this.Dl(),t&&r){var n,o;const a=s==null?void 0:s[Re],l=(n=s==null?void 0:s.$user_state)!==null&&n!==void 0?n:Ge,u=r[Re],c=(o=r.$user_state)!==null&&o!==void 0?o:Ge;if(u!==a||c!==l){this.Qo=!0,K.At(ws(this.rl),!0);const h=Y({},this.props);mi.forEach(d=>delete h[d]),c!=="anonymous"||l!=="identified"&&i.$user_state!=="anonymous"&&(b(a)||u===a)||(Cn(h,i),delete h[it]),this.props=h;const p=new Set;mi.forEach(d=>{var g;const m=(g=fe(d))===null||g===void 0?void 0:g.storageGroup;m&&p.add(m)}),p.forEach(d=>{const g={};W(this.props,(m,v)=>{var _;((_=fe(v))===null||_===void 0?void 0:_.storageGroup)===d&&(g[v]=m)}),ke(g)?(N.Lt(this.hl(d)),this.Wo[d]={}):N.At(this.hl(d),g)&&(this.Wo[d]={persisted:!0,fingerprint:this.yl(g,d)})})}}K.Ot(ws(this.rl))&&(this.Qo=!0)}Dl(){for(const e of Ht){const t=N.Dt(this.hl(e));if(t&&!ke(t)){const s=this.vl(e);s.persisted=!0,this.Ll(e)||(s.fingerprint=this.yl(t,e)),this.Nl(e,t)||Y(this.props,t)}}}Ll(e){return Object.keys(this.props).some(t=>{var s;return((s=fe(t))===null||s===void 0?void 0:s.storageGroup)===e})}Nl(e,t){const s=Dc[e];if(!s)return!1;const i=t[s],r=this.props[s];return ne(i)&&ne(r)&&r>i}refreshKey(e){var t;if(this.pi||e==="$fbc_persistence"&&this.el)return;const s=this.Zo?(t=fe(e))===null||t===void 0?void 0:t.storageGroup:void 0,i=s?N.Dt(this.hl(s)):this.Fo.Dt(this.rl);if(i&&e in i)this._l(e,i[e],!1);else{if(s){const r=this.Fo.Dt(this.rl);if(r&&e in r)return void this._l(e,r[e],!1)}this.wl(e,!1)}}save(){if(this.pi)return;const e=this.$l();e>0?b(this.Al)&&(this.Al=setTimeout(()=>{this.Al=void 0,this.Fl()},e)):this.Fl()}flush(){b(this.Al)||(clearTimeout(this.Al),this.Al=void 0,this.Fl())}Fl(e=!1){if(this.pi||this.Jo&&!e)return;e||(this.syncCookieProperties(),this.el||this.Mr.cookieWinsOnConflict&&this.Mr.persistence.toLowerCase()==="localstorage+cookie"||this.refreshKey(Te));const t=!e&&!this.Xo;t||(this.tl=!1);const s=!!t&&this.kl();if(this.tl)return void(this.Mr.debug&&E.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Zo)return this.ql(),void(s&&this.il.forEach(r=>r()));const i=this.jl(this.Fo,this.rl,this.props,ue);i==="written"&&this.Tl(this.props),i!=="failed"&&(this.Ko.clear(),this.Yo=!1,this.el=!1),s&&this.il.forEach(r=>r())}ql(){const{main:e,groups:t}=this.gl(),s=this.jl(this.Fo,this.rl,e,ue);s==="written"&&this.Tl(e),s!=="failed"&&(this.Yo=!1,this.el=!1,We.forEach(r=>{var n;!((n=fe(r))===null||n===void 0)&&n.storageGroup||this.Ko.delete(r)}));for(const r of Ht){var i;const n=t[r];
vendor: 4,227 bytes, line 2
2if(ke(n)&&!(!((i=this.Wo[r])===null||i===void 0)&&i.persisted)){We.forEach(a=>{var l;((l=fe(a))===null||l===void 0?void 0:l.storageGroup)===r&&this.Ko.delete(a)});continue}const o=this.jl(N,this.hl(r),n,r);o!=="failed"&&We.forEach(a=>{const l=fe(a);(l==null?void 0:l.storageGroup)!==r||o!=="written"&&l.volatile||this.Ko.delete(a)})}}gl(){const e={},t={flags:{},surveys:{}};return W(this.props,(s,i)=>{var r;const n=(r=fe(i))===null||r===void 0?void 0:r.storageGroup;n?t[n][i]=s:e[i]=s}),{main:e,groups:t}}yl(e,t){if(t===ue)return JSON.stringify(e)+"|"+this.Bl+"|"+this.Hl+"|"+this.zl;const s={};return W(e,(i,r)=>{var n;s[r]=!((n=fe(r))===null||n===void 0)&&n.volatile?"__volatile__":i}),JSON.stringify(s)}jl(e,t,s,i){const r=this.vl(i);if(i!==ue&&!r.dirty&&!b(r.fingerprint))return"skipped";let n;try{if(n=this.yl(s,i),n===r.fingerprint)return r.dirty=!1,"skipped"}catch{n=void 0}return e.At(t,s,this.Bl,this.Hl,this.zl,this.Mr.debug)?(r.dirty=!1,i!==ue&&(r.persisted=!0),b(n)||(r.fingerprint=n),this.Vo&&(r.storageValue=N.Ot(t)),"written"):(this.Mr.debug&&E.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.xl(),b(this.Al)||(clearTimeout(this.Al),this.Al=void 0),this.Fo.Lt(this.rl,!1),this.Fo.Lt(this.rl,!0),!e&&this.nl)for(const t of Ht)N.Lt(this.hl(t));e?delete this.Wo[ue]:this.Wo={},this.Il=void 0,this.Ml=void 0}clear(){this.remove(),this.props={}}register_once(e,t,s){if(L(e)){this.syncCookieProperties(),b(t)&&(t="None"),this.Bl=b(s)?this.Ul:s;let i=!1;if(W(e,(r,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this._l(n,r),i=!0)}),i)return this.save(),!0}return!1}register(e,t){if(L(e)){this.syncCookieProperties(),this.Bl=b(t)?this.Ul:t;let s=!1;if(W(e,(i,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==i||L(i)||I(i))&&(this._l(r,i),s=!0)}),s)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t=typeof e=="string"?[e]:e;let s=!1;for(const i of t)i in this.props&&(this.wl(i),s=!0);s&&this.save()}update_campaign_params(){const e=w==null?void 0:w.URL;if(e===this.sl)return;const t=Ua(this.Mr.custom_campaign_params,this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties),s=!ke(Ir(t));return s&&this.register(t),this.sl=e,s?t:void 0}update_search_keyword(){this.register(function(){const e=w==null?void 0:w.referrer;return e?Ka(e):{}}())}update_referrer_info(){var e;this.register_once({$referrer:Ja(),$referring_domain:(w==null?void 0:w.referrer)&&((e=at(w.referrer))===null||e===void 0?void 0:e.host)||Gs},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=Za(this.Mr.mask_personal_data_properties,this.Mr.custom_personal_data_properties,this.Mr.disable_capture_url_hashes);this.register_once({[Mt]:this.Go?{r:xs(e.r),u:e.u?xs(e.u):void 0}:e},void 0)}get_initial_props(){const e={};W([ka,$a],s=>{const i=this.props[s];i&&W(i,function(r,n){e["$initial_"+zi(n)]=r})});const t=this.props[Mt];if(t){const s=function(i,r=!1){const n=Xa(i,r),o={};return W(n,function(a,l){o[`$initial_${zi(l)}`]=a}),o}(t,this.Mr.disable_capture_url_hashes);Y(e,s)}return e}safe_merge(e){return W(this.props,function(t,s){s in e||(e[s]=t)}),e}update_config(e,t,s){const i=e.persistence!==t.persistence,r=!((d,g)=>{if(d.length!==g.length)return!1;const m=[...d].sort(),v=[...g].sort();return m.every((_,x)=>_===v[x])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=i||r,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!s,l=!!this.pi&&!a;a||this.El(t,l),this.Mr=e,!a&&(i||r||o)&&(this.Il=void 0,this.Ml=void 0,this.El(f(f({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));const u=n||o?this.ol(e):this.Fo;this.Wl();const c=this.ll(e),h=n||c!==this.Zo,p=!a&&(h||e.cross_subdomain_cookie!==this.Hl||e.secure_cookie!==this.zl)&&this.Pl(l);this.Xo=h;try{if(this.Ul=this.Bl=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),h){const d=this.props;this.clear(),this.Fo=u,this.Zo=c,this.props=d,this.save()}else o&&(this.Fo=u,a||(delete this.Wo[ue],this.Fl()))}finally{this.Xo=!1,p&&this.Ol()}}
2Wl(){const e=this.props[Mt];if(!this.Go||!L(e)||typeof e.r!="string")return;const t=xs(e.r),s=typeof e.u=="string"?xs(e.u):e.u;t===e.r&&s===e.u||this._l(Mt,f(f({},e),{},{r:t,u:s}))}set_disabled(e){this.pi=e,this.pi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Hl&&(this.Hl=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.zl&&(this.zl=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const s=this.props.__timers||{};s[e]=t,this._l(Zi,s),this.save()}remove_event_timer(e){const t=this.props.__timers||{},s=t[e];return b(s)||(delete t[e],this._l(Zi,t),this.save()),s}get_property(e){return this.props[e]}set_property(e,t){this._l(e,t),this.save()}_l(e,t,s=!0){var i;const r=this.props[e];this.props[e]=t,s&&(e!=="distinct_id"&&e!=="$user_state"||r===t||(this.Yo=!0),e!=="$fbc_persistence"||Xe(r,t)||(this.el=!0),this.Cl(e,r,t),!((i=fe(e))===null||i===void 0)&&i.volatile||this.Sl(e))}wl(e,t=!0){delete this.props[e],t&&($i(e)&&this.dl(e,!0),e==="$fbc_persistence"&&(this.el=!0),this.Sl(e))}Sl(e){var t;const s=(t=fe(e))===null||t===void 0?void 0:t.storageGroup;s&&(this.vl(s).dirty=!0)}vl(e){return this.Wo[e]||(this.Wo[e]={})}};const Me={GZipJS:"gzip-js",Base64:"base64"},qt={Activation:"events",Cancellation:"cancelEvents"},Ei={Popover:"popover",API:"api",Widget:"widget"},Ke={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Si={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},dr={Popover:"popover",Inline:"inline"};function $s(e){let t=!0;return{dispose(){if(t){t=!1;const s=e();s&&de(s.then)&&s.then(void 0,()=>{})}}}}const jc={SHOWN:"product tour shown"},In={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Rn=se("[RateLimiter]");var Bc=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const s=t.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(i=>{Rn.info(`${i||"events"} is quota limited.`),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void Rn.warn(`could not rate limit - continuing. Error: "${i==null?void 0:i.message}"`,{text:s})}},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,s,i;const{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=new Date().getTime(),a=(t=(s=this.instance.persistence)===null||s===void 0?void 0:s.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);const l=1>a.tokens;if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){const u=(ne(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this.Vl(u)&&(a.dropped=0)}return this.lastEventRateLimited=l,(i=this.instance.persistence)===null||i===void 0||i.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Gl(e){const t=this.instance.config.property_denylist;return!I(t)||!t.includes(e)}Zl(){var e;if(this.Gl("$current_url")&&this.Gl("$pathname")&&(ee!=null&&ee.pathname))return`${(e=ee.origin)!==null&&e!==void 0?e:""}${ee.pathname}`}Vl(e){var t,s;const{captureEventsBurstLimit:i,captureEventsPerSecond:r}=this,n=this.Zl(),o=this.Gl("$session_id")?(t=(s=this.instance).get_session_id)===null||t===void 0?void 0:t.call(s):void 0,a=[`${e} event(s) dropped since the last warning`,n?`triggered on ${n}`: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 ${r} events per second and ${i} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}};const Qe=se("[RemoteConfig]");var el=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=C._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Ql(e){var t,s,i;!((t=C.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(s=C.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Jl(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 Qe.info("Using preloaded remote config",this.remoteConfig),void this.Kl(this.remoteConfig);if(this._instance.Xl())return void Qe.warn("Remote config is disabled. Falling back to local config.");this.Ql(e=>{if(!e)return Qe.info("No config found after loading remote JS config. Falling back to JSON."),void this.Jl(t=>{this.Kl(t.json,t)});this.Kl(e)})}catch(e){Qe.error("Error loading remote config",e),this.Kl()}}Kl(e,t){!e&&t&&(t.statusCode===0?t.error||Qe.warn("Failed to fetch remote config from PostHog."):Qe.error("Failed to fetch remote config from PostHog."));try{this._instance.Kl(e?{ok:!0,config:e}:{ok:!1})}catch(i){Qe.error("Error applying remote config",i)}if((e==null?void 0:e.hasFeatureFlags)!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var s;(s=this._instance.featureFlags)===null||s===void 0||s.ensureFlagsLoaded()}catch(i){Qe.error("Error loading feature flags",i)}}},Oe=Uint8Array,Ee=Uint16Array,Lt=Uint32Array,Dr=new Oe([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Nr=new Oe([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Tn=new Oe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tl=function(e,t){for(var s=new Ee(31),i=0;31>i;++i)s[i]=t+=1<<e[i-1];var r=new Lt(s[30]);for(i=1;30>i;++i)for(var n=s[i];s[i+1]>n;++n)r[n]=n-s[i]<<5|i;return[s,r]},sl=tl(Dr,2),pr=sl[1];sl[0][28]=258,pr[258]=28;
vendor: 4,283 bytes, line 2
2for(var An=tl(Nr,0)[1],il=new Ee(32768),te=0;32768>te;++te){var xt=(43690&te)>>>1|(21845&te)<<1;il[te]=((65280&(xt=(61680&(xt=(52428&xt)>>>2|(13107&xt)<<2))>>>4|(3855&xt)<<4))>>>8|(255&xt)<<8)>>>1}var ts=function(e,t,s){for(var i=e.length,r=0,n=new Ee(t);i>r;++r)++n[e[r]-1];var o,a=new Ee(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;for(o=new Ee(i),r=0;i>r;++r)o[r]=il[a[e[r]-1]++]>>>15-e[r];return o},mt=new Oe(288);for(te=0;144>te;++te)mt[te]=8;for(te=144;256>te;++te)mt[te]=9;for(te=256;280>te;++te)mt[te]=7;for(te=280;288>te;++te)mt[te]=8;var Ks=new Oe(32);for(te=0;32>te;++te)Ks[te]=5;var Hc=ts(mt,9),qc=ts(Ks,5),rl=function(e){return(e/8|0)+(7&e&&1)},nl=function(e,t,s){(s==null||s>e.length)&&(s=e.length);var i=new(e instanceof Ee?Ee:e instanceof Lt?Lt:Oe)(s-t);return i.set(e.subarray(t,s)),i},qe=function(e,t,s){var i=t/8|0;e[i]|=s<<=7&t,e[i+1]|=s>>>8},zt=function(e,t,s){var i=t/8|0;e[i]|=s<<=7&t,e[i+1]|=s>>>8,e[i+2]|=s>>>16},Mi=function(e,t){for(var s=[],i=0;e.length>i;++i)e[i]&&s.push({s:i,f:e[i]});var r=s.length,n=s.slice();if(!r)return[new Oe(0),0];if(r==1){var o=new Oe(s[0].s+1);return o[s[0].s]=1,[o,1]}s.sort(function(k,P){return k.f-P.f}),s.push({s:-1,f:25001});var a=s[0],l=s[1],u=0,c=1,h=2;for(s[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=r-1;)a=s[s[h].f>s[u].f?u++:h++],l=s[u!=c&&s[h].f>s[u].f?u++:h++],s[c++]={s:-1,f:a.f+l.f,l:a,r:l};var p=n[0].s;for(i=1;r>i;++i)n[i].s>p&&(p=n[i].s);var d=new Ee(p+1),g=fr(s[c-1],d,0);if(g>t){i=0;var m=0,v=g-t,_=1<<v;for(n.sort(function(k,P){return d[P.s]-d[k.s]||k.f-P.f});r>i;++i){var x=n[i].s;if(t>=d[x])break;m+=_-(1<<g-d[x]),d[x]=t}for(m>>>=v;m>0;){var $=n[i].s;t>d[$]?m-=1<<t-d[$]++-1:++i}for(;i>=0&&m;--i){var O=n[i].s;d[O]==t&&(--d[O],++m)}g=t}return[new Oe(d),g]},fr=function(e,t,s){return e.s==-1?Math.max(fr(e.l,t,s+1),fr(e.r,t,s+1)):t[e.s]=s},Ln=function(e){for(var t=e.length;t&&!e[--t];);for(var s=new Ee(++t),i=0,r=e[0],n=1,o=function(l){s[i++]=l},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[s.subarray(0,i),t]},Vt=function(e,t){for(var s=0,i=0;t.length>i;++i)s+=e[i]*t[i];return s},vr=function(e,t,s){var i=s.length,r=rl(t+2);e[r]=255&i,e[r+1]=i>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;i>n;++n)e[r+n+4]=s[n];return 8*(r+4+i)},Dn=function(e,t,s,i,r,n,o,a,l,u,c){qe(t,c++,s),++r[256];for(var h=Mi(r,15),p=h[0],d=h[1],g=Mi(n,15),m=g[0],v=g[1],_=Ln(p),x=_[0],$=_[1],O=Ln(m),k=O[0],P=O[1],F=new Ee(19),S=0;x.length>S;++S)F[31&x[S]]++;for(S=0;k.length>S;++S)F[31&k[S]]++;for(var M=Mi(F,7),D=M[0],j=M[1],q=19;q>4&&!D[Tn[q-1]];--q);var U,G,oe,Z,ae=u+5<<3,le=Vt(r,mt)+Vt(n,Ks)+o,X=Vt(r,p)+Vt(n,m)+o+14+3*q+Vt(F,D)+(2*F[16]+3*F[17]+7*F[18]);if(le>=ae&&X>=ae)return vr(t,c,e.subarray(l,l+u));if(qe(t,c,1+(le>X)),c+=2,le>X){U=ts(p,d),G=p,oe=ts(m,v),Z=m;var B=ts(D,j);for(qe(t,c,$-257),qe(t,c+5,P-1),qe(t,c+10,q-4),c+=14,S=0;q>S;++S)qe(t,c+3*S,D[Tn[S]]);c+=3*q;for(var ie=[x,k],_e=0;2>_e;++_e){var he=ie[_e];for(S=0;he.length>S;++S)qe(t,c,B[z=31&he[S]]),c+=D[z],z>15&&(qe(t,c,he[S]>>>5&127),c+=he[S]>>>12)}}else U=Hc,G=mt,oe=qc,Z=Ks;for(S=0;a>S;++S)if(i[S]>255){var z;zt(t,c,U[257+(z=i[S]>>>18&31)]),c+=G[z+257],z>7&&(qe(t,c,i[S]>>>23&31),c+=Dr[z]);var me=31&i[S];zt(t,c,oe[me]),c+=Z[me],me>3&&(zt(t,c,i[S]>>>5&8191),c+=Nr[me])}else zt(t,c,U[i[S]]),c+=G[i[S]];return zt(t,c,U[256]),c+G[256]},zc=new Lt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Vc=function(){for(var e=new Lt(256),t=0;256>t;++t){for(var s=t,i=9;--i;)s=(1&s&&3988292384)^s>>>1;e[t]=s}return e}(),Pi=function(e,t,s){for(;s;++t)e[t]=s,s>>>=8};function Wc(e,t){t===void 0&&(t={});var s=function(){var h=4294967295;return{p(p){for(var d=h,g=0;p.length>g;++g)d=Vc[255&d^p[g]]^d>>>8;h=d},d(){return 4294967295^h}}}(),i=e.length;s.p(e);var r,n,o,a,l,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,function(h,p,d,g,m,v){var _=h.length,x=new Oe(g+_+5*(1+Math.floor(_/7e3))+m),$=x.subarray(g,x.length-m),O=0;if(!p||8>_)for(var k=0;_>=k;k+=65535){var P=k+65535;_>P?O=vr($,O,h.subarray(k,P)):($[k]=v,O=vr($,O,h.subarray(k,_)))}else{for(var F=zc[p-1],S=F>>>13,M=8191&F,D=(1<<d)-1,j=new Ee(32768),q=new Ee(D+1),U=Math.ceil(d/3),G=2*U,oe=function(ri){return(
vendor: 5,305 bytes, line 2
2h[ri]^h[ri+1]<<U^h[ri+2]<<G)&D},Z=new Lt(25e3),ae=new Ee(288),le=new Ee(32),X=0,B=0,ie=(k=0,0),_e=0,he=0;_>k;++k){var z=oe(k),me=32767&k,Se=q[z];if(j[me]=Se,q[z]=me,k>=_e){var Ce=_-k;if((X>7e3||ie>24576)&&Ce>423){O=Dn(h,$,0,Z,ae,le,B,ie,he,k-he,O),ie=X=B=0,he=k;for(var ve=0;286>ve;++ve)ae[ve]=0;for(ve=0;30>ve;++ve)le[ve]=0}var Pe=2,lt=0,Ml=M,Je=me-Se&32767;if(Ce>2&&z==oe(k-Je))for(var Pl=Math.min(S,Ce)-1,Fl=Math.min(32767,k),Ol=Math.min(258,Ce);Fl>=Je&&--Ml&&me!=Se;){if(h[k+Pe]==h[k+Pe-Je]){for(var Ze=0;Ol>Ze&&h[k+Ze]==h[k+Ze-Je];++Ze);if(Ze>Pe){if(Pe=Ze,lt=Je,Ze>Pl)break;var Cl=Math.min(Je,Ze-2),Br=0;for(ve=0;Cl>ve;++ve){var ii=k-Je+ve+32768&32767,Hr=ii-j[ii]+32768&32767;Hr>Br&&(Br=Hr,Se=ii)}}}Je+=(me=Se)-(Se=j[me])+32768&32767}if(lt){Z[ie++]=268435456|pr[Pe]<<18|An[lt];var qr=31&pr[Pe],zr=31&An[lt];B+=Dr[qr]+Nr[zr],++ae[257+qr],++le[zr],_e=k+Pe,++X}else Z[ie++]=h[k],++ae[h[k]]}}O=Dn(h,$,v,Z,ae,le,B,ie,he,k-he,O)}return nl(x,0,g+rl(O)+m)}(n=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l,!0)),c=u.length;return function(h,p){var d=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&&Pi(h,4,Math.floor(new Date(p.mtime||Date.now())/1e3)),d){h[3]=8;for(var g=0;d.length>=g;++g)h[g+10]=d.charCodeAt(g)}}(u,t),Pi(u,c-8,s.d()),Pi(u,c-4,i),u}const Uc=!!br||!!ns,ol=new WeakMap,al="text/plain";let Fi=0,Is=!1;const ll=(e,t)=>{const[s,i]=e.split("#"),[r,n]=s.split("?");if(!n)return e;const o=n.split("&").filter(a=>a.split("=")[0]!==t).join("&");return`${r}${o?`?${o}`:""}${i?`#${i}`:""}`},gs=(e,t,s=!0)=>{var i;const[r,n]=e.split("?"),o=f({},t),a=(i=n==null?void 0:n.split("&").map(u=>{var c;const[h,p]=u.split("="),d=s&&(c=o[h])!==null&&c!==void 0?c:p;return delete o[h],`${h}=${d}`}))!==null&&i!==void 0?i:[],l=function(u,c="&"){let h,p;const d=[];return W(u,function(g,m){b(g)||b(m)||m==="undefined"||(h=encodeURIComponent((v=>v instanceof File)(g)?g.name:g.toString()),p=encodeURIComponent(m),d[d.length]=p+"="+h)}),d.join(c)}(o);return l&&a.push(l),a.length>0?`${r}?${a.join("&")}`:r},Oi=e=>{if(e.Yl)return e.Yl;const{data:t,compression:s}=e;if(!t)return;if(s===Me.GZipJS){const r=Wc(function(n){var o=n.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(n);for(var a=new Oe(n.length+(n.length>>>1)),l=0,u=function(d){a[l++]=d},c=0;o>c;++c){if(l+5>a.length){var h=new Oe(l+8+(o-c<<1));h.set(a),a=h}var p=n.charCodeAt(c);128>p?u(p):2048>p?(u(192|p>>>6),u(128|63&p)):p>55295&&57344>p?(u(240|(p=65536+(1047552&p)|1023&n.charCodeAt(++c))>>>18),u(128|p>>>12&63),u(128|p>>>6&63),u(128|63&p)):(u(224|p>>>12),u(128|p>>>6&63),u(128|63&p))}return nl(a,0,l)}(Ft(t)),{mtime:0});return{contentType:al,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(s===Me.Base64){const r=function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,(a,l)=>String.fromCharCode(parseInt(l,16))))}(Ft(t)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:Ft(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}const i=Ft(t);return{contentType:"application/json",body:i,estimatedSize:new Blob([i]).size}},ul=e=>{const t=()=>e.transport==="sendBeacon"?{url:gs(e.url,{compression:Me.Base64}),encodedBody:Oi(f(f({},e),{},{compression:Me.Base64,Yl:void 0}))}:{url:ll(e.url,"compression"),encodedBody:Oi(f(f({},e),{},{compression:void 0,Yl:void 0}))};let s;try{s=Oi(e)}catch(r){if(on(e.compression,Tt(e.url,"compression")))return E.error("Failed to gzip request body, sending uncompressed payload",r),t();throw r}return s&&on(e.compression,Tt(e.url,"compression"))&&!((i=s.body)instanceof ArrayBuffer?Yi(new Uint8Array(i)):ArrayBuffer.isView(i)&&Yi(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?(Is=!0,t()):{url:e.url,encodedBody:s};var i},cl=e=>{try{return ul(e)}catch(s){var t;return E.error(s),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:s}))}},Gc=function(){var e=J(function*(t){const s=yield function(r){return Ji.apply(this,arguments)}(Ft(t.data),ce.DEBUG,{rethrow:!0});if(!s)return t;const i=yield s.arrayBuffer();return f(f({},t),{},{Yl:{contentType:al,body:i,estimatedSize:i.byteLength}})});return function(t){return e.apply(this,arguments)}}(),Kc=/Failed to fetch|NetworkError|Load failed/i,hl=e=>(e==null?void 0:e.name)==="TypeError"&&Kc.test((e==null?void 0:e.message)||""),dl=e=>{const t=cl(e);if(!t)return;const s=new br;ol.set(s,!0);const{url:i,encodedBody:r}=t;s.open(e.method||"GET",i,!0);const{contentType:n,body:o}=r??{};W(e.headers,function(a,l){s.setRequestHeader(l,a)}),n&&s.setRequestHeader("Content-Type",n),e.timeout&&(s.timeout=e.timeout),s.onreadystatechange=()=>{if(s.readyState===4){var a;const l={statusCode:s.status,text:s.responseText};if(s.status===200)try{l.json=JSON.parse(s.responseText)}catch{}(a=e.callback)===null||a===void 0||a.call(e,l)}},s.send(o)},pl=e=>{const t=cl(e);if(!t)return;const{url:s,encodedBody:i}=t,{contentType:r,body:n,estimatedSize:o}=i??{},a=new Headers;W(e.headers,function(d,g){a.append(g,d)}),r&&a.append("Content-Type",r);let l=null,u=!1;if(Vr){const d=new Vr;l={signal:d.signal,timeout:setTimeout(()=>{var g;u=!0,d.abort(Ko("AbortError","PostHog request timed out"+((g=e.timeout)?` after ${g}ms`:"")))}
2,e.timeout)}}const c=d=>{var g;u&&(d==null?void 0:d.name)==="AbortError"||hl(d)?E.warn(d):E.error(d),(g=e.callback)===null||g===void 0||g.call(e,{statusCode:0,error:d})};let h=0;const p=()=>{Fi-=h,h=0,l&&clearTimeout(l.timeout)};try{const d=f({method:(e==null?void 0:e.method)||"GET",headers:a,body:n,signal:l==null?void 0:l.signal},e.fetchOptions),g=o??(b(n)?0:void 0);d.keepalive=d.method==="POST"&&!e.ta&&d.keepalive!==!1&&d.body===n&&!b(g)&&g>=0&&52428.8>Fi+g,d.keepalive&&(h=g,Fi+=h),ns(s,d).then(m=>m.text().then(v=>{var _;const x={statusCode:m.status,text:v};if(m.status===200)try{x.json=JSON.parse(v)}catch($){E.error($)}p(),(_=e.callback)===null||_===void 0||_.call(e,x)})).catch(m=>{p(),c(m)}).finally(p)}catch(d){p(),c(d)}},gr=e=>{try{var t;const{url:s,encodedBody:i}=ul(e),{contentType:r,body:n,estimatedSize:o}=i??{};if(!n)return;const a=n instanceof Blob?n:new Blob([n],{type:r});if(pe.sendBeacon(s,a))return;const l=I(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(I(l)&&l.length>1&&(o??0)>16384){const u=Math.ceil(l.length/2),c=h=>I(e.data)?h:f(f({},e.data),{},{batch:h});return gr(f(f({},e),{},{data:c(l.slice(0,u))})),void gr(f(f({},e),{},{data:c(l.slice(u))}))}E.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${ns?"fetch":"XHR"}`),ns?pl(f(f({},e),{},{ta:!0})):dl(e)}catch(s){E.warn("Beacon send failed",s)}},Nn=(e,t,s,i)=>{const r=i==="query"?t==="POST"?"sent_at":"_":void 0;return gs(s===Me.GZipJS?ll(e,"compression"):e,f(f({},r?{[r]:Date.now().toString()}:{}),s===Me.GZipJS?{}:{compression:s}))},Yc=(()=>{const e=[];return ns&&e.push({transport:"fetch",method:pl}),br&&e.push({transport:"XHR",method:dl}),pe!=null&&pe.sendBeacon&&e.push({transport:"sendBeacon",method:gr}),e})();var Jc=class{constructor(e,t){this.ea=!0,this.ia=[],this.na=Be((t==null?void 0:t.flush_interval_ms)||3e3,250,5e3,E.createLogger("flush interval"),3e3),this.sa=e}enqueue(e){this.ia.push(e),this.ra||this.oa()}unload(){this.la();const e=this.ia.length>0?this.aa():{},t=Object.values(e);[...t.filter(s=>s.url.indexOf("/e")===0),...t.filter(s=>s.url.indexOf("/e")!==0)].map(s=>{this.ua(f(f({},s),{},{transport:"sendBeacon"}))})}enable(){this.ea=!1,this.oa()}oa(){this.ea||(this.ra=setTimeout(()=>{if(this.la(),this.ia.length>0){const e=this.aa();for(const t in e)this.ua(e[t])}},this.na))}ua(e){try{this.sa(e)}catch(t){E.error(t)}}la(){clearTimeout(this.ra),this.ra=void 0}aa(){const e={};return W(this.ia,t=>{var s;const i=t,r=((i?i.batchKey:null)||i.url)+(i.batchGroup?`:${i.batchGroup}`:"");b(e[r])&&(e[r]=f(f({},i),{},{data:[]})),(s=e[r].data)===null||s===void 0||s.push(i.data)}),this.ia=[],e}};const Zc=["retriesPerformedSoFar"];var Xc=class{constructor(e){this._instance=e,this.ha=!1,this.ca=3e3,this.ia=[],this.ia=[],this.da=!0,this.resume()}resume(){if(!b(y)&&"onLine"in y.navigator){if(this.da=y.navigator.onLine,this.va)return;this.va=()=>{this.da=!0,this.fa()},this.pa=()=>{this.da=!1},H(y,"online",this.va),H(y,"offline",this.pa)}}get length(){return this.ia.length}retriableRequest(e){let{retriesPerformedSoFar:t}=e,s=ia(e,Zc);Ve(t)&&(s.url=gs(s.url,{retry_count:t})),this._instance._send_request(f(f({},s),{},{callback:i=>{var r;if(i.statusCode!==200&&(400>i.statusCode||i.statusCode>=500)){if((i.statusCode===0?3:10)>(t??0))return void this.Ls(f({retriesPerformedSoFar:t},s));i.statusCode===0&&E.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${t??0} retries.`)}(r=s.callback)===null||r===void 0||r.call(s,i)}}))}Ls(e){const t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;const s=function(n){const o=3e3*Math.pow(2,n),a=o/2,l=Math.min(18e5,o),u=(Math.random()-.5)*(l-a);return Math.ceil(l+u)}(t),i=Date.now()+s;this.ia.push({retryAt:i,requestOptions:e});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),E.warn(r),this.ha||(this.ha=!0,this.ga())}ga(){if(this.ma&&clearTimeout(this.ma),this.ia.length===0)return this.ha=!1,void(this.ma=void 0);this.ma=setTimeout(()=>{this.da&&this.ia.length>0&&this.fa(),this.ga()},this.ca)}fa(){const e=Date.now(),t=[],s=this.ia.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.ia=t,s.length>0)for(const{requestOptions:i}of s)this.retriableRequest(i)}unload(){this.ma&&(clearTimeout(this.ma),this.ma=void 0),this.ha=!1,b(y)||(this.va&&(y.removeEventListener("online",this.va),this.va=void 0),this.pa&&(y.removeEventListener("offline",this.pa),this.pa=void 0));for(const{requestOptions:e}of this.ia)try{this._instance._send_request(f(f({},e),{},{transport:"sendBeacon"}))}catch(t){E.error(t)}this.ia=[]}},Qc=class{constructor(e){this._instance=e,this.ya=()=>{var t,s,i,r;this.ba||(this.ba={});const n=this.scrollElement(),o=this.scrollY(),a=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=o+((n==null?void 0:n.clientHeight)||0),u=(n==null?void 0:n.scrollHeight)||0;this.ba.lastScrollY=Math.ceil(o),this.ba.maxScrollY=Math.max(o,(t=this.ba.maxScrollY)!==null&&t!==void 0?t:0),this.ba.maxScrollHeight=Math.max(a,(s=this.ba.maxScrollHeight)!==null&&s!==void 0?s:0),this.ba.lastContentY=l,this.ba.maxContentY=Math.max(l,(i=this.ba.maxContentY)!==null&&i!==void 0?i:0),this.ba.maxContentHeight=Math.max(u,(r=this.ba.maxContentHeight)!==null&&r!==void 0?r:0)}}get _a(){return this._instance.config.scroll_root_selector}getContext(){return this.ba}resetContext(){const e=this.ba;return this.ba=void 0,setTimeout(this.ya,0),e}startMeasuringScrollPosition(){H(y,"scroll",this.ya,{capture:!0}),H(y,"scrollend",this.ya,{capture:!0}),H(y,"resize",this.ya)}scrollElement(){if(this._a){const s=I(this._a)?this._a:[this._a];for(const i of s){var e;const r=y==null||(e=y.document)===null||e===void 0?void 0:e.querySelector(i);if(r)return r}return}var t;return y==null||(t=y.document)===null||t===void 0?void 0:t.documentElement}wa(e){var t,s;const i=e==="y"?"scrollTop":"scrollLeft";if(this._a){const r=this.scrollElement();return r&&r[i]||0}return y?e==="y"?y.scrollY||y.pageYOffset||((t=y.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:y.scrollX||y.pageXOffset||((s=y.document)===null||s===void 0||(s=s.documentElement)===null||s===void 0?void 0:s.scrollLeft)||0:0}scrollY(){return this.wa("y")}scrollX(){return this.wa("x")}};const eh=e=>Za(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
vendor: 4,502 bytes, line 2
2);var jn=class{constructor(e,t,s,i){this.je=r=>{const n=this.ka();if(n&&n.sessionId===r)return;const o={sessionId:r,props:this.Sa(this._instance)};this.xa.register({[nr]:o})},this._instance=e,this.Ca=t,this.xa=s,this.Sa=i||eh,this.Ca.onSessionId(this.je)}ka(){return this.xa.props[nr]}getSetOnceProps(){var e;const t=(e=this.ka())===null||e===void 0?void 0:e.props;return t?"r"in t?Xa(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(){const e={};return W(Ir(this.getSetOnceProps()),(t,s)=>{s==="$current_url"&&(s="url"),e[`$session_entry_${zi(s)}`]=t}),e}},Ys=class{on(e,t){return this.$a[e]||(this.$a[e]=[]),this.$a[e].push(t),()=>{this.$a[e]=this.$a[e].filter(s=>s!==t)}}emit(e,t){for(const s of this.$a[e]||[])s(t);for(const s of this.$a["*"]||[])s(e,t)}constructor(){this.$a={}}};const $t=se("[SessionId]"),Bn=864e5;var Hn=class{on(e,t){return this.Ta.on(e,t)}constructor(e,t,s){var i;if(this.Ia=null,this.Ma=null,this.Ea=[],this.Pa=void 0,this.Ra=!1,this.Ta=new Ys,this.Aa=(n,o)=>!(!Ve(n)||!Ve(o))&&Math.abs(n-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.xa=e.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Fa=void 0,this._sessionActivityTimestamp=null,this.Oa=t||Le,this.Da=s||Le;const r=this.Mr.persistence_name||this.Mr.token;if(this._sessionTimeoutMs=1e3*Be(this.Mr.session_idle_timeout_seconds||1800,60,36e3,$t.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.La(),this.Na="ph_"+r+"_window_id",this.qa="ph_"+r+"_primary_window_exists",this.ja()){const n=K.Dt(this.Na),o=K.Dt(this.qa);n&&!o?this.Be=n:K.Lt(this.Na),K.At(this.qa,!0)}!((i=this.Mr.bootstrap)===null||i===void 0)&&i.sessionID&&this.setBootstrapSessionId(this.Mr.bootstrap.sessionID),this.Ba()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return b(this.Ea)&&(this.Ea=[]),this.Ea.push(e),this.Xt&&e(this.Xt,this.Be),()=>{this.Ea=this.Ea.filter(t=>t!==e)}}ja(){return this.Mr.persistence!=="memory"&&!this.xa.pi&&K.Et()}Ha(e){e!==this.Be&&(this.Be=e,this.ja()&&K.At(this.Na,e))}za(){return this.Be?this.Be:this.ja()?K.Dt(this.Na):null}Ua(e){const t=this.Ia;return!re(t)&&!re(e)&&5e3>Math.abs(e-t)}Wa(e,t,s){const i=t!==this._sessionActivityTimestamp,r=!(e!==this.Xt||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=t,this.Xt=e,r&&!i||r&&this.Ua(t)||(this.Ia=t,this.xa.register({[St]:[t,e,s]}))}Va(){var e;const t=(e=this.Mr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return Ve(t)&&t>0}Ga(){this.Va()?this.xa.refreshKey(St):(this.xa.flush(),this.xa.load())}Za(){var e;if(re(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ia)return;this.Ga();const[,t,s]=this.Qa();t===this.Xt&&s===this._sessionStartTimestamp&&(this.Ia=this._sessionActivityTimestamp,this.xa.register({[St]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.xa.flush())}Ja(){const[e]=this.Qa(),t=Ve(e)?e:0,s=Ve(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,s)}Ka(e){return this.Ga(),this.Aa(e,this.Ja())}Qa(){const e=this.xa.props[St];return I(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ia=null,this.Fa=void 0,clearTimeout(this.Xa),this.Xa=void 0,this.Wa(null,null,null)}setBootstrapSessionId(e,t=!1){const s=((i,r=new Date().getTime())=>{try{const n=(o=>{const 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)})(i);return n>r+6e4?void $t.error("Bootstrap sessionID cannot be in the future"):n}catch(n){return void $t.error("Invalid sessionID in bootstrap",n)}})(e);return!b(s)&&(t?this.Fa={sessionId:e,sessionStartTimestamp:s}:this.Wa(e,new Date().getTime(),s),!0)}destroy(){this.Ra=!0,this.Za(),clearTimeout(this.Xa),this.Xa=void 0,this.Pa&&y&&(y.removeEventListener(Vs,this.Pa,{capture:!1}),this.Pa=void 0),this.Ea=[]}Ba(){this.Pa=()=>{this.Za(),this.ja()&&K.Lt(this.qa)},H(y,Vs,this.Pa,{capture:!1})}
2checkAndGetSessionAndWindowId(e=!1,t=null,s=!1){if(this.Mr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const i=t||new Date().getTime(),r=this.Xt;if(s)this.Ma=i;else if(re(this.Ma)||this.Ma>i||i-this.Ma>=1e3){var n,o;(n=(o=this.xa).syncCookieProperties)===null||n===void 0||n.call(o),this.Ma=i}let[,a,l]=this.Qa();const u=!b(r)&&a!==r,c=this.Ja();let h=this.za();const p=this.Fa,d=!!p&&(p.sessionStartTimestamp>i+6e4||i-p.sessionStartTimestamp>Bn),g=p?d:Ve(l)&&Math.abs(i-l)>Bn;let m=!1,v=u;const _=!a||!!p,x=a;let $=!_&&!e&&this.Aa(i,c);if($&&($=this.Ka(i),$||$t.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.Qa()),_||$||g){v=!1;const F=p&&!d;a=F?p.sessionId:this.Oa(),h=this.Da(),$t.info("new session ID assigned",{sessionId:a,windowId:h,bootstrapped:!!F,changeReason:{noSessionId:_,activityTimeout:$,sessionPastMaximumLength:g}}),l=F?p.sessionStartTimestamp:i,this.Fa=void 0,m=!0}else h||(h=this.Da(),m=!0),v=v||a!==x,v&&($t.info("adopted cross-tab session id",{sessionId:a,windowId:h}),m=!0);const O=Ve(c)&&e&&!g?c:i,k=Ve(l)?l:new Date().getTime();this.Ha(h),this.Wa(a,O,k),e||this.La();const P={noSessionId:_,activityTimeout:$,sessionPastMaximumLength:g,crossTabAdoption:v};return m&&this.Ea.forEach(F=>F(a,h,P)),{sessionId:a,windowId:h,sessionStartTimestamp:k,changeReason:m?P:void 0,lastActivityTimestamp:c}}La(){this.Ra||(clearTimeout(this.Xa),this.Xa=setTimeout(()=>{if(!this.Ra)if(this.Ka(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:e})}else this.La()},1.1*this.sessionTimeoutMs))}};const fl=function(e,t){if(!e)return!1;const s=e.userAgent;if(s&&Ur(s,t))return!0;try{const i=e==null?void 0:e.userAgentData;if(i!=null&&i.brands&&i.brands.some(r=>Ur(r==null?void 0:r.brand,t)))return!0}catch{}return!!e.webdriver};function vl(){return(vl=J(function*(){const e=pe==null?void 0:pe.userAgentData;if(e!=null&&e.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),s=t==null?void 0:t.model;return A(s)&&s.length>0?s:void 0}catch(t){return void E.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function th(e,t){let s=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(s=`$survey_${t}/${e.id}/${e.current_iteration}`),s}function gl(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)}const Js=(e,t)=>{if(!(s=>{try{new RegExp(s)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},ks=e=>e.toLowerCase(),_l={exact:(e,t)=>t.some(s=>e.some(i=>s===i)),is_not:(e,t)=>t.every(s=>e.every(i=>s!==i)),regex:(e,t)=>t.some(s=>e.some(i=>Js(s,i))),not_regex:(e,t)=>t.every(s=>e.every(i=>!Js(s,i))),icontains:(e,t)=>t.map(ks).some(s=>e.map(ks).some(i=>s.includes(i))),not_icontains:(e,t)=>t.map(ks).every(s=>e.map(ks).every(i=>!s.includes(i))),gt:(e,t)=>t.some(s=>{const i=parseFloat(s);return!isNaN(i)&&e.some(r=>i>parseFloat(r))}),lt:(e,t)=>t.some(s=>{const i=parseFloat(s);return!isNaN(i)&&e.some(r=>i<parseFloat(r))})};function ml(e,t){return!e||Object.entries(e).every(([s,i])=>{const r=t==null?void 0:t[s];if(r==null)return!1;const n=_l[i.operator];return!!n&&n(i.values,[String(r)])})}function Ci(e,t,s){return Ft({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:s})}const _r="custom",qn="i.posthog.com",sh=/^\/static\//,ih=["/s/","/e/","/i/"];var rh=class{constructor(e){this.Ya={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const 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(`.${qn}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Ya[this.apiHost]||(this.Ya[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":_r),this.Ya[this.apiHost]}tu(e){if(!sh.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}
2eu(e){const t=at(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}iu(e,t,s){if(e==="ui")return s;let i=s;const r=this.instance.config.rewriteRequestPath;if(r){var n;const o=((n=at(s))===null||n===void 0?void 0:n.href)||s;i=r(new URL(o)).toString()}if(r&&e==="api"&&ih.some(o=>t.indexOf(o)===0)){const o=this.eu(i);if(o){const a=this.apiHost;let l=this.nu;(l==null?void 0:l.apiHost)===a&&l.rewriteRequestPath===r||(l={apiHost:a,rewriteRequestPath:r,urls:new Set},this.nu=l),l.urls.add(o)}}return i}isIngestionEndpoint(e){const t=this.nu,s=this.eu(e);return(t==null?void 0:t.apiHost)===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!s&&t.urls.has(s)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this.iu(e,t,this.uiHost+t);if(e==="flags")return this.iu(e,t,this.flagsApiHost+t);if(e==="assets"){const i=this.tu(t);if(i)return this.iu(e,t,`${i}${t}`)}if(this.region===_r)return this.iu(e,t,this.apiHost+t);const s=qn+t;switch(e){case"assets":return this.iu(e,t,`https://${this.region}-assets.${s}`);case"api":return this.iu(e,t,`https://${this.region}.${s}`)}}};const V=se("[Surveys]"),yl=e=>{try{const t=(s=>((i,r)=>`seenSurvey_${function(n){return n.current_iteration&&n.current_iteration>0?`${n.id}_${n.current_iteration}`:n.id}(r)}`)(0,s))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){V.error("Failed to persist survey seen state",t)}},nh=[Ei.Popover,Ei.Widget,Ei.API],oh={ignoreConditions:!1,ignoreDelay:!1,displayType:dr.Popover},ah=se("[PostHog ExternalIntegrations]"),lh={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var uh=class{constructor(e){this._instance=e}No(e,t){var s,i;(s=C.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,e,r=>{if(r)return ah.error("failed to load script",r);t()})}startIfEnabledOrStop(){var e;for(const[r,n]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,s,i;n&&!(!((t=C.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[r])&&this.No(lh[r],()=>{var o;(o=C.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[r])===null||o===void 0||o.start(this._instance)}),!n&&(!((s=C.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0)&&s[r])&&((i=C.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0||(i=i[r])===null||i===void 0||i.stop())}}},ch=class{constructor(e,t){this.$=e,this.po=t,this.su=new Map,this.So=!1}add(e){var t=this;return J(function*(){if(t.So)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.su.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.su.set(e.name,e);try{const s=e.setup(t.po);s&&(yield s)}catch(s){const i=t.su.get(e.name)===e;i&&t.su.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,s),i&&t.ru(e)}})()}getExtension(e){return this.su.get(e)}dispose(){if(this.So)return;this.So=!0;const e=Array.from(this.su.values()).reverse();this.su.clear();for(const t of e)this.ru(t)}ru(e){try{var t;const s=(t=e.dispose)===null||t===void 0?void 0:t.call(e);s&&de(s.then)&&s.then(void 0,i=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,i)})}catch(s){this.$.error(`Failed to dispose browser extension "${e.name}"`,s)}}},hh=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if(typeof e=="string")return t==null?void 0:t.get_property(e);const s={};for(const i of e){const r=t==null?void 0:t.get_property(i);b(r)||(s[i]=r)}return s}set(e,t){var s;(s=this._instance.persistence)===null||s===void 0||s.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}};const zn="extensionsRemoteConfig";var dh=class{constructor(e){this.instance=e,this.So=!1,this.$=E,this.ou=e.lu,this.kv=new hh(e),this.onEvent=t=>$s(this.instance.on("eventCaptured",s=>{try{t({event:s.event,properties:s.properties})}catch(i){this.$.error("Browser extension event listener failed",i)}})),this.onRemoteConfig=t=>{if(this.So)return $s(()=>{});const s=r=>{try{t(r)}catch(n){this.$.error("Browser extension remote config listener failed",n)}},i=this.instance.au.on(zn,s);return this.ou&&s(this.ou),$s(i)},this.uu=new ch(E.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}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(){const e=this.instance.get_property(Sr);return typeof e=="string"?e:void 0}get library(){return{name:ce.LIB_NAME,version:ce.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,s,i;const r=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=r==null?void 0:r.sessionId)!==null&&t!==void 0?t:"",windowId:(s=r==null?void 0:r.windowId)!==null&&s!==void 0?s:"",sessionStartTimestamp:(i=r==null?void 0:r.sessionStartTimestamp)!==null&&i!==void 0?i: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.uu.add(e)}getExtension(e){return this.uu.getExtension(e)}capture(e,t,s){var i=this;return J(function*(){s?i.instance.capture(e,t,{timestamp:s.timestamp,uuid:s.uuid,$set:s.set,$set_once:s.setOnce}):i.instance.capture(e,t)})()}registerDynamicEventProperties(e){return $s(this.instance.hu(e))}handleRemoteConfig(e){this.So||(this.ou=e,this.instance.au.emit(zn,e))}sendRequest(e){var t=this;return J(function*(s,i={}){var r;const n=t.instance.requestRouter.endpointFor((r=i.target)!==null&&r!==void 0?r:"api",s),o={method:i.method,url:i.query?gs(n,i.query):n,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:i.target==="flags"&&i.compression==="best-available"?qi.Base64:void 0,timestampMode:i.sentAt};return i.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.So||(this.So=!0,this.uu.dispose())}};const ss={};let Ii=0;const is=()=>{}
2,Vn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Wt="Surveys module not available",Wn="sanitize_properties is deprecated. Use before_send instead",bl="Invalid value for property_denylist config: ",ph=/^[A-Za-z0-9_-]{1,400}$/,Ri=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,fh=["token","distinct_id",Ea],Kt="posthog";let wl=!Uc&&(we==null?void 0:we.indexOf("MSIE"))===-1&&(we==null?void 0:we.indexOf("Mozilla"))===-1;const vh=e=>{const 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},Ti=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:fc(w==null?void 0:w.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:is,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:ee&&A(ee==null?void 0:ee.search)&&ee.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:(y==null||(t=y.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,surveys_request_timeout_ms:1e4,on_request_error(s){E.error("Bad HTTP status: "+s.statusCode+" "+s.text)},get_device_id:s=>s,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Fa,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:is},(s=>({rageclick:s&&s>="2026-05-30"?{content_ignorelist:xc,ignore_text_selection:!0}
2:!s||"2025-11-30">s||{content_ignorelist:!0},capture_pageview:!s||"2025-05-24">s||"history_change",session_recording:vh(s),external_scripts_inject_target:s&&s>="2026-01-30"?"head":"body",internal_or_test_user_hostname:s&&s>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:s&&s>="2026-05-30"?250:0,split_storage:!(!s||"2026-05-30">s),detect_google_search_app:!(!s||"2026-05-30">s),disable_capture_url_hashes:!(!s||"2026-06-25">s),cookieWinsOnConflict:!(!s||s==="unset"||"2026-08-29">s)}))(e))},gh=[["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"]],Un=e=>{const t={};for(const[r,n]of gh)b(e[r])||(t[n]=e[r]);const s=Y({},t,e),i=e.__preview_external_dependency_versioned_paths;return b(i)||(b(e.strict_script_versioning)&&(s.strict_script_versioning=!!i),A(i)&&b(e.asset_host)&&(s.asset_host=i)),I(e.property_blacklist)&&(b(e.property_denylist)?s.property_denylist=e.property_blacklist:I(e.property_denylist)?s.property_denylist=[...e.property_blacklist,...e.property_denylist]:E.error(bl+e.property_denylist)),s};var _h=class{constructor(){this.__forceAllowLocalhost=!1}get cu(){return this.__forceAllowLocalhost}set cu(e){E.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},rs=class et{du(t){if(!t)return;const s=this.su.indexOf(t);s!==-1&&this.su.splice(s,1)}vu(t,s){var i;return this.du(t),this.su.push(s),(i=s.initialize)===null||i===void 0||i.call(s),s}fu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}pu(){if(this.gu||this.config.reuseAnonymousId||this.config.segment||this.fu())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.mu)return;let s,i,r;t?(s=`persistence is set to '${this.config.persistence}'`,i=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",r="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(s="persistence is disabled (disable_persistence is true)",i="on every page load",r="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gu=!0}yu(){if(this.fu()||this.get_distinct_id()!=="$posthog_cookieless")return;const t=this.persistence;if(!t)return;this.bu()||t.load(!0);const s=this.get_distinct_id();if(!s||s==="$posthog_cookieless"){const i=this.config.get_device_id(Le());this.register({distinct_id:i,$device_id:i}),t.set_property(xe,Ge)}this._u()}get decideEndpointWasHit(){var t,s;return(t=(s=this.featureFlags)===null||s===void 0?void 0:s.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,s;return(t=(s=this.featureFlags)===null||s===void 0?void 0:s.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.wu=!1,this.ku=!1,this.webPerformance=new _h,this.Su=!1,this.version=ce.LIB_VERSION,this.xu=new Set,this.Cu="",this.au=new Ys,this.su=[],this.$u=[],this.mu=!1,this.gu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ti(),this.SentryIntegration=Oc,this.sentryIntegration=i=>function(r,n){const o=za(r,n);return{name:qa,processEvent:a=>o(a)}}(this,i),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Iu=null,this.Mu=null,this.Eu=null,this.scrollManager=new Qc(this),this.pageViewManager=new On(this),this.rateLimiter=new Bc(this),this.requestRouter=new rh(this),this.consent=new wc(this),this.externalIntegrations=new uh(this);const s=(t=et.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=s.featureFlags&&new s.featureFlags(this),this.toolbar=s.toolbar&&new s.toolbar(this),this.surveys=s.surveys&&new s.surveys(this),this.conversations=s.conversations&&new s.conversations(this),this.logs=s.logs&&new s.logs(this),this.metrics=s.metrics&&new s.metrics(this),this.experiments=s.experiments&&new s.experiments(this),this.exceptions=s.exceptions&&new s.exceptions(this),this.people={set:(i,r,n)=>{const o=A(i)?{[i]:r}:i;this.setPersonProperties(o),n==null||n({})},set_once:(i,r,n)=>{const o=A(i)?{[i]:r}:i;this.setPersonProperties(void 0,o),n==null||n({})}},this.on("eventCaptured",i=>E.info(`send "${i==null?void 0:i.event}"`,i))}init(t,s,i){if(i&&i!==Kt){var r;const n=(r=ss[i])!==null&&r!==void 0?r:new et;return n._init(t,s,i),ss[i]=n,ss[Kt][i]=n,n}return this._init(t,s,i)}_init(t,s={},i){var r,n,o;const a=A(t)?t.trim():"";if(!a)return E.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(l=this.config)===null||l===void 0||l.token,this;this.__loaded=!0,this.config=Ti(s.defaults),s.debug=this.Pu(s.debug),this.Ru=s,this.Au=[],s.person_profiles?this.Mu=s.person_profiles:s.process_person&&(this.Mu=s.process_person);const u=Ti(s.defaults),c=Un(s),h=Y({},u,c,{name:i,token:a});L(u.rageclick)&&L(c.rageclick)&&(h.rageclick=Y({},u.rageclick,c.rageclick)),L(u.session_recording)&&L(c.session_recording)&&(h.session_recording=Y({},u.session_recording,c.session_recording)),this.set_config(h),this.config.on_xhr_error&&E.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=s.disable_compression?void 0:Me.GZipJS;const p=this.bu();if(this.persistence=new ki(this.config,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ki(f(f({},this.config),{},{persistence:"sessionStorage"}),p,!1),this.Cu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!p&&K.Et()){const _=K.Dt(this.Cu);I(_)&&_.forEach(x=>{A(x)&&this.xu.add(x)})}else K.Lt(this.Cu);const d=f({},this.persistence.props),g=f({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Fu=new Jc(_=>this.Ou(_),this.config.request_queue_config),this.Du=new Xc(this),this.__request_queue=[];const m=this.fu();m||(this.sessionManager=new Hn(this),this.sessionPropsManager=new jn(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((_,x,$)=>{($!=null&&$.activityTimeout||$!=null&&$.sessionPastMaximumLength||$!=null&&$.crossTabAdoption)&&this.Lu()})),this.Nu(),this.config.__preview_deferred_init_extensions?(E.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.qu(m)},0)):(E.info("Initializing extensions synchronously"),this.qu(m)),ce.DEBUG=ce.DEBUG||this.config.debug,ce.DEBUG&&E.info("Starting in debug mode",{this:this,config:s,thisC:f({},this.config),p:d,s:g}),this.config.identity_distinct_id&&!(!((r=s.bootstrap)===null||r===void 0)&&r.distinctID)&&(s.bootstrap=f(f({},s.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const v=(n=s.bootstrap)===null||n===void 0?void 0:n.distinctID;if(this.mu=!!v&&!Yt(v),(o=s.bootstrap)===null||o===void 0?void 0:o.distinctID){const _=s.bootstrap.distinctID,x=this.get_distinct_id(),$=this.persistence.get_property(xe);if(s.bootstrap.isIdentifiedID&&x!=null&&x!==_&&$==="anonymous")this.identify(_);else if(s.bootstrap.isIdentifiedID&&x!=null&&x!==_&&$==="identified")E.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{const O=this.config.get_device_id(Le()),k=s.bootstrap.isIdentifiedID?O:_;this.persistence.set_property(xe,s.bootstrap.isIdentifiedID?Os:Ge),this.register({distinct_id:_,$device_id:k})}}if(m)this.register_once({distinct_id:gi,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(Le());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(xe,Ge)}return H(y,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),H(y,"pageshow",()=>{var _;this.wu=!1,this.ku||(_=this.Du)===null||_===void 0||_.resume()}),s.segment?Fn(this,()=>this.ju()):this.ju(),de(this.config._onCapture)&&this.config._onCapture!==is&&(E.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this.config.ip&&E.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 vl.a
2pply(this,arguments)}().then(_=>{_&&this.register({[vi]:_})}).catch(is),this}Bu(t){const s=t;return A(s.name)&&de(s.setup)}Hu(t,s){this.Bu(t)?s.push(()=>{this.zu().add(t).catch(()=>{var i;return(i=t.dispose)===null||i===void 0?void 0:i.call(t)}).catch(i=>{E.error(`Failed to dispose browser extension "${t.name}"`,i)})}):this.su.push(t)}Nu(){var t,s,i;const r=(t=(s=this.config.__extensionClasses)===null||s===void 0?void 0:s.featureFlags)!==null&&t!==void 0?t:(i=et.__defaultExtensionClasses)===null||i===void 0?void 0:i.featureFlags;var n,o,a;r&&(this.featureFlags&&this.featureFlags instanceof r||((n=this.Uu)===null||n===void 0||n.call(this),this.Uu=void 0,this.featureFlags=new r(this)),de(this.featureFlags.onReloading)&&de(this.featureFlags.setup)?this.Uu||(this.Uu=this.featureFlags.onReloading(()=>{this.au.emit("featureFlagsReloading",!0)}),this.zu().add(this.featureFlags)):(o=(a=this.featureFlags).initialize)===null||o===void 0||o.call(a))}qu(t){const s=performance.now(),i=f(f({},et.__defaultExtensionClasses),this.config.__extensionClasses),r=[];var n,o,a,l,u,c,h;i.exceptions&&this.su.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new i.exceptions(this)),i.historyAutocapture&&this.su.push(this.historyAutocapture=new i.historyAutocapture(this)),i.tracingHeaders&&this.su.push(this.tracingHeaders=new i.tracingHeaders(this)),i.siteApps&&this.su.push(this.siteApps=new i.siteApps(this)),i.sessionRecording&&!t&&this.su.push(this.sessionRecording=new i.sessionRecording(this)),this.config.disable_scroll_properties||r.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),i.autocapture&&this.Hu(this.autocapture=new i.autocapture(this),r),i.surveys&&this.Hu(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new i.surveys(this),r),i.logs&&this.Hu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new i.logs(this),r),i.metrics&&this.su.push(this.metrics=(l=this.metrics)!==null&&l!==void 0?l:new i.metrics(this)),i.conversations&&this.su.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new i.conversations(this)),i.productTours&&this.su.push(this.productTours=new i.productTours(this)),i.heatmaps&&this.su.push(this.heatmaps=new i.heatmaps(this)),i.webVitalsAutocapture&&this.su.push(this.webVitalsAutocapture=new i.webVitalsAutocapture(this)),i.exceptionObserver&&this.su.push(this.exceptionObserver=new i.exceptionObserver(this)),i.deadClicksAutocapture&&this.su.push(this.deadClicksAutocapture=new i.deadClicksAutocapture(this,Fc)),i.toolbar&&this.su.push(this.toolbar=(c=this.toolbar)!==null&&c!==void 0?c:new i.toolbar(this)),i.experiments&&this.su.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new i.experiments(this)),this.su.forEach(p=>{p.initialize&&r.push(()=>{var d;(d=p.initialize)===null||d===void 0||d.call(p)})}),r.push(()=>{if(this.Wu){const p=this.Wu;this.Wu=void 0,this.su.forEach(d=>{var g;return(g=d.onRemoteConfig)===null||g===void 0?void 0:g.call(d,p)})}}),this.Vu(r,s)}Vu(t,s){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-s>=30&&t.length>0)return void setTimeout(()=>{this.Vu(t,s)},0);const r=t.shift();if(r)try{r()}catch(n){E.error("Error initializing extension:",n)}}const i=Math.round(performance.now()-s);this.register_for_session({[Sa]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ma]:i}),this.config.__preview_deferred_init_extensions&&E.info(`PostHog extensions initialized (${i}ms)`)}Kl(t){var s;if(!w||!w.body)return E.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Kl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Wu=t),this.lu=t,this.compression=void 0,t.ok){var i;const r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=R(r.supportedCompression,Me.GZipJS)?Me.GZipJS:R(r.supportedCompression,Me.Base64)?Me.Base64:void 0),!((i=r.analytics)===null||i===void 0)&&i.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Mu?this.Mu:Fa}),(s=this.Gu)===null||s===void 0||s.handleRemoteConfig(t),this.su.forEach(r=>{var n;return(n=r.onRemoteConfig)===null||n===void 0?void 0:n.call(r,t)})}ju(){try{this.config.loaded(this)}catch(t){E.critical("`loaded` function failed",t)}if(this.Zu(),this.config.internal_or_test_user_hostname&&(ee==null?void 0:ee.hostname)){const t=ee.hostname,s=this.config.internal_or_test_user_hostname;(typeof s=="string"?t===s:s.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.fu())&&this.Qu()},1),this.Ju=new el(this),this.Ju.load()}Zu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Fu)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&Pt(this.__request_queue,t=>this.Ou(t)),this.__request_queue=[],this.Zu()}_handle_unload(){var t,s,i,r,n,o;this.wu=!0,(t=this.surveys)===null||t===void 0||(s=t.handlePageUnload)===null||s===void 0||s.call(t),(i=this.metrics)===null||i===void 0||i.flush("sendBeacon"),this.config.request_batching?(this.Ku()&&this.capture(pn),(r=this.logs)===null||r===void 0||r.flushLogs("sendBeacon"),(n=this.Fu)===null||n===void 0||n.unload(),(o=this.Du)===null||o===void 0||o.unload()):this.Ku()&&this.capture(pn,null,{transport:"sendBeacon"})}_send_request(t){var s,i,r;this.__loaded?wl?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((i=t.callback)===null||i===void 0||i.call(t,{statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=f(f({},this.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(s=this.compression)!==null&&s!==void 0?s:t.compressionFallback:t.compression,(b(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,
2(n=>{var o,a,l;const u=f({},n);u.timeout=u.timeout||6e4;const c=(o=u.transport)!==null&&o!==void 0?o:"fetch";c==="sendBeacon"&&b(u.compression)&&u.data&&(u.compression=Me.Base64),u.method==="POST"&&u.data&&(u.timestampMode==="capture-body"?u.data=(g=>{var m,v;const _=(I(g)?g:[g]).map($=>f(f({},$),$.timestamp instanceof Date&&!isNaN($.timestamp.getTime())?{timestamp:$.timestamp.toISOString()}:{})),x=_[0];return{api_key:(m=x==null||(v=x.properties)===null||v===void 0?void 0:v.token)!==null&&m!==void 0?m:x==null?void 0:x.token,batch:_,sent_at:new Date().toISOString()}})(u.data):u.timestampMode==="body"&&(u.data=((g,m=new Date().toISOString())=>I(g)?g.map(v=>f(f({},v),{},{sent_at:m})):f(f({},g),{},{sent_at:m}))(u.data))),u.url=Nn(u.url,u.method,u.compression,u.timestampMode);const h=Yc.filter(g=>!u.disableTransport||!g.transport||!u.disableTransport.includes(g.transport)),p=(a=(l=function(g,m){for(let v=0;g.length>v;v++)if(m(g[v]))return g[v]}(h,g=>g.transport===c))===null||l===void 0?void 0:l.method)!==null&&a!==void 0?a:h[0].method;if(!p)throw new Error("No available transport method");const d=g=>{try{p(g)}catch(v){var m;hl(v)?E.warn(v):E.error(v),(m=u.callback)===null||m===void 0||m.call(u,{statusCode:0,error:v})}};c!=="sendBeacon"&&u.data&&u.compression===Me.GZipJS&&Il&&typeof Promise<"u"&&!Is?Gc(u).then(g=>{d(g)}).catch(g=>{if(an(g))return Is=!0,void d(f(f({},u),{},{compression:void 0,url:Nn(n.url,n.method,void 0,n.timestampMode)}));(m=>{if(!m||typeof m!="object")return!1;const v="name"in m?String(m.name):"";return an(m)||v===ta})(g)&&(Is=!0),d(u)}):p(u)})(f(f({},t),{},{callback:n=>{var o,a,l;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(a=(l=this.config).on_request_error)===null||a===void 0||a.call(l,n),(o=t.callback)===null||o===void 0||o.call(t,n)}}))):t.fireCallbackOnDrop&&((r=t.callback)===null||r===void 0||r.call(t,{statusCode:0}))}Ou(t){this.Du?this.Du.retriableRequest(t):this._send_request(t)}_execute_array(t){Ii++;try{let s;const i=[],r=[],n=[];Pt(t,a=>{if(a)if(s=a[0],I(s))n.push(a);else if(de(a))try{a.call(this)}catch(l){E.error("Error executing queued PostHog call",a,l)}else I(a)&&s==="alias"?i.push(a):I(a)&&s.indexOf("capture")!==-1&&de(this[s])?n.push(a):r.push(a)});const o=function(a,l){Pt(a,function(u){try{if(I(u[0])){let c=l;W(u,function(h){c=c[h[0]].apply(c,h.slice(1))})}else l[u[0]].apply(l,u.slice(1))}catch(c){E.error("Error executing queued PostHog call",u,c)}})};o(i,this),o(r,this),o(n,this)}finally{Ii--}}push(t){if(Ii>0&&I(t)&&A(t[0])){const s=et.prototype[t[0]];return void(de(s)&&s.apply(this,t.slice(1)))}this._execute_array([t])}Xu(){var t;const s=(t=this.persistence)===null||t===void 0?void 0:t.get_property(Te);return A(s)&&Ri.test(s)?{value:s,delivered:!1}:L(s)&&A(s.value)&&Ri.test(s.value)?{value:s.value,delivered:s.delivered===!0}:void 0}Yu(t,s,i,r){if(!this.persistence)return;this.persistence.refreshKey(Te);const n=this.Xu();if(!r){if(i)return A(s)&&Ri.test(s)?(s!==(n==null?void 0:n.value)&&this.persistence.register({[Te]:{value:s,delivered:!1}}),{value:s,pending:s!==(n==null?void 0:n.value)||!n.delivered}):void this.persistence.unregister(Te);if(A(t)&&ph.test(t)){if((n==null?void 0:n.value.split(".")[3])===t)return{value:n.value,pending:!n.delivered};const o=`fb.1.${Date.now()}.${t}`;return this.persistence.register({[Te]:{value:o,delivered:!1}}),{value:o,pending:!0}}return n?{value:n.value,pending:!n.delivered}:void 0}this.persistence.unregister(Te)}th(t){if(!this.persistence)return;this.persistence.refreshKey(Te);const s=this.Xu();(s==null?void 0:s.value)!==t||s.delivered||this.persistence.register({[Te]:{value:t,delivered:!0}})}capture(t,s,i){var r,n,o,a,l,u;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Fu))return void E.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(b(t)||!A(t))return void E.error("No event name provided to posthog.capture");this.yu();const c=!this.config.opt_out_useragent_filter&&this._is_bot();if(c&&!this.config.__preview_capture_bot_pageviews)return;const h=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(h!=null&&h.isRateLimited)return void E.critical("This capture call is ignored due to client rate limiting.");let p;s!=null&&s.$current_url&&!A(s==null?void 0:s.$current_url)&&(E.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),s==null||delete s.$current_url),t!=="$exception"||i!=null&&i.eh||E.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&&(p=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();const d=new Date,g=(i==null?void 0:i.timestamp)||d,m=Jr(i==null?void 0:i.uuid,Le);let v={uuid:m,event:t,properties:this.calculateEventProperties(t,s||{},g,m)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&c&&(v.event="$bot_pageview",v.properties.$browser_type="bot"),h&&(v.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);const _=t==="$feature_flag_called"&&v.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;i!=null&&i.$set&&!_&&(v.$set=i==null?void 0:i.$set);const x=L(s==null?void 0:s.$set)?s.$set:void 0,$=!!(i!=null&&i.$set)&&"$fbc"in i.$set,O=$||!!x&&"$fbc"in x,k=$?i==null||(r=i.$set)===null||r===void 0?void 0:r[ys]:x==null?void 0:x[ys],P=I(s==null?void 0:s.$unset)?s.$unset:[],F=(i==null?void 0:i.$unset)||[],S=P.
2indexOf("$fbc")!==-1||F.indexOf("$fbc")!==-1,M=this.Yu(p==null?void 0:p.fbclid,k,O,S);M&&v.properties.$process_person_profile===!0&&M.pending&&!O&&!_&&(v.$set=f({[ys]:M.value},v.$set));const D=i==null?void 0:i.$unset;D&&(v.$unset=D);const j=_?void 0:this.ih(i==null?void 0:i.$set_once,t!==fn,t===Oa);if(j&&(v.$set_once=j),i!=null&&i._noTruncate||(q=this.config.properties_string_max_length,v=function(B,ie){const _e=new Set;return function he(z,me){if(z!==Object(z))return ie?ie(z):z;if(_e.has(z))return;let Se;if(_e.add(z),I(z))Se=[],Pt(z,Ce=>{Se.push(he(Ce))});else{const Ce={};W(fs(z)?Ca(z):z,(ve,Pe)=>{_e.has(ve)||(Ce[Pe]=he(ve))}),Se=Ce}return Se}(B)}(v,B=>A(B)?B.slice(0,q):B)),v.timestamp=g,b(i==null?void 0:i.timestamp)||(v.properties.$event_time_override_provided=!0,v.properties.$event_time_override_system_time=d),_&&(v.properties=((B,ie=[])=>{const _e={},he=z=>{B[z]!==void 0&&(_e[z]=B[z])};return Mu.forEach(he),ie.forEach(he),_e})(v.properties,fh)),t===Ke.DISMISSED||t===Ke.SENT){const B=s==null?void 0:s[Si.SURVEY_ID],ie=s==null?void 0:s[Si.SURVEY_ITERATION];yl({id:B,current_iteration:ie}),v.$set=f(f({},v.$set),{},{[th({id:B,current_iteration:ie},t===Ke.SENT?"responded":"dismissed")]:!0})}else t===Ke.SHOWN&&(v.$set=f(f({},v.$set),{},{[Si.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var q;if(t===jc.SHOWN){const B=s==null?void 0:s[In.TOUR_TYPE];B&&(v.$set=f(f({},v.$set),{},{[`${In.TOUR_LAST_SEEN_DATE}/${B}`]:new Date().toISOString()}))}const U=f(f({},v.properties.$set),v.$set);if(ke(U)||this.setPersonPropertiesForFlags(U),!T(this.config.before_send)){const B=this.Os(v);if(!B)return;v=B,v.uuid=Jr(v.uuid,Le)}const G=(n=(o=v.$set)===null||o===void 0?void 0:o.$fbc)!==null&&n!==void 0?n:L((a=v.properties)===null||a===void 0?void 0:a.$set)?v.properties.$set[ys]:void 0,oe=M!=null&&M.pending&&G===M.value?M.value:void 0;this.au.emit("eventCaptured",v);const Z=(l=i==null?void 0:i._url)!==null&&l!==void 0?l:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),ae=(i==null?void 0:i._batchKey)==="recordings"||/\/s\/(?:\?|$)/.test(Z),le=f(f(f({method:"POST",url:Z,data:v,compression:"best-available",timestampMode:ae?"body":"capture-body",batchKey:i==null?void 0:i._batchKey},ae&&(!((u=v.properties)===null||u===void 0)&&u.$session_id)?{batchGroup:v.properties.$session_id}:{}),i!=null&&i.transport?{transport:i.transport}:{}),oe?{fireCallbackOnDrop:!0,callback:B=>{B.statusCode>=200&&300>B.statusCode&&this.th(oe)}}:{});var X;return!this.config.request_batching||i&&!(i!=null&&i._batchKey)||i!=null&&i.send_instantly||oe?(!le.transport&&!le.callback&&ke((X=this.config.request_headers)!==null&&X!==void 0?X:{})&&this.wu&&(le.transport="sendBeacon"),this.Ou(le)):this.Fu.enqueue(le),v}_addCaptureHook(t){return this.on("eventCaptured",s=>t(s.event,s))}getExtension(t){var s;return(s=this.Gu)===null||s===void 0?void 0:s.getExtension(t)}zu(){var t;return(t=this.Gu)!==null&&t!==void 0?t:this.Gu=new dh(this)}hu(t){this.$u.push(t);let s=!0;return()=>{if(!s)return;s=!1;const i=this.$u.indexOf(t);i!==-1&&this.$u.splice(i,1)}}nh(t=!0){var s,i,r;return!!(!((s=this.persistence)===null||s===void 0)&&s.consumeCookieIdentityChange())&&(this.Eu=null,this.persistence.get_property("$user_state")==="anonymous"&&((r=this.sessionPersistence)===null||r===void 0||r.clear(),this.xu.clear(),this.sh()),(i=this.featureFlags)===null||i===void 0||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,s,i,r,n){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return s;this.persistence.syncCookieProperties(),this.nh();const o=n?void 0:this.persistence.remove_event_timer(t);let a=f({},s);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.fu()&&(a[Ea]=!0),t==="$snapshot"){const x=f(f({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=x.distinct_id,(!A(a.distinct_id)&&!ne(a.distinct_id)||Yt(a.distinct_id))&&E.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const l=function(x,$,O,k=!1){var P,F,S,M;if(!we)return{};const D=x?[...At,...$||[]]:[],[j,q]=Wo(we),[U,G]=function(z){for(let me=0;Yr.length>me;me++){const[Se,Ce,ve]=Yr[me],Pe=z.match(Se);if(Pe){const lt=ve&&z.match(ve)||Pe;return[Ce,(lt==null?void 0:lt[1])||""]}
2}return["",""]}(we),oe=function(){const z="u">typeof navigator?navigator:void 0;return z!=null&&z.brave?{brave:!0}:{}}(),Z={};b(O)||(Z.detectGoogleSearchApp=O);const ae={},le=(P=navigator)===null||P===void 0||(P=P.userAgentData)===null||P===void 0?void 0:P.platform,X=(F=navigator)===null||F===void 0?void 0:F.maxTouchPoints,B=y==null||(S=y.screen)===null||S===void 0?void 0:S.width,ie=y==null||(M=y.screen)===null||M===void 0?void 0:M.height,_e=y==null?void 0:y.devicePixelRatio;b(le)||(ae.userAgentDataPlatform=le),b(X)||(ae.maxTouchPoints=X),b(B)||(ae.screenWidth=B),b(ie)||(ae.screenHeight=ie),b(_e)||(ae.devicePixelRatio=_e);const he=Y(Ir({$os:j,$os_version:q,$browser:Vo(we,navigator.vendor,oe,Z),$webview_app:U,$webview_app_version:G,$device:Uo(we),$device_type:Yl(we,ae),$timezone:Qa(),$timezone_offset:Lc()}),{$current_url:hs(k?ot(ee==null?void 0:ee.href):ee==null?void 0:ee.href,D,ds),$host:ee==null?void 0:ee.host,$pathname:ee==null?void 0:ee.pathname,$raw_user_agent:we.length>1e3?we.substring(0,997)+"...":we,$browser_version:Kl(we,navigator.vendor,oe,Z),$browser_language:Ya(),$browser_language_prefix:Ac(),$screen_height:y==null?void 0:y.screen.height,$screen_width:y==null?void 0:y.screen.width,$viewport_height:y==null?void 0:y.innerHeight,$viewport_width:y==null?void 0:y.innerWidth,$lib:Ye.LIB_NAME,$lib_version:Ye.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Ye.SDK_DIST_CHANNEL&&(he.$sdk_dist_channel=Ye.SDK_DIST_CHANNEL),he}(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){const{sessionId:x,windowId:$}=this.sessionManager.checkAndGetSessionAndWindowId(n,i.getTime(),!0);a.$session_id=x,a.$window_id=$}this.sessionPropsManager&&Y(a,this.sessionPropsManager.getSessionProps());try{var u;this.sessionRecording&&Y(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(u=this.Du)===null||u===void 0?void 0:u.length}catch(x){a.$sdk_debug_error_capturing_properties=String(x)}let c;if(this.requestRouter.region===_r&&(a.$lib_custom_api_host=this.config.api_host),c=t!=="$pageview"||n?t!=="$pageleave"||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),a=Y(a,c),t==="$pageview"&&w&&(a.title=w.title),!b(o)){const x=i.getTime()-o;a.$duration=parseFloat((x/1e3).toFixed(3))}we&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const h=this.persistence.properties(),p=this.sessionPersistence.properties(),d=a.$groups,g=h.$groups;L(d)&&!ke(d)&&(a.$groups=f(f({},L(g)?g:{}),d)),W(["$referrer","$referring_domain"],x=>{x in h&&delete p[x]});const m={};if(this.$u.length>0)for(const x of this.$u.slice())try{Y(m,x())}catch($){E.error("Failed to produce browser extension event properties",$)}a=Y({},l,h,p,f(f({},m),a)),a.$is_identified=this._isIdentified(),I(this.config.property_denylist)?W(this.config.property_denylist,function(x){delete a[x]}):E.error(bl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const v=this.config.sanitize_properties;v&&(E.error(Wn),a=v(a,t));const _=this.rh();return a.$process_person_profile=_,_&&!n&&this.oh("_calculate_event_properties"),a}ih(t,s=!0,i=!1){var r;if(!this.persistence||!this.rh()||this.Su&&!i)return t;const n=this.persistence.get_initial_props(),o=(r=this.sessionPropsManager)===null||r===void 0?void 0:r.getSetOnceProps();let a=Y({},n,o||{},t||{});const l=this.config.sanitize_properties;return l&&(E.error(Wn),a=l(a,"$set_once")),s&&(this.Su=!0),ke(a)?void 0:a}register(t,s){var i;(i=this.persistence)===null||i===void 0||i.register(t,s)}register_once(t,s,i){var r;(r=this.persistence)===null||r===void 0||r.register_once(t,s,i)}register_for_session(t){var s,i;(s=this.persistence)===null||s===void 0||s.syncCookieProperties(),this.nh(),(i=this.sessionPersistence)===null||i===void 0||i.register(t),Object.keys(t).forEach(r=>this.xu.add(r)),this.sh()}unregister(t){var s;(s=this.persistence)===null||s===void 0||s.unregister(t)}unregister_for_session(t){var s;(s=this.sessionPersistence)===null||s===void 0||s.unregister(t),this.xu.delete(t),this.sh()}ah(t,s){this.register({[t]:s})}Lu(){this.xu.forEach(t=>{var s;(s=this.sessionPersistence)===null||s===void 0||s.unregister(t)}),this.xu.clear(),this.sh()}sh(){var t;if(!this.Cu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.pi||!K.Et())return void K.Lt(this.Cu);const s=[];this.xu.forEach(i=>
2s.push(i)),s.length>0?K.At(this.Cu,s):K.Lt(this.Cu)}getFeatureFlag(t,s){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlag(t,s)}getFeatureFlagPayload(t){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlagPayload(t)}getFeatureFlagResult(t,s){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlagResult(t,s)}getAllFeatureFlags(){var t,s;return(t=(s=this.featureFlags)===null||s===void 0?void 0:s.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,s){var i,r;return(i=(r=this.featureFlags)===null||r===void 0?void 0:r.isFeatureEnabled(t,s))!==null&&i!==void 0?i:s==null?void 0:s.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,s,i){var r;(r=this.featureFlags)===null||r===void 0||r.updateFlags(t,s,i)}updateEarlyAccessFeatureEnrollment(t,s,i){var r;(r=this.featureFlags)===null||r===void 0||r.updateEarlyAccessFeatureEnrollment(t,s,i)}getEarlyAccessFeatures(t,s=!1,i){var r;return(r=this.featureFlags)===null||r===void 0?void 0:r.getEarlyAccessFeatures(t,s,i)}on(t,s){return this.au.on(t,s)}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:Wt}),()=>{})}onSessionId(t){var s,i;return(s=(i=this.sessionManager)===null||i===void 0?void 0:i.onSessionId(t))!==null&&s!==void 0?s:()=>{}}getSurveys(t,s=!1){this.surveys?this.surveys.getSurveys(t,s):t([],{isLoaded:!1,error:Wt})}getActiveMatchingSurveys(t,s=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,s):t([],{isLoaded:!1,error:Wt})}renderSurvey(t,s){var i;(i=this.surveys)===null||i===void 0||i.renderSurvey(t,s)}displaySurvey(t,s=oh){var i;(i=this.surveys)===null||i===void 0||i.displaySurvey(t,s)}cancelPendingSurvey(t){var s;(s=this.surveys)===null||s===void 0||s.cancelPendingSurvey(t)}canRenderSurvey(t){var s,i;return(s=(i=this.surveys)===null||i===void 0?void 0:i.canRenderSurvey(t))!==null&&s!==void 0?s:{visible:!1,disabledReason:Wt}}canRenderSurveyAsync(t,s=!1){var i,r;return(i=(r=this.surveys)===null||r===void 0?void 0:r.canRenderSurveyAsync(t,s))!==null&&i!==void 0?i:Promise.resolve({visible:!1,disabledReason:Wt})}uh(t){return!t||Yt(t)?(E.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(E.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())||(E.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,s,i){if(!this.__loaded||!this.persistence)return E.uninitializedWarning("posthog.identify");if(ne(t)&&(t=t.toString(),E.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.uh(t)||!this.oh("posthog.identify"))return;this.yu();const r=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,o=this.nh(!1),a=this.persistence.Pl();let l=!1;try{const c=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:c},""),t!==c&&t!==this.get_property("__alias")&&(this.unregister(qs),this.register({distinct_id:t}));const h=(this.persistence.get_property("$user_state")||"anonymous")===Ge,p=t!==c,d=!p&&h;if(p&&h){var u;const g=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:c};this.persistence.set_property(xe,Os),this.setPersonPropertiesForFlags({$set:s||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$identify",g,{$set:s||{},$set_once:i||{}})&&(this.Eu=Ci(t,s,i)),(u=this.featureFlags)===null||u===void 0||u.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:c)}else if(d){this.persistence.set_property(xe,Os);const g=s||{},m=i||{};this.setPersonPropertiesForFlags({$set:g,$set_once:m},!1),this.config.cookieWinsOnConflict&&this.persistence.Rl(),this.capture("$set",{$set:g,$set_once:m})&&(this.Eu=Ci(t,s,i))}else(s||i)&&this.setPersonProperties(s,i);p||n||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(rt)):d&&(s||i)&&this.reloadFeatureFlags(),l=!0}finally{a&&this.persistence.Ol(l)}}setPersonProperties(t,s){if(!t&&!s||!this.oh("posthog.setPersonProperties"))return;const i=Ci(this.get_distinct_id(),t,s);this.Eu!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:s||{}},!0),this.capture("$set",{$set:t||{},$set_once:s||{}})&&(this.Eu=i)):E.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var s;const i=(I(t)?t:[t]).filter(r=>A(r)&&r.length>0);i.length!==0&&this.oh("posthog.unsetPersonProperties")&&((s=this.featureFlags)===null||s===void 0||s.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Eu=null)}group(t,s,i){var r;if(!t||!s)return void E.error("posthog.group requires a group type and group key");(r=this.persistence)===null||r===void 0||r.syncCookieProperties(),this.nh();const n=this.getGroups(),o=n[t]!==s;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:f(f({},n),{},{[t]:s})}),(o||i)&&this.rh()){const a={$group_type:t,$group_key:s};i&&(a.$group_set=i),this.capture(fn,a)}i&&this.setGroupPropertiesForFlags({[t]:i}),o&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,s=!0){var i;(i=this.featureFlags)===null||i===void 0||i.setPersonPropertiesForFlags(t,s)}resetPersonPropertiesForFlags(t=!0){var s;(s=this.featureFlags)===null||s===void 0||s.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,s=!0){var i;this.oh("posthog.setGroupPropertiesForFlags")&&((i=this.featureFlags)===null||i===void 0||i.setGroupPropertiesForFlags(t,s))}resetGroupPropertiesForFlags(t){var s;(s=this.featureFlags)===null||s===void 0||s.resetGroupPropertiesForFlags(t)}reset(t){const s=$e(t)?t:t==null?void 0:t.resetDeviceID,i=$e(t)||t==null?void 0:t.bootstrap;this.hh(s,!1,i)}hh(t,s=!1,i){var r,n,o,a,l,u;if(E.info("reset"),!this.__loaded)return E.uninitializedWarning("posthog.reset");const c=i==null?void 0:i.sessionID;this.config.bootstrap=i||((r=this.Ru)===null||r===void 0?void 0:r.bootstrap)||{},(n=this.featureFlags)===null||n===void 0||(o=n.updateConfig)===null||o===void 0||o.call(n,this.config,this.Xl());const h=this.get_property(Sr),p=this.get_property(vi),d=this.get_property(Zt);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const g=this.is_capturing();this.consent.reset(),s||!g||this.is_capturing();const m=(l=this.persistence)===null||l===void 0||(u=l.Pl)===null||u===void 0?void 0:u.call(l);let v=!1;try{var _,x,$,O,k,P,F,S,M,D,j,q,U;if((_=this.persistence)===null||_===void 0||_.clear(),(x=this.sessionPersistence)===null||x===void 0||x.clear(),this.xu.clear(),this.sh(),b(d)||(D=this.persistence)===null||D===void 0||D.register({$session_recording_remote_config:d}),($=this.surveys)===null||$===void 0||$.reset(),(O=this.featureFlags)===null||O===void 0||O.reset(),(k=this.conversations)===null||k===void 0||k.reset(),(P=this.logs)===null||P===void 0||P.reset(),(F=this.metrics)===null||F===void 0||F.reset(),(S=this.persistence)===null||S===void 0||S.set_property("$user_state","anonymous"),(M=this.sessionManager)===null||M===void 0||M.resetSessionId(),this.Eu=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:gi,$device_id:null},"");else{const Z=this.config.get_device_id(Le());this.register_once({distinct_id:Z,$device_id:t?Z:h},""),t||b(p)||this.register({[vi]:p})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),i&&(i.distinctID&&!this.fu()&&((U=this.persistence)===null||U===void 0||U.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),(j=this.featureFlags)===null||j===void 0||j.initialize(),!T(c)&&!(!((q=this.sessionManager)===null||q===void 0)&&q.setBootstrapSessionId(c,!0)))){const Z=f({},i);delete Z.sessionID,this.config.bootstrap=Z}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var G,oe;m&&((G=this.persistence)===null||G===void 0||(oe=G.Ol)===null||oe===void 0||oe.call(G,v))}this.reloadFeatureFlags()}shutdown(t){var s=this;return J(function*(){var i,r,n,o,a,l,u,c;if(s.__loaded){s.ku=!0,s.zu().dispose(),(i=s.sessionRecording)===null||i===void 0||i.dispose(),(r=s.logs)===null||r===void 0||r.flushLogs("sendBeacon"),(n=s.metrics)===null||n===void 0||n.flush("sendBeacon"),(o=s.metrics)===null||o===void 0||o.dispose(),(a=s.Fu)===null||a===void 0||a.unload(),(l=s.Du)===null||l===void 0||l.unload();try{var h;(h=s.featureFlags)===null||h===void 0||h.destroy()}catch(p){E.error("Error while destroying feature flags",p)}(u=s.persistence)===null||u===void 0||u.destroy(),(c=s.sessionPersistence)===null||c===void 0||c.destroy()}else E.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,s){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=s,this.alias(t),(i=this.conversations)===null||i===void 0||i.dh()}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.fh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,s;return(t=(s=this.sessionManager)===null||s===void 0?void 0:s.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:s,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let r=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${s}`);if(t!=null&&t.withTimestamp&&i){var n;const o=(n=t.timestampLookBack)!==null&&n!==void 0?n:10;if(!i)return r;r+=`?t=${Math.max(Math.floor((new Date().getTime()-i)/1e3)-o,0)}`}return r}alias(t,s){return t===this.get_property("$people_distinct_id")?(E.critical("Attempting to create alias for existing People user - aborting."),-2):this.oh("posthog.alias")?(b(s)&&(s=this.get_distinct_id()),t!==s?(this.ah(qs,t),this.capture("$create_alias",{alias:t,distinct_id:s})):(E.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const s=f({},this.config);if(L(t)){var i,r,n,o,a,l,u,c,h,p,d,g,m,v;Y(this.config,Un(t));const x=this.bu();(i=this.persistence)===null||i===void 0||i.update_config(this.config,s,x),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ki(f(f({},this.config),{},{persistence:"sessionStorage"}),x,!1);const $=this.Pu(this.config.debug);var _;$e($)&&(this.config.debug=$),$e(this.config.debug)&&(this.config.debug?(ce.DEBUG=!0,N.Et()&&N.At("ph_debug",!0),E.info("set_config",{config:t,oldConfig:s,newConfig:f({},this.config)})):(ce.DEBUG=!1,N.Et()&&N.Lt("ph_debug"))),(r=this.featureFlags)===null||r===void 0||(n=r.updateConfig)===null||n===void 0||n.call(r,this.config,this.Xl()),(o=this.exceptionObserver)===null||o===void 0||o.onConfigChange(),(a=this.exceptions)===null||a===void 0||a.onConfigChange(),(l=this.metrics)===null||l===void 0||l.onConfigChange(),(u=this.sessionRecording)===null||u===void 0||u.startIfEnabledOrStop(),(c=this.tracingHeaders)===null||c===void 0||c.startIfEnabledOrStop(),(h=this.autocapture)===null||h===void 0||h.startIfEnabled(),(p=this.heatmaps)===null||p===void 0||p.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((_=this.historyAutocapture)===null||_===void 0||_.startIfEnabledOrStop()),(d=this.exceptionObserver)===null||d===void 0||d.startIfEnabledOrStop(),(g=this.deadClicksAutocapture)===null||g===void 0||g.startIfEnabledOrStop(),(m=this.surveys)===null||m===void 0||m.loadIfEnabled(),this._u(),(v=this.externalIntegrations)===null||v===void 0||v.startIfEnabledOrStop(),!s.segment&&this.config.segment&&this.persistence&&Fn(this,is,!1)}}_overrideSDKInfo(t,s){ce.LIB_NAME=t,ce.LIB_VERSION=s}startSessionRecording(t){const s=t===!0,i={sampling:s||!!(t!=null&&t.sampling),linked_flag:s||!!(t!=null&&t.linked_flag),url_trigger:s||!!(t!=null&&t.url_trigger),event_trigger:s||!!(t!=null&&t.event_trigger)};var r,n,o,a,l;
2Object.values(i).some(Boolean)&&((r=this.sessionManager)===null||r===void 0||r.checkAndGetSessionAndWindowId(),i.sampling&&((n=this.sessionRecording)===null||n===void 0||n.overrideSampling()),i.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),i.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),i.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,s){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(f(f({},i),s))}catch{return}}addExceptionStep(t,s){var i;(i=this.exceptions)===null||i===void 0||i.addExceptionStep(t,s)}captureLog(t){var s;(s=this.logs)===null||s===void 0||s.captureLog(t)}get logger(){var t,s;return(t=(s=this.logs)===null||s===void 0?void 0:s.logger)!==null&&t!==void 0?t:et.ph}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var s,i;return(s=(i=this.toolbar)===null||i===void 0?void 0:i.loadToolbar(t))!==null&&s!==void 0&&s}get_property(t){var s;return(s=this.persistence)===null||s===void 0?void 0:s.props[t]}getSessionProperty(t){var s;return(s=this.sessionPersistence)===null||s===void 0?void 0:s.props[t]}toString(){var t;let s=(t=this.config.name)!==null&&t!==void 0?t:Kt;return s!==Kt&&(s="posthog."+s),s}_isIdentified(){var t,s;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((s=this.sessionPersistence)===null||s===void 0?void 0:s.get_property("$user_state"))==="identified"}rh(){var t,s;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&ke(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((s=this.persistence)===null||s===void 0||(s=s.props)===null||s===void 0)&&s.$epp))}Ku(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.rh()||this.oh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.oh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}oh(t){return this.config.person_profiles==="never"?(E.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.pu(),this.ah(Fr,!0),!0)}bu(){if(this.config.cookieless_mode==="always")return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}_u(){var t,s;const i=this.bu();var r,n,o;return this.is_capturing()||(r=this.logs)===null||r===void 0||r.gh(),((t=this.persistence)===null||t===void 0?void 0:t.pi)!==i&&((n=this.persistence)===null||n===void 0||n.set_disabled(i)),((s=this.sessionPersistence)===null||s===void 0?void 0:s.pi)!==i&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(i)),i&&(this.xu.clear(),this.sh()),i}opt_in_capturing(t){var s;if(this.config.cookieless_mode!=="always"){if(this.fu()){var i,r,n,o,a,l;(i=this.sessionRecording)===null||i===void 0||i.dispose({discardBufferedEvents:!0}),this.hh(!0,!0),(r=this.sessionManager)===null||r===void 0||r.destroy(),(n=this.pageViewManager)===null||n===void 0||n.destroy(),this.sessionManager=new Hn(this),this.pageViewManager=new On(this),this.persistence&&(this.sessionPropsManager=new jn(this,this.sessionManager,this.persistence));const d=(o=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&o!==void 0?o:(l=et.__defaultExtensionClasses)===null||l===void 0?void 0:l.sessionRecording;var u,c;d&&(this.sessionRecording=this.vu(this.sessionRecording,new d(this)),this.lu&&((u=this.sessionRecording)===null||u===void 0||(c=u.onRemoteConfig)===null||c===void 0||c.c
2all(u,this.lu)))}var h,p;this.consent.optInOut(!0),this._u(),this.Zu(),(s=this.sessionRecording)===null||s===void 0||s.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((h=this.surveys)===null||h===void 0||h.loadIfEnabled()),(b(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((p=t==null?void 0:t.captureEventName)!==null&&p!==void 0?p:"$opt_in",t==null?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Qu()}else E.warn(Vn)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void E.warn(Vn);const t=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var s,i;t==null||t.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.hh(!0,!0),this.consent.optInOut(!1),this._u(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:gi,$device_id:null}),this.du(t),this.sessionRecording=void 0,(s=this.sessionManager)===null||s===void 0||s.destroy(),(i=this.pageViewManager)===null||i===void 0||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Qu(),this.Zu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return 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._u()}_is_bot(){return pe?fl(pe,this.config.custom_blocked_useragents):void 0}Qu(){w&&(w.visibilityState==="visible"?this.Tu||(this.Tu=!0,this.capture(Cr,{title:w.title},{send_instantly:!0}),this.Iu&&(w.removeEventListener(ls,this.Iu),this.Iu=null)):this.Iu||(this.Iu=this.Qu.bind(this),H(w,ls,this.Iu)))}debug(t){t===!1?(y==null||y.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(y==null||y.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}))}Xl(){const t=this.Ru||{};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?(E.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(s,i,r,n,o){const a=i in s&&!T(s[i]),l=r in s&&!T(s[r]);return a?s[i]:!!l&&(o&&o.warn(`Config field '${r}' is deprecated. Please use '${i}' instead. The old field will be removed in a future major version.`),s[r])}(t,"advanced_disable_flags","advanced_disable_decide",0,E)}Os(t){var s;if(T(this.config.before_send))return t;const i=Object.keys((s=t.properties)!==null&&s!==void 0?s:{}).filter(Dl),r=I(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=t;for(const o of r)try{if(n=o(n),T(n)){const a=`Event '${t.event}' was rejected in beforeSend function`;return Ll(t.event)?E.warn(`${a}. This can cause unexpected behavior.`):E.info(a),null}n.properties&&!ke(n.properties)||E.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return E.error(`Error in beforeSend function for event '${t.event}':`,a),null}for(const o of i)if(n.properties&&T(n.properties[o]))return E.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 n}getPageViewId(){var t;return(t=this.pageViewManager.Bo)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,s){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:s})}captureTraceMetric(t,s,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:s,$ai_metric_value:String(i)})}Pu(t){const s=$e(t)&&!t,i=N.Et()&&N.Ot("ph_debug")==="true";return!s&&(!!i||t)}};rs.__defaultExtensionClasses={},rs.ph=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),function(e,t){for(let s=0;t.length>s;s++)e.prototype[t[s]]=dc(e.prototype[t[s]])}(rs,["identify"]);var xl=class{constructor(e){this.disabled=e===!1;const 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,s){if(this.disabled)return!1;const i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(t-i.y)<this.thresholdPx&&this.timeoutMs>s-i.timestamp){if(this.clicks.push({x:e,y:t,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:s}];return!1}};const Ai="$copy_autocapture",Es=se("[AutoCapture]");function Li(e,t){return t.length>e?t.slice(0,e)+"...":t}function mh(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!He(t));return t}function yh(e,{e:t,maskAllElementAttributes:s,maskAllText:i,elementAttributeIgnoreList:r,elementsC
2hainAsString:n,disableCaptureUrlHashes:o}){var a,l;if(!He(e))return{props:{}};const u=[e],c=new Set([e]);let h=e;for(;h.parentNode&&!ge(h,"body")&&1e3>u.length;){if(Rr(h.parentNode)){const P=h.parentNode.host;if(c.has(P))break;c.add(P),u.push(P),h=P;continue}if(!He(h.parentNode)||c.has(h.parentNode))break;c.add(h.parentNode),u.push(h.parentNode),h=h.parentNode}const p=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?u.findIndex(P=>ge(P,"button")||ge(P,"a")):-1;p>0&&(i=i||u.slice(0,p+1).some(P=>!Ct(P)||cs(P)));const d=[],g={};let m,v=!1,_=!1;if(W(u,P=>{const F=Ct(P);if(ge(P,"a")){const S=P.getAttribute("href");v=!!(F&&S&&es(S))&&(o?ot(S):S)}R(Rt(P),"ph-no-capture")&&(_=!0),d.push(function(S,M,D,j,q=!1){const U=S.tagName.toLowerCase(),G={tag_name:U};Ar.indexOf(U)>-1&&!D&&(G.$el_text=U.toLowerCase()==="a"||U.toLowerCase()==="button"?Li(1024,Sn(S)):Li(1024,us(S)));const oe=Rt(S);oe.length>0&&(G.classes=oe.filter(function(X){return X!==""})),W(S.attributes,function(X){var B;if((!cs(S)||["name","id","class","aria-label"].indexOf(X.name)!==-1)&&!(j!=null&&j.includes(X.name))&&!M&&es(X.value)&&(!A(B=X.name)||B.substring(0,10)!=="_ngcontent"&&B.substring(0,7)!=="_nghost")){let ie=X.value;X.name==="class"&&(ie=Tr(ie).join(" ")),G["attr__"+X.name]=Li(1024,X.name==="href"&&q?ot(ie):ie)}});let Z=1,ae=1,le=S;for(;le=mh(le);)Z++,le.tagName===S.tagName&&ae++;return G.nth_child=Z,G.nth_of_type=ae,G}(P,s,i,r,o)),W(function(S){if(!Ct(S))return{};const M={};return W(S.attributes,function(D){if(D.name&&D.name.indexOf("data-ph-capture-attribute")===0){const j=D.name.replace("data-ph-capture-attribute-",""),q=D.value;j&&q&&es(q)&&(M[j]=q)}}),M}(P),(S,M)=>{({}).hasOwnProperty.call(g,M)||(g[M]=S)})}),_)return{props:{},explicitNoCapture:_};if(p>0&&(e=u[p],d.splice(0,p)),i||(d[0].$el_text=ge(e,"a")||ge(e,"button")?Sn(e):us(e)),v){var x,$;d[0].attr__href=v;const P=(x=at(v))===null||x===void 0?void 0:x.host,F=y==null||($=y.location)===null||$===void 0?void 0:$.host;P&&F&&P!==F&&(m=v)}return{props:Y((k=t.type,{$event_type:k,$ce_version:1}),n?{}:{$elements:d},{$elements_chain:(O=d,I(O)?function(P){return P.map(F=>{var S,M;let D="";if(F.tag_name&&(D+=F.tag_name),F.attr_class){F.attr_class.sort();for(const U of F.attr_class)D+=`.${U.replace(/"/g,"")}`}const j=f(f(f(f({},F.text?{text:F.text}:{}),{},{"nth-child":(S=F.nth_child)!==null&&S!==void 0?S:0,"nth-of-type":(M=F.nth_of_type)!==null&&M!==void 0?M:0},F.href?{href:F.href}:{}),F.attr_id?{attr_id:F.attr_id}:{}),F.attributes),q={};return Cs(j).sort(([U],[G])=>function(oe,Z){return Z>oe?-1:oe>Z?1:0}(U,G)).forEach(([U,G])=>q[Mn(U.toString())]=Mn(G.toString())),D+=":",D+=Cs(q).map(([U,G])=>`${U}="${G}"`).join(""),D}).join(";")}(function(P){return P.map(F=>{var S,M;const D={text:(S=F.$el_text)===null||S===void 0?void 0:S.slice(0,400),tag_name:F.tag_name,href:(M=F.attr__href)===null||M===void 0?void 0:M.slice(0,2048),attr_class:Mc(F),attr_id:F.attr__id,nth_child:F.nth_child,nth_of_type:F.nth_of_type,attributes:{}};return Cs(F).filter(([j])=>j.indexOf("attr__")===0).forEach(([j,q])=>D.attributes[j]=q),D})}(O)):"")},!((a=d[0])===null||a===void 0)&&a.$el_text?{$el_text:(l=d[0])===null||l===void 0?void 0:l.$el_text}:{},m&&t.type==="click"?{$external_click_url:m}:{},g),target:e};var O,k}var bh=class{uo(){this.ho=void 0,clearTimeout(this.co),this.co=void 0}do(e){var t;if(!Ct(e))return!0;const s=(t=this.vo().css_selector_ignorelist)!==null&&t!==void 0?t:xi,i=new Set;let r=e;for(;r;){if(i.size>=1e3||i.has(r))return!0;i.add(r);const n=r,o=Rt(n);if(R(o,"ph-no-capture")||R(o,"ph-sensitive")||cs(n)||s.some(l=>cr(n,l)))return!0;const a=r.parentNode;r=Rr(a)?a.host:a&&He(a)?a:null}return!1}fo(e){if(!this.isEnabled||e.type==="pointercancel")return void this.uo();if(e.type==="pointerdown"){this.uo();const i=Qt(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&i&&He(i)&&(this.ho={target:i,excluded:this.do(i),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.po)===null||t===void 0?void 0:t.distinctId}))}const s=this.ho;s&&(e.pointerId!==s.id||Math.abs(e.clientX-s.x)>5||Math.abs(e.clientY-s.y)>5?this.uo():e.type==="pointerup"&&(s.released=!0,this.co=setTimeout(()=>this.uo(),0)))}mo(e){var t;const s=this.ho;this.uo();const i=Qt(e);
2if(s!=null&&s.released&&s.target.isConnected&&s.distinctId===((t=this.po)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===s.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-s.x)&&5>=Math.abs(e.clientY-s.y)&&i&&(ge(i,"html")||ge(i,"body"))){var r;if(s.excluded)return null;const n=(r=this.vo().css_selector_ignorelist)!==null&&r!==void 0?r:xi;return[i,w==null?void 0:w.documentElement,w==null?void 0:w.body].some(o=>{if(!o)return!1;const a=Rt(o);return R(a,"ph-no-capture")||R(a,"ph-sensitive")||!Ct(o)||cs(o)||n.some(l=>cr(o,l))})?null:s.target}}constructor(e){this.yo=e,this.name="autocapture",this.bo=!1,this._o=null,this.wo=!1,this.ko=!1,this.Mr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.So=!1,this.yo.refresh(this.Mr),this.rageclicks=new xl(this.Mr.rageclick),this.xo=null}setup(e){this.Co(),this.po=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.So?t.dispose():(this.$o=t,this.startIfEnabled())}dispose(){var e;this.So||(this.So=!0,this.po=void 0,(e=this.$o)===null||e===void 0||e.dispose(),this.$o=void 0,this.To())}vo(){return this.yo.refresh(this.Mr),this.Mr}Co(){var e,t;return this.vo(),this.Mr.url_allowlist=(e=this.Mr.url_allowlist)===null||e===void 0?void 0:e.map(s=>new RegExp(s)),this.Mr.url_ignorelist=(t=this.Mr.url_ignorelist)===null||t===void 0?void 0:t.map(s=>new RegExp(s)),this.Mr}Io(){if(!this.isBrowserSupported())return void Es.info("Disabling Automatic Event Collection because this browser is not supported");if(!y||!w)return;const e=this.Mo=t=>{t=t||(y==null?void 0:y.event);try{if(t.type==="blur")return void this.uo();if(t.type.indexOf("pointer")===0)return void this.fo(t);const s=t.type==="click"?this.mo(t):void 0;if(re(s))return;this.Eo(t,"$autocapture",s)}catch(s){Es.error("Failed to capture event",s)}};if(H(y,"blur",e),H(w,"submit",e,{capture:!0}),H(w,"change",e,{capture:!0}),H(w,"click",e,{capture:!0}),W(["pointerdown","pointermove","pointerup","pointercancel"],t=>{H(w,t,e,{capture:!0})}),this.vo().capture_copied_text){const t=this.Po=s=>{s=s||(y==null?void 0:y.event);try{this.Eo(s,Ai)}catch(i){Es.error("Failed to capture clipboard event",i)}};H(w,"copy",t,{capture:!0}),H(w,"cut",t,{capture:!0}),H(w,"paste",t,{capture:!0})}}To(){this.uo(),this.Mo&&(y==null||y.removeEventListener("blur",this.Mo),W(["pointerdown","pointermove","pointerup","pointercancel"],e=>{w==null||w.removeEventListener(e,this.Mo,!0)}),w==null||w.removeEventListener("submit",this.Mo,!0),w==null||w.removeEventListener("change",this.Mo,!0),w==null||w.removeEventListener("click",this.Mo,!0),this.Mo=void 0),this.Po&&(w==null||w.removeEventListener("copy",this.Po,!0),w==null||w.removeEventListener("cut",this.Po,!0),w==null||w.removeEventListener("paste",this.Po,!0),this.Po=void 0),this.bo=!1}startIfEnabled(){this.isEnabled||this.uo(),!this.So&&this.po&&this.isEnabled&&!this.bo&&(this.Io(),this.bo=!0)}onRemoteConfig(e){if(this.So)return;if(this.wo=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this.ko=t.elementsChainAsString);const s=t.autocapture_opt_out;var i;$e(s)&&((i=this.po)===null||i===void 0||i.kv.set("$autocapture_disabled_server_side",s),this._o=s),this.startIfEnabled()}setElementSelectors(e){this.xo=e}getElementSelectors(e,t){var s;const i=[];return(s=this.xo)===null||s===void 0||s.forEach(r=>{const n=w==null?void 0:w.querySelectorAll(r);n==null||n.forEach(o=>{e!==o&&t!==o||R(i,r)||i.push(r)})}),i}get isEnabled(){var e,t;if(this.So)return!1;const s=(e=this.po)===null||e===void 0?void 0:e.kv.get(fa),i=this._o,r=this.vo();if(!r.remoteRequestsDisabled&&!this.wo)return!1;const n=r.remoteRequestsDisabled&&!this.wo;if(re(i)&&!$e(s)&&!n)return!1;const o=(t=this._o)!==null&&t!==void 0?t:!!s;return!!r.enabled&&!o}Eo(e,t="$autocapture",s){if(!this.isEnabled)return void this.uo();let i=s||Qt(e);Aa(i)&&(i=i.parentNode||null);const r=this.Co();var n;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&r.rageclick&&(!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&ja(i,r.rageclick)&&this.Eo(e,"$rageclick",
2s);const o=t===Ai,a=o?f(f({},r),{},{dom_event_allowlist:void 0}):r;if(i&&function(h,p,d,g,m,v){var _;if(!y||Lr(h)||d!=null&&d.url_allowlist&&!yn(d.url_allowlist,v)||d!=null&&d.url_ignorelist&&yn(d.url_ignorelist,v))return!1;if(d!=null&&d.dom_event_allowlist){const k=d.dom_event_allowlist;if(k&&!k.some(P=>p.type===P))return!1}const{parentIsUsefulElement:x,targetElementList:$}=Ba(h,g);if(!function(k,P){const F=P==null?void 0:P.element_allowlist;if(b(F))return!0;for(const S of k)if(F.some(M=>S.tagName.toLowerCase()===M))return!0;return!1}($,d)||!hr($,d==null?void 0:d.css_selector_allowlist)||hr($,(_=d==null?void 0:d.css_selector_ignorelist)!==null&&_!==void 0?_:xi))return!1;try{const k=y.getComputedStyle(h);if(k&&k.getPropertyValue("cursor")==="pointer"&&p.type==="click")return!0}catch{}const O=h.tagName.toLowerCase();switch(O){case"html":return!1;case"form":return(m||["submit"]).indexOf(p.type)>=0;case"input":case"select":case"textarea":return(m||["change","click"]).indexOf(p.type)>=0;default:return x?(m||["click"]).indexOf(p.type)>=0:(m||["click"]).indexOf(p.type)>=0&&(Ar.indexOf(O)>-1||h.getAttribute("contenteditable")==="true")}}(i,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var l;const{props:h,explicitNoCapture:p,target:d}=yh(i,{e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.ko,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(p)return!1;const g=this.getElementSelectors(i,d);if(g&&g.length>0&&(h.$element_selectors=g),t===Ai){const m=e.type||"clipboard";if(m!=="paste"){var u,c;const v=y==null||(u=y.getSelection())===null||u===void 0?void 0:u.toString(),_=La(v);if(!_)return!1;h.$selected_content=_,h.$clipboard_text_length=(c=v==null?void 0:v.length)!==null&&c!==void 0?c:0}h.$copy_type=m}return(l=this.po)===null||l===void 0||l.capture(t,h).catch(m=>Es.error("Failed to capture event",m)),!0}}isBrowserSupported(){return de(w==null?void 0:w.querySelectorAll)}},wh=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,s=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.Xl(),e.url_allowlist=s==null?void 0:s.url_allowlist,e.url_ignorelist=s==null?void 0:s.url_ignorelist,e.dom_event_allowlist=s==null?void 0:s.dom_event_allowlist,e.element_allowlist=s==null?void 0:s.element_allowlist,e.css_selector_allowlist=s==null?void 0:s.css_selector_allowlist,e.css_selector_ignorelist=s==null?void 0:s.css_selector_ignorelist,e.element_attribute_ignorelist=s==null?void 0:s.element_attribute_ignorelist,e.capture_copied_text=s==null?void 0:s.capture_copied_text}};const Ut=se("[ExceptionAutocapture]"),Gn=()=>{},Kn=e=>{var t;if(de(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function ps(e,t,s){try{if(!(t in e))return Gn;const i={next:e[t]},r=s(function(...n){return i.next.apply(this,n)});return de(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:i}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=i.next);let n=e[t],o=Kn(n);for(;o;){if(o.next===r)return void(o.next=i.next);n=o.next,o=Kn(n)}}}catch{return Gn}}const xh=se("[TracingHeaders]"),ct=se("[Web Vitals]"),Yn=9e5,Jn=["CLS","FCP","INP","LCP"],$h=["INP","LCP"],kh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Di="disabled",Zn="lazy_loading",ze=se("[SessionRecording]"),Eh=se("[Heatmaps]");function Ni(e){return L(e)&&"clientX"in e&&"clientY"in e&&ne(e.clientX)&&ne(e.clientY)}const Ss=se("[Product Tours]"),ji=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(Pr))},Sh=["$set_once","$set"],De=se("[SiteApps]"),Xn="Error while initializing PostHog app with config id ",$l=(e,t)=>
2e!=null&&e.then?e.then(t):t(e),kt="SDK is not enabled or survey functionality is not yet loaded",Qn="Disabled. Not loading surveys.";var Mh=class{constructor(e,t){this.yo=e,this.mh=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.yh=!1,this.bh=[],this._h=null,this.wh=null,this.So=!1,this.kh=new Set,this.onRemoteConfig=s=>{if(this.So||this.Mr.disableSurveys)return;if(!s.ok)return V.warn("Remote config unavailable. Not loading surveys.");const i=s.config.surveys;if(T(i))return V.warn("Flags not loaded yet. Not loading surveys.");this.Sh=$e(i)?i:i.length>0,V.info(`flags response received, isSurveysEnabled: ${this.Sh}`),this.loadIfEnabled()}}setup(e){if(!this.So)return this.xh=e,$l(e.kv.initialize(),()=>{if(this.xh!==e||this.So)return;this.xh=void 0,this.po=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.So?t.dispose():(this.$o=t,this.loadIfEnabled())})}dispose(){var e,t,s,i;this.So||(this.So=!0,this.xh=void 0,this.po=void 0,(e=this.$o)===null||e===void 0||e.dispose(),this.$o=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(s=this._surveyManager)===null||s===void 0||(i=s.dispose)===null||i===void 0||i.call(s),this._surveyManager=null,this.bh=[],this._h=null,this.kh.forEach(r=>clearTimeout(r)),this.kh.clear())}get Mr(){return this.yo.get()}initialize(){this.loadIfEnabled()}reset(){try{var e;(e=this._surveyEventReceiver)===null||e===void 0||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let s=0;s<localStorage.length;s++){const i=localStorage.key(s);(i!=null&&i.startsWith("seenSurvey_")||i!=null&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach(s=>localStorage.removeItem(s))}catch{}}loadIfEnabled(){if(this.So||!this.po)return;const e=this.Mr;if(this._surveyManager)return;if(this.yh)return void V.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void V.info(Qn);if(e.cookielessMode&&this.yo.isOptedOut())return void V.info("Not loading surveys in cookieless mode without consent.");const t=this.yo.getExtensions();if(!t)return void V.error("PostHog Extensions not found.");if(b(this.Sh)&&!e.advancedEnableSurveys)return;const s=this.Sh||e.advancedEnableSurveys;this.yh=!0;try{const i=t.generateSurveys;if(i)return this.Ch(i,s),void(this.yh=!1);const r=t.loadExternalDependency;if(!r)return this.$h(Or),void(this.yh=!1);r(n=>{try{if(this.So)return;const o=this.yo.getExtensions();n||!(o!=null&&o.generateSurveys)?this.$h("Could not load surveys script",n):this.Ch(o.generateSurveys,s)}finally{this.yh=!1}})}catch(i){throw this.yh=!1,this.$h("Error initializing surveys",i),i}}Ch(e,t){this.So||(this._surveyManager=e(t),this._surveyEventReceiver=this.yo.createEventReceiver(),V.info("Surveys loaded successfully"),this.Th({isLoaded:!0}))}$h(e,t){V.error(e,t),this.Th({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.bh.push(e),this._surveyManager&&this.Th({isLoaded:!0}),()=>{this.bh=this.bh.filter(t=>t!==e)}}getSurveys(e,t=!1){var s;const i=(s=this.po)!==null&&s!==void 0?s:this.mh;if(!i||this.So)return;if(this.Mr.disableSurveys)return V.info(Qn),e([]);const r=i.kv.get(ir);if(r&&!t)return e(r,{isLoaded:!0}),void(this.Ih()&&this.getSurveys(()=>{},!0));if(this._h)return void this._h.then(({surveys:a,context:l})=>{this.So||e(a,l)}).catch(a=>V.error("Error in survey callback",a));const n=this.Mh("/api/surveys/",{method:"GET",query:{token:i.projectToken},sentAt:"query",timeoutMs:this.Mr.requestTimeoutMs}).then(a=>{try{return this.Eh(i,a)}catch(l){return V.error("Error processing surveys response",l),this.Eh(i,{statusCode:0,error:l})}},a=>this.Eh(i,{statusCode:0,error:a}));this._h=n;const o=()=>{this._h===n&&(this._h=null)};n.then(a=>{o(),this.So||e(a.surveys,a.context)},o).catch(a=>V.error("Error in survey callback",a))}Mh(e,t){const s=this.po;return s?s.sendRequest(e,t):new Promise(i=>i({statusCode:0,error:new Error(kt)}))}Eh(e,t){if(this.So)return{surveys:[],context:{isLoaded:!1,error:kt}};const s=t.statusCode;if(s!==200||!t.json){const o=`Surveys API could not be loaded, status: ${s}`;return s!==0?V.error(o):t.error||V.warn(o),this.wh=Date.now(),{surveys:[],context:{isLoaded:!1,error:o}}}this.wh=null;const i=t.json.surveys||[],r=i.filter(o=>function(a){return!(!a.start_date||a.end_date)}(o)&&(gl(o)||function(a){var l;return!!(!((l=a.conditions)===null||l===void 0||(l=l.actions)===null||l===void 0||(l=l.values)===null||l===void 0)&&l.length)}(o)));var n;return r.length>0&&((n=this._surveyEventReceiver)===null||n===void 0||n.register(r)),e.kv.set({[ir]:i,[zs]:Date.now()}),{surveys:i,context:{isLoaded:!0}}}Ih(){return this.Ph()&&!this._h&&!this.Rh()}Ph(){var e,t;const s=(e=(t=this.po)!==null&&t!==void 0?t:this.mh)===null||e===void 0?void 0:e.kv.get(zs);return ne(s)&&Date.now()-s>3e5}Rh(){return ne(this.wh)&&3e5>Date.now()-this.wh}markSurveyAsSeen(e,t){var s;const i={id:e,current_iteration:(s=t==null?void 0:t.iteration)!==null&&s!==void 0?s:null};yl(i);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Th(e){for(const t of this.bh)try{if(!e.isLoaded)return t([],e);
2this.getSurveys(t)}catch(s){V.error("Error in survey callback",s)}}getActiveMatchingSurveys(e,t=!1){if(!T(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);V.warn("init was not called")}Ah(e){let t=null;return this.getSurveys(s=>{var i;t=(i=s.find(r=>r.id===e))!==null&&i!==void 0?i:null}),t}Fh(e){if(T(this._surveyManager))return{eligible:!1,reason:kt};const t=typeof e=="string"?this.Ah(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Oh(e){if(!this.yo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(T(this._surveyManager))return{eligible:!1,reason:kt};const t=typeof e=="string"?this.Ah(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(T(this._surveyManager))return V.warn("init was not called"),{visible:!1,disabledReason:kt};const t=this.Oh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return T(this._surveyManager)?(V.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:kt})):new Promise(s=>{this.getSurveys(i=>{var r;const n=(r=i.find(o=>o.id===e))!==null&&r!==void 0?r:null;if(n){const o=this.Oh(n);s({visible:o.eligible,disabledReason:o.reason})}else s({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,s){var i;if(!this.yo.isCapturing())return;if(T(this._surveyManager))return void V.warn("init was not called");const r=typeof e=="string"?this.Ah(e):e;if(!(r!=null&&r.id))return void V.warn("Survey not found");if(!nh.includes(r.type))return void V.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const n=w==null?void 0:w.querySelector(t);if(n){if(!((i=r.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds){V.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const o=setTimeout(()=>{var a,l;this.kh.delete(o),!this.So&&this.yo.isCapturing()&&(V.info(`Rendering survey ${r.id} with delay of ${(a=r.appearance)===null||a===void 0?void 0:a.surveyPopupDelaySeconds} seconds`),(l=this._surveyManager)===null||l===void 0||l.renderSurvey(r,n,s),V.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.kh.add(o)}this._surveyManager.renderSurvey(r,n,s)}else V.warn("Survey element not found")}displaySurvey(e,t){var s;if(!this.yo.isCapturing())return;if(T(this._surveyManager))return void V.warn("init was not called");const i=this.Ah(e);if(!i)return void V.warn("Survey not found");let r=i;if(!((s=i.appearance)===null||s===void 0)&&s.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=f(f({},i),{},{appearance:f(f({},i.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==dr.Popover&&t.initialResponses&&V.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const n=this.Fh(i);if(!n.eligible)return void V.warn("Survey is not eligible to be displayed: ",n.reason)}t.displayType!==dr.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}cancelPendingSurvey(e){T(this._surveyManager)?V.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 Et(e,t,s){if(T(e))return!1;switch(s){case"exact":return e===t;case"contains":{const i=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var Ph=class{constructor(e){this._instance=e,this.Dh=new Set,this.Lh=new Set,this.Nh=new Ys,this.qh=(t,s)=>this.jh(t,s)&&this.Bh(t,s)&&this.Hh(t,s)&&this.zh(t,s),this.jh=(t,s)=>!(s!=null&&s.event)||(t==null?void 0:t.event)===(s==null?void 0:s.event)}init(){var e,t;b((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.Uh=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((s,i)=>{this.on(s,i)}))}dispose(){var e;(e=this.Uh)===null||e===void 0||e.call(this),this.Uh=void 0,this.Nh=new Ys}register(e){var t,s;if(!b((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(i=>
2{var r;this.Dh.add(i),(r=i.steps)===null||r===void 0||r.forEach(n=>{this.Lh.add((n==null?void 0:n.event)||"")})}),(s=this._instance)===null||s===void 0?void 0:s.autocapture)){const i=new Set;this.Dh.forEach(r=>{var n;(n=r.steps)===null||n===void 0||n.forEach(o=>{o!=null&&o.selector&&i.add(o.selector)})}),this._instance.autocapture.setElementSelectors(i)}}replace(e){this.Dh.clear(),this.Lh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.Lh.has(e)||this.Lh.has(t.event))&&this.Dh.forEach(s=>{this.Wh(t,s)&&this.Nh.emit("actionCaptured",s.name)})}Vh(e){this.onAction("actionCaptured",t=>e(t))}Wh(e,t){if((t==null?void 0:t.steps)==null)return!1;for(const s of t.steps)if(this.qh(e,s))return!0;return!1}onAction(e,t){return this.Nh.on(e,t)}Bh(e,t){if(t!=null&&t.url){var s;const i=e==null||(s=e.properties)===null||s===void 0?void 0:s.$current_url;if(!i||typeof i!="string"||!Et(i,t.url,t.url_matching||"contains"))return!1}return!0}Hh(e,t){return!!this.Gh(e,t)&&!!this.Zh(e,t)&&!!this.Qh(e,t)}Gh(e,t){var s;if(!(t!=null&&t.href))return!0;const i=this.Jh(e);if(i.length>0)return i.some(n=>Et(n.href,t.href,t.href_matching||"exact"));const r=(e==null||(s=e.properties)===null||s===void 0?void 0:s.$elements_chain)||"";return!!r&&Et(function(n){const o=n.match(/(?::|")href="(.*?)"/);return o?o[1]:""}(r),t.href,t.href_matching||"exact")}Zh(e,t){var s;if(!(t!=null&&t.text))return!0;const i=this.Jh(e);if(i.length>0)return i.some(l=>Et(l.text,t.text,t.text_matching||"exact")||Et(l.$el_text,t.text,t.text_matching||"exact"));const r=(e==null||(s=e.properties)===null||s===void 0?void 0:s.$elements_chain)||"";return!!r&&(n=function(l){const u=[],c=/(?::|")text="(.*?)"/g;let h;for(;!T(h=c.exec(l));)u.includes(h[1])||u.push(h[1]);return u}(r),o=t.text,a=t.text_matching||"exact",n.some(l=>Et(l,o,a)));var n,o,a}Qh(e,t){var s,i;if(!(t!=null&&t.selector))return!0;const r=e==null||(s=e.properties)===null||s===void 0?void 0:s.$element_selectors;if(r!=null&&r.includes(t.selector))return!0;const n=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch{return!1}return!1}Jh(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}zh(e,t){return!(t!=null&&t.properties)||t.properties.length===0||ml(t.properties.reduce((s,i)=>{const r=I(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return s[i.key]={values:r,operator:i.operator||"exact"},s},{}),e==null?void 0:e.properties)}},Fh=class{constructor(e){var t,s;this.Kh=[],this._instance=e,this.Xh=new Map,this.Yh=new Map,this.tc=new Map,this.ec=(t=this._instance)===null||t===void 0||(s=t.onSessionId)===null||s===void 0?void 0:s.call(t,i=>this.nc(i))}sc(e){return!1}rc(){return null}oc(e){}lc(){}ac(e,t){return!!e&&ml(e.propertyFilters,t==null?void 0:t.properties)}uc(e,t){const s=new Map;return e.forEach(i=>{var r;(r=i.conditions)===null||r===void 0||(r=r[t])===null||r===void 0||(r=r.values)===null||r===void 0||r.forEach(n=>{if(n!=null&&n.name){const o=s.get(n.name)||[];o.push(i.id),s.set(n.name,o)}})}),s}hc(e,t,s){const i=(s===qt.Activation?this.Xh:this.Yh).get(e);let r=[];return this.cc(n=>{r=n.filter(o=>i==null?void 0:i.includes(o.id))}),r.filter(n=>{var o;const a=(o=n.conditions)===null||o===void 0||(o=o[s])===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.find(l=>l.name===e);return this.ac(a,t)})}register(e){this.dc(e,!1)}replace(e){this.dc(e,!0)}dc(e,t){var s;b((s=this._instance)===null||s===void 0?void 0:s._addCaptureHook)||(this.vc(e,t),this.fc(e,t))}fc(e,t){const s=e.filter(n=>{var o;return(o=n.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.length});var i;if(t&&this.tc.clear(),s.length===0)return void(t&&((i=this.gc)===null||i===void 0||i.replace([])));this.gc||(this.gc=new Ph(this._instance),this.gc.init(),this.gc.Vh(n=>this.onAction(n)));const r=[];s.forEach(n=>{var o;(o=n.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||o.values.forEac
2h(a=>{if(r.push(a),a.name){var l;const u=(l=this.tc.get(a.name))!==null&&l!==void 0?l:[];u.includes(n.id)||u.push(n.id),this.tc.set(a.name,u)}})}),t?this.gc.replace(r):this.gc.register(r)}mc(e,t){t.forEach((s,i)=>{var r;const n=(r=e.get(i))!==null&&r!==void 0?r:[];s.forEach(o=>{n.includes(o)||n.push(o)}),e.set(i,n)})}vc(e,t){var s,i;const r=e.filter(l=>{var u,c;return((u=l.conditions)===null||u===void 0?void 0:u.events)&&((c=l.conditions)===null||c===void 0||(c=c.events)===null||c===void 0||(c=c.values)===null||c===void 0?void 0:c.length)>0}),n=e.filter(l=>{var u,c;return((u=l.conditions)===null||u===void 0?void 0:u.cancelEvents)&&((c=l.conditions)===null||c===void 0||(c=c.cancelEvents)===null||c===void 0||(c=c.values)===null||c===void 0?void 0:c.length)>0}),o=this.uc(e,qt.Activation),a=this.uc(e,qt.Cancellation);t?(this.Xh=o,this.Yh=a):(this.mc(this.Xh,o),this.mc(this.Yh,a)),(r.length!==0||n.length!==0)&&((s=this.Uh)!==null&&s!==void 0||(this.Uh=(i=this._instance)===null||i===void 0?void 0:i._addCaptureHook((l,u)=>{this.onEvent(l,u)})))}onEvent(e,t){var s,i;const r=this.yc(),n=(t==null||(s=t.properties)===null||s===void 0?void 0:s.$survey_id)||(t==null||(i=t.properties)===null||i===void 0?void 0:i.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){const a=this.bc(e,n);if(a==="consume")return r.info("event consumed activated item, removing it",{event:e,itemId:n}),void this._c([n]);if(a==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:n}),this.wc(n),void this.kc([n])}if(this.Yh.has(e)){const a=this.hc(e,t,qt.Cancellation);a.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(l=>l.id)}),this._c(a.map(l=>l.id)),a.forEach(l=>this.Sc(l.id)))}if(!this.Xh.has(e))return;r.info("event name matched",{event:e,eventPayload:t,items:this.Xh.get(e)});const o=this.hc(e,t,qt.Activation);this.xc(o.map(a=>a.id))}onAction(e){this.tc.has(e)&&this.xc(this.tc.get(e)||[])}xc(e){var t,s;if(e.length===0)return;const i=!!(!((t=this._instance)===null||t===void 0||(s=t.get_session_id)===null||s===void 0)&&s.call(t)),r=[];for(const n of e)i&&this.sc(n)?this.wc(n)&&this.Cc(n):r.push(n);r.length>0&&(this.Kh=[...new Set([...this.Kh,...r])]),this.yc().info("updating activated items",{activatedItems:this.getActivatedIds()})}wc(e){this.Kh=this.Kh.filter(s=>s!==e);const t=this.$c();return!t.includes(e)&&(this.Tc([...t,e]),this.Ic(),!0)}_c(e){const t=new Set(e);this.Kh=this.Kh.filter(r=>!t.has(r));const s=this.Mc(),i=s.filter(r=>!t.has(r));i.length!==s.length&&(this.Tc(i),i.length===0&&this.Ec()),this.kc(e)}Pc(){var e;const t=this.rc();if(!t)return{};const s=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return s&&typeof s=="object"?s:{}}Cc(e){if(!this.rc())return;const t=this.Pc();this.oc(f(f({},t),{},{[e]:Date.now()}))}kc(e){if(!this.rc())return;const t=this.Pc(),s={};let i=!1;for(const[r,n]of Object.entries(t))e.includes(r)?i=!0:s[r]=n;i&&(ke(s)?this.lc():this.oc(s))}Rc(){this.rc()&&this.lc()}getActivationTimestamp(e){if(!this.$c().includes(e))return;const t=this.Pc()[e];return ne(t)?t:void 0}Mc(){var e;const t=this.Ac();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}$c(){var e,t,s;const i=this.Mc();if(i.length===0)return[];const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.Fc()],n=(t=this._instance)===null||t===void 0||(s=t.get_session_id)===null||s===void 0?void 0:s.call(t);return n&&r===n?i:[]}Ic(){var e,t;const s=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);s&&this.Oc(s)}Ec(){this.Dc()}nc(e){var t;const s=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.Fc()];if(s&&s!==e){const i=this.Mc(),r=this.Pc();i.length>0&&(this.Tc([]),i.filter(n=>ne(r[n])).forEach(n=>this.Sc(n))),this.Ec(),this.Rc()}}getActivatedIds(){return[...new Set([...this.$c(),...this.Kh])].filter(e=>!this.Lc(e))}dispose(){var e,t,s;(e=this.ec)===null||e===void 0||e.call(this),this.ec=void 0,(t=this.Uh)===null||t===void 0||t.call(this),this.Uh=void 0,(s=this.gc)===null||s===void 0||s.dispose(),this.gc=void 0}reset(){this.Kh=[],this.Mc().length>0&&this.Tc([]),this.Ec(),this.Rc()}
2getEventToItemsMap(){return this.Xh}Nc(){return this.gc}},Oh=class extends Fh{constructor(e){super(e)}Ac(){return ba}Fc(){return wa}rc(){return xa}oc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}lc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}sc(e){var t;let s;this.cc(r=>{s=r.find(n=>n.id===e)});const i=s==null||(t=s.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return ne(i)&&i>0}qc(){return Ke.SHOWN}cc(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Sc(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}yc(){return V}Tc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}Oc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}Dc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}Lc(){return!1}bc(e,t){let s;return this.cc(i=>{s=i.find(r=>r.id===t)}),!s||function(i){var r;return gl(i)&&!!(!((r=i.conditions)===null||r===void 0||(r=r.events)===null||r===void 0)&&r.repeatedActivation)||i.schedule==="always"}(s)?e===Ke.SHOWN?"consume":"ignore":e===Ke.SHOWN?"persist":e===Ke.DISMISSED||e===Ke.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Ch=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const t={};for(const s of e){const i=this._instance.get_property(s);b(i)||(t[s]=i)}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)}},Ih=class{constructor(e){this._instance=e}get(){const 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(){const e=C==null?void 0:C.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:s}=e;return{generateSurveys:t?i=>t(this._instance,i):void 0,loadExternalDependency:s?i=>s(this._instance,"surveys",i):void 0}}createEventReceiver(){return new Oh(this._instance)}};const Rh=y!=null&&y.location?Us(y.location.hash,"__posthog")||Us(location.hash,"state"):null,eo="_postHogToolbarParams",to=se("[Toolbar]"),so=se("[FeatureFlags]");var Th=class{constructor(e,t=!1){this.jc=!1,this.update(e,t)}update(e,t){this.Bc=((s,i)=>{var r,n,o,a,l,u,c;return{bootstrap:{featureFlags:(r=(n=s.bootstrap)===null||n===void 0?void 0:n.featureFlags)!==null&&r!==void 0?r:void 0,featureFlagPayloads:(o=(a=s.bootstrap)===null||a===void 0?void 0:a.featureFlagPayloads)!==null&&o!==void 0?o:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!s.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!s.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!s.advanced_feature_flags_dedup_per_session,cacheTtlMs:s.feature_flag_cache_ttl_ms,refreshIntervalMs:(l=s.remote_config_refresh_interval_ms)!==null&&l!==void 0?l:3e5,idleRefreshBackoff:b(s.remote_config_refresh_interval_ms),requestTimeoutMs:s.feature_flag_request_timeout_ms,compression:s.disable_compression?void 0:"best-available",evaluationContexts:(u=(c=s.evaluation_contexts)!==null&&c!==void 0?c:s.evaluation_environments)!==null&&u!==void 0?u:[],flagKeys:I(s.flag_keys)?s.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.jc||(so.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.jc=!0),b(e.flag_keys)||I(e.flag_keys)||so.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Bc}};const io=se("[FeatureFlags]"),ht=se("[FeatureFlags]",{debugEnabled:!0}),Bi=`" failed. Feature flags didn't load in time.`,ro=["click","keydown","wheel","touchstart","pointerdown"],no="connection_error",oo=e=>{const t={};for(let s=0;e.length>s;s++)t[e[s]]=!0;return t},ao=e=>{const t={};for(const[s,i]of Cs(e||{}))i&&(t[s]=i);return t},lo=e=>fs(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),Ie=se("[Error tracking]"),mr="webkit-masked-url:",Ah=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Lh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",mr],Dh=["__firefox__","__gCrWeb"],uo="Refusing to render web experiment since the viewer is a likely bot",Nh={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Js(t,e),not_regex:(e,t)=>!Js(t,e),exact:(e,t)=>
2t===e,is_not:(e,t)=>t!==e},Fe=se("[Conversations]"),dt="Conversations not available yet.";function co(e,t){var s,i,r,n,o,a,l;const u=(s=e==null?void 0:e.flushIntervalMs)!==null&&s!==void 0?s:3e3,c=(i=e==null?void 0:e.maxBufferSize)!==null&&i!==void 0?i:100,h=t!=null&&t.consoleCapture?void 0:(r=e==null?void 0:e.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,p=b(h)?Math.max(c,2048):Math.max(c,h),d=f(f({},function(){let g="",m="";try{const v=pe==null?void 0:pe.userAgent;v&&([g,m]=Wo(v))}catch{}return function(v,_){const x=function($){if($)return{}.hasOwnProperty.call(un,$)?un[$]:$}(v);return f(f({},x?{"os.name":x}:{}),_?{"os.version":_}:{})}(g,m)}()),e==null?void 0:e.resourceAttributes);return{serviceName:(n=(o=d==null?void 0:d["service.name"])!==null&&o!==void 0?o:e==null?void 0:e.serviceName)!==null&&n!==void 0?n:t==null?void 0:t.serviceNameDefault,serviceVersion:(a=d==null?void 0:d["service.version"])!==null&&a!==void 0?a:e==null?void 0:e.serviceVersion,environment:(l=d==null?void 0:d["deployment.environment"])!==null&&l!==void 0?l:e==null?void 0:e.environment,resourceAttributes:d,beforeSend:e==null?void 0:e.beforeSend,flushIntervalMs:u,maxBufferSize:c,maxQueueSize:p,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const jh=["debug","log","warn","error","info"],Bh=e=>{for(;e!=null&&e.__rrweb_original__;)e=e.__rrweb_original__;return e},ho="console",kl="__posthogHandledLogsRequestError",Hi=(e,t)=>{const s=e instanceof Error?e:new Error(t);return s[kl]=!0,s},po=e=>!!e&&typeof e=="object"&&e[kl]===!0,Zs=se("[NetworkMetrics]"),jr=()=>{var e;return!(y==null||(e=y.performance)===null||e===void 0)&&e.now?y.performance.now():Date.now()},Hh=e=>e?`${Math.floor(e/100)}xx`:"missing",El=(e,t)=>{var s;const i=String(t);return{method:String(e).toUpperCase(),url:((s=at(i))===null||s===void 0?void 0:s.href)||i}},yr=(e,t,s,i,r)=>{try{var n,o,a;const u=r();if(!u)return;const c=s||void 0,h=jr()-i,p=at(t.url);if(p&&p.protocol!=="http:"&&p.protocol!=="https:")return;const d={url:(p==null?void 0:p.href)||t.url,method:t.method},g=de(u.name)?u.name(d):A(u.name)?u.name:"http.client.request.duration";if(!g)return;const m=f({method:d.method,host:(n=p==null?void 0:p.hostname)!==null&&n!==void 0?n:"",path:p?(l=p.pathname,l.split("/").map(v=>(_=>/^\d+$/.test(_)||_.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(_))(v)?":id":v).join("/")):"",status_class:Hh(c)},(o=u.attributes)===null||o===void 0?void 0:o.call(u,d,{status:c,durationMs:h}));(a=e.metrics)===null||a===void 0||a.histogram(g,h,{unit:"ms",attributes:m})}catch(u){Zs.error("Failed to record network metric",u)}var l},Sl=()=>{},qh=(e,t)=>de(y==null?void 0:y.fetch)?ps(y,"fetch",s=>function(...i){const r=jr(),n=s.apply(this,i);if(!t())return n;try{var o,a,l;const[u,c]=i,h=El((o=(a=c==null?void 0:c.method)!==null&&a!==void 0?a:u==null?void 0:u.method)!==null&&o!==void 0?o:"GET",(l=u==null?void 0:u.url)!==null&&l!==void 0?l:u);return n.then(p=>(yr(e,h,p==null?void 0:p.status,r,t),p),p=>{throw yr(e,h,void 0,r,t),p})}catch(u){return Zs.error("Failed to observe fetch",u),n}}):Sl,zh=(e,t)=>{var s;const i=y==null||(s=y.XMLHttpRequest)===null||s===void 0?void 0:s.prototype;if(!i)return Sl;const r=new WeakMap,n=ps(i,"open",a=>function(...l){try{ol.has(this)||r.set(this,El(l[0],l[1]))}catch(u){Zs.error("Failed to observe XHR open",u)}return a.apply(this,l)}),o=ps(i,"send",a=>function(...l){let u;try{const c=r.get(this);if(c&&t()){const h=jr();u=()=>{this.removeEventListener("loadend",u),yr(e,c,this.status,h,t)},H(this,"loadend",u)}}catch(c){Zs.error("Failed to observe XHR send",c)}try{return a.apply(this,l)}catch(c){throw u&&this.removeEventListener("loadend",u),c}});return()=>{n(),o()}},si={featureFlags:class{constructor(e){this.name="featureFlags",this.Hc=!1,this.featureFlagEventHandlers=[],this.$=io,this.zc={},this.Uc={},this.Wc=[],this.Vc=!1,this.Gc=!1,this.Zc=0,this.Qc=!1,this.Jc=!1,this.Kc=!1,this.Xc=!1,this.Yc=0,this.td=!1,this.sn=()=>{const t=this.ed();this.Yc=0,t&&this.reloadFeatureFlags()},this.nd=()=>{var t,s;const i=this.sd,r=(t=this.rd)!==null&&t!==void 0?t:i;b(i)||b(r)||this.Mr.remoteRequestsDisabled||!w||w.visibilityState==="hidden"||Date.now()-((s=this.od)!==null&&s!==void 0?s:0)<r||(this.rd=this.td||!this.Mr.idleRefreshBackoff?i:Math.min(2*r,36e5),this.td=!1,this.reloadFeatureFlags(),this.ld())},this.ad=()=>{this.td&&this.rd===this.sd||this.ud()},this.an=()=>{(w==null?void 0:w.visibilityState)==="visible"&&this.ud()},"get"in e?this.yo=e:(this._instance=e,this.hd=new Th(e.config,e.Xl()),this.yo=this.hd)}updateConfig(e,t){var s;(s=this.hd)===null||s===void 0||s.update(e,t),this.po&&this.dd()}setup(e){return this.xh=e,this.$=e.logger.createLogger("[FeatureFlags]"),$l(e.kv.initialize(),()=>{this.xh===e&&(this.xh=void 0,this.po=e,this.vd(e))})}vd(e){var t;if(this.po===e)return y&&H(y,"online",this.sn),this.dd(),this.fd=e.registerDynamicEventProperties(()=>this.pd()?this.zc:this.Uc),this.gd=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.md(),this.yd(),this.bd()}),this.yd(),this.initialize()}ud(){this.td=!0,this.rd=this.sd,this.nd()}dd(){const e=this.Mr.refreshIntervalMs,t=!this.Mr.remoteRequestsDisabled&&w&&!b(e)&&e>0?e:void 0;this.Mr.idleRefreshBackoff||(this.rd=t),t!==this.sd&&(this._d(),b(t)||(this.sd=t,this.rd=t,this.ld(),w!=null&&w.addEventListener&&(H(w,ls,this.an),Pt(ro,s=>{H(w,s,this.ad,{capture:!0})}
2))))}ld(){b(this.sd)||(b(this.wd)||clearInterval(this.wd),this.od=Date.now(),this.wd=setInterval(this.nd,this.sd))}_d(){var e;b(this.wd)||(clearInterval(this.wd),this.wd=void 0,w==null||(e=w.removeEventListener)===null||e===void 0||e.call(w,"visibilitychange",this.an),Pt(ro,t=>{var s;w==null||(s=w.removeEventListener)===null||s===void 0||s.call(w,t,this.ad,{capture:!0})})),this.sd=void 0,this.rd=void 0,this.td=!1,this.od=void 0}destroy(){this.kd()}dispose(){this.kd()}kd(){var e,t;this._d(),this.Zc++,this.Jc=!1,this.xh=void 0,this.po&&(this.Sd(),(e=this.fd)===null||e===void 0||e.dispose(),this.fd=void 0,(t=this.gd)===null||t===void 0||t.call(this),this.gd=void 0,this.Wc=[],y==null||y.removeEventListener("online",this.sn),this.po=void 0)}get Mr(){return this.yo.get()}xd(e){var t;return this.Cd&&e in this.Cd?this.Cd[e]:(t=this.po)===null||t===void 0?void 0:t.kv.get(e)}md(){return!!this.Cd&&(this.Cd=void 0,!0)}$d(){var e;return!b((e=this.po)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.md()}At(e){this.Td(()=>{var t;return(t=this.po)===null||t===void 0?void 0:t.kv.set(e)})}Id(e,t,s){var i;if(!(!((i=this._instance)===null||i===void 0)&&i.persistence)||!e.$enabled_feature_flags)return;const r=this.xd("$enabled_feature_flags")||{},n=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,_])=>!(_!=null&&_.failed)).map(([_])=>_):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,u=l?a:s&&!I(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(r),...Object.keys(n)])),c=this.xd("$feature_flag_payloads")||{},h=e.$feature_flag_payloads||{},p=l||s?u:Array.from(new Set([...Object.keys(c),...Object.keys(h)])),d=!l&&!s,g=!!d||u,m=!!d||p,v={[Ue]:g,[Ae]:g,[tt]:m};e.$feature_flag_details&&(v[gt]=g);for(const _ of[_t,nt,Xt])b(e[_])||(v[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(v)}Lt(e){this.Td(()=>{var t;return(t=this.po)===null||t===void 0?void 0:t.kv.remove(e)})}Td(e){try{e()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}yd(){const e={};for(const i of[Ue,tt,_t,Ne]){const r=this.xd(i);b(r)||(e[i]=r)}this.zc=e;const t=f({},e),s=this.xd(Ae);if(s)for(const[i,r]of Object.entries(s))t[`$feature/${i}`]=r;this.Uc=t}pd(){const e=this.Mr.cacheTtlMs;if(!e||0>=e)return!1;const t=this.xd(nt);return typeof t!="number"||Date.now()-t>e}Md(){return!!this.pd()&&(this.Xc||this.Gc||(this.Xc=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Ed(){const e=this.Mr.evaluationContexts;return e!=null&&e.length?e.filter(t=>{const s=t&&typeof t=="string"&&t.trim().length>0;return s||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),s}):[]}Pd(){const e=this.Mr.flagKeys;if(!b(e))return e.filter(t=>{const s=t&&typeof t=="string"&&t.trim().length>0;return s||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),s})}initialize(){var e,t;const s=this.Mr,i=(e=(t=s.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(i).length){var r,n;const o=(r=(n=s.bootstrap)===null||n===void 0?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},a=Object.keys(i).filter(u=>!b(i[u])).reduce((u,c)=>(u[c]=i[c],u),{}),l=Object.keys(o).filter(u=>a[u]).reduce((u,c)=>(u[c]=o[c],u),{});return this.Rd({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(e,t,s){var i,r;const n=s!=null&&s.merge&&(i=this.xd("$enabled_feature_flags"))!==null&&i!==void 0?i:{},o=s!=null&&s.merge&&(r=this.xd("$feature_flag_payloads"))!==null&&r!==void 0?r:{},a=f(f({},n),e),l=f(f({},o),t),u={};for(const[c,h]of Object.entries(a))u[c]={key:c,enabled:rn(h),variant:nn(h),reason:void 0,metadata:b(l==null?void 0:l[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}};this.Rd({flags:u})}get hasLoadedFlags(){return this.Vc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.xd(gt),t=this.xd(Ne),s=this.xd(ft);if(!s&&!t)return e||{};const i=Y({},e||{}),r=[...new Set([...Object.keys(s||{}),...Object.keys(t||{})])];for(const a of r){var n;const l=i[a],u=t==null?void 0:t[a],c=b(u)?(n=l==null?void 0:l.enabled)!==null&&n!==void 0&&n:!!u,h=b(u)?l==null?void 0:l.variant:typeof u=="string"?u:void 0,p=s==null?void 0:s[a],d=f(f({},l),{},{enabled:c,variant:c?h??(l==null?void 0:l.variant):void 0});var o;c!==(l==null?void 0:l.enabled)&&(d.original_enabled=l==null?void 0:l.enabled),h!==(l==null?void 0:l.variant)&&(
2d.original_variant=l==null?void 0:l.variant),p&&(d.metadata=f(f({},l==null?void 0:l.metadata),{},{payload:p,original_payload:l==null||(o=l.metadata)===null||o===void 0?void 0:o.payload})),i[a]=d}return this.Hc||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:s,finalDetails:i}),this.Hc=!0),i}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(s=>{const i=e[s];return{key:s,enabled:rn(i),variant:nn(i),payload:sn(t[s])}})}getFlagVariants(){const e=this.xd(Ae),t=this.xd(Ne);if(!t)return e||{};const s=Y({},e||{}),i=Object.keys(t);for(let r=0;i.length>r;r++)s[i[r]]=t[i[r]];return this.Hc||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:s}),this.Hc=!0),s}getFlagPayloads(){const e=this.xd(tt),t=this.xd(ft);if(!t)return e||{};const s=Y({},e||{}),i=Object.keys(t);for(let r=0;i.length>r;r++)s[i[r]]=t[i[r]];return this.Hc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:s}),this.Hc=!0),s}reloadFeatureFlags(){this.Qc||this.Mr.featureFlagsDisabled||this.ed()||(this.Gc&&(this.Jc=!0),this.Ad||(this.Wc.slice().forEach(e=>{try{e()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.Ad=setTimeout(()=>{this.Fd()},5)))}Sd(){clearTimeout(this.Ad),this.Ad=void 0}onReloading(e){return this.Wc.push(e),()=>{this.Wc=this.Wc.filter(t=>t!==e)}}ensureFlagsLoaded(){this.Vc||this.Gc||this.Ad||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Qc=e}resetFlagCallReported(){this.Lt(rt)}Fd(e){this.Sd();const t=this.po;if(!t||this.Mr.remoteRequestsDisabled||this.ed())return;if(this.Gc)return void(this.Jc=!0);const s={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:f(f(f({},t.initialPersonProperties),this.xd("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.xd(it),timezone:Qa()};b(t.deviceId)||(s.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.Mr.featureFlagsDisabled)&&(s.disable_flags=!0);const i=this.Ed();i.length&&(s.evaluation_contexts=i);const r=this.Pd();b(r)||(s.flag_keys=r);const n=this.Mr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),a=this.Zc;this.Gc=!0;const l=()=>{this.Jc&&(this.Jc=!1,this.Fd())},u=h=>{var p,d;const g=(p=h.json)!==null&&p!==void 0?p:{},m=h.statusCode!==200;if(this.Gc=!1,a!==this.Zc)return void l();if(this.Od(h.statusCode),m||this.Jc||(this.$anon_distinct_id=void 0),s.disable_flags&&!this.Jc)return;this.Kc=!m;const v=[];h.error?v.push(h.error instanceof Error&&h.error.name==="AbortError"?"timeout":h.error instanceof Error?no:"unknown_error"):h.statusCode!==200&&v.push(`api_error_${h.statusCode}`),g.errorsWhileComputingFlags&&v.push("errors_while_computing_flags");const _=!!(!((d=g.quotaLimited)===null||d===void 0)&&d.includes("feature_flags"));_&&v.push("quota_limited"),this.At({[as]:v}),_?this.$.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.Rd(g,m,{partialResponse:n}),l()},c=h=>{this.Gc=!1,a===this.Zc&&(this.At({[as]:[no]}),this.$.error("Feature flag request failed",h),this.$d()&&this.bd(!0)),l()};try{t.sendRequest(o,{target:"flags",method:"POST",body:s,compression:this.Mr.compression,sentAt:"body",timeoutMs:this.Mr.requestTimeoutMs}).then(u).catch(c)}catch(h){c(h)}}ed(){return Va(this.Yc,3)}Od(e){this.Yc=Wa(e,this.Yc,3,()=>this.$.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 s;if(t.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+Bi);if(this.Md())return;const i=this.getFeatureFlagResult(e,t);return(s=i==null?void 0:i.variant)!==null&&s!==void 0?s:i==null?void 0:i.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return t==null?void 0:t.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.Kc)return;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+Bi);if(this.Md())return;const s=this.getFlagVariants(),i=e in s,r=s[e],n=this.getFlagPayloads()[e],o=String(r),a=this.xd("$feature_flag_request_id")||void 0,l=this.xd("$feature_flag_evaluated_at")||void 0;let u,c=this.xd("$flag_call_reported")||{};if(this.Mr.deduplicateCallsPerSession){var h;const M=(h=this.po)===null||h===void 0?void 0:h.session.sessionId,D=this.xd(Gt);M&&M!==D&&(c={},u=M)}if(t.send_event||!("send_event"in t))if(e in c&&c[e].includes(o))u&&this.At({[rt]:c,[Gt]:u});else{var p,d,g,m,v,_,x,$,O,k,P,F;I(c[e])?c[e].push(o):c[e]=[o],this.At(f({[rt]:c},u?{[Gt]:u}:{}));const M=this.getFeatureFlagDetails(e),D=[...(p=this.xd("$feature_flag_errors"))!==null&&p!==void 0?p:[]];b(r)&&D.push("flag_missing");const j={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(d=(g=this.Mr.bootstrap)===null||g===void 0||(g=g.featureFlags)===null||g===void 0?void 0:g[e])!==null&&d!==void 0?d:null,$feature_flag_bootstrapped_payload:(m=(v=this.Mr.bootstrap)===null||v===void 0||(v=v.featureFlagPayloads)===null||v===void 0?void 0:v[e])!==null&&m!==void 0?m:null,$used_bootstrap_value:!this.Kc};b(M==null||(_=M.metadata)===null||_===void 0?void 0:_.has_experiment)||(j.$feature_flag_has_experiment=M.metadata.has_experiment),b(M==null||(x=M.metadata)===null||x===void 0?void 0:x.version)||(j.$feature_flag_version=M.metadata.version);
2const q=($=M==null||(O=M.reason)===null||O===void 0?void 0:O.description)!==null&&$!==void 0?$:M==null||(k=M.reason)===null||k===void 0?void 0:k.code;var S;q&&(j.$feature_flag_reason=q),!(M==null||(P=M.metadata)===null||P===void 0)&&P.id&&(j.$feature_flag_id=M.metadata.id),b(M==null?void 0:M.original_variant)&&b(M==null?void 0:M.original_enabled)||(j.$feature_flag_original_response=b(M.original_variant)?M.original_enabled:M.original_variant),!(M==null||(F=M.metadata)===null||F===void 0)&&F.original_payload&&(j.$feature_flag_original_payload=M==null||(S=M.metadata)===null||S===void 0?void 0:S.original_payload),D.length&&(j.$feature_flag_error=D.join(",")),this.Dd(j)}else u&&this.At({[rt]:c,[Gt]:u});return i?{key:e,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:sn(n)}:void 0}Dd(e){try{var t;(t=this.po)===null||t===void 0||t.capture("$feature_flag_called",e).catch(s=>{this.$.error("Failed to capture feature flag call",s)})}catch(s){this.$.error("Failed to capture feature flag call",s)}}getRemoteConfigPayload(e,t){this.Ld(e,t)}Ld(e,t){var s=this;return J(function*(){const i=s.po;if(!i)return;const r={distinct_id:i.distinctId,token:i.projectToken,person_properties:{$lib:i.library.name,$lib_version:i.library.version}},n=s.Ed();n.length&&(r.evaluation_contexts=n);const o=s.Pd();let a;b(o)||(r.flag_keys=o);try{var l;const u=(l=(yield i.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:s.Mr.compression,sentAt:"body",timeoutMs:s.Mr.requestTimeoutMs})).json)===null||l===void 0?void 0:l.featureFlagPayloads;a=(u==null?void 0:u[e])||void 0}catch(u){return void s.$.error("Remote config feature flag request failed",u)}try{t(a)}catch(u){s.$.error("Remote config feature flag callback failed",u)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.Kc)return t.defaultValue;if(!(this.Vc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+Bi),t.defaultValue;const s=this.getFeatureFlag(e,t);return b(s)?t.defaultValue:!!s}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,s){this.Rd(e,t,s)}Rd(e,t,s){if(!this.po)return;this.Vc=!0;const i=((r,n={},o={},a={},l,u=io)=>{const c=(($,O)=>{const k=$.flags;if(k){const P=Object.fromEntries(Object.keys(k).map(S=>{var M;return[S,(M=k[S].variant)!==null&&M!==void 0?M:k[S].enabled]})),F=Object.fromEntries(Object.keys(k).filter(S=>k[S].enabled).filter(S=>{var M;return!b((M=k[S].metadata)===null||M===void 0?void 0:M.payload)}).map(S=>{var M;return[S,(M=k[S].metadata)===null||M===void 0?void 0:M.payload]}));return f(f({},$),{},{featureFlags:P,featureFlagPayloads:F})}return $.featureFlags&&O.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),$})(r,u),h=c.flags,p=c.featureFlags,d=c.featureFlagPayloads;if(!p)return;const g=r.requestId,m=r.evaluatedAt;if(I(p)){u.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const $={};if(p)for(let O=0;p.length>O;O++)$[p[O]]=!0;return{[Ue]:p,[Ae]:$,[Xt]:!1}}let v=p,_=d,x=h;if(l!=null&&l.partialResponse){const $=Object.keys(v),O=_||{};v=f(f({},n),v),_=f(f({},o),O),$.forEach(k=>{k in O||_==null||delete _[k]}),x=f(f({},a),x)}else if(r.errorsWhileComputingFlags)if(h){const $=new Set(Object.keys(h).filter(k=>{var P;return!(!((P=h[k])===null||P===void 0)&&P.failed)}));v=f(f({},n),Object.fromEntries(Object.entries(v).filter(([k])=>$.has(k))));const O=Object.fromEntries(Object.entries(_||{}).filter(([k])=>$.has(k)));_=f(f({},o),O),$.forEach(k=>{k in O||_==null||delete _[k]}),x=f(f({},a),Object.fromEntries(Object.entries(x||{}).filter(([k])=>$.has(k))))}else v=f(f({},n),v),_=f(f({},o),_),x=f(f({},a),x);return f(f({[Ue]:Object.keys(ao(v)),[Ae]:v||{},[tt]:_||{},[gt]:x||{},[Xt]:r.minimalFlagCalledEvents===!0},g?{[_t]:g}:{}),m?{[nt]:m}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),s,this.$);if(i)if((s==null?void 0:s.persist)===!1){const r=!b(this.po.kv.get(Ae));this.Cd=i,r||this.At(i)}else this.md(),this.Id(i,e,!!(s!=null&&s.partialResponse)),this.At(i);else t&&this.$d();t||(this.Xc=!1),this.bd(t)}override(e,t=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Nd(e)}Nd(e){if(this.po){if(e===!1)return this.Lt([Ne,ft]),this.bd(),void ht.info("All overrides cleared");if(I(e))return this.At({[Ne]:oo(e)}),this.bd(),void ht.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;const s=e;this.Hc=!!((t=s.suppressWarning)!==null&&t!==void 0&&t);const i={},r=s.flags,n=s.payloads;return r&&(i[Ne]=I(r)?oo(r):r),n&&(i[ft]=n),Object.keys(i).length&&this.At(i),r===!1&&n===!1?this.Lt([Ne,ft]):r===!1?this.Lt(Ne):n===!1&&this.Lt(ft),this.bd(),r===!1?ht.info("Flag overrides cleared"):r&&ht.info("Flag overrides set",{flags:r}),void(n===!1?ht.info("Payload overrides cleared"):n&&ht.info("Payload overrides set",{payloads:n}))}if(e&&typeof e=="object")return this.At({[Ne]:e}),this.bd(),void ht.info("Flag overrides set",{flags:e});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Vc){const{flags:t,flagVariants:s}=this.qd();try{e(t,s)}catch(i){this.$.error("Error while running feature flags callback",i)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,s){var i;const r=(this.xd("$early_access_features")||[]).find(u=>u.flagKey===e),n={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(o.$early_access_feature_name=r.name),s&&(o.$feature_enrollment_stage=s);const a=f(f({},this.getFlagVariants()),{},{[e]:t});(i=this._instance)===null||i===void 0||(i=i.persistence)===null||i===void 0||i.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(n)}),this.At({[Ue]:Object.keys(ao(a)),[Ae]:a,[st]:f(f({},this.xd("$stored_person_properties")||{}),n)}),this.bd();try{var l;(l=this.po)===null||l===void 0||l.capture("$feature_enrollment_update",o).catch(u=>{this.$.error("Failed to capture early access feature enrollment",u)})}catch(u){this.$.error("Failed to capture early access feature enrollment",u)}}getEarlyAccessFeatures(e,t=!1,s){const i=this.xd(sr);!i||t?this.jd(e,s):e(i)}jd(e,t){var s=this;return J(function*(){const i=s.po;if(!i)return;const r=t?`&${t.map(o=>`stage=${o}`).join("&")}`:"";let n;try{const o=yield i.sendRequest(`/api/early_access_features/?token=${i.projectToken}${r}`,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;n=o.json.earlyAccessFeatures,s.At({[sr]:n})}catch(o){return void s.$.error("Early access feature request failed",o)}try{e(n)}catch(o){s.$.error("Early access feature callback failed",o)}})()}qd(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(s=>t[s]),flagVariants:Object.keys(t).filter(s=>t[s]).reduce((s,i)=>(s[i]=t[i],s),{})}}bd(e){this.yd();const{flags:t,flagVariants:s}=this.qd();
2this.featureFlagEventHandlers.forEach(i=>{try{i(t,s,{errorsLoading:e})}catch(r){this.$.error("Error while running feature flags callback",r)}})}setPersonPropertiesForFlags(e,t=!0){this.Bd(e,t)}Bd(e,t=!0){const s=this.xd("$stored_person_properties")||{},i=(e==null?void 0:e.$set)||(e!=null&&e.$set_once?{}:e),r=e==null?void 0:e.$set_once,n={};if(r)for(const o in r)({}).hasOwnProperty.call(r,o)&&(o in s||(n[o]=r[o]));this.At({[st]:f(f(f({},s),n),i)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const s=f({},this.xd("$stored_person_properties")||{});e.forEach(i=>{delete s[i]}),this.At({[st]:s}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(st),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const s=this.xd("$stored_group_properties")||{},i=f({},s);for(const r of Object.keys(e))i[r]=f(f({},s[r]),e[r]);this.At({[it]:i}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.xd("$stored_group_properties")||{};this.At({[it]:f(f({},t),{},{[e]:{}})})}else this.Lt(it)}reset(){this.Zc++,this.Jc=!1,this.zc={},this.Uc={},this.Cd=void 0,this.Vc=!1,this.Qc=!1,this.Kc=!1,this.$anon_distinct_id=void 0,this.Sd(),this.Hc=!1,this.Yc=0}}},Vh={sessionRecording:class{get Mr(){return this._instance.config}get xa(){return this._instance.persistence}get started(){var e;return!!(!((e=this.Hd)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.zd==="awaiting_config"||this.zd==="missing_config"?this.zd:(e=(t=this.Hd)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.zd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.zd=Di,this.Ud=void 0,this.Wd=!1,this.Ke=(()=>{var t,s;if(!(w!=null&&w.visibilityState)||w.visibilityState==="visible")return!0;const i=y==null||(t=y.performance)===null||t===void 0||(s=t.getEntriesByType)===null||s===void 0?void 0:s.call(t,"visibility-state");return!(i!=null&&i.length)||i.some(r=>r.name==="visible")})(),this.an=()=>{var t,s;(w==null?void 0:w.visibilityState)==="visible"&&(this.Ke=!0,(t=this.Hd)===null||t===void 0||(s=t.setDocumentWasEverVisible)===null||s===void 0||s.call(t,!0))},!this._instance.sessionManager)throw ze.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"');w!=null&&w.addEventListener&&H(w,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.Wd=!0,w==null||(t=w.removeEventListener)===null||t===void 0||t.call(w,"visibilitychange",this.an),e?this.Vd(!0):this.stopRecording()}get Gd(){var e;const t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),s=!this.Mr.disable_session_recording,i=this.Mr.disable_session_recording||this._instance.consent.isOptedOut();return y&&t&&s&&!i}startIfEnabledOrStop(e){var t;if(this.Wd||this.Gd&&(!((t=this.Hd)===null||t===void 0)&&t.isStarted))return;const s=!b(Object.assign)&&!b(Array.from);this.Gd&&s?(this.Zd(e),ze.info("starting")):(this.zd=Di,this.stopRecording())}Zd(e){var t,s;if(this.Gd)if(this.zd!=="awaiting_config"&&this.zd!=="missing_config"&&(this.zd=Zn),(C==null||(t=C.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((s=C.__PosthogExtensions__)===null||s===void 0?void 0:s.initSessionRecording))this.Qd(e);else{var i,r;const n=this._instance.sessionManager;(i=C.__PosthogExtensions__)===null||i===void 0||(r=i.loadExternalDependency)===null||r===void 0||r.call(i,this._instance,this.Jd,o=>{if(!this.Wd&&this.Gd&&this._instance.sessionManager===n)return o?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),ze.error("could not load recorder",o)):void this.Qd(e);this.zd="disabled"})}}stopRecording(){var e,t;(e=this.Ud)===null||e===void 0||e.call(this),this.Ud=void 0,(t=this.Hd)===null||t===void 0||t.stop()}Vd(e=!1){var t,s;(t=this.Ud)===null||t===void 0||t.call(this),this.Ud=void 0,(s=this.Hd)===null||s===void 0||s.discard({discardProducerEvents:e})}Kd(){var e,t;(e=this.xa)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.xa)===null||t===void 0||t.unregister("$replay_sample_rate")}Xd(e,t){if(T(e))return null;const s=ne(e)?e:parseFloat(e);return typeof(i=s)!="number"||!Number.isFinite(i)||0>i||i>1?(ze.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):s;var i}Yd(e){if(this.xa){var t,s;const i=this.xa,r=()=>{var n;const o=e.sessionRecording===!1?void 0:e.sessionRecording,a=this.Xd((n=this.Mr.session_recording)===null||n===void 0?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.Xd(o==null?void 0:o.sampleRate,"remote config sampleRate"),u=a??l;T(u)&&this.Kd();const c=o==null?void 0:o.minimumDurationMilliseconds;i.register({[Zt]: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:u,minimumDurationMilliseconds:b(c)?null:c,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})})};r(),(t=this.Ud)===null||t===void 0||t.call(this),this.Ud=(s=this._instance.sessionManager)===null||s===void 0?void 0:s.onSessionId(r)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.Yd(t),void this.Vd()):(this.Yd(t),void this.startIfEnabledOrStop()):(this.zd==="awaiting_config"&&(this.zd="missing_config",ze.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var s;!((s=this.Hd)===null||s===void 0)&&s.log?this.Hd.log(e,t):ze.warn("log called before recorder was ready")}get Jd(){var e,t;const s=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(Zt);return(s==null||(t=s.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}tv(){const e=this._instance.get_property(Zt);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(s){return ze.warn("persisted remote config for session recording is invali
2d and will be ignored",s),!1}return!T(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Qd(e){var t,s,i;if(!this.Wd&&this.Gd&&this._instance.sessionManager){if(!(!((t=C.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return ze.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Pa]:!0});var r;if(this.Hd||(this.Hd=(r=C.__PosthogExtensions__)===null||r===void 0?void 0:r.initSessionRecording(this._instance,this.Ke),this.Hd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.tv())return this.zd==="missing_config"||this.zd==="awaiting_config"?void 0:(this.zd="awaiting_config",ze.info("persisted remote config is stale, requesting fresh config before starting"),void new el(this._instance).load());this.zd=Zn,(s=(i=this.Hd).setDocumentWasEverVisible)===null||s===void 0||s.call(i,this.Ke),this.Hd.start(e)}else this.zd=Di}onRRwebEmit(e){var t,s;(t=this.Hd)===null||t===void 0||(s=t.onRRwebEmit)===null||s===void 0||s.call(t,e)}overrideLinkedFlag(){var e,t;this.Hd||(t=this.xa)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.Hd)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Hd||(t=this.xa)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.Hd)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,s;this.Hd||(s=this.xa)===null||s===void 0||s.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Hd)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Hd)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var s;return!!(!((s=this.Hd)===null||s===void 0)&&s.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.Hd)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},Wh={autocapture:class extends bh{constructor(e){super(new wh(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.ev=this.iv()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.nv();return!!(e.path||e.search||this.sv(e))}startIfEnabled(){this.isEnabled&&(E.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.ev=this.iv(),this.startIfEnabled()}stop(){this.rv&&this.rv(),this.rv=void 0,this.ov&&this.ov(),this.ov=void 0,E.info("History API monitoring stopped")}monitorHistoryChanges(){y&&y.history&&(this.lv("pushState"),this.lv("replaceState"),this.av(),this.sv()&&this.uv())}lv(e){var t;if(!y||!((t=y.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const s=this;ps(y.history,e,i=>function(r,n,o){i.call(this,r,n,o),s.hv(e)})}iv(){const e=y==null?void 0:y.location;if(e!=null&&e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}nv(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:L(e)?e:{}}sv(e=this.nv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}dv(e){const t=this.nv(),s=this.ev;return!(!s||!(t.path&&e.pathname!==s.pathname||t.search&&e.search!==s.search||this.sv(t)&&e.hash!==s.hash))}hv(e){try{const t=this.iv();if(!t)return;this.dv(t)&&this._instance.capture(Cr,{navigation_type:e}),this.ev=t}catch(t){E.error(`Error capturing ${e} pageview`,t)}}av(){if(this.rv)return;const e=()=>{this.hv("popstate")};H(y,"popstate",e),this.rv=()=>{y&&y.removeEventListener("popstate",e)}}uv(){if(this.ov)return;const e=()=>{this.hv("hashchange")};H(y,"hashchange",e),this.ov=()=>{y&&y.removeEventListener("hashchange",e)}}},heatmaps:class{get Mr(){return this.instance.config}constructor(e){var t;this.vv=!1,this.bo=!1,this.fv=null,this.instance=e,this.vv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[Xi]),this.rageclicks=new xl(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 T(this.Mr.capture_heatmaps)?T(this.Mr.enable_heatmaps)?this.vv:this.Mr.enable_heatmaps:this.Mr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.bo)return;Eh.info("starting..."),this.pv(),this.an()}else{var e;clearInterval((e=this.fv)!==null&&e!==void 0?e:void 0),this.gv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const s=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Xi]:s}),this.vv=s,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}mv(e){Ni(e.originalEvent)&&this.Cr(e.originalEvent,"deadclick")}an(){this.fv&&clearInterval(this.fv),this.fv=(w==null?void 0:w.visibilityState)==="visible"?setInterval(this.fa.bind(this),this.flushIntervalMilliseconds):null}pv(){y&&w&&(this.yv=this.fa.bind(this),H(y,Vs,this.yv),this.bv=e=>this.Cr(e||(y==null?void 0:y.event)),H(w,"click",this.bv,{capture:!0}),this._v=e=>this.wv(e||(y==null?void 0:y.event)),H(w,"mousemove",this._v,{capture:!0}),this.Sv=new Pn(this.instance,Pc,this.mv.bind(this)),this.Sv.startIfEnabledOrStop(),this.xv=this.an.bind(this),H(w,ls,this.xv),this.bo=!0)}gv(){var e;y&&w&&(this.yv&&y.removeEventListener(Vs,this.yv),this.bv&&w.removeEventListener("click",this.bv,{capture:!0}),this._v&&w.removeEventListener("mousemove",this._v,{capture:!0}),this.xv&&w.removeEventListener(ls,this.xv),clearTimeout(this.Cv),(e=this.Sv)===null||e===void 0||e.stop(),this.bo=!1)}$v(e,t){const s=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=function(o,a,l){let u=o;for(;u&&He(u)&&!ge(u,"body");){if(u===l)return!1;let d;try{var c,h,p;d=(c=(h=(p=u.ownerDocument)===null||p===void 0?void 0:p.defaultView)!==null&&h!==void 0?h:y)===null||c===void 0?void 0:c.getComputedStyle(u).position}catch{return!1}if(R(a,d))return!0;u=Da(u)}return!1}(Qt(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:i),y:e.clientY+(n?0:s),target_fixed:n,type:t}}
2Cr(e,t="click"){var s;if(mn(e.target)||!Ni(e))return;const i=this.$v(e,t);!((s=this.rageclicks)===null||s===void 0)&&s.isRageClick(e.clientX,e.clientY,new Date().getTime())&&ja(Qt(e),this.instance.config.rageclick)&&this.Zs(f(f({},i),{},{type:"rageclick"})),this.Zs(i)}wv(e){!mn(e.target)&&Ni(e)&&(clearTimeout(this.Cv),this.Cv=setTimeout(()=>{this.Zs(this.$v(e,"mousemove"))},500))}Zs(e){if(!y)return;const t=this.Mr.disable_capture_url_hashes?ot(y.location.href):y.location.href,s=this.Mr.custom_personal_data_properties,i=this.Mr.mask_personal_data_properties?[...At,...s||[]]:[],r=hs(t,i,ds);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}fa(){this.Rt&&!ke(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Pn,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.vv=!1,this.bo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Tv=()=>{clearTimeout(this.Iv),this.Iv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",f({$current_url:this.Rt.url},this.Rt.metrics.reduce((s,i)=>f(f({},s),{},{[`$web_vitals_${i.name}_event`]:f({},i),[`$web_vitals_${i.name}_value`]:i.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Mv=s=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},T(s==null?void 0:s.name)||T(s==null?void 0:s.value))return void ct.error("Invalid metric received",s);const r=typeof s.navigationURL=="string"?s.navigationURL:void 0,n=this.Ev(r);if(b(n))return;const o=ne(s.navigationId)||typeof s.navigationId=="string"?`navigation:${s.navigationId}`:`url:${n}`;if(this.Pv&&s.value>=this.Pv)return void ct.error("Ignoring metric with value >= "+this.Pv,s);this.Rt.navigationKey!==o&&(this.Tv(),this.Iv=setTimeout(this.Tv,this.flushToCaptureTimeoutMs)),b(this.Rt.navigationKey)&&(this.Rt.navigationKey=o,this.Rt.url=n),this.Rt.firstMetricTimestamp=b(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0),l=f(f(f({},s),r?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete l.entries,L(s.attribution)&&this.attributionMetrics.indexOf(s.name)>-1){const u={};for(const c of kh){const h=c==="url"&&typeof s.attribution[c]=="string"?this.Ev(s.attribution[c]):s.attribution[c];b(h)||(u[c]=h)}l.attribution=u}else delete l.attribution;b(a)||(l.$session_id=a.sessionId,l.$window_id=a.windowId),this.Rt.metrics.push(l),this.Rt.metrics.length===this.allowedMetrics.length&&this.Tv()},this.Rv=()=>{if(this.bo)return;let s,i,r,n,o=!1;const a=C.__PosthogExtensions__,l=a==null?void 0:a.postHogWebVitalsCallbacksByFlavor,u=(l==null?void 0:l[this.Av])||(this.Av==="web-vitals"&&b(l)?a==null?void 0:a.postHogWebVitalsCallbacks:void 0);if(!b(u)){const p=u.withoutAttribution,d=this.attributionMetrics;o=!b(p),s=d.indexOf("LCP")>-1?u.onLCP:(p==null?void 0:p.onLCP)||u.onLCP,i=d.indexOf("CLS")>-1?u.onCLS:(p==null?void 0:p.onCLS)||u.onCLS,r=d.indexOf("FCP")>-1?u.onFCP:(p==null?void 0:p.onFCP)||u.onFCP,n=d.indexOf("INP")>-1?u.onINP:(p==null?void 0:p.onINP)||u.onINP}if(!(s&&i&&r&&n))return void ct.error("web vitals callbacks not loaded - not starting");const c={reportSoftNavs:this.useSoftNavs},h=o&&this.attributionMetrics.indexOf("INP")>-1?f(f({},c),{},{includeProcessedEventEntries:!1}):c;this.allowedMetrics.indexOf("LCP")>-1&&s(this.Mv.bind(this),c),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Mv.bind(this),c),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Mv.bind(this),c),this.allowedMetrics.indexOf("INP")>-1&&n(this.Mv.bind(this),h),this.bo=!0},this.vv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[tr]),this.startIfEnabled()}get Fv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const s=L(this.Fv)?(e=this.Fv)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return T(s)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||Jn:s}get flushToCaptureTimeoutMs(){return(L(this.Fv)?this.Fv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=L(this.Fv)?this.Fv.web_vitals_attribution:void 0;return $e(e)?e?Jn:[]:I(e)?e:$h}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=L(this.Fv)?this.Fv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Pv(){const e=L(this.Fv)&&ne(this.Fv.__web_vitals_max_value)?this.Fv.__web_vitals_max_value:Yn;return e>0&&6e4>=e?Yn:e}get isEnabled(){const e=ee==null?void 0:ee.protocol;if(e!=="http:"&&e!=="https:")return ct.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=L(this.Fv)?this.Fv.web_vitals:$e(this.Fv)?this.Fv:void 0;return $e(t)?t:this.vv}startIfEnabled(){this.isEnabled&&!this.bo&&(ct.info("enabled, starting..."),this.No(this.Rv))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const s=L(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=L(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[tr]:s}),this._instance.persistence.register({[_a]:i})),this.vv=s,this.startIfEnabled()}get Av(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}No(e){var t;
2const s=C.__PosthogExtensions__,i=this.Av,r=s==null?void 0:s.postHogWebVitalsCallbacksByFlavor;r!=null&&r[i]||i==="web-vitals"&&b(r)&&(s!=null&&s.postHogWebVitalsCallbacks)?e():s==null||(t=s.loadExternalDependency)===null||t===void 0||t.call(s,this._instance,i,n=>{n?ct.error("failed to load script",n):e()})}Ev(e){const t=e||(y==null?void 0:y.location.href);if(!t)return void ct.error("Could not determine current URL");const s=this._instance.config.disable_capture_url_hashes?ot(t):t,i=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...At,...i||[]]:[];return hs(s,r,ds)}}},Uh={exceptionObserver:class{constructor(e){var t;this.Rv=()=>{var s;if(!y||!this.isEnabled||!(!((s=C.__PosthogExtensions__)===null||s===void 0)&&s.errorWrappingFunctions))return;const i=C.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=C.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=C.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ov&&this.Mr.capture_unhandled_errors&&(this.Ov=i(this.captureException.bind(this))),!this.Dv&&this.Mr.capture_unhandled_rejections&&(this.Dv=r(this.captureException.bind(this))),!this.Lv&&this.Mr.capture_console_errors&&(this.Lv=n(this.captureException.bind(this)))}catch(o){Ut.error("failed to start",o),this.Nv()}},this._instance=e,this.qv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[Qi]),this.wt=new Hl(f(f({},function(s={}){var i,r,n,o;return{refillRate:(i=(r=s.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:s.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(n=(o=s.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:s.__exceptionRateLimiterBucketSize)!==null&&n!==void 0?n:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:Ut})),this.Mr=this.jv(),this.startIfEnabledOrStop()}jv(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return L(e)?t=f(f({},t),e):(b(e)?this.qv: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?(Ut.info("enabled"),this.Nv(),this.No(this.Rv)):this.Nv()}No(e){var t,s,i;!((t=C.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(s=C.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,"exception-autocapture",r=>{if(r)return Ut.error("failed to load script",r);e()})}Nv(){var e,t,s;(e=this.Ov)===null||e===void 0||e.call(this),this.Ov=void 0,(t=this.Dv)===null||t===void 0||t.call(this),this.Dv=void 0,(s=this.Lv)===null||s===void 0||s.call(this),this.Lv=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.qv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Qi]:this.qv}),this.Mr=this.jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Mr=this.jv()}captureException(e){try{var t,s,i;const r=(t=e==null||(s=e.$exception_list)===null||s===void 0||(s=s[0])===null||s===void 0?void 0:s.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(r))return void Ut.info("Skipping exception capture because of client rate limiting.",{exception:r});(i=this._instance.exceptions)===null||i===void 0||i.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,s;this.Bv=[],this.Hv=new Ql([new fu,new $u,new gu,new vu,new wu,new bu,new mu,new xu],function(i,...r){return(n,o=0)=>{const a=[],l=n.split(`
3`),u=Math.min(l.length,o+1e3),c=[];for(let d=o;u>d;d++){const g=l[d];if(g.length>1024)continue;const m=tn.test(g)?g.replace(tn,"$1"):g;if(!m.match(/\S*Error: /)){for(const v of r){const _=v(m,i);if(_){a.push(_);const x=cu(a);if(x){for(let $=c.length-1;$>=0;$--){const O=c[$];if(x.start>
3=O.start+O.length)break;c.pop()}c.push(x)}break}}if(du(a,c)>=50)break}}const h=[...c].sort((d,g)=>g.start-d.start),p=h[h.length-1];if(p){const d=Xo(a,p);a.splice(p.start-d,d);for(const g of h)g.start-=d}for(const d of h)hu(a,d);return c.some(d=>d.start===0&&a.length===d.length)&&function(d){const g=d.map(v=>`${v.function}|${v.filename}|${v.lineno}|${v.colno}|${v.module}`);let m=0;for(let v=1;g.length>v;v++)pu(g,v,m)&&(m=v);d.push(...d.splice(0,m))}(a),function(d){if(!d.length)return[];const g=Array.from(d);return g.reverse(),g.slice(0,50).map(m=>{return f(f({},m),{},{filename:m.filename||(v=g,v[v.length-1]||{}).filename,function:m.function||"?"});var v})}(a)}}("web:javascript",ou,uu)),this._instance=e,this.Bv=(t=(s=this._instance.persistence)===null||s===void 0?void 0:s.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.zv=js(this.Uv()),this.Wv=new Eu(this.zv)}onConfigChange(){this.zv=js(this.Uv()),this.Wv.setConfig(this.zv)}onRemoteConfig(e){var t,s,i;if(!e.ok)return;const r=e.config;if(!("errorTracking"in r))return;const n=(t=(s=r.errorTracking)===null||s===void 0?void 0:s.suppressionRules)!==null&&t!==void 0?t:[],o=(i=r.errorTracking)===null||i===void 0?void 0:i.captureExtensionExceptions;this.Bv=n,this._instance.persistence&&this._instance.persistence.register({[va]:this.Bv,[er]:o})}get Vv(){var e;const t=!!this._instance.get_property(er),s=this._instance.config.error_tracking.captureExtensionExceptions;return(e=s??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Hv.buildFromUnknown(e,{syntheticException:t==null?void 0:t.syntheticException,mechanism:{handled:t==null?void 0:t.handled}})}addExceptionStep(e,t){if(this.zv.enabled)try{if(!A(e)||e.trim().length===0)return void Ie.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:s,droppedKeys:i}=function(r){if(!r)return{sanitizedProperties:{},droppedKeys:[]};const n=[];return{sanitizedProperties:Object.keys(r).reduce((o,a)=>ku.has(a)?(n.push(a),o):(o[a]=r[a],o),{}),droppedKeys:n}}(this.Gv(t));i.length>0&&Ie.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.Wv.add(f({[Ds]:e,[Ns]:new Date().toISOString()},s))}catch(s){Ie.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.Zv(t)){if(this.Qv(t))return this.Jv("Exception dropped: matched a suppression rule"),void Ie.info("Skipping exception capture because a suppression rule matched");if(!this.Vv&&this.Kv(t))return this.Jv("Exception dropped: thrown by a browser extension"),void Ie.info("Skipping exception capture because it was thrown by an extension");if(!this.Vv&&this.Xv(t))return this.Jv("Exception dropped: thrown by an injected browser script"),void Ie.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Yv(t))return this.Jv("Exception dropped: thrown by the PostHog SDK"),void Ie.info("Skipping exception capture because it was thrown by the PostHog SDK")}const s=this.zv.enabled&&T(e.$exception_steps)?this.tf(e):e,i=function(){const r=globalThis._posthogReleaseId;return typeof r=="string"&&r.length>0?r:void 0}();i&&(s.$release_id=i);try{const r=this._instance.capture("$exception",s,{_noTruncate:!0,_batchKey:"exceptionEvent",eh:!0});return r&&this.Wv.clear(),r}catch(r){return lo(r)||Ie.error("Failed to capture exception event. Dropping this exception.",r),void this.Wv.clear()}}catch(t){return void(lo(t)||Ie.error("Failed to process exception event. Ignoring this exception.",t))}}tf(e){try{const t=this.Wv.getAttachable();return t.length===0?e:f(f({},e),{},{$exception_steps:t})}catch(t){return Ie.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Jv(e){this.zv.enabled&&this.Wv.add({[Ds]:e,[Ns]:new Date().toISOString()})}Gv(e){return L(e)?f({},e):{}}Uv(){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:{}}Qv(e){if(e.length===0)return!1;try{const t=e.reduce((s,{type:i,value:r})=>(A(i)&&i.length>0&&s.$exception_types.push(i),A(r)&&r.length>0&&s.$exception_values.push(r),s),{$exception_types:[],$exception_values:[]});return this.Bv.some(s=>{const i=s.values.map(r=>{const n=_l[r.operator],o=t[r.key];if(!n||!o)return!1;const a=I(r.value)?r.value:[r.value];return a.length>0&&n(a,o)});return s.type==="OR"?i.some(Boolean):i.every(Boolean)})}catch(t){return Ie.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Kv(e){const t=e.flatMap(i=>{var r,n;return(r=(n=i.stacktrace)===null||n===void 0?void 0:n.frames)!==null&&r!==void 0?r:[]}),s=t.filter(({filename:i})=>!!i&&Lh.some(r=>i.startsWith(r)));return s.length!==0&&(!s.every(({filename:i})=>!!i&&i.startsWith(mr))||e.some(({type:i,value:r})=>i==="NoResponse"||A(r)&&Ah.some(({value:n,exact:o})=>o?r===n:r.includes(n)))&&!t.some(({in_app:i,filename:r})=>
3i&&!(r!=null&&r.startsWith(mr))))}Xv(e){return e.some(({value:t})=>A(t)&&Dh.some(s=>t.includes(s)))}Yv(e){if(e.length>0){var t,s,i,r;const n=(t=(s=e[0].stacktrace)===null||s===void 0?void 0:s.frames)!==null&&t!==void 0?t:[],o=n[n.length-1];return(i=o==null||(r=o.filename)===null||r===void 0?void 0:r.includes("posthog.com/static"))!==null&&i!==void 0&&i}return!1}Zv(e){return!T(e)&&I(e)}}},Gh=f({productTours:class{get xa(){return this._instance.persistence}constructor(e){this.ef=null,this.if=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var s,i;if(this.xa&&this.xa.register({[Pr]:!!t.productTours}),!ji(this._instance))return!this.ef&&T((s=this.xa)===null||s===void 0?void 0:s.props.ph_product_tours)||Ss.info("product tours disabled; stopping and clearing cached tours"),(i=this.ef)===null||i===void 0||i.stop(),this.ef=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.ef&&ji(this._instance)&&this.No(()=>this.nf())}No(e){var t,s,i;!((t=C.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(s=C.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,"product-tours",r=>{r?Ss.error("Could not load product tours script",r):e()})}nf(){var e;!this.ef&&(!((e=C.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.ef=C.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(I(this.if)&&!t)return void e(this.if,{isLoaded:!0});const s=this.xa;if(s){const i=s.props[rr];if(I(i)&&!t)return this.if=i,void e(i,{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:i=>{if(!ji(this._instance))return void e([],{isLoaded:!0});const r=i.statusCode;if(r!==200||!i.json){const o=`Product Tours API could not be loaded, status: ${r}`;return r===0?i.error||Ss.warn(o):Ss.error(o),void e([],{isLoaded:!1,error:o})}const n=I(i.json.product_tours)?i.json.product_tours:[];this.if=n,s&&s.register({[rr]:n}),e(n,{isLoaded:!0})}})}getActiveProductTours(e){T(this.ef)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.ef.getActiveProductTours(e)}showProductTour(e){var t;(t=this.ef)===null||t===void 0||t.showTourById(e)}previewTour(e){this.ef?this.ef.previewTour(e):this.No(()=>{var t;this.nf(),(t=this.ef)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.ef)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.ef)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.ef)===null||e===void 0||e.previousStep()}clearCache(){var e;this.if=null,(e=this.xa)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.ef)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.ef)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.ef)===null||t===void 0||t.cancelPendingTour(e)}}},si),Kh={siteApps:class{constructor(e){this._instance=e,this.sf=0,this.rf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}lf(e,t){if(!t)return;const s=this.globalsForEvent(t);this.rf.push(s),this.rf.length>1e3&&(this.rf=this.rf.slice(10))}get siteAppLoaders(){var e;return(e=C._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){const e=this._instance._addCaptureHook(this.lf.bind(this));this.af=()=>{e(),this.rf=[],this.af=void 0}}}globalsForEvent(e){var t,s,i,r,n,o,a;if(!e)throw new Error("Event payload is required");const l={},u=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(const[d,g]of Object.entries(c))l[d]={id:u[d],type:d,properties:g};const{$set_once:h,$set:p}=e;return{event:f(f({},ia(e,Sh)),{},{properties:f(f(f({},e.properties),p?{$set:f(f({},(t=(s=e.properties)===null||s===void 0?void 0:s.$set)!==null&&t!==void 0?t:{}),p)}:{}),h?{$set_once:f(f({},(i=(r=e.properties)===null||r===void 0?void 0:r.$set_once)!==null&&i!==void 0?i:{}),h)}:{}),elements_chain:(n=(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&n!==void 0?n:"",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}}uf(e){var t;const s=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return s==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(De.error("prepare_external_dependency_stylesheet returned null"),null):s==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(De.error("prepare_external_dependency_script returned null"),null):e}hf(){var e,t,s,i,r,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const l=w==null?void 0:w.defaultView,u=l==null||(e=l.Node)===null||e===void 0?void 0:e.prototype;if(!l||!u)return()=>{};if(this.sf++,this.cf)return this.df();const c=[],h=this,p=new WeakSet,d=(v,_,x)=>{if(!(v!=null&&v[_]))return;const $=v[_];v[_]=x($),c.push(()=>{v[_]=$})},g=v=>{if(p.has(v))return v;const _=h.uf(v);return _&&p.add(_),_},m=v=>v.map(_=>typeof _=="string"?_:g(_)).filter(_=>!re(_));return d(u,"appendChild",v=>function(_){const x=g(_);return x?v.call(this,x):_}),d(u,"insertBefore",v=>function(_,x){const $=g(_);return $?v.call(this,$,x):_}),d(u,"replaceChild",v=>function(_,x){const $=g(_);return $?v.call(this,$,x):x}),[(t=l.Element)===null||t===void 0?void 0:t.prototype,(s=l.Document)===null||s===void 0?void 0:s.prototype,(i=l.DocumentFragment)===null||i===void 0?void 0:i.prototype].forEach(v=>{d(v,"append",_=>function(...x){return _.apply(this,m(x))}),d(v,"prepend",_=>function(...x){return _.apply(this,m(x))})}),[(r=l.Element)===null||r===void 0?void 0:r.prototype,(n=l.CharacterData)===null||n===void 0?void 0:n.prototype,(o=l.DocumentType)===null||o===void 0?void 0:o.prototype].forEach(v=>{d(v,"before",_=>function(...x){return _.apply(this,m(x))}),d(v,"after",_=>function(...x){return _.apply(this,m(x))}),d(v,"replaceWith",_=>function(...x){const $=m(x);return x.length&&!$.length?void 0:_.apply(this,$)})}),d((a=l.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",v=>function(_,x){const $=g(x);return $?v.call(this,_,$):null}),this.cf=()=>
3{c.forEach(v=>v()),this.cf=void 0},this.df()}df(){let e=!1;return()=>{var t;e||(e=!0,this.sf--,this.sf===0&&((t=this.cf)===null||t===void 0||t.call(this)))}}vf(e,t=!0){const s=this.hf();try{const i=e(s);return t&&s(),i}catch(i){throw s(),i}}setupSiteApp(e){const t=this.apps[e.id],s=()=>{var n;!t.errored&&this.rf.length&&(De.info(`Processing ${this.rf.length} events for site app with id ${e.id}`),this.rf.forEach(o=>this.vf(()=>{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)&&((n=this.af)===null||n===void 0||n.call(this))};let i=!1;const r=n=>{t.errored=!n,t.loaded=!0,De.info(`Site app with id ${e.id} ${n?"loaded":"errored"}`),i&&s()};try{const{processEvent:n}=this.vf(o=>e.init({posthog:this._instance,callback(a){o(),r(a)}}),!1);n&&(t.processEvent=n),i=!0}catch(n){De.error(Xn+e.id,n),r(!1)}if(i&&t.loaded)try{s()}catch(n){De.error(`Error while processing buffered events PostHog app with config id ${e.id}`,n),t.errored=!0}}ff(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}pf(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const s of Object.values(this.apps))try{this.vf(()=>{var i;return(i=s.processEvent)===null||i===void 0?void 0:i.call(s,t)})}catch(i){De.error(`Error while processing event ${e.event} for site app ${s.id}`,i)}}onRemoteConfig(e){var t,s,i;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.ff(),void this._instance.on("eventCaptured",a=>this.pf(a))):void De.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((s=this.af)===null||s===void 0||s.call(this),!e.ok)return;const r=e.config;if(!((i=r.siteApps)===null||i===void 0)&&i.length)if(this.isEnabled)for(const{id:a,url:l}of r.siteApps){var n,o;C[`__$$ph_site_app_${a}`]=this._instance,(n=C.__PosthogExtensions__)===null||n===void 0||(o=n.loadSiteApp)===null||o===void 0||o.call(n,this._instance,l,u=>{if(u)return De.error(Xn+a,u)})}else De.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Yh={tracingHeaders:class{constructor(e){this._instance=e,this.gf=void 0,this.mf=void 0,this.yf=void 0,this.Rv=()=>{const t=this.bf();var s,i;t?(b(this.gf)&&(this.gf=(s=C.__PosthogExtensions__)===null||s===void 0||(s=s.tracingHeadersPatchFns)===null||s===void 0?void 0:s._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),b(this.mf)&&(this.mf=(i=C.__PosthogExtensions__)===null||i===void 0||(i=i.tracingHeadersPatchFns)===null||i===void 0?void 0:i._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Nv()}}initialize(){this.startIfEnabledOrStop()}No(e){var t,s,i;!((t=C.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(s=C.__PosthogExtensions__)===null||s===void 0||(i=s.loadExternalDependency)===null||i===void 0||i.call(s,this._instance,"tracing-headers",r=>{if(r)return xh.error("failed to load script",r);e()})}_f(){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}bf(){const e=this._f();return I(e)?(I(this.yf)?this.yf.splice(0,this.yf.length,...e):this.yf=[...e],e.length>0?this.yf:void 0):(I(this.yf)&&this.yf.splice(0),this.yf=e||void 0,this.yf)}Nv(){var e,t;(e=this.gf)===null||e===void 0||e.call(this),(t=this.mf)===null||t===void 0||t.call(this),this.gf=void 0,this.mf=void 0}startIfEnabledOrStop(){this.bf()?this.No(this.Rv):this.Nv()}}},Jh=f({surveys:class extends Mh{constructor(e){var t;super(new Ih(e),(t=e,{get projectToken(){return t.config.token},kv:new Ch(t)})),this._instance=e}Mh(e,t){const s=t.query?gs(e,t.query):e;return new Promise(i=>{var r;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((r=t.target)!==null&&r!==void 0?r:"api",s),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:i})})}}},si),Zh={toolbar:class{constructor(e){this.instance=e}wf(e){C.ph_toolbar_state=e}kf(){var e;return(e=C.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,s=void 0){var i,r;if(or(this.instance.config)||!y||!w)return!1;e=(i=e)!==null&&i!==void 0?i:y.location,s=(r=s)!==null&&r!==void 0?r:y.history;try{if(!t){try{y.localStorage.setItem("test","test"),y.localStorage.removeItem("test")}catch{return!1}t=y==null?void 0:y.localStorage}const n=Rh||Us(e.hash,"__posthog")||Us(e.hash,"state");let o;const a=n?Zr(()=>JSON.parse(atob(decodeURIComponent(n))))||Zr(()=>JSON.parse(decodeURIComponent(n))):null;return a&&a.action==="ph_authorize"?(o=a,o.source="url",o&&Object.keys(o).length>0&&(a.desiredHash?e.hash=a.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):(o=JSON.parse(t.getItem(eo)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}Sf(e){const t=C.ph_load_toolbar||C.ph_load_editor;!T(t)&&de(t)?t(e,this.instance):to.warn("No toolbar load function found")}loadToolbar(e){const t=!!(w!=null&&w.getElementById("__POSTHOG_TOOLBAR__"));if(!y||t)return!1;const s=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=f(f({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(y.localStorage.setItem(eo,JSON.stringify(f(f({},i),{},{source:void 0}))),this.kf()===2)this.Sf(i);else if(this.kf()===0){var r,n;this.wf(1),(r=C.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this.instance,"toolbar",o=>{if(o)return to.error("[Toolbar] Failed to load",o),void this.wf(0);this.wf(2),this.Sf(i)}),H(y,"turbolinks:load",()=>{this.wf(0),this.loadToolbar(i)})}return!0}xf(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,s=void 0){return this.maybeLoadToolbar(e,t,s)}}},Xh=f({experiments:class be{get Mr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(s=!1)=>{this.getWebExperiments(i=>{be.Cf("retrieved web experiments from the server"),this.$f=new Map,i.forEac
3h(r=>{if(r.feature_flag_key){var n;this.$f&&(be.Cf("setting flag key ",r.feature_flag_key," to web experiment ",r),(n=this.$f)===null||n===void 0||n.set(r.feature_flag_key,r));const o=this._instance.getFeatureFlag(r.feature_flag_key);A(o)&&r.variants[o]&&this.Tf(r.name,o,r.variants[o].transforms)}else if(r.variants)for(const o in r.variants){const a=r.variants[o];be.If(a,this._instance)&&this.Tf(r.name,o,a.transforms)}})},s)},this._instance.onFeatureFlags(s=>{this.onFeatureFlags(s)})}initialize(){}onFeatureFlags(t){if(this._is_bot())be.Cf(uo);else if(!this.Mr.disable_web_experiments){if(T(this.$f))return this.$f=new Map,this.loadIfEnabled(),void this.previewWebExperiment();be.Cf("applying feature flags",t),t.forEach(s=>{var i;if(this.$f&&(!((i=this.$f)===null||i===void 0)&&i.has(s))){var r;const n=this._instance.getFeatureFlag(s),o=(r=this.$f)===null||r===void 0?void 0:r.get(s);n&&(o!=null&&o.variants[n])&&this.Tf(o.name,n,o.variants[n].transforms)}})}}previewWebExperiment(){const t=be.getWindowLocation();if(t!=null&&t.search){const s=Tt(t==null?void 0:t.search,"__experiment_id"),i=Tt(t==null?void 0:t.search,"__experiment_variant");s&&i&&(be.Cf(`previewing web experiments ${s} && ${i}`),this.getWebExperiments(r=>{this.Mf(parseInt(s),i,r)},!1,!0))}}loadIfEnabled(){this.Mr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,s,i){if(this.Mr.disable_web_experiments&&!i)return t([]);const r=this._instance.get_property("$web_experiments");if(r&&!s)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Mr.token}`),method:"GET",timestampMode:"query",callback:n=>t(n.statusCode===200&&n.json&&n.json.experiments||[])})}Mf(t,s,i){const r=i.filter(n=>n.id===t);r&&r.length>0&&(be.Cf(`Previewing web experiment [${r[0].name}] with variant [${s}]`),this.Tf(r[0].name,s,r[0].variants[s].transforms))}static If(t,s){return!T(t.conditions)&&be.Ef(t,s)&&be.Pf(t)}static Ef(t,s){var i;if(T(t.conditions)||T((i=t.conditions)===null||i===void 0?void 0:i.url))return!0;const r=be.getWindowLocation();if(r){var n,o,a;const l=Ta(s,r.href);return!(!((n=t.conditions)===null||n===void 0)&&n.url)||Nh[(o=(a=t.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,l)}return!1}
3static getWindowLocation(){return y==null?void 0:y.location}static Pf(t){var s;if(T(t.conditions)||T((s=t.conditions)===null||s===void 0?void 0:s.utm))return!0;const i=Ua();if(i.utm_source){var r,n,o,a,l,u,c,h;const p=!(!((r=t.conditions)===null||r===void 0||(r=r.utm)===null||r===void 0)&&r.utm_campaign)||((n=t.conditions)===null||n===void 0||(n=n.utm)===null||n===void 0?void 0:n.utm_campaign)==i.utm_campaign,d=!(!((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)==i.utm_source,g=!(!((l=t.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0)&&l.utm_medium)||((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0?void 0:u.utm_medium)==i.utm_medium,m=!(!((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0)&&c.utm_term)||((h=t.conditions)===null||h===void 0||(h=h.utm)===null||h===void 0?void 0:h.utm_term)==i.utm_term;return p&&g&&m&&d}return!1}static Cf(t,...s){E.info(`[WebExperiments] ${t}`,s)}Tf(t,s,i){this._is_bot()?be.Cf(uo):s!=="control"?i.forEach(r=>{if(r.selector){var n;be.Cf(`applying transform of variant ${s} for experiment ${t} `,r);const o=(n=document)===null||n===void 0?void 0:n.querySelectorAll(r.selector);o==null||o.forEach(a=>{const l=a;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):be.Cf("Control variants leave the page unmodified.")}_is_bot(){return pe&&this._instance?fl(pe,this.Mr.custom_blocked_useragents):void 0}}},si),Qh={conversations:class{constructor(e){this._instance=e,this.Rf=void 0,this._conversationsManager=null,this.Af=!1,this.ne=null,this.Ff=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Of=e.ok,!e.ok))return;const t=e.config.conversations;T(t)||($e(t)?this.Rf=t:(this.Rf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.Rf=void 0,this.ne=null,this.Of=void 0,this.Ff=!1}loadIfEnabled(){if(this._conversationsManager||this.Af||this._instance.config.disable_conversations||or(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=C==null?void 0:C.__PosthogExtensions__;if(e&&!b(this.Rf)&&this.Rf)if(this.ne&&this.ne.token){this.Af=!0;try{const t=e.initConversations;if(t)return this.Df(t),void(this.Af=!1);const s=e.loadExternalDependency;if(!s)return void this.Lf(Or);s(this._instance,"conversations",i=>{i||!e.initConversations?this.Lf("Could not load conversations script",i):this.Df(e.initConversations),this.Af=!1})}catch(t){this.Lf("Error initializing conversations",t),this.Af=!1}}else Fe.error("Conversations enabled but missing token in remote config.")}Df(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.Ff=!1,Fe.info("Conversations loaded successfully")}catch(t){this.Lf("Error completing conversations initialization",t)}else Fe.error("Cannot complete initialization: remote config is null")}Lf(e,t){Fe.error(e,t),this._conversationsManager=null,this.Af=!1,this.Ff=!0}show(){this._conversationsManager?this._conversationsManager.show():Fe.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Rf===!0&&!re(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":or(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Of===!1?"remote_config_failed":b(this.Rf)?this.Of?"disabled_in_project":"remote_config_pending":this.Rf?T(this.ne)||!this.ne.token?"missing_token":C!=null&&C.__PosthogExtensions__?this.Af?"initializing":this.Ff?"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}
3sendMessage(e,t,s){var i=this;return J(function*(){return i._conversationsManager?i._conversationsManager.sendMessage(e,t,s):(Fe.warn(dt),null)})()}getMessages(e,t){var s=this;return J(function*(){return s._conversationsManager?s._conversationsManager.getMessages(e,t):(Fe.warn(dt),null)})()}markAsRead(e){var t=this;return J(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Fe.warn(dt),null)})()}getTickets(e){var t=this;return J(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Fe.warn(dt),null)})()}requestRestoreLink(e){var t=this;return J(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Fe.warn(dt),null)})()}restoreFromToken(e){var t=this;return J(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Fe.warn(dt),null)})()}restoreFromUrlToken(){var e=this;return J(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Fe.warn(dt),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}dh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}fh(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},ed={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.Nf=!1,this.qf=!1,this.jf=!1,this.$=se("[logs]"),this.Bf=f(f({},this.$),{},{error:(...s)=>{s.some(po)||this.$.error(...s)}}),this.ia=[],this.Hf=[],this.Yc=0,this.So=!1,this.zf=[],this.Uf=[],this.Wf=!1,this.Vf=!1,this.Gf=()=>{var s,i;this.So||(this.Yc=0,(s=this.Zf)===null||s===void 0||s.onReconnect(),(i=this.Qf)===null||i===void 0||i.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this.Nf=!0),y&&H(y,"online",this.Gf)}Jf(e,t,s,i){var r;const n=co((r=this._instance)===null||r===void 0||(r=r.config)===null||r===void 0?void 0:r.logs,s);return[new Au(this.Kf(e,t),n,this.Bf,()=>this.Xf(),o=>o(),void 0,i),n]}Yf(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var s;return this.Zf&&this.tp===t||((s=this.Zf)===null||s===void 0||s.reset(),this.tp=t,[this.Zf,this.ep]=this.Jf(()=>this.ia,i=>{this.ia=i})),this.Zf}np(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var s;return this.Qf&&this.sp===t||((s=this.Qf)===null||s===void 0||s.reset(),this.sp=t,[this.Qf,this.rp]=this.Jf(()=>this.Hf,i=>{this.Hf=i},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},ho)),this.Qf}setup(e){var t;if(this.So)return;this.po=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.Nf=!0),(this.Nf||this.op()&&this.lp())&&this.ap();let s=!1;const i=e.onRemoteConfig(r=>{var n;s=r.ok&&((n=r.config.logs)===null||n===void 0?void 0:n.captureConsoleLogs)===!0,this.onRemoteConfig(r)});this.So?i.dispose():(this.$o=i,s||this.loadIfEnabled())}dispose(){var e,t,s,i;this.So||(this.So=!0,this.up(),(e=this.$o)===null||e===void 0||e.dispose(),this.$o=void 0,this.po=void 0,this.jf=!1,y==null||y.removeEventListener("online",this.Gf),(t=this.hp)===null||t===void 0||t.call(this),this.hp=void 0,(s=this.Zf)===null||s===void 0||s.reset(),(i=this.Qf)===null||i===void 0||i.reset())}onRemoteConfig(e){var t,s;if(this.So)return;const i=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;T(i)?this.cp():((s=this._instance)===null||s===void 0||(s=s.persistence)===null||s===void 0||s.register({$logs_capture_enabled_server_side:!!i}),i?(this.Nf=!0,this.qf||this.ap(),this.loadIfEnabled()):this.cp())}reset(){var e,t,s,i;this.up(),(e=this.Zf)===null||e===void 0||e.clearQueue(),this.ia=[],(t=this.Zf)===null||t===void 0||t.reset(),(s=this.Qf)===null||s===void 0||s.clearQueue(),this.Hf=[],(i=this.Qf)===null||i===void 0||i.reset(),this.Yc=0}captureLog(e){this.So||this.Yf().captureLog(e)}captureConsoleLog(e){this.So||this.np().captureLog(e)}captureBufferedConsoleLog(e,t,s){this.So||this.np().captureLog(e,{context:t,occurredAtMs:s})}lp(){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[ga])}op(){var e,t,s;return!(!((e=this._instance)===null||e===void 0||(t=e.Xl)===null||t===void 0)&&t.call(e))||!!(!((s=C._POSTHOG_REMOTE_CONFIG)===null||s===void 0||(s=s[this._instance.config.token])===null||s===void 0)&&s.config)}gh(){var e;this.up(),(e=this.Qf)===null||e===void 0||e.clearQueue(),this.Hf=[]}cp(){this.Nf||this.up()}ap(){var e;if(this.Wf||!(C!=null&&C.console))return;const t=co((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;let s=!0;this.Uf.push(()=>{s=!1});for(const i of jh){let r;try{r=Bh(C.console[i])}catch{continue}r&&this.Uf.push(ps(C.console,i,n=>{const o=(...a)=>{try{s&&this.dp(i,a,t)}catch{}return n.apply(C.console,a)};return o.__rrweb_original__=r,o}))}this.Wf=!0,this.vp=setTimeout(()=>{this.up()},3e4)}dp(e,t,s){var i;if(this.Wf&&!this.Vf&&t.length!==0)if(!((i=this._instance)===null||i===void 0)&&i.is_capturing()){if(s>this.zf.length){this.Vf=!0;try{this.zf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.Xf()})}finally{this.Vf=!1}}}else this.up()}up(){if(this.zf=[],this.Wf){this.Wf=!1,this.vp&&(clearTimeout(this.vp),this.vp=void 0);for(const e of this.Uf)e();this.Uf=[]}}fp(){const e=this.zf;return this.up(),e}get logger(){return this.pp||(this.pp={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)=>
3this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.pp}flushLogs(e){e?this.gp(e):(this.Zf&&this.Zf.flush().catch(t=>this.mp(t)),this.Qf&&this.Qf.flush().catch(t=>this.mp(t)))}mp(e){po(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.So||!this.Nf||this.qf||this.jf)return;const e=C==null?void 0:C.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.up();const t=e.loadExternalDependency;if(!t)return this.$.error(Or),void this.up();this.jf=!0;try{t(this._instance,"logs",s=>{if(this.jf=!1,this.So||!this.Nf)return;const i=e.logs;if(s||!(i!=null&&i.initializeLogs))this.$.error("Could not load logs script",s),this.up();else{var r;const a=this.fp();var n,o;this.hp=i.initializeLogs((r=this.po)!==null&&r!==void 0?r:this._instance),this.qf=!0,a.length>0&&((n=i.replayConsoleBuffer)===null||n===void 0||n.call(i,(o=this.po)!==null&&o!==void 0?o:this._instance,a))}})}catch(s){throw this.jf=!1,s}}Kf(e,t){const s=this._instance;return{get isDisabled(){return!1},get optedOut(){return!s.is_capturing()},getPersistedProperty:i=>i===je.LogsQueue?e():void 0,setPersistedProperty(i,r){var n;i===je.LogsQueue&&t((n=r)!==null&&n!==void 0?n:[])},js:i=>this.js(i),getLibraryId:()=>ce.LIB_NAME,getLibraryVersion:()=>ce.LIB_VERSION}}js(e){return new Promise(t=>{if(Va(this.Yc,3))return void t({kind:"fatal",error:Hi(void 0,"logs endpoint is unreachable, dropping batch")});let s=!1;const i=n=>{s||(s=!0,clearTimeout(r),t(n))},r=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),i({kind:"retry-later",error:Hi(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.yp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{const o=n.statusCode;if(this.bp(o),o>=200&&300>o)i({kind:"ok"});else if(o===413)i({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)i({kind:"fatal",error:new Error(`logs request failed with status ${o}`)});else{var a;o===0?(n.error||this.$.warn("Logs request failed before receiving an HTTP response"),i({kind:"retry-later",error:Hi(n.error,"logs request failed before receiving an HTTP response")})):i({kind:"retry-later",error:(a=n.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${o}`)})}}})})}bp(e){(e!==0||this._instance.__loaded)&&(this.Yc=Wa(e,this.Yc,3,()=>this.$.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.")))}gp(e){this.ia.length>0&&this._p(e,this.ia,this.ep,ce.LIB_NAME,t=>{this.ia=t}),this.Hf.length>0&&this._p(e,this.Hf,this.rp,ho,t=>{this.Hf=t})}_p(e,t,s,i,r){if(t.length===0)return;const n=t.map(a=>a.record);r([]);const o=ua(n,la(s,ce.LIB_NAME,ce.LIB_VERSION),i,ce.LIB_VERSION);this._instance._send_request({method:"POST",url:this.yp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}yp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Xf(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:s,windowId:i,sessionStartTimestamp:r,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=s,t.windowId=i,T(r)||(t.sessionStartTimestamp=r),T(n)||(t.lastActivityTimestamp=n)}if(!(C==null||(e=C.location)===null||e===void 0)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?ot(C.location.href):C.location.href),this._instance.featureFlags){const s=this._instance.featureFlags.getFlags();s&&s.length>0&&(t.activeFeatureFlags=s)}return t}}},td={metrics:class{constructor(e){this._instance=e,this.$=se("[metrics]"),this.So=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.So)return;const t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.wp?this.wp=(s=>{let i=!0;const r=()=>i?(a=>{var l;const u=(l=a.config.metrics)===null||l===void 0?void 0:l.network;return u===!0?{}:u||void 0})(s):void 0,n=qh(s,r),o=zh(s,r);return()=>{i=!1,n(),o()}})(this._instance):!t&&this.wp&&(this.wp(),this.wp=void 0)}Yf(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var s;return this.Zf&&this.tp===t||((s=this.Zf)===null||s===void 0||s.reset(),this.tp=t,this.Zf=new Lu(this.Kf(),function(i){var r,n,o,a,l;const u=i==null?void 0:i.resourceAttributes;return{serviceName:(r=u==null?void 0:u["service.name"])!==null&&r!==void 0?r:i==null?void 0:i.serviceName,serviceVersion:(n=u==null?void 0:u["service.version"])!==null&&n!==void 0?n:i==null?void 0:i.serviceVersion,environment:(o=u==null?void 0:u["deployment.environment"])!==null&&o!==void 0?o:i==null?void 0:i.environment,resourceAttributes:u,beforeSend:i==null?void 0:i.beforeSend,flushIntervalMs:(a=i==null?void 0:i.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(l=i==null?void 0:i.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}}(t),this.$)),this.Zf}count(e,t=1,s){this.Yf().count(e,t,s)}
3gauge(e,t,s){this.Yf().gauge(e,t,s)}histogram(e,t,s){this.Yf().histogram(e,t,s)}flush(e){if(!this.Zf)return Promise.resolve();if(e){const t=this.Zf.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.Zf.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.Zf)===null||e===void 0||e.reset()}dispose(){var e,t;this.So=!0,(e=this.wp)===null||e===void 0||e.call(this),this.wp=void 0,(t=this.Zf)===null||t===void 0||t.reset()}Kf(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:s=>t.Ys(s),getLibraryId:()=>ce.LIB_NAME,getLibraryVersion:()=>ce.LIB_VERSION}}Ys(e,t){return new Promise(s=>{let i=!1;const r=o=>{i||(i=!0,clearTimeout(n),s(o))},n=setTimeout(()=>r({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(f(f({method:"POST",url:this.kp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(o){const a=o.statusCode;if(a>=200&&300>a)r({kind:"ok"});else if(a===413)r({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)r({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var l;r({kind:"retry-later",error:(l=o.error)!==null&&l!==void 0?l:new Error(`metrics request failed with status ${a}`)})}}}))})}kp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};rs.__defaultExtensionClasses=f({},f(f(f(f(f(f(f(f(f(f(f(f(f({},si),Vh),Wh),Uh),Gh),Kh),Jh),Yh),Zh),Xh),Qh),ed),td));const sd=function(){ce.SDK_DIST_CHANNEL="npm";const e=ss[Kt]=new rs;return function(){function t(){t.done||(t.done=!0,wl=!1,W(ss,function(s){s._dom_loaded()}))}w!=null&&w.addEventListener?w.readyState==="complete"?t():H(w,"DOMContentLoaded",t,{capture:!1}):y&&E.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),e}();var id=sd;export{id as n};

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