posthog-js 1.446.2 → 1.446.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/all-external-dependencies.js.map +1 -1
  3. package/dist/array.full.es5.js +1 -1
  4. package/dist/array.full.js +1 -1
  5. package/dist/array.full.js.map +1 -1
  6. package/dist/array.full.no-external.js +1 -1
  7. package/dist/array.full.no-external.js.map +1 -1
  8. package/dist/array.js +1 -1
  9. package/dist/array.no-external.js +1 -1
  10. package/dist/customizations.full.js +1 -1
  11. package/dist/customizations.js +1 -1
  12. package/dist/default-extensions.js +1 -1
  13. package/dist/extension-bundles.js +1 -1
  14. package/dist/integrity.json +29 -29
  15. package/dist/lazy-recorder.js +1 -1
  16. package/dist/lazy-recorder.js.map +1 -1
  17. package/dist/main.js +1 -1
  18. package/dist/module.full.cjs +1 -1
  19. package/dist/module.full.js +1 -1
  20. package/dist/module.full.js.map +1 -1
  21. package/dist/module.full.no-external.cjs +1 -1
  22. package/dist/module.full.no-external.js +1 -1
  23. package/dist/module.full.no-external.js.map +1 -1
  24. package/dist/module.js +1 -1
  25. package/dist/module.mjs +1 -1
  26. package/dist/module.no-external.cjs +1 -1
  27. package/dist/module.no-external.js +1 -1
  28. package/dist/module.slim.js +1 -1
  29. package/dist/module.slim.no-external.js +1 -1
  30. package/dist/posthog-recorder.js +1 -1
  31. package/dist/posthog-recorder.js.map +1 -1
  32. package/dist/recorder-v2.js +1 -1
  33. package/dist/recorder-v2.js.map +1 -1
  34. package/dist/recorder.js +1 -1
  35. package/dist/recorder.js.map +1 -1
  36. package/dist/rrweb.js +1 -1
  37. package/dist/rrweb.js.map +1 -1
  38. package/dist/surveys-preview.js +1 -1
  39. package/dist/surveys.js +1 -1
  40. package/lib/package.json +1 -1
  41. package/package.json +7 -7
package/dist/array.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){const t="u">typeof window?window:void 0,i="u">typeof globalThis?globalThis:t,e=null==i?void 0:i.navigator,s=null==i?void 0:i.document,n=null==i?void 0:i.location,r=null==i?void 0:i.fetch,o=(null==i?void 0:i.XMLHttpRequest)&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,l=null==i?void 0:i.AbortController,a=null==i?void 0:i.CompressionStream,u=null==e?void 0:e.userAgent,h="undefined"!=typeof globalThis?globalThis:t;h&&"undefined"==typeof self&&(h.self=h),h&&"undefined"==typeof File&&(h.File=function(){});const c=null!=t?t:{},d="0.10.7",v={DEBUG:!1,LIB_VERSION:d,LIB_NAME:"browser-common",JS_SDK_VERSION:d};var f=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),p=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const g=["$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"],_=["token"];function m(t,i){return-1!==t.indexOf(i)}const y=function(t){return t.trim()},b=function(t){return t.replace(/^\$/,"")};function w(t){var i;const e=[];return null!==(i=JSON.stringify(t,function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(e.includes(i))return"[Circular]";e.push(i)}return i}}))&&void 0!==i?i:"null"}const x=Object.prototype,S=x.hasOwnProperty,k=x.toString,E=Array.isArray||function(t){return"[object Array]"===k.call(t)},T=t=>"function"==typeof t,P=t=>t===Object(t)&&!E(t),C=t=>{if(P(t)){for(const i in t)if(S.call(t,i))return!1;return!0}return!1},A=t=>void 0===t,F=t=>"[object String]"==k.call(t),O=t=>F(t)&&0===t.trim().length,M=t=>null===t,R=t=>A(t)||M(t),I=t=>"[object Number]"==k.call(t)&&t==t,D=t=>I(t)&&t>0,j=t=>"[object Boolean]"===k.call(t),L=t=>m(g,t),N=t=>m(_,t);function z(t){return null===t||"object"!=typeof t}function B(t,i){return{}.toString.call(t)===`[object ${i}]`}function U(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return q(t,Error)}}function H(t){return"u">typeof Event&&q(t,Event)}function q(t,i){try{return t instanceof i}catch(t){return!1}}const W=[!0,"true",1,"1","yes"],V=t=>m(W,t),G=[!1,"false",0,"0","no"];function K(t,i,e,s,n,r,o){try{var l=t[r](o),a=l.value}catch(t){return void e(t)}l.done?i(a):Promise.resolve(a).then(s,n)}function J(t){return function(){var i=this,e=arguments;return new Promise(function(s,n){var r=t.apply(i,e);function o(t){K(r,s,n,o,l,"next",t)}function l(t){K(r,s,n,o,l,"throw",t)}o(void 0)})}}const Y=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","lightpanda","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"],Z=new Map,X=function(t,i=[]){if(!t)return!1;const e=function(t,i){let e="";for(let t=0;i.length>t;t++){const s=i[t];e+=s.length+":"+s}return t.length+":"+t+"|"+i.length+":"+e}(t,i),s=Z.get(e);if(void 0!==s)return s;const n=t.toLowerCase(),r=Y.concat(i).some(t=>-1!==n.indexOf(t.toLowerCase()));return 256>Z.size||Z.clear(),Z.set(e,r),r};function Q(t,i,e,s,n){return i>e&&(s.warn("min cannot be greater than max."),i=e),I(t)?t>e?(s.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(s.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(s.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+n),Q(null!=n?n:e,i,e,s))}var tt=class{constructor(t){this.C={},this.I=t.I,this.A=Q(t.bucketSize,0,100,t.R),this.O=Q(t.refillRate,0,this.A,t.R),this.$=Q(t.refillInterval,0,864e5,t.R)}F(t,i){const e=Math.floor((i-t.lastAccess)/this.$);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.A),t.lastAccess=t.lastAccess+e*this.$)}consumeRateLimit(t){var i;const e=Date.now(),s=String(t);let n=this.C[s];return n?this.F(n,e):(n={tokens:this.A,lastAccess:e},this.C[s]=n),0===n.tokens||(n.tokens--,0===n.tokens&&(null===(i=this.I)||void 0===i||i.call(this,t)),0===n.tokens)}stop(){this.C={}}};const it="Mobile",et="Android",st="Tablet",nt="Android Tablet",rt="iPad",ot="Apple Watch",lt="Safari",at="BlackBerry",ut="Samsung Internet",ht="Chrome",ct="Chrome iOS",dt="Internet Explorer",vt="Internet Explorer Mobile",ft="Opera",pt="Microsoft Edge",gt="Firefox",_t="Firefox iOS",mt="Nintendo",yt="PlayStation",bt="Xbox",wt="Android Mobile",$t="Mobile Safari",xt="Windows",St="Windows Phone",kt="Nokia",Et="Ouya",Tt="Generic tablet",Pt="Konqueror",Ct="Oculus Browser",At="Vivaldi",Ft="Yandex",Ot="Whale",Mt="DuckDuckGo",Rt="Pale Moon",It="Waterfox",Dt="Brave",jt="Claude",Lt="Codex",Nt="ChatGPT",zt="Google Search App",Bt=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ut=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ht=new RegExp(bt,"i"),qt=new RegExp("PlayStation \\w+","i"),Wt=new RegExp("Nintendo \\w+","i"),Vt=new RegExp("BlackBerry|PlayBook|BB10","i"),Gt={"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"},Kt=function(t,i,e,s){i=i||"";const n=function(t){return(null==t?void 0:t.brave)?Dt:null}(e);return n||((null==s?void 0:s.detectGoogleSearchApp)&&m(t,"GSA/")?zt:m(t," OPR/")&&m(t,"Mini")?"Opera Mini":m(t," OPR/")?ft:Vt.test(t)?at:m(t,"IEMobile")||m(t,"WPDesktop")?vt:m(t,"OculusBrowser")?Ct:m(t,"SamsungBrowser")?ut:m(t,"Edge")||m(t,"Edg/")?pt:m(t,"Vivaldi/")?At:m(t,"YaBrowser/")?Ft:m(t,"Whale/")?Ot:m(t,"DuckDuckGo/")||m(t,"Ddg/")?Mt:m(t,"Claude/")?jt:m(t,"Codex/")?Lt:m(t,"ChatGPT/")?Nt:m(t,"FBIOS")?"Facebook Mobile":m(t,"UCWEB")||m(t,"UCBrowser")?"UC Browser":m(t,"CriOS")?ct:m(t,"CrMo")||m(t,ht)?ht:m(t,et)&&m(t,lt)?wt:m(t,"FxiOS")?_t:m(t.toLowerCase(),Pt.toLowerCase())?Pt:m(t,"Brave/")?Dt:((t,i)=>i&&m(i,"Apple")||function(t){return m(t,lt)&&!m(t,ht)&&!m(t,et)}(t))(t,i)?m(t,it)?$t:lt:m(t,"PaleMoon/")?Rt:m(t,"Waterfox/")?It:m(t,gt)?gt:m(t,"MSIE")||m(t,"Trident/")?dt:m(t,"Gecko")?gt:"")},Jt={[vt]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[pt]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ht]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ct]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[lt]:[Bt],[$t]:[Bt],[ft]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[gt]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[_t]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Pt]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[at]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Bt],[wt]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ut]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Ct]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[At]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ft]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Ot]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Dt]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[jt]:[Ut],[Lt]:[Ut],[Nt]:[Ut],[Mt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Rt]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[It]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[zt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[dt]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Yt=function(t,i,e,s){const n=Kt(t,i,e,s),r=Jt[n];if(A(r))return null;for(let i=0;r.length>i;i++){const e=t.match(r[i]);if(e)return parseFloat(e[e.length-2])}return null},Zt=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[bt,t&&t[1]||""]],[new RegExp(mt,"i"),[mt,""]],[new RegExp(yt,"i"),[yt,""]],[Vt,[at,""]],[new RegExp(xt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[St,""];if(new RegExp(it).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];const e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){let t=Gt[e[1]]||"";return/arm/i.test(i)&&(t="RT"),[xt,t]}return[xt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let i="";return t&&t.length>=3&&(i=A(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[et,[t[2],t[3],t[4]||"0"].join(".")]:[et,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Xt=function(t){for(let i=0;Zt.length>i;i++){const[e,s]=Zt[i],n=e.exec(t),r=n&&(T(s)?s(n,t):s);if(r)return r}return["",""]},Qt=function(t){return Wt.test(t)?mt:qt.test(t)?yt:Ht.test(t)?bt:new RegExp(Et,"i").test(t)?Et:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?St:/iPad/.test(t)?rt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ot:Vt.test(t)?at:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(kt,"i").test(t)?kt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(it).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?et:nt:new RegExp("(pda|Mobile)","i").test(t)?"Generic mobile":new RegExp(st,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?Tt:""},ti=function(t,i){var e;const s=Qt(t);return s===rt||s===nt||"Kobo"===s||"Kindle Fire"===s||s===Tt?st:s===mt||s===bt||s===yt||s===Et?"Console":s===ot?"Wearable":s?it:"Android"===(null==i?void 0:i.userAgentDataPlatform)&&(null!==(e=null==i?void 0:i.maxTouchPoints)&&void 0!==e?e:0)>0?600>Math.min(null!==(n=null==i?void 0:i.screenWidth)&&void 0!==n?n:0,null!==(r=null==i?void 0:i.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==i?void 0:i.devicePixelRatio)&&void 0!==o?o:1)?it:st:"Desktop";var n,r,o},ii=/\bFBAV\/(\d+(?:\.\d+)*)/i,ei=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",ii],[/\bFBAN\/EMA\b/i,"Facebook Lite",ii],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",ii],[/\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"]],si="[Truncated]",ni="[Unserializable]";function ri(t){let i="";for(let e=0;t.length>e;e++){const s=t.charCodeAt(e);if(55296>s||s>56319)i+=56320>s||s>57343?t[e]:"�";else{const s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}function oi(t,i){if(!i)return t;let e=[];try{e=Object.keys(i)}catch(t){e=[]}for(const s of e){let e;try{e=i[s]}catch(t){e=ni}Object.defineProperty(t,s,{value:e,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const li=3e5;var ai=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const i=this.isOpen(),e=Date.now(),s=Math.min(t.retryAfterMs,li);if(!i)return this.ts=e,void(this.es=e+s);this.es=Math.max(this.es,Math.min(e+s,this.ts+li))}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const i=Math.min(li,Math.max(0,this.es-t));return 0===i&&this.reset(),i}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const ui=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function hi(t,i){return"string"==typeof(e=t)&&ui.test(e)?t:i();var e}function ci(t,i){const e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function di(t){return t?t.split("#")[0]:t}function vi(t){try{return t()}catch(t){return}}function fi(t,i){const e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function pi(t,i,e){return gi.apply(this,arguments)}function gi(){return(gi=J(function*(t,i,e){let s;try{return yield Promise.race([t,new Promise((t,n)=>{s=fi(()=>{try{null==e||e(),t()}catch(t){n(t)}},i)})])}finally{clearTimeout(s)}})).apply(this,arguments)}function _i(t){return _i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_i(t)}function mi(t,i,e){return(i=function(t){var i=function(t){if("object"!=_i(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var e=i.call(t,"string");if("object"!=_i(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_i(i)?i:i+""}(i))in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function yi(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),e.push.apply(e,s)}return e}function bi(t){for(var i=1;arguments.length>i;i++){var e=null!=arguments[i]?arguments[i]:{};i%2?yi(Object(e),!0).forEach(function(i){mi(t,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):yi(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})}return t}let wi,$i,xi,Si;function ki(t){var i;const e=globalThis._posthogChunkIds,s=globalThis._debugIds;if(!e&&!s)return;const n=e?Object.keys(e):[],r=s?Object.keys(s):[];if(Si&&Ei(e,n,$i)&&Ei(s,r,xi))return Si;$i=e?bi({},e):void 0,xi=s?bi({},s):void 0,Si={},null!==(i=wi)&&void 0!==i||(wi={});const o=(i,e)=>{for(const n of i){const i=e[n];if(!i)continue;const r=null==wi?void 0:wi[n];if(r){Si[r]=i;continue}const o=t(n);for(let t=o.length-1;t>=0;t--){var s;const e=null===(s=o[t])||void 0===s?void 0:s.filename;if(e){Si[e]=i,wi[n]=e;break}}}};return s&&o(r,s),e&&o(n,e),Si}function Ei(t,i,e){return t&&e?i.length===Object.keys(e).length&&i.every(i=>t[i]===e[i]):t===e}var Ti=class{constructor(t,i,e=[]){this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i={}){const e=i&&i.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(e,i,0).apply(t),n=this.buildParsingContext(i),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,e),$exception_level:"error"}}modifyFrames(t){var i=this;return J(function*(){for(const e of t)e.stacktrace&&e.stacktrace.frames&&E(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t})()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e;let s,n;if(null!=t.cause&&(s=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack)try{n=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)}catch(t){}return bi(bi({},t),{},{cause:s,stack:n,errors:null===(e=t.errors)||void 0===e?void 0:e.map(t=>this.parseStacktrace(t,i))})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(const e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return J(function*(){let e=t;for(const t of i.modifiers)e=yield t(e);return e})()}convertToExceptionList(t,i){const e=[],s=(t,n,r)=>{var o;const l=e.length,a=void 0===n?bi(bi({type:"string"==typeof i.type&&i.type.length>0?i.type:"generic"},"boolean"==typeof i.handled?{handled:i.handled}:void 0===i.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof i.synthetic?i.synthetic:t.synthetic,exception_id:l}):{type:"chained",source:r,synthetic:t.synthetic,exception_id:l,parent_id:n},u={type:t.type,value:t.value,mechanism:a};t.stack&&(u.stacktrace={type:"raw",frames:t.stack}),e.push(u),t.cause&&s(t.cause,l,"cause");for(const i of null!==(o=t.errors)&&void 0!==o?o:[])s(i,l,"member")};return s(t),e}buildParsingContext(t){var i;return{chunkIdMap:ki(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}getAggregateErrors(t){try{if(U(t)){let e=Object.getPrototypeOf(t);for(let s=0;e&&100>s;s++){var i;const s=null===(i=Object.getOwnPropertyDescriptor(e,"constructor"))||void 0===i?void 0:i.value;if("function"==typeof s&&"AggregateError"===s.name){const i=t.errors;return E(i)?i:void 0}e=Object.getPrototypeOf(e)}}}catch(t){}}buildCoercingContext(t,i,e=0){let s=0,n=0,r=!1;const o=new Set,l=[],a={},u=(t,i,e=0)=>{const u=h(i,e),c=u.apply;if(u.apply=i=>{l.push(t);try{return c(i)}finally{l.pop()}},e>4||e>0&&-1!==l.indexOf(t))return this.coerceFallback(u);const d="object"==typeof t&&null!==t||"function"==typeof t;if(0===e&&s>=50||d&&o.has(t))return;d&&o.add(t),0===e&&s++;const v=this.getAggregateErrors(t);let f,p;r||(r=!!v);try{if(f=this.applyCoercers(t,u),!f)throw a}catch(t){if(t===a)return void(0===e&&s--);if(!r)throw t;f=this.coerceFallback(u)}if(!v||s>=50)return f;try{p=v.length}catch(t){return f}if(!Number.isInteger(p)||0>p||p>4294967295)return f;const g=[];for(let t=0;50>s&&1e3>n&&p>t;t++){let e;n++;try{e=u.next(v[t])}catch(t){s++,e=this.coerceFallback(h(i+1))}e&&g.push(e)}return bi(bi({},f),{},{errors:g})},h=(e,s=0)=>bi(bi({},i),{},{syntheticException:0==e?i.syntheticException:void 0,mechanism:0==e?t:{},apply(t){const i=u(t,e,s+1);if(!i)throw a;return i},next:t=>u(t,e+1)}),c=h(e);return bi(bi({},c),{},{apply:t=>{var i;return null!==(i=u(t,e))&&void 0!==i?i:this.coerceFallback(c)}})}};const Pi=/^([a-z][a-z0-9.+-]+):/i,Ci=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function Ai(t){if(!t||"<anonymous>"===t)return!1;const i=Pi.exec(t);return!i||Ci.includes(i[1].toLowerCase())}function Fi(t,i,e,s,n){const r={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:Ai(i)};return A(s)||(r.lineno=s),A(n)||(r.colno=n),r}const Oi=(t,i)=>{const e=-1!==t.indexOf("safari-extension"),s=-1!==t.indexOf("safari-web-extension");return e||s?[-1!==t.indexOf("@")?t.split("@")[0]:"?",e?`safari-extension:${i}`:`safari-web-extension:${i}`]:[t,i]},Mi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ri=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ii=/\((\S*)(?::(\d+))(?::(\d+))\)/,Di=(t,i)=>{const e=Mi.exec(t);if(e){const[,t,s,n]=e;return Fi(i,t,"?",+s,+n)}const s=Ri.exec(t);if(s){if(s[2]&&0===s[2].indexOf("eval")){const t=Ii.exec(s[2]);t&&(s[2]=t[1],s[3]=t[2],s[4]=t[3])}const[t,e]=Oi(s[1]||"?",s[2]);return Fi(i,e,t,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},ji=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Li=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ni=(t,i)=>{const e=ji.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=Li.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}let t=e[3],s=e[1]||"?";return[s,t]=Oi(s,t),Fi(i,t,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},zi=/\(error: (.*)\)/;function Bi(t,i){return t.filename===i.filename&&t.function===i.function&&t.module===i.module&&t.lineno===i.lineno&&t.colno===i.colno}function Ui(t){for(let i=1;10>=i;i++){const e=t.length-2*i;if(0>e)break;let s=!0;for(let n=0;i>n;n++)if(!Bi(t[e+n],t[e+i+n])){s=!1;break}if(s){for(let s=0;i>s;s++)t[e+s]=t[e+i+s];return t.length=e+i,{start:e,length:i}}}}function Hi(t,i){const e=i.start+i.length,s=Wi(t,i);s&&t.splice(e+s===t.length?e:i.start,s)}function qi(t,i){let e=i.start;for(;e>0&&Bi(t[e-1],t[e-1+i.length]);)e--;return i.start-e}function Wi(t,i){const e=i.start+i.length;let s=e;for(;t.length>s&&Bi(t[s],t[s-i.length]);)s++;return s-e}function Vi(t,i){const e=i[0];let s=t.length-(e?qi(t,e):0);for(const e of i)s-=Wi(t,e);return s}function Gi(t,i,e){for(let s=0;t.length>s;s++){const n=t[(i+s)%t.length],r=t[(e+s)%t.length];if(n!==r)return r>n}return!1}var Ki=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){const e=F(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){const i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${i}: ${t.message}`:i}isDOMException(t){return B(t,"DOMException")}isDOMError(t){return B(t,"DOMError")}},Ji=class{match(t){return U(t)}coerce(t,i){var e;const s=this.getStack(t),n=void 0===s?null===(e=i.syntheticException)||void 0===e?void 0:e.stack:void 0,r=!!n;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=s?s:n,cause:t.cause?i.next(t.cause):void 0,synthetic:r}}getType(t){return t.name||t.constructor.name}getMessage(t,i){const e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){try{const i=t.stacktrace;if("string"==typeof i&&i.length>0)return i;const e=t.stack;return"string"==typeof e&&e.length>0?e:void 0}catch(t){return}}},Yi=class{match(t){return!!B(t,"ErrorEvent")&&(null!=t.error||this.yr(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);const s=i.apply(t.message);return bi(bi({},s),{},{stack:null!==(e=this.br(t))&&void 0!==e?e:s.stack,synthetic:!0})}yr(t){return F(t.message)&&t.message.length>0}br(t){var i,e;const s=t,n=null!==(i=s.lineno)&&void 0!==i?i:0,r=null!==(e=s.colno)&&void 0!==e?e:0;if(F(s.filename)&&0!==s.filename.length&&0!==n)return`Error\n at ${s.filename}:${n}:${r}`}};const Zi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Xi=class{match(t){return"string"==typeof t}coerce(t,i){var e;const[s,n]=this.getInfos(t);return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}getInfos(t){let i="Error",e=t;const s=t.match(Zi);return s&&(i=s[1],e=s[2]),[i,e]}};const Qi=["fatal","error","warning","log","info","debug"];function te(t,i=40){const e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(let t=e.length;t>0;t--){const s=e.slice(0,t).join(", ");if(i>=s.length)return t===e.length?s:s.length>i?`${s.slice(0,i)}...`:s}return""}var ie=class{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,s;const n=this.getErrorPropertyFromObject(t);return n?i.apply(n):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null===(s=i.syntheticException)||void 0===s?void 0:s.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(H(t))return t.constructor.name;const i="name"in t?t.name:void 0;return F(i)&&!O(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){let i=`'${t.name}' captured as exception`;return"message"in t&&"string"==typeof t.message&&(i+=` with message: '${t.message}'`),i}if("message"in t&&"string"==typeof t.message)return t.message;const i=this.getObjectClassName(t);return`${i&&"Object"!==i?`'${i}'`:"Object"} captured as exception with keys: ${te(t)}`}isSeverityLevel(t){return F(t)&&!O(t)&&Qi.indexOf(t)>=0}getStack(t){try{return F(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:F(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(const i in t)if({}.hasOwnProperty.call(t,i)){const e=t[i];if(U(e))return e}}getObjectClassName(t){try{const i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},ee=class{match(t){return H(t)}coerce(t,i){var e;const s=t.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${te(t)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}},se=class{match(t){return z(t)}coerce(t,i){var e;return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}},ne=class{match(t){return B(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!H(t))return!1;try{const i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e;const s=this.getUnhandledRejectionReason(t);return z(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}:i.apply(s)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}};const re="$message",oe="$timestamp",le=new Set([re,oe]),ae={enabled:!0,max_bytes:32768};function ue(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:ae.enabled,max_bytes:ce(t.max_bytes,ae.max_bytes)}:bi({},ae)}var he=class{constructor(t){this.ns=[],this.ss=0,this.Fr=ue(t)}setConfig(t){this.Fr=ue(t),this.rs()}add(t){const i=function(t){let i;try{i=w(t)}catch(t){return}try{const t=JSON.parse(i);if(!P(t))return;const e=t,s=e[re],n=e[oe];if(!F(s)||0===s.trim().length)return;if(!F(n)&&!I(n))return;return{step:e,json:i}}catch(t){return}}(t);if(!i)return;const e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;const i=encodeURIComponent(t);let e=0;for(let t=0;i.length>t;t++)"%"===i[t]?(e+=1,t+=2):e+=1;return e}(i.json);e>this.Fr.max_bytes||(this.ns.push({step:i.step,bytes:e}),this.ss+=e,this.rs())}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Fr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function ce(t,i){if(!I(t)||1/0===t||-1/0===t)return i;const e=Math.floor(t);return 0>e?i:e}const de=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function ve(t){return"string"==typeof t||t}function fe(t){return"string"==typeof t?t:void 0}const pe=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],ge="NativeGzipValidationError",_e=t=>t.length>=2&&31===t[0]&&139===t[1],me=(t,i)=>t===p.GZipJS||i===p.GZipJS||"gzip"===i,ye=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):"");let be;const we=t=>{throw ci(ge,`Native gzip produced invalid output: ${t}`)},$e=function(){var t=J(function*(t,i){18>t.size&&we("too-short");const e=new Uint8Array(yield t.slice(0,10).arrayBuffer());_e(e)&&8===e[2]||we("invalid-header");const s=new DataView(yield t.slice(t.size-8).arrayBuffer());s.getUint32(0,!0)!==(t=>{const i=(()=>{if(be)return be;be=[];for(let t=0;256>t;t++){let i=t;for(let t=0;8>t;t++)i=1&i?3988292384^i>>>1:i>>>1;be[t]=i>>>0}return be})();let e=4294967295;for(let s=0;t.length>s;s++)e=i[255&(e^t[s])]^e>>>8;return(4294967295^e)>>>0})(i)&&we("invalid-crc");const n=i.length>>>0;s.getUint32(4,!0)!==n&&we("invalid-size")});return function(i,e){return t.apply(this,arguments)}}();function xe(){return xe=J(function*(t,i=!0,e){try{const i=(new TextEncoder).encode(t),e=new globalThis.CompressionStream("gzip"),n=e.writable.getWriter(),r=n.write(i).then(()=>n.close()).catch((s=J(function*(t){try{yield n.abort(t)}catch(t){}throw t}),function(t){return s.apply(this,arguments)})),o=new Response(e.readable).blob(),[l]=yield Promise.all([o,r]);return yield $e(l,i),l}catch(t){if(null==e?void 0:e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}var s}),xe.apply(this,arguments)}function Se(t,i){if(null==t)return{};var e,s,n=function(t,i){if(null==t)return{};var e={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(i.includes(s))continue;e[s]=t[s]}return e}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;r.length>s;s++)i.includes(e=r[s])||{}.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}const ke="[redacted]",Ee=/^[A-Za-z0-9+/\n\r]+=*$/,Te=/^[A-Za-z0-9_-]+={0,2}$/,Pe=/[-_]/,Ce=/^data:[^,\s]*;base64,/i,Ae=/^[A-Za-z0-9+/_-]+={0,2}$/,Fe=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Oe=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,Me=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,Re=/[\s<>"]/,Ie=(()=>new RegExp(Me.source,"i"))(),De=/[a-z][a-z0-9+.-]{0,63}:\/\//i,je=(()=>new RegExp(`^${De.source}`,"i"))(),Le=(()=>new RegExp(De.source,"gi"))(),Ne=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,ze=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,Be=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,Ue=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,He=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,qe=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,We=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,Ve=/\b\d(?:[ ./-]?\d){12,}\b/g,Ge=/\d+/g,Ke=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,Je=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function Ye(t){return function(t){return Oe.test(t)}(t)||Ne.test(t)||ze.test(t)}function Ze(t){return t.split("&",129).length>128}function Xe(t,i,e){return Ye(t)||i.includes(";")&&function(t){return t.split(";").some(t=>Ye(t.split("=",1)[0]))}(i)?ke:Ie.test(i)?e?ns(i,{allowNestedUrls:!1,stripPunctuation:!0}):ke:i}function Qe(t,i){const e=new URLSearchParams;let s=!1,n=!1;for(const[r,o]of new URLSearchParams(t)){const t=rs(r),l=rs(o);s||(s=t!==r||l!==o);const a=Xe(t,l,i);s||(s=a!==l),n=Ye(t)||a!==l,e.append(t,a)}return{changed:s,lastFieldSensitive:n,serialized:e.toString()}}function ts(t,i){if(!t.includes("="))return{value:is(t,i),lastFieldSensitive:!1};const e=Qe(t,i);return{value:e.changed?e.serialized:t,lastFieldSensitive:e.lastFieldSensitive}}function is(t,i){return i?ns(t,{allowNestedUrls:!1,stripPunctuation:!0}):Ie.test(t)?ke:t}function es(t,i,e){return"#"===t?!i.fragment&&(i.fragment=!0):"?"===t&&(i.fragment?"="!==e&&!i.fragmentQuery&&(i.fragmentQuery=!0):!i.query&&(i.query=!0))}function ss(t,i){var e;if(t.length>8192&&je.test(t))return ke;const{address:s,suffix:n}=i.stripPunctuation?function(t){let i=t.length;for(;i>0&&".,;:!?)]}'".includes(t[i-1]);)i--;return{address:t.slice(0,i),suffix:t.slice(i)}}(t):{address:t,suffix:""};let r;try{r=new URL(s)}catch(t){return ke+n}const o=r.search.slice(1),l=""!==r.hash,a=function(t){const i=t.slice(1),e=i.indexOf("?");return 0>e?{head:i,tail:null}:{head:i.slice(0,e),tail:i.slice(e+1)}}(r.hash);if(Ze(o)||Ze(a.head)||Ze(null!==(e=a.tail)&&void 0!==e?e:""))return ke+n;let u=!1;(r.username||r.password)&&(r.username=ke,r.password="",u=!0);const h=Qe(o,i.allowNestedUrls);h.changed&&(r.search=h.serialized,u=!0);const c=ts(a.head,i.allowNestedUrls),d=null===a.tail?null:(v=a.tail,c.lastFieldSensitive?{value:""===v?"":ke,lastFieldSensitive:!0}:ts(v,i.allowNestedUrls));var v;const f=null===d?c.value:`${c.value}?${d.value}`;f!==r.hash.slice(1)&&(r.hash=f,u=!0);const p=l?null!=d?d:c:h;return(u?rs(r.toString()):s)+(p.lastFieldSensitive?"":n)}function ns(t,i){return t.replace(Me,e=>function(t,i){const e=function(t){if(!t.includes("://"))return[];const i=[...t.matchAll(Le)].map(t=>t.index),e=[],s={query:!1,fragment:!1,fragmentQuery:!1};let n=0,r=!1,o="";for(let l=0;t.length>l&&i.length>n;l++){i[n]===l&&(l>0&&"="!==o&&e.push(l),n++);const a=t[l];es(a,s,o)?(o=a,r=!0):r&&"=&".includes(a)&&(o=a)}return e}(t);if(0===e.length)return ss(t,i);let s="",n=0;for(const r of e)s+=ss(t.slice(n,r),bi(bi({},i),{},{stripPunctuation:!1})),n=r;return s+ss(t.slice(n),i)}(e,bi(bi({},i),{},{stripPunctuation:i.stripPunctuation&&e.length!==t.length})))}function rs(t){return t.replace(Fe,ke)}function os(t,i){return function(t){return t.length>=10240&&(Ee.test(t)||function(t){const i=Ce.exec(t);if(!i)return!1;let e;try{e=decodeURIComponent(t.slice(i[0].length))}catch(t){return!1}return Ae.test(e.replace(/[\r\n]/g,""))}(t)||Pe.test(t)&&Te.test(t))}(t)?"[binary data redacted - not supported by PostHog MCP analytics]":function(t,i,e){const s=4*e.maxStringLength;if(t.length>s){const n=i(t.slice(0,function(t,i){let e=i;for(;e>0&&!Re.test(t[e-1]);)e--;return e}(t,s)));if(n.length>=2*e.maxStringLength)return n+e.truncationSuffix}return i(t)}(t,t=>function(t){return ns(t,{allowNestedUrls:!0,stripPunctuation:!0})}(function(t){let i=t.replace(Be," ");return i=i.replace(Ue,ke),i=i.replace(He,ke),i=i.replace(qe,`$1${ke}`),i=i.replace(Ve,as),i=i.replace(We,ke),i=i.replace(Ke,`$1${ke}`),i=i.replace(Je,`$1${ke}`),i}(rs(t))),i)}function ls(t){let i=0,e=!1;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;if(0>n||n>9)return!1;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e}return i%10==0}function as(t){const i=[];for(let e=Ge.exec(t);null!==e;e=Ge.exec(t))i.push({digits:e[0],start:e.index,end:e.index+e[0].length});let e="",s=0,n=0;for(;i.length>n;){let r="",o=-1;for(let t=n;i.length>t&&(r+=i[t].digits,19>=r.length);t++)r.length>=13&&ls(r)&&(o=t);0>o?n++:(e+=t.slice(s,i[n].start)+ke,s=i[o].end,n=o+1)}return e+t.slice(s)}const us={}.propertyIsEnumerable;function hs(t,i){try{return vs(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function cs(t,i,e,s){if(0>=e.remainingNodes)return{stringValue:si};if(e.remainingNodes--,j(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){const e=t.toString(),s=BigInt("9223372036854775808");return t>=s||-s>t?(null==i||i.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}(t,i);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const e=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==i||i.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:ri(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:si};if(t instanceof Date){const i=t.getTime(),e=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:"string"==typeof e?ri(e):String(e)}}e.ancestors.add(t);try{try{const n=t.toJSON;if("function"==typeof n)return cs(n.call(t),i,e,s+1)}catch(t){}return E(t)?{arrayValue:{values:ds(t,i,e,s+1)}}:{kvlistValue:{values:vs(t,i,e,s+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:ri(String(t))}}function ds(t,i,e,s){const n=[],r=Math.min(t.length,1e3);let o=0;for(;r>o&&e.remainingNodes>0;o++)try{const r=o in t?t[o]:void 0;if(R(r))continue;n.push(cs(r,i,e,s))}catch(t){n.push({stringValue:ni})}return t.length>o&&n.push({stringValue:si}),n}function vs(t,i,e,s){const n=[];for(const r in t)if(us.call(t,r)){if(!r){null==i||i.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=t[r];if(M(o)||A(o))continue;n.push({key:ri(r),value:cs(o,i,e,s)})}catch(t){n.push({key:ri(r),value:{stringValue:ni}})}}return n}function fs(t,i,e){return bi(bi(bi(bi({},oi({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}const ps=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function gs(t,i){const e=oi({},t),s={};for(const t of ps)({}).hasOwnProperty.call(e,t)&&(s[t]=e[t],delete e[t]);return[...hs(e,i),...hs(s,i)]}const _s={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"};const ms={text:"INFO",number:9},ys={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:ms,warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}};function bs(t){try{return ri(String(t))}catch(t){return ni}}function ws(t,i,e,s){const n=t.level||"info",{text:r,number:o}=ys[n]||ms,l=function(t=Date.now()){return String(t)+"000000"}(I(s)?s:void 0),a={};i.distinctId&&(a.posthogDistinctId=i.distinctId),i.sessionId&&(a.sessionId=i.sessionId),i.windowId&&(a["window.id"]=i.windowId),R(i.sessionStartTimestamp)||(a.sessionStartTimestamp=String(i.sessionStartTimestamp)),R(i.lastActivityTimestamp)||(a.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(a["url.full"]=i.currentUrl),i.screenName&&(a["screen.name"]=i.screenName),i.appState&&(a["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(a.feature_flags=i.activeFeatureFlags);const u=bi({},a),h=t.attributes;if(h){let t=[];try{t=Object.keys(h)}catch(i){t=[]}for(const i of t){let t;try{t=h[i]}catch(i){t=ni}Object.defineProperty(u,i,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const c={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:bs(t.body)},attributes:hs(u,e)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),A(t.trace_flags)||(c.flags=t.trace_flags),c}function $s(t,i,e){return fs(t,i,e)}function xs(t,i,e,s){return{resourceLogs:[{resource:{attributes:gs(i)},scopeLogs:[{scope:{name:e,version:s},logRecords:t}]}]}}var Ss=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.cs}arm(t){this.clear(),this.us=Date.now()+t,this.cs=fi(()=>{this.cs=void 0,this.ls()},t)}armNoEarlierThan(t){this.cs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function ks(){return.75+.5*Math.random()}function Es(t,i,e,s){const n=Math.min(Math.max(0,i-1),6),r=t*Math.pow(2,n);return Math.round((void 0===s?r:Math.min(r,Math.max(s,t)))*e)}var Ts=class{constructor(t,i,e,s,n,r=()=>Promise.resolve(),o){var l;this._instance=t,this.Fr=i,this.R=e,this.hs=s,this.ds=n,this.vs=r,this.fs=o,this.ps=new Ss(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new ai,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=i.maxBufferSize,this.Is=Math.max(null!==(l=i.maxQueueSize)&&void 0!==l?l:i.maxBufferSize,i.maxBufferSize),this.Ms=i.flushIntervalMs,this.Es=i.maxBatchRecordsPerPost,this.As=i.rateCapWindowMs,this.Rs=i.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(f.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Fr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.Ps()&&this.Os():this.gs()}captureLog(t,i){var e;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const s=this.Fs(t);if(null===s)return;if(!s.body)return void this.R.info("Log was rejected in beforeSend function");if(!this.Ds())return;const n={record:ws(s,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.hs(),this.R,null==i?void 0:i.occurredAtMs)};this.ds(()=>this.Ls(n))}Fs(t){const i=this.Fr.beforeSend;if(!i)return t;const e=E(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.R.info("Log was rejected in beforeSend function"),null;s=i}catch(t){return this.R.error("Error in beforeSend function for log:",t),null}return s}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),i=t-this.xs;return this.As>i&&i>=0||(this.xs=t,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.R.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.As}ms`),this.Cs=!0),!1)}flush(){var t=this;return J(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return J(function*(){var i;t.ps.clear();let e=null!==(i=t._instance.getPersistedProperty(f.LogsQueue))&&void 0!==i?i:[];if(0===e.length)return;const s=e.length;let n=0;for(;e.length>0&&s>n;){var r,o;const i=t._s;t.bs=0;const s=Math.min(e.length,t.Es),l=e.slice(0,s),a=xs(l.map(t=>t.record),t.js(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.qs(a);if(t._s!==i)return;if("too-large"===u.kind&&l.length>1)t.Es=Math.max(1,Math.floor(l.length/2)),t.R.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.R.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Fr.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Fr.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(l.length),e=null!==(o=t._instance.getPersistedProperty(f.LogsQueue))&&void 0!==o?o:[],n+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var i=this;return J(function*(){var e;const s=Math.max(0,t-i.bs),n=null!==(e=i._instance.getPersistedProperty(f.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(f.LogsQueue,n.slice(s)),yield i.vs()})()}js(){return $s(this.Fr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var i;if(this._instance.optedOut)return;const e=null!==(i=this._instance.getPersistedProperty(f.LogsQueue))&&void 0!==i?i:[];this.Is>e.length||(e.shift(),this.bs++,this.R.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(f.LogsQueue,e),this.Ts>e.length||this.ws.isOpen()?this.Os():this.gs()}Os(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}zs(){return Math.max(Es(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}Ps(){const t=this._instance.getPersistedProperty(f.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return J(function*(){i.ps.clear();const e=i.flush().catch(()=>{});void 0!==t?yield pi(e,t):yield e})()}flushWithTimeout(t){var i=this;return J(function*(){const e=i.flush();yield pi(e,t,()=>{e.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=ks(),this.R.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.Ps()&&this.ps.armNoEarlierThan(this.zs())})}};const Ps=/^[0-9a-f]+$/;function Cs(t,i,e){return"string"==typeof t&&t.length===i&&t!==e&&Ps.test(t)}const As=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;const Fs="00",Os=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ms(t){return String(t)+"000000"}function Rs(t,i,e,s){let n="";return s&&(n=Object.keys(s).sort().map(t=>`${JSON.stringify(t)}:${JSON.stringify(s[t])}`).join(",")),`${t}\0${i}\0${null!=e?e:""}\0${n}`}var Is=class{constructor(t,i,e){this._instance=t,this.Fr=i,this.R=e,this.Hs=new Map,this.ps=new Ss(()=>this.flush().catch(t=>{this.R.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new ai,this.ks=0,this.Ss=1,this.Gs=0}count(t,i=1,e){this.Qs({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.Qs({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.Qs({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this;const i=this.ys,e=function(){var e=J(function*(){i&&(yield i.catch(()=>{})),yield t.Js()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.ys===e&&(this.ys=null)});return this.ys=e,e}drainWindow(){if(0===this.Hs.size)return null;const t=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Zs(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const i=this.Fs(t);if(null===i)return;if(!i.name||"string"!=typeof i.name)return void this.R.warn("Dropping metric with empty name");if("number"!=typeof i.value||!Number.isFinite(i.value))return void this.R.warn(`Dropping metric '${i.name}': value must be a finite number`);if("count"===i.type&&0>i.value)return void this.R.warn(`Dropping count '${i.name}': counters are monotonic, value must be >= 0`);let e,s;try{e=i.attributes?bi({},i.attributes):void 0,s=Rs(i.type,i.name,i.unit,e)}catch(t){return void this.R.warn(`Dropping metric '${i.name}': attributes could not be serialized`,t)}let n=this.Hs.get(s);if(!n){if(!this.Ks())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Hs.set(s,n)}const r=this.Ws.get(i.name);void 0===r?this.Ws.set(i.name,i.type):r===i.type||this.Vs.has(i.name)||(this.Vs.add(i.name),this.R.warn(`Metric name '${i.name}' is already used as a ${r}; recording it as a ${i.type} too will blend both series in charts. Use a distinct name.`)),this.Ys(n,i.value);const o=this.Xs();o&&(n.exemplar=bi(bi({},o),{},{value:i.value,timeMs:Date.now()})),this.Os()}Xs(){try{var t,i;const e=function(t){const i=function(t){if("string"!=typeof t)return;const i=As.exec(t.trim());if(!i)return;const[,e,s,n,r,o]=i;return"ff"===e||"00"===e&&o||!function(t){return Cs(t,32,"00000000000000000000000000000000")}(s)||!function(t){return Cs(t,16,"0000000000000000")}(n)?void 0:{version:e,traceId:s,spanId:n,flags:r}}(t);return i&&{traceId:i.traceId,spanId:i.spanId,flags:(e=i.flags,1&parseInt(e,16)?"01":Fs)};var e}(null===(t=(i=this._instance).getActiveSpan)||void 0===t||null===(t=t.call(i))||void 0===t?void 0:t.traceparent());if(e&&"01"===e.flags)return{traceId:e.traceId,spanId:e.spanId}}catch(t){}}Ks(){return this.Fr.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.R.warn(`Metric series cap reached (${this.Fr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Ys(t,i){switch(t.type){case"count":var e;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(Os.length+1).fill(0)});const e=t.hist;e.count+=1,e.sum+=i,e.min=Math.min(e.min,i),e.max=Math.max(e.max,i),e.bucketCounts[function(t,i){for(let e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,Os)]+=1;break}}}Fs(t){const i=this.Fr.beforeSend;if(!i)return t;const e=E(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.R.info("Metric was rejected in beforeSend function"),null;s=i}catch(t){return this.R.error("Error in beforeSend function for metric:",t),null}return s}Os(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(Es(this.Fr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Js(){var t=this;return J(function*(){if(t.ps.clear(),0===t.Hs.size)return;const i=t.Hs;t.Hs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const e=t.Gs,s=yield t._instance._o(t.Zs(i));if(e===t.Gs)switch(t.ws.record(s),"retry-later"===s.kind?(t.ks++,t.Ss=ks()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.zs()),s.kind){case"ok":return;case"retry-later":return t.ko(i),void t.ps.armNoEarlierThan(t.zs());case"too-large":return void t.R.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.R.error("Failed to send metrics batch:",s.error)}})()}Zs(t){return i=this.So(t),e=function(t,i,e){return fs(t,i,e)}(this.Fr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:gs(e)},scopeMetrics:[{scope:{name:s,version:n},metrics:i}]}]};var i,e,s,n}So(t){const i=Ms(Date.now()),e=new Map;for(const o of t.values()){var s;const t=Rs(o.type,o.name,o.unit,void 0);let l=e.get(t);l||(l=bi({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},e.set(t,l));const a=hs(null!==(s=o.attributes)&&void 0!==s?s:{},this.R),u=Ms(o.windowStartMs),h=Ds(o.exemplar);if("count"===o.type){var n;const t=bi({attributes:a,startTimeUnixNano:u,timeUnixNano:i,asDouble:null!==(n=o.total)&&void 0!==n?n:0},h);l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t=bi({attributes:a,timeUnixNano:i,asDouble:null!==(r=o.last)&&void 0!==r?r:0},h);l.gauge.dataPoints.push(t)}else if(o.hist){const t=bi({attributes:a,startTimeUnixNano:u,timeUnixNano:i,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Os},h);l.histogram.dataPoints.push(t)}}return Array.from(e.values())}ko(t){for(const[n,r]of t){var i;const t=this.Hs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,r.windowStartMs),t.exemplar=null!==(i=t.exemplar)&&void 0!==i?i:r.exemplar,t.type){case"count":var e,s;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(s=r.total)&&void 0!==s?s:0);break;case"gauge":break;case"histogram":if(r.hist)if(t.hist){t.hist.count+=r.hist.count,t.hist.sum+=r.hist.sum,t.hist.min=Math.min(t.hist.min,r.hist.min),t.hist.max=Math.max(t.hist.max,r.hist.max);for(let i=0;t.hist.bucketCounts.length>i;i++)t.hist.bucketCounts[i]+=r.hist.bucketCounts[i]}else t.hist=r.hist}else this.Ks()&&this.Hs.set(n,r)}}};function Ds(t){return t?{exemplars:[{filteredAttributes:[],timeUnixNano:Ms(t.timeMs),asDouble:t.value,traceId:t.traceId,spanId:t.spanId}]}:{}}const js=(t,{debugEnabled:i}={})=>{const e={N(e,...s){let n;try{n=typeof window>"u"?void 0:window}catch(t){return}n&&(v.DEBUG||n.POSTHOG_DEBUG||i)&&!A(n.console)&&n.console&&("__rrweb_original__"in n.console[e]?n.console[e].__rrweb_original__:n.console[e])(t,...s)},debug(...t){e.N("debug",...t)},info(...t){e.N("log",...t)},warn(...t){e.N("warn",...t)},error(...t){e.N("error",...t)},critical(...i){console.error(t,...i)},uninitializedWarning(t){e.error(`You must initialize PostHog before calling ${t}`)},createLogger:(i,e)=>js(`${t} ${i}`,e)};return e},Ls=js("[PostHog.js]"),Ns=(t,i)=>Ls.createLogger(t,i),zs=Ns("[ExternalScriptsLoader]"),Bs=t=>{const i=null==s?void 0:s.querySelectorAll("script");if(i)for(let e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},Us=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return zs.warn(`${i} was requested but loading of external scripts is disabled.`),e("Loading of external scripts is disabled");const n=()=>{if(null==s||s.removeEventListener("DOMContentLoaded",n),t.config.disable_external_dependency_loading)return e("Loading of external scripts is disabled");if(!s)return e("document not found");let o=s.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=i,o.onload=t=>{o.__posthog_loading_callback_fired=!0,e(void 0,t)},o.onerror=t=>{o.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(o=t.config.prepare_external_dependency_script(o)),!o)return e("prepare_external_dependency_script returned null");if(t.config.disable_external_dependency_loading)return e("Loading of external scripts is disabled");const l=Bs(o.src);if(l){if(l.integrity!==o.integrity||l.crossOrigin!==o.crossOrigin||l.nonce!==o.nonce)return e("Existing script conflicts with prepared script policy");if(l.__posthog_loading_callback_fired)return e();const t=l.__posthog_loading_error;return t?e(t):(l.addEventListener("load",t=>{l.__posthog_loading_callback_fired=!0,e(void 0,t)}),void l.addEventListener("error",t=>{l.__posthog_loading_error=t,e(t)}))}if(!s.body)return r();if("head"===t.config.external_scripts_inject_target)s.head.appendChild(o);else{const t=s.querySelectorAll("body > script");var a;t.length>0?null===(a=t[0].parentNode)||void 0===a||a.insertBefore(o,t[0]):s.body.appendChild(o)}},r=()=>{null==s||s.addEventListener("DOMContentLoaded",n)};(null==s?void 0:s.body)||Bs(i)?n():r()},Hs={},qs=(t,i)=>{let e=`/static/${i}.js?v=${t.version}`;if("toolbar"===i){const t=3e5;e=`${e}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",e)};c.__PosthogExtensions__=c.__PosthogExtensions__||{},c.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"===i){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void Us(t,i,e)}const s=t.config.strict_script_versioning;if(s){const n=t.requestRouter.endpointFor("assets",`/static/${t.version}/${i}.js`),r=Hs[n];if("fallback"===s&&r){if(Bs(r))return void Us(t,r,e);delete Hs[n]}return void Us(t,n,"fallback"===s?(s,r)=>{if(s)if("string"==typeof s)e(s);else{var o;const s=qs(t,i);Hs[n]=s;const r=Bs(n);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),Us(t,s,e)}else e(void 0,r)}:e)}Us(t,qs(t,i),e)},c.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{const s=t.requestRouter.endpointFor("api",i);Us(t,s,e)},v.DEBUG=!1,v.LIB_VERSION="1.446.2",v.LIB_NAME="web";var Ws=v;const Vs="$early_access_features",Gs="$active_feature_flags",Ks="$feature_flag_details",Js="$feature_flag_errors",Ys="$feature_flag_evaluated_at",Zs="$feature_flag_request_id",Xs="$minimal_flag_called_events",Qs="$enabled_feature_flags",tn="$stored_group_properties",en="$stored_person_properties",sn="$flag_call_reported",nn="$flag_call_reported_session_id",rn="$feature_flag_payloads",on="$override_feature_flags",ln="$override_feature_flag_payloads",an="visibilitychange",un="$autocapture_disabled_server_side",hn="$surveys",cn="$surveys_loaded_at",dn="PostHog loadExternalDependency extension not found.",vn="$surveys_activated",fn="$surveys_activated_session",pn="$surveys_activated_timestamps",gn="$people_distinct_id",_n="distinct_id",mn="$device_id",yn="$device_model",bn="__alias",wn="__cmpns",$n="$fbc",xn="$fbc_persistence",Sn="$fbp",kn="$fbp_persistence",En="__timers",Tn="$heatmaps_enabled_server_side",Pn="$exception_capture_enabled_server_side",Cn="$error_tracking_suppression_rules",An="$error_tracking_capture_extension_exceptions",Fn="$web_vitals_enabled_server_side",On="$dead_clicks_enabled_server_side",Mn="$product_tours_enabled_server_side",Rn="$logs_capture_enabled_server_side",In="$web_vitals_allowed_metrics",Dn="$session_recording_remote_config",jn="$session_recording_enabled_server_side",Ln="$replay_sample_rate",Nn="$replay_override_sampling",zn="$replay_override_linked_flag",Bn="$replay_override_url_trigger",Un="$replay_override_event_trigger",Hn="$sesid",qn="$session_is_sampled",Wn="$session_past_minimum_duration",Vn="$session_recording_url_trigger_activated_session",Gn="$session_recording_event_trigger_activated_session",Kn="$debug_first_full_snapshot_timestamp",Jn="$sess_rec_flush_size",Yn="$groups",Zn="ph_product_tours",Xn="$product_tours_activated",Qn="$product_tours_activated_session",tr="$conversations_widget_session_id",ir="$conversations_ticket_id",er="$conversations_widget_state",sr="$conversations_user_traits",nr="$user_state",rr="$client_session_props",or="$capture_rate_limit",lr="$initial_campaign_params",ar="$initial_referrer_info",ur="$initial_person_info",hr="$epp",cr="$posthog_cookieless",dr="$cookieless_mode",vr="$sdk_debug_extensions_init_method",fr="$sdk_debug_extensions_init_time_ms",pr="$sdk_debug_recording_script_not_loaded",gr="$sdk_debug_replay_stale_config",_r="$sdk_debug_replay_event_trigger_status",mr="$sdk_debug_replay_linked_flag_trigger_status",yr="$sdk_debug_replay_matched_recording_trigger_groups",br="$sdk_debug_replay_pending_trigger_conditions",wr="$sdk_debug_replay_remote_trigger_matching_config",$r="$sdk_debug_replay_trigger_groups_count",xr="$sdk_debug_replay_url_trigger_status",Sr="$session_recording_start_reason",kr="anonymous",Er="identified",Tr="identified_only",Pr="beforeunload",Cr="$pageview",Ar="$pageleave",Fr="$identify",Or="$groupidentify";function Mr(t,i){E(t)&&t.forEach(i)}function Rr(t,i){if(!R(t))if(E(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(const e in t)S.call(t,e)&&i(t[e],e)}const Ir=function(t,...i){for(const e of i)for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t};function Dr(t){const i=Object.keys(t);let e=i.length;const s=new Array(e);for(;e--;)s[e]=[i[e],t[i[e]]];return s}const jr=function(t){return function(...i){try{return t.apply(this,i)}catch(t){Ls.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ls.critical(t)}}},Lr=function(t){const i={};return Rr(t,function(t,e){(F(t)&&t.length>0||I(t))&&(i[e]=t)}),i};function Nr(t){const i=bi({},t);for(const e of["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e])}catch(t){}return i}const zr=["herokuapp.com","vercel.app","netlify.app"];function Br(t){const i=null==t?void 0:t.hostname;if(!F(i))return!1;const e=i.split(".").slice(-2).join(".");for(const t of zr)if(e===t)return!1;return!0}function Ur(t,i,e,s){const{capture:n=!1,passive:r=!0}=null!=s?s:{};null==t||t.addEventListener(i,e,{capture:n,passive:r})}function Hr(t){return"ph_toolbar_internal"===t.name}const qr=t=>{if(s){try{const i=t+"=",e=s.cookie.split(";").filter(t=>t.length);for(let t=0;e.length>t;t++){let s=e[t];for(;" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}};var Wr=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(i,e,s,n){if(!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(s)||!Number.isInteger(n)||0>i||0>e||0>s||0>n||i>0xffffffffffff||e>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=i/Math.pow(2,40),r[1]=i/Math.pow(2,32),r[2]=i/Math.pow(2,24),r[3]=i/Math.pow(2,16),r[4]=i/256,r[5]=i,r[6]=112|e>>>8,r[7]=e,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new t(r)}toString(){let t="";for(let i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(let i=0;16>i;i++){const e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}},Vr=class{generate(){const t=this.generateOrAbort();if(!A(t))return t;{this.Tt=0;const t=this.generateOrAbort();if(A(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return I(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Tt)this.Tt=t,this.It();else{if(this.Tt>=t+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Tt++,this.It())}return Wr.fromFieldsV7(this.Tt,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.At.nextUint32())}It(){this.Mt=1024*this.At.nextUint32()+(1023&this.At.nextUint32())}constructor(){this.Tt=0,this.Mt=0,this.At=new Jr}};const Gr=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};let Kr;var Jr=class{nextUint32(){var t;return this.Rt.length>this.Et||((null!==(t=Kr)&&void 0!==t?t:Kr="u">typeof window&&!A(window.crypto)&&crypto.getRandomValues?t=>{try{return crypto.getRandomValues(t)}catch(i){return Gr(t)}}:Gr)(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let Yr;const Zr=()=>Xr().toString(),Xr=()=>(Yr||(Yr=new Vr)).generate();let Qr="";const to=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let io=null;const eo={Ot(){if(!M(io))return io;if(io=!1,s)try{const t=`__ph_cookie_support_${Zr()}`;eo.$t(t,"xyz"),io='"xyz"'===qr(t),eo.Dt(t)}catch(t){io=!1}return io},Pt(t){Ls.error("cookieStore error: "+t)},Lt:qr,Ft(t){let i;try{i=JSON.parse(eo.Lt(t))||{}}catch(t){}return i},$t(t,i,e,n,r){if(!s)return!1;try{let o="",l="";const a=function(t,i){if(i){let i=function(t,i=s){if(Qr)return Qr;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";const e=t.split(".");let n=Math.min(e.length,8);const r="dmn_chk_"+Zr();for(;!Qr&&n--;){const t=e.slice(n).join("."),s=r+"=1;domain=."+t+";path=/";i.cookie=s+";max-age=3",i.cookie.includes(r)&&(i.cookie=s+";max-age=0",Qr=t)}return Qr}(t);if(!i){const e=(t=>{const i=t.match(to);return i?i[0]:""})(t);e!==i&&Ls.info("Warning: cookie subdomain discovery mismatch",e,i),i=e}return i?"; domain=."+i:""}return""}(s.location.hostname,n);if(e){const t=new Date;t.setTime(t.getTime()+864e5*e),o="; expires="+t.toUTCString()}r&&(l="; secure");const u=t+"="+encodeURIComponent(JSON.stringify(i))+o+"; SameSite=Lax; path=/"+a+l;return u.length>3686.4&&Ls.warn("cookieStore warning: large cookie, len="+u.length),s.cookie=u,!0}catch(t){return!1}},Dt(t,i){if((null==s?void 0:s.cookie)&&(!i||!M(qr(t))))try{eo.$t(t,"",-1,i)}catch(t){return}}};let so=null;const no={Ot(){if(!M(so))return so;let i=!0;if(A(t))i=!1;else try{const t="__mplssupport__";no.$t(t,"xyz"),'"xyz"'!==no.Lt(t)&&(i=!1),no.Dt(t)}catch(t){i=!1}return i||Ls.error("localStorage unsupported; falling back to cookie store"),so=i,i},Pt(t){Ls.error("localStorage error: "+t)},Lt(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){no.Pt(t)}return null},Ft(t){try{return JSON.parse(no.Lt(t))||{}}catch(t){}return null},$t(i,e){try{return null==t||t.localStorage.setItem(i,JSON.stringify(e)),!0}catch(t){no.Pt(t)}return!1},Dt(i){try{null==t||t.localStorage.removeItem(i)}catch(t){no.Pt(t)}}},ro=[en,Gs,Qs,Ks,rn,Zs,Ys,Js,sn],oo=[mn,_n,Hn,qn,hr,ur,xn,nr],lo=t=>t+"_cpm",ao=["__proto__","constructor","prototype"],uo=t=>{if(!P(t))return{};const i={};return Object.keys(t).forEach(e=>{-1===ao.indexOf(e)&&(i[e]=t[e])}),i},ho=(t,i=[])=>{const e={};return[...oo,...i].forEach(i=>{const s=t[i];A(s)||M(s)||""===s||(e[i]=s)}),e},co=t=>{let i=5381,e=2166136261;for(let s=0;t.length>s;s++){const n=t.charCodeAt(s);i=33*i^n,e=Math.imul(e^n,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},vo=(t,i)=>({p:i,f:co(JSON.stringify(t))}),fo=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{const e=eo.Ft(lo(t)),s=(null==e?void 0:e.f)===co(i)&&E(e.p);return{properties:s?e.p:[],isValid:s}}catch(t){return{properties:[],isValid:!1}}},po=(t,i)=>i+"|"+(eo.Lt(lo(t))||""),go={},_o={Ot:()=>!0,Pt(t){Ls.error("memoryStorage error: "+t)},Lt:t=>t in go?go[t]:null,Ft:t=>t in go?go[t]:null,$t:(t,i)=>(go[t]=i,!0),Dt(t){delete go[t]}};let mo=null;const yo={Ot(){if(!M(mo))return mo;if(mo=!0,A(t))mo=!1;else try{const t="__support__";yo.$t(t,"xyz"),'"xyz"'!==yo.Lt(t)&&(mo=!1),yo.Dt(t)}catch(t){mo=!1}return mo},Pt(t){Ls.error("sessionStorage error: ",t)},Lt(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){yo.Pt(t)}return null},Ft(t){try{return JSON.parse(yo.Lt(t))||null}catch(t){}return null},$t(i,e){try{return null==t||t.sessionStorage.setItem(i,JSON.stringify(e)),!0}catch(t){yo.Pt(t)}return!1},Dt(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){yo.Pt(t)}}};var bo=class{constructor(t){this._instance=t}get Fr(){return this._instance.config}get consent(){return this.Ml()?0:this.El}isOptedOut(){return"always"===this.Fr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Fr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Fr.opt_out_capturing_by_default}optInOut(t){this.Al.$t(this.Rl,t?1:0,this.Fr.cookie_expiration,this.Fr.cross_subdomain_cookie,this.Fr.secure_cookie)}reset(){this.Al.Dt(this.Rl,this.Fr.cross_subdomain_cookie)}get Rl(){const{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get El(){const t=this.Al.Lt(this.Rl);return V(t)?1:m(G,t)?0:-1}get Al(){const t=this.Fr.opt_out_capturing_persistence_type,i="localStorage"===t?no:eo,e=i.Ot()?i:_o;if(!this.Pl||this.Pl!==e){this.Pl=e;const i="localStorage"===t?eo:no;i.Lt(this.Rl)&&(this.Pl.Lt(this.Rl)||this.optInOut(V(i.Lt(this.Rl))),i.Dt(this.Rl,this.Fr.cross_subdomain_cookie))}return this.Pl}Ml(){return!!this.Fr.respect_dnt&&[null==e?void 0:e.doNotTrack,null==e?void 0:e.msDoNotTrack,c.doNotTrack,null==e?void 0:e.globalPrivacyControl].some(t=>V(t))}};function wo(t,i){var e;const s=null==t||null===(e=t.config)||void 0===e?void 0:e.get_current_url;if(!T(s))return i;try{const t=s(i);return F(t)&&t?t:i}catch(t){return Ls.error("Error in get_current_url, falling back to window.location.href",t),i}}function $o(t){var i;return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!!(null===(i=t.closest)||void 0===i?void 0:i.call(t,".toolbar-global-fade-container")))}function xo(t){return!!t&&1===t.nodeType}function So(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function ko(t){return!!t&&3===t.nodeType}function Eo(t){return!!t&&11===t.nodeType&&xo(t.host)}function To(t){return t?y(t).split(/\s+/):[]}function Po(t,i){const e=function(t){var i;const e=typeof window>"u"?void 0:window,s=null==e||null===(i=e.location)||void 0===i?void 0:i.href;return A(s)?void 0:wo(t,s)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function Co(t){let i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return To(i)}function Ao(t){return R(t)?null:y(t).split(/(\s+)/).filter(t=>ol(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Fo(t){let i="";return Zo(t)&&!Xo(t)&&t.childNodes&&t.childNodes.length&&Rr(t.childNodes,function(t){var e;ko(t)&&t.textContent&&(i+=null!==(e=Ao(t.textContent))&&void 0!==e?e:"")}),y(i)}function Oo(t){var i;return A(t.target)?t.srcElement||null:(null===(i=t.target)||void 0===i?void 0:i.shadowRoot)?t.composedPath()[0]||null:t.target||null}const Mo=["a","button","form","input","select","textarea","label"];function Ro(t,i){const e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}function Io(t,i){if(A(i))return!0;for(const e of t)if(i.some(t=>Ro(e,t)))return!0;return!1}function Do(t){const i=t.parentNode;return!(!i||!xo(i))&&i}const jo=[".ph-no-autocapture","[data-ph-no-autocapture]"],Lo=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],No=(()=>[...Lo,"+","-","−","–"])(),zo=(()=>No.length+10)(),Bo=["button","a","input","select","textarea","label"],Uo=["button","link","tab","menuitem","option"],Ho=(t,i)=>/[a-z0-9]/i.test(i)?m(No,i)?new RegExp(`\\b${i}\\b`).test(t):t.includes(i):t===i,qo=t=>m(Bo,t.tagName.toLowerCase())||m(Uo,(t.getAttribute("role")||"").toLowerCase());function Wo(t){let i="",e="";const s=t=>{xo(t)&&Zo(t)&&!Xo(t)&&(i+=` ${Fo(t)}`,e=e||t.getAttribute("aria-label")||"",Rr(t.childNodes,s))};s(t),i=y(i.replace(/\s+/g," "));const n=(ol(i)?i:"").toLowerCase(),r=t.getAttribute("aria-label")||(n?"":e);return{safeText:n,ariaLabel:y(r).toLowerCase()}}const Vo=[".ph-no-rageclick",".ph-no-capture"],Go=["","text","search","email","password","url","tel","number"];function Ko(t,i){if(!(typeof window>"u"?void 0:window)||Jo(t))return!1;let e,s,n;var r,o;if(j(i)?(e=!!i&&Vo,s=void 0,n=!1):(e=null!==(r=null==i?void 0:i.css_selector_ignorelist)&&void 0!==r?r:Vo,s=null==i?void 0:i.content_ignorelist,n=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(n&&function(t){return!(!t||!xo(t))&&(!!So(t,"textarea")||(So(t,"input")?m(Go,(t.getAttribute("type")||"").toLowerCase()):function(t){var i;if(t.isContentEditable)return!0;const e=null===(i=t.getAttribute)||void 0===i?void 0:i.call(t,"contenteditable");return"true"===e||""===e}(t)))}(t))return!1;const{targetElementList:l}=Yo(t,!1);return!(s&&function(t,{safeText:i,ariaLabel:e}){let s;if(!0===t)s=Lo;else{if(!E(t))return!1;if(t.length>zo)return Ls.error(`[PostHog] content_ignorelist array cannot exceed ${zo} items. Use css_selector_ignorelist for more complex matching.`),!1;s=t.map(t=>t.toLowerCase())}return s.some(t=>Ho(i,t)||Ho(e,t))}(s,function(t,i){for(const t of i)if(qo(t))return Wo(t);for(const t of i){try{var e;if("pointer"!==(null===(e=window)||void 0===e?void 0:e.getComputedStyle(t).getPropertyValue("cursor")))break}catch(t){break}const i=Wo(t);if(i.safeText||i.ariaLabel)return i}return Wo(t)}(t,l))||Io(l,e))}const Jo=t=>!t||So(t,"html")||!xo(t),Yo=(t,i)=>{const e=typeof window>"u"?void 0:window;if(!e||Jo(t))return{parentIsUsefulElement:!1,targetElementList:[]};let s=!1;const n=[t];let r=t;for(;r.parentNode&&!So(r,"body");){if(Eo(r.parentNode)){n.push(r.parentNode.host),r=r.parentNode.host;continue}const t=Do(r);if(!t)break;if(i||Mo.indexOf(t.tagName.toLowerCase())>-1)s=!0;else try{const i=e.getComputedStyle(t);i&&"pointer"===i.getPropertyValue("cursor")&&(s=!0)}catch(t){}n.push(t),r=t}return{parentIsUsefulElement:s,targetElementList:n}};function Zo(t){const i=new Set;let e=0;for(let s=t;s.parentNode&&!So(s,"body");s=s.parentNode){if(e++>=1e3||i.has(s))return!1;i.add(s);const t=Co(s);if(m(t,"ph-sensitive")||m(t,"ph-no-capture"))return!1}if(m(Co(t),"ph-include"))return!0;const s=t.type||"";if(F(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const n=t.name||t.id||"";return!F(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function Xo(t){return!!(So(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||So(t,"select")||So(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Qo=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}))$"),tl=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,il=[16,15,14,13],el=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),sl=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),nl=/[0-9A-Za-z_]/;function rl(t){let i=0,e=!1;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e}return i%10==0}function ol(t,i=!0){if(R(t))return!1;if(F(t)){if(t=y(t),i?Qo.test((t||"").replace(/[- ]/g,"")):function(t){let i;for(tl.lastIndex=0;i=tl.exec(t);){const t=i[2];if(!t)continue;const e=t.replace(/[- ]/g,"");for(let t=0;e.length>t;t++)for(const i of il){const s=t+i;if(e.length>=s){const i=e.slice(t,s);if(Qo.test(i)&&rl(i))return!0}}}return!1}(t))return!1;if(i?el.test(t):function(t){let i;for(sl.lastIndex=0;i=sl.exec(t);){const t=i[1],e=i[3];if(!(t&&e&&nl.test(t)&&nl.test(e)))return!0}return!1}(t))return!1}return!0}function ll(t){let i=Fo(t);return i=`${i} ${al(t)}`.trim(),ol(i)?i:""}function al(t){let i="";return t&&t.childNodes&&t.childNodes.length&&Rr(t.childNodes,function(t){var e;if(t&&"span"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase()))try{const e=Fo(t);i=`${i} ${e}`.trim(),t.childNodes&&t.childNodes.length&&(i=`${i} ${al(t)}`.trim())}catch(t){Ls.error("[AutoCapture]",t)}}),i}function ul(t){return t.replace(/"|\\"/g,'\\"')}function hl(t){const i=t.attr__class;if(i)return E(i)?i:To(i)}const cl=Ns("[Dead Clicks]"),dl=()=>!0,vl=t=>{var i;const e=!!(null===(i=t.instance.persistence)||void 0===i?void 0:i.get_property(On)),s=t.instance.config.capture_dead_clicks;return j(s)?s:!!P(s)||e};var fl=class{get lazyLoadedDeadClicksAutocapture(){return this.Ol}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[On]:i.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Fl(()=>{this.Dl()}):this.stop()}Fl(t){var i,e,s;(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.initDeadClicksAutocapture)?t():null===(e=c.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this.instance,"dead-clicks-autocapture",i=>{i?cl.error("failed to load script",i):t()})}Dl(){var t;if(s){if(!this.Ol&&(null===(t=c.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=P(this.instance.config.capture_dead_clicks)?bi({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Ol=c.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Ol.start(s),cl.info("starting...")}}else cl.error("`document` not found. Cannot start.")}stop(){this.Ol&&(this.Ol.stop(),this.Ol=void 0,cl.info("stopping..."))}};const pl=Ns("[SegmentIntegration]");function gl(t,i,e=!0){const s=t.config.segment;if(!s)return i();const{analytics:n,filterProperties:r}=(t=>T(t.register))(o=s)?{analytics:o}:o;var o;!function(t,i,e,s){const n=i=>{const n=()=>i.anonymousId()||Zr();t.config.get_device_id=n,s&&i.id()&&(t.register({distinct_id:i.id(),$device_id:n()}),t.persistence.set_property(nr,Er)),e(s?void 0:i.anonymousId()||void 0)},r=i.user();"then"in r&&T(r.then)?r.then(n):n(r)}(t,n,e=>{n.register(((t,i,{filterProperties:e}={})=>{"undefined"!=typeof Promise&&Promise.resolve||pl.warn("This browser does not have Promise support, and can not use the segment integration");const s=(s,n)=>{if(!n)return s;const r=!!i&&s.event.anonymousId===i&&!s.event.userId;r||s.event.userId||s.event.anonymousId===t.get_distinct_id()||(pl.info("No userId set, resetting PostHog"),t.reset()),r||(i=void 0),s.event.userId&&s.event.userId!==t.get_distinct_id()&&(pl.info("UserId set, identifying with PostHog"),t.identify(s.event.userId));let o=t.calculateEventProperties(n,s.event.properties);if(!R(e)){const t=s.event.properties||{},i={};for(const e of Object.keys(o))S.call(t,e)||(i[e]=o[e]);const n=((t,i)=>{const e=E(t)?t:[t];let s=bi({},i);for(const t of e)try{if(s=t(s),R(s))return null}catch(t){return pl.error("Error in Segment filterProperties:",t),null}return s})(e,i);if(R(n))return s;o=n}return s.event.properties=Object.assign({},o,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return s(t,t.event.event)},page(t){return s(t,Cr)},identify(t){return s(t,Fr)},screen(t){return s(t,"$screen")}}})(t,e,{filterProperties:r})).then(()=>{i()},t=>{pl.error("Failed to register the Segment integration",t),i()})},e)}const _l="posthog-js";function ml(t,{organization:i,projectId:e,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,h,c;if("*"!==n&&!n.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(l=o.exception)||void 0===l?void 0:l.values)||[],f=v.map(t=>bi(bi({},t),{},{stacktrace:t.stacktrace?bi(bi({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>bi(bi({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(a=v[0])||void 0===a?void 0:a.value)||o.message,$exception_type:null===(u=v[0])||void 0===u?void 0:u.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(h=v[0])||void 0===h?void 0:h.value)||o.message,$sentry_exception_type:null===(c=v[0])||void 0===c?void 0:c.type,$sentry_tags:o.tags};var g;return i&&e&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+e+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var yl=class{constructor(t,i,e,s,n,r){this.name=_l,this.setupOnce=function(o){o(ml(t,{organization:i,projectId:e,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}))}}},bl=class{constructor(t){this.Ll=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Ls.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Nl=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.jl()}jl(){var t;this.ql=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.Ll)}destroy(){var t;null===(t=this.ql)||void 0===t||t.call(this),this.ql=void 0}doPageView(i,e){var s;const n=this.Bl(i,e);return this.Nl={pathname:null!==(s=null==t?void 0:t.location.pathname)&&void 0!==s?s:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),n}doPageLeave(t){var i;return this.Bl(t,null===(i=this.Nl)||void 0===i?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Nl)||void 0===t?void 0:t.pageViewId}}Bl(t,i){const e=this.Nl;if(!e)return{$pageview_id:i};let s={$pageview_id:i,$prev_pageview_id:e.pageViewId};const n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:i,maxScrollY:e,maxContentHeight:r,lastContentY:o,maxContentY:l}=n;if(!(A(t)||A(i)||A(e)||A(r)||A(o)||A(l))){t=Math.ceil(t),i=Math.ceil(i),e=Math.ceil(e),r=Math.ceil(r),o=Math.ceil(o),l=Math.ceil(l);const n=t>1?Q(i/t,0,1,Ls):1,a=t>1?Q(e/t,0,1,Ls):1,u=r>1?Q(o/r,0,1,Ls):1,h=r>1?Q(l/r,0,1,Ls):1;s=Ir(s,{$prev_pageview_last_scroll:i,$prev_pageview_last_scroll_percentage:n,$prev_pageview_max_scroll:e,$prev_pageview_max_scroll_percentage:a,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:l,$prev_pageview_max_content_percentage:h})}}return e.pathname&&(s.$prev_pageview_pathname=e.pathname),e.timestamp&&(s.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),s}};const wl=["flags","surveys"],$l={[gn]:{exposure:"hidden"},[bn]:{exposure:"hidden"},[wn]:{exposure:"hidden"},[En]:{exposure:"hidden"},[xn]:{exposure:"hidden"},[kn]:{exposure:"hidden"},[un]:{exposure:"event"},[Tn]:{exposure:"hidden"},[Rn]:{exposure:"hidden"},[Pn]:{exposure:"event"},[Cn]:{exposure:"hidden"},[An]:{exposure:"event"},[Fn]:{exposure:"event"},[On]:{exposure:"event"},[Mn]:{exposure:"hidden"},[In]:{exposure:"event"},[Dn]:{exposure:"hidden"},[jn]:{exposure:"hidden"},[Hn]:{exposure:"hidden"},[qn]:{exposure:"event"},[Ln]:{exposure:"event",shouldSkipFromEventProperties:t=>M(t)},[Wn]:{exposure:"event"},[Vn]:{exposure:"event"},[Gn]:{exposure:"event"},[Kn]:{exposure:"event"},[Jn]:{exposure:"hidden"},[Qs]:{exposure:"hidden",storageGroup:"flags"},[Gs]:{exposure:"hidden",storageGroup:"flags"},[Vs]:{exposure:"hidden"},[Ks]:{exposure:"hidden",storageGroup:"flags"},[rn]:{exposure:"hidden",storageGroup:"flags"},[Zs]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Xs]:{exposure:"hidden",storageGroup:"flags"},[on]:{exposure:"hidden"},[ln]:{exposure:"hidden"},[en]:{exposure:"hidden"},[tn]:{exposure:"hidden"},[hn]:{exposure:"hidden",storageGroup:"surveys"},[cn]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[vn]:{exposure:"event"},[fn]:{exposure:"hidden"},[pn]:{exposure:"hidden"},[Zn]:{exposure:"hidden"},[Xn]:{exposure:"hidden"},[Qn]:{exposure:"hidden"},[tr]:{exposure:"event"},[ir]:{exposure:"event"},[er]:{exposure:"event"},[sr]:{exposure:"event"},[sn]:{exposure:"hidden"},[nn]:{exposure:"hidden"},[Yn]:{exposure:"event"},[Js]:{exposure:"hidden"},[Ys]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[nr]:{exposure:"hidden"},[rr]:{exposure:"hidden"},[or]:{exposure:"hidden"},[lr]:{exposure:"hidden"},[ar]:{exposure:"hidden"},[ur]:{exposure:"hidden"},[hr]:{exposure:"hidden"},[Nn]:{exposure:"event"},[zn]:{exposure:"event"},[Bn]:{exposure:"event"},[Un]:{exposure:"event"},[vr]:{exposure:"event"},[fr]:{exposure:"event"},[pr]:{exposure:"hidden"},[gr]:{exposure:"hidden"},[_r]:{exposure:"hidden"},[mr]:{exposure:"hidden"},[yr]:{exposure:"hidden"},[br]:{exposure:"hidden"},[wr]:{exposure:"hidden"},[$r]:{exposure:"hidden"},[xr]:{exposure:"hidden"},[Sr]:{exposure:"event"}},xl=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Sl=t=>{const i=$l[t];if(i)return i;for(const[i,e]of xl)if(0===t.indexOf(i))return e};function kl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}const El=t=>{const i=typeof document>"u"?void 0:document,e=null==i?void 0:i.createElement("a");return A(e)?null:(e.href=t,e)},Tl=()=>{try{return"u">typeof window&&!1!==window.navigator.onLine}catch(t){return!1}},Pl=(t,i)=>t>=i&&Tl(),Cl=(t,i,e,s)=>{if(0===t){if(Tl()){const t=i+1;return t===e&&s(),t}return i}return 0},Al=(t,i)=>{try{let e;return JSON.stringify(t,(t,i)=>{var s;return U(i)?(null!==(s=e)&&void 0!==s||(e=new WeakMap),e.has(i)||e.set(i,Nr(i)),e.get(i)):"bigint"==typeof i?i.toString():i},i)}catch(i){return w(t)}},Fl=function(t,i){const e=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let t=0;e.length>t;t++){const n=e[t].split(/=(.*)/);if(n[0]===i){s=n;break}}if(!E(s)||2>s.length)return"";{let t=s[1].replace(/\+/g," ");try{t=decodeURIComponent(t)}catch(i){Ls.error("Skipping decoding for malformed query param: "+t)}return t}},Ol=function(t,i,e){if(!t||!i||!i.length)return t;const s=t.split(/#(.*)/),n=s[1],r=(s[0]||"").split(/\?(.*)/),o=r[1],l=r[0],a=(o||"").split("&"),u=[];for(let t=0;a.length>t;t++){const s=a[t].split("?");let n=0;for(;s.length>n&&!i.includes(s[n].split("=")[0]);)n++;u.push(s.length>n?s.slice(0,n).concat(s[n].split("=")[0]+"="+e).join("?"):a[t])}let h=l;return null!=o&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},Ml=function(t,i){const e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Rl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],Il=(()=>["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Rl])(),Dl="<masked>",jl=["li_fat_id"];function Ll(t,i,e){if(!s)return{};const n=i?[...Rl,...e||[]]:[],r=Nl(Ol(s.URL,n,Dl),t),o=function(){const t={};return Rr(jl,function(i){const e=qr(i);t[i]=e||null}),t}();return Ir(o,r)}function Nl(t,i){const e=Il.concat(i||[]),s={};return Rr(e,function(i){const e=Fl(t,i);s[i]=e||null}),s}function zl(t){const i=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",n={};if(!M(i)){n.$search_engine=i;const t=s?Fl(s.referrer,e):"";t.length&&(n.ph_keyword=t)}return n}function Bl(){return navigator.language||navigator.userLanguage}function Ul(){const t=Bl();return"string"==typeof t?t.split("-")[0]:void 0}const Hl="$direct";function ql(){return(null==s?void 0:s.referrer)||Hl}function Wl(t,i,e=!1){const s=t?[...Rl,...i||[]]:[],r=e?di(null==n?void 0:n.href):null==n?void 0:n.href,o=null==r?void 0:r.substring(0,1e3);return{r:ql().substring(0,1e3),u:o?Ol(o,s,Dl):void 0}}function Vl(t,i=!1){var e;const{r:s,u:n}=t,r=i?di(n):n,o={$referrer:s,$referring_domain:null==s?void 0:s==Hl?Hl:null===(e=El(s))||void 0===e?void 0:e.host};if(r){o.$current_url=r;const t=El(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const i=Nl(r);Ir(o,i)}if(s){const t=zl(s);Ir(o,t)}return o}function Gl(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Kl={flags:Ys,surveys:cn},Jl=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Yl=t=>`${t}_cookie_identity_change_pending`,Zl=t=>{let i="",e=0;for(const s of t){const t=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(e+t>1e3)break;i+=s,e+=t}return i},Xl="main",Ql=[Qs,Gs,Ks,rn,Zs,Ys,Xs,en],ta=t=>-1!==Ql.indexOf(t),ia=[xn,kn],ea=t=>-1!==ia.indexOf(t),sa=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},na=t=>{if(!t)return{};const i=JSON.parse(t);return P(i)?i:{}},ra=(t,i)=>{Rr(t,(e,s)=>{const n=Sl(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(i,s)||delete t[s]})};var oa=class{constructor(i,e,s=!0,n=!i.cookieless_mode){if(this.zl={},this.Hl=!1,this.Ul=!1,this.Wl=!1,this.Vl=!1,this.Gl=!1,this.Ql=new Map,this.Jl=!1,this.Zl=!1,this.Kl=!1,this.Yl=new Set,this.Xl=new Set,this.Fr=i,this.tu=s,this.props={},this.eu=void 0,this.iu=(t=>{let i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(i),this.fi=i.disable_persistence||!!e,this.Al=this.nu(i),this.Wl=this.su(i),this.load(n),this.ru(),i.debug&&Ls.info("Persistence loaded",i.persistence,bi({},this.props)),this.update_config(i,i,e),this.save(),t){const i=()=>this.flush();Ur(t,"beforeunload",i,{capture:!1}),Ur(t,"pagehide",i,{capture:!1}),this.ou=i=>{if(this.Hl&&(!i.storageArea||i.storageArea===(null==t?void 0:t.localStorage))&&i.key)if(i.key!==this.iu){if(this.Wl){const t=wl.find(t=>i.key===this.au(t));t&&this.lu(i.key,t)}}else this.lu(i.key,Xl)},Ur(t,"storage",this.ou)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,i])=>{const e=this.Ql.get(t);if(!ta(t)||!0===e)return;if(!0===i)return void this.uu(t,!0);const s=new Set(e||[]);i.forEach(t=>s.add(t)),s.size&&this.uu(t,s)})}onCrossTabFeatureFlagChange(t){return this.Xl.add(t),()=>this.Xl.delete(t)}destroy(){this.ou&&t&&(t.removeEventListener("storage",this.ou),this.ou=void 0),this.Xl.clear()}lu(t,i,e=!0){if(this.fi)return!1;let s,n;try{if(n=no.Lt(t),M(n)){const t=this.cu(i);return t.storageValue=null,i!==Xl&&(t.persisted=!1),!1}s=na(n)}catch(t){return!1}const r=i===Xl?s:no.Ft(this.iu);if(r&&this.hu(r))return!1;const o=this.du(s,i,e);return i===Xl&&this.Wl&&!sa(this.vu().main,s)||this.fu(s,i,!0,n),o}hu(t){const i=this.props[_n],e=t[_n];return!A(i)&&!A(e)&&i!==e}fu(t,i,e,s){const n=this.cu(i);n.storageValue=s,i!==Xl&&(n.persisted=e);try{n.fingerprint=this.pu(t,i)}catch(t){n.fingerprint=void 0}}du(t,i,e){let s=!1;return Ql.forEach(e=>{var n;const r=null===(n=Sl(e))||void 0===n?void 0:n.storageGroup;if(i===Xl&&this.Wl&&r||i!==Xl&&r!==i)return;const o=e in t,l=this.gu(e,o?t[e]:void 0),a=this.Ql.has(e)?e in this.props:o;a===e in this.props&&sa(l,this.props[e])||(a?this.mu(e,l,!1):this.yu(e,!1),s=!0)}),s&&e&&this.Xl.forEach(t=>t()),s}bu(){if(!this.Hl)return!1;try{this.Kl=!1;const t=no.Lt(this.iu),i=this.cu(Xl);let e,s=!1,n=!1;if(t!==i.storageValue)if(M(t))i.storageValue=null;else{if(e=na(t),this.Kl=!this.Zl&&this.hu(e),this.Kl)return!1;n=this.du(e,Xl,!1),!this.Wl||sa(this.vu().main,e)?this.fu(e,Xl,!0,t):i.storageValue=t,s=!0}return this.Wl&&wl.forEach(t=>{const i=no.Lt(this.au(t)),r=this.cu(t),o=e||{},l=s&&Ql.some(i=>{var e;return(null===(e=Sl(i))||void 0===e?void 0:e.storageGroup)===t&&i in o});if(i===r.storageValue&&!l)return;if(M(i))return r.storageValue=null,r.persisted=!1,void(l&&(n=this.du(o,t,!1)||n));const a=na(i);n=this.du(a,t,!1)||n,this.fu(a,t,!0,i)}),n}catch(t){return!1}}uu(t,i){this.Ql.set(t,i);const e=Sl(t);(null==e?void 0:e.volatile)||(this.cu((this.Wl?null==e?void 0:e.storageGroup:void 0)||Xl).fingerprint=void 0,this._u(t))}wu(){Ql.forEach(t=>this.Ql.set(t,!0))}ru(){if(this.Hl)try{const t=no.Lt(this.iu),i=na(t);this.cu(Xl).storageValue=t,Ql.forEach(t=>{var e;const s=this.Wl?null===(e=Sl(t))||void 0===e?void 0:e.storageGroup:void 0,n=s?no.Lt(this.au(s)):null;if(s){const t=this.cu(s);t.storageValue=n,t.persisted=!M(n)}const r=s&&!M(n)?na(n):i;t in this.props?this.ku(t,r[t],this.props[t]):t in r&&this.uu(t,!0)})}catch(t){}}gu(t,i){const e=this.Ql.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){const s=new Set(E(i)?i:[]),n=new Set(E(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}const s=P(i)?bi({},i):{},n=P(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in n?s[t]=n[t]:delete s[t]}),s}ku(t,i,e){if(!ta(t))return;const s=this.Ql.get(t);if(!0===s)return;let n=i;if(this.Hl)try{var r;const i=this.Wl?null===(r=Sl(t))||void 0===r?void 0:r.storageGroup:void 0,e=i?this.au(i):this.iu;n=na(no.Lt(e))[t]}catch(t){}const o=new Set(s||[]);if("$active_feature_flags"===t){if(!A(i)&&!E(i)||!A(n)&&!E(n)||!E(e))return void this.uu(t,!0);const s=new Set(i||[]),r=new Set(n||[]),l=new Set(e);new Set([...s,...l]).forEach(t=>{s.has(t)!==l.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===l.has(t)&&o.delete(t)})}else{if(!P(e))return void(sa(n,e)?this.Ql.delete(t):this.uu(t,!0));{if(!A(i)&&!P(i)||A(i)&&C(e)&&A(n))return void this.uu(t,!0);const s=P(i)?i:{},r=P(n)?n:{};new Set([...Object.keys(s),...Object.keys(e)]).forEach(t=>{t in s==t in e&&sa(s[t],e[t])||o.add(t)}),o.forEach(t=>{t in r==t in e&&sa(r[t],e[t])&&o.delete(t)})}}o.size?this.uu(t,o):this.Ql.delete(t)}Su(){var t;const i=null===(t=this.Fr)||void 0===t?void 0:t.persistence_save_debounce_ms;return I(i)&&i>0?i:0}xu(t){if(this.Fr.cookieWinsOnConflict&&"localstorage+cookie"===this.Fr.persistence.toLowerCase())if(t)try{const i=ho(t,this.Fr.cookie_persisted_properties||[]),e=vo(i,this.Fr.cookie_persisted_properties||[]),s=JSON.stringify(i)+"|"+JSON.stringify(e),n=eo.Lt(this.iu)||void 0;n&&po(this.iu,n)===s&&(this.$u=s,this.Cu=n)}catch(t){}else try{const t=eo.Lt(this.iu)||void 0;this.$u=t?po(this.iu,t):void 0,this.Cu=t}catch(t){}}syncCookieProperties(){return this.Tu(this.Fr)}Tu(t,i=!1){if(this.fi&&!i||this.Gl||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let e;try{e=eo.Lt(this.iu)||void 0}catch(t){}if(!e||e===this.Cu)return!1;const s=po(this.iu,e);let n;try{n=uo(JSON.parse(e))}catch(t){return!1}if((eo.Lt(this.iu)||void 0)!==e)return!1;this.$u=s,this.Cu=e;const r=fo(this.iu,e),o=[...oo,...r.properties],l={};if(Object.keys(n).forEach(t=>{const i=n[t];(A(i)||M(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(l[t]=!0,delete n[t])}),C(n))return!1;const a="distinct_id"in n||"anonymous"===n.$user_state||"identified"===n.$user_state,u=this.props,h=u[_n],c=u[nr],d=Ir({},u);[...oo,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in n)&&!l[t]&&(a||"distinct_id"!==t&&"$user_state"!==t)){const i=d[t];(r.isValid||-1===oo.indexOf(t)||!1!==i&&0!==i)&&delete d[t]}}),this.props=Ir(d,n),Ql.forEach(t=>{const i=t in this.props;t in u===i&&sa(u[t],this.props[t])||(i?this.ku(t,u[t],this.props[t]):this.uu(t,!0))}),!a||"$user_state"in n||"$user_state"in this.props||this.mu(nr,kr);const v=this.props[_n],f=this.props[nr];return!a||v===h&&f===c||(this.Zl=!0,this.Vl=!0,yo.$t(Yl(this.iu),!0),this.yu(en),this.yu(Gs),this.yu(Qs),this.yu(Ks),this.yu(rn),this.yu(Zs),this.yu(Ys),this.yu(Js),this.yu(sn),"anonymous"!==f||"identified"!==c&&"anonymous"!==n.$user_state&&(A(h)||v===h)||(ra(this.props,n),this.yu(tn)),"identified"===f?this.props.$user_id=v:delete this.props.$user_id,this.yu(bn)),!0}consumeCookieIdentityChange(){const t=Yl(this.iu),i=this.Vl||!!yo.Lt(t);return this.Vl=!1,i&&yo.Dt(t),i}Iu(t=!1){return!(this.Gl||this.fi&&!t||!this.Fr.cookieWinsOnConflict||"localstorage+cookie"!==this.Fr.persistence.toLowerCase()||(this.Gl=!0,0))}Mu(){this.Gl&&(A(this.Eu)||(clearTimeout(this.Eu),this.Eu=void 0),delete this.zl[Xl],this.Au(!0))}Ru(t=!0){if(this.Gl)try{t?this.Mu():A(this.Eu)||(clearTimeout(this.Eu),this.Eu=void 0)}finally{this.Gl=!1}}isDisabled(){return!!this.fi}nu(i){-1===Jl.indexOf(i.persistence.toLowerCase())&&(Ls.critical("Unknown persistence type "+i.persistence+"; falling back to localStorage+cookie"),i.persistence="localStorage+cookie");const e=((i=[],e=!1,s=()=>!1)=>{const n=[...oo,...i];return bi(bi({},no),{},{Pu(t){return[eo.Lt(t),eo.Lt(lo(t)),no.Lt(t)].join("\0")},Ft(t){try{let r,o={};try{r=eo.Lt(t)||void 0,o=r?uo(JSON.parse(r)):{}}catch(t){}const l=JSON.parse(no.Lt(t)||"{}");let a;if(e){const e=fo(t,r),s=[...oo,...e.properties],u={};Object.keys(o).forEach(t=>{const i=o[t];M(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(u[t]=i)});const h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var i;const t=l[_n],r=null!==(i=l.$user_state)&&void 0!==i?i:kr;n.forEach(t=>{if(-1!==s.indexOf(t)&&!(t in o)&&(h||"distinct_id"!==t&&"$user_state"!==t)){const i=l[t];(e.isValid||-1===oo.indexOf(t)||!1!==i&&0!==i)&&delete l[t]}}),!h||"$user_state"in o||"$user_state"in l||(l[nr]=kr),!h||("distinct_id"in u?u[_n]:l[_n])===t&&("$user_state"in u?u[nr]:l[nr])===r||(ro.forEach(t=>delete l[t]),"identified"===u.$user_state&&"distinct_id"in u?l.$user_id=u[_n]:delete l.$user_id,"identified"!==u.$user_state&&(delete l[Yn],delete l[tn]),delete l.__alias)}a=Ir(l,u)}else a=Ir(o,l);return s()||no.$t(t,a),a}catch(t){}return null},$t(t,s,n,r,o,l){const a=no.$t(t,s,void 0,void 0,l);try{const u=ho(s,i);if(Object.keys(u).length){if(e){const e=lo(t),h=vo(u,i);if(eo.$t(e,h,n,r,o,l),eo.Lt(e)!==JSON.stringify(h)){eo.Dt(e,r);const i=ho(s);return eo.$t(t,i,n,r,o,l),a}}eo.$t(t,u,n,r,o,l)}}catch(t){no.Pt(t)}return a},Dt(i,e){try{null==t||t.localStorage.removeItem(i),eo.Dt(i,e),eo.Dt(lo(i),e)}catch(t){no.Pt(t)}}})})(i.cookie_persisted_properties||[],i.cookieWinsOnConflict,()=>!!this.fi);let s,n=!1,r=!1;const o=i.persistence.toLowerCase();return"localstorage"===o&&no.Ot()?(s=no,r=!0):"localstorage+cookie"===o&&e.Ot()?(s=e,r=!0,n=!0):"sessionstorage"===o&&yo.Ot()?s=yo:"memory"===o?s=_o:"cookie"===o&&eo.Ot()?(s=eo,n=!0):e.Ot()?(s=e,r=!0,n=!0):eo.Ot()?(s=eo,n=!0):s=_o,this.Hl=r,this.Ul=n,s}au(t){return`${this.iu}__${t}`}su(t){return this.Hl&&!!t.split_storage}properties(){const t={};return Rr(this.props,(i,e)=>{const s=Sl(e);if(!s||"event"===s.exposure){var n;if(null==s||null===(n=s.shouldSkipFromEventProperties)||void 0===n?void 0:n.call(s,i))return;t[e]=i}}),t}load(t=!1){if(this.fi&&!t)return;const i=this.Fr.cookieWinsOnConflict&&"localstorage+cookie"===this.Fr.persistence.toLowerCase(),e=i?no.Ft(this.iu):null;let s={};if(i)try{s=uo(eo.Ft(this.iu)),Rr(s,(t,i)=>{(A(t)||M(t)||""===t)&&delete s[i]})}catch(t){}const n=this.Al.Ft(this.iu);if(n&&(this.props=Ir({},n)),this.Wl&&this.Ou(),i&&n){var r,o;const t=null==e?void 0:e[_n],i=null!==(r=null==e?void 0:e.$user_state)&&void 0!==r?r:kr,l=n[_n],a=null!==(o=n.$user_state)&&void 0!==o?o:kr;if(l!==t||a!==i){this.Vl=!0,this.fi||yo.$t(Yl(this.iu),!0);const e=Ir({},this.props);ro.forEach(t=>delete e[t]),"anonymous"!==a||"identified"!==i&&"anonymous"!==s.$user_state&&(A(t)||l===t)||(ra(e,s),delete e[tn]),this.props=e;const n=new Set;ro.forEach(t=>{var i;const e=null===(i=Sl(t))||void 0===i?void 0:i.storageGroup;e&&n.add(e)}),n.forEach(t=>{if(this.fi)return;const i={};Rr(this.props,(e,s)=>{var n;(null===(n=Sl(s))||void 0===n?void 0:n.storageGroup)===t&&(i[s]=e)}),C(i)?(no.Dt(this.au(t)),this.zl[t]={}):no.$t(this.au(t),i)&&(this.zl[t]={persisted:!0,fingerprint:this.pu(i,t)})})}}yo.Lt(Yl(this.iu))&&(this.Vl=!0)}Ou(){for(const t of wl){const i=no.Ft(this.au(t));if(i&&!C(i)){const e=this.cu(t);e.persisted=!0,this.Fu(t)||(e.fingerprint=this.pu(i,t)),this.Du(t,i)||Ir(this.props,i)}}}Fu(t){return Object.keys(this.props).some(i=>{var e;return(null===(e=Sl(i))||void 0===e?void 0:e.storageGroup)===t})}Du(t,i){const e=Kl[t];if(!e)return!1;const s=i[e],n=this.props[e];return I(s)&&I(n)&&n>s}refreshKey(t){this.Lu([t])}Lu(t){if(this.fi)return;let i,e=!1;const s=()=>(e||(i=this.Al.Ft(this.iu),e=!0),i);t.forEach(t=>{var i;if(this.Yl.has(t))return;const e=this.Wl?null===(i=Sl(t))||void 0===i?void 0:i.storageGroup:void 0,n=e?no.Ft(this.au(e)):s();if(n&&t in n)this.mu(t,n[t],!1);else{if(e){const i=s();if(i&&t in i)return void this.mu(t,i[t],!1)}this.yu(t,!1)}})}refreshMetaIdentifiers(){if(this.fi)return;const t=this.Nu();(A(t)||t!==this.ju)&&(this.Lu(ia),this.qu(t))}qu(t=this.Nu()){this.ju=0===this.Yl.size?t:void 0}Nu(){const t=this.Al.Pu?this.Al.Pu(this.iu):this.Al.Lt(this.iu);return F(t)?t:void 0}save(){if(this.fi)return;const t=this.Su();t>0?A(this.Eu)&&(this.Eu=setTimeout(()=>{this.Eu=void 0,this.Au()},t)):this.Au()}flush(){A(this.Eu)||(clearTimeout(this.Eu),this.Eu=void 0,this.Au())}Au(t=!1){if(this.fi||this.Gl&&!t)return;t||(this.syncCookieProperties(),this.Fr.cookieWinsOnConflict&&"localstorage+cookie"===this.Fr.persistence.toLowerCase()||this.refreshMetaIdentifiers());const i=!t&&!this.Jl;i||(this.Kl=!1);const e=!!i&&this.bu();if(this.Kl)return void(this.Fr.debug&&Ls.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Wl)return this.Bu(),void(e&&this.Xl.forEach(t=>t()));const s=this.zu(this.Al,this.iu,this.props,Xl);"written"===s&&this.xu(this.props),"failed"!==s&&(this.Ql.clear(),this.Zl=!1,this.Yl.clear()),"written"===s&&this.qu(),e&&this.Xl.forEach(t=>t())}Bu(){const{main:t,groups:i}=this.vu(),e=this.zu(this.Al,this.iu,t,Xl);"written"===e&&this.xu(t),"failed"!==e&&(this.Zl=!1,this.Yl.clear(),Ql.forEach(t=>{var i;(null===(i=Sl(t))||void 0===i?void 0:i.storageGroup)||this.Ql.delete(t)})),"written"===e&&this.qu();for(const t of wl){var s;const e=i[t];if(C(e)&&!(null===(s=this.zl[t])||void 0===s?void 0:s.persisted)){Ql.forEach(i=>{var e;(null===(e=Sl(i))||void 0===e?void 0:e.storageGroup)===t&&this.Ql.delete(i)});continue}const n=this.zu(no,this.au(t),e,t);"failed"!==n&&Ql.forEach(i=>{const e=Sl(i);(null==e?void 0:e.storageGroup)!==t||"written"!==n&&e.volatile||this.Ql.delete(i)})}}vu(){const t={},i={flags:{},surveys:{}};return Rr(this.props,(e,s)=>{var n;const r=null===(n=Sl(s))||void 0===n?void 0:n.storageGroup;r?i[r][s]=e:t[s]=e}),{main:t,groups:i}}pu(t,i){if(i===Xl)return JSON.stringify(t)+"|"+this.Hu+"|"+this.Uu+"|"+this.Wu;const e={};return Rr(t,(t,i)=>{var s;e[i]=(null===(s=Sl(i))||void 0===s?void 0:s.volatile)?"__volatile__":t}),JSON.stringify(e)}zu(t,i,e,s){const n=this.cu(s);if(s!==Xl&&!n.dirty&&!A(n.fingerprint))return"skipped";let r;try{if(r=this.pu(e,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){r=void 0}return t.$t(i,e,this.Hu,this.Uu,this.Wu,this.Fr.debug)?(n.dirty=!1,s!==Xl&&(n.persisted=!0),A(r)||(n.fingerprint=r),this.Hl&&(n.storageValue=no.Lt(i)),"written"):(this.Fr.debug&&Ls.warn(`failed to persist storage entry "${i}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.wu(),A(this.Eu)||(clearTimeout(this.Eu),this.Eu=void 0),this.Al.Dt(this.iu,!1),this.Al.Dt(this.iu,!0),!t&&this.tu)for(const t of wl)no.Dt(this.au(t));t?delete this.zl[Xl]:this.zl={},this.$u=void 0,this.Cu=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(P(t)){this.syncCookieProperties(),A(i)&&(i="None"),this.Hu=A(e)?this.Vu:e;let s=!1;if(Rr(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.mu(e,t),s=!0)}),s)return this.save(),!0}return!1}register(t,i){if(P(t)){this.syncCookieProperties(),this.Hu=A(i)?this.Vu:i;let e=!1;if(Rr(t,(i,s)=>{t.hasOwnProperty(s)&&(this.props[s]!==i||P(i)||E(i))&&(this.mu(s,i),e=!0)}),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const i="string"==typeof t?[t]:t;let e=!1;for(const t of i)t in this.props&&(this.yu(t),e=!0);e&&this.save()}update_campaign_params(){const t=null==s?void 0:s.URL;if(t===this.eu)return;const i=Ll(this.Fr.custom_campaign_params,this.Fr.mask_personal_data_properties,this.Fr.custom_personal_data_properties),e=!C(Lr(i));return e&&this.register(i),this.eu=t,e?i:void 0}update_search_keyword(){this.register(function(){const t=null==s?void 0:s.referrer;return t?zl(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:ql(),$referring_domain:(null==s?void 0:s.referrer)&&(null===(t=El(s.referrer))||void 0===t?void 0:t.host)||Hl},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Wl(this.Fr.mask_personal_data_properties,this.Fr.custom_personal_data_properties,this.Fr.disable_capture_url_hashes);this.register_once({[ur]:this.Ul?{r:Zl(t.r),u:t.u?Zl(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Rr([ar,lr],i=>{const e=this.props[i];e&&Rr(e,function(i,e){t["$initial_"+b(e)]=i})});const i=this.props[ur];if(i){const e=function(t,i=!1){const e=Vl(t,i),s={};return Rr(e,function(t,i){s[`$initial_${b(i)}`]=t}),s}(i,this.Fr.disable_capture_url_hashes);Ir(t,e)}return t}safe_merge(t){return Rr(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){const s=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;const e=[...t].sort(),s=[...i].sort();return e.every((t,i)=>t===s[i])})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),r=s||n,o=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,a=!!this.fi&&!l;l||this.Tu(i,a),this.Fr=t,!l&&(s||n||o)&&(this.$u=void 0,this.Cu=void 0,this.Tu(bi(bi({},t),{},{cookie_persisted_properties:i.cookie_persisted_properties}),a));const u=r||o?this.nu(t):this.Al;this.Gu();const h=this.su(t),c=r||h!==this.Wl,d=!l&&(c||t.cross_subdomain_cookie!==this.Uu||t.secure_cookie!==this.Wu)&&this.Iu(a);this.Jl=c;try{if(this.Vu=this.Hu=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.Al=u,this.Wl=h,this.props=t,this.save()}else o&&(this.Al=u,l||(delete this.zl[Xl],this.Au()))}finally{this.Jl=!1,d&&this.Ru()}}Gu(){const t=this.props[ur];if(!this.Ul||!P(t)||"string"!=typeof t.r)return;const i=Zl(t.r),e="string"==typeof t.u?Zl(t.u):t.u;i===t.r&&e===t.u||this.mu(ur,bi(bi({},t),{},{r:i,u:e}))}set_disabled(t){this.fi=t,this.fi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Uu&&(this.Uu=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Wu&&(this.Wu=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){const e=this.props.__timers||{};e[t]=i,this.mu(En,e),this.save()}remove_event_timer(t){const i=this.props.__timers||{},e=i[t];return A(e)||(delete i[t],this.mu(En,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.mu(t,i),this.save()}mu(t,i,e=!0){var s;const n=this.props[t];this.props[t]=i,e&&("distinct_id"!==t&&"$user_state"!==t||n===i||(this.Zl=!0),ea(t)&&!sa(n,i)&&this.Yl.add(t),this.ku(t,n,i),(null===(s=Sl(t))||void 0===s?void 0:s.volatile)||this._u(t))}yu(t,i=!0){delete this.props[t],i&&(ta(t)&&this.uu(t,!0),ea(t)&&this.Yl.add(t),this._u(t))}_u(t){var i;const e=null===(i=Sl(t))||void 0===i?void 0:i.storageGroup;e&&(this.cu(e).dirty=!0)}cu(t){return this.zl[t]||(this.zl[t]={})}};const la="gzip-js",aa="base64",ua="events",ha="cancelEvents",ca="survey shown",da="survey dismissed",va="survey sent",fa="$survey_last_seen_date",pa="popover";function ga(t){let i=!0;return{dispose(){if(i){i=!1;const e=t();e&&T(e.then)&&e.then(void 0,()=>{})}}}}const _a=Ns("[RateLimiter]");var ma=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(t=>{_a.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void _a.warn(`could not rate limit - continuing. Error: "${null==t?void 0:t.message}"`,{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}get isClientRateLimited(){return 1>this.Qu().tokens}clientRateLimitContext(t=!1){var i;const e=this.Qu(),s=1>e.tokens;if(s||t||(e.tokens=Math.max(0,e.tokens-1)),s&&!t){const t=(I(e.dropped)?e.dropped:0)+1;e.dropped=t,!this.lastEventRateLimited&&this.Ju(t)&&(e.dropped=0)}return this.lastEventRateLimited=s,null===(i=this.instance.persistence)||void 0===i||i.set_property("$capture_rate_limit",e),{isRateLimited:s,remainingTokens:e.tokens}}Qu(){var t;const{captureEventsBurstLimit:i,captureEventsPerSecond:e}=this,s=(new Date).getTime(),n=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(or),r=n?bi({},n):{tokens:i,last:s};return r.tokens+=Math.max(0,s-r.last)/1e3*e,r.last=Math.max(r.last,s),r.tokens>i&&(r.tokens=i),r}Zu(t){const i=this.instance.config.property_denylist;return!E(i)||!i.includes(t)}Ku(){var t;if(this.Zu("$current_url")&&this.Zu("$pathname")&&(null==n?void 0:n.pathname))return`${null!==(t=n.origin)&&void 0!==t?t:""}${n.pathname}`}Ju(t){var i,e;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this.Ku(),o=this.Zu("$session_id")?null===(i=(e=this.instance).get_session_id)||void 0===i?void 0:i.call(e):void 0,l=[`${t} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${l}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}};const ya=Ns("[RemoteConfig]");var ba=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=c._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Yu(t){var i,e,s;(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.loadExternalDependency)?null===(e=c.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Xu(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:t})}load(){try{if(this.remoteConfig)return ya.info("Using preloaded remote config",this.remoteConfig),void this.tc(this.remoteConfig);if(this._instance.ec())return void ya.warn("Remote config is disabled. Falling back to local config.");this.Yu(t=>{if(!t)return ya.info("No config found after loading remote JS config. Falling back to JSON."),void this.Xu(t=>{this.tc(t.json,t)});this.tc(t)})}catch(t){ya.error("Error loading remote config",t),this.tc()}}tc(t,i){!t&&i&&(0===i.statusCode?i.error||ya.warn("Failed to fetch remote config from PostHog."):ya.error("Failed to fetch remote config from PostHog."));try{this._instance.tc(t?{ok:!0,config:t}:{ok:!1})}catch(t){ya.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null===(e=this._instance.featureFlags)||void 0===e||e.ensureFlagsLoaded()}catch(t){ya.error("Error loading feature flags",t)}}},wa=Uint8Array,$a=Uint16Array,xa=Uint32Array,Sa=new wa([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]),ka=new wa([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]),Ea=new wa([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ta=function(t,i){for(var e=new $a(31),s=0;31>s;++s)e[s]=i+=1<<t[s-1];var n=new xa(e[30]);for(s=1;30>s;++s)for(var r=e[s];e[s+1]>r;++r)n[r]=r-e[s]<<5|s;return[e,n]},Pa=Ta(Sa,2),Ca=Pa[1];Pa[0][28]=258,Ca[258]=28;for(var Aa=Ta(ka,0)[1],Fa=new $a(32768),Oa=0;32768>Oa;++Oa){var Ma=(43690&Oa)>>>1|(21845&Oa)<<1;Fa[Oa]=((65280&(Ma=(61680&(Ma=(52428&Ma)>>>2|(13107&Ma)<<2))>>>4|(3855&Ma)<<4))>>>8|(255&Ma)<<8)>>>1}var Ra=function(t,i,e){for(var s=t.length,n=0,r=new $a(i);s>n;++n)++r[t[n]-1];var o,l=new $a(i);for(n=0;i>n;++n)l[n]=l[n-1]+r[n-1]<<1;if(e){o=new $a(1<<i);var a=15-i;for(n=0;s>n;++n)if(t[n])for(var u=n<<4|t[n],h=i-t[n],c=l[t[n]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[Fa[c]>>>a]=u}else for(o=new $a(s),n=0;s>n;++n)o[n]=Fa[l[t[n]-1]++]>>>15-t[n];return o},Ia=new wa(288);for(Oa=0;144>Oa;++Oa)Ia[Oa]=8;for(Oa=144;256>Oa;++Oa)Ia[Oa]=9;for(Oa=256;280>Oa;++Oa)Ia[Oa]=7;for(Oa=280;288>Oa;++Oa)Ia[Oa]=8;var Da=new wa(32);for(Oa=0;32>Oa;++Oa)Da[Oa]=5;var ja=Ra(Ia,9,0),La=Ra(Da,5,0),Na=function(t){return(t/8|0)+(7&t&&1)},za=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var s=new(t instanceof $a?$a:t instanceof xa?xa:wa)(e-i);return s.set(t.subarray(i,e)),s},Ba=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8},Ua=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8,t[s+2]|=e>>>16},Ha=function(t,i){for(var e=[],s=0;t.length>s;++s)t[s]&&e.push({s:s,f:t[s]});var n=e.length,r=e.slice();if(!n)return[new wa(0),0];if(1==n){var o=new wa(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort(function(t,i){return t.f-i.f}),e.push({s:-1,f:25001});var l=e[0],a=e[1],u=0,h=1,c=2;for(e[0]={s:-1,f:l.f+a.f,l:l,r:a};h!=n-1;)l=e[e[c].f>e[u].f?u++:c++],a=e[u!=h&&e[c].f>e[u].f?u++:c++],e[h++]={s:-1,f:l.f+a.f,l:l,r:a};var d=r[0].s;for(s=1;n>s;++s)r[s].s>d&&(d=r[s].s);var v=new $a(d+1),f=qa(e[h-1],v,0);if(f>i){s=0;var p=0,g=f-i,_=1<<g;for(r.sort(function(t,i){return v[i.s]-v[t.s]||t.f-i.f});n>s;++s){var m=r[s].s;if(i>=v[m])break;p+=_-(1<<f-v[m]),v[m]=i}for(p>>>=g;p>0;){var y=r[s].s;i>v[y]?p-=1<<i-v[y]++-1:++s}for(;s>=0&&p;--s){var b=r[s].s;v[b]==i&&(--v[b],++p)}f=i}return[new wa(v),f]},qa=function(t,i,e){return-1==t.s?Math.max(qa(t.l,i,e+1),qa(t.r,i,e+1)):i[t.s]=e},Wa=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new $a(++i),s=0,n=t[0],r=1,o=function(t){e[s++]=t},l=1;i>=l;++l)if(t[l]==n&&l!=i)++r;else{if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=t[l]}return[e.subarray(0,s),i]},Va=function(t,i){for(var e=0,s=0;i.length>s;++s)e+=t[s]*i[s];return e},Ga=function(t,i,e){var s=e.length,n=Na(i+2);t[n]=255&s,t[n+1]=s>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var r=0;s>r;++r)t[n+r+4]=e[r];return 8*(n+4+s)},Ka=function(t,i,e,s,n,r,o,l,a,u,h){Ba(i,h++,e),++n[256];for(var c=Ha(n,15),d=c[0],v=c[1],f=Ha(r,15),p=f[0],g=f[1],_=Wa(d),m=_[0],y=_[1],b=Wa(p),w=b[0],x=b[1],S=new $a(19),k=0;m.length>k;++k)S[31&m[k]]++;for(k=0;w.length>k;++k)S[31&w[k]]++;for(var E=Ha(S,7),T=E[0],P=E[1],C=19;C>4&&!T[Ea[C-1]];--C);var A,F,O,M,R=u+5<<3,I=Va(n,Ia)+Va(r,Da)+o,D=Va(n,d)+Va(r,p)+o+14+3*C+Va(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(I>=R&&D>=R)return Ga(i,h,t.subarray(a,a+u));if(Ba(i,h,1+(I>D)),h+=2,I>D){A=Ra(d,v,0),F=d,O=Ra(p,g,0),M=p;var j=Ra(T,P,0);for(Ba(i,h,y-257),Ba(i,h+5,x-1),Ba(i,h+10,C-4),h+=14,k=0;C>k;++k)Ba(i,h+3*k,T[Ea[k]]);h+=3*C;for(var L=[m,w],N=0;2>N;++N){var z=L[N];for(k=0;z.length>k;++k)Ba(i,h,j[B=31&z[k]]),h+=T[B],B>15&&(Ba(i,h,z[k]>>>5&127),h+=z[k]>>>12)}}else A=ja,F=Ia,O=La,M=Da;for(k=0;l>k;++k)if(s[k]>255){var B;Ua(i,h,A[257+(B=s[k]>>>18&31)]),h+=F[B+257],B>7&&(Ba(i,h,s[k]>>>23&31),h+=Sa[B]);var U=31&s[k];Ua(i,h,O[U]),h+=M[U],U>3&&(Ua(i,h,s[k]>>>5&8191),h+=ka[U])}else Ua(i,h,A[s[k]]),h+=F[s[k]];return Ua(i,h,A[256]),h+F[256]},Ja=new xa([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ya=new wa(0),Za=function(){for(var t=new xa(256),i=0;256>i;++i){for(var e=i,s=9;--s;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Xa=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function Qa(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,s=0;i.length>s;++s)e=Za[255&e^i[s]]^e>>>8;t=e},d(){return 4294967295^t}}}(),s=t.length;e.p(t);var n,r,o,l,a,u,h=(l=10+((n=i).filename&&n.filename.length+1||0),a=8,function(t,i,e,s,n,r){var o=t.length,l=new wa(s+o+5*(1+Math.floor(o/7e3))+n),a=l.subarray(s,l.length-n),u=0;if(!i||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=Ga(a,u,t.subarray(h,c)):(a[h]=r,u=Ga(a,u,t.subarray(h,o)))}else{for(var d=Ja[i-1],v=d>>>13,f=8191&d,p=(1<<e)-1,g=new $a(32768),_=new $a(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new xa(25e3),x=new $a(288),S=new $a(32),k=0,E=0,T=(h=0,0),P=0,C=0;o>h;++h){var A=b(h),F=32767&h,O=_[A];if(g[F]=O,_[A]=F,h>=P){var M=o-h;if((k>7e3||T>24576)&&M>423){u=Ka(t,a,0,w,x,S,E,T,C,h-C,u),T=k=E=0,C=h;for(var R=0;286>R;++R)x[R]=0;for(R=0;30>R;++R)S[R]=0}var I=2,D=0,j=f,L=F-O&32767;if(M>2&&A==b(h-L))for(var N=Math.min(v,M)-1,z=Math.min(32767,h),B=Math.min(258,M);z>=L&&--j&&F!=O;){if(t[h+I]==t[h+I-L]){for(var U=0;B>U&&t[h+U]==t[h+U-L];++U);if(U>I){if(I=U,D=L,U>N)break;var H=Math.min(L,U-2),q=0;for(R=0;H>R;++R){var W=h-L+R+32768&32767,V=W-g[W]+32768&32767;V>q&&(q=V,O=W)}}}L+=(F=O)-(O=g[F])+32768&32767}if(D){w[T++]=268435456|Ca[I]<<18|Aa[D];var G=31&Ca[I],K=31&Aa[D];E+=Sa[G]+ka[K],++x[257+G],++S[K],P=h+I,++k}else w[T++]=t[h],++x[t[h]]}}u=Ka(t,a,r,w,x,S,E,T,C,h-C,u),r||(u=Ga(a,u,Ya))}return za(l,0,s+Na(u)+n)}(r=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+o.mem,l,a,!u)),c=h.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&Xa(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var s=0;e.length>=s;++s)t[s+10]=e.charCodeAt(s)}}(h,i),Xa(h,c-8,e.d()),Xa(h,c-4,s),h}const tu=!!o||!!r,iu=new WeakMap,eu="text/plain";let su=0,nu=!1;const ru=(t,i)=>{const[e,s]=t.split("#"),[n,r]=e.split("?");if(!r)return t;const o=r.split("&").filter(t=>t.split("=")[0]!==i).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},ou=(t,i,e=!0)=>{var s;const[n,r]=t.split("?"),o=bi({},i),l=null!==(s=null==r?void 0:r.split("&").map(t=>{var i;const[s,n]=t.split("="),r=e&&null!==(i=o[s])&&void 0!==i?i:n;return delete o[s],`${s}=${r}`}))&&void 0!==s?s:[],a=function(t,i="&"){let e,s;const n=[];return Rr(t,function(t,i){A(t)||A(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),s=encodeURIComponent(i),n[n.length]=s+"="+e)}),n.join(i)}(o);return a&&l.push(a),l.length>0?`${n}?${l.join("&")}`:n},lu=t=>{if(t.cr)return t.cr;const{data:i,compression:e}=t;if(!i)return;if(e===la){const t=Qa(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new wa(t.length+(t.length>>>1)),s=0,n=function(t){e[s++]=t},r=0;i>r;++r){if(s+5>e.length){var o=new wa(s+8+(i-r<<1));o.set(e),e=o}var l=t.charCodeAt(r);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++r))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return za(e,0,s)}(Al(i)),{mtime:0});return{contentType:eu,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(e===aa){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(Al(i)),e=(t=>"data="+encodeURIComponent("string"==typeof t?t:Al(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:e,estimatedSize:new Blob([e]).size}}const s=Al(i);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},au=t=>{const i=()=>"sendBeacon"===t.transport?{url:ou(t.url,{compression:aa}),encodedBody:lu(bi(bi({},t),{},{compression:aa,cr:void 0}))}:{url:ru(t.url,"compression"),encodedBody:lu(bi(bi({},t),{},{compression:void 0,cr:void 0}))};let e;try{e=lu(t)}catch(e){if(me(t.compression,Fl(t.url,"compression")))return Ls.error("Failed to gzip request body, sending uncompressed payload",e),i();throw e}return e&&me(t.compression,Fl(t.url,"compression"))&&!((s=e.body)instanceof ArrayBuffer?_e(new Uint8Array(s)):ArrayBuffer.isView(s)&&_e(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(nu=!0,i()):{url:t.url,encodedBody:e};var s},uu=t=>{try{return au(t)}catch(e){var i;return Ls.error(e),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))}},hu=function(){var t=J(function*(t){const i=yield function(t){return xe.apply(this,arguments)}(Al(t.data),Ws.DEBUG,{rethrow:!0});if(!i)return t;const e=yield i.arrayBuffer();return bi(bi({},t),{},{cr:{contentType:eu,body:e,estimatedSize:e.byteLength}})});return function(i){return t.apply(this,arguments)}}(),cu=t=>ci("AbortError","PostHog request timed out"+(t?` after ${t}ms`:"")),du=/Failed to fetch|NetworkError|Load failed/i,vu=t=>"TypeError"===(null==t?void 0:t.name)&&du.test((null==t?void 0:t.message)||""),fu=t=>{try{const i=function(t,i=Date.now(),e=3e5){if("string"!=typeof t||!t)return;const s=t.trim(),n=/^\d+\s*,/.test(s)?s.slice(0,s.indexOf(",")).trim():s;if(/^\d+$/.test(n)){const t=1e3*Math.min(Number(n),e/1e3);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const r=/^\w{3} \w{3} /.test(n)?n+" GMT":n,o=Date.parse(r)-i;return Number.isFinite(o)&&o>0?Math.min(o,e):void 0}(t());return A(i)?void 0:Math.min(i,3e4)}catch(t){return}},pu=t=>{const i=uu(t);if(!i)return;const e=new o;iu.set(e,!0);const{url:s,encodedBody:n}=i;e.open(t.method||"GET",s,!0);const{contentType:r,body:l}=null!=n?n:{};Rr(t.headers,function(t,i){e.setRequestHeader(i,t)}),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout);let a=!1;e.ontimeout=()=>{a=!0},e.onloadend=()=>{var i;if(a){var s;const i=cu(t.timeout);return Ls.warn(i),void(null===(s=t.callback)||void 0===s||s.call(t,{statusCode:0,error:i}))}const n={statusCode:e.status,text:e.responseText};if(200===e.status)try{n.json=JSON.parse(e.responseText)}catch(t){}null===(i=t.callback)||void 0===i||i.call(t,n,fu(()=>e.getResponseHeader("Retry-After")))},e.send(l)},gu=t=>{const i=uu(t);if(!i)return;const{url:e,encodedBody:s}=i,{contentType:n,body:o,estimatedSize:a}=null!=s?s:{},u=new Headers;Rr(t.headers,function(t,i){u.append(i,t)}),n&&u.append("Content-Type",n);let h=null,c=!1;if(l){const i=new l;h={signal:i.signal,timeout:setTimeout(()=>{c=!0;try{i.abort(cu(t.timeout))}catch(t){v(t)}},t.timeout)}}let d=!1;const v=i=>{var e;d||(d=!0,c&&"AbortError"===(null==i?void 0:i.name)||vu(i)?Ls.warn(i):Ls.error(i),null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))};let f=0;const p=()=>{su-=f,f=0,h&&clearTimeout(h.timeout)};try{const i=bi({method:(null==t?void 0:t.method)||"GET",headers:u,referrerPolicy:"strict-origin",body:o,signal:null==h?void 0:h.signal},t.fetchOptions),s=null!=a?a:A(o)?0:void 0;i.keepalive="POST"===i.method&&!t.Il&&!1!==i.keepalive&&i.body===o&&!A(s)&&s>=0&&52428.8>su+s,i.keepalive&&(f=s,su+=f),r(e,i).then(i=>i.text().then(e=>{var s;if(d)return;const n={statusCode:i.status,text:e};if(200===i.status)try{n.json=JSON.parse(e)}catch(t){Ls.error(t)}d=!0,p(),null===(s=t.callback)||void 0===s||s.call(t,n,fu(()=>i.headers.get("Retry-After")))})).catch(t=>{p(),v(t)}).finally(p)}catch(t){p(),v(t)}},_u=t=>{try{var i;const{url:s,encodedBody:n}=au(t),{contentType:o,body:l,estimatedSize:a}=null!=n?n:{};if(!l)return;const u=l instanceof Blob?l:new Blob([l],{type:o});if(e.sendBeacon(s,u))return;const h=E(t.data)?t.data:null===(i=t.data)||void 0===i?void 0:i.batch;if(E(h)&&h.length>1&&(null!=a?a:0)>16384){const i=Math.ceil(h.length/2),e=i=>E(t.data)?i:bi(bi({},t.data),{},{batch:i});return _u(bi(bi({},t),{},{data:e(h.slice(0,i))})),void _u(bi(bi({},t),{},{data:e(h.slice(i))}))}Ls.warn(`Beacon of ~${null!=a?a:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?gu(bi(bi({},t),{},{Il:!0})):pu(t)}catch(t){Ls.warn("Beacon send failed",t)}},mu=(t,i,e,s)=>{const n="query"===s?"POST"===i?"sent_at":"_":void 0;return ou(e===la?ru(t,"compression"):t,bi(bi({},n?{[n]:Date.now().toString()}:{}),e===la?{}:{compression:e}))},yu=(()=>{const t=[];return r&&t.push({transport:"fetch",method:gu}),o&&t.push({transport:"XHR",method:pu}),(null==e?void 0:e.sendBeacon)&&t.push({transport:"sendBeacon",method:_u}),t})();let bu=!tu&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));function wu(t,i,e){var s,n,r,o;e&&(i=bi(bi({},i),{},{callback:t=>e(t)})),t.__loaded?bu?t.__request_queue.push(i):t.rateLimiter.isServerRateLimited(i.batchKey)?i.fireCallbackOnDrop&&(null===(r=i.callback)||void 0===r||r.call(i,{statusCode:429})):(i.transport=i.transport||t.config.api_transport,i.headers=bi(bi({},t.config.request_headers),i.headers),i.compression="best-available"===i.compression?null!==(s=t.compression)&&void 0!==s?s:i.compressionFallback:i.compression,(A(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(i.disableTransport=["sendBeacon"]),i.fetchOptions=i.fetchOptions||t.config.fetch_options,null===(n=i.onDispatch)||void 0===n||n.call(i),((t,i)=>{var e,s,n;const r=bi(bi({},t),{},{callback:null!=i?i:i=>{var e;return null===(e=t.callback)||void 0===e?void 0:e.call(t,i)}});r.timeout=r.timeout||6e4;const o=null!==(e=r.transport)&&void 0!==e?e:"fetch";"sendBeacon"===o&&A(r.compression)&&r.data&&(r.compression=aa),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(t=>{var i,e;const s=(E(t)?t:[t]).map(t=>bi(bi({},t),t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})),n=s[0];return{api_key:null!==(i=null==n||null===(e=n.properties)||void 0===e?void 0:e.token)&&void 0!==i?i:null==n?void 0:n.token,batch:s,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((t,i=(new Date).toISOString())=>E(t)?t.map(t=>bi(bi({},t),{},{sent_at:i})):bi(bi({},t),{},{sent_at:i}))(r.data))),r.url=mu(r.url,r.method,r.compression,r.timestampMode);const l=yu.filter(t=>!r.disableTransport||!t.transport||!r.disableTransport.includes(t.transport)),u=null!==(s=null===(n=function(t,i){for(let e=0;t.length>e;e++)if(i(t[e]))return t[e]}(l,t=>t.transport===o))||void 0===n?void 0:n.method)&&void 0!==s?s:l[0].method;if(!u)throw new Error("No available transport method");const h=t=>{try{u(t)}catch(t){var i;vu(t)?Ls.warn(t):Ls.error(t),null===(i=r.callback)||void 0===i||i.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===la&&a&&"undefined"!=typeof Promise&&!nu?hu(r).then(t=>{h(t)}).catch(i=>{if(ye(i))return nu=!0,void h(bi(bi({},r),{},{compression:void 0,url:mu(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;const i="name"in t?String(t.name):"";return ye(t)||i===ge})(i)&&(nu=!0),h(r)}):h(r)})(i,(s,n)=>{var r,o,l;t.rateLimiter.checkForLimiting(s),400>s.statusCode||null===(r=(o=t.config).on_request_error)||void 0===r||r.call(o,s),e?e(s,n):null===(l=i.callback)||void 0===l||l.call(i,s)})):i.fireCallbackOnDrop&&(null===(o=i.callback)||void 0===o||o.call(i,{statusCode:0}))}var $u=class{constructor(t,i){this.nc=!0,this.sc=[],this.rc=Q((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,Ls.createLogger("flush interval"),3e3),this.oc=t}enqueue(t){this.sc.push(t),this.ac||this.lc()}unload(){this.uc();const t=this.sc.length>0?this.cc():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.hc(bi(bi({},t),{},{callback:void 0}),"sendBeacon")})}enable(){this.nc=!1,this.lc()}lc(){this.nc||(this.ac=setTimeout(()=>{this.uc(),this.dc()},this.rc))}dc(){if(this.sc.length>0){const t=this.cc();for(const i in t)this.hc(t[i])}}hc(t,i){try{this.oc(t,i)}catch(t){Ls.error(t)}}uc(){clearTimeout(this.ac),this.ac=void 0}cc(){const t={},i={};Rr(this.sc,e=>{var s;const n=e,r=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");A(t[r])&&(t[r]=bi(bi({},n),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),i[r]=[]),null===(s=t[r].data)||void 0===s||s.push(n.data),n.callback&&i[r].push(n.callback)});for(const e in i){const s=i[e];s.length&&(t[e].callback=t=>{for(const i of s)i(t)})}return this.sc=[],t}};const xu=["retriesPerformedSoFar"];var Su=class{constructor(t){this._instance=t,this.vc=!1,this.fc=3e3,this.sc=[],this.sc=[],this.gc=!0,this.resume()}resume(){if(!A(t)&&"onLine"in t.navigator){if(this.gc=t.navigator.onLine,this.mc)return;this.mc=()=>{this.gc=!0,this.dc()},this.yc=()=>{this.gc=!1},Ur(t,"online",this.mc),Ur(t,"offline",this.yc)}}get length(){return this.sc.length}retriableRequest(t,i){let{retriesPerformedSoFar:e}=t,s=Se(t,xu);D(e)&&(s.url=ou(s.url,{retry_count:e})),wu(this._instance,i?bi(bi({},s),{},{transport:i}):s,(t,i)=>{var n;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.Ls(bi({retriesPerformedSoFar:e},s),i);0===t.statusCode&&Ls.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=e?e:0} retries.`)}null===(n=s.callback)||void 0===n||n.call(s,t)})}Ls(t,i){const e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;const s=Math.max(function(t){const i=3e3*Math.pow(2,t),e=i/2,s=Math.min(18e5,i),n=(Math.random()-.5)*(s-e);return Math.ceil(s+n)}(e),null!=i?i:0),n=Date.now()+s;this.sc.push({retryAt:n,requestOptions:t});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),Ls.warn(r),this.vc||(this.vc=!0,this.bc())}bc(){if(this._c&&clearTimeout(this._c),0===this.sc.length)return this.vc=!1,void(this._c=void 0);this._c=setTimeout(()=>{this.gc&&this.sc.length>0&&this.dc(),this.bc()},this.fc)}dc(){const t=Date.now(),i=[],e=this.sc.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.sc=i,e.length>0)for(const{requestOptions:t}of e)this.retriableRequest(t)}unload(){this._c&&(clearTimeout(this._c),this._c=void 0),this.vc=!1,A(t)||(this.mc&&(t.removeEventListener("online",this.mc),this.mc=void 0),this.yc&&(t.removeEventListener("offline",this.yc),this.yc=void 0));for(const{requestOptions:t}of this.sc)try{this._instance._send_request(bi(bi({},t),{},{callback:E(t.data)?void 0:t.callback,transport:"sendBeacon"}))}catch(t){Ls.error(t)}this.sc=[]}},ku=class{constructor(t){this._instance=t,this.wc=()=>{var t,i,e,s;this.kc||(this.kc={});const n=this.scrollElement(),r=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=r+((null==n?void 0:n.clientHeight)||0),a=(null==n?void 0:n.scrollHeight)||0;this.kc.lastScrollY=Math.ceil(r),this.kc.maxScrollY=Math.max(r,null!==(t=this.kc.maxScrollY)&&void 0!==t?t:0),this.kc.maxScrollHeight=Math.max(o,null!==(i=this.kc.maxScrollHeight)&&void 0!==i?i:0),this.kc.lastContentY=l,this.kc.maxContentY=Math.max(l,null!==(e=this.kc.maxContentY)&&void 0!==e?e:0),this.kc.maxContentHeight=Math.max(a,null!==(s=this.kc.maxContentHeight)&&void 0!==s?s:0)}}get Sc(){return this._instance.config.scroll_root_selector}getContext(){return this.kc}resetContext(){const t=this.kc;return this.kc=void 0,setTimeout(this.wc,0),t}startMeasuringScrollPosition(){Ur(t,"scroll",this.wc,{capture:!0}),Ur(t,"scrollend",this.wc,{capture:!0}),Ur(t,"resize",this.wc)}scrollElement(){if(this.Sc){const e=E(this.Sc)?this.Sc:[this.Sc];for(const s of e){var i;const e=null==t||null===(i=t.document)||void 0===i?void 0:i.querySelector(s);if(e)return e}return}var e;return null==t||null===(e=t.document)||void 0===e?void 0:e.documentElement}xc(i){var e,s;const n="y"===i?"scrollTop":"scrollLeft";if(this.Sc){const t=this.scrollElement();return t&&t[n]||0}return t?"y"===i?t.scrollY||t.pageYOffset||(null===(e=t.document)||void 0===e||null===(e=e.documentElement)||void 0===e?void 0:e.scrollTop)||0:t.scrollX||t.pageXOffset||(null===(s=t.document)||void 0===s||null===(s=s.documentElement)||void 0===s?void 0:s.scrollLeft)||0:0}scrollY(){return this.xc("y")}scrollX(){return this.xc("x")}};const Eu=t=>Wl(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);var Tu=class{constructor(t,i,e,s){this.je=t=>{const i=this.$c();if(i&&i.sessionId===t)return;const e={sessionId:t,props:this.Cc(this._instance)};this.Tc.register({[rr]:e})},this._instance=t,this.Ic=i,this.Tc=e,this.Cc=s||Eu,this.Ic.onSessionId(this.je)}$c(){return this.Tc.props[rr]}getSetOnceProps(){var t;const i=null===(t=this.$c())||void 0===t?void 0:t.props;return i?"r"in i?Vl(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){const t={};return Rr(Lr(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t[`$session_entry_${b(e)}`]=i}),t}},Pu=class{on(t,i){return this.xo[t]||(this.xo[t]=[]),this.xo[t].push(i),()=>{this.xo[t]=this.xo[t].filter(t=>t!==i)}}emit(t,i){for(const e of this.xo[t]||[])e(i);for(const e of this.xo["*"]||[])e(t,i)}constructor(){this.xo={}}};const Cu=Ns("[SessionId]"),Au=864e5;var Fu=class{on(t,i){return this.Mc.on(t,i)}constructor(t,i,e){var s;if(this.Ec=null,this.Ac=null,this.Rc=[],this.Pc=void 0,this.Oc=!1,this.Mc=new Pu,this.Fc=(t,i)=>!(!D(t)||!D(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Fr=t.config,this.Tc=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Dc=void 0,this._sessionActivityTimestamp=null,this.Lc=i||Zr,this.Nc=e||Zr;const n=this.Fr.persistence_name||this.Fr.token;if(this._sessionTimeoutMs=1e3*Q(this.Fr.session_idle_timeout_seconds||1800,60,36e3,Cu.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.jc(),this.qc="ph_"+n+"_window_id",this.Bc="ph_"+n+"_primary_window_exists",this.zc()){const t=yo.Ft(this.qc),i=yo.Ft(this.Bc);t&&!i?this.Be=t:yo.Dt(this.qc),yo.$t(this.Bc,!0)}(null===(s=this.Fr.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this.Fr.bootstrap.sessionID),this.Hc()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return A(this.Rc)&&(this.Rc=[]),this.Rc.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Rc=this.Rc.filter(i=>i!==t)}}zc(){return"memory"!==this.Fr.persistence&&!this.Tc.fi&&yo.Ot()}Uc(t){t!==this.Be&&(this.Be=t,this.zc()&&yo.$t(this.qc,t))}Wc(){return this.Be?this.Be:this.zc()?yo.Ft(this.qc):null}Vc(t){const i=this.Ec;return!M(i)&&!M(t)&&5e3>Math.abs(t-i)}Gc(t,i,e){const s=i!==this._sessionActivityTimestamp,n=!(t!==this.Xt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Xt=t,n&&!s||n&&this.Vc(i)||(this.Ec=i,this.Tc.register({[Hn]:[i,t,e]}))}Qc(){var t;const i=null===(t=this.Fr)||void 0===t?void 0:t.persistence_save_debounce_ms;return D(i)&&i>0}Jc(){this.Qc()?this.Tc.refreshKey(Hn):(this.Tc.flush(),this.Tc.load())}Zc(){var t;if(M(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ec)return;this.Jc();const[,i,e]=this.Kc();i===this.Xt&&e===this._sessionStartTimestamp&&(this.Ec=this._sessionActivityTimestamp,this.Tc.register({[Hn]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Tc.flush())}Yc(){const[t]=this.Kc(),i=D(t)?t:0,e=D(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Xc(t){return this.Jc(),this.Fc(t,this.Yc())}Kc(){const t=this.Tc.props[Hn];return E(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ec=null,this.Dc=void 0,clearTimeout(this.eh),this.eh=void 0,this.Gc(null,null,null)}setBootstrapSessionId(t,i=!1){const e=((t,i=(new Date).getTime())=>{try{const e=(t=>{const i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(t);return e>i+6e4?void Cu.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Cu.error("Invalid sessionID in bootstrap",t)}})(t);return!A(e)&&(i?this.Dc={sessionId:t,sessionStartTimestamp:e}:this.Gc(t,(new Date).getTime(),e),!0)}destroy(){this.Oc=!0,this.Zc(),clearTimeout(this.eh),this.eh=void 0,this.Pc&&t&&(t.removeEventListener(Pr,this.Pc,{capture:!1}),this.Pc=void 0),this.Rc=[]}Hc(){this.Pc=()=>{this.Zc(),this.zc()&&yo.Dt(this.Bc)},Ur(t,Pr,this.Pc,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,i=null,e=!1){if("always"===this.Fr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=i||(new Date).getTime(),n=this.Xt;if(e)this.Ac=s;else if(M(this.Ac)||this.Ac>s||s-this.Ac>=1e3){var r,o;null===(r=(o=this.Tc).syncCookieProperties)||void 0===r||r.call(o),this.Ac=s}let[,l,a]=this.Kc();const u=!A(n)&&l!==n,h=this.Yc();let c=this.Wc();const d=this.Dc,v=!!d&&(d.sessionStartTimestamp>s+6e4||s-d.sessionStartTimestamp>Au),f=d?v:D(a)&&Math.abs(s-a)>Au;let p=!1,g=u,_=!l||!!d;const m=l;let y=!_&&!t&&this.Fc(s,h);if(y&&(y=this.Xc(s),y||Cu.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Kc(),y||(_=!l||!!d)),_||y||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.Lc(),c=this.Nc(),Cu.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:s,this.Dc=void 0,p=!0}else c||(c=this.Nc(),p=!0),g=g||l!==m,g&&(Cu.info("adopted cross-tab session id",{sessionId:l,windowId:c}),p=!0);const b=D(h)&&t&&!f?h:s,w=D(a)?a:(new Date).getTime();this.Uc(c),this.Gc(l,b,w),t||this.jc();const x={noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.Rc.forEach(t=>t(l,c,x)),{sessionId:l,windowId:c,sessionStartTimestamp:w,changeReason:p?x:void 0,lastActivityTimestamp:h}}jc(){this.Oc||(clearTimeout(this.eh),this.eh=setTimeout(()=>{if(!this.Oc)if(this.Xc((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Mc.emit("forcedIdleReset",{idleSessionId:t})}else this.jc()},1.1*this.sessionTimeoutMs))}};const Ou=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]),Mu=function(t,i){if(!t)return!1;const e=t.userAgent;if(e&&X(e,i))return!0;try{const e=null==t?void 0:t.userAgentData;if((null==e?void 0:e.brands)&&e.brands.some(t=>X(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function Ru(){return(Ru=J(function*(){const t=null==e?void 0:e.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return F(e)&&e.length>0?e:void 0}catch(t){return void Ls.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Iu(t,i){let e=`$survey_${i}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(e=`$survey_${i}/${t.id}/${t.current_iteration}`),e}function Du(t){var i;return!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}const ju=(t,i)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}},Lu=t=>t.toLowerCase(),Nu={exact:(t,i)=>i.some(i=>t.some(t=>i===t)),is_not:(t,i)=>i.every(i=>t.every(t=>i!==t)),regex:(t,i)=>i.some(i=>t.some(t=>ju(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!ju(i,t))),icontains:(t,i)=>i.map(Lu).some(i=>t.map(Lu).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(Lu).every(i=>t.map(Lu).every(t=>!i.includes(t))),gt:(t,i)=>i.some(i=>{const e=parseFloat(i);return!isNaN(e)&&t.some(t=>e>parseFloat(t))}),lt:(t,i)=>i.some(i=>{const e=parseFloat(i);return!isNaN(e)&&t.some(t=>e<parseFloat(t))})};function zu(t,i){return!t||Object.entries(t).every(([t,e])=>{const s=null==i?void 0:i[t];if(null==s)return!1;const n=Nu[e.operator];return!!n&&n(e.values.map(String),[String(s)])})}function Bu(t,i,e){return Al({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}const Uu="custom",Hu="i.posthog.com",qu=/^\/static\//,Wu=["/s/","/e/","/i/"];var Vu=class{constructor(t){this.ih={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let i=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace(`.${Hu}`,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.ih[this.apiHost]||(this.ih[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":Uu),this.ih[this.apiHost]}nh(t){if(!qu.test(t))return;const i=this.instance.config.asset_host;return"string"==typeof i&&i.trim().replace(/\/$/,"")||void 0}sh(t){const i=El(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}rh(t,i,e){if("ui"===t)return e;let s=e;const n=this.instance.config.rewriteRequestPath;if(n){var r;const t=(null===(r=El(e))||void 0===r?void 0:r.href)||e;s=n(new URL(t)).toString()}if(n&&"api"===t&&Wu.some(t=>0===i.indexOf(t))){const t=this.sh(s);if(t){const i=this.apiHost;let e=this.oh;(null==e?void 0:e.apiHost)===i&&e.rewriteRequestPath===n||(e={apiHost:i,rewriteRequestPath:n,urls:new Set},this.oh=e),e.urls.add(t)}}return s}isIngestionEndpoint(t){const i=this.oh,e=this.sh(t);return(null==i?void 0:i.apiHost)===this.apiHost&&i.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&i.urls.has(e)}endpointFor(t,i=""){if(i&&(i="/"===i[0]?i:`/${i}`),"ui"===t)return this.rh(t,i,this.uiHost+i);if("flags"===t)return this.rh(t,i,this.flagsApiHost+i);if("assets"===t){const e=this.nh(i);if(e)return this.rh(t,i,`${e}${i}`)}if(this.region===Uu)return this.rh(t,i,this.apiHost+i);const e=Hu+i;switch(t){case"assets":return this.rh(t,i,`https://${this.region}-assets.${e}`);case"api":return this.rh(t,i,`https://${this.region}.${e}`)}}};const Gu=Ns("[Surveys]"),Ku=t=>{try{const i=(t=>((t,i)=>`seenSurvey_${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(i)}`)(0,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){Gu.error("Failed to persist survey seen state",t)}},Ju=["popover","widget","api"],Yu={ignoreConditions:!1,ignoreDelay:!1,displayType:pa},Zu=Ns("[PostHog ExternalIntegrations]"),Xu={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var Qu=class{constructor(t){this._instance=t}Fl(t,i){var e,s;null===(e=c.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,t,t=>{if(t)return Zu.error("failed to load script",t);i()})}startIfEnabledOrStop(){var t;for(const[n,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var i,e,s;r&&!(null===(i=c.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&this.Fl(Xu[n],()=>{var t;null===(t=c.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[n])||void 0===t||t.start(this._instance)}),!r&&(null===(e=c.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[n])&&(null===(s=c.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop())}}},th=class{constructor(t){this.disabled=!1===t;const i=P(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(t-s.x)+Math.abs(i-s.y)<this.thresholdPx&&this.timeoutMs>e-s.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}};const ih=()=>typeof window>"u"?void 0:window,eh=()=>typeof document>"u"?void 0:document,sh="$copy_autocapture",nh=["password","hidden","file","checkbox","button","submit","reset","image"],rh=Ns("[AutoCapture]");function oh(t,i){return i.length>t?i.slice(0,t)+"...":i}function lh(t){if(t.previousElementSibling)return t.previousElementSibling;let i=t;do{i=i.previousSibling}while(i&&!xo(i));return i}function ah(t,{e:i,maskAllElementAttributes:e,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:r,disableCaptureUrlHashes:o}){var l,a;if(!xo(t))return{props:{}};const u=[t],h=new Set([t]);let c=t;for(;c.parentNode&&!So(c,"body")&&1e3>u.length;){if(Eo(c.parentNode)){const t=c.parentNode.host;if(h.has(t))break;h.add(t),u.push(t),c=t;continue}if(!xo(c.parentNode))break;if(h.has(c.parentNode))break;h.add(c.parentNode),u.push(c.parentNode),c=c.parentNode}const d="click"===i.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(t=>So(t,"button")||So(t,"a")):-1;d>0&&(s=s||u.slice(0,d+1).some(t=>!Zo(t)||Xo(t)));const v=[],f={};let p,g=!1,_=!1;if(Rr(u,t=>{const i=Zo(t);if(So(t,"a")&&!e&&!(null==n?void 0:n.includes("href"))){const e=t.getAttribute("href");g=!!(i&&e&&ol(e))&&(o?di(e):e)}m(Co(t),"ph-no-capture")&&(_=!0),v.push(function(t,i,e,s,n=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};Mo.indexOf(r)>-1&&!e&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?oh(1024,ll(t)):oh(1024,Fo(t)));const l=Co(t);i||(null==s?void 0:s.includes("class"))||0>=l.length||(o.classes=l.filter(function(t){return""!==t})),Rr(t.attributes,function(e){var r;if((!Xo(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&!(null==s?void 0:s.includes(e.name))&&!i&&ol(e.value)&&(!F(r=e.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=e.value;"class"===e.name&&(t=To(t).join(" ")),o["attr__"+e.name]=oh(1024,"href"===e.name&&n?di(t):t)}});let a=1,u=1,h=t;for(;h=lh(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,e,s,n,o)),Rr(function(t){if(!Zo(t))return{};const i={};return Rr(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const e=t.name.replace("data-ph-capture-attribute-",""),s=t.value;e&&s&&ol(s)&&(i[e]=s)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(f,i)||(f[i]=t)})}),_)return{props:{},explicitNoCapture:_};if(d>0&&(t=u[d],v.splice(0,d)),s||(v[0].$el_text=So(t,"a")||So(t,"button")?ll(t):Fo(t)),g){var y,b;v[0].attr__href=g;const t=null===(y=El(g))||void 0===y?void 0:y.host,i=null===(b=ih())||void 0===b||null===(b=b.location)||void 0===b?void 0:b.host;t&&i&&t!==i&&(p=g)}return{props:Ir((x=i.type,{$event_type:x,$ce_version:1}),r?{}:{$elements:v},{$elements_chain:(w=v,E(w)?function(t){return t.map(t=>{var i,e;let s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class){t.attr_class.sort();for(const i of t.attr_class)s+=`.${i.replace(/"/g,"")}`}const n=bi(bi(bi(bi({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return Dr(n).sort(([t],[i])=>function(t,i){return i>t?-1:t>i?1:0}(t,i)).forEach(([t,i])=>r[ul(t.toString())]=ul(i.toString())),s+=":",s+=Dr(r).map(([t,i])=>`${t}="${i}"`).join(""),s}).join(";")}(function(t){return t.map(t=>{var i,e;const s={text:null===(i=t.$el_text)||void 0===i?void 0:i.slice(0,400),tag_name:t.tag_name,href:null===(e=t.attr__href)||void 0===e?void 0:e.slice(0,2048),attr_class:hl(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Dr(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,i])=>s.attributes[t]=i),s})}(w)):"")},(null===(l=v[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(a=v[0])||void 0===a?void 0:a.$el_text}:{},p&&"click"===i.type?{$external_click_url:p}:{},f),target:t};var w,x}const uh="autocapture";var hh=class{al(){this.ll=void 0,clearTimeout(this.ul),this.ul=void 0}cl(t){var i;if(!Zo(t))return!0;const e=null!==(i=this.hl().css_selector_ignorelist)&&void 0!==i?i:jo,s=new Set;let n=t;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const t=n,i=Co(t);if(m(i,"ph-no-capture")||m(i,"ph-sensitive")||Xo(t)||e.some(i=>Ro(t,i)))return!0;const r=n.parentNode;n=Eo(r)?r.host:r&&xo(r)?r:null}return!1}dl(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.al();if("pointerdown"===t.type){var i;this.al();const e=Oo(t);return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&e&&xo(e)&&(this.ll={target:e,excluded:this.cl(e),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(i=this.Ma)||void 0===i?void 0:i.distinctId}))}const e=this.ll;e&&(t.pointerId!==e.id||Math.abs(t.clientX-e.x)>5||Math.abs(t.clientY-e.y)>5?this.al():"pointerup"===t.type&&(e.released=!0,this.ul=setTimeout(()=>this.al(),0)))}vl(t){var i;const e=this.ll;this.al();const s=Oo(t);if((null==e?void 0:e.released)&&e.target.isConnected&&e.distinctId===(null===(i=this.Ma)||void 0===i?void 0:i.distinctId)&&t.pointerId===e.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-e.x)&&5>=Math.abs(t.clientY-e.y)&&s&&(So(s,"html")||So(s,"body"))){var n,r,o;if(e.excluded)return null;const t=null!==(n=this.hl().css_selector_ignorelist)&&void 0!==n?n:jo;return[s,null===(r=eh())||void 0===r?void 0:r.documentElement,null===(o=eh())||void 0===o?void 0:o.body].some(i=>{if(!i)return!1;const e=Co(i);return m(e,"ph-no-capture")||m(e,"ph-sensitive")||!Zo(i)||Xo(i)||t.some(t=>Ro(i,t))})?null:e.target}}constructor(t){this.Ra=t,this.name=uh,this.fl=!1,this.pl=null,this.gl=!1,this.ml=new Map,this.yl=!1,this.Fr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Ti=!1,this.Ra.refresh(this.Fr),this.rageclicks=new th(this.Fr.rageclick),this.bl=null}setup(t){this._l(),this.Ma=t;const i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Ti?i.dispose():(this.Ua=i,this.startIfEnabled())}dispose(){var t;this.Ti||(this.Ti=!0,this.Ma=void 0,null===(t=this.Ua)||void 0===t||t.dispose(),this.Ua=void 0,this.ml.clear(),this.bl=null,this.wl())}hl(){return this.Ra.refresh(this.Fr),this.Fr}_l(){var t,i;return this.hl(),this.Fr.url_allowlist=null===(t=this.Fr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Fr.url_ignorelist=null===(i=this.Fr.url_ignorelist)||void 0===i?void 0:i.map(t=>new RegExp(t)),this.Fr}kl(){const t=ih(),i=eh();if(!this.isBrowserSupported())return void rh.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!i)return;this.Sl=t,this.xl=i;const e=this.$l=i=>{i=i||(null==t?void 0:t.event);try{if("blur"===i.type)return void this.al();if(0===i.type.indexOf("pointer"))return void this.dl(i);const t="click"===i.type?this.vl(i):void 0;if(M(t))return;this.Cl(i,"$autocapture",t)}catch(t){rh.error("Failed to capture event",t)}};if(Ur(t,"blur",e),Ur(i,"submit",e,{capture:!0}),Ur(i,"change",e,{capture:!0}),Ur(i,"click",e,{capture:!0}),Rr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Ur(i,t,e,{capture:!0})}),this.hl().capture_copied_text){const e=this.Tl=i=>{i=i||(null==t?void 0:t.event);try{this.Cl(i,sh)}catch(t){rh.error("Failed to capture clipboard event",t)}};Ur(i,"copy",e,{capture:!0}),Ur(i,"cut",e,{capture:!0}),Ur(i,"paste",e,{capture:!0})}}wl(){const t=this.Sl,i=this.xl;this.al(),this.$l&&(null==t||t.removeEventListener("blur",this.$l),Rr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==i||i.removeEventListener(t,this.$l,!0)}),null==i||i.removeEventListener("submit",this.$l,!0),null==i||i.removeEventListener("change",this.$l,!0),null==i||i.removeEventListener("click",this.$l,!0),this.$l=void 0),this.Tl&&(null==i||i.removeEventListener("copy",this.Tl,!0),null==i||i.removeEventListener("cut",this.Tl,!0),null==i||i.removeEventListener("paste",this.Tl,!0),this.Tl=void 0),this.Sl=void 0,this.xl=void 0,this.fl=!1}startIfEnabled(){this.isEnabled||this.al(),!this.Ti&&this.Ma&&this.isEnabled&&!this.fl&&(this.kl(),this.fl=!0)}onRemoteConfig(t){if(this.Ti)return;if(this.gl=!0,!t.ok)return void this.startIfEnabled();const i=t.config;i.elementsChainAsString&&(this.yl=i.elementsChainAsString);const e=i.autocapture_opt_out;var s;j(e)&&(null===(s=this.Ma)||void 0===s||s.kv.set("$autocapture_disabled_server_side",e),this.pl=e),this.startIfEnabled()}setElementSelectors(t,i=this){if(this.Ti)return;t.size?this.ml.set(i,new Set(t)):this.ml.delete(i);const e=new Set;this.ml.forEach(t=>{t.forEach(t=>e.add(t))}),this.bl=e}getElementSelectors(t,i){var e;const s=[];return null===(e=this.bl)||void 0===e||e.forEach(e=>{var n;const r=null===(n=eh())||void 0===n?void 0:n.querySelectorAll(e);null==r||r.forEach(n=>{t!==n&&i!==n||m(s,e)||s.push(e)})}),s}get isEnabled(){var t,i;if(this.Ti)return!1;const e=null===(t=this.Ma)||void 0===t?void 0:t.kv.get(un),s=this.pl,n=this.hl();if(!n.remoteRequestsDisabled&&!this.gl)return!1;const r=n.remoteRequestsDisabled&&!this.gl;if(M(s)&&!j(e)&&!r)return!1;const o=null!==(i=this.pl)&&void 0!==i?i:!!e;return!!n.enabled&&!o}Cl(t,i="$autocapture",e){if(!this.isEnabled)return void this.al();let s=e||Oo(t);ko(s)&&(s=s.parentNode||null);const n=this._l();var r;"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&(null===(r=this.rageclicks)||void 0===r?void 0:r.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime()))&&Ko(s,n.rageclick)&&this.Cl(t,"$rageclick",e);const o=i===sh,l=o?bi(bi({},n),{},{dom_event_allowlist:void 0}):n;if(s&&function(t,i,e,s,n,r){var o;const l=typeof window>"u"?void 0:window;if(!l||Jo(t))return!1;if((null==e?void 0:e.url_allowlist)&&!Po(e.url_allowlist,r))return!1;if((null==e?void 0:e.url_ignorelist)&&Po(e.url_ignorelist,r))return!1;if(null==e?void 0:e.dom_event_allowlist){const t=e.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:a,targetElementList:u}=Yo(t,s);if(!function(t,i){const e=null==i?void 0:i.element_allowlist;if(A(e))return!0;for(const i of t)if(e.some(t=>i.tagName.toLowerCase()===t))return!0;return!1}(u,e))return!1;if(!Io(u,null==e?void 0:e.css_selector_allowlist))return!1;if(Io(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:jo))return!1;try{const e=l.getComputedStyle(t);if(e&&"pointer"===e.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const h=t.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return a?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(Mo.indexOf(h)>-1||"true"===t.getAttribute("contenteditable"))}}(s,t,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var a;const{props:e,explicitNoCapture:r,target:o}=ah(s,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.yl,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(r)return!1;const l=this.getElementSelectors(s,o);if(l&&l.length>0&&(e.$element_selectors=l),i===sh){const i=t.type||"clipboard";if("paste"!==i){var u,h;const t=null===(u=ih())||void 0===u||null===(u=u.getSelection())||void 0===u?void 0:u.toString(),i=Ao(t);if(!i)return!1;e.$selected_content=i,e.$clipboard_text_length=null!==(h=null==t?void 0:t.length)&&void 0!==h?h:0}e.$copy_type=i}if("$autocapture"===i&&"change"===t.type&&n.capture_value_css_selector_allowlist&&!n.maskAllText&&(So(c=s,"input")?!m(nh,c.type):So(c,"textarea")||So(c,"select")&&!c.multiple)&&function(t,i){var e;if(!Zo(t))return!1;const s=null!==(e=i.css_selector_ignorelist)&&void 0!==e?e:jo,n=new Set;let r=t;for(So(t,"select")&&(r=t.options[t.selectedIndex]||t);r;){const t=r,i=Co(t);if(n.size>=1e3||n.has(r)||m(i,"ph-sensitive")||m(i,"ph-no-capture")||s.some(i=>Ro(t,i)))return!1;n.add(r);const e=r.assignedSlot||r.parentNode;r=Eo(e)?e.host:e&&xo(e)?e:null}return!0}(s,n)&&!s.querySelector(".ph-no-capture, .ph-sensitive")){const t=n.capture_value_css_selector_allowlist;let i=!1;try{i=T(t)?!!t(s):E(t)&&t.some(t=>Ro(s,t))}catch(t){rh.error("capture_value_css_selector_allowlist threw",t)}i&&(e.$input_value=s.value)}return null===(a=this.Ma)||void 0===a||a.capture(i,e),!0}var c}isBrowserSupported(){var t;return T(null===(t=eh())||void 0===t?void 0:t.querySelectorAll)}};const ch="featureFlags",dh="logs",vh=()=>{var i;return(null==t||null===(i=t.performance)||void 0===i?void 0:i.now)?t.performance.now():Date.now()};var fh=class{constructor(t){this._instance=t}initialize(){}get(t){const i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);const e={};for(const s of t){const t=null==i?void 0:i.get_property(s);A(t)||(e[s]=t)}return e}set(t,i){var e;null===(e=this._instance.persistence)||void 0===e||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null===(i=this._instance.persistence)||void 0===i||i.unregister(t)}},ph=class{constructor(t){this.instance=t,this.R=Ls,this.kv=new fh(t),this.onSession=t=>ga(this.instance.onSessionId(i=>{try{t(i)}catch(t){this.R.error("Browser extension session listener failed",t)}})),this.onEvent=t=>ga(this.instance._addCaptureHook((i,e)=>{if(e)try{t({event:i,properties:e.properties})}catch(t){this.R.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{const i=i=>{try{t(i)}catch(t){this.R.error("Browser extension remote config listener failed",t)}},e=this.instance.dr.on("extensionsRemoteConfig",i);return this.instance.vr&&i(this.instance.vr),ga(e)}}get logger(){return this.R}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){const t=this.instance.get_property(mn);return"string"==typeof t?t:void 0}get library(){return{name:Ws.LIB_NAME,version:Ws.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,s,n;const r=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==r?void 0:r.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==r?void 0:r.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(s=null==r?void 0:r.sessionStartTimestamp)&&void 0!==s?s:0,lastActivityTimestamp:null!==(n=null==r?void 0:r.lastActivityTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return T(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get isRateLimited(){var t;return!!(null===(t=this.instance.rateLimiter)||void 0===t?void 0:t.isClientRateLimited)}get projectToken(){return this.instance.config.token}getExtension(t){let i;switch(t){case ch:case"featureFlagsCommon":i=this.instance.featureFlags;break;case dh:i=this.instance.logs;break;case"surveys":i=this.instance.surveys;break;case uh:i=this.instance.autocapture}return i}capture(t,i,e){if(!e)return this.pr(this.instance.capture(t,i));const s=bi({timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce},"unload"===e.delivery?{transport:"sendBeacon",send_instantly:!0}:{});return this.pr(this.instance.capture(t,i,s))}pr(t){var i;return!A(t)||!(null===(i=this.instance.rateLimiter)||void 0===i?void 0:i.lastEventRateLimited)}registerDynamicEventProperties(t){return ga(this.instance.mr(t))}sendRequest(t){var i=this;return J(function*(t,e={}){var s;const n=null!==(s=e.target)&&void 0!==s?s:"api",r=e.query?ou(t,e.query):t,o=i.instance.requestRouter.endpointFor(n,r),l={method:e.method,url:o,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?p.Base64:void 0,timestampMode:e.sentAt};return"api"===n&&"/i/v1/logs"===t&&(l.batchKey="logs"),"sendBeacon"===e.transport?(i.instance._send_request(l),{statusCode:202}):new Promise(t=>{var e;if(l.callback=t,"flags"===n&&(null===(e=i.instance.config.metrics)||void 0===e?void 0:e.flags)){let e;l.onDispatch=()=>{e=vh()},l.callback=s=>{A(e)||i.gr(o,s,vh()-e),t(s)}}i.instance._send_request(l)})}).apply(this,arguments)}gr(t,i,e){try{var s,n,r;const o=i.statusCode||void 0,l={"server.address":(null!==(s=null===(n=El(t))||void 0===n?void 0:n.hostname)&&void 0!==s?s:t).replace(/^\[(.*)\]$/,"$1")};o&&(l["http.response.status_code"]=o);const a=((t,i)=>t?400>t?void 0:String(t):"AbortError"===(null==i?void 0:i.name)?"timeout":"_OTHER")(o,i.error);a&&(l["error.type"]=a);const u=kl();u&&(l["client.timezone"]=u),null===(r=this.instance.metrics)||void 0===r||r.histogram("posthog.flags.request.duration",e,{unit:"ms",attributes:l})}catch(t){Ls.error("Failed to record the /flags request duration",t)}}};const gh={};let _h=0;const mh=()=>{},yh='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',bh="Surveys module not available",wh="sanitize_properties is deprecated. Use before_send instead",$h="Invalid value for property_denylist config: ",xh=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],Sh=["$feature_flag_called","$$heatmap","$snapshot"],kh=t=>"$"===t.charAt(0)&&!m(Sh,t),Eh=/^[A-Za-z0-9_-]{1,400}$/,Th=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Ph=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Ch=["token","distinct_id",dr],Ah="posthog",Fh=[...Ou].sort()[Ou.length-1],Oh=t=>{const i={};return t&&"unset"!==t?("2025-11-30">t||(i.strictMinimumDuration=!0),"2026-05-30">t||(i.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(i.streamNetworkBody=!0),"2026-08-30">t||(i.captureJsonLd=!0),i):i},Mh=i=>{var e;return bi({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Br(null==s?void 0:s.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:mh,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:n&&F(null==n?void 0:n.search)&&-1!==n.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null===(e=t.location)||void 0===e?void 0:e.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(t){Ls.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Tr,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:mh},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:No,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Oh(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(i))},Rh=[["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"]],Ih=t=>{const i={};for(const[e,s]of Rh)A(t[e])||(i[s]=t[e]);const e=Ir({},i,t),s=t.__preview_external_dependency_versioned_paths;return A(s)||(A(t.strict_script_versioning)&&(e.strict_script_versioning=!!s),F(s)&&A(t.asset_host)&&(e.asset_host=s)),E(t.property_blacklist)&&(A(t.property_denylist)?e.property_denylist=t.property_blacklist:E(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ls.error($h+t.property_denylist)),e};var Dh=class{constructor(){this.__forceAllowLocalhost=!1}get ah(){return this.__forceAllowLocalhost}set ah(t){Ls.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},jh=class i{uh(t){if(!t)return;const i=this.hh.indexOf(t);-1!==i&&this.hh.splice(i,1)}dh(t,i){var e;return this.uh(t),this.hh.push(i),null===(e=i.initialize)||void 0===e||e.call(i),i}fh(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}ph(){if(this.gh)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.fh())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.mh)return;let i,e,s;t?(i=`persistence is set to '${this.config.persistence}'`,e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",s="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(i="persistence is disabled (disable_persistence is true)",e="on every page load",s="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gh=!0,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${e}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${s}`)}yh(){const t=this.persistence;if(!t||this.bh)return;if(this.fh())return void("on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this._h(),this.wh()));if("$posthog_cookieless"!==this.get_distinct_id())return;this.kh()||t.load(!0);const i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){const i=this.config.get_device_id(Zr());this.register({distinct_id:i,$device_id:i}),t.set_property(nr,kr)}this._h()}get decideEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.Sh=!1,this.xh=!1,this.webPerformance=new Dh,this.$h=!1,this.version=Ws.LIB_VERSION,this.Ch=new Set,this.Th="",this.dr=new Pu,this.hh=[],this.Ih=[],this.Mh=!1,this.mh=!1,this.gh=!1,this.bh=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Mh(),this.SentryIntegration=yl,this.sentryIntegration=t=>function(t,i){const e=ml(t,i);return{name:_l,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Eh=!1,this.Ah=null,this.Rh=null,this.Ph=null,this.scrollManager=new ku(this),this.pageViewManager=new bl(this),this.rateLimiter=new ma(this),this.requestRouter=new Vu(this),this.consent=new bo(this),this.externalIntegrations=new Qu(this);const e=null!==(t=i.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,i,e)=>{const s=F(t)?{[t]:i}:t;this.setPersonProperties(s),null==e||e({})},set_once:(t,i,e)=>{const s=F(t)?{[t]:i}:t;this.setPersonProperties(void 0,s),null==e||e({})}},this.on("eventCaptured",t=>Ls.info(`send "${null==t?void 0:t.event}"`,t))}init(t,e,s){if(s&&s!==Ah){var n;const r=null!==(n=gh[s])&&void 0!==n?n:new i;return r._init(t,e,s),gh[s]=r,gh[Ah][s]=r,r}return this._init(t,e,s)}_init(i,e={},s){var n,r,o;const l=F(i)?i.trim():"";if(!l)return Ls.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var a;if(this.__loaded)return l!==(null===(a=this.config)||void 0===a?void 0:a.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${l}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Mh(e.defaults),e.debug=this.Oh(e.debug),this.Fh=e,this.Dh=[],e.person_profiles?this.Rh=e.person_profiles:e.process_person&&(this.Rh=e.process_person);const u=Mh(e.defaults),h=Ih(e),c=Ir({},u,h,{name:s,token:l});P(u.rageclick)&&P(h.rageclick)&&(c.rageclick=Ir({},u.rageclick,h.rageclick)),P(u.session_recording)&&P(h.session_recording)&&(c.session_recording=Ir({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&Ls.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:la;const d=this.kh(),v=!this.fh();if(this.persistence=new oa(this.config,d,!0,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new oa(bi(bi({},this.config),{},{persistence:"sessionStorage"}),d,!1,v),this.Th="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&yo.Ot()){const t=yo.Ft(this.Th);E(t)&&t.forEach(t=>{F(t)&&this.Ch.add(t)})}else yo.Dt(this.Th);const f=bi({},this.persistence.props),p=bi({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Lh=new $u((t,i)=>this.Nh(t,i),this.config.request_queue_config),this.jh=new Su(this),this.__request_queue=[];const g=this.fh();g||(this.sessionManager=new Fu(this),this.sessionPropsManager=new Tu(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,i,e)=>{((null==e?void 0:e.activityTimeout)||(null==e?void 0:e.sessionPastMaximumLength)||(null==e?void 0:e.crossTabAdoption))&&this.qh()})),this.Bh(),this.config.__preview_deferred_init_extensions?(Ls.info("Deferring extension initialization to improve startup performance"),this.zh=setTimeout(()=>{this.zh=void 0,this.Hh(g)},0)):(Ls.info("Initializing extensions synchronously"),this.Hh(g)),Ws.DEBUG=Ws.DEBUG||this.config.debug,Ws.DEBUG&&Ls.info("Starting in debug mode",{this:this,config:e,thisC:bi({},this.config),p:f,s:p}),this.config.identity_distinct_id&&!(null===(n=e.bootstrap)||void 0===n?void 0:n.distinctID)&&(e.bootstrap=bi(bi({},e.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const _=null===(r=e.bootstrap)||void 0===r?void 0:r.distinctID;if(this.mh=!!_&&!O(_),null===(o=e.bootstrap)||void 0===o?void 0:o.distinctID){const t=e.bootstrap.distinctID,i=this.get_distinct_id(),s=this.persistence.get_property(nr);if(e.bootstrap.isIdentifiedID&&null!=i&&i!==t&&"anonymous"===s)this.identify(t);else if(e.bootstrap.isIdentifiedID&&null!=i&&i!==t&&"identified"===s)Ls.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 i=this.config.get_device_id(Zr()),s=e.bootstrap.isIdentifiedID?i:t;this.persistence.set_property(nr,e.bootstrap.isIdentifiedID?Er:kr),this.register({distinct_id:t,$device_id:s})}}if(g)this.register_once({distinct_id:cr,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(Zr());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(nr,kr)}return Ur(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Ur(t,"pageshow",t=>{if(this.Sh=!1,!this.xh){var i;if(t.persisted&&this.persistence){const t=this.persistence.get_property(_n),i=this.persistence.get_property(nr);this.persistence.load(),this.Uh()||t===this.persistence.get_property("distinct_id")&&i===this.persistence.get_property("$user_state")||this.Wh()}null===(i=this.jh)||void 0===i||i.resume()}}),e.segment?gl(this,()=>this.Vh()):this.Vh(),T(this.config._onCapture)&&this.config._onCapture!==mh&&(Ls.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Ls.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 Ru.apply(this,arguments)}().then(t=>{t&&this.register({[yn]:t})}).catch(mh),this}Gh(t){const i=t;return F(i.name)&&T(i.setup)}Qh(t,i){var e=this;this.Gh(t)?i.push(J(function*(){try{yield t.setup(e.Jh())}catch(e){Ls.error(`Failed to set up extension "${t.name}"`,e);try{var i;yield null===(i=t.dispose)||void 0===i?void 0:i.call(t)}catch(i){Ls.error(`Failed to dispose extension "${t.name}"`,i)}}})):this.hh.push(t)}Bh(){var t,e,s,n=this;const r=null!==(t=null===(e=this.config.__extensionClasses)||void 0===e?void 0:e.featureFlags)&&void 0!==t?t:null===(s=i.__defaultExtensionClasses)||void 0===s?void 0:s.featureFlags;var o,l,a;if(r)if(this.featureFlags&&this.featureFlags instanceof r||(null===(o=this.Zh)||void 0===o||o.call(this),this.Zh=void 0,this.featureFlags=new r(this)),T(this.featureFlags.onReloading)&&T(this.featureFlags.setup)){if(!this.Zh){this.Zh=this.featureFlags.onReloading(()=>{this.dr.emit("featureFlagsReloading",!0)});const t=this.featureFlags;J(function*(){try{yield t.setup(n.Jh())}catch(i){Ls.error("Failed to set up feature flags",i);const e=n.Zh;n.Zh=void 0;try{null==e||e()}catch(t){Ls.error("Failed to unsubscribe feature flag reloading",t)}try{yield t.dispose()}catch(t){Ls.error("Failed to dispose feature flags",t)}}})()}}else null===(l=(a=this.featureFlags).initialize)||void 0===l||l.call(a)}Hh(t){const e=performance.now(),s=bi(bi({},i.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,l,a,u,h,c,d;s.exceptions&&this.hh.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this.hh.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.hh.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.hh.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!t&&this.hh.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.Qh(this.autocapture=new s.autocapture(this),n),s.surveys&&this.Qh(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this.Qh(this.logs=null!==(l=this.logs)&&void 0!==l?l:new s.logs(this),n),s.metrics&&this.hh.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new s.metrics(this)),s.conversations&&this.hh.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new s.conversations(this)),s.productTours&&this.hh.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.hh.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.hh.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.hh.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.hh.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,vl)),s.toolbar&&this.hh.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new s.toolbar(this)),s.experiments&&this.hh.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new s.experiments(this)),s.webMCP&&this.hh.push(this.webMCP=null!==(d=this.webMCP)&&void 0!==d?d:new s.webMCP(this)),this.hh.forEach(t=>{t.initialize&&n.push(()=>{var i;null===(i=t.initialize)||void 0===i||i.call(t)})}),n.push(()=>{if(this.Kh){const t=this.Kh;this.Kh=void 0,this.hh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}}),this.Yh(n,e)}Yh(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void(this.zh=setTimeout(()=>{this.zh=void 0,this.Yh(t,i)},0));const e=t.shift();if(e)try{e()}catch(t){Ls.error("Error initializing extension:",t)}}const e=Math.round(performance.now()-i);this.register_for_session({[vr]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[fr]:e}),this.config.__preview_deferred_init_extensions&&Ls.info(`PostHog extensions initialized (${e}ms)`)}tc(t){if(!s||!s.body)return Ls.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.tc(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Kh=t),this.vr=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=m(e.supportedCompression,la)?la:m(e.supportedCompression,aa)?aa:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.Rh?this.Rh:Tr}),this.dr.emit("extensionsRemoteConfig",t),this.hh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}Vh(){try{this.config.loaded(this)}catch(t){Ls.critical("`loaded` function failed",t)}if(this.Xh(),this.config.internal_or_test_user_hostname&&(null==n?void 0:n.hostname)){const t=n.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.fh())&&this.ed()},1),this.nd=new ba(this),this.nd.load()}Xh(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Lh)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Mr(this.__request_queue,t=>this.Nh(t)),this.__request_queue=[],this.Xh()}_handle_unload(){var t,i,e,s,n,r;this.Sh=!0,null===(t=this.surveys)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t),null===(e=this.metrics)||void 0===e||e.flush("sendBeacon"),this.config.request_batching?(this.sd()&&this.capture(Ar),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this.Lh)||void 0===n||n.unload(),null===(r=this.jh)||void 0===r||r.unload()):this.sd()&&this.capture(Ar,null,{transport:"sendBeacon"})}_send_request(t){wu(this,t)}Nh(t,i){this.jh?this.jh.retriableRequest(t,i):this._send_request(i?bi(bi({},t),{},{transport:i}):t)}_execute_array(t){_h++;try{let i;const e=[],s=[],n=[];Mr(t,t=>{if(t)if(i=t[0],E(i))n.push(t);else if(T(t))try{t.call(this)}catch(i){Ls.error("Error executing queued PostHog call",t,i)}else E(t)&&"alias"===i?e.push(t):E(t)&&-1!==i.indexOf("capture")&&T(this[i])?n.push(t):s.push(t)});const r=function(t,i){Mr(t,function(t){try{if(E(t[0])){let e=i;Rr(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){Ls.error("Error executing queued PostHog call",t,i)}})};r(e,this),r(s,this),r(n,this)}finally{_h--}}push(t){if(_h>0&&E(t)&&F(t[0])){const e=i.prototype[t[0]];return void(T(e)&&e.apply(this,t.slice(1)))}this._execute_array([t])}get rd(){return{property:$n,persistenceKey:xn,cookieName:"_fbc",pattern:Th,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[xn]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(xn)}}}get od(){return{property:Sn,persistenceKey:kn,cookieName:"_fbp",pattern:Ph,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[kn]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(kn)}}}ad(t){var i;const e=null===(i=this.persistence)||void 0===i?void 0:i.get_property(t.persistenceKey);return F(e)&&t.pattern.test(e)?{value:e,delivered:!1}:P(e)&&F(e.value)&&t.pattern.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}ld(t,i,e){return i===(null==e?void 0:e.value)?{value:i,pending:!e.delivered}:(t.register(i,!1),{value:i,pending:!0})}ud(t){if(!this.config.save_campaign_params||this.fh())return;const i=qr(t.cookieName);return F(i)&&t.pattern.test(i)?i:void 0}hd(t,i,e,s){if(!this.persistence)return;const n=this.rd;this.persistence.refreshMetaIdentifiers();const r=this.ad(n);if(s)return void n.unregister();if(e)return F(i)&&Th.test(i)?this.ld(n,i,r):void n.unregister();const o=F(t)&&Eh.test(t)?t:void 0,l=this.ud(n);return l&&((t,i,e)=>{const s=t.split(".");if(i)return s[3]===i;if(!e)return!0;const n=e.value.split(".");return s[3]===n[3]||Number(s[2])>Number(n[2])})(l,o,r)?this.ld(n,l,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.ld(n,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}dd(t,i,e){if(!this.persistence)return;const s=this.od;this.persistence.refreshMetaIdentifiers();const n=this.ad(s);if(e)return void s.unregister();if(i)return F(t)&&Ph.test(t)?this.ld(s,t,n):void s.unregister();const r=this.ud(s);return r?this.ld(s,r,n):n?{value:n.value,pending:!n.delivered}:void 0}vd(t,i){if(!this.persistence)return;this.persistence.refreshMetaIdentifiers();const e=this.ad(t);(null==e?void 0:e.value)!==i||e.delivered||t.register(i,!0)}capture(t,i,e){var s,n,r;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Lh))return void Ls.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void Ls.info(`Event "${t}" was not captured because capturing is disabled (opted out or consent pending).`);if(A(t)||!F(t))return void Ls.error("No event name provided to posthog.capture");if(this.yh(),"$snapshot"===t&&this.fh())return;const o=!this.config.opt_out_useragent_filter&&this._is_bot();if(o&&!this.config.__preview_capture_bot_pageviews)return void Ls.info(`Event "${t}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);const l=(null==e?void 0:e.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==l?void 0:l.isRateLimited)return void Ls.critical("This capture call is ignored due to client rate limiting.");let a;(null==i?void 0:i.$current_url)&&!F(null==i?void 0:i.$current_url)&&(Ls.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||(null==e?void 0:e.fd)||Ls.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&&(a=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 u=new Date,h=(null==e?void 0:e.timestamp)||u,c=hi(null==e?void 0:e.uuid,Zr);let d={uuid:c,event:t,properties:this.calculateEventProperties(t,i||{},h,c)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&o&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),l&&(d.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens);const v="$feature_flag_called"===t&&!1===d.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==e?void 0:e.$set)&&!v&&(d.$set=null==e?void 0:e.$set);const f=P(null==i?void 0:i.$set)?i.$set:void 0,p=E(null==i?void 0:i.$unset)?i.$unset:[],g=(null==e?void 0:e.$unset)||[],_=t=>{var i;const s=!!(null==e?void 0:e.$set)&&t in e.$set;return{hasProvided:s||!!f&&t in f,provided:s?null==e||null===(i=e.$set)||void 0===i?void 0:i[t]:null==f?void 0:f[t],unset:-1!==p.indexOf(t)||-1!==g.indexOf(t)}},m=_($n),y=_(Sn),b=[{channel:this.rd,hasProvided:m.hasProvided,update:this.hd(null==a?void 0:a.fbclid,m.provided,m.hasProvided,m.unset)},{channel:this.od,hasProvided:y.hasProvided,update:this.dd(y.provided,y.hasProvided,y.unset)}];for(const{channel:t,hasProvided:i,update:e}of b)e&&!0===d.properties.$process_person_profile&&e.pending&&!i&&!v&&(d.$set=bi({[t.property]:e.value},d.$set));const w=null==e?void 0:e.$unset;w&&(d.$unset=w);const x=v?void 0:this.pd(null==e?void 0:e.$set_once,t!==Or,t===Fr);if(x&&(d.$set_once=x),(null==e?void 0:e._noTruncate)||(S=this.config.properties_string_max_length,d=function(t,i){const e=new Set;return function t(s,n){if(s!==Object(s))return i?i(s):s;if(e.has(s))return;let r;if(e.add(s),E(s))r=[],Mr(s,i=>{r.push(t(i))});else{const i={};Rr(U(s)?Nr(s):s,(s,n)=>{e.has(s)||(i[n]=t(s,n))}),r=i}return r}(t)}(d,t=>F(t)?t.slice(0,S):t)),d.timestamp=h,A(null==e?void 0:e.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=u),v&&(d.properties=((t,i=[])=>{const e={},s=i=>{void 0!==t[i]&&(e[i]=t[i])};return pe.forEach(s),i.forEach(s),e})(d.properties,Ch)),t===da||t===va){const e=null==i?void 0:i.$survey_id,s=null==i?void 0:i.$survey_iteration;Ku({id:e,current_iteration:s}),d.$set=bi(bi({},d.$set),{},{[Iu({id:e,current_iteration:s},t===va?"responded":"dismissed")]:!0})}else t===ca&&(d.$set=bi(bi({},d.$set),{},{[fa]:(new Date).toISOString()}));var S;if("product tour shown"===t){const t=null==i?void 0:i.$product_tour_type;t&&(d.$set=bi(bi({},d.$set),{},{[`$product_tour_last_seen_date/${t}`]:(new Date).toISOString()}))}const k=bi(bi({},d.properties.$set),d.$set);if(C(k)||this.setPersonPropertiesForFlags(k),!R(this.config.before_send)){const t=this.Fs(d);if(!t)return;d=t,d.uuid=hi(d.uuid,Zr)}this.sessionRecording&&!this.Mh&&kh(t)&&(this.Mh=!0,setTimeout(()=>this.Mh=!1,3e4));const T=b.filter(({channel:t,update:i})=>{var e,s,n;const r=null!==(e=null===(s=d.$set)||void 0===s?void 0:s[t.property])&&void 0!==e?e:P(null===(n=d.properties)||void 0===n?void 0:n.$set)?d.properties.$set[t.property]:void 0;return(null==i?void 0:i.pending)&&r===i.value});this.dr.emit("eventCaptured",d);const O=null!==(s=null==e?void 0:e._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),M="recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(O),I=bi(bi(bi({method:"POST",url:O,data:d,compression:"best-available",preferSyncCompression:null==e?void 0:e.send_instantly,timestampMode:M?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},M&&(null===(n=d.properties)||void 0===n?void 0:n.$session_id)?{batchGroup:d.properties.$session_id+(d.properties.$window_id?`-${d.properties.$window_id}`:"")}:{}),(null==e?void 0:e.transport)?{transport:e.transport}:{}),T.length?{fireCallbackOnDrop:!0,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(const{channel:t,update:i}of T)this.vd(t,i.value)}}:{});if(!this.config.request_batching||e&&!(null==e?void 0:e._batchKey)||(null==e?void 0:e.send_instantly)){var D;let t;!I.transport&&!I.callback&&C(null!==(D=this.config.request_headers)&&void 0!==D?D:{})&&this.Sh&&(t="sendBeacon"),this.Nh(I,t)}else this.Lh.enqueue(I);return null===(r=this.featureFlags)||void 0===r||r.sendFlagCallsPendingCapture(),d}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null===(i=this.gd)||void 0===i?void 0:i.getExtension(t)}Jh(){var t;return null!==(t=this.gd)&&void 0!==t?t:this.gd=new ph(this)}mr(t){this.Ih.push(t);let i=!0;return()=>{if(!i)return;i=!1;const e=this.Ih.indexOf(t);-1!==e&&this.Ih.splice(e,1)}}Uh(t=!0){var i;return!!(null===(i=this.persistence)||void 0===i?void 0:i.consumeCookieIdentityChange())&&(this.Wh(t),!0)}Wh(t=!0){var i,e,s;this.Ph=null,"anonymous"===(null===(i=this.persistence)||void 0===i?void 0:i.get_property("$user_state"))&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this.Ch.clear(),this.md()),null===(e=this.featureFlags)||void 0===e||e.reset(),t&&this.reloadFeatureFlags()}calculateEventProperties(i,e,r,o,l){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;this.yh(),this.persistence.syncCookieProperties(),this.Uh();const a=l?void 0:this.persistence.remove_event_timer(i);let h=bi({},e);if(h.token=this.config.token,h.$config_defaults="latest"===this.config.defaults?Fh:this.config.defaults,this.fh()&&(h[dr]=!0),"$snapshot"===i){const t=bi(bi({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=t.distinct_id,(!F(h.distinct_id)&&!I(h.distinct_id)||O(h.distinct_id))&&Ls.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const c=function(i,e,s,r=!1){var o,l,a,h;if(!u)return{};const c=i?[...Rl,...e||[]]:[],[d,f]=Xt(u),[p,g]=function(t){for(let i=0;ei.length>i;i++){const[e,s,n]=ei[i],r=t.match(e);if(r){const i=n&&t.match(n)||r;return[s,(null==i?void 0:i[1])||""]}}return["",""]}(u),_=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),m={};A(s)||(m.detectGoogleSearchApp=s);const y={},b=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,w=null===(l=navigator)||void 0===l?void 0:l.maxTouchPoints,x=null==t||null===(a=t.screen)||void 0===a?void 0:a.width,S=null==t||null===(h=t.screen)||void 0===h?void 0:h.height,k=null==t?void 0:t.devicePixelRatio;A(b)||(y.userAgentDataPlatform=b),A(w)||(y.maxTouchPoints=w),A(x)||(y.screenWidth=x),A(S)||(y.screenHeight=S),A(k)||(y.devicePixelRatio=k);const E=Ir(Lr({$os:d,$os_version:f,$browser:Kt(u,navigator.vendor,_,m),$webview_app:p,$webview_app_version:g,$device:Qt(u),$device_type:ti(u,y),$timezone:kl(),$timezone_offset:Gl()}),{$current_url:Ol(r?di(null==n?void 0:n.href):null==n?void 0:n.href,c,Dl),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Yt(u,navigator.vendor,_,m),$browser_language:Bl(),$browser_language_prefix:Ul(),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(E.$sdk_dist_channel=v.SDK_DIST_CHANNEL),E}(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:t,windowId:i}=this.sessionManager.checkAndGetSessionAndWindowId(l,r.getTime(),!0);h.$session_id=t,h.$window_id=i}this.sessionPropsManager&&Ir(h,this.sessionPropsManager.getSessionProps());try{var d;if(this.sessionRecording){const t=this.sessionRecording.sdkDebugProperties,e=!this.Mh&&kh(i);for(const i in t)(e||m(xh,i))&&(h[i]=t[i])}h.$sdk_debug_retry_queue_size=null===(d=this.jh)||void 0===d?void 0:d.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}let f;if(this.requestRouter.region===Uu&&(h.$lib_custom_api_host=this.config.api_host),f="$pageview"!==i||l?"$pageleave"!==i||l?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),h=Ir(h,f),"$pageview"===i&&s&&(h.title=s.title),!A(a)){const t=r.getTime()-a;h.$duration=parseFloat((t/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const p=this.persistence.properties(),g=this.sessionPersistence.properties(),_=h.$groups,y=p.$groups;P(_)&&!C(_)&&(h.$groups=bi(bi({},P(y)?y:{}),_)),Rr(["$referrer","$referring_domain"],t=>{t in p&&delete g[t]});const b={};if(this.Ih.length>0)for(const t of this.Ih.slice())try{Ir(b,t())}catch(t){Ls.error("Failed to produce browser extension event properties",t)}h=Ir({},c,p,g,bi(bi({},b),h)),h.$is_identified=this._isIdentified(),E(this.config.property_denylist)?Rr(this.config.property_denylist,function(t){delete h[t]}):Ls.error($h+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const w=this.config.sanitize_properties;w&&(Ls.error(wh),h=w(h,i));const x=this.yd();return h.$process_person_profile=x,x&&!l&&this.bd("_calculate_event_properties"),h}pd(t,i=!0,e=!1){var s;if(!this.persistence||!this.yd())return t;if(this.$h&&!e)return t;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=Ir({},n,r||{},t||{});const l=this.config.sanitize_properties;return l&&(Ls.error(wh),o=l(o,"$set_once")),i&&(this.$h=!0),C(o)?void 0:o}register(t,i){var e;null===(e=this.persistence)||void 0===e||e.register(t,i)}register_once(t,i,e){var s;null===(s=this.persistence)||void 0===s||s.register_once(t,i,e)}register_for_session(t){var i,e;null===(i=this.persistence)||void 0===i||i.syncCookieProperties(),this.Uh(),null===(e=this.sessionPersistence)||void 0===e||e.register(t),Object.keys(t).forEach(t=>this.Ch.add(t)),this.md()}unregister(t){var i;null===(i=this.persistence)||void 0===i||i.unregister(t)}unregister_for_session(t){var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t),this.Ch.delete(t),this.md()}_d(t,i){this.register({[t]:i})}qh(){this.Ch.forEach(t=>{var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t)}),this.Ch.clear(),this.md()}md(){var t;if(!this.Th)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.fi)||!yo.Ot())return void yo.Dt(this.Th);const i=[];this.Ch.forEach(t=>i.push(t)),i.length>0?yo.$t(this.Th,i):yo.Dt(this.Th)}getFeatureFlag(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,s;return null!==(e=null===(s=this.featureFlags)||void 0===s?void 0:s.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i=!1,e){var s;return null===(s=this.featureFlags)||void 0===s?void 0:s.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.dr.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:bh}),()=>{})}onSessionId(t){var i,e;return null!==(i=null===(e=this.sessionManager)||void 0===e?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i=!1){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:bh})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:bh})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:bh}),()=>{})}renderSurvey(t,i){var e;null===(e=this.surveys)||void 0===e||e.renderSurvey(t,i)}displaySurvey(t,i=Yu){var e;null===(e=this.surveys)||void 0===e||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null===(i=this.surveys)||void 0===i||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null===(e=this.surveys)||void 0===e?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:bh}}canRenderSurveyAsync(t,i=!1){var e,s;return null!==(e=null===(s=this.surveys)||void 0===s?void 0:s.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:bh})}wd(t){return!t||O(t)?(Ls.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Ls.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())||(Ls.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,i,e){if(!this.__loaded||!this.persistence)return Ls.uninitializedWarning("posthog.identify");if(I(t)&&(t=t.toString(),Ls.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wd(t))return;if(!this.bd("posthog.identify"))return;this.yh();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this.Uh(!1),o=this.persistence.Iu();let l=!1;try{const s=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),t!==s&&t!==this.get_property("__alias")&&(this.unregister(bn),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===kr,u=t!==s,h=!u&&o;if(u&&o){var a;const n=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:s};this.persistence.set_property(nr,Er),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Mu(),this.capture("$identify",n,{$set:i||{},$set_once:e||{}})&&(this.Ph=Bu(t,i,e)),null===(a=this.featureFlags)||void 0===a||a.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(h){this.persistence.set_property(nr,Er);const s=i||{},n=e||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence.Mu(),this.capture("$set",{$set:s,$set_once:n})&&(this.Ph=Bu(t,i,e))}else(i||e)&&this.setPersonProperties(i,e);u||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(sn)):h&&(i||e)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Ru(l)}}setPersonProperties(t,i){if(!t&&!i)return;if(!this.bd("posthog.setPersonProperties"))return;const e=Bu(this.get_distinct_id(),t,i);this.Ph!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this.Ph=e)):Ls.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;const e=(E(t)?t:[t]).filter(t=>F(t)&&t.length>0);0!==e.length&&this.bd("posthog.unsetPersonProperties")&&(null===(i=this.featureFlags)||void 0===i||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Ph=null)}group(t,i,e){var s;if(!t||!i)return void Ls.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.Uh();const n=this.getGroups(),r=n[t]!==i;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:bi(bi({},n),{},{[t]:i})}),(r||e)&&this.yd()){const s={$group_type:t,$group_key:i};e&&(s.$group_set=e),this.capture(Or,s)}e&&this.setGroupPropertiesForFlags({[t]:e}),r&&!e&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i=!0){var e;null===(e=this.featureFlags)||void 0===e||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i=!0){var e;this.bd("posthog.setGroupPropertiesForFlags")&&(null===(e=this.featureFlags)||void 0===e||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null===(i=this.featureFlags)||void 0===i||i.resetGroupPropertiesForFlags(t)}reset(t){const i=j(t)?t:null==t?void 0:t.resetDeviceID,e=j(t)||null==t?void 0:t.bootstrap;this.kd(i,!1,e)}kd(t,i=!1,e){var s,n,r,o,l,a;if(Ls.info("reset"),!this.__loaded)return Ls.uninitializedWarning("posthog.reset");const u=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null===(s=this.Fh)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this.ec());const h=this.get_property(mn),c=this.get_property(yn),d=this.get_property(Dn);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();i||this.consent.reset(),i||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.Iu)||void 0===a?void 0:a.call(l),p=this.bh;this.bh=p||i;let g=!1;try{var _,m,y,b,w,x,S,k,E,T,P,C,F;if(null===(_=this.persistence)||void 0===_||_.clear(),null===(m=this.sessionPersistence)||void 0===m||m.clear(),this.Ch.clear(),this.md(),A(d)||null===(T=this.persistence)||void 0===T||T.register({$session_recording_remote_config:d}),null===(y=this.surveys)||void 0===y||y.reset(),null===(b=this.featureFlags)||void 0===b||b.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(x=this.logs)||void 0===x||x.reset(),null===(S=this.metrics)||void 0===S||S.reset(),null===(k=this.persistence)||void 0===k||k.set_property("$user_state","anonymous"),null===(E=this.sessionManager)||void 0===E||E.resetSessionId(),this.Ph=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:cr,$device_id:null},"");else{const i=this.config.get_device_id(Zr());this.register_once({distinct_id:i,$device_id:t?i:h},""),t||A(c)||this.register({[yn]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(e.distinctID&&!this.fh()&&(null===(F=this.persistence)||void 0===F||F.set_property("$user_state",e.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.distinctID})),null===(P=this.featureFlags)||void 0===P||P.initialize(),!R(u)&&!(null===(C=this.sessionManager)||void 0===C?void 0:C.setBootstrapSessionId(u,!0))){const t=bi({},e);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,g=!0}finally{var O,M;this.bh=p,f&&(null===(O=this.persistence)||void 0===O||null===(M=O.Ru)||void 0===M||M.call(O,g))}var I;this.vr&&(null===(I=this.conversations)||void 0===I||I.onRemoteConfig(this.vr)),this.reloadFeatureFlags()}shutdown(t){var i=this;return J(function*(){if(!i.__loaded)return void Ls.uninitializedWarning("posthog.shutdown");i.xh=!0,clearTimeout(i.zh),i.zh=void 0;const t=i.Zh;i.Zh=void 0;for(const e of[()=>{var t;return null===(t=i.sessionRecording)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.flushLogs("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.flush("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.surveys)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.autocapture)||void 0===t?void 0:t.dispose()},()=>null==t?void 0:t(),()=>{var t;return null===(t=i.Lh)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.jh)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.featureFlags)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.persistence)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.sessionPersistence)||void 0===t?void 0:t.destroy()}])try{const t=e();t&&T(t.then)&&t.then(void 0,t=>{Ls.error("Error during shutdown",t)})}catch(t){Ls.error("Error during shutdown",t)}})()}setIdentity(t,i){var e;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null===(e=this.conversations)||void 0===e||e.Sd()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(t=this.conversations)||void 0===t||t.xd()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if((null==t?void 0:t.withTimestamp)&&e){var n;const i=null!==(n=t.timestampLookBack)&&void 0!==n?n:10;if(!e)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-e)/1e3)-i,0)}`}return s}alias(t,i){return t===this.get_property("$people_distinct_id")?(Ls.critical("Attempting to create alias for existing People user - aborting."),-2):this.bd("posthog.alias")?(A(i)&&(i=this.get_distinct_id()),t!==i?(this._d(bn,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Ls.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const i=bi({},this.config);if(P(t)){var e,s,n,r,o,l,a,u,h,c,d,v,f,p;Ir(this.config,Ih(t));const b=this.kh();if(this.persistence){const t="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;var g,_;if(t&&this.sessionPersistence!==this.persistence&&(null===(g=this.sessionPersistence)||void 0===g||g.remove(),null===(_=this.sessionPersistence)||void 0===_||_.destroy()),this.persistence.update_config(this.config,i,b),t)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new oa(bi(bi({},this.config),{},{persistence:"sessionStorage"}),b,!1);else{var m;null===(m=this.sessionPersistence)||void 0===m||m.update_config(bi(bi({},this.config),{},{persistence:"sessionStorage"}),bi(bi({},i),{},{persistence:"sessionStorage"}),b)}}const w=this.Oh(this.config.debug);var y;j(w)&&(this.config.debug=w),j(this.config.debug)&&(this.config.debug?(Ws.DEBUG=!0,no.Ot()&&no.$t("ph_debug",!0),Ls.info("set_config",{config:t,oldConfig:i,newConfig:bi({},this.config)})):(Ws.DEBUG=!1,no.Ot()&&no.Dt("ph_debug"))),null===(e=this.featureFlags)||void 0===e||null===(s=e.updateConfig)||void 0===s||s.call(e,this.config,this.ec()),null===(n=this.exceptionObserver)||void 0===n||n.onConfigChange(),null===(r=this.exceptions)||void 0===r||r.onConfigChange(),null===(o=this.metrics)||void 0===o||o.onConfigChange(),null===(l=this.webMCP)||void 0===l||l.startIfEnabled(),null===(a=this.sessionRecording)||void 0===a||a.startIfEnabledOrStop(),null===(u=this.tracingHeaders)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.autocapture)||void 0===h||h.startIfEnabled(),null===(c=this.heatmaps)||void 0===c||c.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(y=this.historyAutocapture)||void 0===y||y.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.deadClicksAutocapture)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),this._h(),null===(p=this.externalIntegrations)||void 0===p||p.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&gl(this,mh,!1)}}_overrideSDKInfo(t,i){Ws.LIB_NAME=t,Ws.LIB_VERSION=i}startSessionRecording(t){const i=!0===t,e={sampling:i||!!(null==t?void 0:t.sampling),linked_flag:i||!!(null==t?void 0:t.linked_flag),url_trigger:i||!!(null==t?void 0:t.url_trigger),event_trigger:i||!!(null==t?void 0:t.event_trigger)};var s,n,r,o,l;Object.values(e).some(Boolean)&&(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),e.sampling&&(null===(n=this.sessionRecording)||void 0===n||n.overrideSampling()),e.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),e.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),e.event_trigger&&(null===(l=this.sessionRecording)||void 0===l||l.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(null===(t=this.sessionRecording)||void 0===t?void 0:t.started)}captureException(t,i){try{if(!this.exceptions)return;const e=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(bi(bi({},e),i))}catch(t){return}}addExceptionStep(t,i){var e;null===(e=this.exceptions)||void 0===e||e.addExceptionStep(t,i)}captureLog(t){var i;null===(i=this.logs)||void 0===i||i.captureLog(t)}get logger(){var t,e;return null!==(t=null===(e=this.logs)||void 0===e?void 0:e.logger)&&void 0!==t?t:i.$d}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null===(e=this.toolbar)||void 0===e?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null===(i=this.persistence)||void 0===i?void 0:i.props[t]}getSessionProperty(t){var i;return null===(i=this.sessionPersistence)||void 0===i?void 0:i.props[t]}toString(){var t;let i=null!==(t=this.config.name)&&void 0!==t?t:Ah;return i!==Ah&&(i="posthog."+i),i}_isIdentified(){var t,i;return"identified"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))||"identified"===(null===(i=this.sessionPersistence)||void 0===i?void 0:i.get_property("$user_state"))}yd(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&C(this.getGroups())&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.__alias)&&!(null===(i=this.persistence)||void 0===i||null===(i=i.props)||void 0===i?void 0:i.$epp))}sd(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yd()||this.bd("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bd("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bd(t){return"never"===this.config.person_profiles?(Ls.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.ph(),this._d(hr,!0),!0)}kh(){if("always"===this.config.cookieless_mode)return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_h(){var t,i;const e=this.kh();var s,n,r;return this.is_capturing()||null===(s=this.logs)||void 0===s||s.Cd(),(null===(t=this.persistence)||void 0===t?void 0:t.fi)!==e&&(null===(n=this.persistence)||void 0===n||n.set_disabled(e)),(null===(i=this.sessionPersistence)||void 0===i?void 0:i.fi)!==e&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(e)),this.md(),e}opt_in_capturing(t){var e,s,n;if("always"===this.config.cookieless_mode)return void Ls.warn(yh);if(this.fh()){var r,o,l,a,u,h;null===(r=this.sessionRecording)||void 0===r||r.dispose({discardBufferedEvents:!0}),this.kd(!0,!0),null===(o=this.sessionManager)||void 0===o||o.destroy(),null===(l=this.pageViewManager)||void 0===l||l.destroy(),this.sessionManager=new Fu(this),this.pageViewManager=new bl(this),this.persistence&&(this.sessionPropsManager=new Tu(this,this.sessionManager,this.persistence));const t=null!==(a=null===(u=this.config.__extensionClasses)||void 0===u?void 0:u.sessionRecording)&&void 0!==a?a:null===(h=i.__defaultExtensionClasses)||void 0===h?void 0:h.sessionRecording;var c,d;t&&(this.sessionRecording=this.dh(this.sessionRecording,new t(this)),this.vr&&(null===(c=this.sessionRecording)||void 0===c||null===(d=c.onRemoteConfig)||void 0===d||d.call(c,this.vr)))}const v=1===this.consent.consent;var f,p,g;v&&this.yh(),this.consent.optInOut(!0),this._h(),this.Xh(),null===(e=this.sessionRecording)||void 0===e||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),null===(p=this.conversations)||void 0===p||p.loadIfEnabled()),v||!A(null==t?void 0:t.captureEventName)&&!(null==t?void 0:t.captureEventName)||this.capture(null!==(g=null==t?void 0:t.captureEventName)&&void 0!==g?g:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.Uh(),null===(n=this.featureFlags)||void 0===n||n.sendFlagCallsPendingCapture(),this.config.capture_pageview&&this.ed()}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this._h(),"on_reject"===this.config.cookieless_mode&&this.wh()):Ls.warn(yh)}wh(){var t,i;const e=this.sessionRecording;null==e||e.dispose({discardBufferedEvents:!0}),"$posthog_cookieless"!==this.get_distinct_id()&&this.kd(!0,!0),this.register({distinct_id:cr,$device_id:null}),this.uh(e),this.sessionRecording=void 0,null===(t=this.sessionManager)||void 0===t||t.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.ed(),this.Xh()}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 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return!this.bh&&("always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this._h()}_is_bot(){return e?Mu(e,this.config.custom_blocked_useragents):void 0}ed(){s&&("visible"===s.visibilityState?this.Eh||(this.Eh=!0,this.capture(Cr,{title:s.title},{send_instantly:!0}),this.Ah&&(s.removeEventListener(an,this.Ah),this.Ah=null)):this.Ah||(this.Ah=this.ed.bind(this),Ur(s,an,this.Ah)))}debug(i){!1===i?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}ec(){const t=this.Fh||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ls.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(t,i,e,s,n){const r=i in t&&!R(t[i]),o=e in t&&!R(t[e]);return r?t[i]:!!o&&(n&&n.warn(`Config field '${e}' is deprecated. Please use '${i}' instead. The old field will be removed in a future major version.`),t[e])}(t,"advanced_disable_flags","advanced_disable_decide",0,Ls)}Fs(t){var i;if(R(this.config.before_send))return t;const e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(N),s=E(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=t;for(const i of s)try{if(n=i(n),R(n)){const i=`Event '${t.event}' was rejected in beforeSend function`;return L(t.event)?Ls.warn(`${i}. This can cause unexpected behavior.`):Ls.info(i),null}n.properties&&!C(n.properties)||Ls.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(i){return Ls.error(`Error in beforeSend function for event '${t.event}':`,i),null}for(const i of e)if(n.properties&&R(n.properties[i]))return Ls.warn(`Event '${t.event}' had its '${i}' 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 null===(t=this.pageViewManager.Nl)||void 0===t?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Oh(t){const i=j(t)&&!t,e=no.Ot()&&"true"===no.Lt("ph_debug");return!i&&(!!e||t)}};jh.__defaultExtensionClasses={},jh.$d=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(let e=0;i.length>e;e++)t.prototype[i[e]]=jr(t.prototype[i[e]])}(jh,["identify"]);const Lh=["[data-ph-capture-value]"];var Nh=class{constructor(t){this._instance=t}refresh(t){var i;const e=this._instance.config,s=P(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.ec(),t.url_allowlist=null==s?void 0:s.url_allowlist,t.url_ignorelist=null==s?void 0:s.url_ignorelist,t.dom_event_allowlist=null==s?void 0:s.dom_event_allowlist,t.element_allowlist=null==s?void 0:s.element_allowlist,t.css_selector_allowlist=null==s?void 0:s.css_selector_allowlist,t.css_selector_ignorelist=null==s?void 0:s.css_selector_ignorelist,t.element_attribute_ignorelist=null==s?void 0:s.element_attribute_ignorelist,t.capture_copied_text=null==s?void 0:s.capture_copied_text,t.capture_value_css_selector_allowlist=null!==(i=null==s?void 0:s.capture_value_css_selector_allowlist)&&void 0!==i?i:Lh}};const zh=Ns("[ExceptionAutocapture]"),Bh=()=>{},Uh=t=>{var i;if(T(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Hh(t,i,e){try{if(!(i in t))return Bh;const s={next:t[i]},n=e(function(...t){return s.next.apply(this,t)});return T(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),t[i]=n,()=>{if(t[i]===n)return void(t[i]=s.next);let e=t[i],r=Uh(e);for(;r;){if(r.next===n)return void(r.next=s.next);e=r.next,r=Uh(e)}}}catch(t){return Bh}}const qh=Ns("[TracingHeaders]"),Wh=Ns("[Web Vitals]"),Vh=9e5,Gh=["CLS","FCP","INP","LCP"],Kh=["INP","LCP"],Jh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Yh="disabled",Zh="lazy_loading",Xh=Ns("[SessionRecording]"),Qh=[pr,gr,_r,mr,yr,br,wr,$r,xr],tc=Ns("[Heatmaps]");function ic(t){return P(t)&&"clientX"in t&&"clientY"in t&&I(t.clientX)&&I(t.clientY)}const ec=Ns("[Product Tours]"),sc=t=>{var i;return!t.config.disable_product_tours&&!!(null===(i=t.persistence)||void 0===i?void 0:i.get_property(Mn))},nc=["$set_once","$set"],rc=Ns("[SiteApps]"),oc="Error while initializing PostHog app with config id ";function lc(t,i,e){if(R(t))return!1;switch(e){case"exact":return t===i;case"contains":{const e=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(e,"i").test(t)}case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}var ac=class{constructor(t){this.$i=t,this.$o=new Set,this.Co=new Set,this.To=new Pu,this.Io=(t,i)=>this.Mo(t,i)&&this.Eo(t,i)&&this.Ao(t,i)&&this.Ro(t,i),this.Mo=(t,i)=>!(null==i?void 0:i.event)||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;A(null===(t=this.$i)||void 0===t?void 0:t.subscribeCapture)||(this.Po=null===(i=this.$i)||void 0===i?void 0:i.subscribeCapture((t,i)=>{this.on(t,i)}))}dispose(){var t,i,e;null===(t=this.Po)||void 0===t||t.call(this),this.Po=void 0,null===(i=this.$i)||void 0===i||null===(e=i.setElementSelectors)||void 0===e||e.call(i,new Set,this),this.To=new Pu}register(t){var i,e;if(!A(null===(i=this.$i)||void 0===i?void 0:i.subscribeCapture)&&(t.forEach(t=>{var i;this.$o.add(t),null===(i=t.steps)||void 0===i||i.forEach(t=>{this.Co.add((null==t?void 0:t.event)||"")})}),null===(e=this.$i)||void 0===e?void 0:e.setElementSelectors)){const t=new Set;this.$o.forEach(i=>{var e;null===(e=i.steps)||void 0===e||e.forEach(i=>{(null==i?void 0:i.selector)&&t.add(i.selector)})}),this.$i.setElementSelectors(t,this)}}replace(t){this.$o.clear(),this.Co.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Co.has(t)||this.Co.has(i.event))&&this.$o.forEach(t=>{this.Oo(i,t)&&this.To.emit("actionCaptured",t.name)})}Fo(t){this.onAction("actionCaptured",i=>t(i))}Oo(t,i){if(null==(null==i?void 0:i.steps))return!1;for(const e of i.steps)if(this.Io(t,e))return!0;return!1}onAction(t,i){return this.To.on(t,i)}Eo(t,i){if(null==i?void 0:i.url){var e;let r=null==t||null===(e=t.properties)||void 0===e?void 0:e.$current_url;if(!(null==t?void 0:t.properties)||!("$current_url"in t.properties))try{var s,n;r=null===(s=this.$i)||void 0===s||null===(n=s.getActionUrl)||void 0===n?void 0:n.call(s)}catch(t){return!1}if(!r||"string"!=typeof r)return!1;if(!lc(r,i.url,i.url_matching||"contains"))return!1}return!0}Ao(t,i){return!!this.Do(t,i)&&!!this.Lo(t,i)&&!!this.No(t,i)}Do(t,i){var e;if(!(null==i?void 0:i.href))return!0;const s=this.jo(t);if(s.length>0)return s.some(t=>lc(t.href,i.href,i.href_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return!!n&&lc(function(t){const i=t.match(/(?::|")href="(.*?)"/);return i?i[1]:""}(n),i.href,i.href_matching||"exact")}Lo(t,i){var e;if(!(null==i?void 0:i.text))return!0;const s=this.jo(t);if(s.length>0)return s.some(t=>lc(t.text,i.text,i.text_matching||"exact")||lc(t.$el_text,i.text,i.text_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return!!n&&(r=function(t){const i=[],e=/(?::|")text="(.*?)"/g;let s;for(;!R(s=e.exec(t));)i.includes(s[1])||i.push(s[1]);return i}(n),o=i.text,l=i.text_matching||"exact",r.some(t=>lc(t,o,l)));var r,o,l}No(t,i){var e,s;if(!(null==i?void 0:i.selector))return!0;const n=null==t||null===(e=t.properties)||void 0===e?void 0:e.$element_selectors;if(null==n?void 0:n.includes(i.selector))return!0;const r=(null==t||null===(s=t.properties)||void 0===s?void 0:s.$elements_chain)||"";if(i.selector_regex&&r)try{return new RegExp(i.selector_regex).test(r)}catch(t){}return!1}jo(t){var i;return null==(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Ro(t,i){return!(null==i?void 0:i.properties)||0===i.properties.length||zu(i.properties.reduce((t,i)=>{const e=E(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t},{}),null==t?void 0:t.properties)}},uc=class{constructor(t,i){this.qo=i,this.Bo=[],this.$i=t,this.zo=new Map,this.Ho=new Map,this.Uo=new Map}Wo(){var t,i;this.Vo=null===(t=(i=this.$i).subscribeSession)||void 0===t?void 0:t.call(i,t=>this.Go(t))}Qo(t){return!1}Jo(){return null}Zo(t){}Ko(){}Yo(t,i){return!!t&&zu(t.propertyFilters,null==i?void 0:i.properties)}Xo(t,i){const e=new Map;return t.forEach(t=>{var s;null===(s=t.conditions)||void 0===s||null===(s=s[i])||void 0===s||null===(s=s.values)||void 0===s||s.forEach(i=>{if(null==i?void 0:i.name){const s=e.get(i.name)||[];s.push(t.id),e.set(i.name,s)}})}),e}ta(t,i,e){const s=(e===ua?this.zo:this.Ho).get(t);let n=[];return this.ea(t=>{n=t.filter(t=>null==s?void 0:s.includes(t.id))}),n.filter(s=>{var n;const r=null===(n=s.conditions)||void 0===n||null===(n=n[e])||void 0===n||null===(n=n.values)||void 0===n?void 0:n.find(i=>i.name===t);return this.Yo(r,i)})}register(t){this.ia(t,!1)}replace(t){this.ia(t,!0)}ia(t,i){A(this.$i.subscribeCapture)||(this.na(t,i),this.sa(t,i))}sa(t,i){const e=t.filter(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length});var s;if(i&&this.Uo.clear(),0===e.length)return void(i&&(null===(s=this.ra)||void 0===s||s.replace([])));this.ra||(this.ra=new ac(this.$i),this.ra.init(),this.ra.Fo(t=>this.onAction(t)));const n=[];e.forEach(t=>{var i;null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||i.values.forEach(i=>{if(n.push(i),i.name){var e;const s=null!==(e=this.Uo.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.Uo.set(i.name,s)}})}),i?this.ra.replace(n):this.ra.register(n)}oa(t,i){i.forEach((i,e)=>{var s;const n=null!==(s=t.get(e))&&void 0!==s?s:[];i.forEach(t=>{n.includes(t)||n.push(t)}),t.set(e,n)})}na(t,i){var e,s,n;const r=t.filter(t=>{var i,e;return(null===(i=t.conditions)||void 0===i?void 0:i.events)&&(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),o=t.filter(t=>{var i,e;return(null===(i=t.conditions)||void 0===i?void 0:i.cancelEvents)&&(null===(e=t.conditions)||void 0===e||null===(e=e.cancelEvents)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),l=this.Xo(t,ua),a=this.Xo(t,ha);i?(this.zo=l,this.Ho=a):(this.oa(this.zo,l),this.oa(this.Ho,a)),(0!==r.length||0!==o.length||t.some(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length}))&&(null!==(e=this.Po)&&void 0!==e||(this.Po=null===(s=(n=this.$i).subscribeCapture)||void 0===s?void 0:s.call(n,(t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,s;const n=this.aa(),r=(null==i||null===(e=i.properties)||void 0===e?void 0:e.$survey_id)||(null==i||null===(s=i.properties)||void 0===s?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const e=this.la(t,r,i);if("consume"===e)return n.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.ua([r]);if("persist"===e)return n.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.ca(r),void this.ha([r])}if(this.Ho.has(t)){const e=this.ta(t,i,ha);e.length>0&&(n.info("cancel event matched, cancelling items",{event:t,itemsToCancel:e.map(t=>t.id)}),this.ua(e.map(t=>t.id)),e.forEach(t=>this.da(t.id)))}if(!this.zo.has(t))return;n.info("event name matched",{event:t,eventPayload:i,items:this.zo.get(t)});const o=this.ta(t,i,ua);this.va(o.map(t=>t.id))}onAction(t){this.Uo.has(t)&&this.va(this.Uo.get(t)||[])}va(t){if(0===t.length)return;const i=!!this.$i.getSessionId(),e=[];for(const s of t)i&&this.Qo(s)?this.ca(s)&&this.fa(s):e.push(s);e.length>0&&(this.Bo=[...new Set([...this.Bo,...e])]),this.aa().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.pa()}ca(t){this.Bo=this.Bo.filter(i=>i!==t);const i=this.ga();return!i.includes(t)&&(this.ma([...i,t]),this.ya(),!0)}ua(t){const i=new Set(t);this.Bo=this.Bo.filter(t=>!i.has(t));const e=this.ba(),s=e.filter(t=>!i.has(t));s.length!==e.length&&(this.ma(s),0===s.length&&this._a()),this.ha(t),this.pa()}pa(){try{var t;null===(t=this.qo)||void 0===t||t.call(this)}catch(t){this.aa().error("Error while handling activated items change",t)}}wa(){const t=this.Jo();if(!t)return{};const i=this.$i.getProperty(t);return i&&"object"==typeof i?i:{}}fa(t){if(!this.Jo())return;const i=this.wa();this.Zo(bi(bi({},i),{},{[t]:Date.now()}))}ha(t){if(!this.Jo())return;const i=this.wa(),e={};let s=!1;for(const[n,r]of Object.entries(i))t.includes(n)?s=!0:e[n]=r;s&&(C(e)?this.Ko():this.Zo(e))}ka(){this.Jo()&&this.Ko()}getActivationTimestamp(t){if(!this.ga().includes(t))return;const i=this.wa()[t];return I(i)?i:void 0}ba(){const t=this.Sa();return this.$i.getProperty(t)||[]}ga(){const t=this.ba();if(0===t.length)return[];const i=this.$i.getProperty(this.xa()),e=this.$i.getSessionId();return e&&i===e?t:[]}ya(){const t=this.$i.getSessionId();t&&this.$a(t)}_a(){this.Ca()}Go(t){const i=this.$i.getProperty(this.xa());if(i&&i!==t){const t=this.ba(),i=this.wa();t.length>0&&(this.ma([]),t.filter(t=>I(i[t])).forEach(t=>this.da(t))),this._a(),this.ka(),t.length>0&&this.pa()}}getActivatedIds(){return[...new Set([...this.ga(),...this.Bo])].filter(t=>!this.Ta(t))}dispose(){var t,i,e;null===(t=this.Vo)||void 0===t||t.call(this),this.Vo=void 0,null===(i=this.Po)||void 0===i||i.call(this),this.Po=void 0,null===(e=this.ra)||void 0===e||e.dispose(),this.ra=void 0}reset(){this.Bo=[],this.ba().length>0&&this.ma([]),this._a(),this.ka(),this.pa()}getEventToItemsMap(){return this.zo}Ia(){return this.ra}},hc=class extends uc{constructor(t,i,e,s){var n;super({subscribeCapture(i){const e=t.onEvent(t=>i(t.event,t));return()=>e.dispose()},subscribeSession(i){const e=t.onSession(i);return()=>e.dispose()},getSessionId(){var i;return null===(i=t.session)||void 0===i?void 0:i.sessionId},getProperty:i=>t.kv.get(i),getActionUrl:null==e?void 0:e.getActionUrl,setElementSelectors:null!==(n=null==e?void 0:e.setElementSelectors)&&void 0!==n?n:(i,e)=>{var s;return null===(s=t.getExtension("autocapture"))||void 0===s?void 0:s.setElementSelectors(i,e)}},s),this.Ma=t,this.Ea=i,this.Wo()}Sa(){return vn}xa(){return fn}Jo(){return pn}Zo(t){this.Ma.kv.set({[pn]:t})}Ko(){this.Ma.kv.remove(pn)}Qo(t){var i;let e;this.ea(i=>{e=i.find(i=>i.id===t)});const s=null==e||null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds;return I(s)&&s>0}Aa(){return ca}ea(t){this.Ea.getSurveys(t)}da(t){this.Ea.cancelPendingSurvey(t)}aa(){return Gu}ma(t){this.Ma.kv.set({[vn]:t})}$a(t){this.Ma.kv.set({[fn]:t})}Ca(){this.Ma.kv.remove(fn)}Ta(){return!1}la(t,i,e){var s;if(t===va&&!1===(null==e||null===(s=e.properties)||void 0===s?void 0:s.$survey_completed))return"ignore";let n;return this.ea(t=>{n=t.find(t=>t.id===i)}),!n||function(t){var i;return Du(t)&&!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i?void 0:i.repeatedActivation)||"always"===t.schedule}(n)?t===ca?"consume":"ignore":t===ca?"persist":t===da||t===va?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};const cc=(t,i)=>(null==t?void 0:t.then)?t.then(i):i(t),dc="SDK is not enabled or survey functionality is not yet loaded",vc="Disabled. Not loading surveys.";var fc=class{constructor(t){this.Ra=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Pa=!1,this.Oa=!1,this.Fa=[],this.Da=[],this.La=null,this.Na=null,this.Ti=!1,this.ja=new Set,this.onRemoteConfig=t=>{if(this.Ti)return;if(this.Fr.disableSurveys)return;if(!t.ok)return this.Oa=!0,this.qa({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),Gu.warn("Remote config unavailable. Not loading surveys.");const i=t.config.surveys;if(R(i))return Gu.warn("Flags not loaded yet. Not loading surveys.");this.Ba=j(i)?i:i.length>0,Gu.info(`flags response received, isSurveysEnabled: ${this.Ba}`),this.loadIfEnabled()},this.qa=t=>{this.Da.slice().forEach(i=>this.za(i,t))}}setup(t){if(!this.Ti)return this.Ha=t,cc(t.kv.initialize(),()=>{if(this.Ha!==t||this.Ti)return;this.Ha=void 0,this.Ma=t;const i=t.onRemoteConfig(this.onRemoteConfig);this.Ti?i.dispose():(this.Ua=i,this.loadIfEnabled())})}dispose(){var t,i,e,s,n;this.Ti||(this.Ti=!0,this.Ha=void 0,this.Ma=void 0,null===(t=this.Ua)||void 0===t||t.dispose(),this.Ua=void 0,null===(i=this._surveyEventReceiver)||void 0===i||i.dispose(),this._surveyEventReceiver=null,null===(e=this._surveyManager)||void 0===e||null===(s=e.dispose)||void 0===s||s.call(e),this._surveyManager=null,this.Fa=[],this.Da.forEach(t=>{t.active=!1}),this.Da=[],null===(n=this.Wa)||void 0===n||n.call(this),this.Wa=void 0,this.La=null,this.ja.forEach(t=>clearTimeout(t)),this.ja.clear())}get Fr(){return this.Ra.get()}getRenderContext(){if(!this.Ma)return;const t=this;return{client:this.Ma,get config(){return t.Fr},surveys:t}}initialize(){this.loadIfEnabled()}reset(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.clearInMemoryInProgressSurveyState)||void 0===i||i.call(t);try{var e;null===(e=this._surveyEventReceiver)||void 0===e||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let i=0;i<localStorage.length;i++){const e=localStorage.key(i);((null==e?void 0:e.startsWith("seenSurvey_"))||(null==e?void 0:e.startsWith("inProgressSurvey_")))&&t.push(e)}t.forEach(t=>localStorage.removeItem(t))}catch(t){}this.qa()}loadIfEnabled(){if(this.Ti||!this.Ma)return;const t=this.Fr;if(this._surveyManager)return;if(this.Pa)return void Gu.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Gu.info(vc);if(t.cookielessMode&&this.Ma.isOptedOut)return void Gu.info("Not loading surveys in cookieless mode without consent.");const i=this.Ra.getExtensions();if(!i)return void this.Va("PostHog Extensions not found.");if(A(this.Ba)&&!t.advancedEnableSurveys)return;const e=this.Ba||t.advancedEnableSurveys;this.Pa=!0,this.Oa=!1;try{const t=i.generateSurveys;if(t)return this.Ga(t,e),void(this.Pa=!1);const s=i.loadExternalDependency;if(!s)return this.Va(dn),void(this.Pa=!1);s(t=>{try{if(this.Ti)return;const i=this.Ra.getExtensions();t||!(null==i?void 0:i.generateSurveys)?this.Va("Could not load surveys script",t):this.Ga(i.generateSurveys,e)}finally{this.Pa=!1}})}catch(t){throw this.Pa=!1,this.Va("Error initializing surveys",t),t}}Ga(t,i){var e;if(this.Ti)return;this._surveyManager=t(i),this._surveyEventReceiver=this.Qa(this.Ma,this.qa);const s=null===(e=this.Ma)||void 0===e?void 0:e.kv.get(hn);s&&this.Ja(s),Gu.info("Surveys loaded successfully"),this.Za(),this.qa(),this.Ka({isLoaded:!0})}Qa(t,i){return new hc(t,this,void 0,i)}Va(t,i){this.Oa=!0,Gu.error(t,i),this.qa({isLoaded:!1,error:t}),this.Ka({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Fa.push(t),this._surveyManager&&this.Ka({isLoaded:!0}),()=>{this.Fa=this.Fa.filter(i=>i!==t)}}getSurveys(t,i=!1){if(this.Ti)return;const e=this.Ma;if(!e)return t([],{isLoaded:!1,error:dc});if(this.Fr.disableSurveys)return Gu.info(vc),t([]);const s=e.kv.get(hn);if(s&&!i)return t(s,{isLoaded:!0}),void(this.Ya()&&this.getSurveys(()=>{},!0));if(this.La)return void this.La.then(({surveys:i,context:e})=>{this.Ti||t(i,e)}).catch(t=>Gu.error("Error in survey callback",t));const n=e.sendRequest("/api/surveys/",{method:"GET",query:{token:e.projectToken},sentAt:"query",timeoutMs:this.Fr.requestTimeoutMs}).then(t=>{try{return this.Xa(e,t)}catch(t){return Gu.error("Error processing surveys response",t),this.Xa(e,{statusCode:0,error:t})}},t=>this.Xa(e,{statusCode:0,error:t}));this.La=n;const r=()=>{this.La===n&&(this.La=null)};n.then(i=>{r(),this.Ti||(this.qa(i.context),t(i.surveys,i.context))},r).catch(t=>Gu.error("Error in survey callback",t))}Xa(t,i){if(this.Ti)return{surveys:[],context:{isLoaded:!1,error:dc}};const e=i.statusCode;if(200!==e||!i.json){const t=`Surveys API could not be loaded, status: ${e}`;return 0!==e?Gu.error(t):i.error||Gu.warn(t),this.Na=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.Na=null;const s=i.json.surveys||[];return t.kv.set({[hn]:s,[cn]:Date.now()}),this.Ja(s),{surveys:s,context:{isLoaded:!0}}}Ja(t){const i=t.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Du(t)||function(t){var i;return!!(null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}(t)));this.tl(i)}tl(t){var i;null===(i=this._surveyEventReceiver)||void 0===i||i.replace(t)}Ya(){return this.el()&&!this.La&&!this.il()}el(){var t;const i=null===(t=this.Ma)||void 0===t?void 0:t.kv.get(cn);return I(i)&&Date.now()-i>3e5}il(){return I(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(t,i){var e;const s={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};Ku(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}this.qa()}Ka(t){for(const i of this.Fa){if(this.Ti)return;try{t.isLoaded?this.getSurveys(i):i([],t)}catch(t){Gu.error("Error in survey callback",t)}}}getActiveMatchingSurveys(t,i=!1){if(!R(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Gu.warn("init was not called")}onActiveMatchingSurveysChanged(t){var i;if(this.Ti)return()=>{};const e={callback:t,active:!0,revision:0};this.Da.push(e),this.Za();const s=null===(i=this.Ma)||void 0===i?void 0:i.kv.get(hn);return this.Fr.disableSurveys||!this._surveyManager&&this.Oa&&!this.Pa||!s&&!R(this.Na)&&!this.La?this.za(e,{isLoaded:!1}):this._surveyManager&&this.za(e),()=>{var t;e.active=!1,this.Da=this.Da.filter(t=>t!==e),0===this.Da.length&&(null===(t=this.Wa)||void 0===t||t.call(this),this.Wa=void 0)}}Za(){var t,i,e;this._surveyManager&&this.Da.length>0&&(null!==(t=this.Wa)&&void 0!==t||(this.Wa=null===(i=(e=this.Ra).onMatchingConditionsChanged)||void 0===i?void 0:i.call(e,this.qa)))}za(t,i){if(this.Ti||!t.active)return;const e=++t.revision,s=s=>{if(!this.Ti&&t.active&&e===t.revision)try{const e=null!=i?i:{isLoaded:!0},n=JSON.stringify([s,e]);if(n===t.lastResult)return;t.lastResult=n,t.callback(s,e)}catch(t){Gu.error("Error in active matching surveys callback",t)}};try{i&&!i.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(t){Gu.error("Error in active matching surveys callback",t)}}nl(t){let i=null;return this.getSurveys(e=>{var s;i=null!==(s=e.find(i=>i.id===t))&&void 0!==s?s:null}),i}sl(t){if(R(this._surveyManager))return{eligible:!1,reason:dc};const i="string"==typeof t?this.nl(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}rl(t){var i;if(!(null===(i=this.Ma)||void 0===i?void 0:i.canCapture))return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(R(this._surveyManager))return{eligible:!1,reason:dc};const e="string"==typeof t?this.nl(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(R(this._surveyManager))return Gu.warn("init was not called"),{visible:!1,disabledReason:dc};const i=this.rl(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return R(this._surveyManager)?(Gu.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:dc})):new Promise(e=>{this.getSurveys(i=>{var s;const n=null!==(s=i.find(i=>i.id===t))&&void 0!==s?s:null;if(n){const t=this.rl(n);e({visible:t.eligible,disabledReason:t.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var s,n,r;if(!(null===(s=this.Ma)||void 0===s?void 0:s.canCapture))return;if(R(this._surveyManager))return void Gu.warn("init was not called");const o="string"==typeof t?this.nl(t):t;if(!(null==o?void 0:o.id))return void Gu.warn("Survey not found");if(!Ju.includes(o.type))return void Gu.warn(`Surveys of type ${o.type} cannot be rendered in the app`);const l=null===(n=typeof document>"u"?void 0:document)||void 0===n?void 0:n.querySelector(i);if(l){if(null===(r=o.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds){Gu.info(`Rendering survey ${o.id} with delay of ${o.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var i,s,n;this.ja.delete(t),!this.Ti&&(null===(i=this.Ma)||void 0===i?void 0:i.canCapture)&&(Gu.info(`Rendering survey ${o.id} with delay of ${null===(s=o.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(o,l,e),Gu.info(`Survey ${o.id} rendered`))},1e3*o.appearance.surveyPopupDelaySeconds);return void this.ja.add(t)}this._surveyManager.renderSurvey(o,l,e)}else Gu.warn("Survey element not found")}displaySurvey(t,i){var e,s;if(!(null===(e=this.Ma)||void 0===e?void 0:e.canCapture))return;if(R(this._surveyManager))return void Gu.warn("init was not called");const n=this.nl(t);if(!n)return void Gu.warn("Survey not found");let r=n;if((null===(s=n.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds)&&i.ignoreDelay&&(r=bi(bi({},n),{},{appearance:bi(bi({},n.appearance),{},{surveyPopupDelaySeconds:0})})),i.displayType!==pa&&i.initialResponses&&Gu.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){const t=this.sl(n);if(!t.eligible)return void Gu.warn("Survey is not eligible to be displayed: ",t.reason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(r,i):this.renderSurvey(r,i.selector,i.properties)}cancelPendingSurvey(t){R(this._surveyManager)?Gu.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t)}},pc=class{constructor(t){this._instance=t}get(){var t,i,e,s;const n=null===(t=this._instance)||void 0===t?void 0:t.config;return{disableSurveys:!!(null==n?void 0:n.disable_surveys),cookielessMode:!!(null==n?void 0:n.cookieless_mode),advancedEnableSurveys:!!(null==n?void 0:n.advanced_enable_surveys),requestTimeoutMs:null!==(i=null==n?void 0:n.surveys_request_timeout_ms)&&void 0!==i?i:1e4,prefillFromUrl:!!(null==n||null===(e=n.surveys)||void 0===e?void 0:e.prefillFromUrl),automaticDisplay:!(null==n?void 0:n.disable_surveys_automatic_display),featureFlagEvaluation:!(null==n?void 0:n.advanced_disable_feature_flags),overrideLanguage:null==n?void 0:n.override_display_language,prepareStylesheet:null==n?void 0:n.prepare_external_dependency_stylesheet,get_current_url:null==n?void 0:n.get_current_url,uiHost:null===(s=this._instance)||void 0===s||null===(s=s.requestRouter)||void 0===s?void 0:s.endpointFor("ui","")}}getExtensions(){const t=null==c?void 0:c.__PosthogExtensions__;if(!t||!this._instance)return;const i=this._instance,{generateSurveys:e,loadExternalDependency:s}=t;return{generateSurveys:e?t=>e(i,t):void 0,loadExternalDependency:s?t=>s(i,"surveys",t):void 0}}onMatchingConditionsChanged(i){var e,s;const n=null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook(t=>{"$pageview"!==t&&t!==ca&&t!==da&&t!==va||i()}),r=()=>i();Ur(t,"PHSurveyShown",r);let o=!1;const l=null===(s=this._instance)||void 0===s?void 0:s.onFeatureFlags(()=>{o&&i()});return o=!0,()=>{o=!1,null==n||n(),null==l||l(),null==t||t.removeEventListener("PHSurveyShown",r)}}};const gc=(()=>(null==t?void 0:t.location)?Ml(t.location.hash,"__posthog")||Ml(location.hash,"state"):null)(),_c="_postHogToolbarParams",mc=Ns("[Toolbar]"),yc=Ns("[FeatureFlags]"),bc=Ns("[FeatureFlags]",{debugEnabled:!0}),wc="\" failed. Feature flags didn't load in time.",$c=[502,504],xc=["click","keydown","wheel","touchstart","pointerdown"],Sc="connection_error",kc=t=>{const i={};for(let e=0;t.length>e;e++)i[t[e]]=!0;return i},Ec=t=>{const i={};for(const[e,s]of Dr(t||{}))s&&(i[e]=s);return i},Tc=(t,i)=>t.distinctId===i.distinctId&&t.sessionId===i.sessionId&&((t,i)=>{const e=Object.keys(t);return e.length===Object.keys(i).length&&e.every(e=>t[e]===i[e])})(t.groups,i.groups);var Pc=class{constructor(t){this.name="featureFlags",this.Td=!1,this.featureFlagEventHandlers=[],this.R=yc,this.Id={},this.Md={},this.Ed=[],this.Ad=new Set,this.Rd=new Set,this.Pd=!1,this.Od=!1,this.Fd=0,this.Dd=!1,this.Ld=!1,this.Nd=!1,this.jd=new Map,this.qd=!1,this.Bd=!1,this.zd=!1,this.Hd=0,this.Ud=!1,this.sn=()=>{const t=this.Wd();this.Hd=0,t&&this.reloadFeatureFlags()},this.Vd=()=>{var t,i;const e=this.Gd,s=null!==(t=this.Qd)&&void 0!==t?t:e;A(e)||A(s)||this.Fr.remoteRequestsDisabled||!this.Jd||"hidden"===this.Jd.visibilityState||Date.now()-(null!==(i=this.Zd)&&void 0!==i?i:0)<s||(this.Qd=this.Ud||!this.Fr.idleRefreshBackoff?e:Math.min(2*s,36e5),this.Ud=!1,this.reloadFeatureFlags(),this.Kd())},this.Yd=()=>{this.Ud&&this.Qd===this.Gd||this.Xd()},this.an=()=>{var t;"visible"===(null===(t=this.Jd)||void 0===t?void 0:t.visibilityState)&&this.Xd()},this.Ra=t}get tv(){}ev(){this.Ma&&this.iv()}setup(t){try{this.nv=typeof window>"u"?void 0:window,this.Jd=typeof document>"u"?void 0:document}catch(t){this.nv=void 0,this.Jd=void 0}return this.Ha=t,this.R=t.logger.createLogger("[FeatureFlags]"),cc(t.kv.initialize(),()=>{this.Ha===t&&(this.Ha=void 0,this.Ma=t,this.sv(t))})}sv(t){var i;if(this.Ma===t)return this.nv&&Ur(this.nv,"online",this.sn),this.iv(),this.rv=t.registerDynamicEventProperties(()=>this.ov()?this.Id:this.Md),this.av=null===(i=this.tv)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.lv(),this.uv(),this.hv()}),this.uv(),this.initialize()}Xd(){this.Ud=!0,this.Qd=this.Gd,this.Vd()}iv(){var t;const i=this.Fr.refreshIntervalMs,e=!this.Fr.remoteRequestsDisabled&&this.Jd&&!A(i)&&i>0?i:void 0;this.Fr.idleRefreshBackoff||(this.Qd=e),e!==this.Gd&&(this.dv(),A(e)||(this.Gd=e,this.Qd=e,this.Kd(),(null===(t=this.Jd)||void 0===t?void 0:t.addEventListener)&&(Ur(this.Jd,an,this.an),Mr(xc,t=>{Ur(this.Jd,t,this.Yd,{capture:!0})}))))}Kd(){A(this.Gd)||(A(this.vv)||clearInterval(this.vv),this.Zd=Date.now(),this.vv=setInterval(this.Vd,this.Gd))}dv(){var t,i;A(this.vv)||(clearInterval(this.vv),this.vv=void 0,null===(t=this.Jd)||void 0===t||null===(i=t.removeEventListener)||void 0===i||i.call(t,"visibilitychange",this.an),Mr(xc,t=>{var i,e;null===(i=this.Jd)||void 0===i||null===(e=i.removeEventListener)||void 0===e||e.call(i,t,this.Yd,{capture:!0})})),this.Gd=void 0,this.Qd=void 0,this.Ud=!1,this.Zd=void 0}destroy(){this.fv()}dispose(){this.fv()}fv(){var t,i,e;this.dv(),this.Fd++,this.Ld=!1,this.Ha=void 0,this.pv(this.Ad,"cancelled"),this.pv(this.Rd,"cancelled"),this.Ma&&(this.gv(),null===(t=this.rv)||void 0===t||t.dispose(),this.rv=void 0,null===(i=this.av)||void 0===i||i.call(this),this.av=void 0,this.Ed=[],null===(e=this.nv)||void 0===e||e.removeEventListener("online",this.sn),this.Ma=void 0)}get Fr(){return this.Ra.get()}mv(t){var i;return this.yv&&t in this.yv?this.yv[t]:null===(i=this.Ma)||void 0===i?void 0:i.kv.get(t)}lv(){return!!this.yv&&(this.yv=void 0,!0)}bv(){var t;return!A(null===(t=this.Ma)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.lv()}$t(t){this._v(()=>{var i;return null===(i=this.Ma)||void 0===i?void 0:i.kv.set(t)})}wv(t,i,e){if(!this.tv||!t.$enabled_feature_flags)return;const s=this.mv("$enabled_feature_flags")||{},n=t.$enabled_feature_flags||{},r=i.flags||i.featureFlags,o=i.flags?Object.entries(i.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,a=l?o:e&&!E(r)?Object.keys(r||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.mv("$feature_flag_payloads")||{},h=t.$feature_flag_payloads||{},c=l||e?a:Array.from(new Set([...Object.keys(u),...Object.keys(h)])),d=!l&&!e,v=!!d||a,f=!!d||c,p={[Gs]:v,[Qs]:v,[rn]:f};t.$feature_flag_details&&(p[Ks]=v);for(const i of[Zs,Ys,Xs])A(t[i])||(p[i]=!0);this.tv.markCrossTabFeatureFlagChanges(p)}Dt(t){this._v(()=>{var i;return null===(i=this.Ma)||void 0===i?void 0:i.kv.remove(t)})}_v(t){try{t()}catch(t){this.R.error("Failed to update feature flag persistence",t)}}uv(){const t={};for(const i of[Gs,rn,Zs,on]){const e=this.mv(i);A(e)||(t[i]=e)}this.Id=t;const i=bi({},t),e=this.mv(Qs);if(e)for(const[t,s]of Object.entries(e))i[`$feature/${t}`]=s;this.Md=i}ov(){const t=this.Fr.cacheTtlMs;if(!t||0>=t)return!1;const i=this.mv(Ys);return"number"!=typeof i||Date.now()-i>t}Sv(){return!!this.ov()&&(this.zd||this.Od||(this.zd=!0,this.R.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}xv(){const t=this.Fr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.R.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}$v(){const t=this.Fr.flagKeys;if(!A(t))return t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.R.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i;const e=this.Fr,s=null!==(t=null===(i=e.bootstrap)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(s).length){var n,r;const t=null!==(n=null===(r=e.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:{},i=Object.keys(s).filter(t=>!A(s[t])).reduce((t,i)=>(t[i]=s[i],t),{}),o=Object.keys(t).filter(t=>i[t]).reduce((i,e)=>(i[e]=t[e],i),{});return this.Cv({featureFlags:i,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,i,e){var s,n;const r=(null==e?void 0:e.merge)&&null!==(s=this.mv("$enabled_feature_flags"))&&void 0!==s?s:{},o=(null==e?void 0:e.merge)&&null!==(n=this.mv("$feature_flag_payloads"))&&void 0!==n?n:{},l=bi(bi({},r),t),a=bi(bi({},o),i),u={};for(const[t,i]of Object.entries(l))u[t]={key:t,enabled:ve(i),variant:fe(i),reason:void 0,metadata:A(null==a?void 0:a[t])?void 0:{id:0,version:void 0,description:void 0,payload:a[t]}};this.Cv({flags:u})}get hasLoadedFlags(){return this.Pd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.mv(Ks),i=this.mv(on),e=this.mv(ln);if(!e&&!i)return t||{};const s=Ir({},t||{}),n=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(const t of n){var r,o;const n=s[t],l=null==i?void 0:i[t],a=A(l)?null!==(r=null==n?void 0:n.enabled)&&void 0!==r&&r:!!l,u=A(l)?null==n?void 0:n.variant:"string"==typeof l?l:void 0,h=null==e?void 0:e[t],c=bi(bi({},n),{},{enabled:a,variant:a?null!=u?u:null==n?void 0:n.variant:void 0});a!==(null==n?void 0:n.enabled)&&(c.original_enabled=null==n?void 0:n.enabled),u!==(null==n?void 0:n.variant)&&(c.original_variant=null==n?void 0:n.variant),h&&(c.metadata=bi(bi({},null==n?void 0:n.metadata),{},{payload:h,original_payload:null==n||null===(o=n.metadata)||void 0===o?void 0:o.payload})),s[t]=c}return this.Td||(this.R.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:s}),this.Td=!0),s}getAllFeatureFlags(){const t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{const s=t[e];return{key:e,enabled:ve(s),variant:fe(s),payload:de(i[e])}})}getFlagVariants(){const t=this.mv(Qs),i=this.mv(on);if(!i)return t||{};const e=Ir({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.Td||(this.R.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.Td=!0),e}getFlagPayloads(){const t=this.mv(rn),i=this.mv(ln);if(!i)return t||{};const e=Ir({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.Td||(this.R.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.Td=!0),e}reloadFeatureFlags(){this.Dd||this.Fr.featureFlagsDisabled||this.Wd()||(this.Nd&&this.R.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this.Od&&(this.Ld=!0),this.Tv||(this.Ed.slice().forEach(t=>{try{t()}catch(t){this.R.error("Error while running feature flags reloading callback",t)}}),this.Tv=setTimeout(()=>{this.Iv()},5)))}reloadFeatureFlagsAsync(){return!this.Ma||this.Dd||this.Fr.featureFlagsDisabled||this.Fr.remoteRequestsDisabled||this.Wd()?Promise.resolve({status:"skipped"}):new Promise(t=>{this.Ad.add(t),this.reloadFeatureFlags()})}pv(t,i){t.forEach(t=>t({status:i})),t.clear()}gv(){clearTimeout(this.Tv),this.Tv=void 0}onReloading(t){return this.Ed.push(t),()=>{this.Ed=this.Ed.filter(i=>i!==t)}}ensureFlagsLoaded(){this.Pd||this.Od||this.Tv||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Dd=t}resetFlagCallReported(){this.Dt(sn),this.jd=new Map}sendFlagCallsPendingCapture(){var t;if(0!==this.jd.size&&!this.qd&&(null===(t=this.Ma)||void 0===t?void 0:t.canCapture)&&!this.Ma.isRateLimited){this.qd=!0;try{const t=this.getFlagVariants();for(const i of Array.from(this.jd.keys())){const e=this.jd.get(i);if(e){if(e.value!==String(t[i])||!Tc(e.context,this.Mv())){this.jd.delete(i);continue}if(this.getFeatureFlagResult(i),this.jd.has(i))break}}}finally{this.qd=!1}}}Iv(t){var i;this.gv();const e=this.Ma;if(!e||this.Fr.remoteRequestsDisabled||this.Wd())return void this.pv(this.Ad,"skipped");if(this.Od)return void(this.Ld=!0);const s={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:bi(bi(bi({},e.initialPersonProperties),this.mv("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.mv(tn),timezone:kl()};A(e.deviceId)||(s.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Fr.featureFlagsDisabled)&&(s.disable_flags=!0);const n=this.xv();n.length&&(s.evaluation_contexts=n);const r=this.$v();A(r)||(s.flag_keys=r);const o=this.Fr.onlyEvaluateSurveyFeatureFlags,l="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),a=this.Fd,u=this.Ad;this.Ad=new Set,this.Rd=u,this.Od=!0;const h=()=>{this.Ld&&(this.Ld=!1,this.Iv())},c=t=>{var i,e;const n=null!==(i=t.json)&&void 0!==i?i:{},r=200!==t.statusCode;if(this.Od=!1,a!==this.Fd)return void h();if(this.Ev(t.statusCode),r||this.Ld||(this.$anon_distinct_id=void 0),s.disable_flags&&!this.Ld)return void this.pv(u,"skipped");this.Bd=!r;const l=[];t.error?l.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Sc:"unknown_error"):200!==t.statusCode&&l.push(`api_error_${t.statusCode}`),n.errorsWhileComputingFlags&&l.push("errors_while_computing_flags");const c=!!(null===(e=n.quotaLimited)||void 0===e?void 0:e.includes("feature_flags"));c&&l.push("quota_limited"),this.$t({[Js]:l}),c?this.R.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.Cv(n,r,{partialResponse:o}),this.pv(u,s.disable_flags?"skipped":l.length||!n.flags&&!n.featureFlags?"error":"loaded"),h()},d=t=>{this.Od=!1,a===this.Fd?(this.$t({[Js]:[Sc]}),this.R.error("Feature flag request failed",t),this.bv()&&this.hv(!0),this.pv(u,"error"),h()):h()};let v=null!==(i=this.Fr.requestMaxRetries)&&void 0!==i?i:1;const f=()=>v>0&&a===this.Fd,p=()=>{if(a!==this.Fd||!this.Ma||this.Fr.remoteRequestsDisabled)return this.Od=!1,this.pv(u,"skipped"),void h();try{e.sendRequest(l,{target:"flags",method:"POST",body:s,compression:this.Fr.compression,sentAt:"body",timeoutMs:this.Fr.requestTimeoutMs}).then(t=>{if((t=>$c.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&f())return v--,void setTimeout(p,500);c(t)}).catch(d)}catch(t){d(t)}};p()}Wd(){return Pl(this.Hd,3)}Ev(t){this.Hd=Cl(t,this.Hd,3,()=>this.R.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(t,i={}){var e;if(i.fresh&&!this.Bd)return;if(!(this.Pd||this.getFlags()&&this.getFlags().length>0))return void this.R.warn('getFeatureFlag for key "'+t+wc);if(this.Sv())return;const s=this.getFeatureFlagResult(t,i);return null!==(e=null==s?void 0:s.variant)&&void 0!==e?e:null==s?void 0:s.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i={}){if(i.fresh&&!this.Bd)return;if(!(this.Pd||this.getFlags()&&this.getFlags().length>0))return void this.R.warn('getFeatureFlagResult for key "'+t+wc);if(this.Sv())return;const e=this.getFlagVariants(),s=t in e,n=e[t],r=this.getFlagPayloads()[t],o=String(n),l=this.mv("$feature_flag_request_id")||void 0,a=this.mv("$feature_flag_evaluated_at")||void 0;let u,h=this.mv("$flag_call_reported")||{};if(this.Fr.deduplicateCallsPerSession){var c;const t=null===(c=this.Ma)||void 0===c||null===(c=c.session)||void 0===c?void 0:c.sessionId,i=this.mv(nn);t&&t!==i&&(h={},u=t)}if(!i.send_event&&"send_event"in i)u&&this.$t({[sn]:h,[nn]:u});else{var d,v,f;const i=!(null===(d=this.Ma)||void 0===d?void 0:d.canCapture),e=!i&&!(null===(v=this.Ma)||void 0===v?void 0:v.isRateLimited);var p;if(e?this.jd.delete(t):(i&&Object.keys(h).length>0&&(h={},this.$t({[sn]:h})),(null===(p=h[t])||void 0===p?void 0:p.includes(o))||this.Av(t,o)),e&&!(null===(f=h[t])||void 0===f?void 0:f.includes(o))){var g,_,m,y,b,w,x,S,k,T,P,C,F;E(h[t])?h[t].push(o):h[t]=[o],this.$t(bi({[sn]:h},u?{[nn]:u}:{}));const i=this.getFeatureFlagDetails(t),e=[...null!==(g=this.mv("$feature_flag_errors"))&&void 0!==g?g:[]];A(n)&&e.push("flag_missing");const s={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:null!==(_=null===(m=this.Fr.bootstrap)||void 0===m||null===(m=m.featureFlags)||void 0===m?void 0:m[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(y=null===(b=this.Fr.bootstrap)||void 0===b||null===(b=b.featureFlagPayloads)||void 0===b?void 0:b[t])&&void 0!==y?y:null,$used_bootstrap_value:!this.Bd};A(null==i||null===(w=i.metadata)||void 0===w?void 0:w.has_experiment)||(s.$feature_flag_has_experiment=i.metadata.has_experiment),A(null==i||null===(x=i.metadata)||void 0===x?void 0:x.version)||(s.$feature_flag_version=i.metadata.version);const c=null!==(S=null==i||null===(k=i.reason)||void 0===k?void 0:k.description)&&void 0!==S?S:null==i||null===(T=i.reason)||void 0===T?void 0:T.code;c&&(s.$feature_flag_reason=c),(null==i||null===(P=i.metadata)||void 0===P?void 0:P.id)&&(s.$feature_flag_id=i.metadata.id),A(null==i?void 0:i.original_variant)&&A(null==i?void 0:i.original_enabled)||(s.$feature_flag_original_response=A(i.original_variant)?i.original_enabled:i.original_variant),(null==i||null===(C=i.metadata)||void 0===C?void 0:C.original_payload)&&(s.$feature_flag_original_payload=null==i||null===(F=i.metadata)||void 0===F?void 0:F.original_payload),e.length&&(s.$feature_flag_error=e.join(",")),this.Rv(s)||(this.Pv(t,o),this.Av(t,o))}else u&&this.$t({[sn]:h,[nn]:u})}return s?{key:t,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:de(r)}:void 0}Rv(t){try{var i;return!1!==(null===(i=this.Ma)||void 0===i?void 0:i.capture("$feature_flag_called",t))}catch(t){return this.R.error("Failed to capture feature flag call",t),!0}}Av(t,i){this.jd.set(t,{value:i,context:this.Mv()})}Mv(){var t,i,e;return{distinctId:null===(t=this.Ma)||void 0===t?void 0:t.distinctId,groups:bi({},null===(i=this.Ma)||void 0===i?void 0:i.groups),sessionId:this.Fr.deduplicateCallsPerSession?null===(e=this.Ma)||void 0===e||null===(e=e.session)||void 0===e?void 0:e.sessionId:void 0}}Pv(t,i){const e=this.mv("$flag_call_reported")||{},s=e[t];E(s)&&s.includes(i)&&(e[t]=s.filter(t=>t!==i),this.$t({[sn]:e}))}getRemoteConfigPayload(t,i){this.Ov(t,i)}Ov(t,i){var e=this;return J(function*(){const s=e.Ma;if(!s)return;const n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=e.xv();r.length&&(n.evaluation_contexts=r);const o=e.$v();let l;A(o)||(n.flag_keys=o);try{var a;const i=null===(a=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:e.Fr.compression,sentAt:"body",timeoutMs:e.Fr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==i?void 0:i[t])||void 0}catch(t){return void e.R.error("Remote config feature flag request failed",t)}try{i(l)}catch(t){e.R.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,i={}){if(i.fresh&&!this.Bd)return i.defaultValue;if(!(this.Pd||this.getFlags()&&this.getFlags().length>0))return this.R.warn('isFeatureEnabled for key "'+t+wc),i.defaultValue;const e=this.getFeatureFlag(t,i);return A(e)?i.defaultValue:!!e}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(i=>i!==t)}receivedFeatureFlags(t,i,e){this.Cv(t,i,e)}Cv(t,i,e){if(!this.Ma)return;this.Pd=!0;const s=((t,i={},e={},s={},n,r=yc)=>{const o=((t,i)=>{const e=t.flags;if(e){const i=Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]})),s=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return!A(null===(i=e[t].metadata)||void 0===i?void 0:i.payload)}).map(t=>{var i;return[t,null===(i=e[t].metadata)||void 0===i?void 0:i.payload]}));return bi(bi({},t),{},{featureFlags:i,featureFlagPayloads:s})}return t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,r),l=o.flags,a=o.featureFlags,u=o.featureFlagPayloads;if(!a)return;const h=t.requestId,c=t.evaluatedAt;if(E(a)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const t={};if(a)for(let i=0;a.length>i;i++)t[a[i]]=!0;return{[Gs]:a,[Qs]:t,[Xs]:!1}}let d=a,v=u,f=l;if(null==n?void 0:n.partialResponse){const t=Object.keys(d),n=v||{};d=bi(bi({},i),d),v=bi(bi({},e),n),t.forEach(t=>{t in n||null==v||delete v[t]}),f=bi(bi({},s),f)}else if(t.errorsWhileComputingFlags)if(l){const t=new Set(Object.keys(l).filter(t=>{var i;return!(null===(i=l[t])||void 0===i?void 0:i.failed)}));d=bi(bi({},i),Object.fromEntries(Object.entries(d).filter(([i])=>t.has(i))));const n=Object.fromEntries(Object.entries(v||{}).filter(([i])=>t.has(i)));v=bi(bi({},e),n),t.forEach(t=>{t in n||null==v||delete v[t]}),f=bi(bi({},s),Object.fromEntries(Object.entries(f||{}).filter(([i])=>t.has(i))))}else d=bi(bi({},i),d),v=bi(bi({},e),v),f=bi(bi({},s),f);return bi(bi({[Gs]:Object.keys(Ec(d)),[Qs]:d||{},[rn]:v||{},[Ks]:f||{},[Xs]:!0===t.minimalFlagCalledEvents},h?{[Zs]:h}:{}),c?{[Ys]:c}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.R);if(s)if(!1===(null==e?void 0:e.persist)){const t=!A(this.Ma.kv.get(Qs));this.yv=s,t||this.$t(s)}else this.lv(),this.wv(s,t,!!(null==e?void 0:e.partialResponse)),this.$t(s);else i&&this.bv();i||(this.zd=!1),this.hv(i)}override(t,i=!1){this.R.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Fv(t)}Fv(t){if(this.Ma){if(!1===t)return this.Dt([on,ln]),this.hv(),void bc.info("All overrides cleared");if(E(t))return this.$t({[on]:kc(t)}),this.hv(),void bc.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i;const e=t;this.Td=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);const s={},n=e.flags,r=e.payloads;return n&&(s[on]=E(n)?kc(n):n),r&&(s[ln]=r),Object.keys(s).length&&this.$t(s),!1===n&&!1===r?this.Dt([on,ln]):!1===n?this.Dt(on):!1===r&&this.Dt(ln),this.hv(),!1===n?bc.info("Flag overrides cleared"):n&&bc.info("Flag overrides set",{flags:n}),void(!1===r?bc.info("Payload overrides cleared"):r&&bc.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.$t({[on]:t}),this.hv(),void bc.info("Flag overrides set",{flags:t});this.R.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.R.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Pd){const{flags:i,flagVariants:e}=this.Dv();try{t(i,e)}catch(t){this.R.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var s;const n=(this.mv("$early_access_features")||[]).find(i=>i.flagKey===t),r={[`$feature_enrollment/${t}`]:i},o={$feature_flag:t,$feature_enrollment:i,$set:r};n&&(o.$early_access_feature_name=n.name),e&&(o.$feature_enrollment_stage=e);const l=bi(bi({},this.getFlagVariants()),{},{[t]:i});null===(s=this.tv)||void 0===s||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.$t({[Gs]:Object.keys(Ec(l)),[Qs]:l,[en]:bi(bi({},this.mv("$stored_person_properties")||{}),r)}),this.hv();try{var a;null===(a=this.Ma)||void 0===a||a.capture("$feature_enrollment_update",o)}catch(t){this.R.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i=!1,e){const s=this.mv(Vs);!s||i?this.Lv(t,e):t(s)}Lv(t,i){var e=this;return J(function*(){const s=e.Ma;if(!s)return;const n=i?`&${i.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,e.$t({[Vs]:r})}catch(t){return void e.R.error("Early access feature request failed",t)}try{t(r)}catch(t){e.R.error("Early access feature callback failed",t)}})()}Dv(){const t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter(t=>i[t]),flagVariants:Object.keys(i).filter(t=>i[t]).reduce((t,e)=>(t[e]=i[e],t),{})}}hv(t){this.uv();const{flags:i,flagVariants:e}=this.Dv(),s=this.Nd;this.Nd=!0,this.featureFlagEventHandlers.forEach(s=>{try{s(i,e,{errorsLoading:t})}catch(t){this.R.error("Error while running feature flags callback",t)}}),this.Nd=s}setPersonPropertiesForFlags(t,i=!0){this.Nv(t,i)}Nv(t,i=!0){const e=this.mv("$stored_person_properties")||{},s=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),n=null==t?void 0:t.$set_once,r={};if(n)for(const t in n)({}).hasOwnProperty.call(n,t)&&(t in e||(r[t]=n[t]));this.$t({[en]:bi(bi(bi({},e),r),s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i=!0){const e=bi({},this.mv("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.$t({[en]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Dt(en),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i=!0){const e=this.mv("$stored_group_properties")||{},s=bi({},e);for(const i of Object.keys(t))s[i]=bi(bi({},e[i]),t[i]);this.$t({[tn]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const i=this.mv("$stored_group_properties")||{};this.$t({[tn]:bi(bi({},i),{},{[t]:{}})})}else this.Dt(tn)}reset(){this.Fd++,this.pv(this.Ad,"cancelled"),this.pv(this.Rd,"cancelled"),this.Ld=!1,this.Id={},this.Md={},this.yv=void 0,this.Pd=!1,this.Dd=!1,this.Bd=!1,this.$anon_distinct_id=void 0,this.gv(),this.Td=!1,this.Hd=0,this.jd=new Map}};const Cc=Ns("[FeatureFlags]");var Ac=class{constructor(t,i=!1){this.jv=!1,this.update(t,i)}update(t,i){this.qv=((t,i)=>{var e,s,n,r,o,l,a,u;return{bootstrap:{featureFlags:null!==(e=null===(s=t.bootstrap)||void 0===s?void 0:s.featureFlags)&&void 0!==e?e:void 0,featureFlagPayloads:null!==(n=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:A(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(l=t.feature_flag_request_max_retries)&&void 0!==l?l:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(a=null!==(u=t.evaluation_contexts)&&void 0!==u?u:t.evaluation_environments)&&void 0!==a?a:[],flagKeys:E(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.jv||(Cc.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.jv=!0),A(t.flag_keys)||E(t.flag_keys)||Cc.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.qv}},Fc=class extends Pc{constructor(t){const i=new Ac(t.config,t.ec());super(i),this.name=ch,this._instance=t,this.Bv=i}get tv(){return this._instance.persistence}updateConfig(t,i){this.Bv.update(t,i),this.ev()}};const Oc=t=>U(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Mc=Ns("[Error tracking]"),Rc="webkit-masked-url:",Ic=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Dc=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Rc],jc=["__firefox__","__gCrWeb"];function Lc(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);i>e;e++)s[e]=t[e];return s}function Nc(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,i){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var s,n,r,o,l=[],a=!0,u=!1;try{if(r=(e=e.call(t)).next,0===i);else for(;!(a=(s=r.call(e)).done)&&(l.push(s.value),l.length!==i);a=!0);}catch(t){u=!0,n=t}finally{try{if(!a&&null!=e.return&&(o=e.return(),Object(o)!==o))return}finally{if(u)throw n}}return l}}(t,i)||function(t,i){if(t){if("string"==typeof t)return Lc(t,i);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Lc(t,i):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const zc=Object.entries,Bc=Object.setPrototypeOf,Uc=Object.isFrozen,Hc=Object.getPrototypeOf,qc=Object.getOwnPropertyDescriptor;let Wc=Object.freeze,Vc=Object.seal,Gc=Object.create,Kc="undefined"!=typeof Reflect&&Reflect,Jc=Kc.apply,Yc=Kc.construct;Wc||(Wc=function(t){return t}),Vc||(Vc=function(t){return t}),Jc||(Jc=function(t,i){for(var e=arguments.length,s=new Array(e>2?e-2:0),n=2;e>n;n++)s[n-2]=arguments[n];return t.apply(i,s)}),Yc||(Yc=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),s=1;i>s;s++)e[s-1]=arguments[s];return new t(...e)});const Zc=md([].forEach),Xc=md([].lastIndexOf),Qc=md([].pop),td=md([].push),id=md([].splice),ed=Array.isArray,sd=md("".toLowerCase),nd=md("".toString),rd=md("".match),od=md("".replace),ld=md("".indexOf),ad=md("".trim),ud=md((0).toString),hd=md(Boolean.prototype.toString),cd="undefined"==typeof BigInt?null:md(BigInt.prototype.toString),dd="undefined"==typeof Symbol?null:md(Symbol.prototype.toString),vd=md({}.hasOwnProperty),fd=md({}.toString),pd=md(/t/.test),gd=(_d=TypeError,function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return Yc(_d,i)});var _d;function md(t){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;e>n;n++)s[n-1]=arguments[n];return Jc(t,i,s)}}function yd(t,i){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:sd;if(Bc&&Bc(t,null),!ed(i))return t;let s=i.length;for(;s--;){let n=i[s];if("string"==typeof n){const t=e(n);t!==n&&(Uc(i)||(i[s]=t),n=t)}t[n]=!0}return t}function bd(t){for(let i=0;t.length>i;i++)vd(t,i)||(t[i]=null);return t}function wd(t){const i=Gc(null);for(const s of zc(t)){var e=Nc(s,2);const n=e[0],r=e[1];vd(t,n)&&(i[n]=ed(r)?bd(r):r&&"object"==typeof r&&r.constructor===Object?wd(r):r)}return i}function $d(t,i){for(;null!==t;){const e=qc(t,i);if(e){if(e.get)return md(e.get);if("function"==typeof e.value)return md(e.value)}t=Hc(t)}return function(){return null}}const xd=Wc(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Sd=Wc(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),kd=Wc(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ed=Wc(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Td=Wc(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Pd=Wc(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Cd=Wc(["#text"]),Ad=Wc(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Fd=Wc(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Od=Wc(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Md=Wc(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Rd=Vc(/{{[\w\W]*|^[\w\W]*}}/g),Id=Vc(/<%[\w\W]*|^[\w\W]*%>/g),Dd=Vc(/\${[\w\W]*/g),jd=Vc(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ld=Vc(/^aria-[\-\w]+$/),Nd=Vc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),zd=Vc(/^(?:\w+script|data):/i),Bd=Vc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ud=Vc(/^html$/i),Hd=Vc(/^[a-z][.\w]*(-[.\w]+)+$/i),qd=Vc(/<[/\w!]/g),Wd=Vc(/<[/\w]/g),Vd=Vc(/<\/no(script|embed|frames)/i),Gd=Vc(/\/>/i),Kd=function(){return"undefined"==typeof window?null:window},Jd=function(t,i,e,s){return vd(t,i)&&ed(t[i])?yd(s.base?wd(s.base):{},t[i],s.transform):e};var Yd=function t(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Kd();const e=i=>t(i);if(e.version="3.4.13",e.removed=[],!i||!i.document||9!==i.document.nodeType||!i.Element)return e.isSupported=!1,e;let s=i.document;const n=s,r=n.currentScript,o=i.HTMLTemplateElement,l=i.Node,a=i.NodeFilter,u=i.DOMParser,h=i.trustedTypes,c=i.Element.prototype,d=$d(c,"cloneNode"),v=$d(c,"remove"),f=$d(c,"nextSibling"),p=$d(c,"childNodes"),g=$d(c,"parentNode"),_=$d(c,"shadowRoot"),m=$d(c,"attributes"),y=l&&l.prototype?$d(l.prototype,"nodeType"):null,b=l&&l.prototype?$d(l.prototype,"nodeName"):null,w=l&&l.prototype?$d(l.prototype,"ownerDocument"):null;if("function"==typeof o){const t=s.createElement("template");t.content&&t.content.ownerDocument&&(s=t.content.ownerDocument)}let x,S,k="",E=!1,T=0;const P=function(){if(T>0)throw gd('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},C=function(t){P(),T++;try{return x.createHTML(t)}finally{T--}},A=s.implementation,F=s.createNodeIterator,O=s.createDocumentFragment,M=s.getElementsByTagName,R=n.importNode;let I={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};e.isSupported="function"==typeof zc&&"function"==typeof g&&A&&void 0!==A.createHTMLDocument;const D=Rd,j=Id,L=Dd,N=jd,z=Ld,B=zd,U=Bd,H=Hd;let q=Nd,W=null;const V=yd({},[...xd,...Sd,...kd,...Td,...Cd]);let G=null;const K=yd({},[...Ad,...Fd,...Od,...Md]);let J=Object.seal(Gc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Y=null,Z=null;const X=Object.seal(Gc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Q=!0,tt=!0,it=!1,et=!0,st=!1,nt=!0,rt=!1,ot=!1,lt=null,at=null,ut=!1,ht=!1,ct=!1,dt=!1,vt=!0,ft=!1;const pt="user-content-";let gt=!0,_t=!1,mt={},yt=null;const bt=yd({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let wt=null;const $t=yd({},["audio","video","img","source","image","track"]);let xt=null;const St=yd({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kt="http://www.w3.org/1998/Math/MathML",Et="http://www.w3.org/2000/svg",Tt="http://www.w3.org/1999/xhtml";let Pt=Tt,Ct=!1,At=null;const Ft=yd({},[kt,Et,Tt],nd),Ot=Wc(["mi","mo","mn","ms","mtext"]);let Mt=yd({},Ot);const Rt=Wc(["annotation-xml"]);let It=yd({},Rt);const Dt=yd({},["title","style","font","a","script"]);let jt=null;const Lt=["application/xhtml+xml","text/html"];let Nt=null,zt=null;const Bt=s.createElement("form"),Ut=function(t){return t instanceof RegExp||t instanceof Function},Ht=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(zt&&zt===t)return;t&&"object"==typeof t||(t={}),t=wd(t),jt=-1===Lt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Nt="application/xhtml+xml"===jt?nd:sd,W=Jd(t,"ALLOWED_TAGS",V,{transform:Nt}),G=Jd(t,"ALLOWED_ATTR",K,{transform:Nt}),At=Jd(t,"ALLOWED_NAMESPACES",Ft,{transform:nd}),xt=Jd(t,"ADD_URI_SAFE_ATTR",St,{transform:Nt,base:St}),wt=Jd(t,"ADD_DATA_URI_TAGS",$t,{transform:Nt,base:$t}),yt=Jd(t,"FORBID_CONTENTS",bt,{transform:Nt}),Y=Jd(t,"FORBID_TAGS",wd({}),{transform:Nt}),Z=Jd(t,"FORBID_ATTR",wd({}),{transform:Nt}),mt=!!vd(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?wd(t.USE_PROFILES):t.USE_PROFILES),Q=!1!==t.ALLOW_ARIA_ATTR,tt=!1!==t.ALLOW_DATA_ATTR,it=t.ALLOW_UNKNOWN_PROTOCOLS||!1,et=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,st=t.SAFE_FOR_TEMPLATES||!1,nt=!1!==t.SAFE_FOR_XML,rt=t.WHOLE_DOCUMENT||!1,ht=t.RETURN_DOM||!1,ct=t.RETURN_DOM_FRAGMENT||!1,dt=t.RETURN_TRUSTED_TYPE||!1,ut=t.FORCE_BODY||!1,vt=!1!==t.SANITIZE_DOM,ft=t.SANITIZE_NAMED_PROPS||!1,gt=!1!==t.KEEP_CONTENT,_t=t.IN_PLACE||!1,q=function(t){try{return pd(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:Nd,Pt="string"==typeof t.NAMESPACE?t.NAMESPACE:Tt,Mt=vd(t,"MATHML_TEXT_INTEGRATION_POINTS")&&t.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof t.MATHML_TEXT_INTEGRATION_POINTS?wd(t.MATHML_TEXT_INTEGRATION_POINTS):yd({},Ot),It=vd(t,"HTML_INTEGRATION_POINTS")&&t.HTML_INTEGRATION_POINTS&&"object"==typeof t.HTML_INTEGRATION_POINTS?wd(t.HTML_INTEGRATION_POINTS):yd({},Rt);const i=vd(t,"CUSTOM_ELEMENT_HANDLING")&&t.CUSTOM_ELEMENT_HANDLING&&"object"==typeof t.CUSTOM_ELEMENT_HANDLING?wd(t.CUSTOM_ELEMENT_HANDLING):Gc(null);if(J=Gc(null),vd(i,"tagNameCheck")&&Ut(i.tagNameCheck)&&(J.tagNameCheck=i.tagNameCheck),vd(i,"attributeNameCheck")&&Ut(i.attributeNameCheck)&&(J.attributeNameCheck=i.attributeNameCheck),vd(i,"allowCustomizedBuiltInElements")&&"boolean"==typeof i.allowCustomizedBuiltInElements&&(J.allowCustomizedBuiltInElements=i.allowCustomizedBuiltInElements),Vc(J),st&&(tt=!1),ct&&(ht=!0),mt&&(W=yd({},Cd),G=Gc(null),!0===mt.html&&(yd(W,xd),yd(G,Ad)),!0===mt.svg&&(yd(W,Sd),yd(G,Fd),yd(G,Md)),!0===mt.svgFilters&&(yd(W,kd),yd(G,Fd),yd(G,Md)),!0===mt.mathMl&&(yd(W,Td),yd(G,Od),yd(G,Md))),X.tagCheck=null,X.attributeCheck=null,vd(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?X.tagCheck=t.ADD_TAGS:ed(t.ADD_TAGS)&&(W===V&&(W=wd(W)),yd(W,t.ADD_TAGS,Nt))),vd(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?X.attributeCheck=t.ADD_ATTR:ed(t.ADD_ATTR)&&(G===K&&(G=wd(G)),yd(G,t.ADD_ATTR,Nt))),vd(t,"ADD_URI_SAFE_ATTR")&&ed(t.ADD_URI_SAFE_ATTR)&&yd(xt,t.ADD_URI_SAFE_ATTR,Nt),vd(t,"FORBID_CONTENTS")&&ed(t.FORBID_CONTENTS)&&(yt===bt&&(yt=wd(yt)),yd(yt,t.FORBID_CONTENTS,Nt)),vd(t,"ADD_FORBID_CONTENTS")&&ed(t.ADD_FORBID_CONTENTS)&&(yt===bt&&(yt=wd(yt)),yd(yt,t.ADD_FORBID_CONTENTS,Nt)),gt&&(W["#text"]=!0),rt&&yd(W,["html","head","body"]),W.table&&(yd(W,["tbody"]),delete Y.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw gd('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw gd('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const i=x;x=t.TRUSTED_TYPES_POLICY;try{k=C("")}catch(t){throw x=i,t}}else null===t.TRUSTED_TYPES_POLICY?(x=void 0,k=""):(void 0===x&&(E||(S=function(t,i){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let e=null;const s="data-tt-policy-suffix";i&&i.hasAttribute(s)&&(e=i.getAttribute(s));const n="dompurify"+(e?"#"+e:"");try{return t.createPolicy(n,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+n+" could not be created."),null}}(h,r),E=!0),x=S),x&&"string"==typeof k&&(k=C("")));Wc&&Wc(t),zt=t},qt=yd({},[...Sd,...kd,...Ed]),Wt=yd({},[...Td,...Pd]),Vt=function(t){td(e.removed,{element:t});try{g(t).removeChild(t)}catch(i){if(v(t),!g(t))throw gd("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Gt=function(t){Yt(t);const i=p(t);if(i){const t=[];Zc(i,i=>{td(t,i)}),Zc(t,t=>{try{v(t)}catch(t){}})}const e=m(t);if(e)for(let i=e.length-1;i>=0;--i){const s=e[i],n=s&&s.name;if("string"==typeof n)try{t.removeAttribute(n)}catch(t){}}},Kt=function(t,i){try{td(e.removed,{attribute:i.getAttributeNode(t),from:i})}catch(t){td(e.removed,{attribute:null,from:i})}if(i.removeAttribute(t),"is"===t)if(ht||ct)try{Vt(i)}catch(t){}else try{i.setAttribute(t,"")}catch(t){}},Jt=function(t){const i=m(t);if(i)for(let e=i.length-1;e>=0;--e){const s=i[e],n=s&&s.name;if("string"==typeof n&&!G[Nt(n)])try{t.removeAttribute(n)}catch(t){}}},Yt=function(t){const i=[t];for(;i.length>0;){const t=i.pop();1===(y?y(t):t.nodeType)&&Jt(t);const e=p(t);if(e)for(let t=e.length-1;t>=0;--t)i.push(e[t])}},Zt=function(t){let i=null,e=null;if(ut)t="<remove></remove>"+t;else{const i=rd(t,/^[\r\n\t ]+/);e=i&&i[0]}"application/xhtml+xml"===jt&&Pt===Tt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const n=x?C(t):t;if(Pt===Tt)try{i=(new u).parseFromString(n,jt)}catch(t){}if(!i||!i.documentElement){i=A.createDocument(Pt,"template",null);try{i.documentElement.innerHTML=Ct?k:n}catch(t){}}const r=i.body||i.documentElement;return t&&e&&r.insertBefore(s.createTextNode(e),r.childNodes[0]||null),Pt===Tt?M.call(i,rt?"html":"body")[0]:rt?i.documentElement:r},Xt=function(t){const i=w?w(t):t.ownerDocument;return F.call(i||t,t,a.SHOW_ELEMENT|a.SHOW_COMMENT|a.SHOW_TEXT|a.SHOW_PROCESSING_INSTRUCTION|a.SHOW_CDATA_SECTION,null)},Qt=function(t){return t=od(t,D," "),t=od(t,j," "),od(t,L," ")},ti=function(t){var i;t.normalize();const e=w?w(t):t.ownerDocument,s=F.call(e||t,t,a.SHOW_TEXT|a.SHOW_COMMENT|a.SHOW_CDATA_SECTION|a.SHOW_PROCESSING_INSTRUCTION,null);let n=s.nextNode();for(;n;)n.data=Qt(n.data),n=s.nextNode();const r=null===(i=t.querySelectorAll)||void 0===i?void 0:i.call(t,"template");r&&Zc(r,t=>{ei(t.content)&&ti(t.content)})},ii=function(t){const i=b?b(t):null;return"string"==typeof i&&"form"===Nt(i)&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||t.attributes!==m(t)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes||t.nodeType!==y(t)||t.childNodes!==p(t))},ei=function(t){if(!y||"object"!=typeof t||null===t)return!1;try{return 11===y(t)}catch(t){return!1}},si=function(t){if(!y||"object"!=typeof t||null===t)return!1;try{return"number"==typeof y(t)}catch(t){return!1}};function ni(t,i,s){0!==t.length&&Zc(t,t=>{t.call(e,i,s,zt)})}const ri=function(t,i,e,s){return 0===t.length?i:i===e||i===s?wd(i):i},oi=function(t,i){if(ni(I.beforeSanitizeElements,t,null),t!==i&&null===g(t))return _t&&Yt(t),!0;if(ii(t))return Vt(t),!0;const s=Nt(b?b(t):t.nodeName);if(W=ri(I.uponSanitizeElement,W,V,lt),ni(I.uponSanitizeElement,t,{tagName:s,allowedTags:W}),t!==i&&null===g(t))return _t&&Yt(t),!0;if(function(t,i){return!!(nt&&t.hasChildNodes()&&!si(t.firstElementChild)&&pd(qd,t.textContent)&&pd(qd,t.innerHTML))||!(!nt||t.namespaceURI!==Tt||"style"!==i||!si(t.firstElementChild))||7===t.nodeType||!(!nt||8!==t.nodeType||!pd(Wd,t.data))}(t,s))return Vt(t),!0;if(Y[s]||!(X.tagCheck instanceof Function&&X.tagCheck(s))&&!W[s]){const e=function(t,i,e){if(!Y[i]&&ui(i)){if(J.tagNameCheck instanceof RegExp&&pd(J.tagNameCheck,i))return!1;if(J.tagNameCheck instanceof Function&&J.tagNameCheck(i))return!1}if(gt&&!yt[i]){const i=g(t),s=p(t);if(s&&i)for(let n=s.length-1;n>=0;--n){const r=t===e?d(s[n],!0):s[n];i.insertBefore(r,f(t))}}return Vt(t),!0}(t,s,i);return!1===e&&ni(I.afterSanitizeElements,t,null),e}if(1===(y?y(t):t.nodeType)&&!function(t){let i=g(t);i&&i.tagName||(i={namespaceURI:Pt,tagName:"template"});const e=sd(t.tagName),s=sd(i.tagName);return!!At[t.namespaceURI]&&(t.namespaceURI===Et?function(t,i,e){return i.namespaceURI===Tt?"svg"===t:i.namespaceURI===kt?"svg"===t&&("annotation-xml"===e||Mt[e]):Boolean(qt[t])}(e,i,s):t.namespaceURI===kt?function(t,i,e){return i.namespaceURI===Tt?"math"===t:i.namespaceURI===Et?"math"===t&&It[e]:Boolean(Wt[t])}(e,i,s):t.namespaceURI===Tt?function(t,i,e){return!(i.namespaceURI===Et&&!It[e])&&!(i.namespaceURI===kt&&!Mt[e])&&!Wt[t]&&(Dt[t]||!qt[t])}(e,i,s):!("application/xhtml+xml"!==jt||!At[t.namespaceURI]))}(t))return Vt(t),!0;if(("noscript"===s||"noembed"===s||"noframes"===s)&&pd(Vd,t.innerHTML))return Vt(t),!0;if(st&&3===t.nodeType){const i=Qt(t.textContent);t.textContent!==i&&(td(e.removed,{element:t.cloneNode()}),t.textContent=i)}return ni(I.afterSanitizeElements,t,null),!1},li=function(t,i,e){if(Z[i])return!1;if(nt&&"patchsrc"===i)return!1;if(nt&&"for"===i&&"label"!==t&&"output"!==t)return!1;if(vt&&("id"===i||"name"===i)&&(e in s||e in Bt))return!1;const n=G[i]||X.attributeCheck instanceof Function&&X.attributeCheck(i,t);if(tt&&pd(N,i));else if(Q&&pd(z,i));else if(n){if(xt[i]);else if(pd(q,od(e,U,"")));else if("src"!==i&&"xlink:href"!==i&&"href"!==i||"script"===t||0!==ld(e,"data:")||!wt[t])if(it&&!pd(B,od(e,U,"")));else if(e)return!1}else if(!(ui(t)&&(J.tagNameCheck instanceof RegExp&&pd(J.tagNameCheck,t)||J.tagNameCheck instanceof Function&&J.tagNameCheck(t))&&(J.attributeNameCheck instanceof RegExp&&pd(J.attributeNameCheck,i)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(i,t))||"is"===i&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&pd(J.tagNameCheck,e)||J.tagNameCheck instanceof Function&&J.tagNameCheck(e))))return!1;return!0},ai=yd({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ui=function(t){return!ai[sd(t)]&&pd(H,t)},hi=function(t,i,e,s){if(x&&"object"==typeof h&&"function"==typeof h.getAttributeType&&!e)switch(h.getAttributeType(t,i)){case"TrustedHTML":return C(s);case"TrustedScriptURL":return function(t){P(),T++;try{return x.createScriptURL(t)}finally{T--}}(s)}return s},ci=function(t,i,s,n){try{s?t.setAttributeNS(s,i,n):t.setAttribute(i,n),ii(t)?Vt(t):Qc(e.removed)}catch(e){Kt(i,t)}},di=function(t){ni(I.beforeSanitizeAttributes,t,null);const i=t.attributes;if(!i||ii(t))return;G=ri(I.uponSanitizeAttribute,G,K,at);const e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:G,forceKeepAttr:void 0};let s=i.length;const n=Nt(t.nodeName);for(;s--;){const r=i[s],o=r.name,l=r.namespaceURI,a=r.value,u=Nt(o),h=a;let c="value"===o?h:ad(h);e.attrName=u,e.attrValue=c,e.keepAttr=!0,e.forceKeepAttr=void 0,ni(I.uponSanitizeAttribute,t,e),c=e.attrValue,!ft||"id"!==u&&"name"!==u||0===ld(c,pt)||(Kt(o,t),c=pt+c),nt&&pd(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,c)||"attributename"===u&&rd(c,"href")?Kt(o,t):e.forceKeepAttr||(!e.keepAttr||!et&&pd(Gd,c)?Kt(o,t):(st&&(c=Qt(c)),li(n,u,c)?(c=hi(n,u,l,c),c!==h&&ci(t,o,l,c)):Kt(o,t)))}ni(I.afterSanitizeAttributes,t,null)},vi=function(t){let i=null;const e=Xt(t);for(ni(I.beforeSanitizeShadowDOM,t,null);i=e.nextNode();)if(ni(I.uponSanitizeShadowNode,i,null),oi(i,t),di(i),ei(i.content)&&vi(i.content),1===(y?y(i):i.nodeType)){const t=_(i);ei(t)&&(fi(t),vi(t))}ni(I.afterSanitizeShadowDOM,t,null)},fi=function(t){const i=[{node:t,shadow:null}];for(;i.length>0;){const t=i.pop();if(t.shadow){vi(t.shadow);continue}const e=t.node,s=1===(y?y(e):e.nodeType),n=p(e);if(n)for(let t=n.length-1;t>=0;--t)i.push({node:n[t],shadow:null});if(s){const t=b?b(e):null;if("string"==typeof t&&"template"===Nt(t)){const t=e.content;ei(t)&&i.push({node:t,shadow:null})}}if(s){const t=_(e);ei(t)&&i.push({node:null,shadow:t},{node:t,shadow:null})}}};return e.sanitize=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=null,r=null,o=null,l=null;if(Ct=!t,Ct&&(t="\x3c!--\x3e"),"string"!=typeof t&&!si(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return ud(t);case"boolean":return hd(t);case"bigint":return cd?cd(t):"0";case"symbol":return dd?dd(t):"Symbol()";case"undefined":default:return fd(t);case"function":case"object":{if(null===t)return fd(t);const i=t,e=$d(i,"toString");if("function"==typeof e){const t=e(i);return"string"==typeof t?t:fd(t)}return fd(t)}}}(t)))throw gd("dirty is not a string, aborting");if(!e.isSupported)return t;ot?(W=lt,G=at):Ht(i),(I.uponSanitizeElement.length>0||I.uponSanitizeAttribute.length>0)&&(W=wd(W)),I.uponSanitizeAttribute.length>0&&(G=wd(G)),e.removed=[];const a=_t&&"string"!=typeof t&&si(t);if(a){!function(t){if(!nt)return;const i=[t];for(;i.length>0;){const t=i.pop(),e=y?y(t):t.nodeType;if(7===e||8===e&&pd(Wd,t.data)){try{v(t)}catch(t){}continue}if(1===e){const i=t,e=Nt(b?b(t):t.nodeName);try{i.hasAttribute&&i.hasAttribute("patchsrc")&&i.removeAttribute("patchsrc"),i.hasAttribute&&i.hasAttribute("for")&&"label"!==e&&"output"!==e&&i.removeAttribute("for")}catch(t){}}const s=p(t);if(s)for(let t=s.length-1;t>=0;--t)i.push(s[t])}}(t);const i=b?b(t):t.nodeName;if("string"==typeof i){const e=Nt(i);if(!W[e]||Y[e])throw Gt(t),gd("root node is forbidden and cannot be sanitized in-place")}if(ii(t))throw Gt(t),gd("root node is clobbered and cannot be sanitized in-place");try{fi(t)}catch(i){throw Gt(t),i}}else if(si(t))s=Zt("\x3c!----\x3e"),r=s.ownerDocument.importNode(t,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?s=r:s.appendChild(r),fi(r);else{if(!ht&&!st&&!rt&&-1===t.indexOf("<"))return x&&dt?C(t):t;if(s=Zt(t),!s)return ht?null:dt?k:""}s&&ut&&Vt(s.firstChild);const u=a?t:s;try{const t=Xt(u);for(;o=t.nextNode();)oi(o,u),di(o),ei(o.content)&&vi(o.content)}catch(i){throw a&&(Gt(t),Zc(e.removed,t=>{t.element&&Yt(t.element)})),i}if(a)return Zc(e.removed,t=>{t.element&&Yt(t.element)}),st&&ti(t),t;if(ht){if(st&&ti(s),ct)for(l=O.call(s.ownerDocument);s.firstChild;)l.appendChild(s.firstChild);else l=s;return(G.shadowroot||G.shadowrootmode)&&(l=R.call(n,l,!0)),l}let h=rt?s.outerHTML:s.innerHTML;return rt&&W["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&pd(Ud,s.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+s.ownerDocument.doctype.name+">\n"+h),st&&(h=Qt(h)),x&&dt?C(h):h},e.setConfig=function(){Ht(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ot=!0,lt=W,at=G},e.clearConfig=function(){zt=null,ot=!1,lt=null,at=null,x=S,k=""},e.isValidAttribute=function(t,i,e){zt||Ht({});const s=Nt(t),n=Nt(i);return li(s,n,e)},e.addHook=function(t,i){"function"==typeof i&&vd(I,t)&&td(I[t],i)},e.removeHook=function(t,i){if(vd(I,t)){if(void 0!==i){const e=Xc(I[t],i);return-1===e?void 0:id(I[t],e,1)[0]}return Qc(I[t])}},e.removeHooks=function(t){vd(I,t)&&(I[t]=[])},e.removeAllHooks=function(){I={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},e}();const Zd="Refusing to render web experiment since the viewer is a likely bot",Xd={ADD_ATTR:(t,i)=>"target"===t&&"a"===i||"form"===t&&/^(button|fieldset|input|output|select|textarea)$/.test(i),ADD_URI_SAFE_ATTR:["form"]};let Qd;const tv={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>ju(i,t),not_regex:(t,i)=>!ju(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},iv=Ns("[Conversations]"),ev="Conversations not available yet.";function sv(t,i){var e,s,n,r,o,l,a;const u=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,h=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,c=(null==i?void 0:i.consoleCapture)?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,d=A(c)?Math.max(h,2048):Math.max(h,c),v=bi(bi({},function(){let t="",i="";try{var e;const s="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,n=null==s||null===(e=s.navigator)||void 0===e?void 0:e.userAgent;n&&([t,i]=Xt(n))}catch(t){}return function(t,i){const e=function(t){if(t)return{}.hasOwnProperty.call(_s,t)?_s[t]:t}(t);return bi(bi({},e?{"os.name":e}:{}),i?{"os.version":i}:{})}(t,i)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(r=null!==(o=null==v?void 0:v["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==r?r:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==v?void 0:v["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(a=null==v?void 0:v["deployment.environment"])&&void 0!==a?a:null==t?void 0:t.environment,resourceAttributes:v,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const nv=["debug","log","warn","error","info"],rv=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},ov="console",lv="__posthogHandledLogsRequestError",av=(t,i)=>{const e=t instanceof Error?t:new Error(i);return e[lv]=!0,e},uv=t=>!!t&&"object"==typeof t&&!0===t[lv];var hv=class{get zv(){return bi(bi({},this.R),{},{error:(...t)=>{t.some(uv)||this.R.error(...t)}})}constructor(t,i){var e;this.Ra=t,this.Hv=i,this.name="logs",this.Uv=!1,this.Wv=!1,this.Vv=!1,this.R=Ns("[logs]"),this.sc=[],this.Gv=[],this.Hd=0,this.Qv=!1,this.Ti=!1,this.Jv=[],this.Zv=[],this.Kv=!1,this.Yv=!1,this.Xv=!1,this.tf=()=>{var t,i;this.Ti||(this.Hd=0,null===(t=this.ef)||void 0===t||t.onReconnect(),null===(i=this.if)||void 0===i||i.onReconnect())},this.Uv=!!(null===(e=t.get())||void 0===e?void 0:e.captureConsoleLogs)}get nf(){return!0}sf(){}rf(){if(!this.Xv){try{this.nv=typeof window>"u"?void 0:window}catch(t){this.nv=void 0}this.nv&&(Ur(this.nv,"online",this.tf),this.Xv=!0)}}af(t,i,e,s){this.rf();const n=sv(this.Ra.get(),e);return[new Ts(this.lf(t,i),n,this.zv,()=>this.Hv(),t=>t(),void 0,s),n]}uf(){const t=this.Ra.get();var i;return this.ef&&this.cf===t||(null===(i=this.ef)||void 0===i||i.reset(),this.cf=t,[this.ef,this.hf]=this.af(()=>this.sc,t=>{this.sc=t})),this.ef}df(){const t=this.Ra.get();var i;return this.if&&this.vf===t||(null===(i=this.if)||void 0===i||i.reset(),this.vf=t,[this.if,this.ff]=this.af(()=>this.Gv,t=>{this.Gv=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},ov)),this.if}setup(t){if(!this.Ti&&!this.Qv)return this.Qv=!0,this.Ma=t,this.R=t.logger.createLogger("[logs]"),cc(t.kv.initialize(),()=>{this.Ti||this.sv(t)})}sv(t){var i;this.rf(),(null===(i=this.Ra.get())||void 0===i?void 0:i.captureConsoleLogs)&&(this.Uv=!0),(this.Uv||this.Ra.remoteConfigWillArrive&&t.kv.get(this.Ra.captureHintKey))&&this.pf();let e=!1;const s=t.onRemoteConfig(t=>{var i;e=t.ok&&!0===(null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)});this.Ti?s.dispose():(this.Ua=s,e||this.loadIfEnabled())}dispose(){var t,i,e,s,n,r,o;this.Ti||(this.Ti=!0,this.gf(),null===(t=this.Ua)||void 0===t||t.dispose(),this.Ua=void 0,this.Ma=void 0,this.Vv=!1,null===(i=this.nv)||void 0===i||i.removeEventListener("online",this.tf),null===(e=this.mf)||void 0===e||e.call(this),this.mf=void 0,null===(s=this.ef)||void 0===s||s.clearQueue(),null===(n=this.if)||void 0===n||n.clearQueue(),null===(r=this.ef)||void 0===r||r.reset(),null===(o=this.if)||void 0===o||o.reset())}onRemoteConfig(t){var i,e;if(this.Ti)return;const s=t.ok?null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs:void 0;R(s)?this.yf():(null===(e=this.Ma)||void 0===e||e.kv.set(this.Ra.captureHintKey,!!s),s?(this.Uv=!0,this.Wv||this.pf(),this.loadIfEnabled()):this.yf())}reset(){var t,i,e,s;this.gf(),null===(t=this.ef)||void 0===t||t.clearQueue(),this.sc=[],null===(i=this.ef)||void 0===i||i.reset(),null===(e=this.if)||void 0===e||e.clearQueue(),this.Gv=[],null===(s=this.if)||void 0===s||s.reset(),this.Hd=0}captureLog(t){!this.Ti&&this.Ma&&this.uf().captureLog(t)}captureConsoleLog(t){!this.Ti&&this.Ma&&this.df().captureLog(t)}captureBufferedConsoleLog(t,i,e){!this.Ti&&this.Ma&&this.df().captureLog(t,{context:i,occurredAtMs:e})}Cd(){var t;this.gf(),null===(t=this.if)||void 0===t||t.clearQueue(),this.Gv=[]}yf(){this.Uv||this.gf()}pf(){var t;if(this.Kv||!(null===(t=this.nv)||void 0===t?void 0:t.console))return;const i=sv(this.Ra.get()).maxBufferSize;let e=!0;this.Zv.push(()=>{e=!1});for(const t of nv){let s;try{s=rv(this.nv.console[t])}catch(t){continue}s&&this.Zv.push(Hh(this.nv.console,t,n=>{const r=(...s)=>{try{e&&this.bf(t,s,i)}catch(t){}return n.apply(this.nv.console,s)};return r.__rrweb_original__=s,r}))}this.Kv=!0,this._f=setTimeout(()=>{this.gf()},3e4)}bf(t,i,e){var s;if(this.Kv&&!this.Yv&&0!==i.length)if(null===(s=this.Ma)||void 0===s?void 0:s.canCapture){if(e>this.Jv.length){this.Yv=!0;try{this.Jv.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Hv()})}finally{this.Yv=!1}}}else this.gf()}gf(){if(this.Jv=[],this.Kv){this.Kv=!1,this._f&&(clearTimeout(this._f),this._f=void 0);for(const t of this.Zv)t();this.Zv=[]}}wf(){const t=this.Jv;return this.gf(),t}get logger(){return this.kf||(this.kf={trace:(t,i)=>this.captureLog({body:t,level:"trace",attributes:i}),debug:(t,i)=>this.captureLog({body:t,level:"debug",attributes:i}),info:(t,i)=>this.captureLog({body:t,level:"info",attributes:i}),warn:(t,i)=>this.captureLog({body:t,level:"warn",attributes:i}),error:(t,i)=>this.captureLog({body:t,level:"error",attributes:i}),fatal:(t,i)=>this.captureLog({body:t,level:"fatal",attributes:i})}),this.kf}flushLogs(t){this.Ma&&(t?this.Sf(t):(this.ef&&this.ef.flush().catch(t=>this.xf(t)),this.if&&this.if.flush().catch(t=>this.xf(t))))}flush(){var t=this;return J(function*(){var i,e;const s=null===(i=t.ef)||void 0===i?void 0:i.flush().catch(i=>t.xf(i)),n=null===(e=t.if)||void 0===e?void 0:e.flush().catch(i=>t.xf(i));yield s,yield n})()}xf(t){uv(t)||this.R.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Ti||!this.Uv||this.Wv||this.Vv)return;const t=this.sf();if(t){this.Vv=!0;try{t((t,i)=>{if(this.Vv=!1,!this.Ti&&this.Uv)if(t||!i)this.R.error("Could not load logs script",t),this.gf();else{const t=this.wf();this.mf=i.initialize(this.Ma),this.Wv=!0,t.length>0&&i.replay(this.Ma,t)}})}catch(t){throw this.Vv=!1,t}}else this.gf()}lf(t,i){const e=this.Ma;return{get isDisabled(){return!1},get optedOut(){return!e.canCapture},getPersistedProperty:i=>i===f.LogsQueue?t():void 0,setPersistedProperty(t,e){t===f.LogsQueue&&i(null!=e?e:[])},qs:t=>this.qs(t),getLibraryId:()=>e.library.name,getLibraryVersion:()=>e.library.version}}qs(t){return new Promise(i=>{if(Pl(this.Hd,3))return void i({kind:"fatal",error:av(void 0,"logs endpoint is unreachable, dropping batch")});let e=!1;const s=t=>{e||(e=!0,clearTimeout(n),i(t))},n=setTimeout(()=>{this.R.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:av(void 0,"logs request timed out")})},9e4),r=this.nf;this.Ma.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.Ma.projectToken},body:t,compression:"best-available",timeoutMs:6e4}).then(t=>{var i;const e=t.statusCode;this.$f(e,r),e>=200&&300>e?s({kind:"ok"}):413===e?s({kind:"too-large"}):0!==e&&408!==e&&429!==e&&500>e?s({kind:"fatal",error:new Error(`logs request failed with status ${e}`)}):0===e?(t.error||this.R.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:av(t.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`logs request failed with status ${e}`)})},t=>{s({kind:"retry-later",error:t})})})}$f(t,i){(0!==t||i)&&(this.Hd=Cl(t,this.Hd,3,()=>this.R.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.")))}Sf(t){this.sc.length>0&&this.Cf(t,this.sc,this.hf,this.Ma.library.name,t=>{this.sc=t}),this.Gv.length>0&&this.Cf(t,this.Gv,this.ff,ov,t=>{this.Gv=t})}Cf(t,i,e,s,n){if(0===i.length)return;const r=i.map(t=>t.record);n([]);const o=xs(r,$s(e,this.Ma.library.name,this.Ma.library.version),s,this.Ma.library.version);this.Ma.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.Ma.projectToken},body:o,compression:"best-available",transport:t,timeoutMs:6e4}).catch(t=>this.xf(t))}};const cv=Ns("[NetworkMetrics]"),dv={"http:":80,"https:":443},vv=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),fv=(t,i)=>{var e;const s=String(i);return{method:String(t).toUpperCase(),url:(null===(e=El(s))||void 0===e?void 0:e.href)||s}},pv=(t,i,e,s,n,r,o=!1)=>{try{var l,a;const u=n();if(!u)return;const h=e||void 0,c=vh()-s,d=El(i.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||i.url,method:i.method},f=T(u.name)?u.name(v):F(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=o&&!h?void 0:((t,i)=>t?400>t?void 0:String(t):(null==i?void 0:i.name)||"_OTHER")(h,r),g=bi(bi(bi(bi(bi({},(t=>{const i=vv.has(t)?t:"_OTHER";return bi({"http.request.method":i},"_OTHER"===i&&t!==i?{"http.request.method_original":t}:{})})(v.method)),d?(t=>{return{"server.address":t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,"server.port":Number(t.port)||dv[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(i=t.pathname,i.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/"))};var i})(d):{}),h?{"http.response.status_code":h}:{}),p?{"error.type":p}:{}),null===(l=u.attributes)||void 0===l?void 0:l.call(u,v,{status:h,durationMs:c}));null===(a=t.metrics)||void 0===a||a.histogram(f,c,{unit:"ms",attributes:g})}catch(t){cv.error("Failed to record network metric",t)}},gv=()=>{},_v=(i,e)=>T(null==t?void 0:t.fetch)?Hh(t,"fetch",t=>function(...s){const n=vh(),r=t.apply(this,s);if(!e())return r;try{var o,l,a;const[t,u]=s,h=fv(null!==(o=null!==(l=null==u?void 0:u.method)&&void 0!==l?l:null==t?void 0:t.method)&&void 0!==o?o:"GET",null!==(a=null==t?void 0:t.url)&&void 0!==a?a:t);return r.then(t=>(pv(i,h,null==t?void 0:t.status,n,e,void 0,!0),t),t=>{throw pv(i,h,void 0,n,e,t),t})}catch(t){return cv.error("Failed to observe fetch",t),r}}):gv,mv=(i,e)=>{var s;const n=null==t||null===(s=t.XMLHttpRequest)||void 0===s?void 0:s.prototype;if(!n)return gv;const r=new WeakMap,o=Hh(n,"open",t=>function(...i){try{(()=>iu.has(this))()||r.set(this,fv(i[0],i[1]))}catch(t){cv.error("Failed to observe XHR open",t)}return t.apply(this,i)}),l=Hh(n,"send",t=>function(...s){let n;try{const t=r.get(this);if(t&&e()){const s=vh();n=()=>{this.removeEventListener("loadend",n),pv(i,t,this.status,s,e)},Ur(this,"loadend",n)}}catch(t){cv.error("Failed to observe XHR send",t)}try{return t.apply(this,s)}catch(t){throw n&&this.removeEventListener("loadend",n),t}});return()=>{o(),l()}},yv=new WeakMap,bv=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),wv={maxStringLength:2048,truncationSuffix:"..."},$v={maxStringLength:2048,truncationSuffix:"..."};function xv(t){if(t)return!0===t?{intent:!0,model:!0}:{intent:!1!==t.intent,model:!1!==t.model}}function Sv(t,i){return{}.hasOwnProperty.call(t,i)}function kv(t,i){const e=Object.create(t);return i&&Object.defineProperty(e,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:i}),e}function Ev(t,i,e=!1){if(!F(t))return;const s=t.trim();return s?(e?os(s,wv):s).slice(0,i):void 0}function Tv(t){try{return P(t)&&!0===t.isError}catch(t){return!1}}function Pv(t){return os(t||"Unknown error",$v).slice(0,2048)}function Cv(t,i){try{return Pv(i?function(t){try{if(!P(t)||!E(t.content))return;return t.content.filter(t=>P(t)&&"text"===t.type&&F(t.text)).map(t=>t.text).join(" ").trim()||void 0}catch(t){return}}(t):P(t)&&F(t.message)?t.message:F(t)?t:String(t))}catch(t){return"Unknown error"}}function Av(t,i,e){return i.errorResult?[{type:"Error",value:e,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:t.buildProperties(i.error,{handled:!0}).$exception_list.map(t=>bi(bi({},t),{},{value:Pv(t.value)}))}function Fv(t,i){if(i)return"Error";try{if(!P(t))return"Error";let i=F(t.name)?t.name.trim():"";const e=t.constructor;return i&&"Error"!==i||!T(e)||"Error"===e.name||(i=e.name),(i||"Error").slice(0,256)}catch(t){return"Error"}}function Ov(t,i){return{message:Cv(t,i),type:Fv(t,i)}}jh.__defaultExtensionClasses=bi({},((...t)=>Ir({},...t))({featureFlags:Fc},{sessionRecording:class{get Fr(){return this._instance.config}get Tc(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.Tf)||void 0===t?void 0:t.isStarted)}get status(){var t,i;return"awaiting_config"===this.If||"missing_config"===this.If?this.If:null!==(t=null===(i=this.Tf)||void 0===i?void 0:i.status)&&void 0!==t?t:this.If}constructor(i){if(this._instance=i,this._forceAllowLocalhostNetworkCapture=!1,this.If=Yh,this.Mf=void 0,this.Ef=!1,this.Ye=(()=>{var i,e;if(!(null==s?void 0:s.visibilityState)||"visible"===s.visibilityState)return!0;const n=null==t||null===(i=t.performance)||void 0===i||null===(e=i.getEntriesByType)||void 0===e?void 0:e.call(i,"visibility-state");return!(null==n?void 0:n.length)||n.some(t=>"visible"===t.name)})(),this.an=()=>{var t,i;"visible"===(null==s?void 0:s.visibilityState)&&(this.Ye=!0,null===(t=this.Tf)||void 0===t||null===(i=t.setDocumentWasEverVisible)||void 0===i||i.call(t,!0))},!this._instance.sessionManager)throw Xh.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Fr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==s?void 0:s.addEventListener)&&Ur(s,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var i;this.Ef=!0,null==s||null===(i=s.removeEventListener)||void 0===i||i.call(s,"visibilitychange",this.an),t?this.Af(!0):this.stopRecording()}get Rf(){var i;const e=!!(null===(i=this._instance.get_property("$session_recording_remote_config"))||void 0===i?void 0:i.enabled),s=!this.Fr.disable_session_recording,n=this.Fr.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&s&&!n}startIfEnabledOrStop(t){var i;if(this.Ef)return;if(this.Rf&&(null===(i=this.Tf)||void 0===i?void 0:i.isStarted))return;const e=!A(Object.assign)&&!A(Array.from);this.Rf&&e?(this.Pf(t),Xh.info("starting")):(this.If=Yh,this.stopRecording())}Pf(t){var i,e;if(this.Rf)if("awaiting_config"!==this.If&&"missing_config"!==this.If&&(this.If=Zh),(null==c||null===(i=c.__PosthogExtensions__)||void 0===i||null===(i=i.rrweb)||void 0===i?void 0:i.record)&&(null===(e=c.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))this.Of(t);else{var s,n;const i=this._instance.sessionManager;null===(s=c.__PosthogExtensions__)||void 0===s||null===(n=s.loadExternalDependency)||void 0===n||n.call(s,this._instance,this.Ff,e=>{if(!this.Ef&&this.Rf&&this._instance.sessionManager===i)return e?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Xh.error("could not load recorder",e)):void this.Of(t);this.If="disabled"})}}stopRecording(){var t,i;null===(t=this.Mf)||void 0===t||t.call(this),this.Mf=void 0,null===(i=this.Tf)||void 0===i||i.stop()}Af(t=!1){var i,e;null===(i=this.Mf)||void 0===i||i.call(this),this.Mf=void 0,null===(e=this.Tf)||void 0===e||e.discard({discardProducerEvents:t})}Df(){var t,i;null===(t=this.Tc)||void 0===t||t.unregister("$session_is_sampled"),null===(i=this.Tc)||void 0===i||i.unregister("$replay_sample_rate")}Lf(t,i){if(R(t))return null;const e=I(t)?t:parseFloat(t);return"number"!=typeof(s=e)||!Number.isFinite(s)||0>s||s>1?(Xh.warn(`${i} must be between 0 and 1. Ignoring invalid value:`,t),null):e;var s}Nf(t){if(this.Tc){var i,e;const s=this.Tc,n=()=>{var i;const e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Lf(null===(i=this.Fr.session_recording)||void 0===i?void 0:i.sampleRate,"session_recording.sampleRate"),r=this.Lf(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=n?n:r;R(o)&&this.Df();const l=null==e?void 0:e.minimumDurationMilliseconds;s.register({[Dn]:bi(bi({cache_timestamp:Date.now(),enabled:!!e},e),{},{networkPayloadCapture:bi({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:o,minimumDurationMilliseconds:A(l)?null:l,endpoint:null==e?void 0:e.endpoint,triggerMatchType:null==e?void 0:e.triggerMatchType,masking:null==e?void 0:e.masking,urlTriggers:null==e?void 0:e.urlTriggers,version:null==e?void 0:e.version,triggerGroups:null==e?void 0:e.triggerGroups})})};n(),null===(i=this.Mf)||void 0===i||i.call(this),this.Mf=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.onSessionId(n)}}onRemoteConfig(t){const i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.Nf(i),void this.Af()):(this.Nf(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.If&&(this.If="missing_config",this._instance.register_for_session({[gr]:!0}),Xh.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i="log"){var e;(null===(e=this.Tf)||void 0===e?void 0:e.log)?this.Tf.log(t,i):Xh.warn("log called before recorder was ready")}get Ff(){var t,i;const e=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(Dn);return(null==e||null===(i=e.scriptConfig)||void 0===i?void 0:i.script)||"lazy-recorder"}jf(){const t=this._instance.get_property(Dn);if(!t)return!1;let i;try{i="object"==typeof t?t:JSON.parse(t)}catch(t){return Xh.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!R(i.cache_timestamp)&&36e5>=Date.now()-i.cache_timestamp}Of(t){var i,e,s;if(!this.Ef&&this.Rf&&this._instance.sessionManager){if(!(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))return Xh.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[pr]:!0});var n;if(this.Tf||(this.Tf=null===(n=c.__PosthogExtensions__)||void 0===n?void 0:n.initSessionRecording(this._instance,this.Ye),this.Tf._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.jf()){if("missing_config"===this.If||"awaiting_config"===this.If)return;return this.If="awaiting_config",Xh.info("persisted remote config is stale, requesting fresh config before starting"),void new ba(this._instance).load()}this.If=Zh,null===(e=(s=this.Tf).setDocumentWasEverVisible)||void 0===e||e.call(s,this.Ye),this.Tf.start(t)}else this.If=Yh}onRRwebEmit(t){var i,e;null===(i=this.Tf)||void 0===i||null===(e=i.onRRwebEmit)||void 0===e||e.call(i,t)}overrideLinkedFlag(){var t,i;this.Tf||null===(i=this.Tc)||void 0===i||i.register({$replay_override_linked_flag:!0}),null===(t=this.Tf)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.Tf||null===(i=this.Tc)||void 0===i||i.register({$replay_override_sampling:!0}),null===(t=this.Tf)||void 0===t||t.overrideSampling()}overrideTrigger(t){var i,e;this.Tf||null===(e=this.Tc)||void 0===e||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(i=this.Tf)||void 0===i||i.overrideTrigger(t)}get sdkDebugProperties(){var t;const i={};for(const t of Qh){var e;const s=null===(e=this._instance.sessionPersistence)||void 0===e?void 0:e.get_property(t);A(s)||(i[t]=s)}return bi(bi({},i),(null===(t=this.Tf)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,i){var e;return!!(null===(e=this.Tf)||void 0===e?void 0:e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t,i;null===(t=this.Tf)||void 0===t||null===(i=t.flushBeforeIdentityReset)||void 0===i||i.call(t)}}},{autocapture:class extends hh{constructor(t){super(new Nh(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.qf=!1,this._instance=t,this.Bf=this.zf()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Hf();return!!(t.path||t.search||this.Uf(t))}startIfEnabled(){this.isEnabled&&(Ls.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Bf=this.zf(),this.startIfEnabled()}stop(){this.Wf&&this.Wf(),this.Wf=void 0,this.Vf&&this.Vf(),this.Vf=void 0,Ls.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.Gf("pushState"),this.Gf("replaceState"),this.Qf(),this.Uf()&&this.Jf())}Gf(i){var e;if(!t||(null===(e=t.history[i])||void 0===e?void 0:e.__posthog_wrapped__))return;const s=this;Hh(t.history,i,e=>function(n,r,o){var l;s.Zf(o)&&s.Kf(),e.call(this,n,r,o),s.Yf(i,!s.qf&&"popstate"!==(null==t||null===(l=t.event)||void 0===l?void 0:l.type))})}zf(){const i=null==t?void 0:t.location;if(null==i?void 0:i.pathname)return{pathname:i.pathname,search:i.search,hash:i.hash}}Hf(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:P(t)?t:{}}Uf(t=this.Hf()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Xf(t){const i=this.Hf(),e=this.Bf;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.Uf(i)&&t.hash!==e.hash))}Yf(t,i=!1){try{i||this.Kf();const e=this.zf();if(!e)return;if(this.Xf(e)){const e=()=>this._instance.capture(Cr,{navigation_type:t});i?(this.tp=e,Promise.resolve().then(()=>this.Kf())):e()}this.Bf=e}catch(i){Ls.error(`Error capturing ${t} pageview`,i)}}Zf(i){var e,s;return!(R(i)||!t)&&(null===(e=El(String(i)))||void 0===e?void 0:e.href)!==(null===(s=t.location)||void 0===s?void 0:s.href)}Kf(){const t=this.tp;if(t){this.tp=void 0,this.qf=!0;try{t()}catch(t){Ls.error("Error capturing deferred pageview",t)}finally{this.qf=!1}this.Bf=this.zf()}}Qf(){if(this.Wf)return;const i=()=>{this.Yf("popstate")};Ur(t,"popstate",i),this.Wf=()=>{t&&t.removeEventListener("popstate",i)}}Jf(){if(this.Vf)return;const i=()=>{this.Yf("hashchange")};Ur(t,"hashchange",i),this.Vf=()=>{t&&t.removeEventListener("hashchange",i)}}},heatmaps:class{get Fr(){return this.instance.config}constructor(t){var i;this.ep=!1,this.fl=!1,this.np=null,this.instance=t,this.ep=!!(null===(i=this.instance.persistence)||void 0===i?void 0:i.props[Tn]),this.rageclicks=new th(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return P(this.Fr.capture_heatmaps)&&this.Fr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Fr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return R(this.Fr.capture_heatmaps)?R(this.Fr.enable_heatmaps)?this.ep:this.Fr.enable_heatmaps:!1!==this.Fr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.fl)return;tc.info("starting..."),this.sp(),this.an()}else{var t;clearInterval(null!==(t=this.np)&&void 0!==t?t:void 0),this.rp(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("heatmaps"in i))return;const e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Tn]:e}),this.ep=e,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}op(t){ic(t.originalEvent)&&this.Pr(t.originalEvent,"deadclick")}an(){this.np&&clearInterval(this.np),this.np=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(s)?setInterval(this.dc.bind(this),this.flushIntervalMilliseconds):null}sp(){t&&s&&(this.ap=this.dc.bind(this),Ur(t,Pr,this.ap),this.lp=i=>this.Pr(i||(null==t?void 0:t.event)),Ur(s,"click",this.lp,{capture:!0}),this.up=i=>this.cp(i||(null==t?void 0:t.event)),Ur(s,"mousemove",this.up,{capture:!0}),this.hp=new fl(this.instance,dl,this.op.bind(this)),this.hp.startIfEnabledOrStop(),this.dp=this.an.bind(this),Ur(s,an,this.dp),this.fl=!0)}rp(){var i;t&&s&&(this.ap&&t.removeEventListener(Pr,this.ap),this.lp&&s.removeEventListener("click",this.lp,{capture:!0}),this.up&&s.removeEventListener("mousemove",this.up,{capture:!0}),this.dp&&s.removeEventListener(an,this.dp),clearTimeout(this.vp),null===(i=this.hp)||void 0===i||i.stop(),this.fl=!1)}fp(i,e){const s=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(i,e,s){let n=i;for(;n&&xo(n)&&!So(n,"body");){if(n===s)return!1;let i;try{var r,o,l;i=null===(r=null!==(o=null===(l=n.ownerDocument)||void 0===l?void 0:l.defaultView)&&void 0!==o?o:t)||void 0===r?void 0:r.getComputedStyle(n).position}catch(t){return!1}if(m(e,i))return!0;n=Do(n)}return!1}(Oo(i),["fixed","sticky"],r);return{x:i.clientX+(o?0:n),y:i.clientY+(o?0:s),target_fixed:o,type:e}}Pr(t,i="click"){var e;if($o(t.target)||!ic(t))return;const s=this.fp(t,i);(null===(e=this.rageclicks)||void 0===e?void 0:e.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&Ko(Oo(t),this.instance.config.rageclick)&&this.Qs(bi(bi({},s),{},{type:"rageclick"})),this.Qs(s)}cp(t){!$o(t.target)&&ic(t)&&(clearTimeout(this.vp),this.vp=setTimeout(()=>{this.Qs(this.fp(t,"mousemove"))},500))}Qs(i){if(!t)return;const e=this.Fr.disable_capture_url_hashes?di(t.location.href):t.location.href,s=this.Fr.custom_personal_data_properties,n=this.Fr.mask_personal_data_properties?[...Rl,...s||[]]:[],r=Ol(e,n,Dl);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(i)}dc(){this.Rt&&!C(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:fl,webVitalsAutocapture:class{constructor(i){var e;this._instance=i,this.ep=!1,this.fl=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.pp=(t=!1)=>{clearTimeout(this.gp),this.gp=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",bi({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,i)=>bi(bi({},t),{},{[`$web_vitals_${i.name}_event`]:bi({},i),[`$web_vitals_${i.name}_value`]:i.value}),{})),t?{transport:"sendBeacon",send_instantly:!0}:void 0),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.mp=t=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},R(null==t?void 0:t.name)||R(null==t?void 0:t.value))return void Wh.error("Invalid metric received",t);const e="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.yp(e);if(A(s))return;const n=I(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${s}`;if(this.bp&&t.value>=this.bp)return void Wh.error("Ignoring metric with value >= "+this.bp,t);this.Rt.navigationKey!==n&&(this.pp(),this.gp=setTimeout(this.pp,this.flushToCaptureTimeoutMs)),A(this.Rt.navigationKey)&&(this.Rt.navigationKey=n,this.Rt.url=s),this.Rt.firstMetricTimestamp=A(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.checkAndGetSessionAndWindowId(!0),o=bi(bi(bi({},t),e?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,P(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const i={};for(const e of Jh){const s="url"===e&&"string"==typeof t.attribution[e]?this.yp(t.attribution[e]):t.attribution[e];A(s)||(i[e]=s)}o.attribution=i}else delete o.attribution;A(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.pp()},this._p=()=>{if(this.fl)return;let i,e,s,n,r=!1;const o=c.__PosthogExtensions__,l=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,a=(null==l?void 0:l[this.wp])||("web-vitals"===this.wp&&A(l)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!A(a)){const t=a.withoutAttribution,o=this.attributionMetrics;r=!A(t),i=o.indexOf("LCP")>-1?a.onLCP:(null==t?void 0:t.onLCP)||a.onLCP,e=o.indexOf("CLS")>-1?a.onCLS:(null==t?void 0:t.onCLS)||a.onCLS,s=o.indexOf("FCP")>-1?a.onFCP:(null==t?void 0:t.onFCP)||a.onFCP,n=o.indexOf("INP")>-1?a.onINP:(null==t?void 0:t.onINP)||a.onINP}if(!(i&&e&&s&&n))return void Wh.error("web vitals callbacks not loaded - not starting");const u={reportSoftNavs:this.useSoftNavs},h=r&&this.attributionMetrics.indexOf("INP")>-1?bi(bi({},u),{},{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&i(this.mp.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&e(this.mp.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&s(this.mp.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&n(this.mp.bind(this),h);const d=null==t?void 0:t.document;Ur(d,an,()=>{"hidden"===(null==d?void 0:d.visibilityState)&&this.pp(!0)}),Ur(t,"pagehide",()=>this.pp(!0)),this.fl=!0},this.ep=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[Fn]),this.startIfEnabled()}get kp(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i;const e=P(this.kp)?null===(t=this.kp)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return R(e)?(null===(i=this._instance.persistence)||void 0===i?void 0:i.props.$web_vitals_allowed_metrics)||Gh:e}get flushToCaptureTimeoutMs(){return(P(this.kp)?this.kp.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=P(this.kp)?this.kp.web_vitals_attribution:void 0;return j(t)?t?Gh:[]:E(t)?t:Kh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=P(this.kp)?this.kp.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get bp(){const t=P(this.kp)&&I(this.kp.__web_vitals_max_value)?this.kp.__web_vitals_max_value:Vh;return t>0&&6e4>=t?Vh:t}get isEnabled(){const t=null==n?void 0:n.protocol;if("http:"!==t&&"https:"!==t)return Wh.info("Web Vitals are disabled on non-http/https protocols"),!1;const i=P(this.kp)?this.kp.web_vitals:j(this.kp)?this.kp:void 0;return j(i)?i:this.ep}startIfEnabled(){this.isEnabled&&!this.fl&&(Wh.info("enabled, starting..."),this.Fl(this._p))}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("capturePerformance"in i))return;const e=P(i.capturePerformance)&&!!i.capturePerformance.web_vitals,s=P(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Fn]:e}),this._instance.persistence.register({[In]:s})),this.ep=e,this.startIfEnabled()}get wp(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Fl(t){var i;const e=c.__PosthogExtensions__,s=this.wp,n=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&A(n)&&(null==e?void 0:e.postHogWebVitalsCallbacks)?t():null==e||null===(i=e.loadExternalDependency)||void 0===i||i.call(e,this._instance,s,i=>{i?Wh.error("failed to load script",i):t()})}yp(i){const e=i||(null==t?void 0:t.location.href);if(!e)return void Wh.error("Could not determine current URL");const s=this._instance.config.disable_capture_url_hashes?di(e):e,n=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Rl,...n||[]]:[];return Ol(s,r,Dl)}}},{exceptionObserver:class{constructor(i){var e;this._p=()=>{var i;if(!t||!this.isEnabled||!(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.errorWrappingFunctions))return;const e=c.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=c.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=c.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Sp&&this.Fr.capture_unhandled_errors&&(this.Sp=e(this.captureException.bind(this))),!this.xp&&this.Fr.capture_unhandled_rejections&&(this.xp=s(this.captureException.bind(this))),!this.$p&&this.Fr.capture_console_errors&&(this.$p=n(this.captureException.bind(this)))}catch(t){zh.error("failed to start",t),this.Cp()}},this._instance=i,this.Tp=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[Pn]),this.kt=new tt(bi(bi({},function(t={}){var i,e,s,n;return{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=null!==(n=t.exceptionRateLimiterBucketSize)&&void 0!==n?n:t.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,R:zh})),this.Fr=this.Ip(),this.startIfEnabledOrStop()}Ip(){const t=this._instance.config.capture_exceptions;let i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return P(t)?i=bi(bi({},i),t):(A(t)?this.Tp:t)&&(i=bi(bi({},i),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Fr.capture_console_errors||this.Fr.capture_unhandled_errors||this.Fr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(zh.info("enabled"),this.Cp(),this.Fl(this._p)):this.Cp()}Fl(t){var i,e,s;(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.errorWrappingFunctions)?t():null===(e=c.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"exception-autocapture",i=>{if(i)return zh.error("failed to load script",i);t()})}Cp(){var t,i,e;null===(t=this.Sp)||void 0===t||t.call(this),this.Sp=void 0,null===(i=this.xp)||void 0===i||i.call(this),this.xp=void 0,null===(e=this.$p)||void 0===e||e.call(this),this.$p=void 0}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"autocaptureExceptions"in i&&(this.Tp=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Pn]:this.Tp}),this.Fr=this.Ip(),this.startIfEnabledOrStop())}onConfigChange(){this.Fr=this.Ip()}captureException(t){try{var i,e,s;const n=null!==(i=null==t||null===(e=t.$exception_list)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.type)&&void 0!==i?i:"Exception";if(this.kt.consumeRateLimit(n))return void zh.info("Skipping exception capture because of client rate limiting.",{exception:n});null===(s=this._instance.exceptions)||void 0===s||s.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var i,e;this.Mp=[],this.Ep=new Ti([new Ki,new ne,new Yi,new Ji,new ee,new ie,new Xi,new se],function(t,...i){return(e,s=0)=>{const n=[],r=e.split("\n"),o=Math.min(r.length,s+1e3),l=[];for(let e=s;o>e;e++){const s=r[e];if(s.length>1024)continue;const o=zi.test(s)?s.replace(zi,"$1"):s;if(!o.match(/\S*Error: /)){for(const e of i){const i=e(o,t);if(i){n.push(i);const t=Ui(n);if(t){for(let i=l.length-1;i>=0;i--){const e=l[i];if(t.start>=e.start+e.length)break;l.pop()}l.push(t)}break}}if(Vi(n,l)>=50)break}}const a=[...l].sort((t,i)=>i.start-t.start),u=a[a.length-1];if(u){const t=qi(n,u);n.splice(u.start-t,t);for(const i of a)i.start-=t}for(const t of a)Hi(n,t);return l.some(t=>0===t.start&&n.length===t.length)&&function(t){const i=t.map(t=>`${t.function}|${t.filename}|${t.lineno}|${t.colno}|${t.module}`);let e=0;for(let t=1;i.length>t;t++)Gi(i,t,e)&&(e=t);t.push(...t.splice(0,e))}(n),function(t){if(!t.length)return[];const i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return bi(bi({},t),{},{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",Di,Ni)),this._instance=t,this.Mp=null!==(i=null===(e=this._instance.persistence)||void 0===e?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this.Ap=ue(this.Rp()),this.Pp=new he(this.Ap)}onConfigChange(){this.Ap=ue(this.Rp()),this.Pp.setConfig(this.Ap)}onRemoteConfig(t){var i,e,s;if(!t.ok)return;const n=t.config;if(!("errorTracking"in n))return;const r=null!==(i=null===(e=n.errorTracking)||void 0===e?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null===(s=n.errorTracking)||void 0===s?void 0:s.captureExtensionExceptions;this.Mp=r,this._instance.persistence&&this._instance.persistence.register({[Cn]:this.Mp,[An]:o})}get Op(){var t;const i=!!this._instance.get_property(An),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Ep.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.Ap.enabled)try{if(!F(t)||0===t.trim().length)return void Mc.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:e,droppedKeys:s}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};const i=[];return{sanitizedProperties:Object.keys(t).reduce((e,s)=>le.has(s)?(i.push(s),e):(e[s]=t[s],e),{}),droppedKeys:i}}(this.Fp(i));s.length>0&&Mc.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Pp.add(bi({[re]:t,[oe]:(new Date).toISOString()},e))}catch(t){Mc.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const i=t.$exception_list;if(this.Dp(i)){if(this.Lp(i))return this.Np("Exception dropped: matched a suppression rule"),void Mc.info("Skipping exception capture because a suppression rule matched");if(!this.Op&&this.jp(i))return this.Np("Exception dropped: thrown by a browser extension"),void Mc.info("Skipping exception capture because it was thrown by an extension");if(!this.Op&&this.qp(i))return this.Np("Exception dropped: thrown by an injected browser script"),void Mc.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Bp(i))return this.Np("Exception dropped: thrown by the PostHog SDK"),void Mc.info("Skipping exception capture because it was thrown by the PostHog SDK")}const e=this.Ap.enabled&&R(t.$exception_steps)?this.zp(t):t,s=function(){if("u">typeof process){var t;const i=null===(t=process.env.POSTHOG_RELEASE_ID)||void 0===t?void 0:t.trim();if(i)return i}const i=globalThis._posthogReleaseId;return"string"==typeof i&&i.length>0?i:void 0}();s&&(e.$release_id=s);try{const t=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",fd:!0});return t&&this.Pp.clear(),t}catch(t){return Oc(t)||Mc.error("Failed to capture exception event. Dropping this exception.",t),void this.Pp.clear()}}catch(t){return void(Oc(t)||Mc.error("Failed to process exception event. Ignoring this exception.",t))}}zp(t){try{const i=this.Pp.getAttachable();return 0===i.length?t:bi(bi({},t),{},{$exception_steps:i})}catch(i){return Mc.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Np(t){this.Ap.enabled&&this.Pp.add({[re]:t,[oe]:(new Date).toISOString()})}Fp(t){return P(t)?bi({},t):{}}Rp(){var t,i;return null!==(t=null===(i=this._instance.config.error_tracking)||void 0===i?void 0:i.exception_steps)&&void 0!==t?t:{}}Lp(t){if(0===t.length)return!1;try{const i=t.reduce((t,{type:i,value:e})=>(F(i)&&i.length>0&&t.$exception_types.push(i),F(e)&&e.length>0&&t.$exception_values.push(e),t),{$exception_types:[],$exception_values:[]});return this.Mp.some(t=>{const e=t.values.map(t=>{const e=Nu[t.operator],s=i[t.key];if(!e||!s)return!1;const n=E(t.value)?t.value:[t.value];return n.length>0&&e(n,s)});return"OR"===t.type?e.some(Boolean):e.every(Boolean)})}catch(t){return Mc.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}jp(t){const i=t.flatMap(t=>{var i,e;return null!==(i=null===(e=t.stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[]}),e=i.filter(({filename:t})=>!!t&&Dc.some(i=>t.startsWith(i)));return 0!==e.length&&(!e.every(({filename:t})=>!!t&&t.startsWith(Rc))||t.some(({type:t,value:i})=>"NoResponse"===t||F(i)&&Ic.some(({value:t,exact:e})=>e?i===t:i.includes(t)))&&!i.some(({in_app:t,filename:i})=>t&&!(null==i?void 0:i.startsWith(Rc))))}qp(t){return t.some(({value:t})=>F(t)&&jc.some(i=>t.includes(i)))}Bp(t){if(t.length>0){var i,e,s,n;const r=null!==(i=null===(e=t[0].stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[],o=r[r.length-1];return null!==(s=null==o||null===(n=o.filename)||void 0===n?void 0:n.includes("posthog.com/static"))&&void 0!==s&&s}return!1}Dp(t){return!R(t)&&E(t)}}},{productTours:class{get Tc(){return this._instance.persistence}constructor(t){this.Hp=null,this.Up=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if("productTours"in i){var e,s;if(this.Tc&&this.Tc.register({[Mn]:!!i.productTours}),!sc(this._instance))return!this.Hp&&R(null===(e=this.Tc)||void 0===e?void 0:e.props.ph_product_tours)||ec.info("product tours disabled; stopping and clearing cached tours"),null===(s=this.Hp)||void 0===s||s.stop(),this.Hp=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Hp&&sc(this._instance)&&this.Fl(()=>this.Wp())}Fl(t){var i,e,s;(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.generateProductTours)?t():null===(e=c.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"product-tours",i=>{i?ec.error("Could not load product tours script",i):t()})}Wp(){var t;!this.Hp&&(null===(t=c.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.Hp=c.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i=!1){if(E(this.Up)&&!i)return void t(this.Up,{isLoaded:!0});const e=this.Tc;if(e){const s=e.props[Zn];if(E(s)&&!i)return this.Up=s,void t(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:i=>{if(!sc(this._instance))return void t([],{isLoaded:!0});const s=i.statusCode;if(200!==s||!i.json){const e=`Product Tours API could not be loaded, status: ${s}`;return 0===s?i.error||ec.warn(e):ec.error(e),void t([],{isLoaded:!1,error:e})}const n=E(i.json.product_tours)?i.json.product_tours:[];this.Up=n,e&&e.register({[Zn]:n}),t(n,{isLoaded:!0})}})}getActiveProductTours(t){R(this.Hp)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Hp.getActiveProductTours(t)}showProductTour(t){var i;null===(i=this.Hp)||void 0===i||i.showTourById(t)}previewTour(t){this.Hp?this.Hp.previewTour(t):this.Fl(()=>{var i;this.Wp(),null===(i=this.Hp)||void 0===i||i.previewTour(t)})}dismissProductTour(){var t;null===(t=this.Hp)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.Hp)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.Hp)||void 0===t||t.previousStep()}clearCache(){var t;this.Up=null,null===(t=this.Tc)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var i;null===(i=this.Hp)||void 0===i||i.resetTour(t)}resetAllTours(){var t;null===(t=this.Hp)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var i;null===(i=this.Hp)||void 0===i||i.cancelPendingTour(t)}},featureFlags:Fc},{siteApps:class{constructor(t){this._instance=t,this.Vp=0,this.Gp=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Qp(t,i){if(!i)return;const e=this.globalsForEvent(i);this.Gp.push(e),this.Gp.length>1e3&&(this.Gp=this.Gp.slice(10))}get siteAppLoaders(){var t;return null===(t=c._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.Qp.bind(this));this.Jp=()=>{t(),this.Gp=[],this.Jp=void 0}}}globalsForEvent(t){var i,e,s,n,r,o,l;if(!t)throw new Error("Event payload is required");const a={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(const[t,i]of Object.entries(h))a[t]={id:u[t],type:t,properties:i};const{$set_once:c,$set:d}=t;return{event:bi(bi({},Se(t,nc)),{},{properties:bi(bi(bi({},t.properties),d?{$set:bi(bi({},null!==(i=null===(e=t.properties)||void 0===e?void 0:e.$set)&&void 0!==i?i:{}),d)}:{}),c?{$set_once:bi(bi({},null!==(s=null===(n=t.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),c)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(l=t.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:a}}Zp(t){var i;const e=null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase();if("style"===e&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(t)||(rc.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===e&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(t)||(rc.error("prepare_external_dependency_script returned null"),null)}return t}Kp(){var t,i,e,n,r,o,l,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const u=null==s?void 0:s.defaultView,h=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!h)return()=>{};if(this.Vp++,this.Yp)return this.Xp();const c=[],d=this,v=new WeakSet,f=(t,i,e)=>{if(!(null==t?void 0:t[i]))return;const s=t[i];t[i]=e(s),c.push(()=>{t[i]=s})},p=t=>{if(v.has(t))return t;const i=d.Zp(t);return i&&v.add(i),i},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!M(t));return f(h,"appendChild",t=>function(i){const e=p(i);return e?t.call(this,e):i}),f(h,"insertBefore",t=>function(i,e){const s=p(i);return s?t.call(this,s,e):i}),f(h,"replaceChild",t=>function(i,e){const s=p(i);return s?t.call(this,s,e):e}),[null===(i=u.Element)||void 0===i?void 0:i.prototype,null===(e=u.Document)||void 0===e?void 0:e.prototype,null===(n=u.DocumentFragment)||void 0===n?void 0:n.prototype].forEach(t=>{f(t,"append",t=>function(...i){return t.apply(this,g(i))}),f(t,"prepend",t=>function(...i){return t.apply(this,g(i))})}),[null===(r=u.Element)||void 0===r?void 0:r.prototype,null===(o=u.CharacterData)||void 0===o?void 0:o.prototype,null===(l=u.DocumentType)||void 0===l?void 0:l.prototype].forEach(t=>{f(t,"before",t=>function(...i){return t.apply(this,g(i))}),f(t,"after",t=>function(...i){return t.apply(this,g(i))}),f(t,"replaceWith",t=>function(...i){const e=g(i);return i.length&&!e.length?void 0:t.apply(this,e)})}),f(null===(a=u.Element)||void 0===a?void 0:a.prototype,"insertAdjacentElement",t=>function(i,e){const s=p(e);return s?t.call(this,i,s):null}),this.Yp=()=>{c.forEach(t=>t()),this.Yp=void 0},this.Xp()}Xp(){let t=!1;return()=>{var i;t||(t=!0,this.Vp--,0===this.Vp&&(null===(i=this.Yp)||void 0===i||i.call(this)))}}tg(t,i=!0){const e=this.Kp();try{const s=t(e);return i&&e(),s}catch(t){throw e(),t}}setupSiteApp(t){const i=this.apps[t.id],e=()=>{var e;!i.errored&&this.Gp.length&&(rc.info(`Processing ${this.Gp.length} events for site app with id ${t.id}`),this.Gp.forEach(t=>this.tg(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null===(e=this.Jp)||void 0===e||e.call(this))};let s=!1;const n=n=>{i.errored=!n,i.loaded=!0,rc.info(`Site app with id ${t.id} ${n?"loaded":"errored"}`),s&&e()};try{const{processEvent:e}=this.tg(i=>t.init({posthog:this._instance,callback(t){i(),n(t)}}),!1);e&&(i.processEvent=e),s=!0}catch(i){rc.error(oc+t.id,i),n(!1)}if(s&&i.loaded)try{e()}catch(e){rc.error(`Error while processing buffered events PostHog app with config id ${t.id}`,e),i.errored=!0}}eg(){const t=this.siteAppLoaders||[];for(const i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(const i of t)this.setupSiteApp(i)}ig(t){if(0===Object.keys(this.apps).length)return;const i=this.globalsForEvent(t);for(const e of Object.values(this.apps))try{this.tg(()=>{var t;return null===(t=e.processEvent)||void 0===t?void 0:t.call(e,i)})}catch(i){rc.error(`Error while processing event ${t.event} for site app ${e.id}`,i)}}onRemoteConfig(t){var i,e,s;if(null===(i=this.siteAppLoaders)||void 0===i?void 0:i.length)return this.isEnabled?(this.eg(),void this._instance.on("eventCaptured",t=>this.ig(t))):void rc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(e=this.Jp)||void 0===e||e.call(this),!t.ok)return;const n=t.config;if(null===(s=n.siteApps)||void 0===s?void 0:s.length)if(this.isEnabled)for(const{id:t,url:i}of n.siteApps){var r,o;c[`__$$ph_site_app_${t}`]=this._instance,null===(r=c.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,i,i=>{if(i)return rc.error(oc+t,i)})}else rc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},{surveys:class extends fc{constructor(t){super(new pc(t))}},featureFlags:Fc},{tracingHeaders:class{constructor(t){this._instance=t,this.ng=void 0,this.sg=void 0,this.rg=void 0,this._p=()=>{const t=this.og();var i,e;t?(A(this.ng)&&(this.ng=null===(i=c.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),A(this.sg)&&(this.sg=null===(e=c.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Cp()}}initialize(){this.startIfEnabledOrStop()}Fl(t){var i,e,s;(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.tracingHeadersPatchFns)?t():null===(e=c.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"tracing-headers",i=>{if(i)return qh.error("failed to load script",i);t()})}ag(){var t,i;return null!==(t=null!==(i=this._instance.config.tracing_headers)&&void 0!==i?i:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}og(){const t=this.ag();return E(t)?(E(this.rg)?this.rg.splice(0,this.rg.length,...t):this.rg=[...t],t.length>0?this.rg:void 0):(E(this.rg)&&this.rg.splice(0),this.rg=t||void 0,this.rg)}Cp(){var t,i;null===(t=this.ng)||void 0===t||t.call(this),null===(i=this.sg)||void 0===i||i.call(this),this.ng=void 0,this.sg=void 0}startIfEnabledOrStop(){this.og()?this.Fl(this._p):this.Cp()}}},{toolbar:class{constructor(t){this.instance=t}lg(t){c.ph_toolbar_state=t}ug(){var t;return null!==(t=c.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i=void 0,e=void 0,n=void 0){var r,o;if(Hr(this.instance.config))return!1;if(!t||!s)return!1;i=null!==(r=i)&&void 0!==r?r:t.location,n=null!==(o=n)&&void 0!==o?o:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}const s=gc||Ml(i.hash,"__posthog")||Ml(i.hash,"state");let r;const o=s?vi(()=>JSON.parse(atob(decodeURIComponent(s))))||vi(()=>JSON.parse(decodeURIComponent(s))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?i.hash=o.desiredHash:n?n.replaceState(n.state,"",i.pathname+i.search):i.hash="")):(r=JSON.parse(e.getItem(_c)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}cg(t){const i=c.ph_load_toolbar||c.ph_load_editor;!R(i)&&T(i)?i(t,this.instance):mc.warn("No toolbar load function found")}loadToolbar(i){const e=!!(null==s?void 0:s.getElementById("__POSTHOG_TOOLBAR__"));if(!t||e)return!1;const n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=bi(bi({token:this.instance.config.token},i),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(t.localStorage.setItem(_c,JSON.stringify(bi(bi({},r),{},{source:void 0}))),2===this.ug())this.cg(r);else if(0===this.ug()){var o,l;this.lg(1),null===(o=c.__PosthogExtensions__)||void 0===o||null===(l=o.loadExternalDependency)||void 0===l||l.call(o,this.instance,"toolbar",t=>{if(t)return mc.error("[Toolbar] Failed to load",t),void this.lg(0);this.lg(2),this.cg(r)}),Ur(t,"turbolinks:load",()=>{this.lg(0),this.loadToolbar(r)})}return!0}hg(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,i=void 0,e=void 0){return this.maybeLoadToolbar(t,i,e)}}},{experiments:class i{get Fr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{i.dg("retrieved web experiments from the server"),this.vg=new Map,t.forEach(t=>{if(t.feature_flag_key){var e;this.vg&&(i.dg("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(e=this.vg)||void 0===e||e.set(t.feature_flag_key,t));const s=this._instance.getFeatureFlag(t.feature_flag_key);F(s)&&t.variants[s]&&this.fg(t,s)}else if(t.variants)for(const e in t.variants){const s=t.variants[e];i.pg(s,this._instance)&&this.gg(t.name,e,s.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())i.dg(Zd);else if(!this.Fr.disable_web_experiments){if(R(this.vg))return this.vg=new Map,this.loadIfEnabled(),void this.previewWebExperiment();i.dg("applying feature flags",t),t.forEach(t=>{var i;if(this.vg&&(null===(i=this.vg)||void 0===i?void 0:i.has(t))){var e;const i=this._instance.getFeatureFlag(t),s=null===(e=this.vg)||void 0===e?void 0:e.get(t);i&&(null==s?void 0:s.variants[i])&&this.fg(s,i)}})}}previewWebExperiment(){const t=i.getWindowLocation();if(null==t?void 0:t.search){const e=Fl(null==t?void 0:t.search,"__experiment_id"),s=Fl(null==t?void 0:t.search,"__experiment_variant");e&&s&&(i.dg(`previewing web experiments ${e} && ${s}`),this.getWebExperiments(t=>{this.mg(parseInt(e),s,t)},!1,!0))}}loadIfEnabled(){this.Fr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Fr.disable_web_experiments&&!e)return t([]);const s=this._instance.get_property("$web_experiments");if(s&&!i)return t(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Fr.token}`),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}mg(t,e,s){const n=s.filter(i=>i.id===t);n&&n.length>0&&(i.dg(`Previewing web experiment [${n[0].name}] with variant [${e}]`),this.gg(n[0].name,e,n[0].variants[e].transforms))}fg(t,e){const s=t.variants[e];i.yg(s,this._instance)?this.gg(t.name,e,s.transforms):i.dg(`skipping variant ${e} of experiment ${t.name} because this page does not match its url conditions`)}static pg(t,e){return!R(t.conditions)&&i.yg(t,e)&&i.bg(t)}static yg(t,e){var s;if(R(t.conditions)||R(null===(s=t.conditions)||void 0===s?void 0:s.url))return!0;const n=i.getWindowLocation();if(n){var r,o,l;const i=wo(e,n.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||tv[null!==(o=null===(l=t.conditions)||void 0===l?void 0:l.urlMatchType)&&void 0!==o?o:"icontains"](t.conditions.url,i)}return!1}static getWindowLocation(){return null==t?void 0:t.location}static bg(t){var i;if(R(t.conditions)||R(null===(i=t.conditions)||void 0===i?void 0:i.utm))return!0;const e=Ll();if(e.utm_source){var s,n,r,o,l,a,u,h;const i=!(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)||(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)==e.utm_campaign,c=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==e.utm_source,d=!(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)||(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)==e.utm_medium,v=!(null===(u=t.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)||(null===(h=t.conditions)||void 0===h||null===(h=h.utm)||void 0===h?void 0:h.utm_term)==e.utm_term;return i&&d&&v&&c}return!1}static dg(t,...i){Ls.info(`[WebExperiments] ${t}`,i)}static _g(t,...i){Ls.warn(`[WebExperiments] ${t}`,i)}static wg(t){("http://www.w3.org/1999/xhtml"===t.namespaceURI&&"template"===t.localName?t.content:t).querySelectorAll("a[target], template").forEach(t=>{var e;if("template"===t.localName)return void("http://www.w3.org/1999/xhtml"===t.namespaceURI&&i.wg(t));if("http://www.w3.org/1999/xhtml"!==t.namespaceURI||"_blank"!==(null===(e=t.getAttribute("target"))||void 0===e?void 0:e.toLowerCase()))return void t.removeAttribute("target");const s=(t.getAttribute("rel")||"").split(/\s+/).filter(t=>t&&!/^(opener|noopener)$/i.test(t));s.push("noopener"),t.setAttribute("rel",s.join(" "))})}gg(t,e,s){this._is_bot()?i.dg(Zd):"control"!==e?s.forEach(s=>{if(s.selector){var n;i.dg(`applying transform of variant ${e} for experiment ${t} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector);if(!(null==r?void 0:r.length))return void i._g(`no element on this page matches selector ${s.selector} of variant ${e} for experiment ${t}`);const o=new Map;null==r||r.forEach(t=>{if("script"===t.localName.toLowerCase())return;const e=t;if(s.html){var n;const l="http://www.w3.org/1998/Math/MathML"===t.namespaceURI&&"annotation-xml"===t.localName&&(null===(n=t.getAttribute("encoding"))||void 0===n?void 0:n.toLowerCase())||"",a=JSON.stringify([t.namespaceURI,t.localName,l]);let u=o.get(a);if(R(u)){var r;const e=null!==(r=Qd)&&void 0!==r?r:Qd=Yd(),n=t.ownerDocument.implementation.createHTMLDocument(""),h=n.createElementNS(t.namespaceURI,t.localName);l&&h.setAttribute("encoding",l);const c=n.createRange();c.selectNodeContents(h);const d="http://www.w3.org/2000/svg"===t.namespaceURI&&/^(foreignObject|desc|title)$/.test(t.localName)||/^(text\/html|application\/xhtml\+xml)$/.test(l)?"http://www.w3.org/1999/xhtml":t.namespaceURI,v=c.createContextualFragment(s.html);"http://www.w3.org/1998/Math/MathML"===t.namespaceURI&&/^(mi|mo|mn|ms|mtext)$/.test(t.localName)?(h.appendChild(v),e.sanitize(h,bi(bi({},Xd),{},{NAMESPACE:d||void 0,IN_PLACE:!0}))):("http://www.w3.org/1999/xhtml"===h.namespaceURI&&"template"===h.localName?h.content:h).appendChild(e.sanitize(v,bi(bi({},Xd),{},{NAMESPACE:d||void 0,RETURN_DOM_FRAGMENT:!0}))),i.wg(h),u=h.innerHTML,o.set(a,u)}e.innerHTML=u}s.css&&e.setAttribute("style",s.css)})}}):i.dg("Control variants leave the page unmodified.")}_is_bot(){return e&&this._instance?Mu(e,this.Fr.custom_blocked_useragents):void 0}},featureFlags:Fc},{conversations:class{constructor(t){this._instance=t,this.kg=void 0,this._conversationsManager=null,this.Sg=!1,this.ie=null,this.xg=!1,this.$g=0,this.Cg=null,this.Tg=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return void(this.Cg=null);if(this.Ig=t.ok,!t.ok)return;const i=t.config.conversations;R(i)?this.Cg=null:(j(i)?this.kg=i:(this.kg=i.enabled,this.ie=i),this.kg||(this.Cg=null),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.$g++,this.kg=void 0,this.ie=null,this.Ig=void 0,this.xg=!1,this.Cg=null}loadIfEnabled(){if(this._conversationsManager)return;if(this.Sg)return;if(this._instance.config.disable_conversations)return;if(Hr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==c?void 0:c.__PosthogExtensions__;if(t&&!A(this.kg)&&this.kg)if(this.ie&&this.ie.token){this.Sg=!0;try{const i=t.initConversations;if(i)return this.Mg(i),void(this.Sg=!1);const e=t.loadExternalDependency;if(!e)return void this.Eg(dn);const s=this.$g;e(this._instance,"conversations",i=>{if(s!==this.$g)return this.Sg=!1,void this.loadIfEnabled();i||!t.initConversations?this.Eg("Could not load conversations script",i):this.Mg(t.initConversations),this.Sg=!1})}catch(t){this.Eg("Error initializing conversations",t),this.Sg=!1}}else iv.error("Conversations enabled but missing token in remote config.")}Mg(t){if(this.ie){try{this._conversationsManager=t(this.ie,this._instance),this.xg=!1,iv.info("Conversations loaded successfully")}catch(t){return void this.Eg("Error completing conversations initialization",t)}this.Tg&&this._conversationsManager.setTheme(this.Tg),this.Ag()}else iv.error("Cannot complete initialization: remote config is null")}Ag(){const t=this.Cg;this.Cg=null,this._conversationsManager&&t&&("open"===t?this._conversationsManager.open():this._conversationsManager.close())}Eg(t,i){iv.error(t,i),this._conversationsManager=null,this.Sg=!1,this.xg=!0}show(){this._conversationsManager?this._conversationsManager.show():iv.warn("Conversations not loaded yet.")}hide(){"open"===this.Cg&&(this.Cg=null),this._conversationsManager&&this._conversationsManager.hide()}open(){this._conversationsManager?(this.Cg=null,this._conversationsManager.open()):this.Cg="open"}close(){this._conversationsManager?(this.Cg=null,this._conversationsManager.close()):this.Cg="close"}setTheme(t){var i,e;this.Tg=bi(bi(bi({},this.Tg),t),{},{dark:bi(bi({},null===(i=this.Tg)||void 0===i?void 0:i.dark),null==t?void 0:t.dark)}),null===(e=this._conversationsManager)||void 0===e||e.setTheme(t)}isAvailable(){return!0===this.kg&&!M(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Hr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Ig?"remote_config_failed":A(this.kg)?this.Ig?"disabled_in_project":"remote_config_pending":this.kg?R(this.ie)||!this.ie.token?"missing_token":(null==c?void 0:c.__PosthogExtensions__)?this.Sg?"initializing":this.xg?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var s=this;return J(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,e):(iv.warn(ev),null)})()}getMessages(t,i){var e=this;return J(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(iv.warn(ev),null)})()}markAsRead(t){var i=this;return J(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(iv.warn(ev),null)})()}getTickets(t){var i=this;return J(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(iv.warn(ev),null)})()}requestRestoreLink(t){var i=this;return J(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(iv.warn(ev),null)})()}restoreFromToken(t){var i=this;return J(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(iv.warn(ev),null)})()}restoreFromUrlToken(){var t=this;return J(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(iv.warn(ev),null)})()}getCurrentTicketId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Sd(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}xd(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},{logs:class extends hv{constructor(t){super({get(){var i;return null==t||null===(i=t.config)||void 0===i?void 0:i.logs},captureHintKey:Rn,get remoteConfigWillArrive(){var i,e;return!(null===(i=t.ec)||void 0===i?void 0:i.call(t))||!!(null===(e=c._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[t.config.token])||void 0===e?void 0:e.config)}},()=>function(t){var i;const e={};if(e.distinctId=t.get_distinct_id(),t.sessionManager){const{sessionId:i,windowId:s,sessionStartTimestamp:n,lastActivityTimestamp:r}=t.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i,e.windowId=s,R(n)||(e.sessionStartTimestamp=n),R(r)||(e.lastActivityTimestamp=r)}if((null==c||null===(i=c.location)||void 0===i?void 0:i.href)&&(e.currentUrl=t.config.disable_capture_url_hashes?di(c.location.href):c.location.href),t.featureFlags){const i=t.featureFlags.getFlags();i&&i.length>0&&(e.activeFeatureFlags=i)}return e}(t)),this._instance=t,this.name=dh,this.rf()}get nf(){return this._instance.__loaded}sf(){const t=Ns("[logs]"),i=null==c?void 0:c.__PosthogExtensions__;if(!i)return void t.error("PostHog Extensions not found.");const e=i.loadExternalDependency;if(e)return t=>{e(this._instance,"logs",e=>{const s=i.logs;t(e,(null==s?void 0:s.initializeLogs)?{initialize:t=>s.initializeLogs(t),replay(t,i){var e;return null===(e=s.replayConsoleBuffer)||void 0===e?void 0:e.call(s,t,i)}}:void 0)})};t.error(dn)}}},{metrics:class{constructor(t){this._instance=t,this.R=Ns("[metrics]"),this.Ti=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.Ti)return;const i=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);i&&!this.Rg?this.Rg=(t=>{let i=!0;const e=()=>i?(t=>{var i;const e=null===(i=t.config.metrics)||void 0===i?void 0:i.network;return!0===e?{}:e||void 0})(t):void 0,s=_v(t,e),n=mv(t,e);return()=>{i=!1,s(),n()}})(this._instance):!i&&this.Rg&&(this.Rg(),this.Rg=void 0)}uf(){var t;if(this.Ti)return;const i=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var e;return this.ef&&this.cf===i||(null===(e=this.ef)||void 0===e||e.reset(),this.cf=i,this.ef=new Is(this.lf(),function(t){var i,e,s,n,r;const o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==o?void 0:o["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==o?void 0:o["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(s=null==o?void 0:o["deployment.environment"])&&void 0!==s?s:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(n=null==t?void 0:t.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(i),this.R)),this.ef}count(t,i=1,e){var s;null===(s=this.uf())||void 0===s||s.count(t,i,e)}gauge(t,i,e){var s;null===(s=this.uf())||void 0===s||s.gauge(t,i,e)}histogram(t,i,e){var s;null===(s=this.uf())||void 0===s||s.histogram(t,i,e)}flush(t){if(!this.ef)return Promise.resolve();if(t){const i=this.ef.drainWindow();return i&&this._o(i,t),Promise.resolve()}return this.ef.flush().catch(t=>this.R.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.ef)||void 0===t||t.reset()}dispose(){var t,i;this.Ti=!0,null===(t=this.Rg)||void 0===t||t.call(this),this.Rg=void 0,null===(i=this.ef)||void 0===i||i.reset()}lf(){const t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},_o:t=>i._o(t),getLibraryId:()=>Ws.LIB_NAME,getLibraryVersion:()=>Ws.LIB_VERSION}}_o(t,i){return new Promise(e=>{let s=!1;const n=t=>{s||(s=!0,clearTimeout(r),e(t))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(bi(bi({method:"POST",url:this.Pg(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i}),{},{fireCallbackOnDrop:!0,callback(t){const i=t.statusCode;if(i>=200&&300>i)n({kind:"ok"});else if(413===i)n({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)n({kind:"fatal",error:new Error(`metrics request failed with status ${i}`)});else{var e;n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error(`metrics request failed with status ${i}`)})}}}))})}Pg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},{webMCP:class{constructor(t){this._instance=t,this.Og=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.Og)return;const t=null==s?void 0:s.modelContext;if(!t||!T(t.registerTool))return;const i=yv.get(t);if(i)return i.instances.add(this._instance),void(this.Og=!0);const e={instances:new Set([this._instance])},n=t.registerTool,r=this;Hh(t,"registerTool",t=>{const i=t;return function(t,...s){let n=t;try{n=r.Fg(t,e)}catch(e){return i.call(this,t,...s)}return i.call(this,n,...s)}}),t.registerTool!==n&&(yv.set(t,e),this.Og=!0)}Fg(t,i){if(!t||!T(t.execute))return t;const e=t.execute,s=this,{tool:n,injected:r}=function(t,i){const e={intent:!1,model:!1},s=t.inputSchema;if(!function(t){return!!A(t)||P(t)&&Object.keys(t).every(t=>bv.has(t)||t.startsWith("x-"))&&!0!==t.additionalProperties&&!P(t.additionalProperties)&&(!t.type||"object"===t.type)&&(!t.properties||P(t.properties))&&(!t.required||E(t.required))}(s))return{tool:kv(t),injected:e};const n=(null==s?void 0:s.properties)||{},r=t=>Sv(n,t)||E(null==s?void 0:s.required)&&s.required.includes(t);if(e.intent=i.intent&&!r("context"),e.model=i.model&&!r("llm_model"),!e.intent&&!e.model)return{tool:kv(t),injected:e};const o=bi({},n),l=E(null==s?void 0:s.required)?[...s.required]:[];return e.intent&&(o.context={type:"string",description:'Explain why this tool is called and how it supports the user\'s goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".'},l.includes("context")||l.push("context")),e.model&&(o.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},l.includes("llm_model")||l.push("llm_model")),{tool:kv(t,bi(bi({},s),{},{type:(null==s?void 0:s.type)||"object",properties:o,required:l})),injected:e}}(t,function(t){const i={intent:!1,model:!1};for(const e of t.instances){const t=xv(e.config.capture_webmcp);i.intent||(i.intent=!0===(null==t?void 0:t.intent)),i.model||(i.model=!0===(null==t?void 0:t.model))}return i}(i));return Object.defineProperty(n,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){const l=new Date,a=function(t,i){if(!P(t))return{};try{const e=i.intent?Ev(t.context,2048,!0):void 0,s=i.model?Ev(t.llm_model,256):void 0;return bi(bi({},e&&"{}"!==e?{intent:e}:{}),s&&"unknown"!==s.toLowerCase()?{model:s}:{})}catch(t){return{}}}(o[0],r),u=function(t,i){const e=t[0];if(!P(e))return t;try{const s=i.intent&&Sv(e,"context"),n=i.model&&Sv(e,"llm_model");if(!s&&!n)return t;const r=bi({},e);return s&&delete r.context,n&&delete r.llm_model,[r,...t.slice(1)]}catch(i){return t}}(o,r);let h;try{h=e.apply(this===n?t:this,u)}catch(t){throw s.Dg(i,n,l,{error:t,errorResult:!1},a),t}if((c=h)&&"function"==typeof c.then)return Promise.resolve(h).then(t=>{const e=Tv(t)?{error:t,errorResult:!0}:void 0;return s.Dg(i,n,l,e,a),t},t=>{throw s.Dg(i,n,l,{error:t,errorResult:!1},a),t});var c;const d=Tv(h)?{error:h,errorResult:!0}:void 0;return s.Dg(i,n,l,d,a),h}}),n}Dg(t,i,e,s,r){const o=Date.now()-e.getTime();let l;for(const u of t.instances){var a;const t=xv(u.config.capture_webmcp);if(t){s&&!l&&(l=Ov(s.error,s.errorResult));try{u.capture("$mcp_tool_call",bi(bi(bi({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==n?void 0:n.hostname,$mcp_duration_ms:o,$mcp_is_error:!!s},l?{$mcp_error_type:l.type,$mcp_error_message:l.message}:{}),t.intent&&r.intent?{$mcp_intent:r.intent,$mcp_intent_source:"context_parameter"}:{}),t.model&&r.model?{$mcp_llm_model:r.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:e})}catch(t){continue}if(s&&l&&u.exceptions&&(null===(a=u.exceptionObserver)||void 0===a?void 0:a.isEnabled))try{const t={$exception_list:Av(u.exceptions,s,l.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==n?void 0:n.hostname};u.exceptionObserver.captureException(t)}catch(t){}}}}}})),function(){Ws.SDK_DIST_CHANNEL="cdn";const i=c.posthog;if(i&&!E(i._i)&&T(i.init))return;const e=gh[Ah]=new jh;if(i){const t=[];Rr(i._i,function(s){if(s&&E(s)){const n=e.init(s[0],s[1],s[2]),r=i[s[2]]||i;n.__loaded&&-1===t.indexOf(r)&&(t.push(r),n._execute_array.call(n.people,r.people),n._execute_array(r))}});const s=i.people;if(!e.__loaded&&E(i)){const t=e.init;let n=!0;e.init=(r,o,l)=>{const a=t.call(e,r,o,l);return n&&a===e&&a.__loaded&&(n=!1,e.init=t,a._execute_array.call(a.people,s),a._execute_array(i)),a}}}e.__SV=1,c.posthog=e,function(){function i(){i.done||(i.done=!0,bu=!1,Rr(gh,function(t){t._dom_loaded()}))}(null==s?void 0:s.addEventListener)?"complete"===s.readyState?i():Ur(s,"DOMContentLoaded",i,{capture:!1}):t&&Ls.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
1
+ !function(){const t="u">typeof window?window:void 0,i="u">typeof globalThis?globalThis:t,e=null==i?void 0:i.navigator,s=null==i?void 0:i.document,n=null==i?void 0:i.location,r=null==i?void 0:i.fetch,o=(null==i?void 0:i.XMLHttpRequest)&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,l=null==i?void 0:i.AbortController,a=null==i?void 0:i.CompressionStream,u=null==e?void 0:e.userAgent,h="undefined"!=typeof globalThis?globalThis:t;h&&"undefined"==typeof self&&(h.self=h),h&&"undefined"==typeof File&&(h.File=function(){});const c=null!=t?t:{},d="0.10.7",v={DEBUG:!1,LIB_VERSION:d,LIB_NAME:"browser-common",JS_SDK_VERSION:d};var f=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),p=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const g=["$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"],_=["token"];function m(t,i){return-1!==t.indexOf(i)}const y=function(t){return t.trim()},b=function(t){return t.replace(/^\$/,"")};function w(t){var i;const e=[];return null!==(i=JSON.stringify(t,function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(e.includes(i))return"[Circular]";e.push(i)}return i}}))&&void 0!==i?i:"null"}const x=Object.prototype,S=x.hasOwnProperty,k=x.toString,E=Array.isArray||function(t){return"[object Array]"===k.call(t)},T=t=>"function"==typeof t,P=t=>t===Object(t)&&!E(t),C=t=>{if(P(t)){for(const i in t)if(S.call(t,i))return!1;return!0}return!1},A=t=>void 0===t,F=t=>"[object String]"==k.call(t),O=t=>F(t)&&0===t.trim().length,M=t=>null===t,R=t=>A(t)||M(t),I=t=>"[object Number]"==k.call(t)&&t==t,D=t=>I(t)&&t>0,j=t=>"[object Boolean]"===k.call(t),L=t=>m(g,t),N=t=>m(_,t);function z(t){return null===t||"object"!=typeof t}function B(t,i){return{}.toString.call(t)===`[object ${i}]`}function U(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return q(t,Error)}}function H(t){return"u">typeof Event&&q(t,Event)}function q(t,i){try{return t instanceof i}catch(t){return!1}}const W=[!0,"true",1,"1","yes"],V=t=>m(W,t),G=[!1,"false",0,"0","no"];function K(t,i,e,s,n,r,o){try{var l=t[r](o),a=l.value}catch(t){return void e(t)}l.done?i(a):Promise.resolve(a).then(s,n)}function J(t){return function(){var i=this,e=arguments;return new Promise(function(s,n){var r=t.apply(i,e);function o(t){K(r,s,n,o,l,"next",t)}function l(t){K(r,s,n,o,l,"throw",t)}o(void 0)})}}const Y=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","lightpanda","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"],Z=new Map,X=function(t,i=[]){if(!t)return!1;const e=function(t,i){let e="";for(let t=0;i.length>t;t++){const s=i[t];e+=s.length+":"+s}return t.length+":"+t+"|"+i.length+":"+e}(t,i),s=Z.get(e);if(void 0!==s)return s;const n=t.toLowerCase(),r=Y.concat(i).some(t=>-1!==n.indexOf(t.toLowerCase()));return 256>Z.size||Z.clear(),Z.set(e,r),r};function Q(t,i,e,s,n){return i>e&&(s.warn("min cannot be greater than max."),i=e),I(t)?t>e?(s.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(s.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(s.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+n),Q(null!=n?n:e,i,e,s))}var tt=class{constructor(t){this.C={},this.I=t.I,this.A=Q(t.bucketSize,0,100,t.R),this.O=Q(t.refillRate,0,this.A,t.R),this.$=Q(t.refillInterval,0,864e5,t.R)}F(t,i){const e=Math.floor((i-t.lastAccess)/this.$);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.A),t.lastAccess=t.lastAccess+e*this.$)}consumeRateLimit(t){var i;const e=Date.now(),s=String(t);let n=this.C[s];return n?this.F(n,e):(n={tokens:this.A,lastAccess:e},this.C[s]=n),0===n.tokens||(n.tokens--,0===n.tokens&&(null===(i=this.I)||void 0===i||i.call(this,t)),0===n.tokens)}stop(){this.C={}}};const it="Mobile",et="Android",st="Tablet",nt="Android Tablet",rt="iPad",ot="Apple Watch",lt="Safari",at="BlackBerry",ut="Samsung Internet",ht="Chrome",ct="Chrome iOS",dt="Internet Explorer",vt="Internet Explorer Mobile",ft="Opera",pt="Microsoft Edge",gt="Firefox",_t="Firefox iOS",mt="Nintendo",yt="PlayStation",bt="Xbox",wt="Android Mobile",$t="Mobile Safari",xt="Windows",St="Windows Phone",kt="Nokia",Et="Ouya",Tt="Generic tablet",Pt="Konqueror",Ct="Oculus Browser",At="Vivaldi",Ft="Yandex",Ot="Whale",Mt="DuckDuckGo",Rt="Pale Moon",It="Waterfox",Dt="Brave",jt="Claude",Lt="Codex",Nt="ChatGPT",zt="Google Search App",Bt=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ut=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ht=new RegExp(bt,"i"),qt=new RegExp("PlayStation \\w+","i"),Wt=new RegExp("Nintendo \\w+","i"),Vt=new RegExp("BlackBerry|PlayBook|BB10","i"),Gt={"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"},Kt=function(t,i,e,s){i=i||"";const n=function(t){return(null==t?void 0:t.brave)?Dt:null}(e);return n||((null==s?void 0:s.detectGoogleSearchApp)&&m(t,"GSA/")?zt:m(t," OPR/")&&m(t,"Mini")?"Opera Mini":m(t," OPR/")?ft:Vt.test(t)?at:m(t,"IEMobile")||m(t,"WPDesktop")?vt:m(t,"OculusBrowser")?Ct:m(t,"SamsungBrowser")?ut:m(t,"Edge")||m(t,"Edg/")?pt:m(t,"Vivaldi/")?At:m(t,"YaBrowser/")?Ft:m(t,"Whale/")?Ot:m(t,"DuckDuckGo/")||m(t,"Ddg/")?Mt:m(t,"Claude/")?jt:m(t,"Codex/")?Lt:m(t,"ChatGPT/")?Nt:m(t,"FBIOS")?"Facebook Mobile":m(t,"UCWEB")||m(t,"UCBrowser")?"UC Browser":m(t,"CriOS")?ct:m(t,"CrMo")||m(t,ht)?ht:m(t,et)&&m(t,lt)?wt:m(t,"FxiOS")?_t:m(t.toLowerCase(),Pt.toLowerCase())?Pt:m(t,"Brave/")?Dt:((t,i)=>i&&m(i,"Apple")||function(t){return m(t,lt)&&!m(t,ht)&&!m(t,et)}(t))(t,i)?m(t,it)?$t:lt:m(t,"PaleMoon/")?Rt:m(t,"Waterfox/")?It:m(t,gt)?gt:m(t,"MSIE")||m(t,"Trident/")?dt:m(t,"Gecko")?gt:"")},Jt={[vt]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[pt]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[ht]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ct]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[lt]:[Bt],[$t]:[Bt],[ft]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[gt]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[_t]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Pt]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[at]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Bt],[wt]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ut]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Ct]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[At]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ft]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Ot]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Dt]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[jt]:[Ut],[Lt]:[Ut],[Nt]:[Ut],[Mt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Rt]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[It]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[zt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[dt]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Yt=function(t,i,e,s){const n=Kt(t,i,e,s),r=Jt[n];if(A(r))return null;for(let i=0;r.length>i;i++){const e=t.match(r[i]);if(e)return parseFloat(e[e.length-2])}return null},Zt=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[bt,t&&t[1]||""]],[new RegExp(mt,"i"),[mt,""]],[new RegExp(yt,"i"),[yt,""]],[Vt,[at,""]],[new RegExp(xt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[St,""];if(new RegExp(it).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];const e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){let t=Gt[e[1]]||"";return/arm/i.test(i)&&(t="RT"),[xt,t]}return[xt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let i="";return t&&t.length>=3&&(i=A(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[et,[t[2],t[3],t[4]||"0"].join(".")]:[et,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Xt=function(t){for(let i=0;Zt.length>i;i++){const[e,s]=Zt[i],n=e.exec(t),r=n&&(T(s)?s(n,t):s);if(r)return r}return["",""]},Qt=function(t){return Wt.test(t)?mt:qt.test(t)?yt:Ht.test(t)?bt:new RegExp(Et,"i").test(t)?Et:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?St:/iPad/.test(t)?rt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ot:Vt.test(t)?at:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(kt,"i").test(t)?kt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(it).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?et:nt:new RegExp("(pda|Mobile)","i").test(t)?"Generic mobile":new RegExp(st,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?Tt:""},ti=function(t,i){var e;const s=Qt(t);return s===rt||s===nt||"Kobo"===s||"Kindle Fire"===s||s===Tt?st:s===mt||s===bt||s===yt||s===Et?"Console":s===ot?"Wearable":s?it:"Android"===(null==i?void 0:i.userAgentDataPlatform)&&(null!==(e=null==i?void 0:i.maxTouchPoints)&&void 0!==e?e:0)>0?600>Math.min(null!==(n=null==i?void 0:i.screenWidth)&&void 0!==n?n:0,null!==(r=null==i?void 0:i.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==i?void 0:i.devicePixelRatio)&&void 0!==o?o:1)?it:st:"Desktop";var n,r,o},ii=/\bFBAV\/(\d+(?:\.\d+)*)/i,ei=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",ii],[/\bFBAN\/EMA\b/i,"Facebook Lite",ii],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",ii],[/\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"]],si="[Truncated]",ni="[Unserializable]";function ri(t){let i="";for(let e=0;t.length>e;e++){const s=t.charCodeAt(e);if(55296>s||s>56319)i+=56320>s||s>57343?t[e]:"�";else{const s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}function oi(t,i){if(!i)return t;let e=[];try{e=Object.keys(i)}catch(t){e=[]}for(const s of e){let e;try{e=i[s]}catch(t){e=ni}Object.defineProperty(t,s,{value:e,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const li=3e5;var ai=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const i=this.isOpen(),e=Date.now(),s=Math.min(t.retryAfterMs,li);if(!i)return this.ts=e,void(this.es=e+s);this.es=Math.max(this.es,Math.min(e+s,this.ts+li))}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const i=Math.min(li,Math.max(0,this.es-t));return 0===i&&this.reset(),i}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const ui=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function hi(t,i){return"string"==typeof(e=t)&&ui.test(e)?t:i();var e}function ci(t,i){const e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function di(t){return t?t.split("#")[0]:t}function vi(t){try{return t()}catch(t){return}}function fi(t,i){const e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function pi(t,i,e){return gi.apply(this,arguments)}function gi(){return(gi=J(function*(t,i,e){let s;try{return yield Promise.race([t,new Promise((t,n)=>{s=fi(()=>{try{null==e||e(),t()}catch(t){n(t)}},i)})])}finally{clearTimeout(s)}})).apply(this,arguments)}function _i(t){return _i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_i(t)}function mi(t,i,e){return(i=function(t){var i=function(t){if("object"!=_i(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var e=i.call(t,"string");if("object"!=_i(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_i(i)?i:i+""}(i))in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function yi(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),e.push.apply(e,s)}return e}function bi(t){for(var i=1;arguments.length>i;i++){var e=null!=arguments[i]?arguments[i]:{};i%2?yi(Object(e),!0).forEach(function(i){mi(t,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):yi(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})}return t}let wi,$i,xi,Si;function ki(t){var i;const e=globalThis._posthogChunkIds,s=globalThis._debugIds;if(!e&&!s)return;const n=e?Object.keys(e):[],r=s?Object.keys(s):[];if(Si&&Ei(e,n,$i)&&Ei(s,r,xi))return Si;$i=e?bi({},e):void 0,xi=s?bi({},s):void 0,Si={},null!==(i=wi)&&void 0!==i||(wi={});const o=(i,e)=>{for(const n of i){const i=e[n];if(!i)continue;const r=null==wi?void 0:wi[n];if(r){Si[r]=i;continue}const o=t(n);for(let t=o.length-1;t>=0;t--){var s;const e=null===(s=o[t])||void 0===s?void 0:s.filename;if(e){Si[e]=i,wi[n]=e;break}}}};return s&&o(r,s),e&&o(n,e),Si}function Ei(t,i,e){return t&&e?i.length===Object.keys(e).length&&i.every(i=>t[i]===e[i]):t===e}var Ti=class{constructor(t,i,e=[]){this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i={}){const e=i&&i.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(e,i,0).apply(t),n=this.buildParsingContext(i),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,e),$exception_level:"error"}}modifyFrames(t){var i=this;return J(function*(){for(const e of t)e.stacktrace&&e.stacktrace.frames&&E(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t})()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e;let s,n;if(null!=t.cause&&(s=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack)try{n=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)}catch(t){}return bi(bi({},t),{},{cause:s,stack:n,errors:null===(e=t.errors)||void 0===e?void 0:e.map(t=>this.parseStacktrace(t,i))})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(const e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return J(function*(){let e=t;for(const t of i.modifiers)e=yield t(e);return e})()}convertToExceptionList(t,i){const e=[],s=(t,n,r)=>{var o;const l=e.length,a=void 0===n?bi(bi({type:"string"==typeof i.type&&i.type.length>0?i.type:"generic"},"boolean"==typeof i.handled?{handled:i.handled}:void 0===i.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof i.synthetic?i.synthetic:t.synthetic,exception_id:l}):{type:"chained",source:r,synthetic:t.synthetic,exception_id:l,parent_id:n},u={type:t.type,value:t.value,mechanism:a};t.stack&&(u.stacktrace={type:"raw",frames:t.stack}),e.push(u),t.cause&&s(t.cause,l,"cause");for(const i of null!==(o=t.errors)&&void 0!==o?o:[])s(i,l,"member")};return s(t),e}buildParsingContext(t){var i;return{chunkIdMap:ki(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}getAggregateErrors(t){try{if(U(t)){let e=Object.getPrototypeOf(t);for(let s=0;e&&100>s;s++){var i;const s=null===(i=Object.getOwnPropertyDescriptor(e,"constructor"))||void 0===i?void 0:i.value;if("function"==typeof s&&"AggregateError"===s.name){const i=t.errors;return E(i)?i:void 0}e=Object.getPrototypeOf(e)}}}catch(t){}}buildCoercingContext(t,i,e=0){let s=0,n=0,r=!1;const o=new Set,l=[],a={},u=(t,i,e=0)=>{const u=h(i,e),c=u.apply;if(u.apply=i=>{l.push(t);try{return c(i)}finally{l.pop()}},e>4||e>0&&-1!==l.indexOf(t))return this.coerceFallback(u);const d="object"==typeof t&&null!==t||"function"==typeof t;if(0===e&&s>=50||d&&o.has(t))return;d&&o.add(t),0===e&&s++;const v=this.getAggregateErrors(t);let f,p;r||(r=!!v);try{if(f=this.applyCoercers(t,u),!f)throw a}catch(t){if(t===a)return void(0===e&&s--);if(!r)throw t;f=this.coerceFallback(u)}if(!v||s>=50)return f;try{p=v.length}catch(t){return f}if(!Number.isInteger(p)||0>p||p>4294967295)return f;const g=[];for(let t=0;50>s&&1e3>n&&p>t;t++){let e;n++;try{e=u.next(v[t])}catch(t){s++,e=this.coerceFallback(h(i+1))}e&&g.push(e)}return bi(bi({},f),{},{errors:g})},h=(e,s=0)=>bi(bi({},i),{},{syntheticException:0==e?i.syntheticException:void 0,mechanism:0==e?t:{},apply(t){const i=u(t,e,s+1);if(!i)throw a;return i},next:t=>u(t,e+1)}),c=h(e);return bi(bi({},c),{},{apply:t=>{var i;return null!==(i=u(t,e))&&void 0!==i?i:this.coerceFallback(c)}})}};const Pi=/^([a-z][a-z0-9.+-]+):/i,Ci=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function Ai(t){if(!t||"<anonymous>"===t)return!1;const i=Pi.exec(t);return!i||Ci.includes(i[1].toLowerCase())}function Fi(t,i,e,s,n){const r={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:Ai(i)};return A(s)||(r.lineno=s),A(n)||(r.colno=n),r}const Oi=(t,i)=>{const e=-1!==t.indexOf("safari-extension"),s=-1!==t.indexOf("safari-web-extension");return e||s?[-1!==t.indexOf("@")?t.split("@")[0]:"?",e?`safari-extension:${i}`:`safari-web-extension:${i}`]:[t,i]},Mi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ri=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ii=/\((\S*)(?::(\d+))(?::(\d+))\)/,Di=(t,i)=>{const e=Mi.exec(t);if(e){const[,t,s,n]=e;return Fi(i,t,"?",+s,+n)}const s=Ri.exec(t);if(s){if(s[2]&&0===s[2].indexOf("eval")){const t=Ii.exec(s[2]);t&&(s[2]=t[1],s[3]=t[2],s[4]=t[3])}const[t,e]=Oi(s[1]||"?",s[2]);return Fi(i,e,t,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},ji=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Li=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ni=(t,i)=>{const e=ji.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=Li.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}let t=e[3],s=e[1]||"?";return[s,t]=Oi(s,t),Fi(i,t,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},zi=/\(error: (.*)\)/;function Bi(t,i){return t.filename===i.filename&&t.function===i.function&&t.module===i.module&&t.lineno===i.lineno&&t.colno===i.colno}function Ui(t){for(let i=1;10>=i;i++){const e=t.length-2*i;if(0>e)break;let s=!0;for(let n=0;i>n;n++)if(!Bi(t[e+n],t[e+i+n])){s=!1;break}if(s){for(let s=0;i>s;s++)t[e+s]=t[e+i+s];return t.length=e+i,{start:e,length:i}}}}function Hi(t,i){const e=i.start+i.length,s=Wi(t,i);s&&t.splice(e+s===t.length?e:i.start,s)}function qi(t,i){let e=i.start;for(;e>0&&Bi(t[e-1],t[e-1+i.length]);)e--;return i.start-e}function Wi(t,i){const e=i.start+i.length;let s=e;for(;t.length>s&&Bi(t[s],t[s-i.length]);)s++;return s-e}function Vi(t,i){const e=i[0];let s=t.length-(e?qi(t,e):0);for(const e of i)s-=Wi(t,e);return s}function Gi(t,i,e){for(let s=0;t.length>s;s++){const n=t[(i+s)%t.length],r=t[(e+s)%t.length];if(n!==r)return r>n}return!1}var Ki=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){const e=F(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){const i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${i}: ${t.message}`:i}isDOMException(t){return B(t,"DOMException")}isDOMError(t){return B(t,"DOMError")}},Ji=class{match(t){return U(t)}coerce(t,i){var e;const s=this.getStack(t),n=void 0===s?null===(e=i.syntheticException)||void 0===e?void 0:e.stack:void 0,r=!!n;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=s?s:n,cause:t.cause?i.next(t.cause):void 0,synthetic:r}}getType(t){return t.name||t.constructor.name}getMessage(t,i){const e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){try{const i=t.stacktrace;if("string"==typeof i&&i.length>0)return i;const e=t.stack;return"string"==typeof e&&e.length>0?e:void 0}catch(t){return}}},Yi=class{match(t){return!!B(t,"ErrorEvent")&&(null!=t.error||this.yr(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);const s=i.apply(t.message);return bi(bi({},s),{},{stack:null!==(e=this.br(t))&&void 0!==e?e:s.stack,synthetic:!0})}yr(t){return F(t.message)&&t.message.length>0}br(t){var i,e;const s=t,n=null!==(i=s.lineno)&&void 0!==i?i:0,r=null!==(e=s.colno)&&void 0!==e?e:0;if(F(s.filename)&&0!==s.filename.length&&0!==n)return`Error\n at ${s.filename}:${n}:${r}`}};const Zi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Xi=class{match(t){return"string"==typeof t}coerce(t,i){var e;const[s,n]=this.getInfos(t);return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}getInfos(t){let i="Error",e=t;const s=t.match(Zi);return s&&(i=s[1],e=s[2]),[i,e]}};const Qi=["fatal","error","warning","log","info","debug"];function te(t,i=40){const e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(let t=e.length;t>0;t--){const s=e.slice(0,t).join(", ");if(i>=s.length)return t===e.length?s:s.length>i?`${s.slice(0,i)}...`:s}return""}var ie=class{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,s;const n=this.getErrorPropertyFromObject(t);return n?i.apply(n):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null===(s=i.syntheticException)||void 0===s?void 0:s.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(H(t))return t.constructor.name;const i="name"in t?t.name:void 0;return F(i)&&!O(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){let i=`'${t.name}' captured as exception`;return"message"in t&&"string"==typeof t.message&&(i+=` with message: '${t.message}'`),i}if("message"in t&&"string"==typeof t.message)return t.message;const i=this.getObjectClassName(t);return`${i&&"Object"!==i?`'${i}'`:"Object"} captured as exception with keys: ${te(t)}`}isSeverityLevel(t){return F(t)&&!O(t)&&Qi.indexOf(t)>=0}getStack(t){try{return F(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:F(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(const i in t)if({}.hasOwnProperty.call(t,i)){const e=t[i];if(U(e))return e}}getObjectClassName(t){try{const i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},ee=class{match(t){return H(t)}coerce(t,i){var e;const s=t.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${te(t)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}},se=class{match(t){return z(t)}coerce(t,i){var e;return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}},ne=class{match(t){return B(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!H(t))return!1;try{const i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e;const s=this.getUnhandledRejectionReason(t);return z(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}:i.apply(s)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}};const re="$message",oe="$timestamp",le=new Set([re,oe]),ae={enabled:!0,max_bytes:32768};function ue(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:ae.enabled,max_bytes:ce(t.max_bytes,ae.max_bytes)}:bi({},ae)}var he=class{constructor(t){this.ns=[],this.ss=0,this.Fr=ue(t)}setConfig(t){this.Fr=ue(t),this.rs()}add(t){const i=function(t){let i;try{i=w(t)}catch(t){return}try{const t=JSON.parse(i);if(!P(t))return;const e=t,s=e[re],n=e[oe];if(!F(s)||0===s.trim().length)return;if(!F(n)&&!I(n))return;return{step:e,json:i}}catch(t){return}}(t);if(!i)return;const e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;const i=encodeURIComponent(t);let e=0;for(let t=0;i.length>t;t++)"%"===i[t]?(e+=1,t+=2):e+=1;return e}(i.json);e>this.Fr.max_bytes||(this.ns.push({step:i.step,bytes:e}),this.ss+=e,this.rs())}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Fr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function ce(t,i){if(!I(t)||1/0===t||-1/0===t)return i;const e=Math.floor(t);return 0>e?i:e}const de=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function ve(t){return"string"==typeof t||t}function fe(t){return"string"==typeof t?t:void 0}const pe=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],ge="NativeGzipValidationError",_e=t=>t.length>=2&&31===t[0]&&139===t[1],me=(t,i)=>t===p.GZipJS||i===p.GZipJS||"gzip"===i,ye=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):"");let be;const we=t=>{throw ci(ge,`Native gzip produced invalid output: ${t}`)},$e=function(){var t=J(function*(t,i){18>t.size&&we("too-short");const e=new Uint8Array(yield t.slice(0,10).arrayBuffer());_e(e)&&8===e[2]||we("invalid-header");const s=new DataView(yield t.slice(t.size-8).arrayBuffer());s.getUint32(0,!0)!==(t=>{const i=(()=>{if(be)return be;be=[];for(let t=0;256>t;t++){let i=t;for(let t=0;8>t;t++)i=1&i?3988292384^i>>>1:i>>>1;be[t]=i>>>0}return be})();let e=4294967295;for(let s=0;t.length>s;s++)e=i[255&(e^t[s])]^e>>>8;return(4294967295^e)>>>0})(i)&&we("invalid-crc");const n=i.length>>>0;s.getUint32(4,!0)!==n&&we("invalid-size")});return function(i,e){return t.apply(this,arguments)}}();function xe(){return xe=J(function*(t,i=!0,e){try{const i=(new TextEncoder).encode(t),e=new globalThis.CompressionStream("gzip"),n=e.writable.getWriter(),r=n.write(i).then(()=>n.close()).catch((s=J(function*(t){try{yield n.abort(t)}catch(t){}throw t}),function(t){return s.apply(this,arguments)})),o=new Response(e.readable).blob(),[l]=yield Promise.all([o,r]);return yield $e(l,i),l}catch(t){if(null==e?void 0:e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}var s}),xe.apply(this,arguments)}function Se(t,i){if(null==t)return{};var e,s,n=function(t,i){if(null==t)return{};var e={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(i.includes(s))continue;e[s]=t[s]}return e}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;r.length>s;s++)i.includes(e=r[s])||{}.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}const ke="[redacted]",Ee=/^[A-Za-z0-9+/\n\r]+=*$/,Te=/^[A-Za-z0-9_-]+={0,2}$/,Pe=/[-_]/,Ce=/^data:[^,\s]*;base64,/i,Ae=/^[A-Za-z0-9+/_-]+={0,2}$/,Fe=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,Oe=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,Me=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,Re=/[\s<>"]/,Ie=(()=>new RegExp(Me.source,"i"))(),De=/[a-z][a-z0-9+.-]{0,63}:\/\//i,je=(()=>new RegExp(`^${De.source}`,"i"))(),Le=(()=>new RegExp(De.source,"gi"))(),Ne=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,ze=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,Be=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,Ue=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,He=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,qe=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,We=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,Ve=/\b\d(?:[ ./-]?\d){12,}\b/g,Ge=/\d+/g,Ke=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,Je=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function Ye(t){return function(t){return Oe.test(t)}(t)||Ne.test(t)||ze.test(t)}function Ze(t){return t.split("&",129).length>128}function Xe(t,i,e){return Ye(t)||i.includes(";")&&function(t){return t.split(";").some(t=>Ye(t.split("=",1)[0]))}(i)?ke:Ie.test(i)?e?ns(i,{allowNestedUrls:!1,stripPunctuation:!0}):ke:i}function Qe(t,i){const e=new URLSearchParams;let s=!1,n=!1;for(const[r,o]of new URLSearchParams(t)){const t=rs(r),l=rs(o);s||(s=t!==r||l!==o);const a=Xe(t,l,i);s||(s=a!==l),n=Ye(t)||a!==l,e.append(t,a)}return{changed:s,lastFieldSensitive:n,serialized:e.toString()}}function ts(t,i){if(!t.includes("="))return{value:is(t,i),lastFieldSensitive:!1};const e=Qe(t,i);return{value:e.changed?e.serialized:t,lastFieldSensitive:e.lastFieldSensitive}}function is(t,i){return i?ns(t,{allowNestedUrls:!1,stripPunctuation:!0}):Ie.test(t)?ke:t}function es(t,i,e){return"#"===t?!i.fragment&&(i.fragment=!0):"?"===t&&(i.fragment?"="!==e&&!i.fragmentQuery&&(i.fragmentQuery=!0):!i.query&&(i.query=!0))}function ss(t,i){var e;if(t.length>8192&&je.test(t))return ke;const{address:s,suffix:n}=i.stripPunctuation?function(t){let i=t.length;for(;i>0&&".,;:!?)]}'".includes(t[i-1]);)i--;return{address:t.slice(0,i),suffix:t.slice(i)}}(t):{address:t,suffix:""};let r;try{r=new URL(s)}catch(t){return ke+n}const o=r.search.slice(1),l=""!==r.hash,a=function(t){const i=t.slice(1),e=i.indexOf("?");return 0>e?{head:i,tail:null}:{head:i.slice(0,e),tail:i.slice(e+1)}}(r.hash);if(Ze(o)||Ze(a.head)||Ze(null!==(e=a.tail)&&void 0!==e?e:""))return ke+n;let u=!1;(r.username||r.password)&&(r.username=ke,r.password="",u=!0);const h=Qe(o,i.allowNestedUrls);h.changed&&(r.search=h.serialized,u=!0);const c=ts(a.head,i.allowNestedUrls),d=null===a.tail?null:(v=a.tail,c.lastFieldSensitive?{value:""===v?"":ke,lastFieldSensitive:!0}:ts(v,i.allowNestedUrls));var v;const f=null===d?c.value:`${c.value}?${d.value}`;f!==r.hash.slice(1)&&(r.hash=f,u=!0);const p=l?null!=d?d:c:h;return(u?rs(r.toString()):s)+(p.lastFieldSensitive?"":n)}function ns(t,i){return t.replace(Me,e=>function(t,i){const e=function(t){if(!t.includes("://"))return[];const i=[...t.matchAll(Le)].map(t=>t.index),e=[],s={query:!1,fragment:!1,fragmentQuery:!1};let n=0,r=!1,o="";for(let l=0;t.length>l&&i.length>n;l++){i[n]===l&&(l>0&&"="!==o&&e.push(l),n++);const a=t[l];es(a,s,o)?(o=a,r=!0):r&&"=&".includes(a)&&(o=a)}return e}(t);if(0===e.length)return ss(t,i);let s="",n=0;for(const r of e)s+=ss(t.slice(n,r),bi(bi({},i),{},{stripPunctuation:!1})),n=r;return s+ss(t.slice(n),i)}(e,bi(bi({},i),{},{stripPunctuation:i.stripPunctuation&&e.length!==t.length})))}function rs(t){return t.replace(Fe,ke)}function os(t,i){return function(t){return t.length>=10240&&(Ee.test(t)||function(t){const i=Ce.exec(t);if(!i)return!1;let e;try{e=decodeURIComponent(t.slice(i[0].length))}catch(t){return!1}return Ae.test(e.replace(/[\r\n]/g,""))}(t)||Pe.test(t)&&Te.test(t))}(t)?"[binary data redacted - not supported by PostHog MCP analytics]":function(t,i,e){const s=4*e.maxStringLength;if(t.length>s){const n=i(t.slice(0,function(t,i){let e=i;for(;e>0&&!Re.test(t[e-1]);)e--;return e}(t,s)));if(n.length>=2*e.maxStringLength)return n+e.truncationSuffix}return i(t)}(t,t=>function(t){return ns(t,{allowNestedUrls:!0,stripPunctuation:!0})}(function(t){let i=t.replace(Be," ");return i=i.replace(Ue,ke),i=i.replace(He,ke),i=i.replace(qe,`$1${ke}`),i=i.replace(Ve,as),i=i.replace(We,ke),i=i.replace(Ke,`$1${ke}`),i=i.replace(Je,`$1${ke}`),i}(rs(t))),i)}function ls(t){let i=0,e=!1;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;if(0>n||n>9)return!1;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e}return i%10==0}function as(t){const i=[];for(let e=Ge.exec(t);null!==e;e=Ge.exec(t))i.push({digits:e[0],start:e.index,end:e.index+e[0].length});let e="",s=0,n=0;for(;i.length>n;){let r="",o=-1;for(let t=n;i.length>t&&(r+=i[t].digits,19>=r.length);t++)r.length>=13&&ls(r)&&(o=t);0>o?n++:(e+=t.slice(s,i[n].start)+ke,s=i[o].end,n=o+1)}return e+t.slice(s)}const us={}.propertyIsEnumerable;function hs(t,i){try{return vs(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function cs(t,i,e,s){if(0>=e.remainingNodes)return{stringValue:si};if(e.remainingNodes--,j(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){const e=t.toString(),s=BigInt("9223372036854775808");return t>=s||-s>t?(null==i||i.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}(t,i);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const e=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==i||i.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:ri(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:si};if(t instanceof Date){const i=t.getTime(),e=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:"string"==typeof e?ri(e):String(e)}}e.ancestors.add(t);try{try{const n=t.toJSON;if("function"==typeof n)return cs(n.call(t),i,e,s+1)}catch(t){}return E(t)?{arrayValue:{values:ds(t,i,e,s+1)}}:{kvlistValue:{values:vs(t,i,e,s+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:ri(String(t))}}function ds(t,i,e,s){const n=[],r=Math.min(t.length,1e3);let o=0;for(;r>o&&e.remainingNodes>0;o++)try{const r=o in t?t[o]:void 0;if(R(r))continue;n.push(cs(r,i,e,s))}catch(t){n.push({stringValue:ni})}return t.length>o&&n.push({stringValue:si}),n}function vs(t,i,e,s){const n=[];for(const r in t)if(us.call(t,r)){if(!r){null==i||i.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=t[r];if(M(o)||A(o))continue;n.push({key:ri(r),value:cs(o,i,e,s)})}catch(t){n.push({key:ri(r),value:{stringValue:ni}})}}return n}function fs(t,i,e){return bi(bi(bi(bi({},oi({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}const ps=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function gs(t,i){const e=oi({},t),s={};for(const t of ps)({}).hasOwnProperty.call(e,t)&&(s[t]=e[t],delete e[t]);return[...hs(e,i),...hs(s,i)]}const _s={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"};const ms={text:"INFO",number:9},ys={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:ms,warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}};function bs(t){try{return ri(String(t))}catch(t){return ni}}function ws(t,i,e,s){const n=t.level||"info",{text:r,number:o}=ys[n]||ms,l=function(t=Date.now()){return String(t)+"000000"}(I(s)?s:void 0),a={};i.distinctId&&(a.posthogDistinctId=i.distinctId),i.sessionId&&(a.sessionId=i.sessionId),i.windowId&&(a["window.id"]=i.windowId),R(i.sessionStartTimestamp)||(a.sessionStartTimestamp=String(i.sessionStartTimestamp)),R(i.lastActivityTimestamp)||(a.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(a["url.full"]=i.currentUrl),i.screenName&&(a["screen.name"]=i.screenName),i.appState&&(a["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(a.feature_flags=i.activeFeatureFlags);const u=bi({},a),h=t.attributes;if(h){let t=[];try{t=Object.keys(h)}catch(i){t=[]}for(const i of t){let t;try{t=h[i]}catch(i){t=ni}Object.defineProperty(u,i,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const c={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:bs(t.body)},attributes:hs(u,e)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),A(t.trace_flags)||(c.flags=t.trace_flags),c}function $s(t,i,e){return fs(t,i,e)}function xs(t,i,e,s){return{resourceLogs:[{resource:{attributes:gs(i)},scopeLogs:[{scope:{name:e,version:s},logRecords:t}]}]}}var Ss=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.cs}arm(t){this.clear(),this.us=Date.now()+t,this.cs=fi(()=>{this.cs=void 0,this.ls()},t)}armNoEarlierThan(t){this.cs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function ks(){return.75+.5*Math.random()}function Es(t,i,e,s){const n=Math.min(Math.max(0,i-1),6),r=t*Math.pow(2,n);return Math.round((void 0===s?r:Math.min(r,Math.max(s,t)))*e)}var Ts=class{constructor(t,i,e,s,n,r=()=>Promise.resolve(),o){var l;this._instance=t,this.Fr=i,this.R=e,this.hs=s,this.ds=n,this.vs=r,this.fs=o,this.ps=new Ss(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new ai,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=i.maxBufferSize,this.Is=Math.max(null!==(l=i.maxQueueSize)&&void 0!==l?l:i.maxBufferSize,i.maxBufferSize),this.Ms=i.flushIntervalMs,this.Es=i.maxBatchRecordsPerPost,this.As=i.rateCapWindowMs,this.Rs=i.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(f.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Fr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.Ps()&&this.Os():this.gs()}captureLog(t,i){var e;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const s=this.Fs(t);if(null===s)return;if(!s.body)return void this.R.info("Log was rejected in beforeSend function");if(!this.Ds())return;const n={record:ws(s,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.hs(),this.R,null==i?void 0:i.occurredAtMs)};this.ds(()=>this.Ls(n))}Fs(t){const i=this.Fr.beforeSend;if(!i)return t;const e=E(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.R.info("Log was rejected in beforeSend function"),null;s=i}catch(t){return this.R.error("Error in beforeSend function for log:",t),null}return s}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),i=t-this.xs;return this.As>i&&i>=0||(this.xs=t,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.R.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.As}ms`),this.Cs=!0),!1)}flush(){var t=this;return J(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return J(function*(){var i;t.ps.clear();let e=null!==(i=t._instance.getPersistedProperty(f.LogsQueue))&&void 0!==i?i:[];if(0===e.length)return;const s=e.length;let n=0;for(;e.length>0&&s>n;){var r,o;const i=t._s;t.bs=0;const s=Math.min(e.length,t.Es),l=e.slice(0,s),a=xs(l.map(t=>t.record),t.js(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.qs(a);if(t._s!==i)return;if("too-large"===u.kind&&l.length>1)t.Es=Math.max(1,Math.floor(l.length/2)),t.R.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.R.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Fr.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Fr.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(l.length),e=null!==(o=t._instance.getPersistedProperty(f.LogsQueue))&&void 0!==o?o:[],n+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var i=this;return J(function*(){var e;const s=Math.max(0,t-i.bs),n=null!==(e=i._instance.getPersistedProperty(f.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(f.LogsQueue,n.slice(s)),yield i.vs()})()}js(){return $s(this.Fr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var i;if(this._instance.optedOut)return;const e=null!==(i=this._instance.getPersistedProperty(f.LogsQueue))&&void 0!==i?i:[];this.Is>e.length||(e.shift(),this.bs++,this.R.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(f.LogsQueue,e),this.Ts>e.length||this.ws.isOpen()?this.Os():this.gs()}Os(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}zs(){return Math.max(Es(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}Ps(){const t=this._instance.getPersistedProperty(f.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return J(function*(){i.ps.clear();const e=i.flush().catch(()=>{});void 0!==t?yield pi(e,t):yield e})()}flushWithTimeout(t){var i=this;return J(function*(){const e=i.flush();yield pi(e,t,()=>{e.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=ks(),this.R.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.Ps()&&this.ps.armNoEarlierThan(this.zs())})}};const Ps=/^[0-9a-f]+$/;function Cs(t,i,e){return"string"==typeof t&&t.length===i&&t!==e&&Ps.test(t)}const As=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;const Fs="00",Os=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ms(t){return String(t)+"000000"}function Rs(t,i,e,s){let n="";return s&&(n=Object.keys(s).sort().map(t=>`${JSON.stringify(t)}:${JSON.stringify(s[t])}`).join(",")),`${t}\0${i}\0${null!=e?e:""}\0${n}`}var Is=class{constructor(t,i,e){this._instance=t,this.Fr=i,this.R=e,this.Hs=new Map,this.ps=new Ss(()=>this.flush().catch(t=>{this.R.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new ai,this.ks=0,this.Ss=1,this.Gs=0}count(t,i=1,e){this.Qs({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.Qs({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.Qs({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this;const i=this.ys,e=function(){var e=J(function*(){i&&(yield i.catch(()=>{})),yield t.Js()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.ys===e&&(this.ys=null)});return this.ys=e,e}drainWindow(){if(0===this.Hs.size)return null;const t=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Zs(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const i=this.Fs(t);if(null===i)return;if(!i.name||"string"!=typeof i.name)return void this.R.warn("Dropping metric with empty name");if("number"!=typeof i.value||!Number.isFinite(i.value))return void this.R.warn(`Dropping metric '${i.name}': value must be a finite number`);if("count"===i.type&&0>i.value)return void this.R.warn(`Dropping count '${i.name}': counters are monotonic, value must be >= 0`);let e,s;try{e=i.attributes?bi({},i.attributes):void 0,s=Rs(i.type,i.name,i.unit,e)}catch(t){return void this.R.warn(`Dropping metric '${i.name}': attributes could not be serialized`,t)}let n=this.Hs.get(s);if(!n){if(!this.Ks())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Hs.set(s,n)}const r=this.Ws.get(i.name);void 0===r?this.Ws.set(i.name,i.type):r===i.type||this.Vs.has(i.name)||(this.Vs.add(i.name),this.R.warn(`Metric name '${i.name}' is already used as a ${r}; recording it as a ${i.type} too will blend both series in charts. Use a distinct name.`)),this.Ys(n,i.value);const o=this.Xs();o&&(n.exemplar=bi(bi({},o),{},{value:i.value,timeMs:Date.now()})),this.Os()}Xs(){try{var t,i;const e=function(t){const i=function(t){if("string"!=typeof t)return;const i=As.exec(t.trim());if(!i)return;const[,e,s,n,r,o]=i;return"ff"===e||"00"===e&&o||!function(t){return Cs(t,32,"00000000000000000000000000000000")}(s)||!function(t){return Cs(t,16,"0000000000000000")}(n)?void 0:{version:e,traceId:s,spanId:n,flags:r}}(t);return i&&{traceId:i.traceId,spanId:i.spanId,flags:(e=i.flags,1&parseInt(e,16)?"01":Fs)};var e}(null===(t=(i=this._instance).getActiveSpan)||void 0===t||null===(t=t.call(i))||void 0===t?void 0:t.traceparent());if(e&&"01"===e.flags)return{traceId:e.traceId,spanId:e.spanId}}catch(t){}}Ks(){return this.Fr.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.R.warn(`Metric series cap reached (${this.Fr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Ys(t,i){switch(t.type){case"count":var e;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(Os.length+1).fill(0)});const e=t.hist;e.count+=1,e.sum+=i,e.min=Math.min(e.min,i),e.max=Math.max(e.max,i),e.bucketCounts[function(t,i){for(let e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,Os)]+=1;break}}}Fs(t){const i=this.Fr.beforeSend;if(!i)return t;const e=E(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.R.info("Metric was rejected in beforeSend function"),null;s=i}catch(t){return this.R.error("Error in beforeSend function for metric:",t),null}return s}Os(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(Es(this.Fr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Js(){var t=this;return J(function*(){if(t.ps.clear(),0===t.Hs.size)return;const i=t.Hs;t.Hs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const e=t.Gs,s=yield t._instance._o(t.Zs(i));if(e===t.Gs)switch(t.ws.record(s),"retry-later"===s.kind?(t.ks++,t.Ss=ks()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.zs()),s.kind){case"ok":return;case"retry-later":return t.ko(i),void t.ps.armNoEarlierThan(t.zs());case"too-large":return void t.R.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.R.error("Failed to send metrics batch:",s.error)}})()}Zs(t){return i=this.So(t),e=function(t,i,e){return fs(t,i,e)}(this.Fr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:gs(e)},scopeMetrics:[{scope:{name:s,version:n},metrics:i}]}]};var i,e,s,n}So(t){const i=Ms(Date.now()),e=new Map;for(const o of t.values()){var s;const t=Rs(o.type,o.name,o.unit,void 0);let l=e.get(t);l||(l=bi({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},e.set(t,l));const a=hs(null!==(s=o.attributes)&&void 0!==s?s:{},this.R),u=Ms(o.windowStartMs),h=Ds(o.exemplar);if("count"===o.type){var n;const t=bi({attributes:a,startTimeUnixNano:u,timeUnixNano:i,asDouble:null!==(n=o.total)&&void 0!==n?n:0},h);l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t=bi({attributes:a,timeUnixNano:i,asDouble:null!==(r=o.last)&&void 0!==r?r:0},h);l.gauge.dataPoints.push(t)}else if(o.hist){const t=bi({attributes:a,startTimeUnixNano:u,timeUnixNano:i,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Os},h);l.histogram.dataPoints.push(t)}}return Array.from(e.values())}ko(t){for(const[n,r]of t){var i;const t=this.Hs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,r.windowStartMs),t.exemplar=null!==(i=t.exemplar)&&void 0!==i?i:r.exemplar,t.type){case"count":var e,s;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(s=r.total)&&void 0!==s?s:0);break;case"gauge":break;case"histogram":if(r.hist)if(t.hist){t.hist.count+=r.hist.count,t.hist.sum+=r.hist.sum,t.hist.min=Math.min(t.hist.min,r.hist.min),t.hist.max=Math.max(t.hist.max,r.hist.max);for(let i=0;t.hist.bucketCounts.length>i;i++)t.hist.bucketCounts[i]+=r.hist.bucketCounts[i]}else t.hist=r.hist}else this.Ks()&&this.Hs.set(n,r)}}};function Ds(t){return t?{exemplars:[{filteredAttributes:[],timeUnixNano:Ms(t.timeMs),asDouble:t.value,traceId:t.traceId,spanId:t.spanId}]}:{}}const js=(t,{debugEnabled:i}={})=>{const e={N(e,...s){let n;try{n=typeof window>"u"?void 0:window}catch(t){return}n&&(v.DEBUG||n.POSTHOG_DEBUG||i)&&!A(n.console)&&n.console&&("__rrweb_original__"in n.console[e]?n.console[e].__rrweb_original__:n.console[e])(t,...s)},debug(...t){e.N("debug",...t)},info(...t){e.N("log",...t)},warn(...t){e.N("warn",...t)},error(...t){e.N("error",...t)},critical(...i){console.error(t,...i)},uninitializedWarning(t){e.error(`You must initialize PostHog before calling ${t}`)},createLogger:(i,e)=>js(`${t} ${i}`,e)};return e},Ls=js("[PostHog.js]"),Ns=(t,i)=>Ls.createLogger(t,i),zs=Ns("[ExternalScriptsLoader]"),Bs=t=>{const i=null==s?void 0:s.querySelectorAll("script");if(i)for(let e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},Us=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return zs.warn(`${i} was requested but loading of external scripts is disabled.`),e("Loading of external scripts is disabled");const n=()=>{if(null==s||s.removeEventListener("DOMContentLoaded",n),t.config.disable_external_dependency_loading)return e("Loading of external scripts is disabled");if(!s)return e("document not found");let o=s.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=i,o.onload=t=>{o.__posthog_loading_callback_fired=!0,e(void 0,t)},o.onerror=t=>{o.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(o=t.config.prepare_external_dependency_script(o)),!o)return e("prepare_external_dependency_script returned null");if(t.config.disable_external_dependency_loading)return e("Loading of external scripts is disabled");const l=Bs(o.src);if(l){if(l.integrity!==o.integrity||l.crossOrigin!==o.crossOrigin||l.nonce!==o.nonce)return e("Existing script conflicts with prepared script policy");if(l.__posthog_loading_callback_fired)return e();const t=l.__posthog_loading_error;return t?e(t):(l.addEventListener("load",t=>{l.__posthog_loading_callback_fired=!0,e(void 0,t)}),void l.addEventListener("error",t=>{l.__posthog_loading_error=t,e(t)}))}if(!s.body)return r();if("head"===t.config.external_scripts_inject_target)s.head.appendChild(o);else{const t=s.querySelectorAll("body > script");var a;t.length>0?null===(a=t[0].parentNode)||void 0===a||a.insertBefore(o,t[0]):s.body.appendChild(o)}},r=()=>{null==s||s.addEventListener("DOMContentLoaded",n)};(null==s?void 0:s.body)||Bs(i)?n():r()},Hs={},qs=(t,i)=>{let e=`/static/${i}.js?v=${t.version}`;if("toolbar"===i){const t=3e5;e=`${e}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",e)};c.__PosthogExtensions__=c.__PosthogExtensions__||{},c.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"===i){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void Us(t,i,e)}const s=t.config.strict_script_versioning;if(s){const n=t.requestRouter.endpointFor("assets",`/static/${t.version}/${i}.js`),r=Hs[n];if("fallback"===s&&r){if(Bs(r))return void Us(t,r,e);delete Hs[n]}return void Us(t,n,"fallback"===s?(s,r)=>{if(s)if("string"==typeof s)e(s);else{var o;const s=qs(t,i);Hs[n]=s;const r=Bs(n);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),Us(t,s,e)}else e(void 0,r)}:e)}Us(t,qs(t,i),e)},c.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{const s=t.requestRouter.endpointFor("api",i);Us(t,s,e)},v.DEBUG=!1,v.LIB_VERSION="1.446.3",v.LIB_NAME="web";var Ws=v;const Vs="$early_access_features",Gs="$active_feature_flags",Ks="$feature_flag_details",Js="$feature_flag_errors",Ys="$feature_flag_evaluated_at",Zs="$feature_flag_request_id",Xs="$minimal_flag_called_events",Qs="$enabled_feature_flags",tn="$stored_group_properties",en="$stored_person_properties",sn="$flag_call_reported",nn="$flag_call_reported_session_id",rn="$feature_flag_payloads",on="$override_feature_flags",ln="$override_feature_flag_payloads",an="visibilitychange",un="$autocapture_disabled_server_side",hn="$surveys",cn="$surveys_loaded_at",dn="PostHog loadExternalDependency extension not found.",vn="$surveys_activated",fn="$surveys_activated_session",pn="$surveys_activated_timestamps",gn="$people_distinct_id",_n="distinct_id",mn="$device_id",yn="$device_model",bn="__alias",wn="__cmpns",$n="$fbc",xn="$fbc_persistence",Sn="$fbp",kn="$fbp_persistence",En="__timers",Tn="$heatmaps_enabled_server_side",Pn="$exception_capture_enabled_server_side",Cn="$error_tracking_suppression_rules",An="$error_tracking_capture_extension_exceptions",Fn="$web_vitals_enabled_server_side",On="$dead_clicks_enabled_server_side",Mn="$product_tours_enabled_server_side",Rn="$logs_capture_enabled_server_side",In="$web_vitals_allowed_metrics",Dn="$session_recording_remote_config",jn="$session_recording_enabled_server_side",Ln="$replay_sample_rate",Nn="$replay_override_sampling",zn="$replay_override_linked_flag",Bn="$replay_override_url_trigger",Un="$replay_override_event_trigger",Hn="$sesid",qn="$session_is_sampled",Wn="$session_past_minimum_duration",Vn="$session_recording_url_trigger_activated_session",Gn="$session_recording_event_trigger_activated_session",Kn="$debug_first_full_snapshot_timestamp",Jn="$sess_rec_flush_size",Yn="$groups",Zn="ph_product_tours",Xn="$product_tours_activated",Qn="$product_tours_activated_session",tr="$conversations_widget_session_id",ir="$conversations_ticket_id",er="$conversations_widget_state",sr="$conversations_user_traits",nr="$user_state",rr="$client_session_props",or="$capture_rate_limit",lr="$initial_campaign_params",ar="$initial_referrer_info",ur="$initial_person_info",hr="$epp",cr="$posthog_cookieless",dr="$cookieless_mode",vr="$sdk_debug_extensions_init_method",fr="$sdk_debug_extensions_init_time_ms",pr="$sdk_debug_recording_script_not_loaded",gr="$sdk_debug_replay_stale_config",_r="$sdk_debug_replay_event_trigger_status",mr="$sdk_debug_replay_linked_flag_trigger_status",yr="$sdk_debug_replay_matched_recording_trigger_groups",br="$sdk_debug_replay_pending_trigger_conditions",wr="$sdk_debug_replay_remote_trigger_matching_config",$r="$sdk_debug_replay_trigger_groups_count",xr="$sdk_debug_replay_url_trigger_status",Sr="$session_recording_start_reason",kr="anonymous",Er="identified",Tr="identified_only",Pr="beforeunload",Cr="$pageview",Ar="$pageleave",Fr="$identify",Or="$groupidentify";function Mr(t,i){E(t)&&t.forEach(i)}function Rr(t,i){if(!R(t))if(E(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(const e in t)S.call(t,e)&&i(t[e],e)}const Ir=function(t,...i){for(const e of i)for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t};function Dr(t){const i=Object.keys(t);let e=i.length;const s=new Array(e);for(;e--;)s[e]=[i[e],t[i[e]]];return s}const jr=function(t){return function(...i){try{return t.apply(this,i)}catch(t){Ls.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ls.critical(t)}}},Lr=function(t){const i={};return Rr(t,function(t,e){(F(t)&&t.length>0||I(t))&&(i[e]=t)}),i};function Nr(t){const i=bi({},t);for(const e of["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e])}catch(t){}return i}const zr=["herokuapp.com","vercel.app","netlify.app"];function Br(t){const i=null==t?void 0:t.hostname;if(!F(i))return!1;const e=i.split(".").slice(-2).join(".");for(const t of zr)if(e===t)return!1;return!0}function Ur(t,i,e,s){const{capture:n=!1,passive:r=!0}=null!=s?s:{};null==t||t.addEventListener(i,e,{capture:n,passive:r})}function Hr(t){return"ph_toolbar_internal"===t.name}const qr=t=>{if(s){try{const i=t+"=",e=s.cookie.split(";").filter(t=>t.length);for(let t=0;e.length>t;t++){let s=e[t];for(;" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}};var Wr=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(i,e,s,n){if(!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(s)||!Number.isInteger(n)||0>i||0>e||0>s||0>n||i>0xffffffffffff||e>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=i/Math.pow(2,40),r[1]=i/Math.pow(2,32),r[2]=i/Math.pow(2,24),r[3]=i/Math.pow(2,16),r[4]=i/256,r[5]=i,r[6]=112|e>>>8,r[7]=e,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new t(r)}toString(){let t="";for(let i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(let i=0;16>i;i++){const e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}},Vr=class{generate(){const t=this.generateOrAbort();if(!A(t))return t;{this.Tt=0;const t=this.generateOrAbort();if(A(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return I(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Tt)this.Tt=t,this.It();else{if(this.Tt>=t+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Tt++,this.It())}return Wr.fromFieldsV7(this.Tt,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.At.nextUint32())}It(){this.Mt=1024*this.At.nextUint32()+(1023&this.At.nextUint32())}constructor(){this.Tt=0,this.Mt=0,this.At=new Jr}};const Gr=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};let Kr;var Jr=class{nextUint32(){var t;return this.Rt.length>this.Et||((null!==(t=Kr)&&void 0!==t?t:Kr="u">typeof window&&!A(window.crypto)&&crypto.getRandomValues?t=>{try{return crypto.getRandomValues(t)}catch(i){return Gr(t)}}:Gr)(this.Rt),this.Et=0),this.Rt[this.Et++]}constructor(){this.Rt=new Uint32Array(8),this.Et=1/0}};let Yr;const Zr=()=>Xr().toString(),Xr=()=>(Yr||(Yr=new Vr)).generate();let Qr="";const to=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let io=null;const eo={Ot(){if(!M(io))return io;if(io=!1,s)try{const t=`__ph_cookie_support_${Zr()}`;eo.$t(t,"xyz"),io='"xyz"'===qr(t),eo.Dt(t)}catch(t){io=!1}return io},Pt(t){Ls.error("cookieStore error: "+t)},Lt:qr,Ft(t){let i;try{i=JSON.parse(eo.Lt(t))||{}}catch(t){}return i},$t(t,i,e,n,r){if(!s)return!1;try{let o="",l="";const a=function(t,i){if(i){let i=function(t,i=s){if(Qr)return Qr;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";const e=t.split(".");let n=Math.min(e.length,8);const r="dmn_chk_"+Zr();for(;!Qr&&n--;){const t=e.slice(n).join("."),s=r+"=1;domain=."+t+";path=/";i.cookie=s+";max-age=3",i.cookie.includes(r)&&(i.cookie=s+";max-age=0",Qr=t)}return Qr}(t);if(!i){const e=(t=>{const i=t.match(to);return i?i[0]:""})(t);e!==i&&Ls.info("Warning: cookie subdomain discovery mismatch",e,i),i=e}return i?"; domain=."+i:""}return""}(s.location.hostname,n);if(e){const t=new Date;t.setTime(t.getTime()+864e5*e),o="; expires="+t.toUTCString()}r&&(l="; secure");const u=t+"="+encodeURIComponent(JSON.stringify(i))+o+"; SameSite=Lax; path=/"+a+l;return u.length>3686.4&&Ls.warn("cookieStore warning: large cookie, len="+u.length),s.cookie=u,!0}catch(t){return!1}},Dt(t,i){if((null==s?void 0:s.cookie)&&(!i||!M(qr(t))))try{eo.$t(t,"",-1,i)}catch(t){return}}};let so=null;const no={Ot(){if(!M(so))return so;let i=!0;if(A(t))i=!1;else try{const t="__mplssupport__";no.$t(t,"xyz"),'"xyz"'!==no.Lt(t)&&(i=!1),no.Dt(t)}catch(t){i=!1}return i||Ls.error("localStorage unsupported; falling back to cookie store"),so=i,i},Pt(t){Ls.error("localStorage error: "+t)},Lt(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){no.Pt(t)}return null},Ft(t){try{return JSON.parse(no.Lt(t))||{}}catch(t){}return null},$t(i,e){try{return null==t||t.localStorage.setItem(i,JSON.stringify(e)),!0}catch(t){no.Pt(t)}return!1},Dt(i){try{null==t||t.localStorage.removeItem(i)}catch(t){no.Pt(t)}}},ro=[en,Gs,Qs,Ks,rn,Zs,Ys,Js,sn],oo=[mn,_n,Hn,qn,hr,ur,xn,nr],lo=t=>t+"_cpm",ao=["__proto__","constructor","prototype"],uo=t=>{if(!P(t))return{};const i={};return Object.keys(t).forEach(e=>{-1===ao.indexOf(e)&&(i[e]=t[e])}),i},ho=(t,i=[])=>{const e={};return[...oo,...i].forEach(i=>{const s=t[i];A(s)||M(s)||""===s||(e[i]=s)}),e},co=t=>{let i=5381,e=2166136261;for(let s=0;t.length>s;s++){const n=t.charCodeAt(s);i=33*i^n,e=Math.imul(e^n,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},vo=(t,i)=>({p:i,f:co(JSON.stringify(t))}),fo=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{const e=eo.Ft(lo(t)),s=(null==e?void 0:e.f)===co(i)&&E(e.p);return{properties:s?e.p:[],isValid:s}}catch(t){return{properties:[],isValid:!1}}},po=(t,i)=>i+"|"+(eo.Lt(lo(t))||""),go={},_o={Ot:()=>!0,Pt(t){Ls.error("memoryStorage error: "+t)},Lt:t=>t in go?go[t]:null,Ft:t=>t in go?go[t]:null,$t:(t,i)=>(go[t]=i,!0),Dt(t){delete go[t]}};let mo=null;const yo={Ot(){if(!M(mo))return mo;if(mo=!0,A(t))mo=!1;else try{const t="__support__";yo.$t(t,"xyz"),'"xyz"'!==yo.Lt(t)&&(mo=!1),yo.Dt(t)}catch(t){mo=!1}return mo},Pt(t){Ls.error("sessionStorage error: ",t)},Lt(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){yo.Pt(t)}return null},Ft(t){try{return JSON.parse(yo.Lt(t))||null}catch(t){}return null},$t(i,e){try{return null==t||t.sessionStorage.setItem(i,JSON.stringify(e)),!0}catch(t){yo.Pt(t)}return!1},Dt(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){yo.Pt(t)}}};var bo=class{constructor(t){this._instance=t}get Fr(){return this._instance.config}get consent(){return this.Ml()?0:this.El}isOptedOut(){return"always"===this.Fr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Fr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Fr.opt_out_capturing_by_default}optInOut(t){this.Al.$t(this.Rl,t?1:0,this.Fr.cookie_expiration,this.Fr.cross_subdomain_cookie,this.Fr.secure_cookie)}reset(){this.Al.Dt(this.Rl,this.Fr.cross_subdomain_cookie)}get Rl(){const{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get El(){const t=this.Al.Lt(this.Rl);return V(t)?1:m(G,t)?0:-1}get Al(){const t=this.Fr.opt_out_capturing_persistence_type,i="localStorage"===t?no:eo,e=i.Ot()?i:_o;if(!this.Pl||this.Pl!==e){this.Pl=e;const i="localStorage"===t?eo:no;i.Lt(this.Rl)&&(this.Pl.Lt(this.Rl)||this.optInOut(V(i.Lt(this.Rl))),i.Dt(this.Rl,this.Fr.cross_subdomain_cookie))}return this.Pl}Ml(){return!!this.Fr.respect_dnt&&[null==e?void 0:e.doNotTrack,null==e?void 0:e.msDoNotTrack,c.doNotTrack,null==e?void 0:e.globalPrivacyControl].some(t=>V(t))}};function wo(t,i){var e;const s=null==t||null===(e=t.config)||void 0===e?void 0:e.get_current_url;if(!T(s))return i;try{const t=s(i);return F(t)&&t?t:i}catch(t){return Ls.error("Error in get_current_url, falling back to window.location.href",t),i}}function $o(t){var i;return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!!(null===(i=t.closest)||void 0===i?void 0:i.call(t,".toolbar-global-fade-container")))}function xo(t){return!!t&&1===t.nodeType}function So(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function ko(t){return!!t&&3===t.nodeType}function Eo(t){return!!t&&11===t.nodeType&&xo(t.host)}function To(t){return t?y(t).split(/\s+/):[]}function Po(t,i){const e=function(t){var i;const e=typeof window>"u"?void 0:window,s=null==e||null===(i=e.location)||void 0===i?void 0:i.href;return A(s)?void 0:wo(t,s)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function Co(t){let i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return To(i)}function Ao(t){return R(t)?null:y(t).split(/(\s+)/).filter(t=>ol(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Fo(t){let i="";return Zo(t)&&!Xo(t)&&t.childNodes&&t.childNodes.length&&Rr(t.childNodes,function(t){var e;ko(t)&&t.textContent&&(i+=null!==(e=Ao(t.textContent))&&void 0!==e?e:"")}),y(i)}function Oo(t){var i;return A(t.target)?t.srcElement||null:(null===(i=t.target)||void 0===i?void 0:i.shadowRoot)?t.composedPath()[0]||null:t.target||null}const Mo=["a","button","form","input","select","textarea","label"];function Ro(t,i){const e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}function Io(t,i){if(A(i))return!0;for(const e of t)if(i.some(t=>Ro(e,t)))return!0;return!1}function Do(t){const i=t.parentNode;return!(!i||!xo(i))&&i}const jo=[".ph-no-autocapture","[data-ph-no-autocapture]"],Lo=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],No=(()=>[...Lo,"+","-","−","–"])(),zo=(()=>No.length+10)(),Bo=["button","a","input","select","textarea","label"],Uo=["button","link","tab","menuitem","option"],Ho=(t,i)=>/[a-z0-9]/i.test(i)?m(No,i)?new RegExp(`\\b${i}\\b`).test(t):t.includes(i):t===i,qo=t=>m(Bo,t.tagName.toLowerCase())||m(Uo,(t.getAttribute("role")||"").toLowerCase());function Wo(t){let i="",e="";const s=t=>{xo(t)&&Zo(t)&&!Xo(t)&&(i+=` ${Fo(t)}`,e=e||t.getAttribute("aria-label")||"",Rr(t.childNodes,s))};s(t),i=y(i.replace(/\s+/g," "));const n=(ol(i)?i:"").toLowerCase(),r=t.getAttribute("aria-label")||(n?"":e);return{safeText:n,ariaLabel:y(r).toLowerCase()}}const Vo=[".ph-no-rageclick",".ph-no-capture"],Go=["","text","search","email","password","url","tel","number"];function Ko(t,i){if(!(typeof window>"u"?void 0:window)||Jo(t))return!1;let e,s,n;var r,o;if(j(i)?(e=!!i&&Vo,s=void 0,n=!1):(e=null!==(r=null==i?void 0:i.css_selector_ignorelist)&&void 0!==r?r:Vo,s=null==i?void 0:i.content_ignorelist,n=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(n&&function(t){return!(!t||!xo(t))&&(!!So(t,"textarea")||(So(t,"input")?m(Go,(t.getAttribute("type")||"").toLowerCase()):function(t){var i;if(t.isContentEditable)return!0;const e=null===(i=t.getAttribute)||void 0===i?void 0:i.call(t,"contenteditable");return"true"===e||""===e}(t)))}(t))return!1;const{targetElementList:l}=Yo(t,!1);return!(s&&function(t,{safeText:i,ariaLabel:e}){let s;if(!0===t)s=Lo;else{if(!E(t))return!1;if(t.length>zo)return Ls.error(`[PostHog] content_ignorelist array cannot exceed ${zo} items. Use css_selector_ignorelist for more complex matching.`),!1;s=t.map(t=>t.toLowerCase())}return s.some(t=>Ho(i,t)||Ho(e,t))}(s,function(t,i){for(const t of i)if(qo(t))return Wo(t);for(const t of i){try{var e;if("pointer"!==(null===(e=window)||void 0===e?void 0:e.getComputedStyle(t).getPropertyValue("cursor")))break}catch(t){break}const i=Wo(t);if(i.safeText||i.ariaLabel)return i}return Wo(t)}(t,l))||Io(l,e))}const Jo=t=>!t||So(t,"html")||!xo(t),Yo=(t,i)=>{const e=typeof window>"u"?void 0:window;if(!e||Jo(t))return{parentIsUsefulElement:!1,targetElementList:[]};let s=!1;const n=[t];let r=t;for(;r.parentNode&&!So(r,"body");){if(Eo(r.parentNode)){n.push(r.parentNode.host),r=r.parentNode.host;continue}const t=Do(r);if(!t)break;if(i||Mo.indexOf(t.tagName.toLowerCase())>-1)s=!0;else try{const i=e.getComputedStyle(t);i&&"pointer"===i.getPropertyValue("cursor")&&(s=!0)}catch(t){}n.push(t),r=t}return{parentIsUsefulElement:s,targetElementList:n}};function Zo(t){const i=new Set;let e=0;for(let s=t;s.parentNode&&!So(s,"body");s=s.parentNode){if(e++>=1e3||i.has(s))return!1;i.add(s);const t=Co(s);if(m(t,"ph-sensitive")||m(t,"ph-no-capture"))return!1}if(m(Co(t),"ph-include"))return!0;const s=t.type||"";if(F(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const n=t.name||t.id||"";return!F(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function Xo(t){return!!(So(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||So(t,"select")||So(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Qo=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}))$"),tl=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,il=[16,15,14,13],el=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),sl=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),nl=/[0-9A-Za-z_]/;function rl(t){let i=0,e=!1;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e}return i%10==0}function ol(t,i=!0){if(R(t))return!1;if(F(t)){if(t=y(t),i?Qo.test((t||"").replace(/[- ]/g,"")):function(t){let i;for(tl.lastIndex=0;i=tl.exec(t);){const t=i[2];if(!t)continue;const e=t.replace(/[- ]/g,"");for(let t=0;e.length>t;t++)for(const i of il){const s=t+i;if(e.length>=s){const i=e.slice(t,s);if(Qo.test(i)&&rl(i))return!0}}}return!1}(t))return!1;if(i?el.test(t):function(t){let i;for(sl.lastIndex=0;i=sl.exec(t);){const t=i[1],e=i[3];if(!(t&&e&&nl.test(t)&&nl.test(e)))return!0}return!1}(t))return!1}return!0}function ll(t){let i=Fo(t);return i=`${i} ${al(t)}`.trim(),ol(i)?i:""}function al(t){let i="";return t&&t.childNodes&&t.childNodes.length&&Rr(t.childNodes,function(t){var e;if(t&&"span"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase()))try{const e=Fo(t);i=`${i} ${e}`.trim(),t.childNodes&&t.childNodes.length&&(i=`${i} ${al(t)}`.trim())}catch(t){Ls.error("[AutoCapture]",t)}}),i}function ul(t){return t.replace(/"|\\"/g,'\\"')}function hl(t){const i=t.attr__class;if(i)return E(i)?i:To(i)}const cl=Ns("[Dead Clicks]"),dl=()=>!0,vl=t=>{var i;const e=!!(null===(i=t.instance.persistence)||void 0===i?void 0:i.get_property(On)),s=t.instance.config.capture_dead_clicks;return j(s)?s:!!P(s)||e};var fl=class{get lazyLoadedDeadClicksAutocapture(){return this.Ol}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[On]:i.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Fl(()=>{this.Dl()}):this.stop()}Fl(t){var i,e,s;(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.initDeadClicksAutocapture)?t():null===(e=c.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this.instance,"dead-clicks-autocapture",i=>{i?cl.error("failed to load script",i):t()})}Dl(){var t;if(s){if(!this.Ol&&(null===(t=c.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=P(this.instance.config.capture_dead_clicks)?bi({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Ol=c.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Ol.start(s),cl.info("starting...")}}else cl.error("`document` not found. Cannot start.")}stop(){this.Ol&&(this.Ol.stop(),this.Ol=void 0,cl.info("stopping..."))}};const pl=Ns("[SegmentIntegration]");function gl(t,i,e=!0){const s=t.config.segment;if(!s)return i();const{analytics:n,filterProperties:r}=(t=>T(t.register))(o=s)?{analytics:o}:o;var o;!function(t,i,e,s){const n=i=>{const n=()=>i.anonymousId()||Zr();t.config.get_device_id=n,s&&i.id()&&(t.register({distinct_id:i.id(),$device_id:n()}),t.persistence.set_property(nr,Er)),e(s?void 0:i.anonymousId()||void 0)},r=i.user();"then"in r&&T(r.then)?r.then(n):n(r)}(t,n,e=>{n.register(((t,i,{filterProperties:e}={})=>{"undefined"!=typeof Promise&&Promise.resolve||pl.warn("This browser does not have Promise support, and can not use the segment integration");const s=(s,n)=>{if(!n)return s;const r=!!i&&s.event.anonymousId===i&&!s.event.userId;r||s.event.userId||s.event.anonymousId===t.get_distinct_id()||(pl.info("No userId set, resetting PostHog"),t.reset()),r||(i=void 0),s.event.userId&&s.event.userId!==t.get_distinct_id()&&(pl.info("UserId set, identifying with PostHog"),t.identify(s.event.userId));let o=t.calculateEventProperties(n,s.event.properties);if(!R(e)){const t=s.event.properties||{},i={};for(const e of Object.keys(o))S.call(t,e)||(i[e]=o[e]);const n=((t,i)=>{const e=E(t)?t:[t];let s=bi({},i);for(const t of e)try{if(s=t(s),R(s))return null}catch(t){return pl.error("Error in Segment filterProperties:",t),null}return s})(e,i);if(R(n))return s;o=n}return s.event.properties=Object.assign({},o,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return s(t,t.event.event)},page(t){return s(t,Cr)},identify(t){return s(t,Fr)},screen(t){return s(t,"$screen")}}})(t,e,{filterProperties:r})).then(()=>{i()},t=>{pl.error("Failed to register the Segment integration",t),i()})},e)}const _l="posthog-js";function ml(t,{organization:i,projectId:e,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,h,c;if("*"!==n&&!n.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(l=o.exception)||void 0===l?void 0:l.values)||[],f=v.map(t=>bi(bi({},t),{},{stacktrace:t.stacktrace?bi(bi({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>bi(bi({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(a=v[0])||void 0===a?void 0:a.value)||o.message,$exception_type:null===(u=v[0])||void 0===u?void 0:u.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(h=v[0])||void 0===h?void 0:h.value)||o.message,$sentry_exception_type:null===(c=v[0])||void 0===c?void 0:c.type,$sentry_tags:o.tags};var g;return i&&e&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+e+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var yl=class{constructor(t,i,e,s,n,r){this.name=_l,this.setupOnce=function(o){o(ml(t,{organization:i,projectId:e,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}))}}},bl=class{constructor(t){this.Ll=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Ls.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Nl=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.jl()}jl(){var t;this.ql=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.Ll)}destroy(){var t;null===(t=this.ql)||void 0===t||t.call(this),this.ql=void 0}doPageView(i,e){var s;const n=this.Bl(i,e);return this.Nl={pathname:null!==(s=null==t?void 0:t.location.pathname)&&void 0!==s?s:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),n}doPageLeave(t){var i;return this.Bl(t,null===(i=this.Nl)||void 0===i?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Nl)||void 0===t?void 0:t.pageViewId}}Bl(t,i){const e=this.Nl;if(!e)return{$pageview_id:i};let s={$pageview_id:i,$prev_pageview_id:e.pageViewId};const n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:i,maxScrollY:e,maxContentHeight:r,lastContentY:o,maxContentY:l}=n;if(!(A(t)||A(i)||A(e)||A(r)||A(o)||A(l))){t=Math.ceil(t),i=Math.ceil(i),e=Math.ceil(e),r=Math.ceil(r),o=Math.ceil(o),l=Math.ceil(l);const n=t>1?Q(i/t,0,1,Ls):1,a=t>1?Q(e/t,0,1,Ls):1,u=r>1?Q(o/r,0,1,Ls):1,h=r>1?Q(l/r,0,1,Ls):1;s=Ir(s,{$prev_pageview_last_scroll:i,$prev_pageview_last_scroll_percentage:n,$prev_pageview_max_scroll:e,$prev_pageview_max_scroll_percentage:a,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:l,$prev_pageview_max_content_percentage:h})}}return e.pathname&&(s.$prev_pageview_pathname=e.pathname),e.timestamp&&(s.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),s}};const wl=["flags","surveys"],$l={[gn]:{exposure:"hidden"},[bn]:{exposure:"hidden"},[wn]:{exposure:"hidden"},[En]:{exposure:"hidden"},[xn]:{exposure:"hidden"},[kn]:{exposure:"hidden"},[un]:{exposure:"event"},[Tn]:{exposure:"hidden"},[Rn]:{exposure:"hidden"},[Pn]:{exposure:"event"},[Cn]:{exposure:"hidden"},[An]:{exposure:"event"},[Fn]:{exposure:"event"},[On]:{exposure:"event"},[Mn]:{exposure:"hidden"},[In]:{exposure:"event"},[Dn]:{exposure:"hidden"},[jn]:{exposure:"hidden"},[Hn]:{exposure:"hidden"},[qn]:{exposure:"event"},[Ln]:{exposure:"event",shouldSkipFromEventProperties:t=>M(t)},[Wn]:{exposure:"event"},[Vn]:{exposure:"event"},[Gn]:{exposure:"event"},[Kn]:{exposure:"event"},[Jn]:{exposure:"hidden"},[Qs]:{exposure:"hidden",storageGroup:"flags"},[Gs]:{exposure:"hidden",storageGroup:"flags"},[Vs]:{exposure:"hidden"},[Ks]:{exposure:"hidden",storageGroup:"flags"},[rn]:{exposure:"hidden",storageGroup:"flags"},[Zs]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Xs]:{exposure:"hidden",storageGroup:"flags"},[on]:{exposure:"hidden"},[ln]:{exposure:"hidden"},[en]:{exposure:"hidden"},[tn]:{exposure:"hidden"},[hn]:{exposure:"hidden",storageGroup:"surveys"},[cn]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[vn]:{exposure:"event"},[fn]:{exposure:"hidden"},[pn]:{exposure:"hidden"},[Zn]:{exposure:"hidden"},[Xn]:{exposure:"hidden"},[Qn]:{exposure:"hidden"},[tr]:{exposure:"event"},[ir]:{exposure:"event"},[er]:{exposure:"event"},[sr]:{exposure:"event"},[sn]:{exposure:"hidden"},[nn]:{exposure:"hidden"},[Yn]:{exposure:"event"},[Js]:{exposure:"hidden"},[Ys]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[nr]:{exposure:"hidden"},[rr]:{exposure:"hidden"},[or]:{exposure:"hidden"},[lr]:{exposure:"hidden"},[ar]:{exposure:"hidden"},[ur]:{exposure:"hidden"},[hr]:{exposure:"hidden"},[Nn]:{exposure:"event"},[zn]:{exposure:"event"},[Bn]:{exposure:"event"},[Un]:{exposure:"event"},[vr]:{exposure:"event"},[fr]:{exposure:"event"},[pr]:{exposure:"hidden"},[gr]:{exposure:"hidden"},[_r]:{exposure:"hidden"},[mr]:{exposure:"hidden"},[yr]:{exposure:"hidden"},[br]:{exposure:"hidden"},[wr]:{exposure:"hidden"},[$r]:{exposure:"hidden"},[xr]:{exposure:"hidden"},[Sr]:{exposure:"event"}},xl=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Sl=t=>{const i=$l[t];if(i)return i;for(const[i,e]of xl)if(0===t.indexOf(i))return e};function kl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}const El=t=>{const i=typeof document>"u"?void 0:document,e=null==i?void 0:i.createElement("a");return A(e)?null:(e.href=t,e)},Tl=()=>{try{return"u">typeof window&&!1!==window.navigator.onLine}catch(t){return!1}},Pl=(t,i)=>t>=i&&Tl(),Cl=(t,i,e,s)=>{if(0===t){if(Tl()){const t=i+1;return t===e&&s(),t}return i}return 0},Al=(t,i)=>{try{let e;return JSON.stringify(t,(t,i)=>{var s;return U(i)?(null!==(s=e)&&void 0!==s||(e=new WeakMap),e.has(i)||e.set(i,Nr(i)),e.get(i)):"bigint"==typeof i?i.toString():i},i)}catch(i){return w(t)}},Fl=function(t,i){const e=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let t=0;e.length>t;t++){const n=e[t].split(/=(.*)/);if(n[0]===i){s=n;break}}if(!E(s)||2>s.length)return"";{let t=s[1].replace(/\+/g," ");try{t=decodeURIComponent(t)}catch(i){Ls.error("Skipping decoding for malformed query param: "+t)}return t}},Ol=function(t,i,e){if(!t||!i||!i.length)return t;const s=t.split(/#(.*)/),n=s[1],r=(s[0]||"").split(/\?(.*)/),o=r[1],l=r[0],a=(o||"").split("&"),u=[];for(let t=0;a.length>t;t++){const s=a[t].split("?");let n=0;for(;s.length>n&&!i.includes(s[n].split("=")[0]);)n++;u.push(s.length>n?s.slice(0,n).concat(s[n].split("=")[0]+"="+e).join("?"):a[t])}let h=l;return null!=o&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},Ml=function(t,i){const e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Rl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],Il=(()=>["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Rl])(),Dl="<masked>",jl=["li_fat_id"];function Ll(t,i,e){if(!s)return{};const n=i?[...Rl,...e||[]]:[],r=Nl(Ol(s.URL,n,Dl),t),o=function(){const t={};return Rr(jl,function(i){const e=qr(i);t[i]=e||null}),t}();return Ir(o,r)}function Nl(t,i){const e=Il.concat(i||[]),s={};return Rr(e,function(i){const e=Fl(t,i);s[i]=e||null}),s}function zl(t){const i=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",n={};if(!M(i)){n.$search_engine=i;const t=s?Fl(s.referrer,e):"";t.length&&(n.ph_keyword=t)}return n}function Bl(){return navigator.language||navigator.userLanguage}function Ul(){const t=Bl();return"string"==typeof t?t.split("-")[0]:void 0}const Hl="$direct";function ql(){return(null==s?void 0:s.referrer)||Hl}function Wl(t,i,e=!1){const s=t?[...Rl,...i||[]]:[],r=e?di(null==n?void 0:n.href):null==n?void 0:n.href,o=null==r?void 0:r.substring(0,1e3);return{r:ql().substring(0,1e3),u:o?Ol(o,s,Dl):void 0}}function Vl(t,i=!1){var e;const{r:s,u:n}=t,r=i?di(n):n,o={$referrer:s,$referring_domain:null==s?void 0:s==Hl?Hl:null===(e=El(s))||void 0===e?void 0:e.host};if(r){o.$current_url=r;const t=El(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const i=Nl(r);Ir(o,i)}if(s){const t=zl(s);Ir(o,t)}return o}function Gl(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Kl={flags:Ys,surveys:cn},Jl=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Yl=t=>`${t}_cookie_identity_change_pending`,Zl=t=>{let i="",e=0;for(const s of t){const t=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(e+t>1e3)break;i+=s,e+=t}return i},Xl="main",Ql=[Qs,Gs,Ks,rn,Zs,Ys,Xs,en],ta=t=>-1!==Ql.indexOf(t),ia=[xn,kn],ea=t=>-1!==ia.indexOf(t),sa=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},na=t=>{if(!t)return{};const i=JSON.parse(t);return P(i)?i:{}},ra=(t,i)=>{Rr(t,(e,s)=>{const n=Sl(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(i,s)||delete t[s]})};var oa=class{constructor(i,e,s=!0,n=!i.cookieless_mode){if(this.zl={},this.Hl=!1,this.Ul=!1,this.Wl=!1,this.Vl=!1,this.Gl=!1,this.Ql=new Map,this.Jl=!1,this.Zl=!1,this.Kl=!1,this.Yl=new Set,this.Xl=new Set,this.Fr=i,this.tu=s,this.props={},this.eu=void 0,this.iu=(t=>{let i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(i),this.fi=i.disable_persistence||!!e,this.Al=this.nu(i),this.Wl=this.su(i),this.load(n),this.ru(),i.debug&&Ls.info("Persistence loaded",i.persistence,bi({},this.props)),this.update_config(i,i,e),this.save(),t){const i=()=>this.flush();Ur(t,"beforeunload",i,{capture:!1}),Ur(t,"pagehide",i,{capture:!1}),this.ou=i=>{if(this.Hl&&(!i.storageArea||i.storageArea===(null==t?void 0:t.localStorage))&&i.key)if(i.key!==this.iu){if(this.Wl){const t=wl.find(t=>i.key===this.au(t));t&&this.lu(i.key,t)}}else this.lu(i.key,Xl)},Ur(t,"storage",this.ou)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,i])=>{const e=this.Ql.get(t);if(!ta(t)||!0===e)return;if(!0===i)return void this.uu(t,!0);const s=new Set(e||[]);i.forEach(t=>s.add(t)),s.size&&this.uu(t,s)})}onCrossTabFeatureFlagChange(t){return this.Xl.add(t),()=>this.Xl.delete(t)}destroy(){this.ou&&t&&(t.removeEventListener("storage",this.ou),this.ou=void 0),this.Xl.clear()}lu(t,i,e=!0){if(this.fi)return!1;let s,n;try{if(n=no.Lt(t),M(n)){const t=this.cu(i);return t.storageValue=null,i!==Xl&&(t.persisted=!1),!1}s=na(n)}catch(t){return!1}const r=i===Xl?s:no.Ft(this.iu);if(r&&this.hu(r))return!1;const o=this.du(s,i,e);return i===Xl&&this.Wl&&!sa(this.vu().main,s)||this.fu(s,i,!0,n),o}hu(t){const i=this.props[_n],e=t[_n];return!A(i)&&!A(e)&&i!==e}fu(t,i,e,s){const n=this.cu(i);n.storageValue=s,i!==Xl&&(n.persisted=e);try{n.fingerprint=this.pu(t,i)}catch(t){n.fingerprint=void 0}}du(t,i,e){let s=!1;return Ql.forEach(e=>{var n;const r=null===(n=Sl(e))||void 0===n?void 0:n.storageGroup;if(i===Xl&&this.Wl&&r||i!==Xl&&r!==i)return;const o=e in t,l=this.gu(e,o?t[e]:void 0),a=this.Ql.has(e)?e in this.props:o;a===e in this.props&&sa(l,this.props[e])||(a?this.mu(e,l,!1):this.yu(e,!1),s=!0)}),s&&e&&this.Xl.forEach(t=>t()),s}bu(){if(!this.Hl)return!1;try{this.Kl=!1;const t=no.Lt(this.iu),i=this.cu(Xl);let e,s=!1,n=!1;if(t!==i.storageValue)if(M(t))i.storageValue=null;else{if(e=na(t),this.Kl=!this.Zl&&this.hu(e),this.Kl)return!1;n=this.du(e,Xl,!1),!this.Wl||sa(this.vu().main,e)?this.fu(e,Xl,!0,t):i.storageValue=t,s=!0}return this.Wl&&wl.forEach(t=>{const i=no.Lt(this.au(t)),r=this.cu(t),o=e||{},l=s&&Ql.some(i=>{var e;return(null===(e=Sl(i))||void 0===e?void 0:e.storageGroup)===t&&i in o});if(i===r.storageValue&&!l)return;if(M(i))return r.storageValue=null,r.persisted=!1,void(l&&(n=this.du(o,t,!1)||n));const a=na(i);n=this.du(a,t,!1)||n,this.fu(a,t,!0,i)}),n}catch(t){return!1}}uu(t,i){this.Ql.set(t,i);const e=Sl(t);(null==e?void 0:e.volatile)||(this.cu((this.Wl?null==e?void 0:e.storageGroup:void 0)||Xl).fingerprint=void 0,this._u(t))}wu(){Ql.forEach(t=>this.Ql.set(t,!0))}ru(){if(this.Hl)try{const t=no.Lt(this.iu),i=na(t);this.cu(Xl).storageValue=t,Ql.forEach(t=>{var e;const s=this.Wl?null===(e=Sl(t))||void 0===e?void 0:e.storageGroup:void 0,n=s?no.Lt(this.au(s)):null;if(s){const t=this.cu(s);t.storageValue=n,t.persisted=!M(n)}const r=s&&!M(n)?na(n):i;t in this.props?this.ku(t,r[t],this.props[t]):t in r&&this.uu(t,!0)})}catch(t){}}gu(t,i){const e=this.Ql.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){const s=new Set(E(i)?i:[]),n=new Set(E(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}const s=P(i)?bi({},i):{},n=P(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in n?s[t]=n[t]:delete s[t]}),s}ku(t,i,e){if(!ta(t))return;const s=this.Ql.get(t);if(!0===s)return;let n=i;if(this.Hl)try{var r;const i=this.Wl?null===(r=Sl(t))||void 0===r?void 0:r.storageGroup:void 0,e=i?this.au(i):this.iu;n=na(no.Lt(e))[t]}catch(t){}const o=new Set(s||[]);if("$active_feature_flags"===t){if(!A(i)&&!E(i)||!A(n)&&!E(n)||!E(e))return void this.uu(t,!0);const s=new Set(i||[]),r=new Set(n||[]),l=new Set(e);new Set([...s,...l]).forEach(t=>{s.has(t)!==l.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===l.has(t)&&o.delete(t)})}else{if(!P(e))return void(sa(n,e)?this.Ql.delete(t):this.uu(t,!0));{if(!A(i)&&!P(i)||A(i)&&C(e)&&A(n))return void this.uu(t,!0);const s=P(i)?i:{},r=P(n)?n:{};new Set([...Object.keys(s),...Object.keys(e)]).forEach(t=>{t in s==t in e&&sa(s[t],e[t])||o.add(t)}),o.forEach(t=>{t in r==t in e&&sa(r[t],e[t])&&o.delete(t)})}}o.size?this.uu(t,o):this.Ql.delete(t)}Su(){var t;const i=null===(t=this.Fr)||void 0===t?void 0:t.persistence_save_debounce_ms;return I(i)&&i>0?i:0}xu(t){if(this.Fr.cookieWinsOnConflict&&"localstorage+cookie"===this.Fr.persistence.toLowerCase())if(t)try{const i=ho(t,this.Fr.cookie_persisted_properties||[]),e=vo(i,this.Fr.cookie_persisted_properties||[]),s=JSON.stringify(i)+"|"+JSON.stringify(e),n=eo.Lt(this.iu)||void 0;n&&po(this.iu,n)===s&&(this.$u=s,this.Cu=n)}catch(t){}else try{const t=eo.Lt(this.iu)||void 0;this.$u=t?po(this.iu,t):void 0,this.Cu=t}catch(t){}}syncCookieProperties(){return this.Tu(this.Fr)}Tu(t,i=!1){if(this.fi&&!i||this.Gl||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let e;try{e=eo.Lt(this.iu)||void 0}catch(t){}if(!e||e===this.Cu)return!1;const s=po(this.iu,e);let n;try{n=uo(JSON.parse(e))}catch(t){return!1}if((eo.Lt(this.iu)||void 0)!==e)return!1;this.$u=s,this.Cu=e;const r=fo(this.iu,e),o=[...oo,...r.properties],l={};if(Object.keys(n).forEach(t=>{const i=n[t];(A(i)||M(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(l[t]=!0,delete n[t])}),C(n))return!1;const a="distinct_id"in n||"anonymous"===n.$user_state||"identified"===n.$user_state,u=this.props,h=u[_n],c=u[nr],d=Ir({},u);[...oo,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in n)&&!l[t]&&(a||"distinct_id"!==t&&"$user_state"!==t)){const i=d[t];(r.isValid||-1===oo.indexOf(t)||!1!==i&&0!==i)&&delete d[t]}}),this.props=Ir(d,n),Ql.forEach(t=>{const i=t in this.props;t in u===i&&sa(u[t],this.props[t])||(i?this.ku(t,u[t],this.props[t]):this.uu(t,!0))}),!a||"$user_state"in n||"$user_state"in this.props||this.mu(nr,kr);const v=this.props[_n],f=this.props[nr];return!a||v===h&&f===c||(this.Zl=!0,this.Vl=!0,yo.$t(Yl(this.iu),!0),this.yu(en),this.yu(Gs),this.yu(Qs),this.yu(Ks),this.yu(rn),this.yu(Zs),this.yu(Ys),this.yu(Js),this.yu(sn),"anonymous"!==f||"identified"!==c&&"anonymous"!==n.$user_state&&(A(h)||v===h)||(ra(this.props,n),this.yu(tn)),"identified"===f?this.props.$user_id=v:delete this.props.$user_id,this.yu(bn)),!0}consumeCookieIdentityChange(){const t=Yl(this.iu),i=this.Vl||!!yo.Lt(t);return this.Vl=!1,i&&yo.Dt(t),i}Iu(t=!1){return!(this.Gl||this.fi&&!t||!this.Fr.cookieWinsOnConflict||"localstorage+cookie"!==this.Fr.persistence.toLowerCase()||(this.Gl=!0,0))}Mu(){this.Gl&&(A(this.Eu)||(clearTimeout(this.Eu),this.Eu=void 0),delete this.zl[Xl],this.Au(!0))}Ru(t=!0){if(this.Gl)try{t?this.Mu():A(this.Eu)||(clearTimeout(this.Eu),this.Eu=void 0)}finally{this.Gl=!1}}isDisabled(){return!!this.fi}nu(i){-1===Jl.indexOf(i.persistence.toLowerCase())&&(Ls.critical("Unknown persistence type "+i.persistence+"; falling back to localStorage+cookie"),i.persistence="localStorage+cookie");const e=((i=[],e=!1,s=()=>!1)=>{const n=[...oo,...i];return bi(bi({},no),{},{Pu(t){return[eo.Lt(t),eo.Lt(lo(t)),no.Lt(t)].join("\0")},Ft(t){try{let r,o={};try{r=eo.Lt(t)||void 0,o=r?uo(JSON.parse(r)):{}}catch(t){}const l=JSON.parse(no.Lt(t)||"{}");let a;if(e){const e=fo(t,r),s=[...oo,...e.properties],u={};Object.keys(o).forEach(t=>{const i=o[t];M(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(u[t]=i)});const h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var i;const t=l[_n],r=null!==(i=l.$user_state)&&void 0!==i?i:kr;n.forEach(t=>{if(-1!==s.indexOf(t)&&!(t in o)&&(h||"distinct_id"!==t&&"$user_state"!==t)){const i=l[t];(e.isValid||-1===oo.indexOf(t)||!1!==i&&0!==i)&&delete l[t]}}),!h||"$user_state"in o||"$user_state"in l||(l[nr]=kr),!h||("distinct_id"in u?u[_n]:l[_n])===t&&("$user_state"in u?u[nr]:l[nr])===r||(ro.forEach(t=>delete l[t]),"identified"===u.$user_state&&"distinct_id"in u?l.$user_id=u[_n]:delete l.$user_id,"identified"!==u.$user_state&&(delete l[Yn],delete l[tn]),delete l.__alias)}a=Ir(l,u)}else a=Ir(o,l);return s()||no.$t(t,a),a}catch(t){}return null},$t(t,s,n,r,o,l){const a=no.$t(t,s,void 0,void 0,l);try{const u=ho(s,i);if(Object.keys(u).length){if(e){const e=lo(t),h=vo(u,i);if(eo.$t(e,h,n,r,o,l),eo.Lt(e)!==JSON.stringify(h)){eo.Dt(e,r);const i=ho(s);return eo.$t(t,i,n,r,o,l),a}}eo.$t(t,u,n,r,o,l)}}catch(t){no.Pt(t)}return a},Dt(i,e){try{null==t||t.localStorage.removeItem(i),eo.Dt(i,e),eo.Dt(lo(i),e)}catch(t){no.Pt(t)}}})})(i.cookie_persisted_properties||[],i.cookieWinsOnConflict,()=>!!this.fi);let s,n=!1,r=!1;const o=i.persistence.toLowerCase();return"localstorage"===o&&no.Ot()?(s=no,r=!0):"localstorage+cookie"===o&&e.Ot()?(s=e,r=!0,n=!0):"sessionstorage"===o&&yo.Ot()?s=yo:"memory"===o?s=_o:"cookie"===o&&eo.Ot()?(s=eo,n=!0):e.Ot()?(s=e,r=!0,n=!0):eo.Ot()?(s=eo,n=!0):s=_o,this.Hl=r,this.Ul=n,s}au(t){return`${this.iu}__${t}`}su(t){return this.Hl&&!!t.split_storage}properties(){const t={};return Rr(this.props,(i,e)=>{const s=Sl(e);if(!s||"event"===s.exposure){var n;if(null==s||null===(n=s.shouldSkipFromEventProperties)||void 0===n?void 0:n.call(s,i))return;t[e]=i}}),t}load(t=!1){if(this.fi&&!t)return;const i=this.Fr.cookieWinsOnConflict&&"localstorage+cookie"===this.Fr.persistence.toLowerCase(),e=i?no.Ft(this.iu):null;let s={};if(i)try{s=uo(eo.Ft(this.iu)),Rr(s,(t,i)=>{(A(t)||M(t)||""===t)&&delete s[i]})}catch(t){}const n=this.Al.Ft(this.iu);if(n&&(this.props=Ir({},n)),this.Wl&&this.Ou(),i&&n){var r,o;const t=null==e?void 0:e[_n],i=null!==(r=null==e?void 0:e.$user_state)&&void 0!==r?r:kr,l=n[_n],a=null!==(o=n.$user_state)&&void 0!==o?o:kr;if(l!==t||a!==i){this.Vl=!0,this.fi||yo.$t(Yl(this.iu),!0);const e=Ir({},this.props);ro.forEach(t=>delete e[t]),"anonymous"!==a||"identified"!==i&&"anonymous"!==s.$user_state&&(A(t)||l===t)||(ra(e,s),delete e[tn]),this.props=e;const n=new Set;ro.forEach(t=>{var i;const e=null===(i=Sl(t))||void 0===i?void 0:i.storageGroup;e&&n.add(e)}),n.forEach(t=>{if(this.fi)return;const i={};Rr(this.props,(e,s)=>{var n;(null===(n=Sl(s))||void 0===n?void 0:n.storageGroup)===t&&(i[s]=e)}),C(i)?(no.Dt(this.au(t)),this.zl[t]={}):no.$t(this.au(t),i)&&(this.zl[t]={persisted:!0,fingerprint:this.pu(i,t)})})}}yo.Lt(Yl(this.iu))&&(this.Vl=!0)}Ou(){for(const t of wl){const i=no.Ft(this.au(t));if(i&&!C(i)){const e=this.cu(t);e.persisted=!0,this.Fu(t)||(e.fingerprint=this.pu(i,t)),this.Du(t,i)||Ir(this.props,i)}}}Fu(t){return Object.keys(this.props).some(i=>{var e;return(null===(e=Sl(i))||void 0===e?void 0:e.storageGroup)===t})}Du(t,i){const e=Kl[t];if(!e)return!1;const s=i[e],n=this.props[e];return I(s)&&I(n)&&n>s}refreshKey(t){this.Lu([t])}Lu(t){if(this.fi)return;let i,e=!1;const s=()=>(e||(i=this.Al.Ft(this.iu),e=!0),i);t.forEach(t=>{var i;if(this.Yl.has(t))return;const e=this.Wl?null===(i=Sl(t))||void 0===i?void 0:i.storageGroup:void 0,n=e?no.Ft(this.au(e)):s();if(n&&t in n)this.mu(t,n[t],!1);else{if(e){const i=s();if(i&&t in i)return void this.mu(t,i[t],!1)}this.yu(t,!1)}})}refreshMetaIdentifiers(){if(this.fi)return;const t=this.Nu();(A(t)||t!==this.ju)&&(this.Lu(ia),this.qu(t))}qu(t=this.Nu()){this.ju=0===this.Yl.size?t:void 0}Nu(){const t=this.Al.Pu?this.Al.Pu(this.iu):this.Al.Lt(this.iu);return F(t)?t:void 0}save(){if(this.fi)return;const t=this.Su();t>0?A(this.Eu)&&(this.Eu=setTimeout(()=>{this.Eu=void 0,this.Au()},t)):this.Au()}flush(){A(this.Eu)||(clearTimeout(this.Eu),this.Eu=void 0,this.Au())}Au(t=!1){if(this.fi||this.Gl&&!t)return;t||(this.syncCookieProperties(),this.Fr.cookieWinsOnConflict&&"localstorage+cookie"===this.Fr.persistence.toLowerCase()||this.refreshMetaIdentifiers());const i=!t&&!this.Jl;i||(this.Kl=!1);const e=!!i&&this.bu();if(this.Kl)return void(this.Fr.debug&&Ls.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Wl)return this.Bu(),void(e&&this.Xl.forEach(t=>t()));const s=this.zu(this.Al,this.iu,this.props,Xl);"written"===s&&this.xu(this.props),"failed"!==s&&(this.Ql.clear(),this.Zl=!1,this.Yl.clear()),"written"===s&&this.qu(),e&&this.Xl.forEach(t=>t())}Bu(){const{main:t,groups:i}=this.vu(),e=this.zu(this.Al,this.iu,t,Xl);"written"===e&&this.xu(t),"failed"!==e&&(this.Zl=!1,this.Yl.clear(),Ql.forEach(t=>{var i;(null===(i=Sl(t))||void 0===i?void 0:i.storageGroup)||this.Ql.delete(t)})),"written"===e&&this.qu();for(const t of wl){var s;const e=i[t];if(C(e)&&!(null===(s=this.zl[t])||void 0===s?void 0:s.persisted)){Ql.forEach(i=>{var e;(null===(e=Sl(i))||void 0===e?void 0:e.storageGroup)===t&&this.Ql.delete(i)});continue}const n=this.zu(no,this.au(t),e,t);"failed"!==n&&Ql.forEach(i=>{const e=Sl(i);(null==e?void 0:e.storageGroup)!==t||"written"!==n&&e.volatile||this.Ql.delete(i)})}}vu(){const t={},i={flags:{},surveys:{}};return Rr(this.props,(e,s)=>{var n;const r=null===(n=Sl(s))||void 0===n?void 0:n.storageGroup;r?i[r][s]=e:t[s]=e}),{main:t,groups:i}}pu(t,i){if(i===Xl)return JSON.stringify(t)+"|"+this.Hu+"|"+this.Uu+"|"+this.Wu;const e={};return Rr(t,(t,i)=>{var s;e[i]=(null===(s=Sl(i))||void 0===s?void 0:s.volatile)?"__volatile__":t}),JSON.stringify(e)}zu(t,i,e,s){const n=this.cu(s);if(s!==Xl&&!n.dirty&&!A(n.fingerprint))return"skipped";let r;try{if(r=this.pu(e,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){r=void 0}return t.$t(i,e,this.Hu,this.Uu,this.Wu,this.Fr.debug)?(n.dirty=!1,s!==Xl&&(n.persisted=!0),A(r)||(n.fingerprint=r),this.Hl&&(n.storageValue=no.Lt(i)),"written"):(this.Fr.debug&&Ls.warn(`failed to persist storage entry "${i}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.wu(),A(this.Eu)||(clearTimeout(this.Eu),this.Eu=void 0),this.Al.Dt(this.iu,!1),this.Al.Dt(this.iu,!0),!t&&this.tu)for(const t of wl)no.Dt(this.au(t));t?delete this.zl[Xl]:this.zl={},this.$u=void 0,this.Cu=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(P(t)){this.syncCookieProperties(),A(i)&&(i="None"),this.Hu=A(e)?this.Vu:e;let s=!1;if(Rr(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.mu(e,t),s=!0)}),s)return this.save(),!0}return!1}register(t,i){if(P(t)){this.syncCookieProperties(),this.Hu=A(i)?this.Vu:i;let e=!1;if(Rr(t,(i,s)=>{t.hasOwnProperty(s)&&(this.props[s]!==i||P(i)||E(i))&&(this.mu(s,i),e=!0)}),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const i="string"==typeof t?[t]:t;let e=!1;for(const t of i)t in this.props&&(this.yu(t),e=!0);e&&this.save()}update_campaign_params(){const t=null==s?void 0:s.URL;if(t===this.eu)return;const i=Ll(this.Fr.custom_campaign_params,this.Fr.mask_personal_data_properties,this.Fr.custom_personal_data_properties),e=!C(Lr(i));return e&&this.register(i),this.eu=t,e?i:void 0}update_search_keyword(){this.register(function(){const t=null==s?void 0:s.referrer;return t?zl(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:ql(),$referring_domain:(null==s?void 0:s.referrer)&&(null===(t=El(s.referrer))||void 0===t?void 0:t.host)||Hl},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Wl(this.Fr.mask_personal_data_properties,this.Fr.custom_personal_data_properties,this.Fr.disable_capture_url_hashes);this.register_once({[ur]:this.Ul?{r:Zl(t.r),u:t.u?Zl(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Rr([ar,lr],i=>{const e=this.props[i];e&&Rr(e,function(i,e){t["$initial_"+b(e)]=i})});const i=this.props[ur];if(i){const e=function(t,i=!1){const e=Vl(t,i),s={};return Rr(e,function(t,i){s[`$initial_${b(i)}`]=t}),s}(i,this.Fr.disable_capture_url_hashes);Ir(t,e)}return t}safe_merge(t){return Rr(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){const s=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;const e=[...t].sort(),s=[...i].sort();return e.every((t,i)=>t===s[i])})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),r=s||n,o=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,a=!!this.fi&&!l;l||this.Tu(i,a),this.Fr=t,!l&&(s||n||o)&&(this.$u=void 0,this.Cu=void 0,this.Tu(bi(bi({},t),{},{cookie_persisted_properties:i.cookie_persisted_properties}),a));const u=r||o?this.nu(t):this.Al;this.Gu();const h=this.su(t),c=r||h!==this.Wl,d=!l&&(c||t.cross_subdomain_cookie!==this.Uu||t.secure_cookie!==this.Wu)&&this.Iu(a);this.Jl=c;try{if(this.Vu=this.Hu=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.Al=u,this.Wl=h,this.props=t,this.save()}else o&&(this.Al=u,l||(delete this.zl[Xl],this.Au()))}finally{this.Jl=!1,d&&this.Ru()}}Gu(){const t=this.props[ur];if(!this.Ul||!P(t)||"string"!=typeof t.r)return;const i=Zl(t.r),e="string"==typeof t.u?Zl(t.u):t.u;i===t.r&&e===t.u||this.mu(ur,bi(bi({},t),{},{r:i,u:e}))}set_disabled(t){this.fi=t,this.fi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Uu&&(this.Uu=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Wu&&(this.Wu=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){const e=this.props.__timers||{};e[t]=i,this.mu(En,e),this.save()}remove_event_timer(t){const i=this.props.__timers||{},e=i[t];return A(e)||(delete i[t],this.mu(En,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.mu(t,i),this.save()}mu(t,i,e=!0){var s;const n=this.props[t];this.props[t]=i,e&&("distinct_id"!==t&&"$user_state"!==t||n===i||(this.Zl=!0),ea(t)&&!sa(n,i)&&this.Yl.add(t),this.ku(t,n,i),(null===(s=Sl(t))||void 0===s?void 0:s.volatile)||this._u(t))}yu(t,i=!0){delete this.props[t],i&&(ta(t)&&this.uu(t,!0),ea(t)&&this.Yl.add(t),this._u(t))}_u(t){var i;const e=null===(i=Sl(t))||void 0===i?void 0:i.storageGroup;e&&(this.cu(e).dirty=!0)}cu(t){return this.zl[t]||(this.zl[t]={})}};const la="gzip-js",aa="base64",ua="events",ha="cancelEvents",ca="survey shown",da="survey dismissed",va="survey sent",fa="$survey_last_seen_date",pa="popover";function ga(t){let i=!0;return{dispose(){if(i){i=!1;const e=t();e&&T(e.then)&&e.then(void 0,()=>{})}}}}const _a=Ns("[RateLimiter]");var ma=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(t=>{_a.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void _a.warn(`could not rate limit - continuing. Error: "${null==t?void 0:t.message}"`,{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}get isClientRateLimited(){return 1>this.Qu().tokens}clientRateLimitContext(t=!1){var i;const e=this.Qu(),s=1>e.tokens;if(s||t||(e.tokens=Math.max(0,e.tokens-1)),s&&!t){const t=(I(e.dropped)?e.dropped:0)+1;e.dropped=t,!this.lastEventRateLimited&&this.Ju(t)&&(e.dropped=0)}return this.lastEventRateLimited=s,null===(i=this.instance.persistence)||void 0===i||i.set_property("$capture_rate_limit",e),{isRateLimited:s,remainingTokens:e.tokens}}Qu(){var t;const{captureEventsBurstLimit:i,captureEventsPerSecond:e}=this,s=(new Date).getTime(),n=null===(t=this.instance.persistence)||void 0===t?void 0:t.get_property(or),r=n?bi({},n):{tokens:i,last:s};return r.tokens+=Math.max(0,s-r.last)/1e3*e,r.last=Math.max(r.last,s),r.tokens>i&&(r.tokens=i),r}Zu(t){const i=this.instance.config.property_denylist;return!E(i)||!i.includes(t)}Ku(){var t;if(this.Zu("$current_url")&&this.Zu("$pathname")&&(null==n?void 0:n.pathname))return`${null!==(t=n.origin)&&void 0!==t?t:""}${n.pathname}`}Ju(t){var i,e;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this.Ku(),o=this.Zu("$session_id")?null===(i=(e=this.instance).get_session_id)||void 0===i?void 0:i.call(e):void 0,l=[`${t} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${l}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}};const ya=Ns("[RemoteConfig]");var ba=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=c._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Yu(t){var i,e,s;(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.loadExternalDependency)?null===(e=c.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Xu(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:t})}load(){try{if(this.remoteConfig)return ya.info("Using preloaded remote config",this.remoteConfig),void this.tc(this.remoteConfig);if(this._instance.ec())return void ya.warn("Remote config is disabled. Falling back to local config.");this.Yu(t=>{if(!t)return ya.info("No config found after loading remote JS config. Falling back to JSON."),void this.Xu(t=>{this.tc(t.json,t)});this.tc(t)})}catch(t){ya.error("Error loading remote config",t),this.tc()}}tc(t,i){!t&&i&&(0===i.statusCode?i.error||ya.warn("Failed to fetch remote config from PostHog."):ya.error("Failed to fetch remote config from PostHog."));try{this._instance.tc(t?{ok:!0,config:t}:{ok:!1})}catch(t){ya.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null===(e=this._instance.featureFlags)||void 0===e||e.ensureFlagsLoaded()}catch(t){ya.error("Error loading feature flags",t)}}},wa=Uint8Array,$a=Uint16Array,xa=Uint32Array,Sa=new wa([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]),ka=new wa([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]),Ea=new wa([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ta=function(t,i){for(var e=new $a(31),s=0;31>s;++s)e[s]=i+=1<<t[s-1];var n=new xa(e[30]);for(s=1;30>s;++s)for(var r=e[s];e[s+1]>r;++r)n[r]=r-e[s]<<5|s;return[e,n]},Pa=Ta(Sa,2),Ca=Pa[1];Pa[0][28]=258,Ca[258]=28;for(var Aa=Ta(ka,0)[1],Fa=new $a(32768),Oa=0;32768>Oa;++Oa){var Ma=(43690&Oa)>>>1|(21845&Oa)<<1;Fa[Oa]=((65280&(Ma=(61680&(Ma=(52428&Ma)>>>2|(13107&Ma)<<2))>>>4|(3855&Ma)<<4))>>>8|(255&Ma)<<8)>>>1}var Ra=function(t,i,e){for(var s=t.length,n=0,r=new $a(i);s>n;++n)++r[t[n]-1];var o,l=new $a(i);for(n=0;i>n;++n)l[n]=l[n-1]+r[n-1]<<1;if(e){o=new $a(1<<i);var a=15-i;for(n=0;s>n;++n)if(t[n])for(var u=n<<4|t[n],h=i-t[n],c=l[t[n]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[Fa[c]>>>a]=u}else for(o=new $a(s),n=0;s>n;++n)o[n]=Fa[l[t[n]-1]++]>>>15-t[n];return o},Ia=new wa(288);for(Oa=0;144>Oa;++Oa)Ia[Oa]=8;for(Oa=144;256>Oa;++Oa)Ia[Oa]=9;for(Oa=256;280>Oa;++Oa)Ia[Oa]=7;for(Oa=280;288>Oa;++Oa)Ia[Oa]=8;var Da=new wa(32);for(Oa=0;32>Oa;++Oa)Da[Oa]=5;var ja=Ra(Ia,9,0),La=Ra(Da,5,0),Na=function(t){return(t/8|0)+(7&t&&1)},za=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var s=new(t instanceof $a?$a:t instanceof xa?xa:wa)(e-i);return s.set(t.subarray(i,e)),s},Ba=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8},Ua=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8,t[s+2]|=e>>>16},Ha=function(t,i){for(var e=[],s=0;t.length>s;++s)t[s]&&e.push({s:s,f:t[s]});var n=e.length,r=e.slice();if(!n)return[new wa(0),0];if(1==n){var o=new wa(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort(function(t,i){return t.f-i.f}),e.push({s:-1,f:25001});var l=e[0],a=e[1],u=0,h=1,c=2;for(e[0]={s:-1,f:l.f+a.f,l:l,r:a};h!=n-1;)l=e[e[c].f>e[u].f?u++:c++],a=e[u!=h&&e[c].f>e[u].f?u++:c++],e[h++]={s:-1,f:l.f+a.f,l:l,r:a};var d=r[0].s;for(s=1;n>s;++s)r[s].s>d&&(d=r[s].s);var v=new $a(d+1),f=qa(e[h-1],v,0);if(f>i){s=0;var p=0,g=f-i,_=1<<g;for(r.sort(function(t,i){return v[i.s]-v[t.s]||t.f-i.f});n>s;++s){var m=r[s].s;if(i>=v[m])break;p+=_-(1<<f-v[m]),v[m]=i}for(p>>>=g;p>0;){var y=r[s].s;i>v[y]?p-=1<<i-v[y]++-1:++s}for(;s>=0&&p;--s){var b=r[s].s;v[b]==i&&(--v[b],++p)}f=i}return[new wa(v),f]},qa=function(t,i,e){return-1==t.s?Math.max(qa(t.l,i,e+1),qa(t.r,i,e+1)):i[t.s]=e},Wa=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new $a(++i),s=0,n=t[0],r=1,o=function(t){e[s++]=t},l=1;i>=l;++l)if(t[l]==n&&l!=i)++r;else{if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=t[l]}return[e.subarray(0,s),i]},Va=function(t,i){for(var e=0,s=0;i.length>s;++s)e+=t[s]*i[s];return e},Ga=function(t,i,e){var s=e.length,n=Na(i+2);t[n]=255&s,t[n+1]=s>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var r=0;s>r;++r)t[n+r+4]=e[r];return 8*(n+4+s)},Ka=function(t,i,e,s,n,r,o,l,a,u,h){Ba(i,h++,e),++n[256];for(var c=Ha(n,15),d=c[0],v=c[1],f=Ha(r,15),p=f[0],g=f[1],_=Wa(d),m=_[0],y=_[1],b=Wa(p),w=b[0],x=b[1],S=new $a(19),k=0;m.length>k;++k)S[31&m[k]]++;for(k=0;w.length>k;++k)S[31&w[k]]++;for(var E=Ha(S,7),T=E[0],P=E[1],C=19;C>4&&!T[Ea[C-1]];--C);var A,F,O,M,R=u+5<<3,I=Va(n,Ia)+Va(r,Da)+o,D=Va(n,d)+Va(r,p)+o+14+3*C+Va(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(I>=R&&D>=R)return Ga(i,h,t.subarray(a,a+u));if(Ba(i,h,1+(I>D)),h+=2,I>D){A=Ra(d,v,0),F=d,O=Ra(p,g,0),M=p;var j=Ra(T,P,0);for(Ba(i,h,y-257),Ba(i,h+5,x-1),Ba(i,h+10,C-4),h+=14,k=0;C>k;++k)Ba(i,h+3*k,T[Ea[k]]);h+=3*C;for(var L=[m,w],N=0;2>N;++N){var z=L[N];for(k=0;z.length>k;++k)Ba(i,h,j[B=31&z[k]]),h+=T[B],B>15&&(Ba(i,h,z[k]>>>5&127),h+=z[k]>>>12)}}else A=ja,F=Ia,O=La,M=Da;for(k=0;l>k;++k)if(s[k]>255){var B;Ua(i,h,A[257+(B=s[k]>>>18&31)]),h+=F[B+257],B>7&&(Ba(i,h,s[k]>>>23&31),h+=Sa[B]);var U=31&s[k];Ua(i,h,O[U]),h+=M[U],U>3&&(Ua(i,h,s[k]>>>5&8191),h+=ka[U])}else Ua(i,h,A[s[k]]),h+=F[s[k]];return Ua(i,h,A[256]),h+F[256]},Ja=new xa([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ya=new wa(0),Za=function(){for(var t=new xa(256),i=0;256>i;++i){for(var e=i,s=9;--s;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Xa=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function Qa(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,s=0;i.length>s;++s)e=Za[255&e^i[s]]^e>>>8;t=e},d(){return 4294967295^t}}}(),s=t.length;e.p(t);var n,r,o,l,a,u,h=(l=10+((n=i).filename&&n.filename.length+1||0),a=8,function(t,i,e,s,n,r){var o=t.length,l=new wa(s+o+5*(1+Math.floor(o/7e3))+n),a=l.subarray(s,l.length-n),u=0;if(!i||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=Ga(a,u,t.subarray(h,c)):(a[h]=r,u=Ga(a,u,t.subarray(h,o)))}else{for(var d=Ja[i-1],v=d>>>13,f=8191&d,p=(1<<e)-1,g=new $a(32768),_=new $a(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new xa(25e3),x=new $a(288),S=new $a(32),k=0,E=0,T=(h=0,0),P=0,C=0;o>h;++h){var A=b(h),F=32767&h,O=_[A];if(g[F]=O,_[A]=F,h>=P){var M=o-h;if((k>7e3||T>24576)&&M>423){u=Ka(t,a,0,w,x,S,E,T,C,h-C,u),T=k=E=0,C=h;for(var R=0;286>R;++R)x[R]=0;for(R=0;30>R;++R)S[R]=0}var I=2,D=0,j=f,L=F-O&32767;if(M>2&&A==b(h-L))for(var N=Math.min(v,M)-1,z=Math.min(32767,h),B=Math.min(258,M);z>=L&&--j&&F!=O;){if(t[h+I]==t[h+I-L]){for(var U=0;B>U&&t[h+U]==t[h+U-L];++U);if(U>I){if(I=U,D=L,U>N)break;var H=Math.min(L,U-2),q=0;for(R=0;H>R;++R){var W=h-L+R+32768&32767,V=W-g[W]+32768&32767;V>q&&(q=V,O=W)}}}L+=(F=O)-(O=g[F])+32768&32767}if(D){w[T++]=268435456|Ca[I]<<18|Aa[D];var G=31&Ca[I],K=31&Aa[D];E+=Sa[G]+ka[K],++x[257+G],++S[K],P=h+I,++k}else w[T++]=t[h],++x[t[h]]}}u=Ka(t,a,r,w,x,S,E,T,C,h-C,u),r||(u=Ga(a,u,Ya))}return za(l,0,s+Na(u)+n)}(r=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+o.mem,l,a,!u)),c=h.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&Xa(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var s=0;e.length>=s;++s)t[s+10]=e.charCodeAt(s)}}(h,i),Xa(h,c-8,e.d()),Xa(h,c-4,s),h}const tu=!!o||!!r,iu=new WeakMap,eu="text/plain";let su=0,nu=!1;const ru=(t,i)=>{const[e,s]=t.split("#"),[n,r]=e.split("?");if(!r)return t;const o=r.split("&").filter(t=>t.split("=")[0]!==i).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},ou=(t,i,e=!0)=>{var s;const[n,r]=t.split("?"),o=bi({},i),l=null!==(s=null==r?void 0:r.split("&").map(t=>{var i;const[s,n]=t.split("="),r=e&&null!==(i=o[s])&&void 0!==i?i:n;return delete o[s],`${s}=${r}`}))&&void 0!==s?s:[],a=function(t,i="&"){let e,s;const n=[];return Rr(t,function(t,i){A(t)||A(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),s=encodeURIComponent(i),n[n.length]=s+"="+e)}),n.join(i)}(o);return a&&l.push(a),l.length>0?`${n}?${l.join("&")}`:n},lu=t=>{if(t.cr)return t.cr;const{data:i,compression:e}=t;if(!i)return;if(e===la){const t=Qa(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new wa(t.length+(t.length>>>1)),s=0,n=function(t){e[s++]=t},r=0;i>r;++r){if(s+5>e.length){var o=new wa(s+8+(i-r<<1));o.set(e),e=o}var l=t.charCodeAt(r);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++r))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return za(e,0,s)}(Al(i)),{mtime:0});return{contentType:eu,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(e===aa){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(Al(i)),e=(t=>"data="+encodeURIComponent("string"==typeof t?t:Al(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:e,estimatedSize:new Blob([e]).size}}const s=Al(i);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},au=t=>{const i=()=>"sendBeacon"===t.transport?{url:ou(t.url,{compression:aa}),encodedBody:lu(bi(bi({},t),{},{compression:aa,cr:void 0}))}:{url:ru(t.url,"compression"),encodedBody:lu(bi(bi({},t),{},{compression:void 0,cr:void 0}))};let e;try{e=lu(t)}catch(e){if(me(t.compression,Fl(t.url,"compression")))return Ls.error("Failed to gzip request body, sending uncompressed payload",e),i();throw e}return e&&me(t.compression,Fl(t.url,"compression"))&&!((s=e.body)instanceof ArrayBuffer?_e(new Uint8Array(s)):ArrayBuffer.isView(s)&&_e(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(nu=!0,i()):{url:t.url,encodedBody:e};var s},uu=t=>{try{return au(t)}catch(e){var i;return Ls.error(e),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))}},hu=function(){var t=J(function*(t){const i=yield function(t){return xe.apply(this,arguments)}(Al(t.data),Ws.DEBUG,{rethrow:!0});if(!i)return t;const e=yield i.arrayBuffer();return bi(bi({},t),{},{cr:{contentType:eu,body:e,estimatedSize:e.byteLength}})});return function(i){return t.apply(this,arguments)}}(),cu=t=>ci("AbortError","PostHog request timed out"+(t?` after ${t}ms`:"")),du=/Failed to fetch|NetworkError|Load failed/i,vu=t=>"TypeError"===(null==t?void 0:t.name)&&du.test((null==t?void 0:t.message)||""),fu=t=>{try{const i=function(t,i=Date.now(),e=3e5){if("string"!=typeof t||!t)return;const s=t.trim(),n=/^\d+\s*,/.test(s)?s.slice(0,s.indexOf(",")).trim():s;if(/^\d+$/.test(n)){const t=1e3*Math.min(Number(n),e/1e3);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const r=/^\w{3} \w{3} /.test(n)?n+" GMT":n,o=Date.parse(r)-i;return Number.isFinite(o)&&o>0?Math.min(o,e):void 0}(t());return A(i)?void 0:Math.min(i,3e4)}catch(t){return}},pu=t=>{const i=uu(t);if(!i)return;const e=new o;iu.set(e,!0);const{url:s,encodedBody:n}=i;e.open(t.method||"GET",s,!0);const{contentType:r,body:l}=null!=n?n:{};Rr(t.headers,function(t,i){e.setRequestHeader(i,t)}),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout);let a=!1;e.ontimeout=()=>{a=!0},e.onloadend=()=>{var i;if(a){var s;const i=cu(t.timeout);return Ls.warn(i),void(null===(s=t.callback)||void 0===s||s.call(t,{statusCode:0,error:i}))}const n={statusCode:e.status,text:e.responseText};if(200===e.status)try{n.json=JSON.parse(e.responseText)}catch(t){}null===(i=t.callback)||void 0===i||i.call(t,n,fu(()=>e.getResponseHeader("Retry-After")))},e.send(l)},gu=t=>{const i=uu(t);if(!i)return;const{url:e,encodedBody:s}=i,{contentType:n,body:o,estimatedSize:a}=null!=s?s:{},u=new Headers;Rr(t.headers,function(t,i){u.append(i,t)}),n&&u.append("Content-Type",n);let h=null,c=!1;if(l){const i=new l;h={signal:i.signal,timeout:setTimeout(()=>{c=!0;try{i.abort(cu(t.timeout))}catch(t){v(t)}},t.timeout)}}let d=!1;const v=i=>{var e;d||(d=!0,c&&"AbortError"===(null==i?void 0:i.name)||vu(i)?Ls.warn(i):Ls.error(i),null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))};let f=0;const p=()=>{su-=f,f=0,h&&clearTimeout(h.timeout)};try{const i=bi({method:(null==t?void 0:t.method)||"GET",headers:u,referrerPolicy:"strict-origin",body:o,signal:null==h?void 0:h.signal},t.fetchOptions),s=null!=a?a:A(o)?0:void 0;i.keepalive="POST"===i.method&&!t.Il&&!1!==i.keepalive&&i.body===o&&!A(s)&&s>=0&&52428.8>su+s,i.keepalive&&(f=s,su+=f),r(e,i).then(i=>i.text().then(e=>{var s;if(d)return;const n={statusCode:i.status,text:e};if(200===i.status)try{n.json=JSON.parse(e)}catch(t){Ls.error(t)}d=!0,p(),null===(s=t.callback)||void 0===s||s.call(t,n,fu(()=>i.headers.get("Retry-After")))})).catch(t=>{p(),v(t)}).finally(p)}catch(t){p(),v(t)}},_u=t=>{try{var i;const{url:s,encodedBody:n}=au(t),{contentType:o,body:l,estimatedSize:a}=null!=n?n:{};if(!l)return;const u=l instanceof Blob?l:new Blob([l],{type:o});if(e.sendBeacon(s,u))return;const h=E(t.data)?t.data:null===(i=t.data)||void 0===i?void 0:i.batch;if(E(h)&&h.length>1&&(null!=a?a:0)>16384){const i=Math.ceil(h.length/2),e=i=>E(t.data)?i:bi(bi({},t.data),{},{batch:i});return _u(bi(bi({},t),{},{data:e(h.slice(0,i))})),void _u(bi(bi({},t),{},{data:e(h.slice(i))}))}Ls.warn(`Beacon of ~${null!=a?a:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?gu(bi(bi({},t),{},{Il:!0})):pu(t)}catch(t){Ls.warn("Beacon send failed",t)}},mu=(t,i,e,s)=>{const n="query"===s?"POST"===i?"sent_at":"_":void 0;return ou(e===la?ru(t,"compression"):t,bi(bi({},n?{[n]:Date.now().toString()}:{}),e===la?{}:{compression:e}))},yu=(()=>{const t=[];return r&&t.push({transport:"fetch",method:gu}),o&&t.push({transport:"XHR",method:pu}),(null==e?void 0:e.sendBeacon)&&t.push({transport:"sendBeacon",method:_u}),t})();let bu=!tu&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));function wu(t,i,e){var s,n,r,o;e&&(i=bi(bi({},i),{},{callback:t=>e(t)})),t.__loaded?bu?t.__request_queue.push(i):t.rateLimiter.isServerRateLimited(i.batchKey)?i.fireCallbackOnDrop&&(null===(r=i.callback)||void 0===r||r.call(i,{statusCode:429})):(i.transport=i.transport||t.config.api_transport,i.headers=bi(bi({},t.config.request_headers),i.headers),i.compression="best-available"===i.compression?null!==(s=t.compression)&&void 0!==s?s:i.compressionFallback:i.compression,(A(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(i.disableTransport=["sendBeacon"]),i.fetchOptions=i.fetchOptions||t.config.fetch_options,null===(n=i.onDispatch)||void 0===n||n.call(i),((t,i)=>{var e,s,n;const r=bi(bi({},t),{},{callback:null!=i?i:i=>{var e;return null===(e=t.callback)||void 0===e?void 0:e.call(t,i)}});r.timeout=r.timeout||6e4;const o=null!==(e=r.transport)&&void 0!==e?e:"fetch";"sendBeacon"===o&&A(r.compression)&&r.data&&(r.compression=aa),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(t=>{var i,e;const s=(E(t)?t:[t]).map(t=>bi(bi({},t),t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})),n=s[0];return{api_key:null!==(i=null==n||null===(e=n.properties)||void 0===e?void 0:e.token)&&void 0!==i?i:null==n?void 0:n.token,batch:s,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((t,i=(new Date).toISOString())=>E(t)?t.map(t=>bi(bi({},t),{},{sent_at:i})):bi(bi({},t),{},{sent_at:i}))(r.data))),r.url=mu(r.url,r.method,r.compression,r.timestampMode);const l=yu.filter(t=>!r.disableTransport||!t.transport||!r.disableTransport.includes(t.transport)),u=null!==(s=null===(n=function(t,i){for(let e=0;t.length>e;e++)if(i(t[e]))return t[e]}(l,t=>t.transport===o))||void 0===n?void 0:n.method)&&void 0!==s?s:l[0].method;if(!u)throw new Error("No available transport method");const h=t=>{try{u(t)}catch(t){var i;vu(t)?Ls.warn(t):Ls.error(t),null===(i=r.callback)||void 0===i||i.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===la&&a&&"undefined"!=typeof Promise&&!nu?hu(r).then(t=>{h(t)}).catch(i=>{if(ye(i))return nu=!0,void h(bi(bi({},r),{},{compression:void 0,url:mu(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;const i="name"in t?String(t.name):"";return ye(t)||i===ge})(i)&&(nu=!0),h(r)}):h(r)})(i,(s,n)=>{var r,o,l;t.rateLimiter.checkForLimiting(s),400>s.statusCode||null===(r=(o=t.config).on_request_error)||void 0===r||r.call(o,s),e?e(s,n):null===(l=i.callback)||void 0===l||l.call(i,s)})):i.fireCallbackOnDrop&&(null===(o=i.callback)||void 0===o||o.call(i,{statusCode:0}))}var $u=class{constructor(t,i){this.nc=!0,this.sc=[],this.rc=Q((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,Ls.createLogger("flush interval"),3e3),this.oc=t}enqueue(t){this.sc.push(t),this.ac||this.lc()}unload(){this.uc();const t=this.sc.length>0?this.cc():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.hc(bi(bi({},t),{},{callback:void 0}),"sendBeacon")})}enable(){this.nc=!1,this.lc()}lc(){this.nc||(this.ac=setTimeout(()=>{this.uc(),this.dc()},this.rc))}dc(){if(this.sc.length>0){const t=this.cc();for(const i in t)this.hc(t[i])}}hc(t,i){try{this.oc(t,i)}catch(t){Ls.error(t)}}uc(){clearTimeout(this.ac),this.ac=void 0}cc(){const t={},i={};Rr(this.sc,e=>{var s;const n=e,r=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");A(t[r])&&(t[r]=bi(bi({},n),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),i[r]=[]),null===(s=t[r].data)||void 0===s||s.push(n.data),n.callback&&i[r].push(n.callback)});for(const e in i){const s=i[e];s.length&&(t[e].callback=t=>{for(const i of s)i(t)})}return this.sc=[],t}};const xu=["retriesPerformedSoFar"];var Su=class{constructor(t){this._instance=t,this.vc=!1,this.fc=3e3,this.sc=[],this.sc=[],this.gc=!0,this.resume()}resume(){if(!A(t)&&"onLine"in t.navigator){if(this.gc=t.navigator.onLine,this.mc)return;this.mc=()=>{this.gc=!0,this.dc()},this.yc=()=>{this.gc=!1},Ur(t,"online",this.mc),Ur(t,"offline",this.yc)}}get length(){return this.sc.length}retriableRequest(t,i){let{retriesPerformedSoFar:e}=t,s=Se(t,xu);D(e)&&(s.url=ou(s.url,{retry_count:e})),wu(this._instance,i?bi(bi({},s),{},{transport:i}):s,(t,i)=>{var n;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.Ls(bi({retriesPerformedSoFar:e},s),i);0===t.statusCode&&Ls.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=e?e:0} retries.`)}null===(n=s.callback)||void 0===n||n.call(s,t)})}Ls(t,i){const e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;const s=Math.max(function(t){const i=3e3*Math.pow(2,t),e=i/2,s=Math.min(18e5,i),n=(Math.random()-.5)*(s-e);return Math.ceil(s+n)}(e),null!=i?i:0),n=Date.now()+s;this.sc.push({retryAt:n,requestOptions:t});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),Ls.warn(r),this.vc||(this.vc=!0,this.bc())}bc(){if(this._c&&clearTimeout(this._c),0===this.sc.length)return this.vc=!1,void(this._c=void 0);this._c=setTimeout(()=>{this.gc&&this.sc.length>0&&this.dc(),this.bc()},this.fc)}dc(){const t=Date.now(),i=[],e=this.sc.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.sc=i,e.length>0)for(const{requestOptions:t}of e)this.retriableRequest(t)}unload(){this._c&&(clearTimeout(this._c),this._c=void 0),this.vc=!1,A(t)||(this.mc&&(t.removeEventListener("online",this.mc),this.mc=void 0),this.yc&&(t.removeEventListener("offline",this.yc),this.yc=void 0));for(const{requestOptions:t}of this.sc)try{this._instance._send_request(bi(bi({},t),{},{callback:E(t.data)?void 0:t.callback,transport:"sendBeacon"}))}catch(t){Ls.error(t)}this.sc=[]}},ku=class{constructor(t){this._instance=t,this.wc=()=>{var t,i,e,s;this.kc||(this.kc={});const n=this.scrollElement(),r=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=r+((null==n?void 0:n.clientHeight)||0),a=(null==n?void 0:n.scrollHeight)||0;this.kc.lastScrollY=Math.ceil(r),this.kc.maxScrollY=Math.max(r,null!==(t=this.kc.maxScrollY)&&void 0!==t?t:0),this.kc.maxScrollHeight=Math.max(o,null!==(i=this.kc.maxScrollHeight)&&void 0!==i?i:0),this.kc.lastContentY=l,this.kc.maxContentY=Math.max(l,null!==(e=this.kc.maxContentY)&&void 0!==e?e:0),this.kc.maxContentHeight=Math.max(a,null!==(s=this.kc.maxContentHeight)&&void 0!==s?s:0)}}get Sc(){return this._instance.config.scroll_root_selector}getContext(){return this.kc}resetContext(){const t=this.kc;return this.kc=void 0,setTimeout(this.wc,0),t}startMeasuringScrollPosition(){Ur(t,"scroll",this.wc,{capture:!0}),Ur(t,"scrollend",this.wc,{capture:!0}),Ur(t,"resize",this.wc)}scrollElement(){if(this.Sc){const e=E(this.Sc)?this.Sc:[this.Sc];for(const s of e){var i;const e=null==t||null===(i=t.document)||void 0===i?void 0:i.querySelector(s);if(e)return e}return}var e;return null==t||null===(e=t.document)||void 0===e?void 0:e.documentElement}xc(i){var e,s;const n="y"===i?"scrollTop":"scrollLeft";if(this.Sc){const t=this.scrollElement();return t&&t[n]||0}return t?"y"===i?t.scrollY||t.pageYOffset||(null===(e=t.document)||void 0===e||null===(e=e.documentElement)||void 0===e?void 0:e.scrollTop)||0:t.scrollX||t.pageXOffset||(null===(s=t.document)||void 0===s||null===(s=s.documentElement)||void 0===s?void 0:s.scrollLeft)||0:0}scrollY(){return this.xc("y")}scrollX(){return this.xc("x")}};const Eu=t=>Wl(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);var Tu=class{constructor(t,i,e,s){this.je=t=>{const i=this.$c();if(i&&i.sessionId===t)return;const e={sessionId:t,props:this.Cc(this._instance)};this.Tc.register({[rr]:e})},this._instance=t,this.Ic=i,this.Tc=e,this.Cc=s||Eu,this.Ic.onSessionId(this.je)}$c(){return this.Tc.props[rr]}getSetOnceProps(){var t;const i=null===(t=this.$c())||void 0===t?void 0:t.props;return i?"r"in i?Vl(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){const t={};return Rr(Lr(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t[`$session_entry_${b(e)}`]=i}),t}},Pu=class{on(t,i){return this.xo[t]||(this.xo[t]=[]),this.xo[t].push(i),()=>{this.xo[t]=this.xo[t].filter(t=>t!==i)}}emit(t,i){for(const e of this.xo[t]||[])e(i);for(const e of this.xo["*"]||[])e(t,i)}constructor(){this.xo={}}};const Cu=Ns("[SessionId]"),Au=864e5;var Fu=class{on(t,i){return this.Mc.on(t,i)}constructor(t,i,e){var s;if(this.Ec=null,this.Ac=null,this.Rc=[],this.Pc=void 0,this.Oc=!1,this.Mc=new Pu,this.Fc=(t,i)=>!(!D(t)||!D(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===t.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Fr=t.config,this.Tc=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Dc=void 0,this._sessionActivityTimestamp=null,this.Lc=i||Zr,this.Nc=e||Zr;const n=this.Fr.persistence_name||this.Fr.token;if(this._sessionTimeoutMs=1e3*Q(this.Fr.session_idle_timeout_seconds||1800,60,36e3,Cu.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.jc(),this.qc="ph_"+n+"_window_id",this.Bc="ph_"+n+"_primary_window_exists",this.zc()){const t=yo.Ft(this.qc),i=yo.Ft(this.Bc);t&&!i?this.Be=t:yo.Dt(this.qc),yo.$t(this.Bc,!0)}(null===(s=this.Fr.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this.Fr.bootstrap.sessionID),this.Hc()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return A(this.Rc)&&(this.Rc=[]),this.Rc.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Rc=this.Rc.filter(i=>i!==t)}}zc(){return"memory"!==this.Fr.persistence&&!this.Tc.fi&&yo.Ot()}Uc(t){t!==this.Be&&(this.Be=t,this.zc()&&yo.$t(this.qc,t))}Wc(){return this.Be?this.Be:this.zc()?yo.Ft(this.qc):null}Vc(t){const i=this.Ec;return!M(i)&&!M(t)&&5e3>Math.abs(t-i)}Gc(t,i,e){const s=i!==this._sessionActivityTimestamp,n=!(t!==this.Xt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Xt=t,n&&!s||n&&this.Vc(i)||(this.Ec=i,this.Tc.register({[Hn]:[i,t,e]}))}Qc(){var t;const i=null===(t=this.Fr)||void 0===t?void 0:t.persistence_save_debounce_ms;return D(i)&&i>0}Jc(){this.Qc()?this.Tc.refreshKey(Hn):(this.Tc.flush(),this.Tc.load())}Zc(){var t;if(M(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ec)return;this.Jc();const[,i,e]=this.Kc();i===this.Xt&&e===this._sessionStartTimestamp&&(this.Ec=this._sessionActivityTimestamp,this.Tc.register({[Hn]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Tc.flush())}Yc(){const[t]=this.Kc(),i=D(t)?t:0,e=D(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Xc(t){return this.Jc(),this.Fc(t,this.Yc())}Kc(){const t=this.Tc.props[Hn];return E(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Ec=null,this.Dc=void 0,clearTimeout(this.eh),this.eh=void 0,this.Gc(null,null,null)}setBootstrapSessionId(t,i=!1){const e=((t,i=(new Date).getTime())=>{try{const e=(t=>{const i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(t);return e>i+6e4?void Cu.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Cu.error("Invalid sessionID in bootstrap",t)}})(t);return!A(e)&&(i?this.Dc={sessionId:t,sessionStartTimestamp:e}:this.Gc(t,(new Date).getTime(),e),!0)}destroy(){this.Oc=!0,this.Zc(),clearTimeout(this.eh),this.eh=void 0,this.Pc&&t&&(t.removeEventListener(Pr,this.Pc,{capture:!1}),this.Pc=void 0),this.Rc=[]}Hc(){this.Pc=()=>{this.Zc(),this.zc()&&yo.Dt(this.Bc)},Ur(t,Pr,this.Pc,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,i=null,e=!1){if("always"===this.Fr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=i||(new Date).getTime(),n=this.Xt;if(e)this.Ac=s;else if(M(this.Ac)||this.Ac>s||s-this.Ac>=1e3){var r,o;null===(r=(o=this.Tc).syncCookieProperties)||void 0===r||r.call(o),this.Ac=s}let[,l,a]=this.Kc();const u=!A(n)&&l!==n,h=this.Yc();let c=this.Wc();const d=this.Dc,v=!!d&&(d.sessionStartTimestamp>s+6e4||s-d.sessionStartTimestamp>Au),f=d?v:D(a)&&Math.abs(s-a)>Au;let p=!1,g=u,_=!l||!!d;const m=l;let y=!_&&!t&&this.Fc(s,h);if(y&&(y=this.Xc(s),y||Cu.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Kc(),y||(_=!l||!!d)),_||y||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.Lc(),c=this.Nc(),Cu.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:s,this.Dc=void 0,p=!0}else c||(c=this.Nc(),p=!0),g=g||l!==m,g&&(Cu.info("adopted cross-tab session id",{sessionId:l,windowId:c}),p=!0);const b=D(h)&&t&&!f?h:s,w=D(a)?a:(new Date).getTime();this.Uc(c),this.Gc(l,b,w),t||this.jc();const x={noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.Rc.forEach(t=>t(l,c,x)),{sessionId:l,windowId:c,sessionStartTimestamp:w,changeReason:p?x:void 0,lastActivityTimestamp:h}}jc(){this.Oc||(clearTimeout(this.eh),this.eh=setTimeout(()=>{if(!this.Oc)if(this.Xc((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Mc.emit("forcedIdleReset",{idleSessionId:t})}else this.jc()},1.1*this.sessionTimeoutMs))}};const Ou=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]),Mu=function(t,i){if(!t)return!1;const e=t.userAgent;if(e&&X(e,i))return!0;try{const e=null==t?void 0:t.userAgentData;if((null==e?void 0:e.brands)&&e.brands.some(t=>X(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function Ru(){return(Ru=J(function*(){const t=null==e?void 0:e.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return F(e)&&e.length>0?e:void 0}catch(t){return void Ls.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Iu(t,i){let e=`$survey_${i}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(e=`$survey_${i}/${t.id}/${t.current_iteration}`),e}function Du(t){var i;return!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}const ju=(t,i)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}},Lu=t=>t.toLowerCase(),Nu={exact:(t,i)=>i.some(i=>t.some(t=>i===t)),is_not:(t,i)=>i.every(i=>t.every(t=>i!==t)),regex:(t,i)=>i.some(i=>t.some(t=>ju(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!ju(i,t))),icontains:(t,i)=>i.map(Lu).some(i=>t.map(Lu).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(Lu).every(i=>t.map(Lu).every(t=>!i.includes(t))),gt:(t,i)=>i.some(i=>{const e=parseFloat(i);return!isNaN(e)&&t.some(t=>e>parseFloat(t))}),lt:(t,i)=>i.some(i=>{const e=parseFloat(i);return!isNaN(e)&&t.some(t=>e<parseFloat(t))})};function zu(t,i){return!t||Object.entries(t).every(([t,e])=>{const s=null==i?void 0:i[t];if(null==s)return!1;const n=Nu[e.operator];return!!n&&n(e.values.map(String),[String(s)])})}function Bu(t,i,e){return Al({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}const Uu="custom",Hu="i.posthog.com",qu=/^\/static\//,Wu=["/s/","/e/","/i/"];var Vu=class{constructor(t){this.ih={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let i=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace(`.${Hu}`,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.ih[this.apiHost]||(this.ih[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":Uu),this.ih[this.apiHost]}nh(t){if(!qu.test(t))return;const i=this.instance.config.asset_host;return"string"==typeof i&&i.trim().replace(/\/$/,"")||void 0}sh(t){const i=El(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}rh(t,i,e){if("ui"===t)return e;let s=e;const n=this.instance.config.rewriteRequestPath;if(n){var r;const t=(null===(r=El(e))||void 0===r?void 0:r.href)||e;s=n(new URL(t)).toString()}if(n&&"api"===t&&Wu.some(t=>0===i.indexOf(t))){const t=this.sh(s);if(t){const i=this.apiHost;let e=this.oh;(null==e?void 0:e.apiHost)===i&&e.rewriteRequestPath===n||(e={apiHost:i,rewriteRequestPath:n,urls:new Set},this.oh=e),e.urls.add(t)}}return s}isIngestionEndpoint(t){const i=this.oh,e=this.sh(t);return(null==i?void 0:i.apiHost)===this.apiHost&&i.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&i.urls.has(e)}endpointFor(t,i=""){if(i&&(i="/"===i[0]?i:`/${i}`),"ui"===t)return this.rh(t,i,this.uiHost+i);if("flags"===t)return this.rh(t,i,this.flagsApiHost+i);if("assets"===t){const e=this.nh(i);if(e)return this.rh(t,i,`${e}${i}`)}if(this.region===Uu)return this.rh(t,i,this.apiHost+i);const e=Hu+i;switch(t){case"assets":return this.rh(t,i,`https://${this.region}-assets.${e}`);case"api":return this.rh(t,i,`https://${this.region}.${e}`)}}};const Gu=Ns("[Surveys]"),Ku=t=>{try{const i=(t=>((t,i)=>`seenSurvey_${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(i)}`)(0,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){Gu.error("Failed to persist survey seen state",t)}},Ju=["popover","widget","api"],Yu={ignoreConditions:!1,ignoreDelay:!1,displayType:pa},Zu=Ns("[PostHog ExternalIntegrations]"),Xu={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var Qu=class{constructor(t){this._instance=t}Fl(t,i){var e,s;null===(e=c.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,t,t=>{if(t)return Zu.error("failed to load script",t);i()})}startIfEnabledOrStop(){var t;for(const[n,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var i,e,s;r&&!(null===(i=c.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&this.Fl(Xu[n],()=>{var t;null===(t=c.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[n])||void 0===t||t.start(this._instance)}),!r&&(null===(e=c.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[n])&&(null===(s=c.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop())}}},th=class{constructor(t){this.disabled=!1===t;const i=P(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(t-s.x)+Math.abs(i-s.y)<this.thresholdPx&&this.timeoutMs>e-s.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}};const ih=()=>typeof window>"u"?void 0:window,eh=()=>typeof document>"u"?void 0:document,sh="$copy_autocapture",nh=["password","hidden","file","checkbox","button","submit","reset","image"],rh=Ns("[AutoCapture]");function oh(t,i){return i.length>t?i.slice(0,t)+"...":i}function lh(t){if(t.previousElementSibling)return t.previousElementSibling;let i=t;do{i=i.previousSibling}while(i&&!xo(i));return i}function ah(t,{e:i,maskAllElementAttributes:e,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:r,disableCaptureUrlHashes:o}){var l,a;if(!xo(t))return{props:{}};const u=[t],h=new Set([t]);let c=t;for(;c.parentNode&&!So(c,"body")&&1e3>u.length;){if(Eo(c.parentNode)){const t=c.parentNode.host;if(h.has(t))break;h.add(t),u.push(t),c=t;continue}if(!xo(c.parentNode))break;if(h.has(c.parentNode))break;h.add(c.parentNode),u.push(c.parentNode),c=c.parentNode}const d="click"===i.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(t=>So(t,"button")||So(t,"a")):-1;d>0&&(s=s||u.slice(0,d+1).some(t=>!Zo(t)||Xo(t)));const v=[],f={};let p,g=!1,_=!1;if(Rr(u,t=>{const i=Zo(t);if(So(t,"a")&&!e&&!(null==n?void 0:n.includes("href"))){const e=t.getAttribute("href");g=!!(i&&e&&ol(e))&&(o?di(e):e)}m(Co(t),"ph-no-capture")&&(_=!0),v.push(function(t,i,e,s,n=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};Mo.indexOf(r)>-1&&!e&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?oh(1024,ll(t)):oh(1024,Fo(t)));const l=Co(t);i||(null==s?void 0:s.includes("class"))||0>=l.length||(o.classes=l.filter(function(t){return""!==t})),Rr(t.attributes,function(e){var r;if((!Xo(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&!(null==s?void 0:s.includes(e.name))&&!i&&ol(e.value)&&(!F(r=e.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=e.value;"class"===e.name&&(t=To(t).join(" ")),o["attr__"+e.name]=oh(1024,"href"===e.name&&n?di(t):t)}});let a=1,u=1,h=t;for(;h=lh(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,e,s,n,o)),Rr(function(t){if(!Zo(t))return{};const i={};return Rr(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const e=t.name.replace("data-ph-capture-attribute-",""),s=t.value;e&&s&&ol(s)&&(i[e]=s)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(f,i)||(f[i]=t)})}),_)return{props:{},explicitNoCapture:_};if(d>0&&(t=u[d],v.splice(0,d)),s||(v[0].$el_text=So(t,"a")||So(t,"button")?ll(t):Fo(t)),g){var y,b;v[0].attr__href=g;const t=null===(y=El(g))||void 0===y?void 0:y.host,i=null===(b=ih())||void 0===b||null===(b=b.location)||void 0===b?void 0:b.host;t&&i&&t!==i&&(p=g)}return{props:Ir((x=i.type,{$event_type:x,$ce_version:1}),r?{}:{$elements:v},{$elements_chain:(w=v,E(w)?function(t){return t.map(t=>{var i,e;let s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class){t.attr_class.sort();for(const i of t.attr_class)s+=`.${i.replace(/"/g,"")}`}const n=bi(bi(bi(bi({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return Dr(n).sort(([t],[i])=>function(t,i){return i>t?-1:t>i?1:0}(t,i)).forEach(([t,i])=>r[ul(t.toString())]=ul(i.toString())),s+=":",s+=Dr(r).map(([t,i])=>`${t}="${i}"`).join(""),s}).join(";")}(function(t){return t.map(t=>{var i,e;const s={text:null===(i=t.$el_text)||void 0===i?void 0:i.slice(0,400),tag_name:t.tag_name,href:null===(e=t.attr__href)||void 0===e?void 0:e.slice(0,2048),attr_class:hl(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Dr(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,i])=>s.attributes[t]=i),s})}(w)):"")},(null===(l=v[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(a=v[0])||void 0===a?void 0:a.$el_text}:{},p&&"click"===i.type?{$external_click_url:p}:{},f),target:t};var w,x}const uh="autocapture";var hh=class{al(){this.ll=void 0,clearTimeout(this.ul),this.ul=void 0}cl(t){var i;if(!Zo(t))return!0;const e=null!==(i=this.hl().css_selector_ignorelist)&&void 0!==i?i:jo,s=new Set;let n=t;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const t=n,i=Co(t);if(m(i,"ph-no-capture")||m(i,"ph-sensitive")||Xo(t)||e.some(i=>Ro(t,i)))return!0;const r=n.parentNode;n=Eo(r)?r.host:r&&xo(r)?r:null}return!1}dl(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.al();if("pointerdown"===t.type){var i;this.al();const e=Oo(t);return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&e&&xo(e)&&(this.ll={target:e,excluded:this.cl(e),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(i=this.Ma)||void 0===i?void 0:i.distinctId}))}const e=this.ll;e&&(t.pointerId!==e.id||Math.abs(t.clientX-e.x)>5||Math.abs(t.clientY-e.y)>5?this.al():"pointerup"===t.type&&(e.released=!0,this.ul=setTimeout(()=>this.al(),0)))}vl(t){var i;const e=this.ll;this.al();const s=Oo(t);if((null==e?void 0:e.released)&&e.target.isConnected&&e.distinctId===(null===(i=this.Ma)||void 0===i?void 0:i.distinctId)&&t.pointerId===e.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-e.x)&&5>=Math.abs(t.clientY-e.y)&&s&&(So(s,"html")||So(s,"body"))){var n,r,o;if(e.excluded)return null;const t=null!==(n=this.hl().css_selector_ignorelist)&&void 0!==n?n:jo;return[s,null===(r=eh())||void 0===r?void 0:r.documentElement,null===(o=eh())||void 0===o?void 0:o.body].some(i=>{if(!i)return!1;const e=Co(i);return m(e,"ph-no-capture")||m(e,"ph-sensitive")||!Zo(i)||Xo(i)||t.some(t=>Ro(i,t))})?null:e.target}}constructor(t){this.Ra=t,this.name=uh,this.fl=!1,this.pl=null,this.gl=!1,this.ml=new Map,this.yl=!1,this.Fr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Ti=!1,this.Ra.refresh(this.Fr),this.rageclicks=new th(this.Fr.rageclick),this.bl=null}setup(t){this._l(),this.Ma=t;const i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Ti?i.dispose():(this.Ua=i,this.startIfEnabled())}dispose(){var t;this.Ti||(this.Ti=!0,this.Ma=void 0,null===(t=this.Ua)||void 0===t||t.dispose(),this.Ua=void 0,this.ml.clear(),this.bl=null,this.wl())}hl(){return this.Ra.refresh(this.Fr),this.Fr}_l(){var t,i;return this.hl(),this.Fr.url_allowlist=null===(t=this.Fr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Fr.url_ignorelist=null===(i=this.Fr.url_ignorelist)||void 0===i?void 0:i.map(t=>new RegExp(t)),this.Fr}kl(){const t=ih(),i=eh();if(!this.isBrowserSupported())return void rh.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!i)return;this.Sl=t,this.xl=i;const e=this.$l=i=>{i=i||(null==t?void 0:t.event);try{if("blur"===i.type)return void this.al();if(0===i.type.indexOf("pointer"))return void this.dl(i);const t="click"===i.type?this.vl(i):void 0;if(M(t))return;this.Cl(i,"$autocapture",t)}catch(t){rh.error("Failed to capture event",t)}};if(Ur(t,"blur",e),Ur(i,"submit",e,{capture:!0}),Ur(i,"change",e,{capture:!0}),Ur(i,"click",e,{capture:!0}),Rr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Ur(i,t,e,{capture:!0})}),this.hl().capture_copied_text){const e=this.Tl=i=>{i=i||(null==t?void 0:t.event);try{this.Cl(i,sh)}catch(t){rh.error("Failed to capture clipboard event",t)}};Ur(i,"copy",e,{capture:!0}),Ur(i,"cut",e,{capture:!0}),Ur(i,"paste",e,{capture:!0})}}wl(){const t=this.Sl,i=this.xl;this.al(),this.$l&&(null==t||t.removeEventListener("blur",this.$l),Rr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==i||i.removeEventListener(t,this.$l,!0)}),null==i||i.removeEventListener("submit",this.$l,!0),null==i||i.removeEventListener("change",this.$l,!0),null==i||i.removeEventListener("click",this.$l,!0),this.$l=void 0),this.Tl&&(null==i||i.removeEventListener("copy",this.Tl,!0),null==i||i.removeEventListener("cut",this.Tl,!0),null==i||i.removeEventListener("paste",this.Tl,!0),this.Tl=void 0),this.Sl=void 0,this.xl=void 0,this.fl=!1}startIfEnabled(){this.isEnabled||this.al(),!this.Ti&&this.Ma&&this.isEnabled&&!this.fl&&(this.kl(),this.fl=!0)}onRemoteConfig(t){if(this.Ti)return;if(this.gl=!0,!t.ok)return void this.startIfEnabled();const i=t.config;i.elementsChainAsString&&(this.yl=i.elementsChainAsString);const e=i.autocapture_opt_out;var s;j(e)&&(null===(s=this.Ma)||void 0===s||s.kv.set("$autocapture_disabled_server_side",e),this.pl=e),this.startIfEnabled()}setElementSelectors(t,i=this){if(this.Ti)return;t.size?this.ml.set(i,new Set(t)):this.ml.delete(i);const e=new Set;this.ml.forEach(t=>{t.forEach(t=>e.add(t))}),this.bl=e}getElementSelectors(t,i){var e;const s=[];return null===(e=this.bl)||void 0===e||e.forEach(e=>{var n;const r=null===(n=eh())||void 0===n?void 0:n.querySelectorAll(e);null==r||r.forEach(n=>{t!==n&&i!==n||m(s,e)||s.push(e)})}),s}get isEnabled(){var t,i;if(this.Ti)return!1;const e=null===(t=this.Ma)||void 0===t?void 0:t.kv.get(un),s=this.pl,n=this.hl();if(!n.remoteRequestsDisabled&&!this.gl)return!1;const r=n.remoteRequestsDisabled&&!this.gl;if(M(s)&&!j(e)&&!r)return!1;const o=null!==(i=this.pl)&&void 0!==i?i:!!e;return!!n.enabled&&!o}Cl(t,i="$autocapture",e){if(!this.isEnabled)return void this.al();let s=e||Oo(t);ko(s)&&(s=s.parentNode||null);const n=this._l();var r;"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&(null===(r=this.rageclicks)||void 0===r?void 0:r.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime()))&&Ko(s,n.rageclick)&&this.Cl(t,"$rageclick",e);const o=i===sh,l=o?bi(bi({},n),{},{dom_event_allowlist:void 0}):n;if(s&&function(t,i,e,s,n,r){var o;const l=typeof window>"u"?void 0:window;if(!l||Jo(t))return!1;if((null==e?void 0:e.url_allowlist)&&!Po(e.url_allowlist,r))return!1;if((null==e?void 0:e.url_ignorelist)&&Po(e.url_ignorelist,r))return!1;if(null==e?void 0:e.dom_event_allowlist){const t=e.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:a,targetElementList:u}=Yo(t,s);if(!function(t,i){const e=null==i?void 0:i.element_allowlist;if(A(e))return!0;for(const i of t)if(e.some(t=>i.tagName.toLowerCase()===t))return!0;return!1}(u,e))return!1;if(!Io(u,null==e?void 0:e.css_selector_allowlist))return!1;if(Io(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:jo))return!1;try{const e=l.getComputedStyle(t);if(e&&"pointer"===e.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const h=t.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return a?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(Mo.indexOf(h)>-1||"true"===t.getAttribute("contenteditable"))}}(s,t,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var a;const{props:e,explicitNoCapture:r,target:o}=ah(s,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.yl,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(r)return!1;const l=this.getElementSelectors(s,o);if(l&&l.length>0&&(e.$element_selectors=l),i===sh){const i=t.type||"clipboard";if("paste"!==i){var u,h;const t=null===(u=ih())||void 0===u||null===(u=u.getSelection())||void 0===u?void 0:u.toString(),i=Ao(t);if(!i)return!1;e.$selected_content=i,e.$clipboard_text_length=null!==(h=null==t?void 0:t.length)&&void 0!==h?h:0}e.$copy_type=i}if("$autocapture"===i&&"change"===t.type&&n.capture_value_css_selector_allowlist&&!n.maskAllText&&(So(c=s,"input")?!m(nh,c.type):So(c,"textarea")||So(c,"select")&&!c.multiple)&&function(t,i){var e;if(!Zo(t))return!1;const s=null!==(e=i.css_selector_ignorelist)&&void 0!==e?e:jo,n=new Set;let r=t;for(So(t,"select")&&(r=t.options[t.selectedIndex]||t);r;){const t=r,i=Co(t);if(n.size>=1e3||n.has(r)||m(i,"ph-sensitive")||m(i,"ph-no-capture")||s.some(i=>Ro(t,i)))return!1;n.add(r);const e=r.assignedSlot||r.parentNode;r=Eo(e)?e.host:e&&xo(e)?e:null}return!0}(s,n)&&!s.querySelector(".ph-no-capture, .ph-sensitive")){const t=n.capture_value_css_selector_allowlist;let i=!1;try{i=T(t)?!!t(s):E(t)&&t.some(t=>Ro(s,t))}catch(t){rh.error("capture_value_css_selector_allowlist threw",t)}i&&(e.$input_value=s.value)}return null===(a=this.Ma)||void 0===a||a.capture(i,e),!0}var c}isBrowserSupported(){var t;return T(null===(t=eh())||void 0===t?void 0:t.querySelectorAll)}};const ch="featureFlags",dh="logs",vh=()=>{var i;return(null==t||null===(i=t.performance)||void 0===i?void 0:i.now)?t.performance.now():Date.now()};var fh=class{constructor(t){this._instance=t}initialize(){}get(t){const i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);const e={};for(const s of t){const t=null==i?void 0:i.get_property(s);A(t)||(e[s]=t)}return e}set(t,i){var e;null===(e=this._instance.persistence)||void 0===e||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null===(i=this._instance.persistence)||void 0===i||i.unregister(t)}},ph=class{constructor(t){this.instance=t,this.R=Ls,this.kv=new fh(t),this.onSession=t=>ga(this.instance.onSessionId(i=>{try{t(i)}catch(t){this.R.error("Browser extension session listener failed",t)}})),this.onEvent=t=>ga(this.instance._addCaptureHook((i,e)=>{if(e)try{t({event:i,properties:e.properties})}catch(t){this.R.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{const i=i=>{try{t(i)}catch(t){this.R.error("Browser extension remote config listener failed",t)}},e=this.instance.dr.on("extensionsRemoteConfig",i);return this.instance.vr&&i(this.instance.vr),ga(e)}}get logger(){return this.R}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property("$device_id"))&&void 0!==t?t:this.distinctId}get deviceId(){const t=this.instance.get_property(mn);return"string"==typeof t?t:void 0}get library(){return{name:Ws.LIB_NAME,version:Ws.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,s,n;const r=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==r?void 0:r.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==r?void 0:r.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(s=null==r?void 0:r.sessionStartTimestamp)&&void 0!==s?s:0,lastActivityTimestamp:null!==(n=null==r?void 0:r.lastActivityTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return T(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get isRateLimited(){var t;return!!(null===(t=this.instance.rateLimiter)||void 0===t?void 0:t.isClientRateLimited)}get projectToken(){return this.instance.config.token}getExtension(t){let i;switch(t){case ch:case"featureFlagsCommon":i=this.instance.featureFlags;break;case dh:i=this.instance.logs;break;case"surveys":i=this.instance.surveys;break;case uh:i=this.instance.autocapture}return i}capture(t,i,e){if(!e)return this.pr(this.instance.capture(t,i));const s=bi({timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce},"unload"===e.delivery?{transport:"sendBeacon",send_instantly:!0}:{});return this.pr(this.instance.capture(t,i,s))}pr(t){var i;return!A(t)||!(null===(i=this.instance.rateLimiter)||void 0===i?void 0:i.lastEventRateLimited)}registerDynamicEventProperties(t){return ga(this.instance.mr(t))}sendRequest(t){var i=this;return J(function*(t,e={}){var s;const n=null!==(s=e.target)&&void 0!==s?s:"api",r=e.query?ou(t,e.query):t,o=i.instance.requestRouter.endpointFor(n,r),l={method:e.method,url:o,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?p.Base64:void 0,timestampMode:e.sentAt};return"api"===n&&"/i/v1/logs"===t&&(l.batchKey="logs"),"sendBeacon"===e.transport?(i.instance._send_request(l),{statusCode:202}):new Promise(t=>{var e;if(l.callback=t,"flags"===n&&(null===(e=i.instance.config.metrics)||void 0===e?void 0:e.flags)){let e;l.onDispatch=()=>{e=vh()},l.callback=s=>{A(e)||i.gr(o,s,vh()-e),t(s)}}i.instance._send_request(l)})}).apply(this,arguments)}gr(t,i,e){try{var s,n,r;const o=i.statusCode||void 0,l={"server.address":(null!==(s=null===(n=El(t))||void 0===n?void 0:n.hostname)&&void 0!==s?s:t).replace(/^\[(.*)\]$/,"$1")};o&&(l["http.response.status_code"]=o);const a=((t,i)=>t?400>t?void 0:String(t):"AbortError"===(null==i?void 0:i.name)?"timeout":"_OTHER")(o,i.error);a&&(l["error.type"]=a);const u=kl();u&&(l["client.timezone"]=u),null===(r=this.instance.metrics)||void 0===r||r.histogram("posthog.flags.request.duration",e,{unit:"ms",attributes:l})}catch(t){Ls.error("Failed to record the /flags request duration",t)}}};const gh={};let _h=0;const mh=()=>{},yh='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',bh="Surveys module not available",wh="sanitize_properties is deprecated. Use before_send instead",$h="Invalid value for property_denylist config: ",xh=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],Sh=["$feature_flag_called","$$heatmap","$snapshot"],kh=t=>"$"===t.charAt(0)&&!m(Sh,t),Eh=/^[A-Za-z0-9_-]{1,400}$/,Th=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Ph=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Ch=["token","distinct_id",dr],Ah="posthog",Fh=[...Ou].sort()[Ou.length-1],Oh=t=>{const i={};return t&&"unset"!==t?("2025-11-30">t||(i.strictMinimumDuration=!0),"2026-05-30">t||(i.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(i.streamNetworkBody=!0),"2026-08-30">t||(i.captureJsonLd=!0),i):i},Mh=i=>{var e;return bi({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Br(null==s?void 0:s.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:mh,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",__preview_deferred_init_extensions:!1,__preview_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:n&&F(null==n?void 0:n.search)&&-1!==n.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null===(e=t.location)||void 0===e?void 0:e.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(t){Ls.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Tr,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:mh},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:No,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Oh(t),external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t),disable_capture_url_hashes:!(!t||"2026-06-25">t),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(i))},Rh=[["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"]],Ih=t=>{const i={};for(const[e,s]of Rh)A(t[e])||(i[s]=t[e]);const e=Ir({},i,t),s=t.__preview_external_dependency_versioned_paths;return A(s)||(A(t.strict_script_versioning)&&(e.strict_script_versioning=!!s),F(s)&&A(t.asset_host)&&(e.asset_host=s)),E(t.property_blacklist)&&(A(t.property_denylist)?e.property_denylist=t.property_blacklist:E(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ls.error($h+t.property_denylist)),e};var Dh=class{constructor(){this.__forceAllowLocalhost=!1}get ah(){return this.__forceAllowLocalhost}set ah(t){Ls.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},jh=class i{uh(t){if(!t)return;const i=this.hh.indexOf(t);-1!==i&&this.hh.splice(i,1)}dh(t,i){var e;return this.uh(t),this.hh.push(i),null===(e=i.initialize)||void 0===e||e.call(i),i}fh(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}ph(){if(this.gh)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.fh())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.mh)return;let i,e,s;t?(i=`persistence is set to '${this.config.persistence}'`,e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",s="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(i="persistence is disabled (disable_persistence is true)",e="on every page load",s="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.gh=!0,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${e}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${s}`)}yh(){const t=this.persistence;if(!t||this.bh)return;if(this.fh())return void("on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this._h(),this.wh()));if("$posthog_cookieless"!==this.get_distinct_id())return;this.kh()||t.load(!0);const i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){const i=this.config.get_device_id(Zr());this.register({distinct_id:i,$device_id:i}),t.set_property(nr,kr)}this._h()}get decideEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.Sh=!1,this.xh=!1,this.webPerformance=new Dh,this.$h=!1,this.version=Ws.LIB_VERSION,this.Ch=new Set,this.Th="",this.dr=new Pu,this.hh=[],this.Ih=[],this.Mh=!1,this.mh=!1,this.gh=!1,this.bh=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Mh(),this.SentryIntegration=yl,this.sentryIntegration=t=>function(t,i){const e=ml(t,i);return{name:_l,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Eh=!1,this.Ah=null,this.Rh=null,this.Ph=null,this.scrollManager=new ku(this),this.pageViewManager=new bl(this),this.rateLimiter=new ma(this),this.requestRouter=new Vu(this),this.consent=new bo(this),this.externalIntegrations=new Qu(this);const e=null!==(t=i.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.metrics=e.metrics&&new e.metrics(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,i,e)=>{const s=F(t)?{[t]:i}:t;this.setPersonProperties(s),null==e||e({})},set_once:(t,i,e)=>{const s=F(t)?{[t]:i}:t;this.setPersonProperties(void 0,s),null==e||e({})}},this.on("eventCaptured",t=>Ls.info(`send "${null==t?void 0:t.event}"`,t))}init(t,e,s){if(s&&s!==Ah){var n;const r=null!==(n=gh[s])&&void 0!==n?n:new i;return r._init(t,e,s),gh[s]=r,gh[Ah][s]=r,r}return this._init(t,e,s)}_init(i,e={},s){var n,r,o;const l=F(i)?i.trim():"";if(!l)return Ls.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var a;if(this.__loaded)return l!==(null===(a=this.config)||void 0===a?void 0:a.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${l}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Mh(e.defaults),e.debug=this.Oh(e.debug),this.Fh=e,this.Dh=[],e.person_profiles?this.Rh=e.person_profiles:e.process_person&&(this.Rh=e.process_person);const u=Mh(e.defaults),h=Ih(e),c=Ir({},u,h,{name:s,token:l});P(u.rageclick)&&P(h.rageclick)&&(c.rageclick=Ir({},u.rageclick,h.rageclick)),P(u.session_recording)&&P(h.session_recording)&&(c.session_recording=Ir({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&Ls.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:la;const d=this.kh(),v=!this.fh();if(this.persistence=new oa(this.config,d,!0,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new oa(bi(bi({},this.config),{},{persistence:"sessionStorage"}),d,!1,v),this.Th="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&yo.Ot()){const t=yo.Ft(this.Th);E(t)&&t.forEach(t=>{F(t)&&this.Ch.add(t)})}else yo.Dt(this.Th);const f=bi({},this.persistence.props),p=bi({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Lh=new $u((t,i)=>this.Nh(t,i),this.config.request_queue_config),this.jh=new Su(this),this.__request_queue=[];const g=this.fh();g||(this.sessionManager=new Fu(this),this.sessionPropsManager=new Tu(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,i,e)=>{((null==e?void 0:e.activityTimeout)||(null==e?void 0:e.sessionPastMaximumLength)||(null==e?void 0:e.crossTabAdoption))&&this.qh()})),this.Bh(),this.config.__preview_deferred_init_extensions?(Ls.info("Deferring extension initialization to improve startup performance"),this.zh=setTimeout(()=>{this.zh=void 0,this.Hh(g)},0)):(Ls.info("Initializing extensions synchronously"),this.Hh(g)),Ws.DEBUG=Ws.DEBUG||this.config.debug,Ws.DEBUG&&Ls.info("Starting in debug mode",{this:this,config:e,thisC:bi({},this.config),p:f,s:p}),this.config.identity_distinct_id&&!(null===(n=e.bootstrap)||void 0===n?void 0:n.distinctID)&&(e.bootstrap=bi(bi({},e.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const _=null===(r=e.bootstrap)||void 0===r?void 0:r.distinctID;if(this.mh=!!_&&!O(_),null===(o=e.bootstrap)||void 0===o?void 0:o.distinctID){const t=e.bootstrap.distinctID,i=this.get_distinct_id(),s=this.persistence.get_property(nr);if(e.bootstrap.isIdentifiedID&&null!=i&&i!==t&&"anonymous"===s)this.identify(t);else if(e.bootstrap.isIdentifiedID&&null!=i&&i!==t&&"identified"===s)Ls.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 i=this.config.get_device_id(Zr()),s=e.bootstrap.isIdentifiedID?i:t;this.persistence.set_property(nr,e.bootstrap.isIdentifiedID?Er:kr),this.register({distinct_id:t,$device_id:s})}}if(g)this.register_once({distinct_id:cr,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(Zr());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(nr,kr)}return Ur(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Ur(t,"pageshow",t=>{if(this.Sh=!1,!this.xh){var i;if(t.persisted&&this.persistence){const t=this.persistence.get_property(_n),i=this.persistence.get_property(nr);this.persistence.load(),this.Uh()||t===this.persistence.get_property("distinct_id")&&i===this.persistence.get_property("$user_state")||this.Wh()}null===(i=this.jh)||void 0===i||i.resume()}}),e.segment?gl(this,()=>this.Vh()):this.Vh(),T(this.config._onCapture)&&this.config._onCapture!==mh&&(Ls.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Ls.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 Ru.apply(this,arguments)}().then(t=>{t&&this.register({[yn]:t})}).catch(mh),this}Gh(t){const i=t;return F(i.name)&&T(i.setup)}Qh(t,i){var e=this;this.Gh(t)?i.push(J(function*(){try{yield t.setup(e.Jh())}catch(e){Ls.error(`Failed to set up extension "${t.name}"`,e);try{var i;yield null===(i=t.dispose)||void 0===i?void 0:i.call(t)}catch(i){Ls.error(`Failed to dispose extension "${t.name}"`,i)}}})):this.hh.push(t)}Bh(){var t,e,s,n=this;const r=null!==(t=null===(e=this.config.__extensionClasses)||void 0===e?void 0:e.featureFlags)&&void 0!==t?t:null===(s=i.__defaultExtensionClasses)||void 0===s?void 0:s.featureFlags;var o,l,a;if(r)if(this.featureFlags&&this.featureFlags instanceof r||(null===(o=this.Zh)||void 0===o||o.call(this),this.Zh=void 0,this.featureFlags=new r(this)),T(this.featureFlags.onReloading)&&T(this.featureFlags.setup)){if(!this.Zh){this.Zh=this.featureFlags.onReloading(()=>{this.dr.emit("featureFlagsReloading",!0)});const t=this.featureFlags;J(function*(){try{yield t.setup(n.Jh())}catch(i){Ls.error("Failed to set up feature flags",i);const e=n.Zh;n.Zh=void 0;try{null==e||e()}catch(t){Ls.error("Failed to unsubscribe feature flag reloading",t)}try{yield t.dispose()}catch(t){Ls.error("Failed to dispose feature flags",t)}}})()}}else null===(l=(a=this.featureFlags).initialize)||void 0===l||l.call(a)}Hh(t){const e=performance.now(),s=bi(bi({},i.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,l,a,u,h,c,d;s.exceptions&&this.hh.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this.hh.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.hh.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.hh.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!t&&this.hh.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.Qh(this.autocapture=new s.autocapture(this),n),s.surveys&&this.Qh(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this.Qh(this.logs=null!==(l=this.logs)&&void 0!==l?l:new s.logs(this),n),s.metrics&&this.hh.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new s.metrics(this)),s.conversations&&this.hh.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new s.conversations(this)),s.productTours&&this.hh.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.hh.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.hh.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.hh.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.hh.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,vl)),s.toolbar&&this.hh.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new s.toolbar(this)),s.experiments&&this.hh.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new s.experiments(this)),s.webMCP&&this.hh.push(this.webMCP=null!==(d=this.webMCP)&&void 0!==d?d:new s.webMCP(this)),this.hh.forEach(t=>{t.initialize&&n.push(()=>{var i;null===(i=t.initialize)||void 0===i||i.call(t)})}),n.push(()=>{if(this.Kh){const t=this.Kh;this.Kh=void 0,this.hh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}}),this.Yh(n,e)}Yh(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void(this.zh=setTimeout(()=>{this.zh=void 0,this.Yh(t,i)},0));const e=t.shift();if(e)try{e()}catch(t){Ls.error("Error initializing extension:",t)}}const e=Math.round(performance.now()-i);this.register_for_session({[vr]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[fr]:e}),this.config.__preview_deferred_init_extensions&&Ls.info(`PostHog extensions initialized (${e}ms)`)}tc(t){if(!s||!s.body)return Ls.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.tc(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Kh=t),this.vr=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=m(e.supportedCompression,la)?la:m(e.supportedCompression,aa)?aa:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.Rh?this.Rh:Tr}),this.dr.emit("extensionsRemoteConfig",t),this.hh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}Vh(){try{this.config.loaded(this)}catch(t){Ls.critical("`loaded` function failed",t)}if(this.Xh(),this.config.internal_or_test_user_hostname&&(null==n?void 0:n.hostname)){const t=n.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.fh())&&this.ed()},1),this.nd=new ba(this),this.nd.load()}Xh(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Lh)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Mr(this.__request_queue,t=>this.Nh(t)),this.__request_queue=[],this.Xh()}_handle_unload(){var t,i,e,s,n,r;this.Sh=!0,null===(t=this.surveys)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t),null===(e=this.metrics)||void 0===e||e.flush("sendBeacon"),this.config.request_batching?(this.sd()&&this.capture(Ar),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this.Lh)||void 0===n||n.unload(),null===(r=this.jh)||void 0===r||r.unload()):this.sd()&&this.capture(Ar,null,{transport:"sendBeacon"})}_send_request(t){wu(this,t)}Nh(t,i){this.jh?this.jh.retriableRequest(t,i):this._send_request(i?bi(bi({},t),{},{transport:i}):t)}_execute_array(t){_h++;try{let i;const e=[],s=[],n=[];Mr(t,t=>{if(t)if(i=t[0],E(i))n.push(t);else if(T(t))try{t.call(this)}catch(i){Ls.error("Error executing queued PostHog call",t,i)}else E(t)&&"alias"===i?e.push(t):E(t)&&-1!==i.indexOf("capture")&&T(this[i])?n.push(t):s.push(t)});const r=function(t,i){Mr(t,function(t){try{if(E(t[0])){let e=i;Rr(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){Ls.error("Error executing queued PostHog call",t,i)}})};r(e,this),r(s,this),r(n,this)}finally{_h--}}push(t){if(_h>0&&E(t)&&F(t[0])){const e=i.prototype[t[0]];return void(T(e)&&e.apply(this,t.slice(1)))}this._execute_array([t])}get rd(){return{property:$n,persistenceKey:xn,cookieName:"_fbc",pattern:Th,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[xn]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(xn)}}}get od(){return{property:Sn,persistenceKey:kn,cookieName:"_fbp",pattern:Ph,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[kn]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(kn)}}}ad(t){var i;const e=null===(i=this.persistence)||void 0===i?void 0:i.get_property(t.persistenceKey);return F(e)&&t.pattern.test(e)?{value:e,delivered:!1}:P(e)&&F(e.value)&&t.pattern.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}ld(t,i,e){return i===(null==e?void 0:e.value)?{value:i,pending:!e.delivered}:(t.register(i,!1),{value:i,pending:!0})}ud(t){if(!this.config.save_campaign_params||this.fh())return;const i=qr(t.cookieName);return F(i)&&t.pattern.test(i)?i:void 0}hd(t,i,e,s){if(!this.persistence)return;const n=this.rd;this.persistence.refreshMetaIdentifiers();const r=this.ad(n);if(s)return void n.unregister();if(e)return F(i)&&Th.test(i)?this.ld(n,i,r):void n.unregister();const o=F(t)&&Eh.test(t)?t:void 0,l=this.ud(n);return l&&((t,i,e)=>{const s=t.split(".");if(i)return s[3]===i;if(!e)return!0;const n=e.value.split(".");return s[3]===n[3]||Number(s[2])>Number(n[2])})(l,o,r)?this.ld(n,l,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.ld(n,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}dd(t,i,e){if(!this.persistence)return;const s=this.od;this.persistence.refreshMetaIdentifiers();const n=this.ad(s);if(e)return void s.unregister();if(i)return F(t)&&Ph.test(t)?this.ld(s,t,n):void s.unregister();const r=this.ud(s);return r?this.ld(s,r,n):n?{value:n.value,pending:!n.delivered}:void 0}vd(t,i){if(!this.persistence)return;this.persistence.refreshMetaIdentifiers();const e=this.ad(t);(null==e?void 0:e.value)!==i||e.delivered||t.register(i,!0)}capture(t,i,e){var s,n,r;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Lh))return void Ls.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void Ls.info(`Event "${t}" was not captured because capturing is disabled (opted out or consent pending).`);if(A(t)||!F(t))return void Ls.error("No event name provided to posthog.capture");if(this.yh(),"$snapshot"===t&&this.fh())return;const o=!this.config.opt_out_useragent_filter&&this._is_bot();if(o&&!this.config.__preview_capture_bot_pageviews)return void Ls.info(`Event "${t}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);const l=(null==e?void 0:e.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==l?void 0:l.isRateLimited)return void Ls.critical("This capture call is ignored due to client rate limiting.");let a;(null==i?void 0:i.$current_url)&&!F(null==i?void 0:i.$current_url)&&(Ls.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||(null==e?void 0:e.fd)||Ls.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&&(a=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 u=new Date,h=(null==e?void 0:e.timestamp)||u,c=hi(null==e?void 0:e.uuid,Zr);let d={uuid:c,event:t,properties:this.calculateEventProperties(t,i||{},h,c)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&o&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),l&&(d.properties.$lib_rate_limit_remaining_tokens=l.remainingTokens);const v="$feature_flag_called"===t&&!1===d.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==e?void 0:e.$set)&&!v&&(d.$set=null==e?void 0:e.$set);const f=P(null==i?void 0:i.$set)?i.$set:void 0,p=E(null==i?void 0:i.$unset)?i.$unset:[],g=(null==e?void 0:e.$unset)||[],_=t=>{var i;const s=!!(null==e?void 0:e.$set)&&t in e.$set;return{hasProvided:s||!!f&&t in f,provided:s?null==e||null===(i=e.$set)||void 0===i?void 0:i[t]:null==f?void 0:f[t],unset:-1!==p.indexOf(t)||-1!==g.indexOf(t)}},m=_($n),y=_(Sn),b=[{channel:this.rd,hasProvided:m.hasProvided,update:this.hd(null==a?void 0:a.fbclid,m.provided,m.hasProvided,m.unset)},{channel:this.od,hasProvided:y.hasProvided,update:this.dd(y.provided,y.hasProvided,y.unset)}];for(const{channel:t,hasProvided:i,update:e}of b)e&&!0===d.properties.$process_person_profile&&e.pending&&!i&&!v&&(d.$set=bi({[t.property]:e.value},d.$set));const w=null==e?void 0:e.$unset;w&&(d.$unset=w);const x=v?void 0:this.pd(null==e?void 0:e.$set_once,t!==Or,t===Fr);if(x&&(d.$set_once=x),(null==e?void 0:e._noTruncate)||(S=this.config.properties_string_max_length,d=function(t,i){const e=new Set;return function t(s,n){if(s!==Object(s))return i?i(s):s;if(e.has(s))return;let r;if(e.add(s),E(s))r=[],Mr(s,i=>{r.push(t(i))});else{const i={};Rr(U(s)?Nr(s):s,(s,n)=>{e.has(s)||(i[n]=t(s,n))}),r=i}return r}(t)}(d,t=>F(t)?t.slice(0,S):t)),d.timestamp=h,A(null==e?void 0:e.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=u),v&&(d.properties=((t,i=[])=>{const e={},s=i=>{void 0!==t[i]&&(e[i]=t[i])};return pe.forEach(s),i.forEach(s),e})(d.properties,Ch)),t===da||t===va){const e=null==i?void 0:i.$survey_id,s=null==i?void 0:i.$survey_iteration;Ku({id:e,current_iteration:s}),d.$set=bi(bi({},d.$set),{},{[Iu({id:e,current_iteration:s},t===va?"responded":"dismissed")]:!0})}else t===ca&&(d.$set=bi(bi({},d.$set),{},{[fa]:(new Date).toISOString()}));var S;if("product tour shown"===t){const t=null==i?void 0:i.$product_tour_type;t&&(d.$set=bi(bi({},d.$set),{},{[`$product_tour_last_seen_date/${t}`]:(new Date).toISOString()}))}const k=bi(bi({},d.properties.$set),d.$set);if(C(k)||this.setPersonPropertiesForFlags(k),!R(this.config.before_send)){const t=this.Fs(d);if(!t)return;d=t,d.uuid=hi(d.uuid,Zr)}this.sessionRecording&&!this.Mh&&kh(t)&&(this.Mh=!0,setTimeout(()=>this.Mh=!1,3e4));const T=b.filter(({channel:t,update:i})=>{var e,s,n;const r=null!==(e=null===(s=d.$set)||void 0===s?void 0:s[t.property])&&void 0!==e?e:P(null===(n=d.properties)||void 0===n?void 0:n.$set)?d.properties.$set[t.property]:void 0;return(null==i?void 0:i.pending)&&r===i.value});this.dr.emit("eventCaptured",d);const O=null!==(s=null==e?void 0:e._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),M="recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(O),I=bi(bi(bi({method:"POST",url:O,data:d,compression:"best-available",preferSyncCompression:null==e?void 0:e.send_instantly,timestampMode:M?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},M&&(null===(n=d.properties)||void 0===n?void 0:n.$session_id)?{batchGroup:d.properties.$session_id+(d.properties.$window_id?`-${d.properties.$window_id}`:"")}:{}),(null==e?void 0:e.transport)?{transport:e.transport}:{}),T.length?{fireCallbackOnDrop:!0,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(const{channel:t,update:i}of T)this.vd(t,i.value)}}:{});if(!this.config.request_batching||e&&!(null==e?void 0:e._batchKey)||(null==e?void 0:e.send_instantly)){var D;let t;!I.transport&&!I.callback&&C(null!==(D=this.config.request_headers)&&void 0!==D?D:{})&&this.Sh&&(t="sendBeacon"),this.Nh(I,t)}else this.Lh.enqueue(I);return null===(r=this.featureFlags)||void 0===r||r.sendFlagCallsPendingCapture(),d}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null===(i=this.gd)||void 0===i?void 0:i.getExtension(t)}Jh(){var t;return null!==(t=this.gd)&&void 0!==t?t:this.gd=new ph(this)}mr(t){this.Ih.push(t);let i=!0;return()=>{if(!i)return;i=!1;const e=this.Ih.indexOf(t);-1!==e&&this.Ih.splice(e,1)}}Uh(t=!0){var i;return!!(null===(i=this.persistence)||void 0===i?void 0:i.consumeCookieIdentityChange())&&(this.Wh(t),!0)}Wh(t=!0){var i,e,s;this.Ph=null,"anonymous"===(null===(i=this.persistence)||void 0===i?void 0:i.get_property("$user_state"))&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this.Ch.clear(),this.md()),null===(e=this.featureFlags)||void 0===e||e.reset(),t&&this.reloadFeatureFlags()}calculateEventProperties(i,e,r,o,l){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;this.yh(),this.persistence.syncCookieProperties(),this.Uh();const a=l?void 0:this.persistence.remove_event_timer(i);let h=bi({},e);if(h.token=this.config.token,h.$config_defaults="latest"===this.config.defaults?Fh:this.config.defaults,this.fh()&&(h[dr]=!0),"$snapshot"===i){const t=bi(bi({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=t.distinct_id,(!F(h.distinct_id)&&!I(h.distinct_id)||O(h.distinct_id))&&Ls.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const c=function(i,e,s,r=!1){var o,l,a,h;if(!u)return{};const c=i?[...Rl,...e||[]]:[],[d,f]=Xt(u),[p,g]=function(t){for(let i=0;ei.length>i;i++){const[e,s,n]=ei[i],r=t.match(e);if(r){const i=n&&t.match(n)||r;return[s,(null==i?void 0:i[1])||""]}}return["",""]}(u),_=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),m={};A(s)||(m.detectGoogleSearchApp=s);const y={},b=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,w=null===(l=navigator)||void 0===l?void 0:l.maxTouchPoints,x=null==t||null===(a=t.screen)||void 0===a?void 0:a.width,S=null==t||null===(h=t.screen)||void 0===h?void 0:h.height,k=null==t?void 0:t.devicePixelRatio;A(b)||(y.userAgentDataPlatform=b),A(w)||(y.maxTouchPoints=w),A(x)||(y.screenWidth=x),A(S)||(y.screenHeight=S),A(k)||(y.devicePixelRatio=k);const E=Ir(Lr({$os:d,$os_version:f,$browser:Kt(u,navigator.vendor,_,m),$webview_app:p,$webview_app_version:g,$device:Qt(u),$device_type:ti(u,y),$timezone:kl(),$timezone_offset:Gl()}),{$current_url:Ol(r?di(null==n?void 0:n.href):null==n?void 0:n.href,c,Dl),$host:null==n?void 0:n.host,$pathname:null==n?void 0:n.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Yt(u,navigator.vendor,_,m),$browser_language:Bl(),$browser_language_prefix:Ul(),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(E.$sdk_dist_channel=v.SDK_DIST_CHANNEL),E}(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:t,windowId:i}=this.sessionManager.checkAndGetSessionAndWindowId(l,r.getTime(),!0);h.$session_id=t,h.$window_id=i}this.sessionPropsManager&&Ir(h,this.sessionPropsManager.getSessionProps());try{var d;if(this.sessionRecording){const t=this.sessionRecording.sdkDebugProperties,e=!this.Mh&&kh(i);for(const i in t)(e||m(xh,i))&&(h[i]=t[i])}h.$sdk_debug_retry_queue_size=null===(d=this.jh)||void 0===d?void 0:d.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}let f;if(this.requestRouter.region===Uu&&(h.$lib_custom_api_host=this.config.api_host),f="$pageview"!==i||l?"$pageleave"!==i||l?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),h=Ir(h,f),"$pageview"===i&&s&&(h.title=s.title),!A(a)){const t=r.getTime()-a;h.$duration=parseFloat((t/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const p=this.persistence.properties(),g=this.sessionPersistence.properties(),_=h.$groups,y=p.$groups;P(_)&&!C(_)&&(h.$groups=bi(bi({},P(y)?y:{}),_)),Rr(["$referrer","$referring_domain"],t=>{t in p&&delete g[t]});const b={};if(this.Ih.length>0)for(const t of this.Ih.slice())try{Ir(b,t())}catch(t){Ls.error("Failed to produce browser extension event properties",t)}h=Ir({},c,p,g,bi(bi({},b),h)),h.$is_identified=this._isIdentified(),E(this.config.property_denylist)?Rr(this.config.property_denylist,function(t){delete h[t]}):Ls.error($h+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const w=this.config.sanitize_properties;w&&(Ls.error(wh),h=w(h,i));const x=this.yd();return h.$process_person_profile=x,x&&!l&&this.bd("_calculate_event_properties"),h}pd(t,i=!0,e=!1){var s;if(!this.persistence||!this.yd())return t;if(this.$h&&!e)return t;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=Ir({},n,r||{},t||{});const l=this.config.sanitize_properties;return l&&(Ls.error(wh),o=l(o,"$set_once")),i&&(this.$h=!0),C(o)?void 0:o}register(t,i){var e;null===(e=this.persistence)||void 0===e||e.register(t,i)}register_once(t,i,e){var s;null===(s=this.persistence)||void 0===s||s.register_once(t,i,e)}register_for_session(t){var i,e;null===(i=this.persistence)||void 0===i||i.syncCookieProperties(),this.Uh(),null===(e=this.sessionPersistence)||void 0===e||e.register(t),Object.keys(t).forEach(t=>this.Ch.add(t)),this.md()}unregister(t){var i;null===(i=this.persistence)||void 0===i||i.unregister(t)}unregister_for_session(t){var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t),this.Ch.delete(t),this.md()}_d(t,i){this.register({[t]:i})}qh(){this.Ch.forEach(t=>{var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t)}),this.Ch.clear(),this.md()}md(){var t;if(!this.Th)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.fi)||!yo.Ot())return void yo.Dt(this.Th);const i=[];this.Ch.forEach(t=>i.push(t)),i.length>0?yo.$t(this.Th,i):yo.Dt(this.Th)}getFeatureFlag(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,s;return null!==(e=null===(s=this.featureFlags)||void 0===s?void 0:s.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i=!1,e){var s;return null===(s=this.featureFlags)||void 0===s?void 0:s.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.dr.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:bh}),()=>{})}onSessionId(t){var i,e;return null!==(i=null===(e=this.sessionManager)||void 0===e?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i=!1){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:bh})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:bh})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:bh}),()=>{})}renderSurvey(t,i){var e;null===(e=this.surveys)||void 0===e||e.renderSurvey(t,i)}displaySurvey(t,i=Yu){var e;null===(e=this.surveys)||void 0===e||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null===(i=this.surveys)||void 0===i||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null===(e=this.surveys)||void 0===e?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:bh}}canRenderSurveyAsync(t,i=!1){var e,s;return null!==(e=null===(s=this.surveys)||void 0===s?void 0:s.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:bh})}wd(t){return!t||O(t)?(Ls.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Ls.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())||(Ls.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,i,e){if(!this.__loaded||!this.persistence)return Ls.uninitializedWarning("posthog.identify");if(I(t)&&(t=t.toString(),Ls.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wd(t))return;if(!this.bd("posthog.identify"))return;this.yh();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this.Uh(!1),o=this.persistence.Iu();let l=!1;try{const s=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),t!==s&&t!==this.get_property("__alias")&&(this.unregister(bn),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===kr,u=t!==s,h=!u&&o;if(u&&o){var a;const n=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:s};this.persistence.set_property(nr,Er),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Mu(),this.capture("$identify",n,{$set:i||{},$set_once:e||{}})&&(this.Ph=Bu(t,i,e)),null===(a=this.featureFlags)||void 0===a||a.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(h){this.persistence.set_property(nr,Er);const s=i||{},n=e||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence.Mu(),this.capture("$set",{$set:s,$set_once:n})&&(this.Ph=Bu(t,i,e))}else(i||e)&&this.setPersonProperties(i,e);u||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(sn)):h&&(i||e)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Ru(l)}}setPersonProperties(t,i){if(!t&&!i)return;if(!this.bd("posthog.setPersonProperties"))return;const e=Bu(this.get_distinct_id(),t,i);this.Ph!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this.Ph=e)):Ls.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;const e=(E(t)?t:[t]).filter(t=>F(t)&&t.length>0);0!==e.length&&this.bd("posthog.unsetPersonProperties")&&(null===(i=this.featureFlags)||void 0===i||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Ph=null)}group(t,i,e){var s;if(!t||!i)return void Ls.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.Uh();const n=this.getGroups(),r=n[t]!==i;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:bi(bi({},n),{},{[t]:i})}),(r||e)&&this.yd()){const s={$group_type:t,$group_key:i};e&&(s.$group_set=e),this.capture(Or,s)}e&&this.setGroupPropertiesForFlags({[t]:e}),r&&!e&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i=!0){var e;null===(e=this.featureFlags)||void 0===e||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i=!0){var e;this.bd("posthog.setGroupPropertiesForFlags")&&(null===(e=this.featureFlags)||void 0===e||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null===(i=this.featureFlags)||void 0===i||i.resetGroupPropertiesForFlags(t)}reset(t){const i=j(t)?t:null==t?void 0:t.resetDeviceID,e=j(t)||null==t?void 0:t.bootstrap;this.kd(i,!1,e)}kd(t,i=!1,e){var s,n,r,o,l,a;if(Ls.info("reset"),!this.__loaded)return Ls.uninitializedWarning("posthog.reset");const u=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null===(s=this.Fh)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this.ec());const h=this.get_property(mn),c=this.get_property(yn),d=this.get_property(Dn);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();i||this.consent.reset(),i||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.Iu)||void 0===a?void 0:a.call(l),p=this.bh;this.bh=p||i;let g=!1;try{var _,m,y,b,w,x,S,k,E,T,P,C,F;if(null===(_=this.persistence)||void 0===_||_.clear(),null===(m=this.sessionPersistence)||void 0===m||m.clear(),this.Ch.clear(),this.md(),A(d)||null===(T=this.persistence)||void 0===T||T.register({$session_recording_remote_config:d}),null===(y=this.surveys)||void 0===y||y.reset(),null===(b=this.featureFlags)||void 0===b||b.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(x=this.logs)||void 0===x||x.reset(),null===(S=this.metrics)||void 0===S||S.reset(),null===(k=this.persistence)||void 0===k||k.set_property("$user_state","anonymous"),null===(E=this.sessionManager)||void 0===E||E.resetSessionId(),this.Ph=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:cr,$device_id:null},"");else{const i=this.config.get_device_id(Zr());this.register_once({distinct_id:i,$device_id:t?i:h},""),t||A(c)||this.register({[yn]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(e.distinctID&&!this.fh()&&(null===(F=this.persistence)||void 0===F||F.set_property("$user_state",e.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.distinctID})),null===(P=this.featureFlags)||void 0===P||P.initialize(),!R(u)&&!(null===(C=this.sessionManager)||void 0===C?void 0:C.setBootstrapSessionId(u,!0))){const t=bi({},e);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,g=!0}finally{var O,M;this.bh=p,f&&(null===(O=this.persistence)||void 0===O||null===(M=O.Ru)||void 0===M||M.call(O,g))}var I;this.vr&&(null===(I=this.conversations)||void 0===I||I.onRemoteConfig(this.vr)),this.reloadFeatureFlags()}shutdown(t){var i=this;return J(function*(){if(!i.__loaded)return void Ls.uninitializedWarning("posthog.shutdown");i.xh=!0,clearTimeout(i.zh),i.zh=void 0;const t=i.Zh;i.Zh=void 0;for(const e of[()=>{var t;return null===(t=i.sessionRecording)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.flushLogs("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.flush("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.surveys)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.autocapture)||void 0===t?void 0:t.dispose()},()=>null==t?void 0:t(),()=>{var t;return null===(t=i.Lh)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.jh)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.featureFlags)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.persistence)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.sessionPersistence)||void 0===t?void 0:t.destroy()}])try{const t=e();t&&T(t.then)&&t.then(void 0,t=>{Ls.error("Error during shutdown",t)})}catch(t){Ls.error("Error during shutdown",t)}})()}setIdentity(t,i){var e;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null===(e=this.conversations)||void 0===e||e.Sd()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(t=this.conversations)||void 0===t||t.xd()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if((null==t?void 0:t.withTimestamp)&&e){var n;const i=null!==(n=t.timestampLookBack)&&void 0!==n?n:10;if(!e)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-e)/1e3)-i,0)}`}return s}alias(t,i){return t===this.get_property("$people_distinct_id")?(Ls.critical("Attempting to create alias for existing People user - aborting."),-2):this.bd("posthog.alias")?(A(i)&&(i=this.get_distinct_id()),t!==i?(this._d(bn,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Ls.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const i=bi({},this.config);if(P(t)){var e,s,n,r,o,l,a,u,h,c,d,v,f,p;Ir(this.config,Ih(t));const b=this.kh();if(this.persistence){const t="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;var g,_;if(t&&this.sessionPersistence!==this.persistence&&(null===(g=this.sessionPersistence)||void 0===g||g.remove(),null===(_=this.sessionPersistence)||void 0===_||_.destroy()),this.persistence.update_config(this.config,i,b),t)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new oa(bi(bi({},this.config),{},{persistence:"sessionStorage"}),b,!1);else{var m;null===(m=this.sessionPersistence)||void 0===m||m.update_config(bi(bi({},this.config),{},{persistence:"sessionStorage"}),bi(bi({},i),{},{persistence:"sessionStorage"}),b)}}const w=this.Oh(this.config.debug);var y;j(w)&&(this.config.debug=w),j(this.config.debug)&&(this.config.debug?(Ws.DEBUG=!0,no.Ot()&&no.$t("ph_debug",!0),Ls.info("set_config",{config:t,oldConfig:i,newConfig:bi({},this.config)})):(Ws.DEBUG=!1,no.Ot()&&no.Dt("ph_debug"))),null===(e=this.featureFlags)||void 0===e||null===(s=e.updateConfig)||void 0===s||s.call(e,this.config,this.ec()),null===(n=this.exceptionObserver)||void 0===n||n.onConfigChange(),null===(r=this.exceptions)||void 0===r||r.onConfigChange(),null===(o=this.metrics)||void 0===o||o.onConfigChange(),null===(l=this.webMCP)||void 0===l||l.startIfEnabled(),null===(a=this.sessionRecording)||void 0===a||a.startIfEnabledOrStop(),null===(u=this.tracingHeaders)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.autocapture)||void 0===h||h.startIfEnabled(),null===(c=this.heatmaps)||void 0===c||c.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(y=this.historyAutocapture)||void 0===y||y.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.deadClicksAutocapture)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),this._h(),null===(p=this.externalIntegrations)||void 0===p||p.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&gl(this,mh,!1)}}_overrideSDKInfo(t,i){Ws.LIB_NAME=t,Ws.LIB_VERSION=i}startSessionRecording(t){const i=!0===t,e={sampling:i||!!(null==t?void 0:t.sampling),linked_flag:i||!!(null==t?void 0:t.linked_flag),url_trigger:i||!!(null==t?void 0:t.url_trigger),event_trigger:i||!!(null==t?void 0:t.event_trigger)};var s,n,r,o,l;Object.values(e).some(Boolean)&&(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),e.sampling&&(null===(n=this.sessionRecording)||void 0===n||n.overrideSampling()),e.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),e.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),e.event_trigger&&(null===(l=this.sessionRecording)||void 0===l||l.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(null===(t=this.sessionRecording)||void 0===t?void 0:t.started)}captureException(t,i){try{if(!this.exceptions)return;const e=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(bi(bi({},e),i))}catch(t){return}}addExceptionStep(t,i){var e;null===(e=this.exceptions)||void 0===e||e.addExceptionStep(t,i)}captureLog(t){var i;null===(i=this.logs)||void 0===i||i.captureLog(t)}get logger(){var t,e;return null!==(t=null===(e=this.logs)||void 0===e?void 0:e.logger)&&void 0!==t?t:i.$d}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null===(e=this.toolbar)||void 0===e?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null===(i=this.persistence)||void 0===i?void 0:i.props[t]}getSessionProperty(t){var i;return null===(i=this.sessionPersistence)||void 0===i?void 0:i.props[t]}toString(){var t;let i=null!==(t=this.config.name)&&void 0!==t?t:Ah;return i!==Ah&&(i="posthog."+i),i}_isIdentified(){var t,i;return"identified"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))||"identified"===(null===(i=this.sessionPersistence)||void 0===i?void 0:i.get_property("$user_state"))}yd(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&C(this.getGroups())&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.__alias)&&!(null===(i=this.persistence)||void 0===i||null===(i=i.props)||void 0===i?void 0:i.$epp))}sd(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yd()||this.bd("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bd("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bd(t){return"never"===this.config.person_profiles?(Ls.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.ph(),this._d(hr,!0),!0)}kh(){if("always"===this.config.cookieless_mode)return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}_h(){var t,i;const e=this.kh();var s,n,r;return this.is_capturing()||null===(s=this.logs)||void 0===s||s.Cd(),(null===(t=this.persistence)||void 0===t?void 0:t.fi)!==e&&(null===(n=this.persistence)||void 0===n||n.set_disabled(e)),(null===(i=this.sessionPersistence)||void 0===i?void 0:i.fi)!==e&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(e)),this.md(),e}opt_in_capturing(t){var e,s,n;if("always"===this.config.cookieless_mode)return void Ls.warn(yh);if(this.fh()){var r,o,l,a,u,h;null===(r=this.sessionRecording)||void 0===r||r.dispose({discardBufferedEvents:!0}),this.kd(!0,!0),null===(o=this.sessionManager)||void 0===o||o.destroy(),null===(l=this.pageViewManager)||void 0===l||l.destroy(),this.sessionManager=new Fu(this),this.pageViewManager=new bl(this),this.persistence&&(this.sessionPropsManager=new Tu(this,this.sessionManager,this.persistence));const t=null!==(a=null===(u=this.config.__extensionClasses)||void 0===u?void 0:u.sessionRecording)&&void 0!==a?a:null===(h=i.__defaultExtensionClasses)||void 0===h?void 0:h.sessionRecording;var c,d;t&&(this.sessionRecording=this.dh(this.sessionRecording,new t(this)),this.vr&&(null===(c=this.sessionRecording)||void 0===c||null===(d=c.onRemoteConfig)||void 0===d||d.call(c,this.vr)))}const v=1===this.consent.consent;var f,p,g;v&&this.yh(),this.consent.optInOut(!0),this._h(),this.Xh(),null===(e=this.sessionRecording)||void 0===e||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),null===(p=this.conversations)||void 0===p||p.loadIfEnabled()),v||!A(null==t?void 0:t.captureEventName)&&!(null==t?void 0:t.captureEventName)||this.capture(null!==(g=null==t?void 0:t.captureEventName)&&void 0!==g?g:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.Uh(),null===(n=this.featureFlags)||void 0===n||n.sendFlagCallsPendingCapture(),this.config.capture_pageview&&this.ed()}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this._h(),"on_reject"===this.config.cookieless_mode&&this.wh()):Ls.warn(yh)}wh(){var t,i;const e=this.sessionRecording;null==e||e.dispose({discardBufferedEvents:!0}),"$posthog_cookieless"!==this.get_distinct_id()&&this.kd(!0,!0),this.register({distinct_id:cr,$device_id:null}),this.uh(e),this.sessionRecording=void 0,null===(t=this.sessionManager)||void 0===t||t.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.ed(),this.Xh()}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 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return!this.bh&&("always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing()))}clear_opt_in_out_capturing(){this.consent.reset(),this._h()}_is_bot(){return e?Mu(e,this.config.custom_blocked_useragents):void 0}ed(){s&&("visible"===s.visibilityState?this.Eh||(this.Eh=!0,this.capture(Cr,{title:s.title},{send_instantly:!0}),this.Ah&&(s.removeEventListener(an,this.Ah),this.Ah=null)):this.Ah||(this.Ah=this.ed.bind(this),Ur(s,an,this.Ah)))}debug(i){!1===i?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}ec(){const t=this.Fh||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ls.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(t,i,e,s,n){const r=i in t&&!R(t[i]),o=e in t&&!R(t[e]);return r?t[i]:!!o&&(n&&n.warn(`Config field '${e}' is deprecated. Please use '${i}' instead. The old field will be removed in a future major version.`),t[e])}(t,"advanced_disable_flags","advanced_disable_decide",0,Ls)}Fs(t){var i;if(R(this.config.before_send))return t;const e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(N),s=E(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=t;for(const i of s)try{if(n=i(n),R(n)){const i=`Event '${t.event}' was rejected in beforeSend function`;return L(t.event)?Ls.warn(`${i}. This can cause unexpected behavior.`):Ls.info(i),null}n.properties&&!C(n.properties)||Ls.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(i){return Ls.error(`Error in beforeSend function for event '${t.event}':`,i),null}for(const i of e)if(n.properties&&R(n.properties[i]))return Ls.warn(`Event '${t.event}' had its '${i}' 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 null===(t=this.pageViewManager.Nl)||void 0===t?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Oh(t){const i=j(t)&&!t,e=no.Ot()&&"true"===no.Lt("ph_debug");return!i&&(!!e||t)}};jh.__defaultExtensionClasses={},jh.$d=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(let e=0;i.length>e;e++)t.prototype[i[e]]=jr(t.prototype[i[e]])}(jh,["identify"]);const Lh=["[data-ph-capture-value]"];var Nh=class{constructor(t){this._instance=t}refresh(t){var i;const e=this._instance.config,s=P(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.ec(),t.url_allowlist=null==s?void 0:s.url_allowlist,t.url_ignorelist=null==s?void 0:s.url_ignorelist,t.dom_event_allowlist=null==s?void 0:s.dom_event_allowlist,t.element_allowlist=null==s?void 0:s.element_allowlist,t.css_selector_allowlist=null==s?void 0:s.css_selector_allowlist,t.css_selector_ignorelist=null==s?void 0:s.css_selector_ignorelist,t.element_attribute_ignorelist=null==s?void 0:s.element_attribute_ignorelist,t.capture_copied_text=null==s?void 0:s.capture_copied_text,t.capture_value_css_selector_allowlist=null!==(i=null==s?void 0:s.capture_value_css_selector_allowlist)&&void 0!==i?i:Lh}};const zh=Ns("[ExceptionAutocapture]"),Bh=()=>{},Uh=t=>{var i;if(T(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Hh(t,i,e){try{if(!(i in t))return Bh;const s={next:t[i]},n=e(function(...t){return s.next.apply(this,t)});return T(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),t[i]=n,()=>{if(t[i]===n)return void(t[i]=s.next);let e=t[i],r=Uh(e);for(;r;){if(r.next===n)return void(r.next=s.next);e=r.next,r=Uh(e)}}}catch(t){return Bh}}const qh=Ns("[TracingHeaders]"),Wh=Ns("[Web Vitals]"),Vh=9e5,Gh=["CLS","FCP","INP","LCP"],Kh=["INP","LCP"],Jh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Yh="disabled",Zh="lazy_loading",Xh=Ns("[SessionRecording]"),Qh=[pr,gr,_r,mr,yr,br,wr,$r,xr],tc=Ns("[Heatmaps]");function ic(t){return P(t)&&"clientX"in t&&"clientY"in t&&I(t.clientX)&&I(t.clientY)}const ec=Ns("[Product Tours]"),sc=t=>{var i;return!t.config.disable_product_tours&&!!(null===(i=t.persistence)||void 0===i?void 0:i.get_property(Mn))},nc=["$set_once","$set"],rc=Ns("[SiteApps]"),oc="Error while initializing PostHog app with config id ";function lc(t,i,e){if(R(t))return!1;switch(e){case"exact":return t===i;case"contains":{const e=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(e,"i").test(t)}case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}var ac=class{constructor(t){this.$i=t,this.$o=new Set,this.Co=new Set,this.To=new Pu,this.Io=(t,i)=>this.Mo(t,i)&&this.Eo(t,i)&&this.Ao(t,i)&&this.Ro(t,i),this.Mo=(t,i)=>!(null==i?void 0:i.event)||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;A(null===(t=this.$i)||void 0===t?void 0:t.subscribeCapture)||(this.Po=null===(i=this.$i)||void 0===i?void 0:i.subscribeCapture((t,i)=>{this.on(t,i)}))}dispose(){var t,i,e;null===(t=this.Po)||void 0===t||t.call(this),this.Po=void 0,null===(i=this.$i)||void 0===i||null===(e=i.setElementSelectors)||void 0===e||e.call(i,new Set,this),this.To=new Pu}register(t){var i,e;if(!A(null===(i=this.$i)||void 0===i?void 0:i.subscribeCapture)&&(t.forEach(t=>{var i;this.$o.add(t),null===(i=t.steps)||void 0===i||i.forEach(t=>{this.Co.add((null==t?void 0:t.event)||"")})}),null===(e=this.$i)||void 0===e?void 0:e.setElementSelectors)){const t=new Set;this.$o.forEach(i=>{var e;null===(e=i.steps)||void 0===e||e.forEach(i=>{(null==i?void 0:i.selector)&&t.add(i.selector)})}),this.$i.setElementSelectors(t,this)}}replace(t){this.$o.clear(),this.Co.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Co.has(t)||this.Co.has(i.event))&&this.$o.forEach(t=>{this.Oo(i,t)&&this.To.emit("actionCaptured",t.name)})}Fo(t){this.onAction("actionCaptured",i=>t(i))}Oo(t,i){if(null==(null==i?void 0:i.steps))return!1;for(const e of i.steps)if(this.Io(t,e))return!0;return!1}onAction(t,i){return this.To.on(t,i)}Eo(t,i){if(null==i?void 0:i.url){var e;let r=null==t||null===(e=t.properties)||void 0===e?void 0:e.$current_url;if(!(null==t?void 0:t.properties)||!("$current_url"in t.properties))try{var s,n;r=null===(s=this.$i)||void 0===s||null===(n=s.getActionUrl)||void 0===n?void 0:n.call(s)}catch(t){return!1}if(!r||"string"!=typeof r)return!1;if(!lc(r,i.url,i.url_matching||"contains"))return!1}return!0}Ao(t,i){return!!this.Do(t,i)&&!!this.Lo(t,i)&&!!this.No(t,i)}Do(t,i){var e;if(!(null==i?void 0:i.href))return!0;const s=this.jo(t);if(s.length>0)return s.some(t=>lc(t.href,i.href,i.href_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return!!n&&lc(function(t){const i=t.match(/(?::|")href="(.*?)"/);return i?i[1]:""}(n),i.href,i.href_matching||"exact")}Lo(t,i){var e;if(!(null==i?void 0:i.text))return!0;const s=this.jo(t);if(s.length>0)return s.some(t=>lc(t.text,i.text,i.text_matching||"exact")||lc(t.$el_text,i.text,i.text_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return!!n&&(r=function(t){const i=[],e=/(?::|")text="(.*?)"/g;let s;for(;!R(s=e.exec(t));)i.includes(s[1])||i.push(s[1]);return i}(n),o=i.text,l=i.text_matching||"exact",r.some(t=>lc(t,o,l)));var r,o,l}No(t,i){var e,s;if(!(null==i?void 0:i.selector))return!0;const n=null==t||null===(e=t.properties)||void 0===e?void 0:e.$element_selectors;if(null==n?void 0:n.includes(i.selector))return!0;const r=(null==t||null===(s=t.properties)||void 0===s?void 0:s.$elements_chain)||"";if(i.selector_regex&&r)try{return new RegExp(i.selector_regex).test(r)}catch(t){}return!1}jo(t){var i;return null==(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Ro(t,i){return!(null==i?void 0:i.properties)||0===i.properties.length||zu(i.properties.reduce((t,i)=>{const e=E(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t},{}),null==t?void 0:t.properties)}},uc=class{constructor(t,i){this.qo=i,this.Bo=[],this.$i=t,this.zo=new Map,this.Ho=new Map,this.Uo=new Map}Wo(){var t,i;this.Vo=null===(t=(i=this.$i).subscribeSession)||void 0===t?void 0:t.call(i,t=>this.Go(t))}Qo(t){return!1}Jo(){return null}Zo(t){}Ko(){}Yo(t,i){return!!t&&zu(t.propertyFilters,null==i?void 0:i.properties)}Xo(t,i){const e=new Map;return t.forEach(t=>{var s;null===(s=t.conditions)||void 0===s||null===(s=s[i])||void 0===s||null===(s=s.values)||void 0===s||s.forEach(i=>{if(null==i?void 0:i.name){const s=e.get(i.name)||[];s.push(t.id),e.set(i.name,s)}})}),e}ta(t,i,e){const s=(e===ua?this.zo:this.Ho).get(t);let n=[];return this.ea(t=>{n=t.filter(t=>null==s?void 0:s.includes(t.id))}),n.filter(s=>{var n;const r=null===(n=s.conditions)||void 0===n||null===(n=n[e])||void 0===n||null===(n=n.values)||void 0===n?void 0:n.find(i=>i.name===t);return this.Yo(r,i)})}register(t){this.ia(t,!1)}replace(t){this.ia(t,!0)}ia(t,i){A(this.$i.subscribeCapture)||(this.na(t,i),this.sa(t,i))}sa(t,i){const e=t.filter(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length});var s;if(i&&this.Uo.clear(),0===e.length)return void(i&&(null===(s=this.ra)||void 0===s||s.replace([])));this.ra||(this.ra=new ac(this.$i),this.ra.init(),this.ra.Fo(t=>this.onAction(t)));const n=[];e.forEach(t=>{var i;null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||i.values.forEach(i=>{if(n.push(i),i.name){var e;const s=null!==(e=this.Uo.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.Uo.set(i.name,s)}})}),i?this.ra.replace(n):this.ra.register(n)}oa(t,i){i.forEach((i,e)=>{var s;const n=null!==(s=t.get(e))&&void 0!==s?s:[];i.forEach(t=>{n.includes(t)||n.push(t)}),t.set(e,n)})}na(t,i){var e,s,n;const r=t.filter(t=>{var i,e;return(null===(i=t.conditions)||void 0===i?void 0:i.events)&&(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),o=t.filter(t=>{var i,e;return(null===(i=t.conditions)||void 0===i?void 0:i.cancelEvents)&&(null===(e=t.conditions)||void 0===e||null===(e=e.cancelEvents)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),l=this.Xo(t,ua),a=this.Xo(t,ha);i?(this.zo=l,this.Ho=a):(this.oa(this.zo,l),this.oa(this.Ho,a)),(0!==r.length||0!==o.length||t.some(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length}))&&(null!==(e=this.Po)&&void 0!==e||(this.Po=null===(s=(n=this.$i).subscribeCapture)||void 0===s?void 0:s.call(n,(t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,s;const n=this.aa(),r=(null==i||null===(e=i.properties)||void 0===e?void 0:e.$survey_id)||(null==i||null===(s=i.properties)||void 0===s?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const e=this.la(t,r,i);if("consume"===e)return n.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.ua([r]);if("persist"===e)return n.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.ca(r),void this.ha([r])}if(this.Ho.has(t)){const e=this.ta(t,i,ha);e.length>0&&(n.info("cancel event matched, cancelling items",{event:t,itemsToCancel:e.map(t=>t.id)}),this.ua(e.map(t=>t.id)),e.forEach(t=>this.da(t.id)))}if(!this.zo.has(t))return;n.info("event name matched",{event:t,eventPayload:i,items:this.zo.get(t)});const o=this.ta(t,i,ua);this.va(o.map(t=>t.id))}onAction(t){this.Uo.has(t)&&this.va(this.Uo.get(t)||[])}va(t){if(0===t.length)return;const i=!!this.$i.getSessionId(),e=[];for(const s of t)i&&this.Qo(s)?this.ca(s)&&this.fa(s):e.push(s);e.length>0&&(this.Bo=[...new Set([...this.Bo,...e])]),this.aa().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.pa()}ca(t){this.Bo=this.Bo.filter(i=>i!==t);const i=this.ga();return!i.includes(t)&&(this.ma([...i,t]),this.ya(),!0)}ua(t){const i=new Set(t);this.Bo=this.Bo.filter(t=>!i.has(t));const e=this.ba(),s=e.filter(t=>!i.has(t));s.length!==e.length&&(this.ma(s),0===s.length&&this._a()),this.ha(t),this.pa()}pa(){try{var t;null===(t=this.qo)||void 0===t||t.call(this)}catch(t){this.aa().error("Error while handling activated items change",t)}}wa(){const t=this.Jo();if(!t)return{};const i=this.$i.getProperty(t);return i&&"object"==typeof i?i:{}}fa(t){if(!this.Jo())return;const i=this.wa();this.Zo(bi(bi({},i),{},{[t]:Date.now()}))}ha(t){if(!this.Jo())return;const i=this.wa(),e={};let s=!1;for(const[n,r]of Object.entries(i))t.includes(n)?s=!0:e[n]=r;s&&(C(e)?this.Ko():this.Zo(e))}ka(){this.Jo()&&this.Ko()}getActivationTimestamp(t){if(!this.ga().includes(t))return;const i=this.wa()[t];return I(i)?i:void 0}ba(){const t=this.Sa();return this.$i.getProperty(t)||[]}ga(){const t=this.ba();if(0===t.length)return[];const i=this.$i.getProperty(this.xa()),e=this.$i.getSessionId();return e&&i===e?t:[]}ya(){const t=this.$i.getSessionId();t&&this.$a(t)}_a(){this.Ca()}Go(t){const i=this.$i.getProperty(this.xa());if(i&&i!==t){const t=this.ba(),i=this.wa();t.length>0&&(this.ma([]),t.filter(t=>I(i[t])).forEach(t=>this.da(t))),this._a(),this.ka(),t.length>0&&this.pa()}}getActivatedIds(){return[...new Set([...this.ga(),...this.Bo])].filter(t=>!this.Ta(t))}dispose(){var t,i,e;null===(t=this.Vo)||void 0===t||t.call(this),this.Vo=void 0,null===(i=this.Po)||void 0===i||i.call(this),this.Po=void 0,null===(e=this.ra)||void 0===e||e.dispose(),this.ra=void 0}reset(){this.Bo=[],this.ba().length>0&&this.ma([]),this._a(),this.ka(),this.pa()}getEventToItemsMap(){return this.zo}Ia(){return this.ra}},hc=class extends uc{constructor(t,i,e,s){var n;super({subscribeCapture(i){const e=t.onEvent(t=>i(t.event,t));return()=>e.dispose()},subscribeSession(i){const e=t.onSession(i);return()=>e.dispose()},getSessionId(){var i;return null===(i=t.session)||void 0===i?void 0:i.sessionId},getProperty:i=>t.kv.get(i),getActionUrl:null==e?void 0:e.getActionUrl,setElementSelectors:null!==(n=null==e?void 0:e.setElementSelectors)&&void 0!==n?n:(i,e)=>{var s;return null===(s=t.getExtension("autocapture"))||void 0===s?void 0:s.setElementSelectors(i,e)}},s),this.Ma=t,this.Ea=i,this.Wo()}Sa(){return vn}xa(){return fn}Jo(){return pn}Zo(t){this.Ma.kv.set({[pn]:t})}Ko(){this.Ma.kv.remove(pn)}Qo(t){var i;let e;this.ea(i=>{e=i.find(i=>i.id===t)});const s=null==e||null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds;return I(s)&&s>0}Aa(){return ca}ea(t){this.Ea.getSurveys(t)}da(t){this.Ea.cancelPendingSurvey(t)}aa(){return Gu}ma(t){this.Ma.kv.set({[vn]:t})}$a(t){this.Ma.kv.set({[fn]:t})}Ca(){this.Ma.kv.remove(fn)}Ta(){return!1}la(t,i,e){var s;if(t===va&&!1===(null==e||null===(s=e.properties)||void 0===s?void 0:s.$survey_completed))return"ignore";let n;return this.ea(t=>{n=t.find(t=>t.id===i)}),!n||function(t){var i;return Du(t)&&!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i?void 0:i.repeatedActivation)||"always"===t.schedule}(n)?t===ca?"consume":"ignore":t===ca?"persist":t===da||t===va?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};const cc=(t,i)=>(null==t?void 0:t.then)?t.then(i):i(t),dc="SDK is not enabled or survey functionality is not yet loaded",vc="Disabled. Not loading surveys.";var fc=class{constructor(t){this.Ra=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Pa=!1,this.Oa=!1,this.Fa=[],this.Da=[],this.La=null,this.Na=null,this.Ti=!1,this.ja=new Set,this.onRemoteConfig=t=>{if(this.Ti)return;if(this.Fr.disableSurveys)return;if(!t.ok)return this.Oa=!0,this.qa({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),Gu.warn("Remote config unavailable. Not loading surveys.");const i=t.config.surveys;if(R(i))return Gu.warn("Flags not loaded yet. Not loading surveys.");this.Ba=j(i)?i:i.length>0,Gu.info(`flags response received, isSurveysEnabled: ${this.Ba}`),this.loadIfEnabled()},this.qa=t=>{this.Da.slice().forEach(i=>this.za(i,t))}}setup(t){if(!this.Ti)return this.Ha=t,cc(t.kv.initialize(),()=>{if(this.Ha!==t||this.Ti)return;this.Ha=void 0,this.Ma=t;const i=t.onRemoteConfig(this.onRemoteConfig);this.Ti?i.dispose():(this.Ua=i,this.loadIfEnabled())})}dispose(){var t,i,e,s,n;this.Ti||(this.Ti=!0,this.Ha=void 0,this.Ma=void 0,null===(t=this.Ua)||void 0===t||t.dispose(),this.Ua=void 0,null===(i=this._surveyEventReceiver)||void 0===i||i.dispose(),this._surveyEventReceiver=null,null===(e=this._surveyManager)||void 0===e||null===(s=e.dispose)||void 0===s||s.call(e),this._surveyManager=null,this.Fa=[],this.Da.forEach(t=>{t.active=!1}),this.Da=[],null===(n=this.Wa)||void 0===n||n.call(this),this.Wa=void 0,this.La=null,this.ja.forEach(t=>clearTimeout(t)),this.ja.clear())}get Fr(){return this.Ra.get()}getRenderContext(){if(!this.Ma)return;const t=this;return{client:this.Ma,get config(){return t.Fr},surveys:t}}initialize(){this.loadIfEnabled()}reset(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.clearInMemoryInProgressSurveyState)||void 0===i||i.call(t);try{var e;null===(e=this._surveyEventReceiver)||void 0===e||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let i=0;i<localStorage.length;i++){const e=localStorage.key(i);((null==e?void 0:e.startsWith("seenSurvey_"))||(null==e?void 0:e.startsWith("inProgressSurvey_")))&&t.push(e)}t.forEach(t=>localStorage.removeItem(t))}catch(t){}this.qa()}loadIfEnabled(){if(this.Ti||!this.Ma)return;const t=this.Fr;if(this._surveyManager)return;if(this.Pa)return void Gu.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Gu.info(vc);if(t.cookielessMode&&this.Ma.isOptedOut)return void Gu.info("Not loading surveys in cookieless mode without consent.");const i=this.Ra.getExtensions();if(!i)return void this.Va("PostHog Extensions not found.");if(A(this.Ba)&&!t.advancedEnableSurveys)return;const e=this.Ba||t.advancedEnableSurveys;this.Pa=!0,this.Oa=!1;try{const t=i.generateSurveys;if(t)return this.Ga(t,e),void(this.Pa=!1);const s=i.loadExternalDependency;if(!s)return this.Va(dn),void(this.Pa=!1);s(t=>{try{if(this.Ti)return;const i=this.Ra.getExtensions();t||!(null==i?void 0:i.generateSurveys)?this.Va("Could not load surveys script",t):this.Ga(i.generateSurveys,e)}finally{this.Pa=!1}})}catch(t){throw this.Pa=!1,this.Va("Error initializing surveys",t),t}}Ga(t,i){var e;if(this.Ti)return;this._surveyManager=t(i),this._surveyEventReceiver=this.Qa(this.Ma,this.qa);const s=null===(e=this.Ma)||void 0===e?void 0:e.kv.get(hn);s&&this.Ja(s),Gu.info("Surveys loaded successfully"),this.Za(),this.qa(),this.Ka({isLoaded:!0})}Qa(t,i){return new hc(t,this,void 0,i)}Va(t,i){this.Oa=!0,Gu.error(t,i),this.qa({isLoaded:!1,error:t}),this.Ka({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Fa.push(t),this._surveyManager&&this.Ka({isLoaded:!0}),()=>{this.Fa=this.Fa.filter(i=>i!==t)}}getSurveys(t,i=!1){if(this.Ti)return;const e=this.Ma;if(!e)return t([],{isLoaded:!1,error:dc});if(this.Fr.disableSurveys)return Gu.info(vc),t([]);const s=e.kv.get(hn);if(s&&!i)return t(s,{isLoaded:!0}),void(this.Ya()&&this.getSurveys(()=>{},!0));if(this.La)return void this.La.then(({surveys:i,context:e})=>{this.Ti||t(i,e)}).catch(t=>Gu.error("Error in survey callback",t));const n=e.sendRequest("/api/surveys/",{method:"GET",query:{token:e.projectToken},sentAt:"query",timeoutMs:this.Fr.requestTimeoutMs}).then(t=>{try{return this.Xa(e,t)}catch(t){return Gu.error("Error processing surveys response",t),this.Xa(e,{statusCode:0,error:t})}},t=>this.Xa(e,{statusCode:0,error:t}));this.La=n;const r=()=>{this.La===n&&(this.La=null)};n.then(i=>{r(),this.Ti||(this.qa(i.context),t(i.surveys,i.context))},r).catch(t=>Gu.error("Error in survey callback",t))}Xa(t,i){if(this.Ti)return{surveys:[],context:{isLoaded:!1,error:dc}};const e=i.statusCode;if(200!==e||!i.json){const t=`Surveys API could not be loaded, status: ${e}`;return 0!==e?Gu.error(t):i.error||Gu.warn(t),this.Na=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.Na=null;const s=i.json.surveys||[];return t.kv.set({[hn]:s,[cn]:Date.now()}),this.Ja(s),{surveys:s,context:{isLoaded:!0}}}Ja(t){const i=t.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Du(t)||function(t){var i;return!!(null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}(t)));this.tl(i)}tl(t){var i;null===(i=this._surveyEventReceiver)||void 0===i||i.replace(t)}Ya(){return this.el()&&!this.La&&!this.il()}el(){var t;const i=null===(t=this.Ma)||void 0===t?void 0:t.kv.get(cn);return I(i)&&Date.now()-i>3e5}il(){return I(this.Na)&&3e5>Date.now()-this.Na}markSurveyAsSeen(t,i){var e;const s={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};Ku(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}this.qa()}Ka(t){for(const i of this.Fa){if(this.Ti)return;try{t.isLoaded?this.getSurveys(i):i([],t)}catch(t){Gu.error("Error in survey callback",t)}}}getActiveMatchingSurveys(t,i=!1){if(!R(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Gu.warn("init was not called")}onActiveMatchingSurveysChanged(t){var i;if(this.Ti)return()=>{};const e={callback:t,active:!0,revision:0};this.Da.push(e),this.Za();const s=null===(i=this.Ma)||void 0===i?void 0:i.kv.get(hn);return this.Fr.disableSurveys||!this._surveyManager&&this.Oa&&!this.Pa||!s&&!R(this.Na)&&!this.La?this.za(e,{isLoaded:!1}):this._surveyManager&&this.za(e),()=>{var t;e.active=!1,this.Da=this.Da.filter(t=>t!==e),0===this.Da.length&&(null===(t=this.Wa)||void 0===t||t.call(this),this.Wa=void 0)}}Za(){var t,i,e;this._surveyManager&&this.Da.length>0&&(null!==(t=this.Wa)&&void 0!==t||(this.Wa=null===(i=(e=this.Ra).onMatchingConditionsChanged)||void 0===i?void 0:i.call(e,this.qa)))}za(t,i){if(this.Ti||!t.active)return;const e=++t.revision,s=s=>{if(!this.Ti&&t.active&&e===t.revision)try{const e=null!=i?i:{isLoaded:!0},n=JSON.stringify([s,e]);if(n===t.lastResult)return;t.lastResult=n,t.callback(s,e)}catch(t){Gu.error("Error in active matching surveys callback",t)}};try{i&&!i.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(t){Gu.error("Error in active matching surveys callback",t)}}nl(t){let i=null;return this.getSurveys(e=>{var s;i=null!==(s=e.find(i=>i.id===t))&&void 0!==s?s:null}),i}sl(t){if(R(this._surveyManager))return{eligible:!1,reason:dc};const i="string"==typeof t?this.nl(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}rl(t){var i;if(!(null===(i=this.Ma)||void 0===i?void 0:i.canCapture))return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(R(this._surveyManager))return{eligible:!1,reason:dc};const e="string"==typeof t?this.nl(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(R(this._surveyManager))return Gu.warn("init was not called"),{visible:!1,disabledReason:dc};const i=this.rl(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return R(this._surveyManager)?(Gu.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:dc})):new Promise(e=>{this.getSurveys(i=>{var s;const n=null!==(s=i.find(i=>i.id===t))&&void 0!==s?s:null;if(n){const t=this.rl(n);e({visible:t.eligible,disabledReason:t.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var s,n,r;if(!(null===(s=this.Ma)||void 0===s?void 0:s.canCapture))return;if(R(this._surveyManager))return void Gu.warn("init was not called");const o="string"==typeof t?this.nl(t):t;if(!(null==o?void 0:o.id))return void Gu.warn("Survey not found");if(!Ju.includes(o.type))return void Gu.warn(`Surveys of type ${o.type} cannot be rendered in the app`);const l=null===(n=typeof document>"u"?void 0:document)||void 0===n?void 0:n.querySelector(i);if(l){if(null===(r=o.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds){Gu.info(`Rendering survey ${o.id} with delay of ${o.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var i,s,n;this.ja.delete(t),!this.Ti&&(null===(i=this.Ma)||void 0===i?void 0:i.canCapture)&&(Gu.info(`Rendering survey ${o.id} with delay of ${null===(s=o.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(o,l,e),Gu.info(`Survey ${o.id} rendered`))},1e3*o.appearance.surveyPopupDelaySeconds);return void this.ja.add(t)}this._surveyManager.renderSurvey(o,l,e)}else Gu.warn("Survey element not found")}displaySurvey(t,i){var e,s;if(!(null===(e=this.Ma)||void 0===e?void 0:e.canCapture))return;if(R(this._surveyManager))return void Gu.warn("init was not called");const n=this.nl(t);if(!n)return void Gu.warn("Survey not found");let r=n;if((null===(s=n.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds)&&i.ignoreDelay&&(r=bi(bi({},n),{},{appearance:bi(bi({},n.appearance),{},{surveyPopupDelaySeconds:0})})),i.displayType!==pa&&i.initialResponses&&Gu.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){const t=this.sl(n);if(!t.eligible)return void Gu.warn("Survey is not eligible to be displayed: ",t.reason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(r,i):this.renderSurvey(r,i.selector,i.properties)}cancelPendingSurvey(t){R(this._surveyManager)?Gu.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t)}},pc=class{constructor(t){this._instance=t}get(){var t,i,e,s;const n=null===(t=this._instance)||void 0===t?void 0:t.config;return{disableSurveys:!!(null==n?void 0:n.disable_surveys),cookielessMode:!!(null==n?void 0:n.cookieless_mode),advancedEnableSurveys:!!(null==n?void 0:n.advanced_enable_surveys),requestTimeoutMs:null!==(i=null==n?void 0:n.surveys_request_timeout_ms)&&void 0!==i?i:1e4,prefillFromUrl:!!(null==n||null===(e=n.surveys)||void 0===e?void 0:e.prefillFromUrl),automaticDisplay:!(null==n?void 0:n.disable_surveys_automatic_display),featureFlagEvaluation:!(null==n?void 0:n.advanced_disable_feature_flags),overrideLanguage:null==n?void 0:n.override_display_language,prepareStylesheet:null==n?void 0:n.prepare_external_dependency_stylesheet,get_current_url:null==n?void 0:n.get_current_url,uiHost:null===(s=this._instance)||void 0===s||null===(s=s.requestRouter)||void 0===s?void 0:s.endpointFor("ui","")}}getExtensions(){const t=null==c?void 0:c.__PosthogExtensions__;if(!t||!this._instance)return;const i=this._instance,{generateSurveys:e,loadExternalDependency:s}=t;return{generateSurveys:e?t=>e(i,t):void 0,loadExternalDependency:s?t=>s(i,"surveys",t):void 0}}onMatchingConditionsChanged(i){var e,s;const n=null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook(t=>{"$pageview"!==t&&t!==ca&&t!==da&&t!==va||i()}),r=()=>i();Ur(t,"PHSurveyShown",r);let o=!1;const l=null===(s=this._instance)||void 0===s?void 0:s.onFeatureFlags(()=>{o&&i()});return o=!0,()=>{o=!1,null==n||n(),null==l||l(),null==t||t.removeEventListener("PHSurveyShown",r)}}};const gc=(()=>(null==t?void 0:t.location)?Ml(t.location.hash,"__posthog")||Ml(location.hash,"state"):null)(),_c="_postHogToolbarParams",mc=Ns("[Toolbar]"),yc=Ns("[FeatureFlags]"),bc=Ns("[FeatureFlags]",{debugEnabled:!0}),wc="\" failed. Feature flags didn't load in time.",$c=[502,504],xc=["click","keydown","wheel","touchstart","pointerdown"],Sc="connection_error",kc=t=>{const i={};for(let e=0;t.length>e;e++)i[t[e]]=!0;return i},Ec=t=>{const i={};for(const[e,s]of Dr(t||{}))s&&(i[e]=s);return i},Tc=(t,i)=>t.distinctId===i.distinctId&&t.sessionId===i.sessionId&&((t,i)=>{const e=Object.keys(t);return e.length===Object.keys(i).length&&e.every(e=>t[e]===i[e])})(t.groups,i.groups);var Pc=class{constructor(t){this.name="featureFlags",this.Td=!1,this.featureFlagEventHandlers=[],this.R=yc,this.Id={},this.Md={},this.Ed=[],this.Ad=new Set,this.Rd=new Set,this.Pd=!1,this.Od=!1,this.Fd=0,this.Dd=!1,this.Ld=!1,this.Nd=!1,this.jd=new Map,this.qd=!1,this.Bd=!1,this.zd=!1,this.Hd=0,this.Ud=!1,this.sn=()=>{const t=this.Wd();this.Hd=0,t&&this.reloadFeatureFlags()},this.Vd=()=>{var t,i;const e=this.Gd,s=null!==(t=this.Qd)&&void 0!==t?t:e;A(e)||A(s)||this.Fr.remoteRequestsDisabled||!this.Jd||"hidden"===this.Jd.visibilityState||Date.now()-(null!==(i=this.Zd)&&void 0!==i?i:0)<s||(this.Qd=this.Ud||!this.Fr.idleRefreshBackoff?e:Math.min(2*s,36e5),this.Ud=!1,this.reloadFeatureFlags(),this.Kd())},this.Yd=()=>{this.Ud&&this.Qd===this.Gd||this.Xd()},this.an=()=>{var t;"visible"===(null===(t=this.Jd)||void 0===t?void 0:t.visibilityState)&&this.Xd()},this.Ra=t}get tv(){}ev(){this.Ma&&this.iv()}setup(t){try{this.nv=typeof window>"u"?void 0:window,this.Jd=typeof document>"u"?void 0:document}catch(t){this.nv=void 0,this.Jd=void 0}return this.Ha=t,this.R=t.logger.createLogger("[FeatureFlags]"),cc(t.kv.initialize(),()=>{this.Ha===t&&(this.Ha=void 0,this.Ma=t,this.sv(t))})}sv(t){var i;if(this.Ma===t)return this.nv&&Ur(this.nv,"online",this.sn),this.iv(),this.rv=t.registerDynamicEventProperties(()=>this.ov()?this.Id:this.Md),this.av=null===(i=this.tv)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.lv(),this.uv(),this.hv()}),this.uv(),this.initialize()}Xd(){this.Ud=!0,this.Qd=this.Gd,this.Vd()}iv(){var t;const i=this.Fr.refreshIntervalMs,e=!this.Fr.remoteRequestsDisabled&&this.Jd&&!A(i)&&i>0?i:void 0;this.Fr.idleRefreshBackoff||(this.Qd=e),e!==this.Gd&&(this.dv(),A(e)||(this.Gd=e,this.Qd=e,this.Kd(),(null===(t=this.Jd)||void 0===t?void 0:t.addEventListener)&&(Ur(this.Jd,an,this.an),Mr(xc,t=>{Ur(this.Jd,t,this.Yd,{capture:!0})}))))}Kd(){A(this.Gd)||(A(this.vv)||clearInterval(this.vv),this.Zd=Date.now(),this.vv=setInterval(this.Vd,this.Gd))}dv(){var t,i;A(this.vv)||(clearInterval(this.vv),this.vv=void 0,null===(t=this.Jd)||void 0===t||null===(i=t.removeEventListener)||void 0===i||i.call(t,"visibilitychange",this.an),Mr(xc,t=>{var i,e;null===(i=this.Jd)||void 0===i||null===(e=i.removeEventListener)||void 0===e||e.call(i,t,this.Yd,{capture:!0})})),this.Gd=void 0,this.Qd=void 0,this.Ud=!1,this.Zd=void 0}destroy(){this.fv()}dispose(){this.fv()}fv(){var t,i,e;this.dv(),this.Fd++,this.Ld=!1,this.Ha=void 0,this.pv(this.Ad,"cancelled"),this.pv(this.Rd,"cancelled"),this.Ma&&(this.gv(),null===(t=this.rv)||void 0===t||t.dispose(),this.rv=void 0,null===(i=this.av)||void 0===i||i.call(this),this.av=void 0,this.Ed=[],null===(e=this.nv)||void 0===e||e.removeEventListener("online",this.sn),this.Ma=void 0)}get Fr(){return this.Ra.get()}mv(t){var i;return this.yv&&t in this.yv?this.yv[t]:null===(i=this.Ma)||void 0===i?void 0:i.kv.get(t)}lv(){return!!this.yv&&(this.yv=void 0,!0)}bv(){var t;return!A(null===(t=this.Ma)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.lv()}$t(t){this._v(()=>{var i;return null===(i=this.Ma)||void 0===i?void 0:i.kv.set(t)})}wv(t,i,e){if(!this.tv||!t.$enabled_feature_flags)return;const s=this.mv("$enabled_feature_flags")||{},n=t.$enabled_feature_flags||{},r=i.flags||i.featureFlags,o=i.flags?Object.entries(i.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,a=l?o:e&&!E(r)?Object.keys(r||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.mv("$feature_flag_payloads")||{},h=t.$feature_flag_payloads||{},c=l||e?a:Array.from(new Set([...Object.keys(u),...Object.keys(h)])),d=!l&&!e,v=!!d||a,f=!!d||c,p={[Gs]:v,[Qs]:v,[rn]:f};t.$feature_flag_details&&(p[Ks]=v);for(const i of[Zs,Ys,Xs])A(t[i])||(p[i]=!0);this.tv.markCrossTabFeatureFlagChanges(p)}Dt(t){this._v(()=>{var i;return null===(i=this.Ma)||void 0===i?void 0:i.kv.remove(t)})}_v(t){try{t()}catch(t){this.R.error("Failed to update feature flag persistence",t)}}uv(){const t={};for(const i of[Gs,rn,Zs,on]){const e=this.mv(i);A(e)||(t[i]=e)}this.Id=t;const i=bi({},t),e=this.mv(Qs);if(e)for(const[t,s]of Object.entries(e))i[`$feature/${t}`]=s;this.Md=i}ov(){const t=this.Fr.cacheTtlMs;if(!t||0>=t)return!1;const i=this.mv(Ys);return"number"!=typeof i||Date.now()-i>t}Sv(){return!!this.ov()&&(this.zd||this.Od||(this.zd=!0,this.R.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}xv(){const t=this.Fr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.R.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}$v(){const t=this.Fr.flagKeys;if(!A(t))return t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.R.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i;const e=this.Fr,s=null!==(t=null===(i=e.bootstrap)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(s).length){var n,r;const t=null!==(n=null===(r=e.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:{},i=Object.keys(s).filter(t=>!A(s[t])).reduce((t,i)=>(t[i]=s[i],t),{}),o=Object.keys(t).filter(t=>i[t]).reduce((i,e)=>(i[e]=t[e],i),{});return this.Cv({featureFlags:i,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,i,e){var s,n;const r=(null==e?void 0:e.merge)&&null!==(s=this.mv("$enabled_feature_flags"))&&void 0!==s?s:{},o=(null==e?void 0:e.merge)&&null!==(n=this.mv("$feature_flag_payloads"))&&void 0!==n?n:{},l=bi(bi({},r),t),a=bi(bi({},o),i),u={};for(const[t,i]of Object.entries(l))u[t]={key:t,enabled:ve(i),variant:fe(i),reason:void 0,metadata:A(null==a?void 0:a[t])?void 0:{id:0,version:void 0,description:void 0,payload:a[t]}};this.Cv({flags:u})}get hasLoadedFlags(){return this.Pd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.mv(Ks),i=this.mv(on),e=this.mv(ln);if(!e&&!i)return t||{};const s=Ir({},t||{}),n=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(const t of n){var r,o;const n=s[t],l=null==i?void 0:i[t],a=A(l)?null!==(r=null==n?void 0:n.enabled)&&void 0!==r&&r:!!l,u=A(l)?null==n?void 0:n.variant:"string"==typeof l?l:void 0,h=null==e?void 0:e[t],c=bi(bi({},n),{},{enabled:a,variant:a?null!=u?u:null==n?void 0:n.variant:void 0});a!==(null==n?void 0:n.enabled)&&(c.original_enabled=null==n?void 0:n.enabled),u!==(null==n?void 0:n.variant)&&(c.original_variant=null==n?void 0:n.variant),h&&(c.metadata=bi(bi({},null==n?void 0:n.metadata),{},{payload:h,original_payload:null==n||null===(o=n.metadata)||void 0===o?void 0:o.payload})),s[t]=c}return this.Td||(this.R.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:s}),this.Td=!0),s}getAllFeatureFlags(){const t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{const s=t[e];return{key:e,enabled:ve(s),variant:fe(s),payload:de(i[e])}})}getFlagVariants(){const t=this.mv(Qs),i=this.mv(on);if(!i)return t||{};const e=Ir({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.Td||(this.R.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.Td=!0),e}getFlagPayloads(){const t=this.mv(rn),i=this.mv(ln);if(!i)return t||{};const e=Ir({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.Td||(this.R.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.Td=!0),e}reloadFeatureFlags(){this.Dd||this.Fr.featureFlagsDisabled||this.Wd()||(this.Nd&&this.R.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this.Od&&(this.Ld=!0),this.Tv||(this.Ed.slice().forEach(t=>{try{t()}catch(t){this.R.error("Error while running feature flags reloading callback",t)}}),this.Tv=setTimeout(()=>{this.Iv()},5)))}reloadFeatureFlagsAsync(){return!this.Ma||this.Dd||this.Fr.featureFlagsDisabled||this.Fr.remoteRequestsDisabled||this.Wd()?Promise.resolve({status:"skipped"}):new Promise(t=>{this.Ad.add(t),this.reloadFeatureFlags()})}pv(t,i){t.forEach(t=>t({status:i})),t.clear()}gv(){clearTimeout(this.Tv),this.Tv=void 0}onReloading(t){return this.Ed.push(t),()=>{this.Ed=this.Ed.filter(i=>i!==t)}}ensureFlagsLoaded(){this.Pd||this.Od||this.Tv||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Dd=t}resetFlagCallReported(){this.Dt(sn),this.jd=new Map}sendFlagCallsPendingCapture(){var t;if(0!==this.jd.size&&!this.qd&&(null===(t=this.Ma)||void 0===t?void 0:t.canCapture)&&!this.Ma.isRateLimited){this.qd=!0;try{const t=this.getFlagVariants();for(const i of Array.from(this.jd.keys())){const e=this.jd.get(i);if(e){if(e.value!==String(t[i])||!Tc(e.context,this.Mv())){this.jd.delete(i);continue}if(this.getFeatureFlagResult(i),this.jd.has(i))break}}}finally{this.qd=!1}}}Iv(t){var i;this.gv();const e=this.Ma;if(!e||this.Fr.remoteRequestsDisabled||this.Wd())return void this.pv(this.Ad,"skipped");if(this.Od)return void(this.Ld=!0);const s={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:bi(bi(bi({},e.initialPersonProperties),this.mv("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.mv(tn),timezone:kl()};A(e.deviceId)||(s.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Fr.featureFlagsDisabled)&&(s.disable_flags=!0);const n=this.xv();n.length&&(s.evaluation_contexts=n);const r=this.$v();A(r)||(s.flag_keys=r);const o=this.Fr.onlyEvaluateSurveyFeatureFlags,l="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),a=this.Fd,u=this.Ad;this.Ad=new Set,this.Rd=u,this.Od=!0;const h=()=>{this.Ld&&(this.Ld=!1,this.Iv())},c=t=>{var i,e;const n=null!==(i=t.json)&&void 0!==i?i:{},r=200!==t.statusCode;if(this.Od=!1,a!==this.Fd)return void h();if(this.Ev(t.statusCode),r||this.Ld||(this.$anon_distinct_id=void 0),s.disable_flags&&!this.Ld)return void this.pv(u,"skipped");this.Bd=!r;const l=[];t.error?l.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Sc:"unknown_error"):200!==t.statusCode&&l.push(`api_error_${t.statusCode}`),n.errorsWhileComputingFlags&&l.push("errors_while_computing_flags");const c=!!(null===(e=n.quotaLimited)||void 0===e?void 0:e.includes("feature_flags"));c&&l.push("quota_limited"),this.$t({[Js]:l}),c?this.R.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.Cv(n,r,{partialResponse:o}),this.pv(u,s.disable_flags?"skipped":l.length||!n.flags&&!n.featureFlags?"error":"loaded"),h()},d=t=>{this.Od=!1,a===this.Fd?(this.$t({[Js]:[Sc]}),this.R.error("Feature flag request failed",t),this.bv()&&this.hv(!0),this.pv(u,"error"),h()):h()};let v=null!==(i=this.Fr.requestMaxRetries)&&void 0!==i?i:1;const f=()=>v>0&&a===this.Fd,p=()=>{if(a!==this.Fd||!this.Ma||this.Fr.remoteRequestsDisabled)return this.Od=!1,this.pv(u,"skipped"),void h();try{e.sendRequest(l,{target:"flags",method:"POST",body:s,compression:this.Fr.compression,sentAt:"body",timeoutMs:this.Fr.requestTimeoutMs}).then(t=>{if((t=>$c.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&f())return v--,void setTimeout(p,500);c(t)}).catch(d)}catch(t){d(t)}};p()}Wd(){return Pl(this.Hd,3)}Ev(t){this.Hd=Cl(t,this.Hd,3,()=>this.R.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(t,i={}){var e;if(i.fresh&&!this.Bd)return;if(!(this.Pd||this.getFlags()&&this.getFlags().length>0))return void this.R.warn('getFeatureFlag for key "'+t+wc);if(this.Sv())return;const s=this.getFeatureFlagResult(t,i);return null!==(e=null==s?void 0:s.variant)&&void 0!==e?e:null==s?void 0:s.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i={}){if(i.fresh&&!this.Bd)return;if(!(this.Pd||this.getFlags()&&this.getFlags().length>0))return void this.R.warn('getFeatureFlagResult for key "'+t+wc);if(this.Sv())return;const e=this.getFlagVariants(),s=t in e,n=e[t],r=this.getFlagPayloads()[t],o=String(n),l=this.mv("$feature_flag_request_id")||void 0,a=this.mv("$feature_flag_evaluated_at")||void 0;let u,h=this.mv("$flag_call_reported")||{};if(this.Fr.deduplicateCallsPerSession){var c;const t=null===(c=this.Ma)||void 0===c||null===(c=c.session)||void 0===c?void 0:c.sessionId,i=this.mv(nn);t&&t!==i&&(h={},u=t)}if(!i.send_event&&"send_event"in i)u&&this.$t({[sn]:h,[nn]:u});else{var d,v,f;const i=!(null===(d=this.Ma)||void 0===d?void 0:d.canCapture),e=!i&&!(null===(v=this.Ma)||void 0===v?void 0:v.isRateLimited);var p;if(e?this.jd.delete(t):(i&&Object.keys(h).length>0&&(h={},this.$t({[sn]:h})),(null===(p=h[t])||void 0===p?void 0:p.includes(o))||this.Av(t,o)),e&&!(null===(f=h[t])||void 0===f?void 0:f.includes(o))){var g,_,m,y,b,w,x,S,k,T,P,C,F;E(h[t])?h[t].push(o):h[t]=[o],this.$t(bi({[sn]:h},u?{[nn]:u}:{}));const i=this.getFeatureFlagDetails(t),e=[...null!==(g=this.mv("$feature_flag_errors"))&&void 0!==g?g:[]];A(n)&&e.push("flag_missing");const s={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:null!==(_=null===(m=this.Fr.bootstrap)||void 0===m||null===(m=m.featureFlags)||void 0===m?void 0:m[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(y=null===(b=this.Fr.bootstrap)||void 0===b||null===(b=b.featureFlagPayloads)||void 0===b?void 0:b[t])&&void 0!==y?y:null,$used_bootstrap_value:!this.Bd};A(null==i||null===(w=i.metadata)||void 0===w?void 0:w.has_experiment)||(s.$feature_flag_has_experiment=i.metadata.has_experiment),A(null==i||null===(x=i.metadata)||void 0===x?void 0:x.version)||(s.$feature_flag_version=i.metadata.version);const c=null!==(S=null==i||null===(k=i.reason)||void 0===k?void 0:k.description)&&void 0!==S?S:null==i||null===(T=i.reason)||void 0===T?void 0:T.code;c&&(s.$feature_flag_reason=c),(null==i||null===(P=i.metadata)||void 0===P?void 0:P.id)&&(s.$feature_flag_id=i.metadata.id),A(null==i?void 0:i.original_variant)&&A(null==i?void 0:i.original_enabled)||(s.$feature_flag_original_response=A(i.original_variant)?i.original_enabled:i.original_variant),(null==i||null===(C=i.metadata)||void 0===C?void 0:C.original_payload)&&(s.$feature_flag_original_payload=null==i||null===(F=i.metadata)||void 0===F?void 0:F.original_payload),e.length&&(s.$feature_flag_error=e.join(",")),this.Rv(s)||(this.Pv(t,o),this.Av(t,o))}else u&&this.$t({[sn]:h,[nn]:u})}return s?{key:t,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:de(r)}:void 0}Rv(t){try{var i;return!1!==(null===(i=this.Ma)||void 0===i?void 0:i.capture("$feature_flag_called",t))}catch(t){return this.R.error("Failed to capture feature flag call",t),!0}}Av(t,i){this.jd.set(t,{value:i,context:this.Mv()})}Mv(){var t,i,e;return{distinctId:null===(t=this.Ma)||void 0===t?void 0:t.distinctId,groups:bi({},null===(i=this.Ma)||void 0===i?void 0:i.groups),sessionId:this.Fr.deduplicateCallsPerSession?null===(e=this.Ma)||void 0===e||null===(e=e.session)||void 0===e?void 0:e.sessionId:void 0}}Pv(t,i){const e=this.mv("$flag_call_reported")||{},s=e[t];E(s)&&s.includes(i)&&(e[t]=s.filter(t=>t!==i),this.$t({[sn]:e}))}getRemoteConfigPayload(t,i){this.Ov(t,i)}Ov(t,i){var e=this;return J(function*(){const s=e.Ma;if(!s)return;const n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=e.xv();r.length&&(n.evaluation_contexts=r);const o=e.$v();let l;A(o)||(n.flag_keys=o);try{var a;const i=null===(a=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:e.Fr.compression,sentAt:"body",timeoutMs:e.Fr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==i?void 0:i[t])||void 0}catch(t){return void e.R.error("Remote config feature flag request failed",t)}try{i(l)}catch(t){e.R.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,i={}){if(i.fresh&&!this.Bd)return i.defaultValue;if(!(this.Pd||this.getFlags()&&this.getFlags().length>0))return this.R.warn('isFeatureEnabled for key "'+t+wc),i.defaultValue;const e=this.getFeatureFlag(t,i);return A(e)?i.defaultValue:!!e}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(i=>i!==t)}receivedFeatureFlags(t,i,e){this.Cv(t,i,e)}Cv(t,i,e){if(!this.Ma)return;this.Pd=!0;const s=((t,i={},e={},s={},n,r=yc)=>{const o=((t,i)=>{const e=t.flags;if(e){const i=Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]})),s=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return!A(null===(i=e[t].metadata)||void 0===i?void 0:i.payload)}).map(t=>{var i;return[t,null===(i=e[t].metadata)||void 0===i?void 0:i.payload]}));return bi(bi({},t),{},{featureFlags:i,featureFlagPayloads:s})}return t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,r),l=o.flags,a=o.featureFlags,u=o.featureFlagPayloads;if(!a)return;const h=t.requestId,c=t.evaluatedAt;if(E(a)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const t={};if(a)for(let i=0;a.length>i;i++)t[a[i]]=!0;return{[Gs]:a,[Qs]:t,[Xs]:!1}}let d=a,v=u,f=l;if(null==n?void 0:n.partialResponse){const t=Object.keys(d),n=v||{};d=bi(bi({},i),d),v=bi(bi({},e),n),t.forEach(t=>{t in n||null==v||delete v[t]}),f=bi(bi({},s),f)}else if(t.errorsWhileComputingFlags)if(l){const t=new Set(Object.keys(l).filter(t=>{var i;return!(null===(i=l[t])||void 0===i?void 0:i.failed)}));d=bi(bi({},i),Object.fromEntries(Object.entries(d).filter(([i])=>t.has(i))));const n=Object.fromEntries(Object.entries(v||{}).filter(([i])=>t.has(i)));v=bi(bi({},e),n),t.forEach(t=>{t in n||null==v||delete v[t]}),f=bi(bi({},s),Object.fromEntries(Object.entries(f||{}).filter(([i])=>t.has(i))))}else d=bi(bi({},i),d),v=bi(bi({},e),v),f=bi(bi({},s),f);return bi(bi({[Gs]:Object.keys(Ec(d)),[Qs]:d||{},[rn]:v||{},[Ks]:f||{},[Xs]:!0===t.minimalFlagCalledEvents},h?{[Zs]:h}:{}),c?{[Ys]:c}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.R);if(s)if(!1===(null==e?void 0:e.persist)){const t=!A(this.Ma.kv.get(Qs));this.yv=s,t||this.$t(s)}else this.lv(),this.wv(s,t,!!(null==e?void 0:e.partialResponse)),this.$t(s);else i&&this.bv();i||(this.zd=!1),this.hv(i)}override(t,i=!1){this.R.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Fv(t)}Fv(t){if(this.Ma){if(!1===t)return this.Dt([on,ln]),this.hv(),void bc.info("All overrides cleared");if(E(t))return this.$t({[on]:kc(t)}),this.hv(),void bc.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i;const e=t;this.Td=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);const s={},n=e.flags,r=e.payloads;return n&&(s[on]=E(n)?kc(n):n),r&&(s[ln]=r),Object.keys(s).length&&this.$t(s),!1===n&&!1===r?this.Dt([on,ln]):!1===n?this.Dt(on):!1===r&&this.Dt(ln),this.hv(),!1===n?bc.info("Flag overrides cleared"):n&&bc.info("Flag overrides set",{flags:n}),void(!1===r?bc.info("Payload overrides cleared"):r&&bc.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.$t({[on]:t}),this.hv(),void bc.info("Flag overrides set",{flags:t});this.R.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.R.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Pd){const{flags:i,flagVariants:e}=this.Dv();try{t(i,e)}catch(t){this.R.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var s;const n=(this.mv("$early_access_features")||[]).find(i=>i.flagKey===t),r={[`$feature_enrollment/${t}`]:i},o={$feature_flag:t,$feature_enrollment:i,$set:r};n&&(o.$early_access_feature_name=n.name),e&&(o.$feature_enrollment_stage=e);const l=bi(bi({},this.getFlagVariants()),{},{[t]:i});null===(s=this.tv)||void 0===s||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.$t({[Gs]:Object.keys(Ec(l)),[Qs]:l,[en]:bi(bi({},this.mv("$stored_person_properties")||{}),r)}),this.hv();try{var a;null===(a=this.Ma)||void 0===a||a.capture("$feature_enrollment_update",o)}catch(t){this.R.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i=!1,e){const s=this.mv(Vs);!s||i?this.Lv(t,e):t(s)}Lv(t,i){var e=this;return J(function*(){const s=e.Ma;if(!s)return;const n=i?`&${i.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${n}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,e.$t({[Vs]:r})}catch(t){return void e.R.error("Early access feature request failed",t)}try{t(r)}catch(t){e.R.error("Early access feature callback failed",t)}})()}Dv(){const t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter(t=>i[t]),flagVariants:Object.keys(i).filter(t=>i[t]).reduce((t,e)=>(t[e]=i[e],t),{})}}hv(t){this.uv();const{flags:i,flagVariants:e}=this.Dv(),s=this.Nd;this.Nd=!0,this.featureFlagEventHandlers.forEach(s=>{try{s(i,e,{errorsLoading:t})}catch(t){this.R.error("Error while running feature flags callback",t)}}),this.Nd=s}setPersonPropertiesForFlags(t,i=!0){this.Nv(t,i)}Nv(t,i=!0){const e=this.mv("$stored_person_properties")||{},s=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),n=null==t?void 0:t.$set_once,r={};if(n)for(const t in n)({}).hasOwnProperty.call(n,t)&&(t in e||(r[t]=n[t]));this.$t({[en]:bi(bi(bi({},e),r),s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i=!0){const e=bi({},this.mv("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.$t({[en]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Dt(en),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i=!0){const e=this.mv("$stored_group_properties")||{},s=bi({},e);for(const i of Object.keys(t))s[i]=bi(bi({},e[i]),t[i]);this.$t({[tn]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const i=this.mv("$stored_group_properties")||{};this.$t({[tn]:bi(bi({},i),{},{[t]:{}})})}else this.Dt(tn)}reset(){this.Fd++,this.pv(this.Ad,"cancelled"),this.pv(this.Rd,"cancelled"),this.Ld=!1,this.Id={},this.Md={},this.yv=void 0,this.Pd=!1,this.Dd=!1,this.Bd=!1,this.$anon_distinct_id=void 0,this.gv(),this.Td=!1,this.Hd=0,this.jd=new Map}};const Cc=Ns("[FeatureFlags]");var Ac=class{constructor(t,i=!1){this.jv=!1,this.update(t,i)}update(t,i){this.qv=((t,i)=>{var e,s,n,r,o,l,a,u;return{bootstrap:{featureFlags:null!==(e=null===(s=t.bootstrap)||void 0===s?void 0:s.featureFlags)&&void 0!==e?e:void 0,featureFlagPayloads:null!==(n=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:A(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(l=t.feature_flag_request_max_retries)&&void 0!==l?l:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(a=null!==(u=t.evaluation_contexts)&&void 0!==u?u:t.evaluation_environments)&&void 0!==a?a:[],flagKeys:E(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.jv||(Cc.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.jv=!0),A(t.flag_keys)||E(t.flag_keys)||Cc.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.qv}},Fc=class extends Pc{constructor(t){const i=new Ac(t.config,t.ec());super(i),this.name=ch,this._instance=t,this.Bv=i}get tv(){return this._instance.persistence}updateConfig(t,i){this.Bv.update(t,i),this.ev()}};const Oc=t=>U(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Mc=Ns("[Error tracking]"),Rc="webkit-masked-url:",Ic=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Dc=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Rc],jc=["__firefox__","__gCrWeb"];function Lc(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);i>e;e++)s[e]=t[e];return s}function Nc(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,i){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var s,n,r,o,l=[],a=!0,u=!1;try{if(r=(e=e.call(t)).next,0===i);else for(;!(a=(s=r.call(e)).done)&&(l.push(s.value),l.length!==i);a=!0);}catch(t){u=!0,n=t}finally{try{if(!a&&null!=e.return&&(o=e.return(),Object(o)!==o))return}finally{if(u)throw n}}return l}}(t,i)||function(t,i){if(t){if("string"==typeof t)return Lc(t,i);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Lc(t,i):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const zc=Object.entries,Bc=Object.setPrototypeOf,Uc=Object.isFrozen,Hc=Object.getPrototypeOf,qc=Object.getOwnPropertyDescriptor;let Wc=Object.freeze,Vc=Object.seal,Gc=Object.create,Kc="undefined"!=typeof Reflect&&Reflect,Jc=Kc.apply,Yc=Kc.construct;Wc||(Wc=function(t){return t}),Vc||(Vc=function(t){return t}),Jc||(Jc=function(t,i){for(var e=arguments.length,s=new Array(e>2?e-2:0),n=2;e>n;n++)s[n-2]=arguments[n];return t.apply(i,s)}),Yc||(Yc=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),s=1;i>s;s++)e[s-1]=arguments[s];return new t(...e)});const Zc=md([].forEach),Xc=md([].lastIndexOf),Qc=md([].pop),td=md([].push),id=md([].splice),ed=Array.isArray,sd=md("".toLowerCase),nd=md("".toString),rd=md("".match),od=md("".replace),ld=md("".indexOf),ad=md("".trim),ud=md((0).toString),hd=md(Boolean.prototype.toString),cd="undefined"==typeof BigInt?null:md(BigInt.prototype.toString),dd="undefined"==typeof Symbol?null:md(Symbol.prototype.toString),vd=md({}.hasOwnProperty),fd=md({}.toString),pd=md(/t/.test),gd=(_d=TypeError,function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return Yc(_d,i)});var _d;function md(t){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;e>n;n++)s[n-1]=arguments[n];return Jc(t,i,s)}}function yd(t,i){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:sd;if(Bc&&Bc(t,null),!ed(i))return t;let s=i.length;for(;s--;){let n=i[s];if("string"==typeof n){const t=e(n);t!==n&&(Uc(i)||(i[s]=t),n=t)}t[n]=!0}return t}function bd(t){for(let i=0;t.length>i;i++)vd(t,i)||(t[i]=null);return t}function wd(t){const i=Gc(null);for(const s of zc(t)){var e=Nc(s,2);const n=e[0],r=e[1];vd(t,n)&&(i[n]=ed(r)?bd(r):r&&"object"==typeof r&&r.constructor===Object?wd(r):r)}return i}function $d(t,i){for(;null!==t;){const e=qc(t,i);if(e){if(e.get)return md(e.get);if("function"==typeof e.value)return md(e.value)}t=Hc(t)}return function(){return null}}const xd=Wc(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Sd=Wc(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),kd=Wc(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Ed=Wc(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Td=Wc(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Pd=Wc(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Cd=Wc(["#text"]),Ad=Wc(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),Fd=Wc(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Od=Wc(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Md=Wc(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Rd=Vc(/{{[\w\W]*|^[\w\W]*}}/g),Id=Vc(/<%[\w\W]*|^[\w\W]*%>/g),Dd=Vc(/\${[\w\W]*/g),jd=Vc(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ld=Vc(/^aria-[\-\w]+$/),Nd=Vc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),zd=Vc(/^(?:\w+script|data):/i),Bd=Vc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ud=Vc(/^html$/i),Hd=Vc(/^[a-z][.\w]*(-[.\w]+)+$/i),qd=Vc(/<[/\w!]/g),Wd=Vc(/<[/\w]/g),Vd=Vc(/<\/no(script|embed|frames)/i),Gd=Vc(/\/>/i),Kd=function(){return"undefined"==typeof window?null:window},Jd=function(t,i,e,s){return vd(t,i)&&ed(t[i])?yd(s.base?wd(s.base):{},t[i],s.transform):e};var Yd=function t(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Kd();const e=i=>t(i);if(e.version="3.4.13",e.removed=[],!i||!i.document||9!==i.document.nodeType||!i.Element)return e.isSupported=!1,e;let s=i.document;const n=s,r=n.currentScript,o=i.HTMLTemplateElement,l=i.Node,a=i.NodeFilter,u=i.DOMParser,h=i.trustedTypes,c=i.Element.prototype,d=$d(c,"cloneNode"),v=$d(c,"remove"),f=$d(c,"nextSibling"),p=$d(c,"childNodes"),g=$d(c,"parentNode"),_=$d(c,"shadowRoot"),m=$d(c,"attributes"),y=l&&l.prototype?$d(l.prototype,"nodeType"):null,b=l&&l.prototype?$d(l.prototype,"nodeName"):null,w=l&&l.prototype?$d(l.prototype,"ownerDocument"):null;if("function"==typeof o){const t=s.createElement("template");t.content&&t.content.ownerDocument&&(s=t.content.ownerDocument)}let x,S,k="",E=!1,T=0;const P=function(){if(T>0)throw gd('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},C=function(t){P(),T++;try{return x.createHTML(t)}finally{T--}},A=s.implementation,F=s.createNodeIterator,O=s.createDocumentFragment,M=s.getElementsByTagName,R=n.importNode;let I={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};e.isSupported="function"==typeof zc&&"function"==typeof g&&A&&void 0!==A.createHTMLDocument;const D=Rd,j=Id,L=Dd,N=jd,z=Ld,B=zd,U=Bd,H=Hd;let q=Nd,W=null;const V=yd({},[...xd,...Sd,...kd,...Td,...Cd]);let G=null;const K=yd({},[...Ad,...Fd,...Od,...Md]);let J=Object.seal(Gc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Y=null,Z=null;const X=Object.seal(Gc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Q=!0,tt=!0,it=!1,et=!0,st=!1,nt=!0,rt=!1,ot=!1,lt=null,at=null,ut=!1,ht=!1,ct=!1,dt=!1,vt=!0,ft=!1;const pt="user-content-";let gt=!0,_t=!1,mt={},yt=null;const bt=yd({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let wt=null;const $t=yd({},["audio","video","img","source","image","track"]);let xt=null;const St=yd({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),kt="http://www.w3.org/1998/Math/MathML",Et="http://www.w3.org/2000/svg",Tt="http://www.w3.org/1999/xhtml";let Pt=Tt,Ct=!1,At=null;const Ft=yd({},[kt,Et,Tt],nd),Ot=Wc(["mi","mo","mn","ms","mtext"]);let Mt=yd({},Ot);const Rt=Wc(["annotation-xml"]);let It=yd({},Rt);const Dt=yd({},["title","style","font","a","script"]);let jt=null;const Lt=["application/xhtml+xml","text/html"];let Nt=null,zt=null;const Bt=s.createElement("form"),Ut=function(t){return t instanceof RegExp||t instanceof Function},Ht=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(zt&&zt===t)return;t&&"object"==typeof t||(t={}),t=wd(t),jt=-1===Lt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,Nt="application/xhtml+xml"===jt?nd:sd,W=Jd(t,"ALLOWED_TAGS",V,{transform:Nt}),G=Jd(t,"ALLOWED_ATTR",K,{transform:Nt}),At=Jd(t,"ALLOWED_NAMESPACES",Ft,{transform:nd}),xt=Jd(t,"ADD_URI_SAFE_ATTR",St,{transform:Nt,base:St}),wt=Jd(t,"ADD_DATA_URI_TAGS",$t,{transform:Nt,base:$t}),yt=Jd(t,"FORBID_CONTENTS",bt,{transform:Nt}),Y=Jd(t,"FORBID_TAGS",wd({}),{transform:Nt}),Z=Jd(t,"FORBID_ATTR",wd({}),{transform:Nt}),mt=!!vd(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?wd(t.USE_PROFILES):t.USE_PROFILES),Q=!1!==t.ALLOW_ARIA_ATTR,tt=!1!==t.ALLOW_DATA_ATTR,it=t.ALLOW_UNKNOWN_PROTOCOLS||!1,et=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,st=t.SAFE_FOR_TEMPLATES||!1,nt=!1!==t.SAFE_FOR_XML,rt=t.WHOLE_DOCUMENT||!1,ht=t.RETURN_DOM||!1,ct=t.RETURN_DOM_FRAGMENT||!1,dt=t.RETURN_TRUSTED_TYPE||!1,ut=t.FORCE_BODY||!1,vt=!1!==t.SANITIZE_DOM,ft=t.SANITIZE_NAMED_PROPS||!1,gt=!1!==t.KEEP_CONTENT,_t=t.IN_PLACE||!1,q=function(t){try{return pd(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:Nd,Pt="string"==typeof t.NAMESPACE?t.NAMESPACE:Tt,Mt=vd(t,"MATHML_TEXT_INTEGRATION_POINTS")&&t.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof t.MATHML_TEXT_INTEGRATION_POINTS?wd(t.MATHML_TEXT_INTEGRATION_POINTS):yd({},Ot),It=vd(t,"HTML_INTEGRATION_POINTS")&&t.HTML_INTEGRATION_POINTS&&"object"==typeof t.HTML_INTEGRATION_POINTS?wd(t.HTML_INTEGRATION_POINTS):yd({},Rt);const i=vd(t,"CUSTOM_ELEMENT_HANDLING")&&t.CUSTOM_ELEMENT_HANDLING&&"object"==typeof t.CUSTOM_ELEMENT_HANDLING?wd(t.CUSTOM_ELEMENT_HANDLING):Gc(null);if(J=Gc(null),vd(i,"tagNameCheck")&&Ut(i.tagNameCheck)&&(J.tagNameCheck=i.tagNameCheck),vd(i,"attributeNameCheck")&&Ut(i.attributeNameCheck)&&(J.attributeNameCheck=i.attributeNameCheck),vd(i,"allowCustomizedBuiltInElements")&&"boolean"==typeof i.allowCustomizedBuiltInElements&&(J.allowCustomizedBuiltInElements=i.allowCustomizedBuiltInElements),Vc(J),st&&(tt=!1),ct&&(ht=!0),mt&&(W=yd({},Cd),G=Gc(null),!0===mt.html&&(yd(W,xd),yd(G,Ad)),!0===mt.svg&&(yd(W,Sd),yd(G,Fd),yd(G,Md)),!0===mt.svgFilters&&(yd(W,kd),yd(G,Fd),yd(G,Md)),!0===mt.mathMl&&(yd(W,Td),yd(G,Od),yd(G,Md))),X.tagCheck=null,X.attributeCheck=null,vd(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?X.tagCheck=t.ADD_TAGS:ed(t.ADD_TAGS)&&(W===V&&(W=wd(W)),yd(W,t.ADD_TAGS,Nt))),vd(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?X.attributeCheck=t.ADD_ATTR:ed(t.ADD_ATTR)&&(G===K&&(G=wd(G)),yd(G,t.ADD_ATTR,Nt))),vd(t,"ADD_URI_SAFE_ATTR")&&ed(t.ADD_URI_SAFE_ATTR)&&yd(xt,t.ADD_URI_SAFE_ATTR,Nt),vd(t,"FORBID_CONTENTS")&&ed(t.FORBID_CONTENTS)&&(yt===bt&&(yt=wd(yt)),yd(yt,t.FORBID_CONTENTS,Nt)),vd(t,"ADD_FORBID_CONTENTS")&&ed(t.ADD_FORBID_CONTENTS)&&(yt===bt&&(yt=wd(yt)),yd(yt,t.ADD_FORBID_CONTENTS,Nt)),gt&&(W["#text"]=!0),rt&&yd(W,["html","head","body"]),W.table&&(yd(W,["tbody"]),delete Y.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw gd('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw gd('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const i=x;x=t.TRUSTED_TYPES_POLICY;try{k=C("")}catch(t){throw x=i,t}}else null===t.TRUSTED_TYPES_POLICY?(x=void 0,k=""):(void 0===x&&(E||(S=function(t,i){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let e=null;const s="data-tt-policy-suffix";i&&i.hasAttribute(s)&&(e=i.getAttribute(s));const n="dompurify"+(e?"#"+e:"");try{return t.createPolicy(n,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+n+" could not be created."),null}}(h,r),E=!0),x=S),x&&"string"==typeof k&&(k=C("")));Wc&&Wc(t),zt=t},qt=yd({},[...Sd,...kd,...Ed]),Wt=yd({},[...Td,...Pd]),Vt=function(t){td(e.removed,{element:t});try{g(t).removeChild(t)}catch(i){if(v(t),!g(t))throw gd("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Gt=function(t){Yt(t);const i=p(t);if(i){const t=[];Zc(i,i=>{td(t,i)}),Zc(t,t=>{try{v(t)}catch(t){}})}const e=m(t);if(e)for(let i=e.length-1;i>=0;--i){const s=e[i],n=s&&s.name;if("string"==typeof n)try{t.removeAttribute(n)}catch(t){}}},Kt=function(t,i){try{td(e.removed,{attribute:i.getAttributeNode(t),from:i})}catch(t){td(e.removed,{attribute:null,from:i})}if(i.removeAttribute(t),"is"===t)if(ht||ct)try{Vt(i)}catch(t){}else try{i.setAttribute(t,"")}catch(t){}},Jt=function(t){const i=m(t);if(i)for(let e=i.length-1;e>=0;--e){const s=i[e],n=s&&s.name;if("string"==typeof n&&!G[Nt(n)])try{t.removeAttribute(n)}catch(t){}}},Yt=function(t){const i=[t];for(;i.length>0;){const t=i.pop();1===(y?y(t):t.nodeType)&&Jt(t);const e=p(t);if(e)for(let t=e.length-1;t>=0;--t)i.push(e[t])}},Zt=function(t){let i=null,e=null;if(ut)t="<remove></remove>"+t;else{const i=rd(t,/^[\r\n\t ]+/);e=i&&i[0]}"application/xhtml+xml"===jt&&Pt===Tt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const n=x?C(t):t;if(Pt===Tt)try{i=(new u).parseFromString(n,jt)}catch(t){}if(!i||!i.documentElement){i=A.createDocument(Pt,"template",null);try{i.documentElement.innerHTML=Ct?k:n}catch(t){}}const r=i.body||i.documentElement;return t&&e&&r.insertBefore(s.createTextNode(e),r.childNodes[0]||null),Pt===Tt?M.call(i,rt?"html":"body")[0]:rt?i.documentElement:r},Xt=function(t){const i=w?w(t):t.ownerDocument;return F.call(i||t,t,a.SHOW_ELEMENT|a.SHOW_COMMENT|a.SHOW_TEXT|a.SHOW_PROCESSING_INSTRUCTION|a.SHOW_CDATA_SECTION,null)},Qt=function(t){return t=od(t,D," "),t=od(t,j," "),od(t,L," ")},ti=function(t){var i;t.normalize();const e=w?w(t):t.ownerDocument,s=F.call(e||t,t,a.SHOW_TEXT|a.SHOW_COMMENT|a.SHOW_CDATA_SECTION|a.SHOW_PROCESSING_INSTRUCTION,null);let n=s.nextNode();for(;n;)n.data=Qt(n.data),n=s.nextNode();const r=null===(i=t.querySelectorAll)||void 0===i?void 0:i.call(t,"template");r&&Zc(r,t=>{ei(t.content)&&ti(t.content)})},ii=function(t){const i=b?b(t):null;return"string"==typeof i&&"form"===Nt(i)&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||t.attributes!==m(t)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes||t.nodeType!==y(t)||t.childNodes!==p(t))},ei=function(t){if(!y||"object"!=typeof t||null===t)return!1;try{return 11===y(t)}catch(t){return!1}},si=function(t){if(!y||"object"!=typeof t||null===t)return!1;try{return"number"==typeof y(t)}catch(t){return!1}};function ni(t,i,s){0!==t.length&&Zc(t,t=>{t.call(e,i,s,zt)})}const ri=function(t,i,e,s){return 0===t.length?i:i===e||i===s?wd(i):i},oi=function(t,i){if(ni(I.beforeSanitizeElements,t,null),t!==i&&null===g(t))return _t&&Yt(t),!0;if(ii(t))return Vt(t),!0;const s=Nt(b?b(t):t.nodeName);if(W=ri(I.uponSanitizeElement,W,V,lt),ni(I.uponSanitizeElement,t,{tagName:s,allowedTags:W}),t!==i&&null===g(t))return _t&&Yt(t),!0;if(function(t,i){return!!(nt&&t.hasChildNodes()&&!si(t.firstElementChild)&&pd(qd,t.textContent)&&pd(qd,t.innerHTML))||!(!nt||t.namespaceURI!==Tt||"style"!==i||!si(t.firstElementChild))||7===t.nodeType||!(!nt||8!==t.nodeType||!pd(Wd,t.data))}(t,s))return Vt(t),!0;if(Y[s]||!(X.tagCheck instanceof Function&&X.tagCheck(s))&&!W[s]){const e=function(t,i,e){if(!Y[i]&&ui(i)){if(J.tagNameCheck instanceof RegExp&&pd(J.tagNameCheck,i))return!1;if(J.tagNameCheck instanceof Function&&J.tagNameCheck(i))return!1}if(gt&&!yt[i]){const i=g(t),s=p(t);if(s&&i)for(let n=s.length-1;n>=0;--n){const r=t===e?d(s[n],!0):s[n];i.insertBefore(r,f(t))}}return Vt(t),!0}(t,s,i);return!1===e&&ni(I.afterSanitizeElements,t,null),e}if(1===(y?y(t):t.nodeType)&&!function(t){let i=g(t);i&&i.tagName||(i={namespaceURI:Pt,tagName:"template"});const e=sd(t.tagName),s=sd(i.tagName);return!!At[t.namespaceURI]&&(t.namespaceURI===Et?function(t,i,e){return i.namespaceURI===Tt?"svg"===t:i.namespaceURI===kt?"svg"===t&&("annotation-xml"===e||Mt[e]):Boolean(qt[t])}(e,i,s):t.namespaceURI===kt?function(t,i,e){return i.namespaceURI===Tt?"math"===t:i.namespaceURI===Et?"math"===t&&It[e]:Boolean(Wt[t])}(e,i,s):t.namespaceURI===Tt?function(t,i,e){return!(i.namespaceURI===Et&&!It[e])&&!(i.namespaceURI===kt&&!Mt[e])&&!Wt[t]&&(Dt[t]||!qt[t])}(e,i,s):!("application/xhtml+xml"!==jt||!At[t.namespaceURI]))}(t))return Vt(t),!0;if(("noscript"===s||"noembed"===s||"noframes"===s)&&pd(Vd,t.innerHTML))return Vt(t),!0;if(st&&3===t.nodeType){const i=Qt(t.textContent);t.textContent!==i&&(td(e.removed,{element:t.cloneNode()}),t.textContent=i)}return ni(I.afterSanitizeElements,t,null),!1},li=function(t,i,e){if(Z[i])return!1;if(nt&&"patchsrc"===i)return!1;if(nt&&"for"===i&&"label"!==t&&"output"!==t)return!1;if(vt&&("id"===i||"name"===i)&&(e in s||e in Bt))return!1;const n=G[i]||X.attributeCheck instanceof Function&&X.attributeCheck(i,t);if(tt&&pd(N,i));else if(Q&&pd(z,i));else if(n){if(xt[i]);else if(pd(q,od(e,U,"")));else if("src"!==i&&"xlink:href"!==i&&"href"!==i||"script"===t||0!==ld(e,"data:")||!wt[t])if(it&&!pd(B,od(e,U,"")));else if(e)return!1}else if(!(ui(t)&&(J.tagNameCheck instanceof RegExp&&pd(J.tagNameCheck,t)||J.tagNameCheck instanceof Function&&J.tagNameCheck(t))&&(J.attributeNameCheck instanceof RegExp&&pd(J.attributeNameCheck,i)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(i,t))||"is"===i&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&pd(J.tagNameCheck,e)||J.tagNameCheck instanceof Function&&J.tagNameCheck(e))))return!1;return!0},ai=yd({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ui=function(t){return!ai[sd(t)]&&pd(H,t)},hi=function(t,i,e,s){if(x&&"object"==typeof h&&"function"==typeof h.getAttributeType&&!e)switch(h.getAttributeType(t,i)){case"TrustedHTML":return C(s);case"TrustedScriptURL":return function(t){P(),T++;try{return x.createScriptURL(t)}finally{T--}}(s)}return s},ci=function(t,i,s,n){try{s?t.setAttributeNS(s,i,n):t.setAttribute(i,n),ii(t)?Vt(t):Qc(e.removed)}catch(e){Kt(i,t)}},di=function(t){ni(I.beforeSanitizeAttributes,t,null);const i=t.attributes;if(!i||ii(t))return;G=ri(I.uponSanitizeAttribute,G,K,at);const e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:G,forceKeepAttr:void 0};let s=i.length;const n=Nt(t.nodeName);for(;s--;){const r=i[s],o=r.name,l=r.namespaceURI,a=r.value,u=Nt(o),h=a;let c="value"===o?h:ad(h);e.attrName=u,e.attrValue=c,e.keepAttr=!0,e.forceKeepAttr=void 0,ni(I.uponSanitizeAttribute,t,e),c=e.attrValue,!ft||"id"!==u&&"name"!==u||0===ld(c,pt)||(Kt(o,t),c=pt+c),nt&&pd(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,c)||"attributename"===u&&rd(c,"href")?Kt(o,t):e.forceKeepAttr||(!e.keepAttr||!et&&pd(Gd,c)?Kt(o,t):(st&&(c=Qt(c)),li(n,u,c)?(c=hi(n,u,l,c),c!==h&&ci(t,o,l,c)):Kt(o,t)))}ni(I.afterSanitizeAttributes,t,null)},vi=function(t){let i=null;const e=Xt(t);for(ni(I.beforeSanitizeShadowDOM,t,null);i=e.nextNode();)if(ni(I.uponSanitizeShadowNode,i,null),oi(i,t),di(i),ei(i.content)&&vi(i.content),1===(y?y(i):i.nodeType)){const t=_(i);ei(t)&&(fi(t),vi(t))}ni(I.afterSanitizeShadowDOM,t,null)},fi=function(t){const i=[{node:t,shadow:null}];for(;i.length>0;){const t=i.pop();if(t.shadow){vi(t.shadow);continue}const e=t.node,s=1===(y?y(e):e.nodeType),n=p(e);if(n)for(let t=n.length-1;t>=0;--t)i.push({node:n[t],shadow:null});if(s){const t=b?b(e):null;if("string"==typeof t&&"template"===Nt(t)){const t=e.content;ei(t)&&i.push({node:t,shadow:null})}}if(s){const t=_(e);ei(t)&&i.push({node:null,shadow:t},{node:t,shadow:null})}}};return e.sanitize=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=null,r=null,o=null,l=null;if(Ct=!t,Ct&&(t="\x3c!--\x3e"),"string"!=typeof t&&!si(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return ud(t);case"boolean":return hd(t);case"bigint":return cd?cd(t):"0";case"symbol":return dd?dd(t):"Symbol()";case"undefined":default:return fd(t);case"function":case"object":{if(null===t)return fd(t);const i=t,e=$d(i,"toString");if("function"==typeof e){const t=e(i);return"string"==typeof t?t:fd(t)}return fd(t)}}}(t)))throw gd("dirty is not a string, aborting");if(!e.isSupported)return t;ot?(W=lt,G=at):Ht(i),(I.uponSanitizeElement.length>0||I.uponSanitizeAttribute.length>0)&&(W=wd(W)),I.uponSanitizeAttribute.length>0&&(G=wd(G)),e.removed=[];const a=_t&&"string"!=typeof t&&si(t);if(a){!function(t){if(!nt)return;const i=[t];for(;i.length>0;){const t=i.pop(),e=y?y(t):t.nodeType;if(7===e||8===e&&pd(Wd,t.data)){try{v(t)}catch(t){}continue}if(1===e){const i=t,e=Nt(b?b(t):t.nodeName);try{i.hasAttribute&&i.hasAttribute("patchsrc")&&i.removeAttribute("patchsrc"),i.hasAttribute&&i.hasAttribute("for")&&"label"!==e&&"output"!==e&&i.removeAttribute("for")}catch(t){}}const s=p(t);if(s)for(let t=s.length-1;t>=0;--t)i.push(s[t])}}(t);const i=b?b(t):t.nodeName;if("string"==typeof i){const e=Nt(i);if(!W[e]||Y[e])throw Gt(t),gd("root node is forbidden and cannot be sanitized in-place")}if(ii(t))throw Gt(t),gd("root node is clobbered and cannot be sanitized in-place");try{fi(t)}catch(i){throw Gt(t),i}}else if(si(t))s=Zt("\x3c!----\x3e"),r=s.ownerDocument.importNode(t,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?s=r:s.appendChild(r),fi(r);else{if(!ht&&!st&&!rt&&-1===t.indexOf("<"))return x&&dt?C(t):t;if(s=Zt(t),!s)return ht?null:dt?k:""}s&&ut&&Vt(s.firstChild);const u=a?t:s;try{const t=Xt(u);for(;o=t.nextNode();)oi(o,u),di(o),ei(o.content)&&vi(o.content)}catch(i){throw a&&(Gt(t),Zc(e.removed,t=>{t.element&&Yt(t.element)})),i}if(a)return Zc(e.removed,t=>{t.element&&Yt(t.element)}),st&&ti(t),t;if(ht){if(st&&ti(s),ct)for(l=O.call(s.ownerDocument);s.firstChild;)l.appendChild(s.firstChild);else l=s;return(G.shadowroot||G.shadowrootmode)&&(l=R.call(n,l,!0)),l}let h=rt?s.outerHTML:s.innerHTML;return rt&&W["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&pd(Ud,s.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+s.ownerDocument.doctype.name+">\n"+h),st&&(h=Qt(h)),x&&dt?C(h):h},e.setConfig=function(){Ht(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ot=!0,lt=W,at=G},e.clearConfig=function(){zt=null,ot=!1,lt=null,at=null,x=S,k=""},e.isValidAttribute=function(t,i,e){zt||Ht({});const s=Nt(t),n=Nt(i);return li(s,n,e)},e.addHook=function(t,i){"function"==typeof i&&vd(I,t)&&td(I[t],i)},e.removeHook=function(t,i){if(vd(I,t)){if(void 0!==i){const e=Xc(I[t],i);return-1===e?void 0:id(I[t],e,1)[0]}return Qc(I[t])}},e.removeHooks=function(t){vd(I,t)&&(I[t]=[])},e.removeAllHooks=function(){I={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},e}();const Zd="Refusing to render web experiment since the viewer is a likely bot",Xd={ADD_ATTR:(t,i)=>"target"===t&&"a"===i||"form"===t&&/^(button|fieldset|input|output|select|textarea)$/.test(i),ADD_URI_SAFE_ATTR:["form"]};let Qd;const tv={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>ju(i,t),not_regex:(t,i)=>!ju(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},iv=Ns("[Conversations]"),ev="Conversations not available yet.";function sv(t,i){var e,s,n,r,o,l,a;const u=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,h=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,c=(null==i?void 0:i.consoleCapture)?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,d=A(c)?Math.max(h,2048):Math.max(h,c),v=bi(bi({},function(){let t="",i="";try{var e;const s="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,n=null==s||null===(e=s.navigator)||void 0===e?void 0:e.userAgent;n&&([t,i]=Xt(n))}catch(t){}return function(t,i){const e=function(t){if(t)return{}.hasOwnProperty.call(_s,t)?_s[t]:t}(t);return bi(bi({},e?{"os.name":e}:{}),i?{"os.version":i}:{})}(t,i)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(r=null!==(o=null==v?void 0:v["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==r?r:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==v?void 0:v["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(a=null==v?void 0:v["deployment.environment"])&&void 0!==a?a:null==t?void 0:t.environment,resourceAttributes:v,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const nv=["debug","log","warn","error","info"],rv=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},ov="console",lv="__posthogHandledLogsRequestError",av=(t,i)=>{const e=t instanceof Error?t:new Error(i);return e[lv]=!0,e},uv=t=>!!t&&"object"==typeof t&&!0===t[lv];var hv=class{get zv(){return bi(bi({},this.R),{},{error:(...t)=>{t.some(uv)||this.R.error(...t)}})}constructor(t,i){var e;this.Ra=t,this.Hv=i,this.name="logs",this.Uv=!1,this.Wv=!1,this.Vv=!1,this.R=Ns("[logs]"),this.sc=[],this.Gv=[],this.Hd=0,this.Qv=!1,this.Ti=!1,this.Jv=[],this.Zv=[],this.Kv=!1,this.Yv=!1,this.Xv=!1,this.tf=()=>{var t,i;this.Ti||(this.Hd=0,null===(t=this.ef)||void 0===t||t.onReconnect(),null===(i=this.if)||void 0===i||i.onReconnect())},this.Uv=!!(null===(e=t.get())||void 0===e?void 0:e.captureConsoleLogs)}get nf(){return!0}sf(){}rf(){if(!this.Xv){try{this.nv=typeof window>"u"?void 0:window}catch(t){this.nv=void 0}this.nv&&(Ur(this.nv,"online",this.tf),this.Xv=!0)}}af(t,i,e,s){this.rf();const n=sv(this.Ra.get(),e);return[new Ts(this.lf(t,i),n,this.zv,()=>this.Hv(),t=>t(),void 0,s),n]}uf(){const t=this.Ra.get();var i;return this.ef&&this.cf===t||(null===(i=this.ef)||void 0===i||i.reset(),this.cf=t,[this.ef,this.hf]=this.af(()=>this.sc,t=>{this.sc=t})),this.ef}df(){const t=this.Ra.get();var i;return this.if&&this.vf===t||(null===(i=this.if)||void 0===i||i.reset(),this.vf=t,[this.if,this.ff]=this.af(()=>this.Gv,t=>{this.Gv=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},ov)),this.if}setup(t){if(!this.Ti&&!this.Qv)return this.Qv=!0,this.Ma=t,this.R=t.logger.createLogger("[logs]"),cc(t.kv.initialize(),()=>{this.Ti||this.sv(t)})}sv(t){var i;this.rf(),(null===(i=this.Ra.get())||void 0===i?void 0:i.captureConsoleLogs)&&(this.Uv=!0),(this.Uv||this.Ra.remoteConfigWillArrive&&t.kv.get(this.Ra.captureHintKey))&&this.pf();let e=!1;const s=t.onRemoteConfig(t=>{var i;e=t.ok&&!0===(null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)});this.Ti?s.dispose():(this.Ua=s,e||this.loadIfEnabled())}dispose(){var t,i,e,s,n,r,o;this.Ti||(this.Ti=!0,this.gf(),null===(t=this.Ua)||void 0===t||t.dispose(),this.Ua=void 0,this.Ma=void 0,this.Vv=!1,null===(i=this.nv)||void 0===i||i.removeEventListener("online",this.tf),null===(e=this.mf)||void 0===e||e.call(this),this.mf=void 0,null===(s=this.ef)||void 0===s||s.clearQueue(),null===(n=this.if)||void 0===n||n.clearQueue(),null===(r=this.ef)||void 0===r||r.reset(),null===(o=this.if)||void 0===o||o.reset())}onRemoteConfig(t){var i,e;if(this.Ti)return;const s=t.ok?null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs:void 0;R(s)?this.yf():(null===(e=this.Ma)||void 0===e||e.kv.set(this.Ra.captureHintKey,!!s),s?(this.Uv=!0,this.Wv||this.pf(),this.loadIfEnabled()):this.yf())}reset(){var t,i,e,s;this.gf(),null===(t=this.ef)||void 0===t||t.clearQueue(),this.sc=[],null===(i=this.ef)||void 0===i||i.reset(),null===(e=this.if)||void 0===e||e.clearQueue(),this.Gv=[],null===(s=this.if)||void 0===s||s.reset(),this.Hd=0}captureLog(t){!this.Ti&&this.Ma&&this.uf().captureLog(t)}captureConsoleLog(t){!this.Ti&&this.Ma&&this.df().captureLog(t)}captureBufferedConsoleLog(t,i,e){!this.Ti&&this.Ma&&this.df().captureLog(t,{context:i,occurredAtMs:e})}Cd(){var t;this.gf(),null===(t=this.if)||void 0===t||t.clearQueue(),this.Gv=[]}yf(){this.Uv||this.gf()}pf(){var t;if(this.Kv||!(null===(t=this.nv)||void 0===t?void 0:t.console))return;const i=sv(this.Ra.get()).maxBufferSize;let e=!0;this.Zv.push(()=>{e=!1});for(const t of nv){let s;try{s=rv(this.nv.console[t])}catch(t){continue}s&&this.Zv.push(Hh(this.nv.console,t,n=>{const r=(...s)=>{try{e&&this.bf(t,s,i)}catch(t){}return n.apply(this.nv.console,s)};return r.__rrweb_original__=s,r}))}this.Kv=!0,this._f=setTimeout(()=>{this.gf()},3e4)}bf(t,i,e){var s;if(this.Kv&&!this.Yv&&0!==i.length)if(null===(s=this.Ma)||void 0===s?void 0:s.canCapture){if(e>this.Jv.length){this.Yv=!0;try{this.Jv.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Hv()})}finally{this.Yv=!1}}}else this.gf()}gf(){if(this.Jv=[],this.Kv){this.Kv=!1,this._f&&(clearTimeout(this._f),this._f=void 0);for(const t of this.Zv)t();this.Zv=[]}}wf(){const t=this.Jv;return this.gf(),t}get logger(){return this.kf||(this.kf={trace:(t,i)=>this.captureLog({body:t,level:"trace",attributes:i}),debug:(t,i)=>this.captureLog({body:t,level:"debug",attributes:i}),info:(t,i)=>this.captureLog({body:t,level:"info",attributes:i}),warn:(t,i)=>this.captureLog({body:t,level:"warn",attributes:i}),error:(t,i)=>this.captureLog({body:t,level:"error",attributes:i}),fatal:(t,i)=>this.captureLog({body:t,level:"fatal",attributes:i})}),this.kf}flushLogs(t){this.Ma&&(t?this.Sf(t):(this.ef&&this.ef.flush().catch(t=>this.xf(t)),this.if&&this.if.flush().catch(t=>this.xf(t))))}flush(){var t=this;return J(function*(){var i,e;const s=null===(i=t.ef)||void 0===i?void 0:i.flush().catch(i=>t.xf(i)),n=null===(e=t.if)||void 0===e?void 0:e.flush().catch(i=>t.xf(i));yield s,yield n})()}xf(t){uv(t)||this.R.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Ti||!this.Uv||this.Wv||this.Vv)return;const t=this.sf();if(t){this.Vv=!0;try{t((t,i)=>{if(this.Vv=!1,!this.Ti&&this.Uv)if(t||!i)this.R.error("Could not load logs script",t),this.gf();else{const t=this.wf();this.mf=i.initialize(this.Ma),this.Wv=!0,t.length>0&&i.replay(this.Ma,t)}})}catch(t){throw this.Vv=!1,t}}else this.gf()}lf(t,i){const e=this.Ma;return{get isDisabled(){return!1},get optedOut(){return!e.canCapture},getPersistedProperty:i=>i===f.LogsQueue?t():void 0,setPersistedProperty(t,e){t===f.LogsQueue&&i(null!=e?e:[])},qs:t=>this.qs(t),getLibraryId:()=>e.library.name,getLibraryVersion:()=>e.library.version}}qs(t){return new Promise(i=>{if(Pl(this.Hd,3))return void i({kind:"fatal",error:av(void 0,"logs endpoint is unreachable, dropping batch")});let e=!1;const s=t=>{e||(e=!0,clearTimeout(n),i(t))},n=setTimeout(()=>{this.R.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:av(void 0,"logs request timed out")})},9e4),r=this.nf;this.Ma.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.Ma.projectToken},body:t,compression:"best-available",timeoutMs:6e4}).then(t=>{var i;const e=t.statusCode;this.$f(e,r),e>=200&&300>e?s({kind:"ok"}):413===e?s({kind:"too-large"}):0!==e&&408!==e&&429!==e&&500>e?s({kind:"fatal",error:new Error(`logs request failed with status ${e}`)}):0===e?(t.error||this.R.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:av(t.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`logs request failed with status ${e}`)})},t=>{s({kind:"retry-later",error:t})})})}$f(t,i){(0!==t||i)&&(this.Hd=Cl(t,this.Hd,3,()=>this.R.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.")))}Sf(t){this.sc.length>0&&this.Cf(t,this.sc,this.hf,this.Ma.library.name,t=>{this.sc=t}),this.Gv.length>0&&this.Cf(t,this.Gv,this.ff,ov,t=>{this.Gv=t})}Cf(t,i,e,s,n){if(0===i.length)return;const r=i.map(t=>t.record);n([]);const o=xs(r,$s(e,this.Ma.library.name,this.Ma.library.version),s,this.Ma.library.version);this.Ma.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.Ma.projectToken},body:o,compression:"best-available",transport:t,timeoutMs:6e4}).catch(t=>this.xf(t))}};const cv=Ns("[NetworkMetrics]"),dv={"http:":80,"https:":443},vv=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),fv=(t,i)=>{var e;const s=String(i);return{method:String(t).toUpperCase(),url:(null===(e=El(s))||void 0===e?void 0:e.href)||s}},pv=(t,i,e,s,n,r,o=!1)=>{try{var l,a;const u=n();if(!u)return;const h=e||void 0,c=vh()-s,d=El(i.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||i.url,method:i.method},f=T(u.name)?u.name(v):F(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=o&&!h?void 0:((t,i)=>t?400>t?void 0:String(t):(null==i?void 0:i.name)||"_OTHER")(h,r),g=bi(bi(bi(bi(bi({},(t=>{const i=vv.has(t)?t:"_OTHER";return bi({"http.request.method":i},"_OTHER"===i&&t!==i?{"http.request.method_original":t}:{})})(v.method)),d?(t=>{return{"server.address":t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,"server.port":Number(t.port)||dv[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(i=t.pathname,i.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/"))};var i})(d):{}),h?{"http.response.status_code":h}:{}),p?{"error.type":p}:{}),null===(l=u.attributes)||void 0===l?void 0:l.call(u,v,{status:h,durationMs:c}));null===(a=t.metrics)||void 0===a||a.histogram(f,c,{unit:"ms",attributes:g})}catch(t){cv.error("Failed to record network metric",t)}},gv=()=>{},_v=(i,e)=>T(null==t?void 0:t.fetch)?Hh(t,"fetch",t=>function(...s){const n=vh(),r=t.apply(this,s);if(!e())return r;try{var o,l,a;const[t,u]=s,h=fv(null!==(o=null!==(l=null==u?void 0:u.method)&&void 0!==l?l:null==t?void 0:t.method)&&void 0!==o?o:"GET",null!==(a=null==t?void 0:t.url)&&void 0!==a?a:t);return r.then(t=>(pv(i,h,null==t?void 0:t.status,n,e,void 0,!0),t),t=>{throw pv(i,h,void 0,n,e,t),t})}catch(t){return cv.error("Failed to observe fetch",t),r}}):gv,mv=(i,e)=>{var s;const n=null==t||null===(s=t.XMLHttpRequest)||void 0===s?void 0:s.prototype;if(!n)return gv;const r=new WeakMap,o=Hh(n,"open",t=>function(...i){try{(()=>iu.has(this))()||r.set(this,fv(i[0],i[1]))}catch(t){cv.error("Failed to observe XHR open",t)}return t.apply(this,i)}),l=Hh(n,"send",t=>function(...s){let n;try{const t=r.get(this);if(t&&e()){const s=vh();n=()=>{this.removeEventListener("loadend",n),pv(i,t,this.status,s,e)},Ur(this,"loadend",n)}}catch(t){cv.error("Failed to observe XHR send",t)}try{return t.apply(this,s)}catch(t){throw n&&this.removeEventListener("loadend",n),t}});return()=>{o(),l()}},yv=new WeakMap,bv=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),wv={maxStringLength:2048,truncationSuffix:"..."},$v={maxStringLength:2048,truncationSuffix:"..."};function xv(t){if(t)return!0===t?{intent:!0,model:!0}:{intent:!1!==t.intent,model:!1!==t.model}}function Sv(t,i){return{}.hasOwnProperty.call(t,i)}function kv(t,i){const e=Object.create(t);return i&&Object.defineProperty(e,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:i}),e}function Ev(t,i,e=!1){if(!F(t))return;const s=t.trim();return s?(e?os(s,wv):s).slice(0,i):void 0}function Tv(t){try{return P(t)&&!0===t.isError}catch(t){return!1}}function Pv(t){return os(t||"Unknown error",$v).slice(0,2048)}function Cv(t,i){try{return Pv(i?function(t){try{if(!P(t)||!E(t.content))return;return t.content.filter(t=>P(t)&&"text"===t.type&&F(t.text)).map(t=>t.text).join(" ").trim()||void 0}catch(t){return}}(t):P(t)&&F(t.message)?t.message:F(t)?t:String(t))}catch(t){return"Unknown error"}}function Av(t,i,e){return i.errorResult?[{type:"Error",value:e,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:t.buildProperties(i.error,{handled:!0}).$exception_list.map(t=>bi(bi({},t),{},{value:Pv(t.value)}))}function Fv(t,i){if(i)return"Error";try{if(!P(t))return"Error";let i=F(t.name)?t.name.trim():"";const e=t.constructor;return i&&"Error"!==i||!T(e)||"Error"===e.name||(i=e.name),(i||"Error").slice(0,256)}catch(t){return"Error"}}function Ov(t,i){return{message:Cv(t,i),type:Fv(t,i)}}jh.__defaultExtensionClasses=bi({},((...t)=>Ir({},...t))({featureFlags:Fc},{sessionRecording:class{get Fr(){return this._instance.config}get Tc(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.Tf)||void 0===t?void 0:t.isStarted)}get status(){var t,i;return"awaiting_config"===this.If||"missing_config"===this.If?this.If:null!==(t=null===(i=this.Tf)||void 0===i?void 0:i.status)&&void 0!==t?t:this.If}constructor(i){if(this._instance=i,this._forceAllowLocalhostNetworkCapture=!1,this.If=Yh,this.Mf=void 0,this.Ef=!1,this.Ye=(()=>{var i,e;if(!(null==s?void 0:s.visibilityState)||"visible"===s.visibilityState)return!0;const n=null==t||null===(i=t.performance)||void 0===i||null===(e=i.getEntriesByType)||void 0===e?void 0:e.call(i,"visibility-state");return!(null==n?void 0:n.length)||n.some(t=>"visible"===t.name)})(),this.an=()=>{var t,i;"visible"===(null==s?void 0:s.visibilityState)&&(this.Ye=!0,null===(t=this.Tf)||void 0===t||null===(i=t.setDocumentWasEverVisible)||void 0===i||i.call(t,!0))},!this._instance.sessionManager)throw Xh.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Fr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==s?void 0:s.addEventListener)&&Ur(s,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var i;this.Ef=!0,null==s||null===(i=s.removeEventListener)||void 0===i||i.call(s,"visibilitychange",this.an),t?this.Af(!0):this.stopRecording()}get Rf(){var i;const e=!!(null===(i=this._instance.get_property("$session_recording_remote_config"))||void 0===i?void 0:i.enabled),s=!this.Fr.disable_session_recording,n=this.Fr.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&s&&!n}startIfEnabledOrStop(t){var i;if(this.Ef)return;if(this.Rf&&(null===(i=this.Tf)||void 0===i?void 0:i.isStarted))return;const e=!A(Object.assign)&&!A(Array.from);this.Rf&&e?(this.Pf(t),Xh.info("starting")):(this.If=Yh,this.stopRecording())}Pf(t){var i,e;if(this.Rf)if("awaiting_config"!==this.If&&"missing_config"!==this.If&&(this.If=Zh),(null==c||null===(i=c.__PosthogExtensions__)||void 0===i||null===(i=i.rrweb)||void 0===i?void 0:i.record)&&(null===(e=c.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))this.Of(t);else{var s,n;const i=this._instance.sessionManager;null===(s=c.__PosthogExtensions__)||void 0===s||null===(n=s.loadExternalDependency)||void 0===n||n.call(s,this._instance,this.Ff,e=>{if(!this.Ef&&this.Rf&&this._instance.sessionManager===i)return e?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Xh.error("could not load recorder",e)):void this.Of(t);this.If="disabled"})}}stopRecording(){var t,i;null===(t=this.Mf)||void 0===t||t.call(this),this.Mf=void 0,null===(i=this.Tf)||void 0===i||i.stop()}Af(t=!1){var i,e;null===(i=this.Mf)||void 0===i||i.call(this),this.Mf=void 0,null===(e=this.Tf)||void 0===e||e.discard({discardProducerEvents:t})}Df(){var t,i;null===(t=this.Tc)||void 0===t||t.unregister("$session_is_sampled"),null===(i=this.Tc)||void 0===i||i.unregister("$replay_sample_rate")}Lf(t,i){if(R(t))return null;const e=I(t)?t:parseFloat(t);return"number"!=typeof(s=e)||!Number.isFinite(s)||0>s||s>1?(Xh.warn(`${i} must be between 0 and 1. Ignoring invalid value:`,t),null):e;var s}Nf(t){if(this.Tc){var i,e;const s=this.Tc,n=()=>{var i;const e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Lf(null===(i=this.Fr.session_recording)||void 0===i?void 0:i.sampleRate,"session_recording.sampleRate"),r=this.Lf(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=n?n:r;R(o)&&this.Df();const l=null==e?void 0:e.minimumDurationMilliseconds;s.register({[Dn]:bi(bi({cache_timestamp:Date.now(),enabled:!!e},e),{},{networkPayloadCapture:bi({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:o,minimumDurationMilliseconds:A(l)?null:l,endpoint:null==e?void 0:e.endpoint,triggerMatchType:null==e?void 0:e.triggerMatchType,masking:null==e?void 0:e.masking,urlTriggers:null==e?void 0:e.urlTriggers,version:null==e?void 0:e.version,triggerGroups:null==e?void 0:e.triggerGroups})})};n(),null===(i=this.Mf)||void 0===i||i.call(this),this.Mf=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.onSessionId(n)}}onRemoteConfig(t){const i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.Nf(i),void this.Af()):(this.Nf(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.If&&(this.If="missing_config",this._instance.register_for_session({[gr]:!0}),Xh.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i="log"){var e;(null===(e=this.Tf)||void 0===e?void 0:e.log)?this.Tf.log(t,i):Xh.warn("log called before recorder was ready")}get Ff(){var t,i;const e=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(Dn);return(null==e||null===(i=e.scriptConfig)||void 0===i?void 0:i.script)||"lazy-recorder"}jf(){const t=this._instance.get_property(Dn);if(!t)return!1;let i;try{i="object"==typeof t?t:JSON.parse(t)}catch(t){return Xh.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!R(i.cache_timestamp)&&36e5>=Date.now()-i.cache_timestamp}Of(t){var i,e,s;if(!this.Ef&&this.Rf&&this._instance.sessionManager){if(!(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))return Xh.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[pr]:!0});var n;if(this.Tf||(this.Tf=null===(n=c.__PosthogExtensions__)||void 0===n?void 0:n.initSessionRecording(this._instance,this.Ye),this.Tf._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.jf()){if("missing_config"===this.If||"awaiting_config"===this.If)return;return this.If="awaiting_config",Xh.info("persisted remote config is stale, requesting fresh config before starting"),void new ba(this._instance).load()}this.If=Zh,null===(e=(s=this.Tf).setDocumentWasEverVisible)||void 0===e||e.call(s,this.Ye),this.Tf.start(t)}else this.If=Yh}onRRwebEmit(t){var i,e;null===(i=this.Tf)||void 0===i||null===(e=i.onRRwebEmit)||void 0===e||e.call(i,t)}overrideLinkedFlag(){var t,i;this.Tf||null===(i=this.Tc)||void 0===i||i.register({$replay_override_linked_flag:!0}),null===(t=this.Tf)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.Tf||null===(i=this.Tc)||void 0===i||i.register({$replay_override_sampling:!0}),null===(t=this.Tf)||void 0===t||t.overrideSampling()}overrideTrigger(t){var i,e;this.Tf||null===(e=this.Tc)||void 0===e||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(i=this.Tf)||void 0===i||i.overrideTrigger(t)}get sdkDebugProperties(){var t;const i={};for(const t of Qh){var e;const s=null===(e=this._instance.sessionPersistence)||void 0===e?void 0:e.get_property(t);A(s)||(i[t]=s)}return bi(bi({},i),(null===(t=this.Tf)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,i){var e;return!!(null===(e=this.Tf)||void 0===e?void 0:e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t,i;null===(t=this.Tf)||void 0===t||null===(i=t.flushBeforeIdentityReset)||void 0===i||i.call(t)}}},{autocapture:class extends hh{constructor(t){super(new Nh(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.qf=!1,this._instance=t,this.Bf=this.zf()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Hf();return!!(t.path||t.search||this.Uf(t))}startIfEnabled(){this.isEnabled&&(Ls.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Bf=this.zf(),this.startIfEnabled()}stop(){this.Wf&&this.Wf(),this.Wf=void 0,this.Vf&&this.Vf(),this.Vf=void 0,Ls.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.Gf("pushState"),this.Gf("replaceState"),this.Qf(),this.Uf()&&this.Jf())}Gf(i){var e;if(!t||(null===(e=t.history[i])||void 0===e?void 0:e.__posthog_wrapped__))return;const s=this;Hh(t.history,i,e=>function(n,r,o){var l;s.Zf(o)&&s.Kf(),e.call(this,n,r,o),s.Yf(i,!s.qf&&"popstate"!==(null==t||null===(l=t.event)||void 0===l?void 0:l.type))})}zf(){const i=null==t?void 0:t.location;if(null==i?void 0:i.pathname)return{pathname:i.pathname,search:i.search,hash:i.hash}}Hf(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:P(t)?t:{}}Uf(t=this.Hf()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Xf(t){const i=this.Hf(),e=this.Bf;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.Uf(i)&&t.hash!==e.hash))}Yf(t,i=!1){try{i||this.Kf();const e=this.zf();if(!e)return;if(this.Xf(e)){const e=()=>this._instance.capture(Cr,{navigation_type:t});i?(this.tp=e,Promise.resolve().then(()=>this.Kf())):e()}this.Bf=e}catch(i){Ls.error(`Error capturing ${t} pageview`,i)}}Zf(i){var e,s;return!(R(i)||!t)&&(null===(e=El(String(i)))||void 0===e?void 0:e.href)!==(null===(s=t.location)||void 0===s?void 0:s.href)}Kf(){const t=this.tp;if(t){this.tp=void 0,this.qf=!0;try{t()}catch(t){Ls.error("Error capturing deferred pageview",t)}finally{this.qf=!1}this.Bf=this.zf()}}Qf(){if(this.Wf)return;const i=()=>{this.Yf("popstate")};Ur(t,"popstate",i),this.Wf=()=>{t&&t.removeEventListener("popstate",i)}}Jf(){if(this.Vf)return;const i=()=>{this.Yf("hashchange")};Ur(t,"hashchange",i),this.Vf=()=>{t&&t.removeEventListener("hashchange",i)}}},heatmaps:class{get Fr(){return this.instance.config}constructor(t){var i;this.ep=!1,this.fl=!1,this.np=null,this.instance=t,this.ep=!!(null===(i=this.instance.persistence)||void 0===i?void 0:i.props[Tn]),this.rageclicks=new th(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return P(this.Fr.capture_heatmaps)&&this.Fr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Fr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return R(this.Fr.capture_heatmaps)?R(this.Fr.enable_heatmaps)?this.ep:this.Fr.enable_heatmaps:!1!==this.Fr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.fl)return;tc.info("starting..."),this.sp(),this.an()}else{var t;clearInterval(null!==(t=this.np)&&void 0!==t?t:void 0),this.rp(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("heatmaps"in i))return;const e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Tn]:e}),this.ep=e,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}op(t){ic(t.originalEvent)&&this.Pr(t.originalEvent,"deadclick")}an(){this.np&&clearInterval(this.np),this.np=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(s)?setInterval(this.dc.bind(this),this.flushIntervalMilliseconds):null}sp(){t&&s&&(this.ap=this.dc.bind(this),Ur(t,Pr,this.ap),this.lp=i=>this.Pr(i||(null==t?void 0:t.event)),Ur(s,"click",this.lp,{capture:!0}),this.up=i=>this.cp(i||(null==t?void 0:t.event)),Ur(s,"mousemove",this.up,{capture:!0}),this.hp=new fl(this.instance,dl,this.op.bind(this)),this.hp.startIfEnabledOrStop(),this.dp=this.an.bind(this),Ur(s,an,this.dp),this.fl=!0)}rp(){var i;t&&s&&(this.ap&&t.removeEventListener(Pr,this.ap),this.lp&&s.removeEventListener("click",this.lp,{capture:!0}),this.up&&s.removeEventListener("mousemove",this.up,{capture:!0}),this.dp&&s.removeEventListener(an,this.dp),clearTimeout(this.vp),null===(i=this.hp)||void 0===i||i.stop(),this.fl=!1)}fp(i,e){const s=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(i,e,s){let n=i;for(;n&&xo(n)&&!So(n,"body");){if(n===s)return!1;let i;try{var r,o,l;i=null===(r=null!==(o=null===(l=n.ownerDocument)||void 0===l?void 0:l.defaultView)&&void 0!==o?o:t)||void 0===r?void 0:r.getComputedStyle(n).position}catch(t){return!1}if(m(e,i))return!0;n=Do(n)}return!1}(Oo(i),["fixed","sticky"],r);return{x:i.clientX+(o?0:n),y:i.clientY+(o?0:s),target_fixed:o,type:e}}Pr(t,i="click"){var e;if($o(t.target)||!ic(t))return;const s=this.fp(t,i);(null===(e=this.rageclicks)||void 0===e?void 0:e.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&Ko(Oo(t),this.instance.config.rageclick)&&this.Qs(bi(bi({},s),{},{type:"rageclick"})),this.Qs(s)}cp(t){!$o(t.target)&&ic(t)&&(clearTimeout(this.vp),this.vp=setTimeout(()=>{this.Qs(this.fp(t,"mousemove"))},500))}Qs(i){if(!t)return;const e=this.Fr.disable_capture_url_hashes?di(t.location.href):t.location.href,s=this.Fr.custom_personal_data_properties,n=this.Fr.mask_personal_data_properties?[...Rl,...s||[]]:[],r=Ol(e,n,Dl);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(i)}dc(){this.Rt&&!C(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:fl,webVitalsAutocapture:class{constructor(i){var e;this._instance=i,this.ep=!1,this.fl=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.pp=(t=!1)=>{clearTimeout(this.gp),this.gp=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",bi({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,i)=>bi(bi({},t),{},{[`$web_vitals_${i.name}_event`]:bi({},i),[`$web_vitals_${i.name}_value`]:i.value}),{})),t?{transport:"sendBeacon",send_instantly:!0}:void 0),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.mp=t=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},R(null==t?void 0:t.name)||R(null==t?void 0:t.value))return void Wh.error("Invalid metric received",t);const e="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.yp(e);if(A(s))return;const n=I(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${s}`;if(this.bp&&t.value>=this.bp)return void Wh.error("Ignoring metric with value >= "+this.bp,t);this.Rt.navigationKey!==n&&(this.pp(),this.gp=setTimeout(this.pp,this.flushToCaptureTimeoutMs)),A(this.Rt.navigationKey)&&(this.Rt.navigationKey=n,this.Rt.url=s),this.Rt.firstMetricTimestamp=A(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.checkAndGetSessionAndWindowId(!0),o=bi(bi(bi({},t),e?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,P(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const i={};for(const e of Jh){const s="url"===e&&"string"==typeof t.attribution[e]?this.yp(t.attribution[e]):t.attribution[e];A(s)||(i[e]=s)}o.attribution=i}else delete o.attribution;A(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.pp()},this._p=()=>{if(this.fl)return;let i,e,s,n,r=!1;const o=c.__PosthogExtensions__,l=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,a=(null==l?void 0:l[this.wp])||("web-vitals"===this.wp&&A(l)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!A(a)){const t=a.withoutAttribution,o=this.attributionMetrics;r=!A(t),i=o.indexOf("LCP")>-1?a.onLCP:(null==t?void 0:t.onLCP)||a.onLCP,e=o.indexOf("CLS")>-1?a.onCLS:(null==t?void 0:t.onCLS)||a.onCLS,s=o.indexOf("FCP")>-1?a.onFCP:(null==t?void 0:t.onFCP)||a.onFCP,n=o.indexOf("INP")>-1?a.onINP:(null==t?void 0:t.onINP)||a.onINP}if(!(i&&e&&s&&n))return void Wh.error("web vitals callbacks not loaded - not starting");const u={reportSoftNavs:this.useSoftNavs},h=r&&this.attributionMetrics.indexOf("INP")>-1?bi(bi({},u),{},{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&i(this.mp.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&e(this.mp.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&s(this.mp.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&n(this.mp.bind(this),h);const d=null==t?void 0:t.document;Ur(d,an,()=>{"hidden"===(null==d?void 0:d.visibilityState)&&this.pp(!0)}),Ur(t,"pagehide",()=>this.pp(!0)),this.fl=!0},this.ep=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[Fn]),this.startIfEnabled()}get kp(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i;const e=P(this.kp)?null===(t=this.kp)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return R(e)?(null===(i=this._instance.persistence)||void 0===i?void 0:i.props.$web_vitals_allowed_metrics)||Gh:e}get flushToCaptureTimeoutMs(){return(P(this.kp)?this.kp.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=P(this.kp)?this.kp.web_vitals_attribution:void 0;return j(t)?t?Gh:[]:E(t)?t:Kh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=P(this.kp)?this.kp.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get bp(){const t=P(this.kp)&&I(this.kp.__web_vitals_max_value)?this.kp.__web_vitals_max_value:Vh;return t>0&&6e4>=t?Vh:t}get isEnabled(){const t=null==n?void 0:n.protocol;if("http:"!==t&&"https:"!==t)return Wh.info("Web Vitals are disabled on non-http/https protocols"),!1;const i=P(this.kp)?this.kp.web_vitals:j(this.kp)?this.kp:void 0;return j(i)?i:this.ep}startIfEnabled(){this.isEnabled&&!this.fl&&(Wh.info("enabled, starting..."),this.Fl(this._p))}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("capturePerformance"in i))return;const e=P(i.capturePerformance)&&!!i.capturePerformance.web_vitals,s=P(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Fn]:e}),this._instance.persistence.register({[In]:s})),this.ep=e,this.startIfEnabled()}get wp(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Fl(t){var i;const e=c.__PosthogExtensions__,s=this.wp,n=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&A(n)&&(null==e?void 0:e.postHogWebVitalsCallbacks)?t():null==e||null===(i=e.loadExternalDependency)||void 0===i||i.call(e,this._instance,s,i=>{i?Wh.error("failed to load script",i):t()})}yp(i){const e=i||(null==t?void 0:t.location.href);if(!e)return void Wh.error("Could not determine current URL");const s=this._instance.config.disable_capture_url_hashes?di(e):e,n=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Rl,...n||[]]:[];return Ol(s,r,Dl)}}},{exceptionObserver:class{constructor(i){var e;this._p=()=>{var i;if(!t||!this.isEnabled||!(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.errorWrappingFunctions))return;const e=c.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=c.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=c.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Sp&&this.Fr.capture_unhandled_errors&&(this.Sp=e(this.captureException.bind(this))),!this.xp&&this.Fr.capture_unhandled_rejections&&(this.xp=s(this.captureException.bind(this))),!this.$p&&this.Fr.capture_console_errors&&(this.$p=n(this.captureException.bind(this)))}catch(t){zh.error("failed to start",t),this.Cp()}},this._instance=i,this.Tp=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[Pn]),this.kt=new tt(bi(bi({},function(t={}){var i,e,s,n;return{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=null!==(n=t.exceptionRateLimiterBucketSize)&&void 0!==n?n:t.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,R:zh})),this.Fr=this.Ip(),this.startIfEnabledOrStop()}Ip(){const t=this._instance.config.capture_exceptions;let i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return P(t)?i=bi(bi({},i),t):(A(t)?this.Tp:t)&&(i=bi(bi({},i),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Fr.capture_console_errors||this.Fr.capture_unhandled_errors||this.Fr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(zh.info("enabled"),this.Cp(),this.Fl(this._p)):this.Cp()}Fl(t){var i,e,s;(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.errorWrappingFunctions)?t():null===(e=c.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"exception-autocapture",i=>{if(i)return zh.error("failed to load script",i);t()})}Cp(){var t,i,e;null===(t=this.Sp)||void 0===t||t.call(this),this.Sp=void 0,null===(i=this.xp)||void 0===i||i.call(this),this.xp=void 0,null===(e=this.$p)||void 0===e||e.call(this),this.$p=void 0}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"autocaptureExceptions"in i&&(this.Tp=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Pn]:this.Tp}),this.Fr=this.Ip(),this.startIfEnabledOrStop())}onConfigChange(){this.Fr=this.Ip()}captureException(t){try{var i,e,s;const n=null!==(i=null==t||null===(e=t.$exception_list)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.type)&&void 0!==i?i:"Exception";if(this.kt.consumeRateLimit(n))return void zh.info("Skipping exception capture because of client rate limiting.",{exception:n});null===(s=this._instance.exceptions)||void 0===s||s.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var i,e;this.Mp=[],this.Ep=new Ti([new Ki,new ne,new Yi,new Ji,new ee,new ie,new Xi,new se],function(t,...i){return(e,s=0)=>{const n=[],r=e.split("\n"),o=Math.min(r.length,s+1e3),l=[];for(let e=s;o>e;e++){const s=r[e];if(s.length>1024)continue;const o=zi.test(s)?s.replace(zi,"$1"):s;if(!o.match(/\S*Error: /)){for(const e of i){const i=e(o,t);if(i){n.push(i);const t=Ui(n);if(t){for(let i=l.length-1;i>=0;i--){const e=l[i];if(t.start>=e.start+e.length)break;l.pop()}l.push(t)}break}}if(Vi(n,l)>=50)break}}const a=[...l].sort((t,i)=>i.start-t.start),u=a[a.length-1];if(u){const t=qi(n,u);n.splice(u.start-t,t);for(const i of a)i.start-=t}for(const t of a)Hi(n,t);return l.some(t=>0===t.start&&n.length===t.length)&&function(t){const i=t.map(t=>`${t.function}|${t.filename}|${t.lineno}|${t.colno}|${t.module}`);let e=0;for(let t=1;i.length>t;t++)Gi(i,t,e)&&(e=t);t.push(...t.splice(0,e))}(n),function(t){if(!t.length)return[];const i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return bi(bi({},t),{},{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",Di,Ni)),this._instance=t,this.Mp=null!==(i=null===(e=this._instance.persistence)||void 0===e?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this.Ap=ue(this.Rp()),this.Pp=new he(this.Ap)}onConfigChange(){this.Ap=ue(this.Rp()),this.Pp.setConfig(this.Ap)}onRemoteConfig(t){var i,e,s;if(!t.ok)return;const n=t.config;if(!("errorTracking"in n))return;const r=null!==(i=null===(e=n.errorTracking)||void 0===e?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null===(s=n.errorTracking)||void 0===s?void 0:s.captureExtensionExceptions;this.Mp=r,this._instance.persistence&&this._instance.persistence.register({[Cn]:this.Mp,[An]:o})}get Op(){var t;const i=!!this._instance.get_property(An),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.Ep.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.Ap.enabled)try{if(!F(t)||0===t.trim().length)return void Mc.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:e,droppedKeys:s}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};const i=[];return{sanitizedProperties:Object.keys(t).reduce((e,s)=>le.has(s)?(i.push(s),e):(e[s]=t[s],e),{}),droppedKeys:i}}(this.Fp(i));s.length>0&&Mc.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Pp.add(bi({[re]:t,[oe]:(new Date).toISOString()},e))}catch(t){Mc.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const i=t.$exception_list;if(this.Dp(i)){if(this.Lp(i))return this.Np("Exception dropped: matched a suppression rule"),void Mc.info("Skipping exception capture because a suppression rule matched");if(!this.Op&&this.jp(i))return this.Np("Exception dropped: thrown by a browser extension"),void Mc.info("Skipping exception capture because it was thrown by an extension");if(!this.Op&&this.qp(i))return this.Np("Exception dropped: thrown by an injected browser script"),void Mc.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Bp(i))return this.Np("Exception dropped: thrown by the PostHog SDK"),void Mc.info("Skipping exception capture because it was thrown by the PostHog SDK")}const e=this.Ap.enabled&&R(t.$exception_steps)?this.zp(t):t,s=function(){if("u">typeof process){var t;const i=null===(t=process.env.POSTHOG_RELEASE_ID)||void 0===t?void 0:t.trim();if(i)return i}const i=globalThis._posthogReleaseId;return"string"==typeof i&&i.length>0?i:void 0}();s&&(e.$release_id=s);try{const t=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",fd:!0});return t&&this.Pp.clear(),t}catch(t){return Oc(t)||Mc.error("Failed to capture exception event. Dropping this exception.",t),void this.Pp.clear()}}catch(t){return void(Oc(t)||Mc.error("Failed to process exception event. Ignoring this exception.",t))}}zp(t){try{const i=this.Pp.getAttachable();return 0===i.length?t:bi(bi({},t),{},{$exception_steps:i})}catch(i){return Mc.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Np(t){this.Ap.enabled&&this.Pp.add({[re]:t,[oe]:(new Date).toISOString()})}Fp(t){return P(t)?bi({},t):{}}Rp(){var t,i;return null!==(t=null===(i=this._instance.config.error_tracking)||void 0===i?void 0:i.exception_steps)&&void 0!==t?t:{}}Lp(t){if(0===t.length)return!1;try{const i=t.reduce((t,{type:i,value:e})=>(F(i)&&i.length>0&&t.$exception_types.push(i),F(e)&&e.length>0&&t.$exception_values.push(e),t),{$exception_types:[],$exception_values:[]});return this.Mp.some(t=>{const e=t.values.map(t=>{const e=Nu[t.operator],s=i[t.key];if(!e||!s)return!1;const n=E(t.value)?t.value:[t.value];return n.length>0&&e(n,s)});return"OR"===t.type?e.some(Boolean):e.every(Boolean)})}catch(t){return Mc.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}jp(t){const i=t.flatMap(t=>{var i,e;return null!==(i=null===(e=t.stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[]}),e=i.filter(({filename:t})=>!!t&&Dc.some(i=>t.startsWith(i)));return 0!==e.length&&(!e.every(({filename:t})=>!!t&&t.startsWith(Rc))||t.some(({type:t,value:i})=>"NoResponse"===t||F(i)&&Ic.some(({value:t,exact:e})=>e?i===t:i.includes(t)))&&!i.some(({in_app:t,filename:i})=>t&&!(null==i?void 0:i.startsWith(Rc))))}qp(t){return t.some(({value:t})=>F(t)&&jc.some(i=>t.includes(i)))}Bp(t){if(t.length>0){var i,e,s,n;const r=null!==(i=null===(e=t[0].stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[],o=r[r.length-1];return null!==(s=null==o||null===(n=o.filename)||void 0===n?void 0:n.includes("posthog.com/static"))&&void 0!==s&&s}return!1}Dp(t){return!R(t)&&E(t)}}},{productTours:class{get Tc(){return this._instance.persistence}constructor(t){this.Hp=null,this.Up=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if("productTours"in i){var e,s;if(this.Tc&&this.Tc.register({[Mn]:!!i.productTours}),!sc(this._instance))return!this.Hp&&R(null===(e=this.Tc)||void 0===e?void 0:e.props.ph_product_tours)||ec.info("product tours disabled; stopping and clearing cached tours"),null===(s=this.Hp)||void 0===s||s.stop(),this.Hp=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Hp&&sc(this._instance)&&this.Fl(()=>this.Wp())}Fl(t){var i,e,s;(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.generateProductTours)?t():null===(e=c.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"product-tours",i=>{i?ec.error("Could not load product tours script",i):t()})}Wp(){var t;!this.Hp&&(null===(t=c.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.Hp=c.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i=!1){if(E(this.Up)&&!i)return void t(this.Up,{isLoaded:!0});const e=this.Tc;if(e){const s=e.props[Zn];if(E(s)&&!i)return this.Up=s,void t(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:i=>{if(!sc(this._instance))return void t([],{isLoaded:!0});const s=i.statusCode;if(200!==s||!i.json){const e=`Product Tours API could not be loaded, status: ${s}`;return 0===s?i.error||ec.warn(e):ec.error(e),void t([],{isLoaded:!1,error:e})}const n=E(i.json.product_tours)?i.json.product_tours:[];this.Up=n,e&&e.register({[Zn]:n}),t(n,{isLoaded:!0})}})}getActiveProductTours(t){R(this.Hp)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Hp.getActiveProductTours(t)}showProductTour(t){var i;null===(i=this.Hp)||void 0===i||i.showTourById(t)}previewTour(t){this.Hp?this.Hp.previewTour(t):this.Fl(()=>{var i;this.Wp(),null===(i=this.Hp)||void 0===i||i.previewTour(t)})}dismissProductTour(){var t;null===(t=this.Hp)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.Hp)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.Hp)||void 0===t||t.previousStep()}clearCache(){var t;this.Up=null,null===(t=this.Tc)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var i;null===(i=this.Hp)||void 0===i||i.resetTour(t)}resetAllTours(){var t;null===(t=this.Hp)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var i;null===(i=this.Hp)||void 0===i||i.cancelPendingTour(t)}},featureFlags:Fc},{siteApps:class{constructor(t){this._instance=t,this.Vp=0,this.Gp=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Qp(t,i){if(!i)return;const e=this.globalsForEvent(i);this.Gp.push(e),this.Gp.length>1e3&&(this.Gp=this.Gp.slice(10))}get siteAppLoaders(){var t;return null===(t=c._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.Qp.bind(this));this.Jp=()=>{t(),this.Gp=[],this.Jp=void 0}}}globalsForEvent(t){var i,e,s,n,r,o,l;if(!t)throw new Error("Event payload is required");const a={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(const[t,i]of Object.entries(h))a[t]={id:u[t],type:t,properties:i};const{$set_once:c,$set:d}=t;return{event:bi(bi({},Se(t,nc)),{},{properties:bi(bi(bi({},t.properties),d?{$set:bi(bi({},null!==(i=null===(e=t.properties)||void 0===e?void 0:e.$set)&&void 0!==i?i:{}),d)}:{}),c?{$set_once:bi(bi({},null!==(s=null===(n=t.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),c)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(l=t.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:a}}Zp(t){var i;const e=null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase();if("style"===e&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(t)||(rc.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===e&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(t)||(rc.error("prepare_external_dependency_script returned null"),null)}return t}Kp(){var t,i,e,n,r,o,l,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const u=null==s?void 0:s.defaultView,h=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!h)return()=>{};if(this.Vp++,this.Yp)return this.Xp();const c=[],d=this,v=new WeakSet,f=(t,i,e)=>{if(!(null==t?void 0:t[i]))return;const s=t[i];t[i]=e(s),c.push(()=>{t[i]=s})},p=t=>{if(v.has(t))return t;const i=d.Zp(t);return i&&v.add(i),i},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!M(t));return f(h,"appendChild",t=>function(i){const e=p(i);return e?t.call(this,e):i}),f(h,"insertBefore",t=>function(i,e){const s=p(i);return s?t.call(this,s,e):i}),f(h,"replaceChild",t=>function(i,e){const s=p(i);return s?t.call(this,s,e):e}),[null===(i=u.Element)||void 0===i?void 0:i.prototype,null===(e=u.Document)||void 0===e?void 0:e.prototype,null===(n=u.DocumentFragment)||void 0===n?void 0:n.prototype].forEach(t=>{f(t,"append",t=>function(...i){return t.apply(this,g(i))}),f(t,"prepend",t=>function(...i){return t.apply(this,g(i))})}),[null===(r=u.Element)||void 0===r?void 0:r.prototype,null===(o=u.CharacterData)||void 0===o?void 0:o.prototype,null===(l=u.DocumentType)||void 0===l?void 0:l.prototype].forEach(t=>{f(t,"before",t=>function(...i){return t.apply(this,g(i))}),f(t,"after",t=>function(...i){return t.apply(this,g(i))}),f(t,"replaceWith",t=>function(...i){const e=g(i);return i.length&&!e.length?void 0:t.apply(this,e)})}),f(null===(a=u.Element)||void 0===a?void 0:a.prototype,"insertAdjacentElement",t=>function(i,e){const s=p(e);return s?t.call(this,i,s):null}),this.Yp=()=>{c.forEach(t=>t()),this.Yp=void 0},this.Xp()}Xp(){let t=!1;return()=>{var i;t||(t=!0,this.Vp--,0===this.Vp&&(null===(i=this.Yp)||void 0===i||i.call(this)))}}tg(t,i=!0){const e=this.Kp();try{const s=t(e);return i&&e(),s}catch(t){throw e(),t}}setupSiteApp(t){const i=this.apps[t.id],e=()=>{var e;!i.errored&&this.Gp.length&&(rc.info(`Processing ${this.Gp.length} events for site app with id ${t.id}`),this.Gp.forEach(t=>this.tg(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null===(e=this.Jp)||void 0===e||e.call(this))};let s=!1;const n=n=>{i.errored=!n,i.loaded=!0,rc.info(`Site app with id ${t.id} ${n?"loaded":"errored"}`),s&&e()};try{const{processEvent:e}=this.tg(i=>t.init({posthog:this._instance,callback(t){i(),n(t)}}),!1);e&&(i.processEvent=e),s=!0}catch(i){rc.error(oc+t.id,i),n(!1)}if(s&&i.loaded)try{e()}catch(e){rc.error(`Error while processing buffered events PostHog app with config id ${t.id}`,e),i.errored=!0}}eg(){const t=this.siteAppLoaders||[];for(const i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(const i of t)this.setupSiteApp(i)}ig(t){if(0===Object.keys(this.apps).length)return;const i=this.globalsForEvent(t);for(const e of Object.values(this.apps))try{this.tg(()=>{var t;return null===(t=e.processEvent)||void 0===t?void 0:t.call(e,i)})}catch(i){rc.error(`Error while processing event ${t.event} for site app ${e.id}`,i)}}onRemoteConfig(t){var i,e,s;if(null===(i=this.siteAppLoaders)||void 0===i?void 0:i.length)return this.isEnabled?(this.eg(),void this._instance.on("eventCaptured",t=>this.ig(t))):void rc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(e=this.Jp)||void 0===e||e.call(this),!t.ok)return;const n=t.config;if(null===(s=n.siteApps)||void 0===s?void 0:s.length)if(this.isEnabled)for(const{id:t,url:i}of n.siteApps){var r,o;c[`__$$ph_site_app_${t}`]=this._instance,null===(r=c.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,i,i=>{if(i)return rc.error(oc+t,i)})}else rc.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},{surveys:class extends fc{constructor(t){super(new pc(t))}},featureFlags:Fc},{tracingHeaders:class{constructor(t){this._instance=t,this.ng=void 0,this.sg=void 0,this.rg=void 0,this._p=()=>{const t=this.og();var i,e;t?(A(this.ng)&&(this.ng=null===(i=c.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),A(this.sg)&&(this.sg=null===(e=c.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Cp()}}initialize(){this.startIfEnabledOrStop()}Fl(t){var i,e,s;(null===(i=c.__PosthogExtensions__)||void 0===i?void 0:i.tracingHeadersPatchFns)?t():null===(e=c.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"tracing-headers",i=>{if(i)return qh.error("failed to load script",i);t()})}ag(){var t,i;return null!==(t=null!==(i=this._instance.config.tracing_headers)&&void 0!==i?i:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}og(){const t=this.ag();return E(t)?(E(this.rg)?this.rg.splice(0,this.rg.length,...t):this.rg=[...t],t.length>0?this.rg:void 0):(E(this.rg)&&this.rg.splice(0),this.rg=t||void 0,this.rg)}Cp(){var t,i;null===(t=this.ng)||void 0===t||t.call(this),null===(i=this.sg)||void 0===i||i.call(this),this.ng=void 0,this.sg=void 0}startIfEnabledOrStop(){this.og()?this.Fl(this._p):this.Cp()}}},{toolbar:class{constructor(t){this.instance=t}lg(t){c.ph_toolbar_state=t}ug(){var t;return null!==(t=c.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i=void 0,e=void 0,n=void 0){var r,o;if(Hr(this.instance.config))return!1;if(!t||!s)return!1;i=null!==(r=i)&&void 0!==r?r:t.location,n=null!==(o=n)&&void 0!==o?o:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}const s=gc||Ml(i.hash,"__posthog")||Ml(i.hash,"state");let r;const o=s?vi(()=>JSON.parse(atob(decodeURIComponent(s))))||vi(()=>JSON.parse(decodeURIComponent(s))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?i.hash=o.desiredHash:n?n.replaceState(n.state,"",i.pathname+i.search):i.hash="")):(r=JSON.parse(e.getItem(_c)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}cg(t){const i=c.ph_load_toolbar||c.ph_load_editor;!R(i)&&T(i)?i(t,this.instance):mc.warn("No toolbar load function found")}loadToolbar(i){const e=!!(null==s?void 0:s.getElementById("__POSTHOG_TOOLBAR__"));if(!t||e)return!1;const n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=bi(bi({token:this.instance.config.token},i),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(t.localStorage.setItem(_c,JSON.stringify(bi(bi({},r),{},{source:void 0}))),2===this.ug())this.cg(r);else if(0===this.ug()){var o,l;this.lg(1),null===(o=c.__PosthogExtensions__)||void 0===o||null===(l=o.loadExternalDependency)||void 0===l||l.call(o,this.instance,"toolbar",t=>{if(t)return mc.error("[Toolbar] Failed to load",t),void this.lg(0);this.lg(2),this.cg(r)}),Ur(t,"turbolinks:load",()=>{this.lg(0),this.loadToolbar(r)})}return!0}hg(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,i=void 0,e=void 0){return this.maybeLoadToolbar(t,i,e)}}},{experiments:class i{get Fr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{i.dg("retrieved web experiments from the server"),this.vg=new Map,t.forEach(t=>{if(t.feature_flag_key){var e;this.vg&&(i.dg("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(e=this.vg)||void 0===e||e.set(t.feature_flag_key,t));const s=this._instance.getFeatureFlag(t.feature_flag_key);F(s)&&t.variants[s]&&this.fg(t,s)}else if(t.variants)for(const e in t.variants){const s=t.variants[e];i.pg(s,this._instance)&&this.gg(t.name,e,s.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())i.dg(Zd);else if(!this.Fr.disable_web_experiments){if(R(this.vg))return this.vg=new Map,this.loadIfEnabled(),void this.previewWebExperiment();i.dg("applying feature flags",t),t.forEach(t=>{var i;if(this.vg&&(null===(i=this.vg)||void 0===i?void 0:i.has(t))){var e;const i=this._instance.getFeatureFlag(t),s=null===(e=this.vg)||void 0===e?void 0:e.get(t);i&&(null==s?void 0:s.variants[i])&&this.fg(s,i)}})}}previewWebExperiment(){const t=i.getWindowLocation();if(null==t?void 0:t.search){const e=Fl(null==t?void 0:t.search,"__experiment_id"),s=Fl(null==t?void 0:t.search,"__experiment_variant");e&&s&&(i.dg(`previewing web experiments ${e} && ${s}`),this.getWebExperiments(t=>{this.mg(parseInt(e),s,t)},!1,!0))}}loadIfEnabled(){this.Fr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Fr.disable_web_experiments&&!e)return t([]);const s=this._instance.get_property("$web_experiments");if(s&&!i)return t(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Fr.token}`),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}mg(t,e,s){const n=s.filter(i=>i.id===t);n&&n.length>0&&(i.dg(`Previewing web experiment [${n[0].name}] with variant [${e}]`),this.gg(n[0].name,e,n[0].variants[e].transforms))}fg(t,e){const s=t.variants[e];i.yg(s,this._instance)?this.gg(t.name,e,s.transforms):i.dg(`skipping variant ${e} of experiment ${t.name} because this page does not match its url conditions`)}static pg(t,e){return!R(t.conditions)&&i.yg(t,e)&&i.bg(t)}static yg(t,e){var s;if(R(t.conditions)||R(null===(s=t.conditions)||void 0===s?void 0:s.url))return!0;const n=i.getWindowLocation();if(n){var r,o,l;const i=wo(e,n.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||tv[null!==(o=null===(l=t.conditions)||void 0===l?void 0:l.urlMatchType)&&void 0!==o?o:"icontains"](t.conditions.url,i)}return!1}static getWindowLocation(){return null==t?void 0:t.location}static bg(t){var i;if(R(t.conditions)||R(null===(i=t.conditions)||void 0===i?void 0:i.utm))return!0;const e=Ll();if(e.utm_source){var s,n,r,o,l,a,u,h;const i=!(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)||(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)==e.utm_campaign,c=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==e.utm_source,d=!(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)||(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)==e.utm_medium,v=!(null===(u=t.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)||(null===(h=t.conditions)||void 0===h||null===(h=h.utm)||void 0===h?void 0:h.utm_term)==e.utm_term;return i&&d&&v&&c}return!1}static dg(t,...i){Ls.info(`[WebExperiments] ${t}`,i)}static _g(t,...i){Ls.warn(`[WebExperiments] ${t}`,i)}static wg(t){("http://www.w3.org/1999/xhtml"===t.namespaceURI&&"template"===t.localName?t.content:t).querySelectorAll("a[target], template").forEach(t=>{var e;if("template"===t.localName)return void("http://www.w3.org/1999/xhtml"===t.namespaceURI&&i.wg(t));if("http://www.w3.org/1999/xhtml"!==t.namespaceURI||"_blank"!==(null===(e=t.getAttribute("target"))||void 0===e?void 0:e.toLowerCase()))return void t.removeAttribute("target");const s=(t.getAttribute("rel")||"").split(/\s+/).filter(t=>t&&!/^(opener|noopener)$/i.test(t));s.push("noopener"),t.setAttribute("rel",s.join(" "))})}gg(t,e,s){this._is_bot()?i.dg(Zd):"control"!==e?s.forEach(s=>{if(s.selector){var n;i.dg(`applying transform of variant ${e} for experiment ${t} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector);if(!(null==r?void 0:r.length))return void i._g(`no element on this page matches selector ${s.selector} of variant ${e} for experiment ${t}`);const o=new Map;null==r||r.forEach(t=>{if("script"===t.localName.toLowerCase())return;const e=t;if(s.html){var n;const l="http://www.w3.org/1998/Math/MathML"===t.namespaceURI&&"annotation-xml"===t.localName&&(null===(n=t.getAttribute("encoding"))||void 0===n?void 0:n.toLowerCase())||"",a=JSON.stringify([t.namespaceURI,t.localName,l]);let u=o.get(a);if(R(u)){var r;const e=null!==(r=Qd)&&void 0!==r?r:Qd=Yd(),n=t.ownerDocument.implementation.createHTMLDocument(""),h=n.createElementNS(t.namespaceURI,t.localName);l&&h.setAttribute("encoding",l);const c=n.createRange();c.selectNodeContents(h);const d="http://www.w3.org/2000/svg"===t.namespaceURI&&/^(foreignObject|desc|title)$/.test(t.localName)||/^(text\/html|application\/xhtml\+xml)$/.test(l)?"http://www.w3.org/1999/xhtml":t.namespaceURI,v=c.createContextualFragment(s.html);"http://www.w3.org/1998/Math/MathML"===t.namespaceURI&&/^(mi|mo|mn|ms|mtext)$/.test(t.localName)?(h.appendChild(v),e.sanitize(h,bi(bi({},Xd),{},{NAMESPACE:d||void 0,IN_PLACE:!0}))):("http://www.w3.org/1999/xhtml"===h.namespaceURI&&"template"===h.localName?h.content:h).appendChild(e.sanitize(v,bi(bi({},Xd),{},{NAMESPACE:d||void 0,RETURN_DOM_FRAGMENT:!0}))),i.wg(h),u=h.innerHTML,o.set(a,u)}e.innerHTML=u}s.css&&e.setAttribute("style",s.css)})}}):i.dg("Control variants leave the page unmodified.")}_is_bot(){return e&&this._instance?Mu(e,this.Fr.custom_blocked_useragents):void 0}},featureFlags:Fc},{conversations:class{constructor(t){this._instance=t,this.kg=void 0,this._conversationsManager=null,this.Sg=!1,this.ie=null,this.xg=!1,this.$g=0,this.Cg=null,this.Tg=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return void(this.Cg=null);if(this.Ig=t.ok,!t.ok)return;const i=t.config.conversations;R(i)?this.Cg=null:(j(i)?this.kg=i:(this.kg=i.enabled,this.ie=i),this.kg||(this.Cg=null),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.$g++,this.kg=void 0,this.ie=null,this.Ig=void 0,this.xg=!1,this.Cg=null}loadIfEnabled(){if(this._conversationsManager)return;if(this.Sg)return;if(this._instance.config.disable_conversations)return;if(Hr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==c?void 0:c.__PosthogExtensions__;if(t&&!A(this.kg)&&this.kg)if(this.ie&&this.ie.token){this.Sg=!0;try{const i=t.initConversations;if(i)return this.Mg(i),void(this.Sg=!1);const e=t.loadExternalDependency;if(!e)return void this.Eg(dn);const s=this.$g;e(this._instance,"conversations",i=>{if(s!==this.$g)return this.Sg=!1,void this.loadIfEnabled();i||!t.initConversations?this.Eg("Could not load conversations script",i):this.Mg(t.initConversations),this.Sg=!1})}catch(t){this.Eg("Error initializing conversations",t),this.Sg=!1}}else iv.error("Conversations enabled but missing token in remote config.")}Mg(t){if(this.ie){try{this._conversationsManager=t(this.ie,this._instance),this.xg=!1,iv.info("Conversations loaded successfully")}catch(t){return void this.Eg("Error completing conversations initialization",t)}this.Tg&&this._conversationsManager.setTheme(this.Tg),this.Ag()}else iv.error("Cannot complete initialization: remote config is null")}Ag(){const t=this.Cg;this.Cg=null,this._conversationsManager&&t&&("open"===t?this._conversationsManager.open():this._conversationsManager.close())}Eg(t,i){iv.error(t,i),this._conversationsManager=null,this.Sg=!1,this.xg=!0}show(){this._conversationsManager?this._conversationsManager.show():iv.warn("Conversations not loaded yet.")}hide(){"open"===this.Cg&&(this.Cg=null),this._conversationsManager&&this._conversationsManager.hide()}open(){this._conversationsManager?(this.Cg=null,this._conversationsManager.open()):this.Cg="open"}close(){this._conversationsManager?(this.Cg=null,this._conversationsManager.close()):this.Cg="close"}setTheme(t){var i,e;this.Tg=bi(bi(bi({},this.Tg),t),{},{dark:bi(bi({},null===(i=this.Tg)||void 0===i?void 0:i.dark),null==t?void 0:t.dark)}),null===(e=this._conversationsManager)||void 0===e||e.setTheme(t)}isAvailable(){return!0===this.kg&&!M(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Hr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Ig?"remote_config_failed":A(this.kg)?this.Ig?"disabled_in_project":"remote_config_pending":this.kg?R(this.ie)||!this.ie.token?"missing_token":(null==c?void 0:c.__PosthogExtensions__)?this.Sg?"initializing":this.xg?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var s=this;return J(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,e):(iv.warn(ev),null)})()}getMessages(t,i){var e=this;return J(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(iv.warn(ev),null)})()}markAsRead(t){var i=this;return J(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(iv.warn(ev),null)})()}getTickets(t){var i=this;return J(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(iv.warn(ev),null)})()}requestRestoreLink(t){var i=this;return J(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(iv.warn(ev),null)})()}restoreFromToken(t){var i=this;return J(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(iv.warn(ev),null)})()}restoreFromUrlToken(){var t=this;return J(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(iv.warn(ev),null)})()}getCurrentTicketId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Sd(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}xd(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},{logs:class extends hv{constructor(t){super({get(){var i;return null==t||null===(i=t.config)||void 0===i?void 0:i.logs},captureHintKey:Rn,get remoteConfigWillArrive(){var i,e;return!(null===(i=t.ec)||void 0===i?void 0:i.call(t))||!!(null===(e=c._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[t.config.token])||void 0===e?void 0:e.config)}},()=>function(t){var i;const e={};if(e.distinctId=t.get_distinct_id(),t.sessionManager){const{sessionId:i,windowId:s,sessionStartTimestamp:n,lastActivityTimestamp:r}=t.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i,e.windowId=s,R(n)||(e.sessionStartTimestamp=n),R(r)||(e.lastActivityTimestamp=r)}if((null==c||null===(i=c.location)||void 0===i?void 0:i.href)&&(e.currentUrl=t.config.disable_capture_url_hashes?di(c.location.href):c.location.href),t.featureFlags){const i=t.featureFlags.getFlags();i&&i.length>0&&(e.activeFeatureFlags=i)}return e}(t)),this._instance=t,this.name=dh,this.rf()}get nf(){return this._instance.__loaded}sf(){const t=Ns("[logs]"),i=null==c?void 0:c.__PosthogExtensions__;if(!i)return void t.error("PostHog Extensions not found.");const e=i.loadExternalDependency;if(e)return t=>{e(this._instance,"logs",e=>{const s=i.logs;t(e,(null==s?void 0:s.initializeLogs)?{initialize:t=>s.initializeLogs(t),replay(t,i){var e;return null===(e=s.replayConsoleBuffer)||void 0===e?void 0:e.call(s,t,i)}}:void 0)})};t.error(dn)}}},{metrics:class{constructor(t){this._instance=t,this.R=Ns("[metrics]"),this.Ti=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.Ti)return;const i=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);i&&!this.Rg?this.Rg=(t=>{let i=!0;const e=()=>i?(t=>{var i;const e=null===(i=t.config.metrics)||void 0===i?void 0:i.network;return!0===e?{}:e||void 0})(t):void 0,s=_v(t,e),n=mv(t,e);return()=>{i=!1,s(),n()}})(this._instance):!i&&this.Rg&&(this.Rg(),this.Rg=void 0)}uf(){var t;if(this.Ti)return;const i=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var e;return this.ef&&this.cf===i||(null===(e=this.ef)||void 0===e||e.reset(),this.cf=i,this.ef=new Is(this.lf(),function(t){var i,e,s,n,r;const o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==o?void 0:o["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==o?void 0:o["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(s=null==o?void 0:o["deployment.environment"])&&void 0!==s?s:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(n=null==t?void 0:t.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(i),this.R)),this.ef}count(t,i=1,e){var s;null===(s=this.uf())||void 0===s||s.count(t,i,e)}gauge(t,i,e){var s;null===(s=this.uf())||void 0===s||s.gauge(t,i,e)}histogram(t,i,e){var s;null===(s=this.uf())||void 0===s||s.histogram(t,i,e)}flush(t){if(!this.ef)return Promise.resolve();if(t){const i=this.ef.drainWindow();return i&&this._o(i,t),Promise.resolve()}return this.ef.flush().catch(t=>this.R.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.ef)||void 0===t||t.reset()}dispose(){var t,i;this.Ti=!0,null===(t=this.Rg)||void 0===t||t.call(this),this.Rg=void 0,null===(i=this.ef)||void 0===i||i.reset()}lf(){const t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},_o:t=>i._o(t),getLibraryId:()=>Ws.LIB_NAME,getLibraryVersion:()=>Ws.LIB_VERSION}}_o(t,i){return new Promise(e=>{let s=!1;const n=t=>{s||(s=!0,clearTimeout(r),e(t))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(bi(bi({method:"POST",url:this.Pg(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i}),{},{fireCallbackOnDrop:!0,callback(t){const i=t.statusCode;if(i>=200&&300>i)n({kind:"ok"});else if(413===i)n({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)n({kind:"fatal",error:new Error(`metrics request failed with status ${i}`)});else{var e;n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error(`metrics request failed with status ${i}`)})}}}))})}Pg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},{webMCP:class{constructor(t){this._instance=t,this.Og=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.Og)return;const t=null==s?void 0:s.modelContext;if(!t||!T(t.registerTool))return;const i=yv.get(t);if(i)return i.instances.add(this._instance),void(this.Og=!0);const e={instances:new Set([this._instance])},n=t.registerTool,r=this;Hh(t,"registerTool",t=>{const i=t;return function(t,...s){let n=t;try{n=r.Fg(t,e)}catch(e){return i.call(this,t,...s)}return i.call(this,n,...s)}}),t.registerTool!==n&&(yv.set(t,e),this.Og=!0)}Fg(t,i){if(!t||!T(t.execute))return t;const e=t.execute,s=this,{tool:n,injected:r}=function(t,i){const e={intent:!1,model:!1},s=t.inputSchema;if(!function(t){return!!A(t)||P(t)&&Object.keys(t).every(t=>bv.has(t)||t.startsWith("x-"))&&!0!==t.additionalProperties&&!P(t.additionalProperties)&&(!t.type||"object"===t.type)&&(!t.properties||P(t.properties))&&(!t.required||E(t.required))}(s))return{tool:kv(t),injected:e};const n=(null==s?void 0:s.properties)||{},r=t=>Sv(n,t)||E(null==s?void 0:s.required)&&s.required.includes(t);if(e.intent=i.intent&&!r("context"),e.model=i.model&&!r("llm_model"),!e.intent&&!e.model)return{tool:kv(t),injected:e};const o=bi({},n),l=E(null==s?void 0:s.required)?[...s.required]:[];return e.intent&&(o.context={type:"string",description:'Explain why this tool is called and how it supports the user\'s goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".'},l.includes("context")||l.push("context")),e.model&&(o.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},l.includes("llm_model")||l.push("llm_model")),{tool:kv(t,bi(bi({},s),{},{type:(null==s?void 0:s.type)||"object",properties:o,required:l})),injected:e}}(t,function(t){const i={intent:!1,model:!1};for(const e of t.instances){const t=xv(e.config.capture_webmcp);i.intent||(i.intent=!0===(null==t?void 0:t.intent)),i.model||(i.model=!0===(null==t?void 0:t.model))}return i}(i));return Object.defineProperty(n,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){const l=new Date,a=function(t,i){if(!P(t))return{};try{const e=i.intent?Ev(t.context,2048,!0):void 0,s=i.model?Ev(t.llm_model,256):void 0;return bi(bi({},e&&"{}"!==e?{intent:e}:{}),s&&"unknown"!==s.toLowerCase()?{model:s}:{})}catch(t){return{}}}(o[0],r),u=function(t,i){const e=t[0];if(!P(e))return t;try{const s=i.intent&&Sv(e,"context"),n=i.model&&Sv(e,"llm_model");if(!s&&!n)return t;const r=bi({},e);return s&&delete r.context,n&&delete r.llm_model,[r,...t.slice(1)]}catch(i){return t}}(o,r);let h;try{h=e.apply(this===n?t:this,u)}catch(t){throw s.Dg(i,n,l,{error:t,errorResult:!1},a),t}if((c=h)&&"function"==typeof c.then)return Promise.resolve(h).then(t=>{const e=Tv(t)?{error:t,errorResult:!0}:void 0;return s.Dg(i,n,l,e,a),t},t=>{throw s.Dg(i,n,l,{error:t,errorResult:!1},a),t});var c;const d=Tv(h)?{error:h,errorResult:!0}:void 0;return s.Dg(i,n,l,d,a),h}}),n}Dg(t,i,e,s,r){const o=Date.now()-e.getTime();let l;for(const u of t.instances){var a;const t=xv(u.config.capture_webmcp);if(t){s&&!l&&(l=Ov(s.error,s.errorResult));try{u.capture("$mcp_tool_call",bi(bi(bi({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==n?void 0:n.hostname,$mcp_duration_ms:o,$mcp_is_error:!!s},l?{$mcp_error_type:l.type,$mcp_error_message:l.message}:{}),t.intent&&r.intent?{$mcp_intent:r.intent,$mcp_intent_source:"context_parameter"}:{}),t.model&&r.model?{$mcp_llm_model:r.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:e})}catch(t){continue}if(s&&l&&u.exceptions&&(null===(a=u.exceptionObserver)||void 0===a?void 0:a.isEnabled))try{const t={$exception_list:Av(u.exceptions,s,l.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==n?void 0:n.hostname};u.exceptionObserver.captureException(t)}catch(t){}}}}}})),function(){Ws.SDK_DIST_CHANNEL="cdn";const i=c.posthog;if(i&&!E(i._i)&&T(i.init))return;const e=gh[Ah]=new jh;if(i){const t=[];Rr(i._i,function(s){if(s&&E(s)){const n=e.init(s[0],s[1],s[2]),r=i[s[2]]||i;n.__loaded&&-1===t.indexOf(r)&&(t.push(r),n._execute_array.call(n.people,r.people),n._execute_array(r))}});const s=i.people;if(!e.__loaded&&E(i)){const t=e.init;let n=!0;e.init=(r,o,l)=>{const a=t.call(e,r,o,l);return n&&a===e&&a.__loaded&&(n=!1,e.init=t,a._execute_array.call(a.people,s),a._execute_array(i)),a}}}e.__SV=1,c.posthog=e,function(){function i(){i.done||(i.done=!0,bu=!1,Rr(gh,function(t){t._dom_loaded()}))}(null==s?void 0:s.addEventListener)?"complete"===s.readyState?i():Ur(s,"DOMContentLoaded",i,{capture:!1}):t&&Ls.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
2
2
  //# sourceMappingURL=array.js.map