posthog-js 1.428.1 → 1.428.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/conversations.js.map +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/customizations.full.js.map +1 -1
- package/dist/customizations.js +1 -1
- package/dist/customizations.js.map +1 -1
- package/dist/dead-clicks-autocapture.js.map +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/default-extensions.js.map +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/extension-bundles.js.map +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/lazy-recorder.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.js.map +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/module.slim.no-external.js.map +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/posthog-recorder.js.map +1 -1
- package/dist/product-tours.js.map +1 -1
- package/dist/recorder-v2.js.map +1 -1
- package/dist/recorder.js.map +1 -1
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +5 -5
package/dist/module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t,i=["retriesPerformedSoFar"],e=["$set_once","$set"];function r(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}function s(){return s=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},s.apply(null,arguments)}function n(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function o(t){return function(){var i=this,e=arguments;return new Promise(function(r,s){var o=t.apply(i,e);function a(t){n(o,r,s,a,l,"next",t)}function l(t){n(o,r,s,a,l,"throw",t)}a(void 0)})}}var a="u">typeof window?window:void 0,l="u">typeof globalThis?globalThis:a,h=null==l?void 0:l.navigator,u=null==l?void 0:l.document,d=null==l?void 0:l.location,v=null==l?void 0:l.fetch,c=null!=l&&l.XMLHttpRequest&&"withCredentials"in new l.XMLHttpRequest?l.XMLHttpRequest:void 0,f=null==l?void 0:l.AbortController,p=null==l?void 0:l.CompressionStream,_=null==h?void 0:h.userAgent;function g(){return!(!a||!1===a.navigator.onLine)}var m="undefined"!=typeof globalThis?globalThis:a;m&&"undefined"==typeof self&&(m.self=m),m&&"undefined"==typeof File&&(m.File=function(){});var b=null!=a?a:{},y="0.8.1",w={DEBUG:!1,LIB_VERSION:y,LIB_NAME:"browser-common",JS_SDK_VERSION:y},S=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],x=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return S.concat(i).some(t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)})};function E(t,i){return-1!==t.indexOf(i)}var k=function(t){return t.trim()},T=function(t){return t.replace(/^\$/,"")};function P(t){var i,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"}var R=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.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),C=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),O=["$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"],A=["token"],I=Object.prototype,F=I.hasOwnProperty,M=I.toString,D=Array.isArray||function(t){return"[object Array]"===M.call(t)},N=t=>"function"==typeof t,L=t=>t===Object(t)&&!D(t),j=t=>{if(L(t)){for(var i in t)if(F.call(t,i))return!1;return!0}return!1},U=t=>void 0===t,B=t=>"[object String]"==M.call(t),z=t=>B(t)&&0===t.trim().length,H=t=>null===t,q=t=>U(t)||H(t),V=t=>"[object Number]"==M.call(t)&&t==t,W=t=>V(t)&&t>0,G=t=>"[object Boolean]"===M.call(t),K=t=>E(O,t),J=t=>E(A,t);function Y(t){return null===t||"object"!=typeof t}function X(t,i){return{}.toString.call(t)==="[object "+i+"]"}function Q(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 tt(t,Error)}}function Z(t){return"u">typeof Event&&tt(t,Event)}function tt(t,i){try{return t instanceof i}catch(t){return!1}}var it=[!0,"true",1,"1","yes"],et=t=>E(it,t),rt=[!1,"false",0,"0","no"];function st(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),V(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),st(null!=s?s:e,i,e,r))}var nt=class{constructor(t){this.C={},this.I=t.I,this.R=st(t.bucketSize,0,100,t.A),this.O=st(t.refillRate,0,this.R,t.A),this.F=st(t.refillInterval,0,864e5,t.A)}N(t,i){var e=Math.floor((i-t.lastAccess)/this.F);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.R),t.lastAccess=t.lastAccess+e*this.F)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.C[r];return s?this.N(s,e):this.C[r]=s={tokens:this.R,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.I)||i.call(this,t)),0===s.tokens)}stop(){this.C={}}},ot="Mobile",at="Android",lt="Tablet",ht="Android Tablet",ut="iPad",dt="Apple Watch",vt="Safari",ct="BlackBerry",ft="Samsung Internet",pt="Chrome",_t="Chrome iOS",gt="Internet Explorer",mt="Internet Explorer Mobile",bt="Opera",yt="Microsoft Edge",wt="Firefox",St="Firefox iOS",xt="Nintendo",Et="PlayStation",kt="Xbox",$t="Android Mobile",Tt="Mobile Safari",Pt="Windows",Rt="Windows Phone",Ct="Nokia",Ot="Ouya",At="Generic "+ot.toLowerCase(),It="Generic "+lt.toLowerCase(),Ft="Konqueror",Mt="Oculus Browser",Dt="Vivaldi",Nt="Yandex",Lt="Whale",jt="DuckDuckGo",Ut="Pale Moon",Bt="Waterfox",zt="Brave",Ht="Claude",qt="Codex",Vt="ChatGPT",Wt="Google Search App",Gt=new RegExp("Version/(\\d+(\\.\\d+)?)"),Kt=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Jt=new RegExp(kt,"i"),Yt=new RegExp("PlayStation \\w+","i"),Xt=new RegExp("Nintendo \\w+","i"),Qt=new RegExp("BlackBerry|PlayBook|BB10","i"),Zt={"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"},ti=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?zt:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&E(t,"GSA/")?Wt:E(t," OPR/")&&E(t,"Mini")?"Opera Mini":E(t," OPR/")?bt:Qt.test(t)?ct:E(t,"IEMobile")||E(t,"WPDesktop")?mt:E(t,"OculusBrowser")?Mt:E(t,"SamsungBrowser")?ft:E(t,"Edge")||E(t,"Edg/")?yt:E(t,"Vivaldi/")?Dt:E(t,"YaBrowser/")?Nt:E(t,"Whale/")?Lt:E(t,"DuckDuckGo/")||E(t,"Ddg/")?jt:E(t,"Claude/")?Ht:E(t,"Codex/")?qt:E(t,"ChatGPT/")?Vt:E(t,"FBIOS")?"Facebook Mobile":E(t,"UCWEB")||E(t,"UCBrowser")?"UC Browser":E(t,"CriOS")?_t:E(t,"CrMo")||E(t,pt)?pt:E(t,at)&&E(t,vt)?$t:E(t,"FxiOS")?St:E(t.toLowerCase(),Ft.toLowerCase())?Ft:E(t,"Brave/")?zt:((t,i)=>i&&E(i,"Apple")||function(t){return E(t,vt)&&!E(t,pt)&&!E(t,at)}(t))(t,i)?E(t,ot)?Tt:vt:E(t,"PaleMoon/")?Ut:E(t,"Waterfox/")?Bt:E(t,wt)?wt:E(t,"MSIE")||E(t,"Trident/")?gt:E(t,"Gecko")?wt:"")},ii={[mt]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[yt]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[pt]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[_t]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[vt]:[Gt],[Tt]:[Gt],[bt]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[wt]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[St]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Ft]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ct]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Gt],[$t]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ft]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Mt]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Dt]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Nt]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Lt]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[zt]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ht]:[Kt],[qt]:[Kt],[Vt]:[Kt],[jt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ut]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Bt]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Wt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[gt]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},ei=function(t,i,e,r){var s=ii[ti(t,i,e,r)];if(U(s))return null;for(var n=0;s.length>n;n++){var o=t.match(s[n]);if(o)return parseFloat(o[o.length-2])}return null},ri=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[kt,t&&t[1]||""]],[new RegExp(xt,"i"),[xt,""]],[new RegExp(Et,"i"),[Et,""]],[Qt,[ct,""]],[new RegExp(Pt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Rt,""];if(new RegExp(ot).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Zt[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[Pt,r]}return[Pt,""]}],[/((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=>{var i="";return t&&t.length>=3&&(i=U(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[at,[t[2],t[3],t[4]||"0"].join(".")]:[at,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],si=function(t){for(var i=0;ri.length>i;i++){var e=ri[i],r=e[1],s=e[0].exec(t),n=s&&(N(r)?r(s,t):r);if(n)return n}return["",""]},ni=function(t){return Xt.test(t)?xt:Yt.test(t)?Et:Jt.test(t)?kt:new RegExp(Ot,"i").test(t)?Ot:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?Rt:/iPad/.test(t)?ut:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?dt:Qt.test(t)?ct:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ct,"i").test(t)?Ct:/(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(ot).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)?at:ht:new RegExp("(pda|Mobile)","i").test(t)?At:new RegExp(lt,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?It:""},oi=/\bFBAV\/(\d+(?:\.\d+)*)/i,ai=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",oi],[/\bFBAN\/EMA\b/i,"Facebook Lite",oi],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",oi],[/\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"]],li="[Truncated]",hi="[Unserializable]";function ui(t){for(var i="",e=0;t.length>e;e++){var r=t.charCodeAt(e);if(55296>r||r>56319)i+=56320>r||r>57343?t[e]:"�";else{var s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}Date,Date;var di,vi,ci,fi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function pi(t,i){return"string"==typeof(e=t)&&fi.test(e)?t:i();var e}function _i(t,i){var e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function gi(t){return t?t.split("#")[0]:t}function mi(t,i){var e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function bi(t,i,e){return yi.apply(this,arguments)}function yi(){return(yi=o(function*(t,i,e){var r;try{return yield Promise.race([t,new Promise((t,s)=>{r=mi(()=>{try{null==e||e(),t()}catch(t){s(t)}},i)})])}finally{clearTimeout(r)}})).apply(this,arguments)}function wi(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return ci&&e.length===vi?ci:(vi=e.length,ci=e.reduce((e,r)=>{di||(di={});var s=di[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a,l=null==(a=n[o])?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,di[r]=[l,h];break}}return e},{}))}}var Si=class{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return o(function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&D(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t})()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),s({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return o(function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e})()}convertToExceptionList(t,i){var e,r,n,o={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,s({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:wi(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return s({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}};function xi(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:!!i&&!i.startsWith("webkit-masked-url://")&&"<anonymous>"!==i};return U(r)||(n.lineno=r),U(s)||(n.colno=s),n}var Ei=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:"?",e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},ki=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,$i=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ti=/\((\S*)(?::(\d+))(?::(\d+))\)/,Pi=(t,i)=>{var e=ki.exec(t);if(e)return xi(i,e[1],"?",+e[2],+e[3]);var r=$i.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=Ti.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=Ei(r[1]||"?",r[2]);return xi(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Ri=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ci=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Oi=(t,i)=>{var e=Ri.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=Ci.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||"?",o=Ei(n,s);return xi(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Ai=/\(error: (.*)\)/;var Ii=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=B(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return X(t,"DOMException")}isDOMError(t){return X(t,"DOMError")}},Fi=class{match(t){return Q(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:null==(e=i.syntheticException)?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}},Mi=class{match(t){return!!X(t,"ErrorEvent")&&(null!=t.error||this.Ki(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);var r=i.apply(t.message);return s({},r,{stack:null!==(e=this.Xi(t))&&void 0!==e?e:r.stack,synthetic:!0})}Ki(t){return B(t.message)&&t.message.length>0}Xi(t){var i,e,r=t,s=null!==(i=r.lineno)&&void 0!==i?i:0,n=null!==(e=r.colno)&&void 0!==e?e:0;if(B(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}},Di=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ni=class{match(t){return"string"==typeof t}coerce(t,i){var e,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(Di);return r&&(i=r[1],e=r[2]),[i,e]}},Li=["fatal","error","warning","log","info","debug"];function ji(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}var Ui=class{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r,s=this.getErrorPropertyFromObject(t);return s?i.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null==(r=i.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Z(t))return t.constructor.name;var i="name"in t?t.name:void 0;return B(i)&&!z(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+ji(t)}isSeverityLevel(t){return B(t)&&!z(t)&&Li.indexOf(t)>=0}getStack(t){try{return B(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:B(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(Q(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},Bi=class{match(t){return Z(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+ji(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}},zi=class{match(t){return Y(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}},Hi=class{match(t){return X(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Z(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return Y(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}},qi="$message",Vi="$timestamp",Wi=new Set([qi,Vi]),Gi={enabled:!0,max_bytes:32768};function Ki(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Gi.enabled,max_bytes:Yi(t.max_bytes,Gi.max_bytes)}:s({},Gi)}var Ji=class{constructor(t){this.$n=[],this.Bn=0,this._n=Ki(t)}setConfig(t){this._n=Ki(t),this.Hn()}add(t){var i=function(t){var i;try{i=P(t)}catch(t){return}try{var e=JSON.parse(i);if(!L(e))return;var r=e,s=r[qi],n=r[Vi];if(!B(s)||0===s.trim().length)return;if(!B(n)&&!V(n))return;return{step:r,json:i}}catch(t){return}}(t);if(i){var e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var i=encodeURIComponent(t),e=0,r=0;i.length>r;r++)"%"===i[r]?(e+=1,r+=2):e+=1;return e}(i.json);e>this._n.max_bytes||(this.$n.push({step:i.step,bytes:e}),this.Bn+=e,this.Hn())}}getAttachable(){return this.$n.map(t=>t.step)}clear(){this.$n=[],this.Bn=0}size(){return this.$n.length}Hn(){for(;this.Bn>this._n.max_bytes&&this.$n.length>0;){var t=this.$n.shift();t&&(this.Bn-=t.bytes)}}};function Yi(t,i){if(!V(t)||1/0===t||-1/0===t)return i;var e=Math.floor(t);return 0>e?i:e}var Xi=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Qi(t){return"string"==typeof t||t}function Zi(t){return"string"==typeof t?t:void 0}var te,ie=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],ee="NativeGzipValidationError",re=t=>t.length>=2&&31===t[0]&&139===t[1],se=(t,i)=>t===C.GZipJS||i===C.GZipJS||"gzip"===i,ne=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),oe=t=>{throw _i(ee,"Native gzip produced invalid output: "+t)},ae=function(){var t=o(function*(t,i){18>t.size&&oe("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());re(e)&&8===e[2]||oe("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(te)return te;te=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;te[t]=i>>>0}return te})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&oe("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&oe("invalid-size")});return function(i,e){return t.apply(this,arguments)}}();function le(){return le=o(function*(t,i,e){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),a=n.write(r).then(()=>n.close()).catch(function(){var t=o(function*(t){try{yield n.abort(t)}catch(t){}throw t});return function(i){return t.apply(this,arguments)}}()),l=new Response(s.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield ae(h,r),h}catch(t){if(null!=e&&e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}}),le.apply(this,arguments)}var he={}.propertyIsEnumerable;function ue(t,i){try{return ce(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function de(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:li};if(e.remainingNodes--,G(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){var e=t.toString(),r=BigInt("9223372036854775808");return t>=r||-r>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)};var s=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==i||i.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:ui(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(r>=20)return{stringValue:li};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?ui(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return de(a.call(t),i,e,r+1)}catch(t){}return D(t)?{arrayValue:{values:ve(t,i,e,r+1)}}:{kvlistValue:{values:ce(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:ui(String(t))}}function ve(t,i,e,r){for(var s=[],n=Math.min(t.length,1e3),o=0;n>o&&e.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(q(a))continue;s.push(de(a,i,e,r))}catch(t){s.push({stringValue:hi})}return t.length>o&&s.push({stringValue:li}),s}function ce(t,i,e,r){var s=[];for(var n in t)if(he.call(t,n)){if(!n){null==i||i.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(H(o)||U(o))continue;s.push({key:ui(n),value:de(o,i,e,r)})}catch(t){s.push({key:ui(n),value:{stringValue:hi}})}}return s}function fe(t,i,e){return s({},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})}var pe={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var _e={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},ge=_e.info;function me(t){try{return ui(String(t))}catch(t){return hi}}function be(t,i,e,r){var n,o=_e[t.level||"info"]||ge,a=o.text,l=o.number,h=(void 0===(n=V(r)?r:void 0)&&(n=Date.now()),String(n)+"000000"),u={};i.distinctId&&(u.posthogDistinctId=i.distinctId),i.sessionId&&(u.sessionId=i.sessionId),i.windowId&&(u["window.id"]=i.windowId),q(i.sessionStartTimestamp)||(u.sessionStartTimestamp=String(i.sessionStartTimestamp)),q(i.lastActivityTimestamp)||(u.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(u["url.full"]=i.currentUrl),i.screenName&&(u["screen.name"]=i.screenName),i.appState&&(u["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(u.feature_flags=i.activeFeatureFlags);var d=s({},u),v=t.attributes;if(v){var c=[];try{c=Object.keys(v)}catch(t){c=[]}for(var f of c){var p=void 0;try{p=v[f]}catch(t){p=hi}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var _={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:me(t.body)},attributes:ue(d,e)};return t.trace_id&&(_.traceId=t.trace_id),t.span_id&&(_.spanId=t.span_id),U(t.trace_flags)||(_.flags=t.trace_flags),_}function ye(t,i,e){return fe(t,i,e)}function we(t,i,e,r){return{resourceLogs:[{resource:{attributes:ue(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}var Se=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this._n=i,this.A=e,this.zn=r,this.Un=s,this.Wn=n,this.Vn=o,this.Gn=null,this.Zn=0,this.Jn=0,this.Qn=0,this.Kn=0,this.Xn=0,this.Yn=!1,this.ts=i.maxBufferSize,this.es=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.rs=i.flushIntervalMs,this.ns=i.maxBatchRecordsPerPost,this.ss=i.rateCapWindowMs,this.ls=i.maxLogsPerInterval}clearQueue(){this.Jn++,this._instance.setPersistedProperty(R.LogsQueue,[])}reset(){this.us(),this.Kn=0,this.Xn=0,this.Yn=!1,this.Qn=0,this.ns=this._n.maxBatchRecordsPerPost}onReconnect(){this.Qn=0,this.hs()}captureLog(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.ds(t);if(null!==r)if(r.body){if(this.vs()){var s={record:be(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.zn(),this.A,null==i?void 0:i.occurredAtMs)};this.Un(()=>this.cs(s))}}else this.A.info("Log was rejected in beforeSend function")}}ds(t){var i=this._n.beforeSend;if(!i)return t;var e=D(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for log:",t),null}return r}vs(){if(void 0===this.ls)return!0;var t=Date.now(),i=t-this.Kn;return this.ss>i&&i>=0||(this.Kn=t,this.Xn=0,this.Yn=!1),this.ls>this.Xn?(this.Xn++,!0):(this.Yn||(this.A.warn("captureLog dropping logs: exceeded "+this.ls+" logs per "+this.ss+"ms"),this.Yn=!0),!1)}flush(){var t=this;return o(function*(){if(!t._instance.isDisabled)return t.Gn||(t.Gn=t.fs().finally(()=>{t.Gn=null})),t.Gn})()}fs(){var t=this;return o(function*(){var i;t.us();var e=null!==(i=t._instance.getPersistedProperty(R.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var r=e.length,s=0;e.length>0&&r>s;){var n,o,a=t.Jn;t.Zn=0;var l=Math.min(e.length,t.ns),h=e.slice(0,l),u=we(h.map(t=>t.record),t.ps(),null!==(n=t.Vn)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.gs(u);if(t.Jn!==a)return;if("too-large"===d.kind&&h.length>1)t.ns=Math.max(1,Math.floor(h.length/2)),t.A.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+t.ns);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.A.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&t._n.maxBatchRecordsPerPost>t.ns&&(t.ns=Math.min(t._n.maxBatchRecordsPerPost,t.ns+1)),yield t.ys(h.length),e=null!==(o=t._instance.getPersistedProperty(R.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}})()}ys(t){var i=this;return o(function*(){var e,r=Math.max(0,t-i.Zn),s=null!==(e=i._instance.getPersistedProperty(R.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(R.LogsQueue,s.slice(r)),yield i.Wn()})()}ps(){return ye(this._n,this._instance.getLibraryId(),this._instance.getLibraryVersion())}cs(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(R.LogsQueue))&&void 0!==i?i:[];this.es>e.length||(e.shift(),this.Zn++,this.A.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(R.LogsQueue,e),this.ts>e.length?this.bs():this.hs()}}bs(t){void 0===t&&(t=this.rs),this._s||(this._s=mi(()=>{this._s=void 0,this.hs()},t))}ws(){var t=Math.min(Math.max(0,this.Qn-1),6);return this.rs*Math.pow(2,t)}ks(){var t=this._instance.getPersistedProperty(R.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return o(function*(){i.us();var e=i.flush().catch(()=>{});void 0!==t?yield bi(e,t):yield e})()}flushWithTimeout(t){var i=this;return o(function*(){var e=i.flush();yield bi(e,t,()=>{e.catch(()=>{})})})()}hs(){this.flush().then(()=>{this.Qn=0},t=>{this.Qn++,this.A.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.ks()&&this.bs(this.ws())})}us(){this._s&&(clearTimeout(this._s),this._s=void 0)}},xe=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ee(t){return String(t)+"000000"}function ke(t,i,e,r){var s="";return r&&(s=Object.keys(r).sort().map(t=>JSON.stringify(t)+":"+JSON.stringify(r[t])).join(",")),t+"\0"+i+"\0"+(null!=e?e:"")+"\0"+s}var $e=class{constructor(t,i,e){this._instance=t,this._n=i,this.A=e,this.Ss=new Map,this.Gn=null,this.xs=!1,this.Cs=new Map,this.Ts=new Set,this.Ms=0}count(t,i,e){void 0===i&&(i=1),this.Is({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.Is({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.Is({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,i=this.Gn,e=function(){var e=o(function*(){i&&(yield i.catch(()=>{})),yield t.Es()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.Gn===e&&(this.Gn=null)});return this.Gn=e,e}drainWindow(){if(0===this.Ss.size)return null;var t=this.Ss;return this.Ss=new Map,this.xs=!1,this.Cs=new Map,this.Ts=new Set,this.Rs(t)}reset(){this.Ms++,this.us(),this.Ss=new Map,this.Gn=null,this.xs=!1,this.Cs=new Map,this.Ts=new Set}Is(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.ds(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.A.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var e,r;try{e=i.attributes?s({},i.attributes):void 0,r=ke(i.type,i.name,i.unit,e)}catch(t){return void this.A.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var n=this.Ss.get(r);if(!n){if(!this.As())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Ss.set(r,n)}var o=this.Cs.get(i.name);void 0===o?this.Cs.set(i.name,i.type):o===i.type||this.Ts.has(i.name)||(this.Ts.add(i.name),this.A.warn("Metric name '"+i.name+"' is already used as a "+o+"; recording it as a "+i.type+" too will blend both series in charts. Use a distinct name.")),this.Ps(n,i.value),this.bs()}else this.A.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}As(){return this._n.maxSeriesPerFlush>this.Ss.size||(this.xs||(this.xs=!0,this.A.warn("Metric series cap reached ("+this._n.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ps(t,i){var e;switch(t.type){case"count":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(xe.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=i,r.min=Math.min(r.min,i),r.max=Math.max(r.max,i),r.bucketCounts[function(t,i){for(var e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,xe)]+=1}}ds(t){var i=this._n.beforeSend;if(!i)return t;var e=D(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for metric:",t),null}return r}bs(){this._s||(this._s=mi(()=>{this._s=void 0,this.flush().catch(t=>{this.A.error("Metrics flush failed:",t)})},this._n.flushIntervalMs))}us(){this._s&&(clearTimeout(this._s),this._s=void 0)}Es(){var t=this;return o(function*(){if(0!==t.Ss.size){var i=t.Ss;t.Ss=new Map,t.xs=!1,t.Cs=new Map,t.Ts=new Set;var e=t.Ms,r=yield t._instance.Fs(t.Rs(i));if(e===t.Ms)switch(r.kind){case"ok":return;case"retry-later":return t.Os(i),void t.bs();case"too-large":return void t.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.A.error("Failed to send metrics batch:",r.error)}}})()}Rs(t){return i=this.$s(t),e=function(t,i,e){return fe(t,i,e)}(this._n,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ue(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}$s(t){var i=Ee(Date.now()),e=new Map;for(var r of t.values()){var n,o=ke(r.type,r.name,r.unit,void 0),a=e.get(o);a||(a=s({name:r.name},r.unit&&{unit:r.unit}),"count"===r.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===r.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},e.set(o,a));var l=ue(null!==(n=r.attributes)&&void 0!==n?n:{},this.A),h=Ee(r.windowStartMs);if("count"===r.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:i,asDouble:null!==(u=r.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===r.type){var v,c={attributes:l,timeUnixNano:i,asDouble:null!==(v=r.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else r.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:i,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:xe})}return Array.from(e.values())}Os(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.Ss.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(i=o.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.As()&&this.Ss.set(s,n)}}},Te=function(t,i){var e=(void 0===i?{}:i).debugEnabled,r={q(i){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;r>n;n++)s[n-1]=arguments[n];a&&(w.DEBUG||a.POSTHOG_DEBUG||e)&&!U(a.console)&&a.console&&("__rrweb_original__"in a.console[i]?a.console[i].__rrweb_original__:a.console[i])(t,...s)},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("error",...i)},critical(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];console.error(t,...e)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(i,e)=>Te(t+" "+i,e)};return r},Pe=Te("[PostHog.js]"),Re=Pe.createLogger,Ce=Re("[ExternalScriptsLoader]"),Oe=t=>{var i=null==u?void 0:u.querySelectorAll("script");if(i)for(var e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},Ae=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Ce.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=Oe(i);if(r){if(r.__posthog_loading_callback_fired)return e();var s=r.__posthog_loading_error;return s?e(s):(r.addEventListener("load",t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)}),void r.addEventListener("error",t=>{r.__posthog_loading_error=t,e(t)}))}var n=()=>{if(!u)return e("document not found");if(Oe(i))return Ae(t,i,e);var r=u.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)u.head.appendChild(r);else{var s,n=u.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):u.body.appendChild(r)}};null!=u&&u.body?n():null==u||u.addEventListener("DOMContentLoaded",n)},Ie={},Fe=(t,i)=>{var e="/static/"+i+".js?v="+t.version;if("toolbar"===i){var r=3e5;e=e+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",e)};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"!==i){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+i+".js"),n=Ie[s];if("fallback"===r&&n){if(Oe(n))return void Ae(t,n,e);delete Ie[s]}Ae(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)e(r);else{var o,a=Fe(t,i);Ie[s]=a;var l=Oe(s);null==l||null==(o=l.parentNode)||o.removeChild(l),Ae(t,a,e)}else e(void 0,n)}:e)}else Ae(t,Fe(t,i),e)}else Ae(t,t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js"),e)},b.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{Ae(t,t.requestRouter.endpointFor("api",i),e)},w.DEBUG=!1,w.LIB_VERSION="1.428.1",w.LIB_NAME="web";var Me=w,De="$people_distinct_id",Ne="distinct_id",Le="$device_id",je="$device_model",Ue="__alias",Be="__cmpns",ze="$fbc",He="$fbc_persistence",qe="__timers",Ve="$autocapture_disabled_server_side",We="$heatmaps_enabled_server_side",Ge="$exception_capture_enabled_server_side",Ke="$error_tracking_suppression_rules",Je="$error_tracking_capture_extension_exceptions",Ye="$web_vitals_enabled_server_side",Xe="$dead_clicks_enabled_server_side",Qe="$product_tours_enabled_server_side",Ze="$logs_capture_enabled_server_side",tr="$web_vitals_allowed_metrics",ir="$session_recording_remote_config",er="$session_recording_enabled_server_side",rr="$replay_sample_rate",sr="$replay_override_sampling",nr="$replay_override_linked_flag",or="$replay_override_url_trigger",ar="$replay_override_event_trigger",lr="$sesid",hr="$session_is_sampled",ur="$session_past_minimum_duration",dr="$session_recording_url_trigger_activated_session",vr="$session_recording_event_trigger_activated_session",cr="$debug_first_full_snapshot_timestamp",fr="$sess_rec_flush_size",pr="$enabled_feature_flags",_r="$active_feature_flags",gr="$early_access_features",mr="$feature_flag_details",br="$feature_flag_payloads",yr="$feature_flag_request_id",wr="$minimal_flag_called_events",Sr="$override_feature_flags",xr="$override_feature_flag_payloads",Er="$stored_person_properties",kr="$stored_group_properties",$r="$groups",Tr="$surveys",Pr="$surveys_loaded_at",Rr="$surveys_activated",Cr="$surveys_activated_session",Or="$surveys_activated_timestamps",Ar="ph_product_tours",Ir="$product_tours_activated",Fr="$product_tours_activated_session",Mr="$conversations_widget_session_id",Dr="$conversations_ticket_id",Nr="$conversations_widget_state",Lr="$conversations_user_traits",jr="$flag_call_reported",Ur="$flag_call_reported_session_id",Br="$feature_flag_errors",zr="$feature_flag_evaluated_at",Hr="$user_state",qr="$client_session_props",Vr="$capture_rate_limit",Wr="$initial_campaign_params",Gr="$initial_referrer_info",Kr="$initial_person_info",Jr="$epp",Yr="$posthog_cookieless",Xr="$cookieless_mode",Qr="$sdk_debug_extensions_init_method",Zr="$sdk_debug_extensions_init_time_ms",ts="$sdk_debug_recording_script_not_loaded",is="$sdk_debug_replay_event_trigger_status",es="$sdk_debug_replay_linked_flag_trigger_status",rs="$sdk_debug_replay_matched_recording_trigger_groups",ss="$sdk_debug_replay_pending_trigger_conditions",ns="$sdk_debug_replay_remote_trigger_matching_config",os="$sdk_debug_replay_trigger_groups_count",as="$sdk_debug_replay_url_trigger_status",ls="$session_recording_start_reason",hs="PostHog loadExternalDependency extension not found.",us="anonymous",ds="identified",vs="identified_only",cs="visibilitychange",fs="beforeunload",ps="$pageview",_s="$pageleave",gs="$identify",ms="$groupidentify";function bs(t,i){D(t)&&t.forEach(i)}function ys(t,i){if(!q(t))if(D(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(var e in t)F.call(t,e)&&i(t[e],e)}var ws=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function Ss(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var xs=function(t){try{return t()}catch(t){return}},Es=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){Pe.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Pe.critical(t)}}},ks=function(t){var i={};return ys(t,function(t,e){(B(t)&&t.length>0||V(t))&&(i[e]=t)}),i};var $s=["herokuapp.com","vercel.app","netlify.app"];function Ts(t){var i=null==t?void 0:t.hostname;if(!B(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of $s)if(e===r)return!1;return!0}function Ps(t,i,e,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(i,e,{capture:void 0!==n&&n,passive:void 0===o||o})}function Rs(t){return"ph_toolbar_internal"===t.name}var Cs=t=>{if(u){try{for(var i=t+"=",e=u.cookie.split(";").filter(t=>t.length),r=0;e.length>r;r++){for(var s=e[r];" "==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}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return V(t)&&isFinite(t)&&Math.floor(t)===t});var Os=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(i,e,r,s){if(!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(s)||0>i||0>e||0>r||0>s||i>0xffffffffffff||e>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=i/Math.pow(2,40),n[1]=i/Math.pow(2,32),n[2]=i/Math.pow(2,24),n[3]=i/Math.pow(2,16),n[4]=i/256,n[5]=i,n[6]=112|e>>>8,n[7]=e,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new t(n)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}},As=class{generate(){var t=this.generateOrAbort();if(!U(t))return t;this.ri=0;var i=this.generateOrAbort();if(U(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t,i=(t=Date.now(),V(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0);if(i>this.ri)this.ri=i,this.ii();else{if(this.ri>=i+1e4)return;this.ni++,this.ni>4398046511103&&(this.ri++,this.ii())}return Os.fromFieldsV7(this.ri,Math.trunc(this.ni/Math.pow(2,30)),this.ni&Math.pow(2,30)-1,this.oi.nextUint32())}ii(){this.ni=1024*this.oi.nextUint32()+(1023&this.oi.nextUint32())}constructor(){this.ri=0,this.ni=0,this.oi=new Ms}},Is=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};a&&!U(a.crypto)&&crypto.getRandomValues&&(Is=t=>crypto.getRandomValues(t));var Fs,Ms=class{nextUint32(){return this.Pe.length>this.ai||(Is(this.Pe),this.ai=0),this.Pe[this.ai++]}constructor(){this.Pe=new Uint32Array(8),this.ai=1/0}},Ds=()=>Ns().toString(),Ns=()=>(Fs||(Fs=new As)).generate(),Ls="",js=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Us=null,Bs={si(){if(!H(Us))return Us;if(Us=!1,u)try{var t="__ph_cookie_support_"+Ds();Bs.ui(t,"xyz"),Us='"xyz"'===Cs(t),Bs.hi(t)}catch(t){Us=!1}return Us},ci(t){Pe.error("cookieStore error: "+t)},li:Cs,di(t){var i;try{i=JSON.parse(Bs.li(t))||{}}catch(t){}return i},ui(t,i,e,r,s){if(!u)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=u),Ls)return Ls;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Ds();!Ls&&r--;){var n=e.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";i.cookie=o+";max-age=3",i.cookie.includes(s)&&(i.cookie=o+";max-age=0",Ls=n)}return Ls}(t);if(!e){var r=(t=>{var i=t.match(js);return i?i[0]:""})(t);r!==e&&Pe.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(u.location.hostname,r);if(e){var l=new Date;l.setTime(l.getTime()+864e5*e),n="; expires="+l.toUTCString()}s&&(o="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+a+o;return h.length>3686.4&&Pe.warn("cookieStore warning: large cookie, len="+h.length),u.cookie=h,!0}catch(t){return!1}},hi(t,i){if(null!=u&&u.cookie)try{Bs.ui(t,"",-1,i)}catch(t){return}}},zs=null,Hs={si(){if(!H(zs))return zs;var t=!0;if(U(a))t=!1;else try{var i="__mplssupport__";Hs.ui(i,"xyz"),'"xyz"'!==Hs.li(i)&&(t=!1),Hs.hi(i)}catch(i){t=!1}return t||Pe.error("localStorage unsupported; falling back to cookie store"),zs=t,t},ci(t){Pe.error("localStorage error: "+t)},li(t){try{return null==a?void 0:a.localStorage.getItem(t)}catch(t){Hs.ci(t)}return null},di(t){try{return JSON.parse(Hs.li(t))||{}}catch(t){}return null},ui(t,i){try{return null==a||a.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Hs.ci(t)}return!1},hi(t){try{null==a||a.localStorage.removeItem(t)}catch(t){Hs.ci(t)}}},qs=[Er,_r,pr,mr,br,yr,zr,Br,jr],Vs=[Le,Ne,lr,hr,Jr,Kr,He,Hr],Ws=t=>t+"_cpm",Gs=["__proto__","constructor","prototype"],Ks=t=>{if(!L(t))return{};var i={};return Object.keys(t).forEach(e=>{-1===Gs.indexOf(e)&&(i[e]=t[e])}),i},Js=function(t,i){void 0===i&&(i=[]);var e={};return[...Vs,...i].forEach(i=>{var r=t[i];U(r)||H(r)||""===r||(e[i]=r)}),e},Ys=t=>{for(var i=5381,e=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);i=33*i^s,e=Math.imul(e^s,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},Xs=(t,i)=>({p:i,f:Ys(JSON.stringify(t))}),Qs=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=Bs.di(Ws(t)),r=(null==e?void 0:e.f)===Ys(i)&&D(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Zs=(t,i)=>i+"|"+(Bs.li(Ws(t))||""),tn={},en={si:()=>!0,ci(t){Pe.error("memoryStorage error: "+t)},li:t=>t in tn?tn[t]:null,di:t=>t in tn?tn[t]:null,ui:(t,i)=>(tn[t]=i,!0),hi(t){delete tn[t]}},rn=null,sn={si(){if(!H(rn))return rn;if(rn=!0,U(a))rn=!1;else try{var t="__support__";sn.ui(t,"xyz"),'"xyz"'!==sn.li(t)&&(rn=!1),sn.hi(t)}catch(t){rn=!1}return rn},ci(t){Pe.error("sessionStorage error: ",t)},li(t){try{return null==a?void 0:a.sessionStorage.getItem(t)}catch(t){sn.ci(t)}return null},di(t){try{return JSON.parse(sn.li(t))||null}catch(t){}return null},ui(t,i){try{return null==a||a.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){sn.ci(t)}return!1},hi(t){try{null==a||a.sessionStorage.removeItem(t)}catch(t){sn.ci(t)}}},nn=class{constructor(t){this._instance=t}get _n(){return this._instance.config}get consent(){return this.so()?0:this.oo}isOptedOut(){return"always"===this._n.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._n.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._n.opt_out_capturing_by_default}optInOut(t){this.ao.ui(this.lo,t?1:0,this._n.cookie_expiration,this._n.cross_subdomain_cookie,this._n.secure_cookie)}reset(){this.ao.hi(this.lo,this._n.cross_subdomain_cookie)}get lo(){var t=this._instance.config,i=t.token,e=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(e?e+i:"__ph_opt_in_out_"+i)}get oo(){var t=this.ao.li(this.lo);return et(t)?1:E(rt,t)?0:-1}get ao(){var t=this._n.opt_out_capturing_persistence_type,i="localStorage"===t?Hs:Bs,e=i.si()?i:en;if(!this.uo||this.uo!==e){this.uo=e;var r="localStorage"===t?Bs:Hs;r.li(this.lo)&&(this.uo.li(this.lo)||this.optInOut(et(r.li(this.lo))),r.hi(this.lo,this._n.cross_subdomain_cookie))}return this.uo}so(){return!!this._n.respect_dnt&&[null==h?void 0:h.doNotTrack,null==h?void 0:h.msDoNotTrack,b.doNotTrack,null==h?void 0:h.globalPrivacyControl].some(t=>et(t))}};function on(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!N(r))return i;try{var s=r(i);return B(s)&&s?s:i}catch(t){return Pe.error("Error in get_current_url, falling back to window.location.href",t),i}}function an(t){return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function ln(t){return!!t&&1===t.nodeType}function hn(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function un(t){return!!t&&3===t.nodeType}function dn(t){return!!t&&11===t.nodeType&&ln(t.host)}function vn(t){return t?k(t).split(/\s+/):[]}function cn(t,i){var e=function(t){var i,e=null==a||null==(i=a.location)?void 0:i.href;return U(e)?void 0:on(t,e)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function fn(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return vn(i)}function pn(t){return q(t)?null:k(t).split(/(\s+)/).filter(t=>Un(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function _n(t){var i="";return On(t)&&!An(t)&&t.childNodes&&t.childNodes.length&&ys(t.childNodes,function(t){var e;un(t)&&t.textContent&&(i+=null!==(e=pn(t.textContent))&&void 0!==e?e:"")}),k(i)}function gn(t){var i;return U(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var mn=["a","button","form","input","select","textarea","label"];function bn(t,i){var 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 yn(t,i){if(U(i))return!0;var e,r=function(t){if(i.some(i=>bn(t,i)))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function wn(t){var i=t.parentNode;return!(!i||!ln(i))&&i}var Sn=[".ph-no-autocapture","[data-ph-no-autocapture]"],xn=["next","previous","prev",">","<"],En=[...xn,"+","-","−","–"],kn=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,$n=[".ph-no-rageclick",".ph-no-capture"],Tn=["","text","search","email","password","url","tel","number"];function Pn(t,i){if(!a||Rn(t))return!1;var e,r,s,n,o;if(G(i)?(e=!!i&&$n,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:$n,r=null==i?void 0:i.content_ignorelist,s=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(s&&function(t){return!(!t||!ln(t))&&(!!hn(t,"textarea")||(hn(t,"input")?E(Tn,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var i=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===i||""===i}(t)))}(t))return!1;var l=Cn(t,!1).targetElementList;return!function(t,i){if(!1===t||U(t))return!1;var e;if(!0===t)e=xn;else{if(!D(t))return!1;if(t.length>10)return Pe.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map(t=>t.toLowerCase())}return i.some(t=>{var i=t.safeText,r=t.ariaLabel;return e.some(t=>kn(i,t)||kn(r,t))})}(r,l.map(t=>{var i;return{safeText:_n(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}}))&&!yn(l,e)}var Rn=t=>!t||hn(t,"html")||!ln(t),Cn=(t,i)=>{if(!a||Rn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!hn(s,"body");)if(dn(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=wn(s);if(!n)break;if(i||mn.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var o=a.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function On(t){for(var i=new Set,e=0,r=t;r.parentNode&&!hn(r,"body");r=r.parentNode){if(e++>=1e3||i.has(r))return!1;i.add(r);var s=fn(r);if(E(s,"ph-sensitive")||E(s,"ph-no-capture"))return!1}if(E(fn(t),"ph-include"))return!0;var n=t.type||"";if(B(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!B(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function An(t){return!!(hn(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||hn(t,"select")||hn(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var In=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}))$"),Fn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Mn=[16,15,14,13],Dn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Nn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Ln=/[0-9A-Za-z_]/;function jn(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function Un(t,i){if(void 0===i&&(i=!0),q(t))return!1;if(B(t)){if(t=k(t),i?In.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(Fn.lastIndex=0;i=Fn.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of Mn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(In.test(a)&&jn(a))return!0}}}return!1}(t))return!1;if(i?Dn.test(t):function(t){var i;for(Nn.lastIndex=0;i=Nn.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&Ln.test(e)&&Ln.test(r)))return!0}return!1}(t))return!1}return!0}function Bn(t){var i=_n(t);return Un(i=(i+" "+zn(t)).trim())?i:""}function zn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&ys(t.childNodes,function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=_n(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+zn(t)).trim())}catch(t){Pe.error("[AutoCapture]",t)}}),i}function Hn(t){return t.replace(/"|\\"/g,'\\"')}function qn(t){var i=t.attr__class;if(i)return D(i)?i:vn(i)}var Vn=Re("[Dead Clicks]"),Wn=()=>!0,Gn=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Xe)),r=t.instance.config.capture_dead_clicks;return G(r)?r:!!L(r)||e},Kn=class{get lazyLoadedDeadClicksAutocapture(){return this.ho}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[Xe]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.do(()=>{this.vo()}):this.stop()}do(t){var i,e;null!=(i=b.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=b.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?Vn.error("failed to load script",i):t()})}vo(){var t;if(u){if(!this.ho&&null!=(t=b.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=L(this.instance.config.capture_dead_clicks)?s({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.ho=b.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.ho.start(u),Vn.info("starting...")}}else Vn.error("`document` not found. Cannot start.")}stop(){this.ho&&(this.ho.stop(),this.ho=void 0,Vn.info("stopping..."))}},Jn=Re("[SegmentIntegration]");function Yn(t,i,e){void 0===e&&(e=!0);var r=t.config.segment;if(!r)return i();!function(t,i,e){var r=t.config.segment;if(!r)return i();var s=r=>{var s=()=>r.anonymousId()||Ds();t.config.get_device_id=s,e&&r.id()&&(t.register({distinct_id:r.id(),$device_id:s()}),t.persistence.set_property(Hr,ds)),i(e?void 0:r.anonymousId()||void 0)},n=r.user();"then"in n&&N(n.then)?n.then(s):s(n)}(t,e=>{r.register(((t,i)=>{"undefined"!=typeof Promise&&Promise.resolve||Jn.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,r)=>{if(!r)return e;var s=!!i&&e.event.anonymousId===i&&!e.event.userId;s||e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Jn.info("No userId set, resetting PostHog"),t.reset()),s||(i=void 0),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Jn.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var n=t.calculateEventProperties(r,e.event.properties);return e.event.properties=Object.assign({},n,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return e(t,t.event.event)},page(t){return e(t,ps)},identify(t){return e(t,gs)},screen(t){return e(t,"$screen")}}})(t,e)).then(()=>{i()},t=>{Jn.error("Failed to register the Segment integration",t),i()})},e)}var Xn="posthog-js";function Qn(t,i){var e=void 0===i?{}:i,r=e.organization,n=e.projectId,o=e.prefix,a=e.severityAllowList,l=void 0===a?["error"]:a,h=e.sendExceptionsToPostHog,u=void 0===h||h;return i=>{var e,a,h,d,v,c;if("*"!==l&&!l.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var f=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=f,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p=(null==(e=i.exception)?void 0:e.values)||[],_=p.map(t=>s({},t,{stacktrace:t.stacktrace?s({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>s({},t,{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null==(a=p[0])?void 0:a.value)||i.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:i.level,$exception_list:_,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||i.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:i.tags};return r&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+n+"&query="+i.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),i}}var Zn=class{constructor(t,i,e,r,s,n){this.name=Xn,this.setupOnce=function(o){o(Qn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},to=class{constructor(t){this.co=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Pe.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.fo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.po()}po(){var t;this.mo=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.co)}destroy(){var t;null==(t=this.mo)||t.call(this),this.mo=void 0}doPageView(t,i){var e,r=this.yo(t,i);return this.fo={pathname:null!==(e=null==a?void 0:a.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.yo(t,null==(i=this.fo)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.fo)?void 0:t.pageViewId}}yo(t,i){var e=this.fo;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(U(n)||U(o)||U(a)||U(l)||U(h)||U(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?st(o/n,0,1,Pe):1,v=n>1?st(a/n,0,1,Pe):1,c=l>1?st(h/l,0,1,Pe):1,f=l>1?st(u/l,0,1,Pe):1;r=ws(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}},io=["flags","surveys"],eo={[De]:{exposure:"hidden"},[Ue]:{exposure:"hidden"},[Be]:{exposure:"hidden"},[qe]:{exposure:"hidden"},[He]:{exposure:"hidden"},[Ve]:{exposure:"event"},[We]:{exposure:"hidden"},[Ze]:{exposure:"hidden"},[Ge]:{exposure:"event"},[Ke]:{exposure:"hidden"},[Je]:{exposure:"event"},[Ye]:{exposure:"event"},[Xe]:{exposure:"event"},[Qe]:{exposure:"hidden"},[tr]:{exposure:"event"},[ir]:{exposure:"hidden"},[er]:{exposure:"hidden"},[lr]:{exposure:"hidden"},[hr]:{exposure:"event"},[rr]:{exposure:"event",shouldSkipFromEventProperties:t=>H(t)},[ur]:{exposure:"event"},[dr]:{exposure:"event"},[vr]:{exposure:"event"},[cr]:{exposure:"event"},[fr]:{exposure:"hidden"},[pr]:{exposure:"hidden",storageGroup:"flags"},[_r]:{exposure:"hidden",storageGroup:"flags"},[gr]:{exposure:"hidden"},[mr]:{exposure:"hidden",storageGroup:"flags"},[br]:{exposure:"hidden",storageGroup:"flags"},[yr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[wr]:{exposure:"hidden",storageGroup:"flags"},[Sr]:{exposure:"hidden"},[xr]:{exposure:"hidden"},[Er]:{exposure:"hidden"},[kr]:{exposure:"hidden"},[Tr]:{exposure:"hidden",storageGroup:"surveys"},[Pr]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Rr]:{exposure:"event"},[Cr]:{exposure:"hidden"},[Or]:{exposure:"hidden"},[Ar]:{exposure:"hidden"},[Ir]:{exposure:"hidden"},[Fr]:{exposure:"hidden"},[Mr]:{exposure:"event"},[Dr]:{exposure:"event"},[Nr]:{exposure:"event"},[Lr]:{exposure:"event"},[jr]:{exposure:"hidden"},[Ur]:{exposure:"hidden"},[$r]:{exposure:"event"},[Br]:{exposure:"hidden"},[zr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Hr]:{exposure:"hidden"},[qr]:{exposure:"hidden"},[Vr]:{exposure:"hidden"},[Wr]:{exposure:"hidden"},[Gr]:{exposure:"hidden"},[Kr]:{exposure:"hidden"},[Jr]:{exposure:"hidden"},[sr]:{exposure:"event"},[nr]:{exposure:"event"},[or]:{exposure:"event"},[ar]:{exposure:"event"},[Qr]:{exposure:"event"},[Zr]:{exposure:"event"},[ts]:{exposure:"event"},[is]:{exposure:"event"},[es]:{exposure:"event"},[rs]:{exposure:"event"},[ss]:{exposure:"event"},[ns]:{exposure:"event"},[os]:{exposure:"event"},[as]:{exposure:"event"},[ls]:{exposure:"event"}},ro=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],so=t=>{var i=eo[t];if(i)return i;for(var e of ro){var r=e[1];if(0===t.indexOf(e[0]))return r}},no=(t,i)=>{try{return JSON.stringify(t,(t,i)=>"bigint"==typeof i?i.toString():i,i)}catch(i){return P(t)}},oo=t=>{var i=null==u?void 0:u.createElement("a");return U(i)?null:(i.href=t,i)},ao=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!D(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Pe.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},lo=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");D(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},ho=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},uo=(t,i)=>t>=i&&g(),vo=(t,i,e,r)=>{if(0===t){if(g()){var s=i+1;return s===e&&r(),s}return i}return 0},co=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],fo=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...co],po="<masked>",_o=["li_fat_id"];function go(t,i,e){if(!u)return{};var r,s=i?[...co,...e||[]]:[],n=mo(lo(u.URL,s,po),t);return ws((r={},ys(_o,function(t){var i=Cs(t);r[t]=i||null}),r),n)}function mo(t,i){var e=fo.concat(i||[]),r={};return ys(e,function(i){var e=ao(t,i);r[i]=e||null}),r}function bo(t){var 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",r={};if(!H(i)){r.$search_engine=i;var s=u?ao(u.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function yo(){return navigator.language||navigator.userLanguage}var wo="$direct";function So(){return(null==u?void 0:u.referrer)||wo}function xo(t,i,e){var r;void 0===e&&(e=!1);var s=t?[...co,...i||[]]:[],n=null==(r=e?gi(null==d?void 0:d.href):null==d?void 0:d.href)?void 0:r.substring(0,1e3);return{r:So().substring(0,1e3),u:n?lo(n,s,po):void 0}}function Eo(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?gi(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==wo?wo:null==(e=oo(r))?void 0:e.host};if(n){o.$current_url=n;var a=oo(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,ws(o,mo(n))}return r&&ws(o,bo(r)),o}function ko(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function $o(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var To={flags:zr,surveys:Pr},Po=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ro=t=>t+"_cookie_identity_change_pending",Co=t=>{var i="",e=0;for(var r of t){var s=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(e+s>1e3)break;i+=r,e+=s}return i},Oo="main",Ao=[pr,_r,mr,br,yr,zr,wr,Er],Io=t=>-1!==Ao.indexOf(t),Fo=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},Mo=t=>{if(!t)return{};var i=JSON.parse(t);return L(i)?i:{}},Do=(t,i)=>{ys(t,(e,r)=>{var s=so(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]})},No=class{constructor(t,i,e){if(void 0===e&&(e=!0),this.bo={},this._o=!1,this.wo=!1,this.ko=!1,this.So=!1,this.xo=!1,this.Co=new Map,this.To=!1,this.Mo=!1,this.Io=!1,this.Eo=!1,this.Ro=new Set,this._n=t,this.Ao=e,this.props={},this.Po=void 0,this.Fo=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.ao=this.Oo(t),this.ko=this.$o(t),this.load(),this.Do(),t.debug&&Pe.info("Persistence loaded",t.persistence,s({},this.props)),this.update_config(t,t,i),this.save(),a){var r=()=>this.flush();Ps(a,"beforeunload",r,{capture:!1}),Ps(a,"pagehide",r,{capture:!1}),this.Lo=t=>{if(this._o&&(!t.storageArea||t.storageArea===(null==a?void 0:a.localStorage))&&t.key)if(t.key!==this.Fo){if(this.ko){var i=io.find(i=>t.key===this.No(i));i&&this.qo(t.key,i)}}else this.qo(t.key,Oo)},Ps(a,"storage",this.Lo)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var i=t[0],e=t[1],r=this.Co.get(i);if(Io(i)&&!0!==r)if(!0!==e){var s=new Set(r||[]);e.forEach(t=>s.add(t)),s.size&&this.jo(i,s)}else this.jo(i,!0)})}onCrossTabFeatureFlagChange(t){return this.Ro.add(t),()=>this.Ro.delete(t)}destroy(){this.Lo&&a&&(a.removeEventListener("storage",this.Lo),this.Lo=void 0),this.Ro.clear()}qo(t,i,e){if(void 0===e&&(e=!0),this.Bo)return!1;var r,s;try{if(s=Hs.li(t),H(s)){var n=this.Ho(i);return n.storageValue=null,i!==Oo&&(n.persisted=!1),!1}r=Mo(s)}catch(t){return!1}var o=i===Oo?r:Hs.di(this.Fo);if(o&&this.zo(o))return!1;var a=this.Uo(r,i,e);return i===Oo&&this.ko&&!Fo(this.Wo().main,r)||this.Vo(r,i,!0,s),a}zo(t){var i=this.props[Ne],e=t[Ne];return!U(i)&&!U(e)&&i!==e}Vo(t,i,e,r){var s=this.Ho(i);s.storageValue=r,i!==Oo&&(s.persisted=e);try{s.fingerprint=this.Go(t,i)}catch(t){s.fingerprint=void 0}}Uo(t,i,e){var r=!1;return Ao.forEach(e=>{var s,n=null==(s=so(e))?void 0:s.storageGroup;if(!(i===Oo&&this.ko&&n||i!==Oo&&n!==i)){var o=e in t,a=this.Zo(e,o?t[e]:void 0),l=this.Co.has(e)?e in this.props:o;l===e in this.props&&Fo(a,this.props[e])||(l?this.Jo(e,a,!1):this.Qo(e,!1),r=!0)}}),r&&e&&this.Ro.forEach(t=>t()),r}Ko(){if(!this._o)return!1;try{this.Io=!1;var t,i=Hs.li(this.Fo),e=this.Ho(Oo),r=!1,s=!1;if(i!==e.storageValue)if(H(i))e.storageValue=null;else{if(t=Mo(i),this.Io=!this.Mo&&this.zo(t),this.Io)return!1;s=this.Uo(t,Oo,!1),!this.ko||Fo(this.Wo().main,t)?this.Vo(t,Oo,!0,i):e.storageValue=i,r=!0}return this.ko&&io.forEach(i=>{var e=Hs.li(this.No(i)),n=this.Ho(i),o=t||{},a=r&&Ao.some(t=>{var e;return(null==(e=so(t))?void 0:e.storageGroup)===i&&t in o});if(e!==n.storageValue||a){if(H(e))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Uo(o,i,!1)||s));var l=Mo(e);s=this.Uo(l,i,!1)||s,this.Vo(l,i,!0,e)}}),s}catch(t){return!1}}jo(t,i){this.Co.set(t,i);var e=so(t);null!=e&&e.volatile||(this.Ho((this.ko?null==e?void 0:e.storageGroup:void 0)||Oo).fingerprint=void 0,this.Xo(t))}Yo(){Ao.forEach(t=>this.Co.set(t,!0))}Do(){if(this._o)try{var t=Hs.li(this.Fo),i=Mo(t);this.Ho(Oo).storageValue=t,Ao.forEach(t=>{var e,r=this.ko?null==(e=so(t))?void 0:e.storageGroup:void 0,s=r?Hs.li(this.No(r)):null;if(r){var n=this.Ho(r);n.storageValue=s,n.persisted=!H(s)}var o=r&&!H(s)?Mo(s):i;t in this.props?this.ta(t,o[t],this.props[t]):t in o&&this.jo(t,!0)})}catch(t){}}Zo(t,i){var e=this.Co.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){var r=new Set(D(i)?i:[]),n=new Set(D(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?r.add(t):r.delete(t)),Array.from(r)}var o=L(i)?s({},i):{},a=L(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in a?o[t]=a[t]:delete o[t]}),o}ta(t,i,e){if(Io(t)){var r=this.Co.get(t);if(!0!==r){var s=i;if(this._o)try{var n,o=this.ko?null==(n=so(t))?void 0:n.storageGroup:void 0,a=o?this.No(o):this.Fo;s=Mo(Hs.li(a))[t]}catch(t){}var l=new Set(r||[]);if("$active_feature_flags"===t){if(!U(i)&&!D(i)||!U(s)&&!D(s)||!D(e))return void this.jo(t,!0);var h=new Set(i||[]),u=new Set(s||[]),d=new Set(e);new Set([...h,...d]).forEach(t=>{h.has(t)!==d.has(t)&&l.add(t)}),l.forEach(t=>{u.has(t)===d.has(t)&&l.delete(t)})}else{if(!L(e))return void(Fo(s,e)?this.Co.delete(t):this.jo(t,!0));if(!U(i)&&!L(i)||U(i)&&j(e)&&U(s))return void this.jo(t,!0);var v=L(i)?i:{},c=L(s)?s:{};new Set([...Object.keys(v),...Object.keys(e)]).forEach(t=>{t in v==t in e&&Fo(v[t],e[t])||l.add(t)}),l.forEach(t=>{t in c==t in e&&Fo(c[t],e[t])&&l.delete(t)})}l.size?this.jo(t,l):this.Co.delete(t)}}}ea(){var t,i=null==(t=this._n)?void 0:t.persistence_save_debounce_ms;return V(i)&&i>0?i:0}ia(t){if(this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase())if(t)try{var i=Js(t,this._n.cookie_persisted_properties||[]),e=Xs(i,this._n.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=Bs.li(this.Fo)||void 0;s&&Zs(this.Fo,s)===r&&(this.ra=r,this.na=s)}catch(t){}else try{var n=Bs.li(this.Fo)||void 0;this.ra=n?Zs(this.Fo,n):void 0,this.na=n}catch(t){}}syncCookieProperties(){return this.sa(this._n)}sa(t,i){if(void 0===i&&(i=!1),this.Bo&&!i||this.xo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=Bs.li(this.Fo)||void 0}catch(t){}if(!e||e===this.na)return!1;var r,s=Zs(this.Fo,e);try{r=Ks(JSON.parse(e))}catch(t){return!1}if((Bs.li(this.Fo)||void 0)!==e)return!1;this.ra=s,this.na=e;var n=Qs(this.Fo,e),o=[...Vs,...n.properties],a={};if(Object.keys(r).forEach(t=>{var i=r[t];(U(i)||H(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(a[t]=!0,delete r[t])}),j(r))return!1;var l="distinct_id"in r||"anonymous"===r.$user_state||"identified"===r.$user_state,h=this.props,u=h[Ne],d=h[Hr],v=ws({},h);[...Vs,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||"distinct_id"!==t&&"$user_state"!==t)){var i=v[t];(n.isValid||-1===Vs.indexOf(t)||!1!==i&&0!==i)&&delete v[t]}}),this.props=ws(v,r),Ao.forEach(t=>{var i=t in this.props;t in h===i&&Fo(h[t],this.props[t])||(i?this.ta(t,h[t],this.props[t]):this.jo(t,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this.Jo(Hr,us);var c=this.props[Ne],f=this.props[Hr];return!l||c===u&&f===d||(this.Mo=!0,this.So=!0,sn.ui(Ro(this.Fo),!0),this.Qo(Er),this.Qo(_r),this.Qo(pr),this.Qo(mr),this.Qo(br),this.Qo(yr),this.Qo(zr),this.Qo(Br),this.Qo(jr),"anonymous"!==f||"identified"!==d&&"anonymous"!==r.$user_state&&(U(u)||c===u)||(Do(this.props,r),this.Qo(kr)),"identified"===f?this.props.$user_id=c:delete this.props.$user_id,this.Qo(Ue)),!0}consumeCookieIdentityChange(){var t=Ro(this.Fo),i=this.So||!!sn.li(t);return this.So=!1,i&&sn.hi(t),i}oa(t){return void 0===t&&(t=!1),!(this.xo||this.Bo&&!t||!this._n.cookieWinsOnConflict||"localstorage+cookie"!==this._n.persistence.toLowerCase()||(this.xo=!0,0))}aa(){this.xo&&(U(this.la)||(clearTimeout(this.la),this.la=void 0),delete this.bo[Oo],this.ua(!0))}ha(t){if(void 0===t&&(t=!0),this.xo)try{t?this.aa():U(this.la)||(clearTimeout(this.la),this.la=void 0)}finally{this.xo=!1}}isDisabled(){return!!this.Bo}Oo(t){-1===Po.indexOf(t.persistence.toLowerCase())&&(Pe.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i,e=function(t,i){void 0===t&&(t=[]),void 0===i&&(i=!1);var e=[...Vs,...t];return s({},Hs,{di(t){try{var r,s={};try{r=Bs.li(t)||void 0,s=r?Ks(JSON.parse(r)):{}}catch(t){}var n,o=JSON.parse(Hs.li(t)||"{}");if(i){var a=Qs(t,r),l=[...Vs,...a.properties],h={};Object.keys(s).forEach(t=>{var i=s[t];H(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(h[t]=i)});var u="distinct_id"in h||"anonymous"===h.$user_state||"identified"===h.$user_state;if(Object.keys(h).length>0){var d,v=o[Ne],c=null!==(d=o.$user_state)&&void 0!==d?d:"anonymous";e.forEach(t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(u||"distinct_id"!==t&&"$user_state"!==t)){var i=o[t];(a.isValid||-1===Vs.indexOf(t)||!1!==i&&0!==i)&&delete o[t]}}),!u||"$user_state"in s||"$user_state"in o||(o[Hr]=us),!u||("distinct_id"in h?h[Ne]:o[Ne])===v&&("$user_state"in h?h[Hr]:o[Hr])===c||(qs.forEach(t=>delete o[t]),"identified"===h.$user_state&&"distinct_id"in h?o.$user_id=h[Ne]:delete o.$user_id,"identified"!==h.$user_state&&(delete o[$r],delete o[kr]),delete o.__alias)}n=ws(o,h)}else n=ws(s,o);return Hs.ui(t,n),n}catch(t){}return null},ui(e,r,s,n,o,a){var l=Hs.ui(e,r,void 0,void 0,a);try{var h=Js(r,t);if(Object.keys(h).length){if(i){var u=Ws(e),d=Xs(h,t);if(Bs.ui(u,d,s,n,o,a),Bs.li(u)!==JSON.stringify(d)){Bs.hi(u,n);var v=Js(r);return Bs.ui(e,v,s,n,o,a),l}}Bs.ui(e,h,s,n,o,a)}}catch(t){Hs.ci(t)}return l},hi(t,i){try{null==a||a.localStorage.removeItem(t),Bs.hi(t,i),Bs.hi(Ws(t),i)}catch(t){Hs.ci(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),r=!1,n=!1,o=t.persistence.toLowerCase();return"localstorage"===o&&Hs.si()?(i=Hs,n=!0):"localstorage+cookie"===o&&e.si()?(i=e,n=!0,r=!0):"sessionstorage"===o&&sn.si()?i=sn:"memory"===o?i=en:"cookie"===o&&Bs.si()?(i=Bs,r=!0):e.si()?(i=e,n=!0,r=!0):Bs.si()?(i=Bs,r=!0):i=en,this._o=n,this.wo=r,i}No(t){return this.Fo+"__"+t}$o(t){return this._o&&!!t.split_storage}properties(){var t={};return ys(this.props,(i,e)=>{var r=so(e);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(i))return;t[e]=i}}),t}load(t){if(void 0===t&&(t=!1),!this.Bo||t){var i=this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase(),e=i?Hs.di(this.Fo):null,r={};if(i)try{ys(r=Ks(Bs.di(this.Fo)),(t,i)=>{(U(t)||H(t)||""===t)&&delete r[i]})}catch(t){}var s=this.ao.di(this.Fo);if(s&&(this.props=ws({},s)),this.ko&&this.da(),i&&s){var n,o,a=null==e?void 0:e[Ne],l=null!==(n=null==e?void 0:e.$user_state)&&void 0!==n?n:"anonymous",h=s[Ne],u=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(h!==a||u!==l){this.So=!0,sn.ui(Ro(this.Fo),!0);var d=ws({},this.props);qs.forEach(t=>delete d[t]),"anonymous"!==u||"identified"!==l&&"anonymous"!==r.$user_state&&(U(a)||h===a)||(Do(d,r),delete d[kr]),this.props=d;var v=new Set;qs.forEach(t=>{var i,e=null==(i=so(t))?void 0:i.storageGroup;e&&v.add(e)}),v.forEach(t=>{var i={};ys(this.props,(e,r)=>{var s;(null==(s=so(r))?void 0:s.storageGroup)===t&&(i[r]=e)}),j(i)?(Hs.hi(this.No(t)),this.bo[t]={}):Hs.ui(this.No(t),i)&&(this.bo[t]={persisted:!0,fingerprint:this.Go(i,t)})})}}sn.li(Ro(this.Fo))&&(this.So=!0)}}da(){for(var t of io){var i=Hs.di(this.No(t));if(i&&!j(i)){var e=this.Ho(t);e.persisted=!0,this.va(t)||(e.fingerprint=this.Go(i,t)),this.ca(t,i)||ws(this.props,i)}}}va(t){return Object.keys(this.props).some(i=>{var e;return(null==(e=so(i))?void 0:e.storageGroup)===t})}ca(t,i){var e=To[t];if(!e)return!1;var r=i[e],s=this.props[e];return V(r)&&V(s)&&s>r}refreshKey(t){var i;if(!(this.Bo||"$fbc_persistence"===t&&this.Eo)){var e=this.ko?null==(i=so(t))?void 0:i.storageGroup:void 0,r=e?Hs.di(this.No(e)):this.ao.di(this.Fo);if(r&&t in r)this.Jo(t,r[t],!1);else{if(e){var s=this.ao.di(this.Fo);if(s&&t in s)return void this.Jo(t,s[t],!1)}this.Qo(t,!1)}}}save(){if(!this.Bo){var t=this.ea();t>0?U(this.la)&&(this.la=setTimeout(()=>{this.la=void 0,this.ua()},t)):this.ua()}}flush(){U(this.la)||(clearTimeout(this.la),this.la=void 0,this.ua())}ua(t){if(void 0===t&&(t=!1),!(this.Bo||this.xo&&!t)){t||(this.syncCookieProperties(),this.Eo||this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase()||this.refreshKey(He));var i=!t&&!this.To;i||(this.Io=!1);var e=!!i&&this.Ko();if(this.Io)this._n.debug&&Pe.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.ko)return this.fa(),void(e&&this.Ro.forEach(t=>t()));var r=this.pa(this.ao,this.Fo,this.props,Oo);"written"===r&&this.ia(this.props),"failed"!==r&&(this.Co.clear(),this.Mo=!1,this.Eo=!1),e&&this.Ro.forEach(t=>t())}}}fa(){var t=this,i=this.Wo(),e=i.main,r=i.groups,s=this.pa(this.ao,this.Fo,e,Oo);"written"===s&&this.ia(e),"failed"!==s&&(this.Mo=!1,this.Eo=!1,Ao.forEach(t=>{var i;null!=(i=so(t))&&i.storageGroup||this.Co.delete(t)}));var n=function(i){var e,s=r[i];if(j(s)&&(null==(e=t.bo[i])||!e.persisted))return Ao.forEach(e=>{var r;(null==(r=so(e))?void 0:r.storageGroup)===i&&t.Co.delete(e)}),1;var n=t.pa(Hs,t.No(i),s,i);"failed"!==n&&Ao.forEach(e=>{var r=so(e);(null==r?void 0:r.storageGroup)!==i||"written"!==n&&r.volatile||t.Co.delete(e)})};for(var o of io)if(n(o))continue}Wo(){var t={},i={flags:{},surveys:{}};return ys(this.props,(e,r)=>{var s,n=null==(s=so(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e}),{main:t,groups:i}}Go(t,i){if(i===Oo)return JSON.stringify(t)+"|"+this.ga+"|"+this.ma+"|"+this.ya;var e={};return ys(t,(t,i)=>{var r;e[i]=null!=(r=so(i))&&r.volatile?"__volatile__":t}),JSON.stringify(e)}pa(t,i,e,r){var s,n=this.Ho(r);if(r!==Oo&&!n.dirty&&!U(n.fingerprint))return"skipped";try{if((s=this.Go(e,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.ui(i,e,this.ga,this.ma,this.ya,this._n.debug)?(n.dirty=!1,r!==Oo&&(n.persisted=!0),U(s)||(n.fingerprint=s),this._o&&(n.storageValue=Hs.li(i)),"written"):(this._n.debug&&Pe.warn('failed to persist storage entry "'+i+'"; will retry on next save'),"failed")}remove(t){var i=(void 0===t?{}:t).keepGroupEntries,e=void 0!==i&&i;if(this.Yo(),U(this.la)||(clearTimeout(this.la),this.la=void 0),this.ao.hi(this.Fo,!1),this.ao.hi(this.Fo,!0),!e&&this.Ao)for(var r of io)Hs.hi(this.No(r));e?delete this.bo[Oo]:this.bo={},this.ra=void 0,this.na=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(L(t)){this.syncCookieProperties(),U(i)&&(i="None"),this.ga=U(e)?this.ba:e;var r=!1;if(ys(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.Jo(e,t),r=!0)}),r)return this.save(),!0}return!1}register(t,i){if(L(t)){this.syncCookieProperties(),this.ga=U(i)?this.ba:i;var e=!1;if(ys(t,(i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||L(i)||D(i))&&(this.Jo(r,i),e=!0)}),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var i="string"==typeof t?[t]:t,e=!1;for(var r of i)r in this.props&&(this.Qo(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==u?void 0:u.URL;if(t!==this.Po){var i=go(this._n.custom_campaign_params,this._n.mask_personal_data_properties,this._n.custom_personal_data_properties),e=!j(ks(i));return e&&this.register(i),this.Po=t,e?i:void 0}}update_search_keyword(){var t;this.register((t=null==u?void 0:u.referrer)?bo(t):{})}update_referrer_info(){var t;this.register_once({$referrer:So(),$referring_domain:null!=u&&u.referrer&&(null==(t=oo(u.referrer))?void 0:t.host)||wo},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=xo(this._n.mask_personal_data_properties,this._n.custom_personal_data_properties,this._n.disable_capture_url_hashes);this.register_once({[Kr]:this.wo?{r:Co(t.r),u:t.u?Co(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};ys([Gr,Wr],i=>{var e=this.props[i];e&&ys(e,function(i,e){t["$initial_"+T(e)]=i})});var i=this.props[Kr];return i&&ws(t,function(t,i){void 0===i&&(i=!1);var e=Eo(t,i),r={};return ys(e,function(t,i){r["$initial_"+T(i)]=t}),r}(i,this._n.disable_capture_url_hashes)),t}safe_merge(t){return ys(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){var r=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every((t,i)=>t===r[i])})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),o=r||n,a=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,h=!!this.Bo&&!l;l||this.sa(i,h),this._n=t,!l&&(r||n||a)&&(this.ra=void 0,this.na=void 0,this.sa(s({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),h));var u=o||a?this.Oo(t):this.ao;this._a();var d=this.$o(t),v=o||d!==this.ko,c=!l&&(v||t.cross_subdomain_cookie!==this.ma||t.secure_cookie!==this.ya)&&this.oa(h);this.To=v;try{if(this.ba=this.ga=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var f=this.props;this.clear(),this.ao=u,this.ko=d,this.props=f,this.save()}else a&&(this.ao=u,l||(delete this.bo[Oo],this.ua()))}finally{this.To=!1,c&&this.ha()}}_a(){var t=this.props[Kr];if(this.wo&&L(t)&&"string"==typeof t.r){var i=Co(t.r),e="string"==typeof t.u?Co(t.u):t.u;i===t.r&&e===t.u||this.Jo(Kr,s({},t,{r:i,u:e}))}}set_disabled(t){this.Bo=t,this.Bo?this.remove():this.save()}set_cross_subdomain(t){t!==this.ma&&(this.ma=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ya&&(this.ya=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props.__timers||{};e[t]=i,this.Jo(qe,e),this.save()}remove_event_timer(t){var i=this.props.__timers||{},e=i[t];return U(e)||(delete i[t],this.Jo(qe,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.Jo(t,i),this.save()}Jo(t,i,e){var r;void 0===e&&(e=!0);var s=this.props[t];this.props[t]=i,e&&("distinct_id"!==t&&"$user_state"!==t||s===i||(this.Mo=!0),"$fbc_persistence"!==t||Fo(s,i)||(this.Eo=!0),this.ta(t,s,i),null!=(r=so(t))&&r.volatile||this.Xo(t))}Qo(t,i){void 0===i&&(i=!0),delete this.props[t],i&&(Io(t)&&this.jo(t,!0),"$fbc_persistence"===t&&(this.Eo=!0),this.Xo(t))}Xo(t){var i,e=null==(i=so(t))?void 0:i.storageGroup;e&&(this.Ho(e).dirty=!0)}Ho(t){return this.bo[t]||(this.bo[t]={})}},Lo={GZipJS:"gzip-js",Base64:"base64"},jo={Activation:"events",Cancellation:"cancelEvents"},Uo={Button:"button",Tab:"tab",Selector:"selector"},Bo={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},zo={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Ho={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},qo={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Vo={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Wo={Once:"once",Recurring:"recurring",Always:"always"},Go={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Ko={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Jo={Popover:"popover",Inline:"inline"};function Yo(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&N(e.then)&&e.then(void 0,()=>{})}}}}var Xo={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Qo={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Zo={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ta=Re("[RateLimiter]"),ia=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(t=>{ta.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void ta.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property("$capture_rate_limit"))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(V(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.wa(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Vr,a),{isRateLimited:l,remainingTokens:a.tokens}}ka(t){var i=this.instance.config.property_denylist;return!D(i)||!i.includes(t)}Sa(){var t;if(this.ka("$current_url")&&this.ka("$pathname")&&null!=d&&d.pathname)return""+(null!==(t=d.origin)&&void 0!==t?t:"")+d.pathname}wa(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Sa(),o=this.ka("$session_id")?null==(i=(e=this.instance).get_session_id)?void 0:i.call(e):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}},ea=Re("[RemoteConfig]"),ra=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=b._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}xa(t){var i,e;null!=(i=b.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=b.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Ca(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 ea.info("Using preloaded remote config",this.remoteConfig),void this.Ta(this.remoteConfig);if(this._instance.Ma())return void ea.warn("Remote config is disabled. Falling back to local config.");this.xa(t=>{if(!t)return ea.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ca(t=>{this.Ta(t.json,t)});this.Ta(t)})}catch(t){ea.error("Error loading remote config",t),this.Ta()}}Ta(t,i){!t&&i&&(0===i.statusCode?i.error||ea.warn("Failed to fetch remote config from PostHog."):ea.error("Failed to fetch remote config from PostHog."));try{this._instance.Ta(t?{ok:!0,config:t}:{ok:!1})}catch(t){ea.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)||e.ensureFlagsLoaded()}catch(t){ea.error("Error loading feature flags",t)}}},sa=["fatal","error","warning","log","info","debug"],na=Uint8Array,oa=Uint16Array,aa=Uint32Array,la=new na([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]),ha=new na([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]),ua=new na([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),da=function(t,i){for(var e=new oa(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new aa(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},va=da(la,2),ca=va[1];va[0][28]=258,ca[258]=28;for(var fa=da(ha,0)[1],pa=new oa(32768),_a=0;32768>_a;++_a){var ga=(43690&_a)>>>1|(21845&_a)<<1;pa[_a]=((65280&(ga=(61680&(ga=(52428&ga)>>>2|(13107&ga)<<2))>>>4|(3855&ga)<<4))>>>8|(255&ga)<<8)>>>1}var ma=function(t,i,e){for(var r=t.length,s=0,n=new oa(i);r>s;++s)++n[t[s]-1];var o,a=new oa(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new oa(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[pa[d]>>>l]=h}else for(o=new oa(r),s=0;r>s;++s)o[s]=pa[a[t[s]-1]++]>>>15-t[s];return o},ba=new na(288);for(_a=0;144>_a;++_a)ba[_a]=8;for(_a=144;256>_a;++_a)ba[_a]=9;for(_a=256;280>_a;++_a)ba[_a]=7;for(_a=280;288>_a;++_a)ba[_a]=8;var ya=new na(32);for(_a=0;32>_a;++_a)ya[_a]=5;var wa=ma(ba,9,0),Sa=ma(ya,5,0),xa=function(t){return(t/8|0)+(7&t&&1)},Ea=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof oa?oa:t instanceof aa?aa:na)(e-i);return r.set(t.subarray(i,e)),r},ka=function(t,i,e){var r=i/8|0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},$a=function(t,i,e){var r=i/8|0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},Ta=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new na(0),0];if(1==s){var o=new na(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort(function(t,i){return t.f-i.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[d].f>e[h].f?h++:d++],l=e[h!=u&&e[d].f>e[h].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new oa(v+1),f=Pa(e[u-1],c,0);if(f>i){r=0;var p=0,_=f-i,g=1<<_;for(n.sort(function(t,i){return c[i.s]-c[t.s]||t.f-i.f});s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=g-(1<<f-c[m]),c[m]=i}for(p>>>=_;p>0;){var b=n[r].s;i>c[b]?p-=1<<i-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new na(c),f]},Pa=function(t,i,e){return-1==t.s?Math.max(Pa(t.l,i,e+1),Pa(t.r,i,e+1)):i[t.s]=e},Ra=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new oa(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},Ca=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},Oa=function(t,i,e){var r=e.length,s=xa(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=e[n];return 8*(s+4+r)},Aa=function(t,i,e,r,s,n,o,a,l,h,u){ka(i,u++,e),++s[256];for(var d=Ta(s,15),v=d[0],c=d[1],f=Ta(n,15),p=f[0],_=f[1],g=Ra(v),m=g[0],b=g[1],y=Ra(p),w=y[0],S=y[1],x=new oa(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var k=Ta(x,7),T=k[0],P=k[1],R=19;R>4&&!T[ua[R-1]];--R);var C,O,A,I,F=h+5<<3,M=Ca(s,ba)+Ca(n,ya)+o,D=Ca(s,v)+Ca(n,p)+o+14+3*R+Ca(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=F&&D>=F)return Oa(i,u,t.subarray(l,l+h));if(ka(i,u,1+(M>D)),u+=2,M>D){C=ma(v,c,0),O=v,A=ma(p,_,0),I=p;var N=ma(T,P,0);for(ka(i,u,b-257),ka(i,u+5,S-1),ka(i,u+10,R-4),u+=14,E=0;R>E;++E)ka(i,u+3*E,T[ua[E]]);u+=3*R;for(var L=[m,w],j=0;2>j;++j){var U=L[j];for(E=0;U.length>E;++E)ka(i,u,N[B=31&U[E]]),u+=T[B],B>15&&(ka(i,u,U[E]>>>5&127),u+=U[E]>>>12)}}else C=wa,O=ba,A=Sa,I=ya;for(E=0;a>E;++E)if(r[E]>255){var B;$a(i,u,C[257+(B=r[E]>>>18&31)]),u+=O[B+257],B>7&&(ka(i,u,r[E]>>>23&31),u+=la[B]);var z=31&r[E];$a(i,u,A[z]),u+=I[z],z>3&&($a(i,u,r[E]>>>5&8191),u+=ha[z])}else $a(i,u,C[r[E]]),u+=O[r[E]];return $a(i,u,C[256]),u+O[256]},Ia=new aa([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Fa=new na(0),Ma=function(){for(var t=new aa(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Da=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function Na(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=Ma[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,h,u=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new na(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=Oa(l,h,t.subarray(u,d)):(l[u]=n,h=Oa(l,h,t.subarray(u,o)))}else{for(var v=Ia[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,_=new oa(32768),g=new oa(p+1),m=Math.ceil(e/3),b=2*m,y=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<b)&p},w=new aa(25e3),S=new oa(288),x=new oa(32),E=0,k=0,T=(u=0,0),P=0,R=0;o>u;++u){var C=y(u),O=32767&u,A=g[C];if(_[O]=A,g[C]=O,u>=P){var I=o-u;if((E>7e3||T>24576)&&I>423){h=Aa(t,l,0,w,S,x,k,T,R,u-R,h),T=E=k=0,R=u;for(var F=0;286>F;++F)S[F]=0;for(F=0;30>F;++F)x[F]=0}var M=2,D=0,N=f,L=O-A&32767;if(I>2&&C==y(u-L))for(var j=Math.min(c,I)-1,U=Math.min(32767,u),B=Math.min(258,I);U>=L&&--N&&O!=A;){if(t[u+M]==t[u+M-L]){for(var z=0;B>z&&t[u+z]==t[u+z-L];++z);if(z>M){if(M=z,D=L,z>j)break;var H=Math.min(L,z-2),q=0;for(F=0;H>F;++F){var V=u-L+F+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,A=V)}}}L+=(O=A)-(A=_[O])+32768&32767}if(D){w[T++]=268435456|ca[M]<<18|fa[D];var G=31&ca[M],K=31&fa[D];k+=la[G]+ha[K],++S[257+G],++x[K],P=u+M,++E}else w[T++]=t[u],++S[t[u]]}}h=Aa(t,l,n,w,S,x,k,T,R,u-R,h),n||(h=Oa(l,h,Fa))}return Ea(a,0,r+xa(h)+s)}(n=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l,!h)),d=u.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&Da(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(u,i),Da(u,d-8,e.d()),Da(u,d-4,r),u}var La=!!c||!!v,ja="text/plain",Ua=!1,Ba=(t,i)=>{var e=t.split("#"),r=e[1],s=e[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter(t=>t.split("=")[0]!==i).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},za=function(t,i,e){var r;void 0===e&&(e=!0);var n=t.split("?"),o=n[0],a=n[1],l=s({},i),h=null!==(r=null==a?void 0:a.split("&").map(t=>{var i,r=t.split("="),s=r[0],n=e&&null!==(i=l[s])&&void 0!==i?i:r[1];return delete l[s],s+"="+n}))&&void 0!==r?r:[],u=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return ys(t,function(t,i){U(t)||U(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)}),s.join(i)}(l);return u&&h.push(u),h.length>0?o+"?"+h.join("&"):o},Ha=t=>{if(t.Ia)return t.Ia;var i=t.data,e=t.compression;if(i){if(e===Lo.GZipJS){var r=Na(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new na(t.length+(t.length>>>1)),r=0,s=function(t){e[r++]=t},n=0;i>n;++n){if(r+5>e.length){var o=new na(r+8+(i-n<<1));o.set(e),e=o}var a=t.charCodeAt(n);128>a?s(a):2048>a?(s(192|a>>>6),s(128|63&a)):a>55295&&57344>a?(s(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return Ea(e,0,r)}(no(i)),{mtime:0});return{contentType:ja,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Lo.Base64){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:no(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(no(i)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=no(i);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},qa=t=>{var i,e,r=()=>"sendBeacon"===t.transport?{url:za(t.url,{compression:Lo.Base64}),encodedBody:Ha(s({},t,{compression:Lo.Base64,Ia:void 0}))}:{url:Ba(t.url,"compression"),encodedBody:Ha(s({},t,{compression:void 0,Ia:void 0}))};try{i=Ha(t)}catch(i){if(se(t.compression,ao(t.url,"compression")))return Pe.error("Failed to gzip request body, sending uncompressed payload",i),r();throw i}return i&&se(t.compression,ao(t.url,"compression"))&&!((e=i.body)instanceof ArrayBuffer?re(new Uint8Array(e)):ArrayBuffer.isView(e)&&re(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?(Ua=!0,r()):{url:t.url,encodedBody:i}},Va=t=>{try{return qa(t)}catch(i){return Pe.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},Wa=function(){var t=o(function*(t){var i=yield function(t,i,e){return le.apply(this,arguments)}(no(t.data),Me.DEBUG,{rethrow:!0});if(!i)return t;var e=yield i.arrayBuffer();return s({},t,{Ia:{contentType:ja,body:e,estimatedSize:e.byteLength}})});return function(i){return t.apply(this,arguments)}}(),Ga=/Failed to fetch|NetworkError|Load failed/i,Ka=t=>"TypeError"===(null==t?void 0:t.name)&&Ga.test((null==t?void 0:t.message)||""),Ja=t=>{var i=Va(t);if(i){var e=i.url,r=i.encodedBody,n=null!=r?r:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;ys(t.headers,function(t,i){h.append(i,t)}),o&&h.append("Content-Type",o);var u=null,d=!1;if(f){var c=new f;u={signal:c.signal,timeout:setTimeout(()=>{var i;d=!0,c.abort(_i("AbortError","PostHog request timed out"+((i=t.timeout)?" after "+i+"ms":"")))},t.timeout)}}var p=i=>{d&&"AbortError"===(null==i?void 0:i.name)||Ka(i)?Pe.warn(i):Pe.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var _;v(e,s({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.Ea&&52428.8>(l||0),body:a,signal:null==(_=u)?void 0:_.signal},t.fetchOptions)).then(i=>i.text().then(e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){Pe.error(t)}null==t.callback||t.callback(r)})).catch(p).finally(()=>u?clearTimeout(u.timeout):null)}catch(t){u&&clearTimeout(u.timeout),p(t)}}},Ya=t=>{try{var i,e=qa(t),r=e.url,n=e.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(h.sendBeacon(r,u))return;var d=D(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(D(d)&&d.length>1&&(null!=l?l:0)>16384){var v=Math.ceil(d.length/2),c=i=>D(t.data)?i:s({},t.data,{batch:i});return Ya(s({},t,{data:c(d.slice(0,v))})),void Ya(s({},t,{data:c(d.slice(v))}))}Pe.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Ja(s({},t,{Ea:!0}))}catch(t){Pe.warn("Beacon send failed",t)}},Xa=(t,i,e,r)=>{var n="query"===r?"POST"===i?"sent_at":"_":void 0;return za(e===Lo.GZipJS?Ba(t,"compression"):t,s({},n?{[n]:Date.now().toString()}:{},e===Lo.GZipJS?{}:{compression:e}))},Qa=[];v&&Qa.push({transport:"fetch",method:Ja}),c&&Qa.push({transport:"XHR",method(t){var i=Va(t);if(i){var e=new c,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;ys(t.headers,function(t,i){e.setRequestHeader(i,t)}),n&&e.setRequestHeader("Content-Type",n),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(o)}}}),null!=h&&h.sendBeacon&&Qa.push({transport:"sendBeacon",method:Ya});var Za=class{constructor(t,i){this.Ra=!0,this.Aa=[],this.Pa=st((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,Pe.createLogger("flush interval"),3e3),this.Fa=t}enqueue(t){this.Aa.push(t),this.Oa||this.$a()}unload(){this.Da();var t=this.Aa.length>0?this.La():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.Na(s({},t,{transport:"sendBeacon"}))})}enable(){this.Ra=!1,this.$a()}$a(){var t=this;this.Ra||(this.Oa=setTimeout(()=>{if(this.Da(),this.Aa.length>0){var i=this.La(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&D(e.data)&&ys(e.data,t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp}),t.Na(e)};for(var r in i)e()}},this.Pa))}Na(t){try{this.Fa(t)}catch(t){Pe.error(t)}}Da(){clearTimeout(this.Oa),this.Oa=void 0}La(){var t={};return ys(this.Aa,i=>{var e,r=i,n=(r?r.batchKey:null)||r.url;U(t[n])&&(t[n]=s({},r,{data:[]})),null==(e=t[n].data)||e.push(r.data)}),this.Aa=[],t}},tl=class{constructor(t){this._instance=t,this.qa=!1,this.ja=3e3,this.Aa=[],this.Aa=[],this.Ba=!0,!U(a)&&"onLine"in a.navigator&&(this.Ba=a.navigator.onLine,this.Ha=()=>{this.Ba=!0,this.za()},this.Ua=()=>{this.Ba=!1},Ps(a,"online",this.Ha),Ps(a,"offline",this.Ua))}get length(){return this.Aa.length}retriableRequest(t){var e=t.retriesPerformedSoFar,n=r(t,i);W(e)&&(n.url=za(n.url,{retry_count:e})),this._instance._send_request(s({},n,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.cs(s({retriesPerformedSoFar:e},n));0===t.statusCode&&Pe.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.callback||n.callback(t)}}))}cs(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=(Math.random()-.5)*(r-e);return Math.ceil(r+s)}(i),r=Date.now()+e;this.Aa.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Pe.warn(s),this.qa||(this.qa=!0,this.Wa())}Wa(){if(this.Va&&clearTimeout(this.Va),0===this.Aa.length)return this.qa=!1,void(this.Va=void 0);this.Va=setTimeout(()=>{this.Ba&&this.Aa.length>0&&this.za(),this.Wa()},this.ja)}za(){var t=Date.now(),i=[],e=this.Aa.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.Aa=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.Va&&(clearTimeout(this.Va),this.Va=void 0),this.qa=!1,U(a)||(this.Ha&&(a.removeEventListener("online",this.Ha),this.Ha=void 0),this.Ua&&(a.removeEventListener("offline",this.Ua),this.Ua=void 0)),this.Aa)){var i=t.requestOptions;try{this._instance._send_request(s({},i,{transport:"sendBeacon"}))}catch(t){Pe.error(t)}}this.Aa=[]}},il=class{constructor(t){this._instance=t,this.Ga=()=>{var t,i,e,r;this.Za||(this.Za={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Za.lastScrollY=Math.ceil(n),this.Za.maxScrollY=Math.max(n,null!==(t=this.Za.maxScrollY)&&void 0!==t?t:0),this.Za.maxScrollHeight=Math.max(o,null!==(i=this.Za.maxScrollHeight)&&void 0!==i?i:0),this.Za.lastContentY=a,this.Za.maxContentY=Math.max(a,null!==(e=this.Za.maxContentY)&&void 0!==e?e:0),this.Za.maxContentHeight=Math.max(l,null!==(r=this.Za.maxContentHeight)&&void 0!==r?r:0)}}get Ja(){return this._instance.config.scroll_root_selector}getContext(){return this.Za}resetContext(){var t=this.Za;return setTimeout(this.Ga,0),t}startMeasuringScrollPosition(){Ps(a,"scroll",this.Ga,{capture:!0}),Ps(a,"scrollend",this.Ga,{capture:!0}),Ps(a,"resize",this.Ga)}scrollElement(){var t;if(!this.Ja)return null==a||null==(t=a.document)?void 0:t.documentElement;for(var i of D(this.Ja)?this.Ja:[this.Ja]){var e,r=null==a||null==(e=a.document)?void 0:e.querySelector(i);if(r)return r}}Qa(t){var i,e,r="y"===t?"scrollTop":"scrollLeft";if(this.Ja){var s=this.scrollElement();return s&&s[r]||0}return a?"y"===t?a.scrollY||a.pageYOffset||(null==(i=a.document)||null==(i=i.documentElement)?void 0:i.scrollTop)||0:a.scrollX||a.pageXOffset||(null==(e=a.document)||null==(e=e.documentElement)?void 0:e.scrollLeft)||0:0}scrollY(){return this.Qa("y")}scrollX(){return this.Qa("x")}},el=t=>xo(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),rl=class{constructor(t,i,e,r){this.Te=t=>{var i=this.Ka();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Xa(this._instance)};this.Ya.register({[qr]:e})}},this._instance=t,this.tl=i,this.Ya=e,this.Xa=r||el,this.tl.onSessionId(this.Te)}Ka(){return this.Ya.props[qr]}getSetOnceProps(){var t,i=null==(t=this.Ka())?void 0:t.props;return i?"r"in i?Eo(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(){var t={};return ys(ks(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+T(e)]=i}),t}},sl=class{on(t,i){return this.el[t]||(this.el[t]=[]),this.el[t].push(i),()=>{this.el[t]=this.el[t].filter(t=>t!==i)}}emit(t,i){for(var e of this.el[t]||[])e(i);for(var r of this.el["*"]||[])r(t,i)}constructor(){this.el={}}},nl=Re("[SessionId]"),ol=864e5,al=class{on(t,i){return this.il.on(t,i)}constructor(t,i,e){var r;if(this.rl=null,this.nl=null,this.sl=[],this.ol=void 0,this.al=!1,this.il=new sl,this.ll=(t,i)=>!(!W(t)||!W(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._n=t.config,this.Ya=t.persistence,this.Ie=void 0,this.Bt=void 0,this._sessionStartTimestamp=null,this.ul=void 0,this._sessionActivityTimestamp=null,this.hl=i||Ds,this.dl=e||Ds;var s=this._n.persistence_name||this._n.token;if(this._sessionTimeoutMs=1e3*st(this._n.session_idle_timeout_seconds||1800,60,36e3,nl.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.vl(),this.cl="ph_"+s+"_window_id",this.fl="ph_"+s+"_primary_window_exists",this.pl()){var n=sn.di(this.cl),o=sn.di(this.fl);n&&!o?this.Ie=n:sn.hi(this.cl),sn.ui(this.fl,!0)}null!=(r=this._n.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this._n.bootstrap.sessionID),this.gl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return U(this.sl)&&(this.sl=[]),this.sl.push(t),this.Bt&&t(this.Bt,this.Ie),()=>{this.sl=this.sl.filter(i=>i!==t)}}pl(){return"memory"!==this._n.persistence&&!this.Ya.Bo&&sn.si()}ml(t){t!==this.Ie&&(this.Ie=t,this.pl()&&sn.ui(this.cl,t))}yl(){return this.Ie?this.Ie:this.pl()?sn.di(this.cl):null}bl(t){var i=this.rl;return!H(i)&&!H(t)&&5e3>Math.abs(t-i)}_l(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this.Bt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Bt=t,s&&!r||s&&this.bl(i)||(this.rl=i,this.Ya.register({[lr]:[i,t,e]}))}wl(){var t,i=null==(t=this._n)?void 0:t.persistence_save_debounce_ms;return W(i)&&i>0}kl(){this.wl()?this.Ya.refreshKey(lr):(this.Ya.flush(),this.Ya.load())}Sl(){var t;if(!H(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.rl){this.kl();var i=this.xl();i[1]===this.Bt&&i[2]===this._sessionStartTimestamp&&(this.rl=this._sessionActivityTimestamp,this.Ya.register({[lr]:[this._sessionActivityTimestamp,null!==(t=this.Bt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ya.flush())}}Cl(){var t=this.xl()[0],i=W(t)?t:0,e=W(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Tl(t){return this.kl(),this.ll(t,this.Cl())}xl(){var t=this.Ya.props[lr];return D(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.rl=null,this.ul=void 0,clearTimeout(this.Ml),this.Ml=void 0,this._l(null,null,null)}setBootstrapSessionId(t,i){void 0===i&&(i=!1);var e=function(t,i){void 0===i&&(i=(new Date).getTime());try{var e=(t=>{var 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 nl.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void nl.error("Invalid sessionID in bootstrap",t)}}(t);return!U(e)&&(i?this.ul={sessionId:t,sessionStartTimestamp:e}:this._l(t,(new Date).getTime(),e),!0)}destroy(){this.al=!0,this.Sl(),clearTimeout(this.Ml),this.Ml=void 0,this.ol&&a&&(a.removeEventListener(fs,this.ol,{capture:!1}),this.ol=void 0),this.sl=[]}gl(){this.ol=()=>{this.Sl(),this.pl()&&sn.hi(this.fl)},Ps(a,fs,this.ol,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),"always"===this._n.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this.Bt;if(e)this.nl=r;else if(H(this.nl)||this.nl>r||r-this.nl>=1e3){var n,o;null==(n=(o=this.Ya).syncCookieProperties)||n.call(o),this.nl=r}var a=this.xl(),l=a[1],h=a[2],u=!U(s)&&l!==s,d=this.Cl(),v=this.yl(),c=this.ul,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>ol),p=c?f:W(h)&&Math.abs(r-h)>ol,_=!1,g=u,m=!l||!!c,b=l,y=!m&&!t&&this.ll(r,d);if(y){(y=this.Tl(r))||nl.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.xl();l=w[1],h=w[2]}if(m||y||p){g=!1;var S=c&&!f;l=S?c.sessionId:this.hl(),v=this.dl(),nl.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!S,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),h=S?c.sessionStartTimestamp:r,this.ul=void 0,_=!0}else v||(v=this.dl(),_=!0),(g=g||l!==b)&&(nl.info("adopted cross-tab session id",{sessionId:l,windowId:v}),_=!0);var x=W(d)&&t&&!p?d:r,E=W(h)?h:(new Date).getTime();this.ml(v),this._l(l,x,E),t||this.vl();var k={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return _&&this.sl.forEach(t=>t(l,v,k)),{sessionId:l,windowId:v,sessionStartTimestamp:E,changeReason:_?k:void 0,lastActivityTimestamp:d}}vl(){this.al||(clearTimeout(this.Ml),this.Ml=setTimeout(()=>{if(!this.al)if(this.Tl((new Date).getTime())){var t=this.Bt;this.resetSessionId(),this.il.emit("forcedIdleReset",{idleSessionId:t})}else this.vl()},1.1*this.sessionTimeoutMs))}},ll=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&x(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>x(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function hl(){return(hl=o(function*(){var t=null==h?void 0:h.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i,e=null==(i=yield t.getHighEntropyValues(["model"]))?void 0:i.model;return B(e)&&e.length>0?e:void 0}catch(t){return void Pe.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function ul(t,i){var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e}function dl(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var vl=(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}},cl=t=>t.toLowerCase(),fl={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=>vl(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!vl(i,t))),icontains:(t,i)=>i.map(cl).some(i=>t.map(cl).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(cl).every(i=>t.map(cl).every(t=>!i.includes(t))),gt:(t,i)=>i.some(i=>{var e=parseFloat(i);return!isNaN(e)&&t.some(t=>e>parseFloat(t))}),lt:(t,i)=>i.some(i=>{var e=parseFloat(i);return!isNaN(e)&&t.some(t=>e<parseFloat(t))})};function pl(t,i){return!t||Object.entries(t).every(t=>{var e=t[1],r=null==i?void 0:i[t[0]];if(null==r)return!1;var s=fl[e.operator];return!!s&&s(e.values,[String(r)])})}function _l(t,i,e){return no({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var gl="custom",ml="i.posthog.com",bl=/^\/static\//,yl=["/s/","/e/","/i/"],wl=class{constructor(t){this.Il={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+ml,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.Il[this.apiHost]||(this.Il[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":gl),this.Il[this.apiHost]}El(t){if(bl.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}Rl(t){var i=oo(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}Al(t,i,e){if("ui"===t)return e;var r=e,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=oo(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&yl.some(t=>0===i.indexOf(t))){var a=this.Rl(r);if(a){var l,h=this.apiHost,u=this.Pl;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(this.Pl=u={apiHost:h,rewriteRequestPath:s,urls:new Set}),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.Pl,e=this.Rl(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(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.Al(t,i,this.uiHost+i);if("flags"===t)return this.Al(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.El(i);if(e)return this.Al(t,i,""+e+i)}if(this.region===gl)return this.Al(t,i,this.apiHost+i);var r=ml+i;switch(t){case"assets":return this.Al(t,i,"https://"+this.region+"-assets."+r);case"api":return this.Al(t,i,"https://"+this.region+"."+r)}}},Sl=Re("[Surveys]"),xl=t=>{try{var 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){Sl.error("Failed to persist survey seen state",t)}},El=[Ho.Popover,Ho.Widget,Ho.API],kl={ignoreConditions:!1,ignoreDelay:!1,displayType:Jo.Popover},$l=Re("[PostHog ExternalIntegrations]"),Tl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Pl=class{constructor(t){this._instance=t}do(t,i){var e;null==(e=b.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,t=>{if(t)return $l.error("failed to load script",t);i()})}startIfEnabledOrStop(){var t=this,i=function(){var i,r,s,n=e[0],o=e[1];!o||null!=(i=b.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t.do(Tl[n],()=>{var i;null==(i=b.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)}),!o&&null!=(r=b.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=b.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var e of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;i()}}},Rl=class{constructor(t,i){this.A=t,this.Hs=i,this.Fl=new Map,this.Js=!1}add(t){var i=this;return o(function*(){if(i.Js)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.Fl.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.Fl.set(t.name,t);try{var e=t.setup(i.Hs);e&&(yield e)}catch(e){var r=i.Fl.get(t.name)===t;r&&i.Fl.delete(t.name),i.A.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.Ol(t)}})()}getExtension(t){return this.Fl.get(t)}dispose(){if(!this.Js){this.Js=!0;var t=Array.from(this.Fl.values()).reverse();for(var i of(this.Fl.clear(),t))this.Ol(i)}}Ol(t){try{var i=null==t.dispose?void 0:t.dispose();i&&N(i.then)&&i.then(void 0,i=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',i)})}catch(i){this.A.error('Failed to dispose browser extension "'+t.name+'"',i)}}},Cl=class{constructor(t){this._instance=t}initialize(){}get(t){var i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);var e={};for(var r of t){var s=null==i?void 0:i.get_property(r);U(s)||(e[r]=s)}return e}set(t,i){var e;null==(e=this._instance.persistence)||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null==(i=this._instance.persistence)||i.unregister(t)}},Ol="extensionsRemoteConfig",Al=class{constructor(t){this.instance=t,this.Js=!1,this.A=Pe,this.$l=t.Dl,this.kv=new Cl(t),this.onEvent=t=>Yo(this.instance.on("eventCaptured",i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.Js)return Yo(()=>{});var i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.Ll.on(Ol,i);return this.$l&&i(this.$l),Yo(e)},this.Nl=new Rl(Pe.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}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(){var t=this.instance.get_property(Le);return"string"==typeof t?t:void 0}get library(){return{name:Me.LIB_NAME,version:Me.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null==(i=this.instance.persistence)?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==s?void 0:s.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==s?void 0:s.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.Nl.add(t)}getExtension(t){return this.Nl.getExtension(t)}capture(t,i,e){var r=this;return o(function*(){e?r.instance.capture(t,i,{timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce}):r.instance.capture(t,i)})()}registerDynamicEventProperties(t){return Yo(this.instance.ql(t))}handleRemoteConfig(t){this.Js||(this.$l=t,this.instance.Ll.emit(Ol,t))}sendRequest(t,i){var e=this;return o(function*(){var r;void 0===i&&(i={});var s=e.instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",t),n={method:i.method,url:i.query?za(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?C.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(e.instance._send_request(n),{statusCode:202}):new Promise(t=>{n.callback=t,e.instance._send_request(n)})})()}dispose(){this.Js||(this.Js=!0,this.Nl.dispose())}},Il={},Fl=0,Ml=()=>{},Dl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Nl="Surveys module not available",Ll="sanitize_properties is deprecated. Use before_send instead",jl="Invalid value for property_denylist config: ",Ul=/^[A-Za-z0-9_-]{1,400}$/,Bl=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,zl=["token","distinct_id",Xr],Hl="posthog",ql=!La&&-1===(null==_?void 0:_.indexOf("MSIE"))&&-1===(null==_?void 0:_.indexOf("Mozilla")),Vl=t=>{var 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},Wl=t=>{var i;return s({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ts(null==u?void 0:u.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ml,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:d&&B(null==d?void 0:d.search)&&-1!==d.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==a||null==(i=a.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Pe.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:vs,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Ml},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:En,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Vl(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)}))(t))},Gl=[["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"]],Kl=t=>{var i={};for(var e of Gl){var r=e[0],s=e[1];U(t[r])||(i[s]=t[r])}var n=ws({},i,t),o=t.__preview_external_dependency_versioned_paths;return U(o)||(U(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),B(o)&&U(t.asset_host)&&(n.asset_host=o)),D(t.property_blacklist)&&(U(t.property_denylist)?n.property_denylist=t.property_blacklist:D(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Pe.error(jl+t.property_denylist)),n},Jl=class{constructor(){this.__forceAllowLocalhost=!1}get jl(){return this.__forceAllowLocalhost}set jl(t){Pe.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Yl=(t=class t{Bl(t){if(t){var i=this.Fl.indexOf(t);-1!==i&&this.Fl.splice(i,1)}}Hl(t,i){return this.Bl(t),this.Fl.push(i),null==i.initialize||i.initialize(),i}zl(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}Ul(){if(!(this.Wl||this.config.reuseAnonymousId||this.config.segment||this.zl())){var t,i,e,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.Vl||(r?(t="persistence is set to '"+this.config.persistence+"'",i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",e="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",i="on every page load",e="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.Wl=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+i+", 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. "+e)))}}Gl(){if(!this.zl()&&"$posthog_cookieless"===this.get_distinct_id()){var t=this.persistence;if(t){this.Zl()||t.load(!0);var i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){var e=this.config.get_device_id(Ds());this.register({distinct_id:e,$device_id:e}),t.set_property(Hr,us)}this.Jl()}}}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var i;this.webPerformance=new Jl,this.Ql=!1,this.version=Me.LIB_VERSION,this.Kl=new Set,this.Xl="",this.Ll=new sl,this.Fl=[],this.Yl=[],this.Vl=!1,this.Wl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Wl(),this.SentryIntegration=Zn,this.sentryIntegration=t=>function(t,i){var e=Qn(t,i);return{name:Xn,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.tu=!1,this.eu=null,this.iu=null,this.ru=null,this.scrollManager=new il(this),this.pageViewManager=new to(this),this.rateLimiter=new ia(this),this.requestRouter=new wl(this),this.consent=new nn(this),this.externalIntegrations=new Pl(this);var e=null!==(i=t.__defaultExtensionClasses)&&void 0!==i?i:{};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)=>{var r=B(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=B(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",t=>Pe.info('send "'+(null==t?void 0:t.event)+'"',t))}init(i,e,r){if(r&&r!==Hl){var s,n=null!==(s=Il[r])&&void 0!==s?s:new t;return n._init(i,e,r),Il[r]=n,Il[Hl][r]=n,n}return this._init(i,e,r)}_init(t,i,e){var r,n,o;void 0===i&&(i={});var l,h=B(t)?t.trim():"";if(!h)return Pe.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return h!==(null==(l=this.config)?void 0:l.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Wl(i.defaults),i.debug=this.nu(i.debug),this.su=i,this.ou=[],i.person_profiles?this.iu=i.person_profiles:i.process_person&&(this.iu=i.process_person);var u=Wl(i.defaults),d=Kl(i),v=ws({},u,d,{name:e,token:h});L(u.rageclick)&&L(d.rageclick)&&(v.rageclick=ws({},u.rageclick,d.rageclick)),L(u.session_recording)&&L(d.session_recording)&&(v.session_recording=ws({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&Pe.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Lo.GZipJS;var c=this.Zl();if(this.persistence=new No(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new No(s({},this.config,{persistence:"sessionStorage"}),c,!1),this.Xl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&sn.si()){var f=sn.di(this.Xl);D(f)&&f.forEach(t=>{B(t)&&this.Kl.add(t)})}else sn.hi(this.Xl);var p=s({},this.persistence.props),_=s({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.au=new Za(t=>this.lu(t),this.config.request_queue_config),this.uu=new tl(this),this.__request_queue=[];var g=this.zl();g||(this.sessionManager=new al(this),this.sessionPropsManager=new rl(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.hu()})),this.du(),this.config.__preview_deferred_init_extensions?(Pe.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.vu(g)},0)):(Pe.info("Initializing extensions synchronously"),this.vu(g)),Me.DEBUG=Me.DEBUG||this.config.debug,Me.DEBUG&&Pe.info("Starting in debug mode",{this:this,config:i,thisC:s({},this.config),p:p,s:_}),!this.config.identity_distinct_id||null!=(r=i.bootstrap)&&r.distinctID||(i.bootstrap=s({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var m=null==(n=i.bootstrap)?void 0:n.distinctID;if(this.Vl=!!m&&!z(m),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var b=i.bootstrap.distinctID,y=this.get_distinct_id(),w=this.persistence.get_property(Hr);if(i.bootstrap.isIdentifiedID&&null!=y&&y!==b&&"anonymous"===w)this.identify(b);else if(i.bootstrap.isIdentifiedID&&null!=y&&y!==b&&"identified"===w)Pe.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var S=this.config.get_device_id(Ds()),x=i.bootstrap.isIdentifiedID?S:b;this.persistence.set_property(Hr,i.bootstrap.isIdentifiedID?ds:us),this.register({distinct_id:b,$device_id:x})}}if(g)this.register_once({distinct_id:Yr,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(Ds());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Hr,us)}return Ps(a,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?Yn(this,()=>this.cu()):this.cu(),N(this.config._onCapture)&&this.config._onCapture!==Ml&&(Pe.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Pe.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 hl.apply(this,arguments)}().then(t=>{t&&this.register({[je]:t})}).catch(Ml),this}fu(t){var i=t;return B(i.name)&&N(i.setup)}pu(t,i){this.fu(t)?i.push(()=>{this.gu().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(i=>{Pe.error('Failed to dispose browser extension "'+t.name+'"',i)})}):this.Fl.push(t)}du(){var i,e,r,s,n,o,a=null!==(i=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==i?i:null==(r=t.__defaultExtensionClasses)?void 0:r.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(o=this.mu)||o.call(this),this.mu=void 0,this.featureFlags=new a(this)),N(this.featureFlags.onReloading)&&N(this.featureFlags.setup)?this.mu||(this.mu=this.featureFlags.onReloading(()=>{this.Ll.emit("featureFlagsReloading",!0)}),this.gu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}vu(i){var e,r,n,o,a,l,h,u=performance.now(),d=s({},t.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.exceptions&&this.Fl.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new d.exceptions(this)),d.historyAutocapture&&this.Fl.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.Fl.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.Fl.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!i&&this.Fl.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.pu(this.autocapture=new d.autocapture(this),v),d.surveys&&this.pu(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new d.surveys(this),v),d.logs&&this.pu(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this),v),d.metrics&&this.Fl.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.Fl.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.Fl.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.Fl.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.Fl.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.Fl.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.Fl.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Gn)),d.toolbar&&this.Fl.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this.Fl.push(this.experiments=null!==(h=this.experiments)&&void 0!==h?h:new d.experiments(this)),this.Fl.forEach(t=>{t.initialize&&v.push(()=>{null==t.initialize||t.initialize()})}),v.push(()=>{if(this.yu){var t=this.yu;this.yu=void 0,this.Fl.forEach(i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t))}}),this.bu(v,u)}bu(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this.bu(t,i)},0);var e=t.shift();if(e)try{e()}catch(t){Pe.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[Qr]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Zr]:r}),this.config.__preview_deferred_init_extensions&&Pe.info("PostHog extensions initialized ("+r+"ms)")}Ta(t){var i;if(!u||!u.body)return Pe.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Ta(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.yu=t),this.Dl=t,this.compression=void 0,t.ok){var e,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=E(r.supportedCompression,Lo.GZipJS)?Lo.GZipJS:E(r.supportedCompression,Lo.Base64)?Lo.Base64:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.iu?this.iu:vs}),null==(i=this._u)||i.handleRemoteConfig(t),this.Fl.forEach(i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t))}cu(){try{this.config.loaded(this)}catch(t){Pe.critical("`loaded` function failed",t)}if(this.wu(),this.config.internal_or_test_user_hostname&&null!=d&&d.hostname){var t=d.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.zl())&&this.ku()},1),this.Su=new ra(this),this.Su.load()}wu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.au)||t.enable())}_dom_loaded(){this.is_capturing()&&bs(this.__request_queue,t=>this.lu(t)),this.__request_queue=[],this.wu()}_handle_unload(){var t,i,e,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.xu()&&this.capture(_s),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.au)||r.unload(),null==(s=this.uu)||s.unload()):this.xu()&&this.capture(_s,null,{transport:"sendBeacon"})}_send_request(t){var i;this.__loaded?ql?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=s({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(U(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,n=s({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&U(n.compression)&&n.data&&(n.compression=Lo.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(D(o=n.data)?o:[o]).map(t=>s({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,i){return void 0===i&&(i=(new Date).toISOString()),D(t)?t.map(t=>s({},t,{sent_at:i})):s({},t,{sent_at:i})}(n.data))),n.url=Xa(n.url,n.method,n.compression,n.timestampMode);var v=Qa.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),c=null!==(e=null==(r=function(t,i){for(var e=0;t.length>e;e++)if(i(t[e]))return t[e]}(v,t=>t.transport===d))?void 0:r.method)&&void 0!==e?e:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){Ka(t)?Pe.warn(t):Pe.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Lo.GZipJS&&p&&"undefined"!=typeof Promise&&!Ua?Wa(n).then(t=>{f(t)}).catch(i=>{if(ne(i))return Ua=!0,void f(s({},n,{compression:void 0,url:Xa(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var i="name"in t?String(t.name):"";return ne(t)||i===ee})(i)&&(Ua=!0),f(n)}):c(n)})(s({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}lu(t){this.uu?this.uu.retriableRequest(t):this._send_request(t)}_execute_array(t){Fl++;try{var i,e=[],r=[],s=[];bs(t,t=>{if(t)if(D(i=t[0]))s.push(t);else if(N(t))try{t.call(this)}catch(i){Pe.error("Error executing queued PostHog call",t,i)}else D(t)&&"alias"===i?e.push(t):D(t)&&-1!==i.indexOf("capture")&&N(this[i])?s.push(t):r.push(t)});var n=function(t,i){bs(t,function(t){try{if(D(t[0])){var e=i;ys(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){Pe.error("Error executing queued PostHog call",t,i)}})};n(e,this),n(r,this),n(s,this)}finally{Fl--}}push(i){if(Fl>0&&D(i)&&B(i[0])){var e=t.prototype[i[0]];N(e)&&e.apply(this,i.slice(1))}else this._execute_array([i])}Cu(){var t,i=null==(t=this.persistence)?void 0:t.get_property(He);return B(i)&&Bl.test(i)?{value:i,delivered:!1}:L(i)&&B(i.value)&&Bl.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}Tu(t,i,e,r){if(this.persistence){this.persistence.refreshKey(He);var s=this.Cu();if(!r){if(e)return B(i)&&Bl.test(i)?(i!==(null==s?void 0:s.value)&&this.persistence.register({[He]:{value:i,delivered:!1}}),{value:i,pending:i!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(He);if(B(t)&&Ul.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+t;return this.persistence.register({[He]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(He)}}Mu(t){if(this.persistence){this.persistence.refreshKey(He);var i=this.Cu();(null==i?void 0:i.value)!==t||i.delivered||this.persistence.register({[He]:{value:t,delivered:!0}})}}capture(t,i,e){var r,n,o,a,l,h,u,d,v,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.au){if(this.is_capturing())if(!U(t)&&B(t)){this.Gl();var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var p=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==p||!p.isRateLimited){var _;null!=i&&i.$current_url&&!B(null==i?void 0:i.$current_url)&&(Pe.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=e&&e.Iu||Pe.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(_=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var g=new Date,m=(null==e?void 0:e.timestamp)||g,b=pi(null==e?void 0:e.uuid,Ds),y={uuid:b,event:t,properties:this.calculateEventProperties(t,i||{},m,b)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&f&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),p&&(y.properties.$lib_rate_limit_remaining_tokens=p.remainingTokens);var w="$feature_flag_called"===t&&!1===y.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=e&&e.$set&&!w&&(y.$set=null==e?void 0:e.$set);var S=L(null==i?void 0:i.$set)?i.$set:void 0,x=!(null==e||!e.$set)&&"$fbc"in e.$set,E=x||!!S&&"$fbc"in S,k=x?null==e||null==(r=e.$set)?void 0:r[ze]:null==S?void 0:S[ze],T=D(null==i?void 0:i.$unset)?i.$unset:[],P=(null==e?void 0:e.$unset)||[],R=-1!==T.indexOf("$fbc")||-1!==P.indexOf("$fbc"),C=this.Tu(null==(n=_)?void 0:n.fbclid,k,E,R);C&&!0===y.properties.$process_person_profile&&C.pending&&!E&&!w&&(y.$set=s({[ze]:C.value},y.$set));var O=null==e?void 0:e.$unset;O&&(y.$unset=O);var A=w?void 0:this.Eu(null==e?void 0:e.$set_once,t!==ms,t===gs);if(A&&(y.$set_once=A),null!=e&&e._noTruncate||(u=this.config.properties_string_max_length,d=y,v=t=>B(t)?t.slice(0,u):t,c=new Set,y=function t(i,e){if(i!==Object(i))return v?v(i):i;if(!c.has(i)){var r;if(c.add(i),D(i))r=[],bs(i,i=>{r.push(t(i))});else{var s={};ys(i,(i,e)=>{c.has(i)||(s[e]=t(i,e))}),r=s}return r}}(d)),y.timestamp=m,U(null==e?void 0:e.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=g),w&&(y.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return ie.forEach(r),i.forEach(r),e}(y.properties,zl)),t===Go.DISMISSED||t===Go.SENT){var I=null==i?void 0:i[Ko.SURVEY_ID],F=null==i?void 0:i[Ko.SURVEY_ITERATION];xl({id:I,current_iteration:F}),y.$set=s({},y.$set,{[ul({id:I,current_iteration:F},t===Go.SENT?"responded":"dismissed")]:!0})}else t===Go.SHOWN&&(y.$set=s({},y.$set,{[Ko.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Qo.SHOWN){var M=null==i?void 0:i[Zo.TOUR_TYPE];M&&(y.$set=s({},y.$set,{[Zo.TOUR_LAST_SEEN_DATE+"/"+M]:(new Date).toISOString()}))}var N=s({},y.properties.$set,y.$set);if(j(N)||this.setPersonPropertiesForFlags(N),!q(this.config.before_send)){var z=this.ds(y);if(!z)return;(y=z).uuid=pi(y.uuid,Ds)}var H=null!==(o=null==(a=y.$set)?void 0:a.$fbc)&&void 0!==o?o:L(null==(l=y.properties)?void 0:l.$set)?y.properties.$set.$fbc:void 0,V=null!=C&&C.pending&&H===C.value?C.value:void 0;this.Ll.emit("eventCaptured",y);var W=null!==(h=null==e?void 0:e._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),G=s({method:"POST",url:W,data:y,compression:"best-available",timestampMode:"recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(W)?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},null!=e&&e.transport?{transport:e.transport}:{},V?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.Mu(V)}}:{});return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly||V?this.lu(G):this.au.enqueue(G),y}Pe.critical("This capture call is ignored due to client rate limiting.")}}else Pe.error("No event name provided to posthog.capture")}else Pe.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null==(i=this._u)?void 0:i.getExtension(t)}gu(){var t;return null!==(t=this._u)&&void 0!==t?t:this._u=new Al(this)}ql(t){this.Yl.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.Yl.indexOf(t);-1!==e&&this.Yl.splice(e,1)}}}Ru(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.ru=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(r=this.sessionPersistence)||r.clear(),this.Kl.clear(),this.Au()),null==(e=this.featureFlags)||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,e,r,n){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.Ru();var o=n?void 0:this.persistence.remove_event_timer(t),l=s({},i);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.zl()&&(l[Xr]=!0),"$snapshot"===t){var h=s({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!B(l.distinct_id)&&!V(l.distinct_id)||z(l.distinct_id))&&Pe.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var v,c=function(t,i,e,r){var s,n,o,l;if(void 0===r&&(r=!1),!_)return{};var h,u=t?[...co,...i||[]]:[],v=si(_),c=v[0],f=v[1],p=function(t){for(var i=0;ai.length>i;i++){var e,r=ai[i],s=r[1],n=r[2],o=t.match(r[0]);if(o)return[s,(null==(e=n&&t.match(n)||o)?void 0:e[1])||""]}return["",""]}(_),g=p[0],m=p[1],b=null!=(h="u">typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},y={};U(e)||(y.detectGoogleSearchApp=e);var S={},x=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,E=null==(n=navigator)?void 0:n.maxTouchPoints,k=null==a||null==(o=a.screen)?void 0:o.width,T=null==a||null==(l=a.screen)?void 0:l.height,P=null==a?void 0:a.devicePixelRatio;U(x)||(S.userAgentDataPlatform=x),U(E)||(S.maxTouchPoints=E),U(k)||(S.screenWidth=k),U(T)||(S.screenHeight=T),U(P)||(S.devicePixelRatio=P);var R,C,O,A,I,F,M,D,N=ws(ks({$os:c,$os_version:f,$browser:ti(_,navigator.vendor,b,y),$webview_app:g,$webview_app_version:m,$device:ni(_),$device_type:(C=_,O=S,D=ni(C),D===ut||D===ht||"Kobo"===D||"Kindle Fire"===D||D===It?lt:D===xt||D===kt||D===Et||D===Ot?"Console":D===dt?"Wearable":D?ot:"Android"===(null==O?void 0:O.userAgentDataPlatform)&&(null!==(A=null==O?void 0:O.maxTouchPoints)&&void 0!==A?A:0)>0?600>Math.min(null!==(I=null==O?void 0:O.screenWidth)&&void 0!==I?I:0,null!==(F=null==O?void 0:O.screenHeight)&&void 0!==F?F:0)/(null!==(M=null==O?void 0:O.devicePixelRatio)&&void 0!==M?M:1)?ot:lt:"Desktop"),$timezone:ko(),$timezone_offset:$o()}),{$current_url:lo(r?gi(null==d?void 0:d.href):null==d?void 0:d.href,u,po),$host:null==d?void 0:d.host,$pathname:null==d?void 0:d.pathname,$raw_user_agent:_.length>1e3?_.substring(0,997)+"...":_,$browser_version:ei(_,navigator.vendor,b,y),$browser_language:yo(),$browser_language_prefix:(R=yo(),"string"==typeof R?R.split("-")[0]:void 0),$screen_height:null==a?void 0:a.screen.height,$screen_width:null==a?void 0:a.screen.width,$viewport_height:null==a?void 0:a.innerHeight,$viewport_width:null==a?void 0:a.innerWidth,$lib:w.LIB_NAME,$lib_version:w.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return w.SDK_DIST_CHANNEL&&(N.$sdk_dist_channel=w.SDK_DIST_CHANNEL),N}(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){var f=this.sessionManager.checkAndGetSessionAndWindowId(n,e.getTime(),!0),p=f.windowId;l.$session_id=f.sessionId,l.$window_id=p}this.sessionPropsManager&&ws(l,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&ws(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(g=this.uu)?void 0:g.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===gl&&(l.$lib_custom_api_host=this.config.api_host),v="$pageview"!==t||n?"$pageleave"!==t||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,r),l=ws(l,v),"$pageview"===t&&u&&(l.title=u.title),!U(o)){var m=e.getTime()-o;l.$duration=parseFloat((m/1e3).toFixed(3))}_&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var b=this.persistence.properties(),y=this.sessionPersistence.properties(),S=l.$groups,x=b.$groups;L(S)&&!j(S)&&(l.$groups=s({},L(x)?x:{},S)),ys(["$referrer","$referring_domain"],t=>{t in b&&delete y[t]});var E={};if(this.Yl.length>0)for(var k of this.Yl.slice())try{ws(E,k())}catch(t){Pe.error("Failed to produce browser extension event properties",t)}(l=ws({},c,b,y,s({},E,l))).$is_identified=this._isIdentified(),D(this.config.property_denylist)?ys(this.config.property_denylist,function(t){delete l[t]}):Pe.error(jl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var T=this.config.sanitize_properties;T&&(Pe.error(Ll),l=T(l,t));var P=this.Pu();return l.$process_person_profile=P,P&&!n&&this.Fu("_calculate_event_properties"),l}Eu(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.Pu())return t;if(this.Ql&&!e)return t;var s=ws({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(Pe.error(Ll),s=n(s,"$set_once")),i&&(this.Ql=!0),j(s)?void 0:s}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i,e;null==(i=this.persistence)||i.syncCookieProperties(),this.Ru(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach(t=>this.Kl.add(t)),this.Au()}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t),this.Kl.delete(t),this.Au()}Ou(t,i){this.register({[t]:i})}hu(){this.Kl.forEach(t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)}),this.Kl.clear(),this.Au()}Au(){var t;if(this.Xl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Bo||!sn.si())sn.hi(this.Xl);else{var i=[];this.Kl.forEach(t=>i.push(t)),i.length>0?sn.ui(this.Xl,i):sn.hi(this.Xl)}}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,r;return null!==(e=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Ll.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:Nl}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Nl})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Nl})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=kl),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:Nl}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:Nl})}$u(t){return!t||z(t)?(Pe.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Pe.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())||(Pe.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 Pe.uninitializedWarning("posthog.identify");if(V(t)&&(t=t.toString(),Pe.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.$u(t)&&this.Fu("posthog.identify")){this.Gl();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.Ru(!1),o=this.persistence.oa(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property("__alias")&&(this.unregister(Ue),this.register({distinct_id:t}));var h=(this.persistence.get_property("$user_state")||"anonymous")===us,u=t!==l,d=!u&&h;if(u&&h){var v,c=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:l};this.persistence.set_property(Hr,ds),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.aa(),this.capture(gs,c,{$set:i||{},$set_once:e||{}}),this.ru=_l(t,i,e),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(d){this.persistence.set_property(Hr,ds);var f=i||{},p=e||{};this.setPersonPropertiesForFlags({$set:f,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.aa(),this.capture("$set",{$set:f,$set_once:p}),this.ru=_l(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(jr)):d&&(i||e)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.ha(a)}}}setPersonProperties(t,i){if((t||i)&&this.Fu("posthog.setPersonProperties")){var e=_l(this.get_distinct_id(),t,i);this.ru!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.ru=e):Pe.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(D(t)?t:[t]).filter(t=>B(t)&&t.length>0);0!==e.length&&this.Fu("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.ru=null)}group(t,i,e){var r;if(t&&i){null==(r=this.persistence)||r.syncCookieProperties(),this.Ru();var n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:s({},n,{[t]:i})}),(o||e)&&this.Pu()){var a={$group_type:t,$group_key:i};e&&(a.$group_set=e),this.capture(ms,a)}e&&this.setGroupPropertiesForFlags({[t]:e}),o&&!e&&this.reloadFeatureFlags()}else Pe.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.Fu("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i=G(t)?t:null==t?void 0:t.resetDeviceID,e=G(t)||null==t?void 0:t.bootstrap;this.Du(i,!1,e)}Du(t,i,e){var r,n,o,a;if(void 0===i&&(i=!1),Pe.info("reset"),!this.__loaded)return Pe.uninitializedWarning("posthog.reset");var l=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null==(r=this.su)?void 0:r.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.Ma());var h=this.get_property(Le),u=this.get_property(je),d=this.get_property(ir);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var v=this.is_capturing();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.");var c=null==(a=this.persistence)||null==a.oa?void 0:a.oa(),f=!1;try{var p,_,g,m,b,y,w,S,x,E,k,T,P;if(null==(p=this.persistence)||p.clear(),null==(_=this.sessionPersistence)||_.clear(),this.Kl.clear(),this.Au(),U(d)||null==(g=this.persistence)||g.register({[ir]:d}),null==(m=this.surveys)||m.reset(),null==(b=this.featureFlags)||b.reset(),null==(y=this.conversations)||y.reset(),null==(w=this.logs)||w.reset(),null==(S=this.metrics)||S.reset(),null==(x=this.persistence)||x.set_property(Hr,us),null==(E=this.sessionManager)||E.resetSessionId(),this.ru=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Yr,$device_id:null},"");else{var R=this.config.get_device_id(Ds());this.register_once({distinct_id:R,$device_id:t?R:h},""),t||U(u)||this.register({[je]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(void 0===e.distinctID||this.zl()||(null==(P=this.persistence)||P.set_property(Hr,e.isIdentifiedID?ds:us),this.register({distinct_id:e.distinctID})),null==(k=this.featureFlags)||k.initialize(),!(U(l)||null!=(T=this.sessionManager)&&T.setBootstrapSessionId(l,!0))){var C=s({},e);delete C.sessionID,this.config.bootstrap=C}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,f=!0}finally{var O;c&&(null==(O=this.persistence)||null==O.ha||O.ha(f))}this.reloadFeatureFlags()}shutdown(t){var i=this;return o(function*(){var t,e,r,s,n,o,a;if(i.__loaded){i.gu().dispose(),null==(t=i.sessionRecording)||t.dispose(),null==(e=i.logs)||e.flushLogs("sendBeacon"),null==(r=i.metrics)||r.flush("sendBeacon"),null==(s=i.au)||s.unload(),null==(n=i.uu)||n.unload();try{var l;null==(l=i.featureFlags)||l.destroy()}catch(t){Pe.error("Error while destroying feature flags",t)}null==(o=i.persistence)||o.destroy(),null==(a=i.sessionPersistence)||a.destroy()}else Pe.uninitializedWarning("posthog.shutdown")})()}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)||e.Lu()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t.Nu()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var i=this.sessionManager.checkAndGetSessionAndWindowId(!0),e=i.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i.sessionId);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property("$people_distinct_id")?(Pe.critical("Attempting to create alias for existing People user - aborting."),-2):this.Fu("posthog.alias")?(U(i)&&(i=this.get_distinct_id()),t!==i?(this.Ou(Ue,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Pe.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=s({},this.config);if(L(t)){var e,r,n,o,a,l,h,u,d,v,c,f,p;ws(this.config,Kl(t));var _=this.Zl();null==(e=this.persistence)||e.update_config(this.config,i,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new No(s({},this.config,{persistence:"sessionStorage"}),_,!1);var g=this.nu(this.config.debug);G(g)&&(this.config.debug=g),G(this.config.debug)&&(this.config.debug?(Me.DEBUG=!0,Hs.si()&&Hs.ui("ph_debug",!0),Pe.info("set_config",{config:t,oldConfig:i,newConfig:s({},this.config)})):(Me.DEBUG=!1,Hs.si()&&Hs.hi("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this.Ma()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(h=this.autocapture)||h.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(d=this.historyAutocapture)||d.startIfEnabledOrStop()),null==(v=this.exceptionObserver)||v.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(f=this.surveys)||f.loadIfEnabled(),this.Jl(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&Yn(this,Ml,!1)}}_overrideSDKInfo(t,i){Me.LIB_NAME=t,Me.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){try{if(!this.exceptions)return;var e=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(s({},e,i))}catch(t){return}}addExceptionStep(t,i){var e;null==(e=this.exceptions)||e.addExceptionStep(t,i)}captureLog(t){var i;null==(i=this.logs)||i.captureLog(t)}get logger(){var i,e;return null!==(i=null==(e=this.logs)?void 0:e.logger)&&void 0!==i?i:t.qu}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:Hl;return i!==Hl&&(i="posthog."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property("$user_state"))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property("$user_state"))}Pu(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&j(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t.__alias)&&(null==(i=this.persistence)||null==(i=i.props)||!i.$epp))}xu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.Pu()||this.Fu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Fu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Fu(t){return"never"===this.config.person_profiles?(Pe.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ul(),this.Ou(Jr,!0),!0)}Zl(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}Jl(){var t,i,e,r,s,n=this.Zl();return this.is_capturing()||null==(t=this.logs)||t.ju(),(null==(i=this.persistence)?void 0:i.Bo)!==n&&(null==(e=this.persistence)||e.set_disabled(n)),(null==(r=this.sessionPersistence)?void 0:r.Bo)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.Kl.clear(),this.Au()),n}opt_in_capturing(i){var e,r,s;if("always"!==this.config.cookieless_mode){if(this.zl()){var n,o,a,l,h,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this.Du(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new al(this),this.pageViewManager=new to(this),this.persistence&&(this.sessionPropsManager=new rl(this,this.sessionManager,this.persistence));var d,v=null!==(l=null==(h=this.config.__extensionClasses)?void 0:h.sessionRecording)&&void 0!==l?l:null==(u=t.__defaultExtensionClasses)?void 0:u.sessionRecording;v&&(this.sessionRecording=this.Hl(this.sessionRecording,new v(this)),this.Dl&&(null==(d=this.sessionRecording)||null==d.onRemoteConfig||d.onRemoteConfig(this.Dl)))}this.consent.optInOut(!0),this.Jl(),this.wu(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(r=this.surveys)||r.loadIfEnabled()),(U(null==i?void 0:i.captureEventName)||null!=i&&i.captureEventName)&&this.capture(null!==(s=null==i?void 0:i.captureEventName)&&void 0!==s?s:"$opt_in",null==i?void 0:i.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.ku()}else Pe.warn(Dl)}opt_out_capturing(){if("always"!==this.config.cookieless_mode){var t,i,e="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==e||e.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.Du(!0,!0),this.consent.optInOut(!1),this.Jl(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Yr,$device_id:null}),this.Bl(e),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.ku(),this.wu())}else Pe.warn(Dl)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return"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.Jl()}_is_bot(){return h?ll(h,this.config.custom_blocked_useragents):void 0}ku(){u&&("visible"===u.visibilityState?this.tu||(this.tu=!0,this.capture(ps,{title:u.title},{send_instantly:!0}),this.eu&&(u.removeEventListener(cs,this.eu),this.eu=null)):this.eu||(this.eu=this.ku.bind(this),Ps(u,cs,this.eu)))}debug(t){!1===t?(null==a||a.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==a||a.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}))}Ma(){var t=this.su||{};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?(Pe.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,r,s){var n=i in t&&!q(t[i]),o=e in t&&!q(t[e]);return n?t[i]:!!o&&(s&&s.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,Pe)}ds(t){var i;if(q(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(J),r=D(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),q(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return K(t.event)?Pe.warn(o+". This can cause unexpected behavior."):Pe.info(o),null}s.properties&&!j(s.properties)||Pe.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return Pe.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&q(s.properties[a]))return Pe.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.fo)?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)})}nu(t){var i=G(t)&&!t,e=Hs.si()&&"true"===Hs.li("ph_debug");return!i&&(!!e||t)}},t.__defaultExtensionClasses={},t.qu=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),t);!function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=Es(t.prototype[i[e]])}(Yl,["identify"]);var Xl=class{constructor(t){this.disabled=!1===t;var i=L(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}},Ql="$copy_autocapture",Zl=Re("[AutoCapture]");function th(t,i){return i.length>t?i.slice(0,t)+"...":i}function ih(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!ln(i));return i}function eh(t,i){var e,r,n=i.e,o=i.maskAllElementAttributes,l=i.maskAllText,h=i.elementAttributeIgnoreList,u=i.elementsChainAsString,d=i.disableCaptureUrlHashes;if(!ln(t))return{props:{}};for(var v=[t],c=new Set([t]),f=t;f.parentNode&&!hn(f,"body")&&1e3>v.length;)if(dn(f.parentNode)){var p=f.parentNode.host;if(c.has(p))break;c.add(p),v.push(p),f=p}else{if(!ln(f.parentNode))break;if(c.has(f.parentNode))break;c.add(f.parentNode),v.push(f.parentNode),f=f.parentNode}var _="click"===n.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?v.findIndex(t=>hn(t,"button")||hn(t,"a")):-1;_>0&&(l=l||v.slice(0,_+1).some(t=>!On(t)||An(t)));var g,m,b,y=[],w={},S=!1,x=!1;if(ys(v,t=>{var i=On(t);if(hn(t,"a")){var e=t.getAttribute("href");S=!!(i&&e&&Un(e))&&(d?gi(e):e)}E(fn(t),"ph-no-capture")&&(x=!0),y.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};mn.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?th(1024,Bn(t)):th(1024,_n(t)));var a=fn(t);a.length>0&&(o.classes=a.filter(function(t){return""!==t})),ys(t.attributes,function(e){var n;if((!An(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Un(e.value)&&(!B(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=vn(a).join(" ")),o["attr__"+e.name]=th(1024,"href"===e.name&&s?gi(a):a)}});for(var l=1,h=1,u=t;u=ih(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,l,h,d)),ys(function(t){if(!On(t))return{};var i={};return ys(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Un(r)&&(i[e]=r)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(w,i)||(w[i]=t)})}),x)return{props:{},explicitNoCapture:x};if(_>0&&(t=v[_],y.splice(0,_)),l||(y[0].$el_text=hn(t,"a")||hn(t,"button")?Bn(t):_n(t)),S){var k,T;y[0].attr__href=S;var P=null==(k=oo(S))?void 0:k.host,R=null==a||null==(T=a.location)?void 0:T.host;P&&R&&P!==R&&(g=S)}return{props:ws((m=n.type,{$event_type:m,$ce_version:1}),u?{}:{$elements:y},{$elements_chain:(b=y,D(b)?function(t){return t.map(t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))r+="."+n.replace(/"/g,"");var o=s({},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),a={};return Ss(o).sort((t,i)=>{return(r=i[0])>(e=t[0])?-1:e>r?1:0;var e,r}).forEach(t=>{var i=t[1];return a[Hn(t[0].toString())]=Hn(i.toString())}),(r+=":")+Ss(a).map(t=>t[0]+'="'+t[1]+'"').join("")}).join(";")}(function(t){return t.map(t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:qn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Ss(t).filter(t=>0===t[0].indexOf("attr__")).forEach(t=>r.attributes[t[0]]=t[1]),r})}(b)):"")},null!=(e=y[0])&&e.$el_text?{$el_text:null==(r=y[0])?void 0:r.$el_text}:{},g&&"click"===n.type?{$external_click_url:g}:{},w),target:t}}var rh=class{Ds(){this.Ls=void 0,clearTimeout(this.Ns),this.Ns=void 0}qs(t){var i;if(!On(t))return!0;for(var e,r=null!==(i=this.js().css_selector_ignorelist)&&void 0!==i?i:Sn,s=new Set,n=t,o=function(){if(s.size>=1e3||s.has(n))return{v:!0};s.add(n);var t=n,i=fn(t);if(E(i,"ph-no-capture")||E(i,"ph-sensitive")||An(t)||r.some(i=>bn(t,i)))return{v:!0};var e=n.parentNode;n=dn(e)?e.host:e&&ln(e)?e:null};n;)if(e=o())return e.v;return!1}Bs(t){if(this.isEnabled&&"pointercancel"!==t.type)if("pointerdown"!==t.type){var i=this.Ls;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.Ds():"pointerup"===t.type&&(i.released=!0,this.Ns=setTimeout(()=>this.Ds(),0)))}else{var e;this.Ds();var r=gn(t);t.isPrimary&&0===t.button&&!t.ctrlKey&&r&&ln(r)&&(this.Ls={target:r,excluded:this.qs(r),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null==(e=this.Hs)?void 0:e.distinctId})}else this.Ds()}zs(t){var i,e=this.Ls;this.Ds();var r=gn(t);if(null!=e&&e.released&&e.target.isConnected&&e.distinctId===(null==(i=this.Hs)?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)&&r&&(hn(r,"html")||hn(r,"body"))){var s;if(e.excluded)return null;var n=null!==(s=this.js().css_selector_ignorelist)&&void 0!==s?s:Sn;return[r,null==u?void 0:u.documentElement,null==u?void 0:u.body].some(t=>{if(!t)return!1;var i=fn(t);return E(i,"ph-no-capture")||E(i,"ph-sensitive")||!On(t)||An(t)||n.some(i=>bn(t,i))})?null:e.target}}constructor(t){this.Us=t,this.name="autocapture",this.Ws=!1,this.Vs=null,this.Gs=!1,this.Zs=!1,this._n={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Js=!1,this.Us.refresh(this._n),this.rageclicks=new Xl(this._n.rageclick),this.Qs=null}setup(t){this.Ks(),this.Hs=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Js?i.dispose():(this.Xs=i,this.startIfEnabled())}dispose(){var t;this.Js||(this.Js=!0,this.Hs=void 0,null==(t=this.Xs)||t.dispose(),this.Xs=void 0,this.Ys())}js(){return this.Us.refresh(this._n),this._n}Ks(){var t,i;return this.js(),this._n.url_allowlist=null==(t=this._n.url_allowlist)?void 0:t.map(t=>new RegExp(t)),this._n.url_ignorelist=null==(i=this._n.url_ignorelist)?void 0:i.map(t=>new RegExp(t)),this._n}eo(){if(this.isBrowserSupported()){if(a&&u){var t=this.io=t=>{t=t||(null==a?void 0:a.event);try{if("blur"===t.type)return void this.Ds();if(0===t.type.indexOf("pointer"))return void this.Bs(t);var i="click"===t.type?this.zs(t):void 0;if(H(i))return;this.ro(t,"$autocapture",i)}catch(t){Zl.error("Failed to capture event",t)}};if(Ps(a,"blur",t),Ps(u,"submit",t,{capture:!0}),Ps(u,"change",t,{capture:!0}),Ps(u,"click",t,{capture:!0}),ys(["pointerdown","pointermove","pointerup","pointercancel"],i=>{Ps(u,i,t,{capture:!0})}),this.js().capture_copied_text){var i=this.no=t=>{t=t||(null==a?void 0:a.event);try{this.ro(t,Ql)}catch(t){Zl.error("Failed to capture clipboard event",t)}};Ps(u,"copy",i,{capture:!0}),Ps(u,"cut",i,{capture:!0}),Ps(u,"paste",i,{capture:!0})}}}else Zl.info("Disabling Automatic Event Collection because this browser is not supported")}Ys(){this.Ds(),this.io&&(null==a||a.removeEventListener("blur",this.io),ys(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==u||u.removeEventListener(t,this.io,!0)}),null==u||u.removeEventListener("submit",this.io,!0),null==u||u.removeEventListener("change",this.io,!0),null==u||u.removeEventListener("click",this.io,!0),this.io=void 0),this.no&&(null==u||u.removeEventListener("copy",this.no,!0),null==u||u.removeEventListener("cut",this.no,!0),null==u||u.removeEventListener("paste",this.no,!0),this.no=void 0),this.Ws=!1}startIfEnabled(){this.isEnabled||this.Ds(),!this.Js&&this.Hs&&this.isEnabled&&!this.Ws&&(this.eo(),this.Ws=!0)}onRemoteConfig(t){if(!this.Js)if(this.Gs=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.Zs=i.elementsChainAsString);var e,r=i.autocapture_opt_out;G(r)&&(null==(e=this.Hs)||e.kv.set(Ve,r),this.Vs=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Qs=t}getElementSelectors(t,i){var e,r=[];return null==(e=this.Qs)||e.forEach(e=>{var s;null==u||null==(s=u.querySelectorAll(e))||s.forEach(s=>{t!==s&&i!==s||E(r,e)||r.push(e)})}),r}get isEnabled(){var t,i;if(this.Js)return!1;var e=null==(t=this.Hs)?void 0:t.kv.get(Ve),r=this.Vs,s=this.js(),n=s.remoteRequestsDisabled&&!this.Gs;if(H(r)&&!G(e)&&!n)return!1;var o=null!==(i=this.Vs)&&void 0!==i?i:!!e;return!!s.enabled&&!o}ro(t,i,e){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r=e||gn(t);un(r)&&(r=r.parentNode||null);var n,o=this.Ks();"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&o.rageclick&&null!=(n=this.rageclicks)&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&Pn(r,o.rageclick)&&this.ro(t,"$rageclick",e);var l=i===Ql,h=l?s({},o,{dom_event_allowlist:void 0}):o;if(r&&function(t,i,e,r,s,n){var o;if(!a||Rn(t))return!1;if(null!=e&&e.url_allowlist&&!cn(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&cn(e.url_ignorelist,n))return!1;if(null!=e&&e.dom_event_allowlist){var l=e.dom_event_allowlist;if(l&&!l.some(t=>i.type===t))return!1}var h=Cn(t,r),u=h.parentIsUsefulElement,d=h.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(U(e))return!0;var r,s=function(t){if(e.some(i=>t.tagName.toLowerCase()===i))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(d,e))return!1;if(!yn(d,null==e?void 0:e.css_selector_allowlist))return!1;if(yn(d,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:Sn))return!1;try{var v=a.getComputedStyle(t);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var c=t.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(s||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(i.type)>=0;default:return u?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(mn.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,h,l,l?["copy","cut","paste"]:void 0,{config:{get_current_url:o.getCurrentUrl}})){var u,d=eh(r,{e:t,maskAllElementAttributes:o.maskAllElementAttributes,maskAllText:o.maskAllText,elementAttributeIgnoreList:o.element_attribute_ignorelist,elementsChainAsString:this.Zs,disableCaptureUrlHashes:o.disableCaptureUrlHashes}),v=d.props;if(d.explicitNoCapture)return!1;var c=this.getElementSelectors(r,d.target);if(c&&c.length>0&&(v.$element_selectors=c),i===Ql){var f=t.type||"clipboard";if("paste"!==f){var p,_,g=null==a||null==(p=a.getSelection())?void 0:p.toString(),m=pn(g);if(!m)return!1;v.$selected_content=m,v.$clipboard_text_length=null!==(_=null==g?void 0:g.length)&&void 0!==_?_:0}v.$copy_type=f}return null==(u=this.Hs)||u.capture(i,v).catch(t=>Zl.error("Failed to capture event",t)),!0}}else this.Ds()}isBrowserSupported(){return N(null==u?void 0:u.querySelectorAll)}},sh=class{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=L(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.Ma(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}},nh=Re("[ExceptionAutocapture]"),oh=()=>{},ah=t=>{var i;if(N(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function lh(t,i,e){try{if(!(i in t))return oh;var r={next:t[i]},s=e(function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return r.next.apply(this,i)});return N(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[i]=s,()=>{if(t[i]!==s)for(var e=t[i],n=ah(e);n;){if(n.next===s)return void(n.next=r.next);n=ah(e=n.next)}else t[i]=r.next}}catch(t){return oh}}var hh=Re("[TracingHeaders]"),uh=Re("[Web Vitals]"),dh=9e5,vh=["CLS","FCP","INP","LCP"],ch=["INP","LCP"],fh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],ph="disabled",_h="lazy_loading",gh=Re("[SessionRecording]"),mh=Re("[Heatmaps]");function bh(t){return L(t)&&"clientX"in t&&"clientY"in t&&V(t.clientX)&&V(t.clientY)}var yh=Re("[Product Tours]"),wh=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(Qe))},Sh=Re("[SiteApps]"),xh="Error while initializing PostHog app with config id ",Eh=(t,i)=>null!=t&&t.then?t.then(i):i(t),kh="SDK is not enabled or survey functionality is not yet loaded",$h="Disabled. Not loading surveys.",Th=class{constructor(t,i){this.Us=t,this.Bu=i,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Hu=!1,this.zu=[],this.Uu=null,this.Wu=null,this.Js=!1,this.Vu=new Set,this.onRemoteConfig=t=>{if(!this.Js&&!this._n.disableSurveys){if(!t.ok)return Sl.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(q(i))return Sl.warn("Flags not loaded yet. Not loading surveys.");this.Gu=G(i)?i:i.length>0,Sl.info("flags response received, isSurveysEnabled: "+this.Gu),this.loadIfEnabled()}}}setup(t){if(!this.Js)return this.Zu=t,Eh(t.kv.initialize(),()=>{if(this.Zu===t&&!this.Js){this.Zu=void 0,this.Hs=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Js?i.dispose():(this.Xs=i,this.loadIfEnabled())}})}dispose(){var t,i,e;this.Js||(this.Js=!0,this.Zu=void 0,this.Hs=void 0,null==(t=this.Xs)||t.dispose(),this.Xs=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.zu=[],this.Uu=null,this.Vu.forEach(t=>clearTimeout(t)),this.Vu.clear())}get _n(){return this.Us.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var r=localStorage.key(e);(null!=r&&r.startsWith("seenSurvey_")||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(!this.Js&&this.Hs){var t=this._n;if(!this._surveyManager)if(this.Hu)Sl.info("Already initializing surveys, skipping...");else if(t.disableSurveys)Sl.info($h);else if(t.cookielessMode&&this.Us.isOptedOut())Sl.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Us.getExtensions();if(i){if(!U(this.Gu)||t.advancedEnableSurveys){var e=this.Gu||t.advancedEnableSurveys;this.Hu=!0;try{var r=i.generateSurveys;if(r)return this.Ju(r,e),void(this.Hu=!1);var s=i.loadExternalDependency;if(!s)return this.Qu(hs),void(this.Hu=!1);s(t=>{try{if(this.Js)return;var i=this.Us.getExtensions();t||null==i||!i.generateSurveys?this.Qu("Could not load surveys script",t):this.Ju(i.generateSurveys,e)}finally{this.Hu=!1}})}catch(t){throw this.Hu=!1,this.Qu("Error initializing surveys",t),t}}}else Sl.error("PostHog Extensions not found.")}}}Ju(t,i){this.Js||(this._surveyManager=t(i),this._surveyEventReceiver=this.Us.createEventReceiver(),Sl.info("Surveys loaded successfully"),this.Ku({isLoaded:!0}))}Qu(t,i){Sl.error(t,i),this.Ku({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.zu.push(t),this._surveyManager&&this.Ku({isLoaded:!0}),()=>{this.zu=this.zu.filter(i=>i!==t)}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.Hs)&&void 0!==e?e:this.Bu;if(r&&!this.Js){if(this._n.disableSurveys)return Sl.info($h),t([]);var s=r.kv.get(Tr);if(s&&!i)return t(s,{isLoaded:!0}),void(this.Xu()&&this.getSurveys(()=>{},!0));if(this.Uu)this.Uu.then(i=>{this.Js||t(i.surveys,i.context)}).catch(t=>Sl.error("Error in survey callback",t));else{var n=this.Yu("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this._n.requestTimeoutMs}).then(t=>{try{return this.th(r,t)}catch(t){return Sl.error("Error processing surveys response",t),this.th(r,{statusCode:0,error:t})}},t=>this.th(r,{statusCode:0,error:t}));this.Uu=n;var o=()=>{this.Uu===n&&(this.Uu=null)};n.then(i=>{o(),this.Js||t(i.surveys,i.context)},o).catch(t=>Sl.error("Error in survey callback",t))}}}Yu(t,i){var e=this.Hs;return e?e.sendRequest(t,i):new Promise(t=>t({statusCode:0,error:new Error(kh)}))}th(t,i){var e;if(this.Js)return{surveys:[],context:{isLoaded:!1,error:kh}};var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return 0!==r?Sl.error(s):i.error||Sl.warn(s),this.Wu=Date.now(),{surveys:[],context:{isLoaded:!1,error:s}}}this.Wu=null;var n=i.json.surveys||[],o=n.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(dl(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t)));return o.length>0&&(null==(e=this._surveyEventReceiver)||e.register(o)),t.kv.set({[Tr]:n,[Pr]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Xu(){return this.eh()&&!this.Uu&&!this.ih()}eh(){var t,i,e=null==(t=null!==(i=this.Hs)&&void 0!==i?i:this.Bu)?void 0:t.kv.get(Pr);return V(e)&&Date.now()-e>3e5}ih(){return V(this.Wu)&&3e5>Date.now()-this.Wu}markSurveyAsSeen(t,i){var e;xl({id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Ku(t){for(var i of this.zu)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Sl.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!q(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Sl.warn("init was not called")}rh(t){var i=null;return this.getSurveys(e=>{var r;i=null!==(r=e.find(i=>i.id===t))&&void 0!==r?r:null}),i}nh(t){if(q(this._surveyManager))return{eligible:!1,reason:kh};var i="string"==typeof t?this.rh(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}sh(t){if(q(this._surveyManager))return{eligible:!1,reason:kh};var i="string"==typeof t?this.rh(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(q(this._surveyManager))return Sl.warn("init was not called"),{visible:!1,disabledReason:kh};var i=this.sh(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return q(this._surveyManager)?(Sl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:kh})):new Promise(e=>{this.getSurveys(i=>{var r,s=null!==(r=i.find(i=>i.id===t))&&void 0!==r?r:null;if(s){var n=this.sh(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var r;if(q(this._surveyManager))Sl.warn("init was not called");else{var s="string"==typeof t?this.rh(t):t;if(null!=s&&s.id)if(El.includes(s.type)){var n=null==u?void 0:u.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){Sl.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout(()=>{var t,i;this.Vu.delete(o),this.Js||(Sl.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),Sl.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this.Vu.add(o)}else this._surveyManager.renderSurvey(s,n,e);else Sl.warn("Survey element not found")}else Sl.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Sl.warn("Survey not found")}}displaySurvey(t,i){var e;if(q(this._surveyManager))Sl.warn("init was not called");else{var r=this.rh(t);if(r){var n=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=s({},r,{appearance:s({},r.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==Jo.Popover&&i.initialResponses&&Sl.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.nh(r);if(!o.eligible)return void Sl.warn("Survey is not eligible to be displayed: ",o.reason)}i.displayType!==Jo.Inline?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else Sl.warn("Survey not found")}}cancelPendingSurvey(t){q(this._surveyManager)?Sl.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}};function Ph(t,i,e){if(q(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}var Rh=class{constructor(t){this._instance=t,this.oh=new Set,this.ah=new Set,this.uh=new sl,this.hh=(t,i)=>this.dh(t,i)&&this.fh(t,i)&&this.ph(t,i)&&this.gh(t,i),this.dh=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;U(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.mh=null==(i=this._instance)?void 0:i._addCaptureHook((t,i)=>{this.on(t,i)}))}dispose(){var t;null==(t=this.mh)||t.call(this),this.mh=void 0,this.uh=new sl}register(t){var i,e;if(!U(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach(t=>{var i;this.oh.add(t),null==(i=t.steps)||i.forEach(t=>{this.ah.add((null==t?void 0:t.event)||"")})}),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.oh.forEach(t=>{var i;null==(i=t.steps)||i.forEach(t=>{null!=t&&t.selector&&r.add(t.selector)})}),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.oh.clear(),this.ah.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.ah.has(t)||this.ah.has(i.event))&&this.oh.forEach(t=>{this.yh(i,t)&&this.uh.emit("actionCaptured",t.name)})}bh(t){this.onAction("actionCaptured",i=>t(i))}yh(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.hh(t,e))return!0;return!1}onAction(t,i){return this.uh.on(t,i)}fh(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!Ph(r,i.url,i.url_matching||"contains"))return!1}return!0}ph(t,i){return!!this._h(t,i)&&!!this.wh(t,i)&&!!this.kh(t,i)}_h(t,i){var e;if(null==i||!i.href)return!0;var r=this.Sh(t);if(r.length>0)return r.some(t=>Ph(t.href,i.href,i.href_matching||"exact"));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&Ph((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}wh(t,i){var e;if(null==i||!i.text)return!0;var r=this.Sh(t);if(r.length>0)return r.some(t=>Ph(t.text,i.text,i.text_matching||"exact")||Ph(t.$el_text,i.text,i.text_matching||"exact"));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!q(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some(t=>Ph(t,n,o)))}kh(t,i){var e,r;if(null==i||!i.selector)return!0;if(null!=t&&null!=(e=t.properties)&&null!=(e=e.$element_selectors)&&e.includes(i.selector))return!0;var s=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&s)try{return new RegExp(i.selector_regex).test(s)}catch(t){return!1}return!1}Sh(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}gh(t,i){return null==i||!i.properties||0===i.properties.length||pl(i.properties.reduce((t,i)=>{var e=D(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)}},Ch=class{constructor(t){var i;this.xh=[],this._instance=t,this.Ch=new Map,this.Th=new Map,this.Mh=new Map,this.Ih=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId(t=>this.Eh(t))}Rh(t){return!1}Ah(){return null}Ph(t){}Fh(){}Oh(t,i){return!!t&&pl(t.propertyFilters,null==i?void 0:i.properties)}$h(t,i){var e=new Map;return t.forEach(t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach(i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}})}),e}Dh(t,i,e){var r=(e===jo.Activation?this.Ch:this.Th).get(t),s=[];return this.Lh(t=>{s=t.filter(t=>null==r?void 0:r.includes(t.id))}),s.filter(r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find(i=>i.name===t);return this.Oh(n,i)})}register(t){this.Nh(t,!1)}replace(t){this.Nh(t,!0)}Nh(t,i){var e;U(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.qh(t,i),this.jh(t,i))}jh(t,i){var e=t.filter(t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length});if(i&&this.Mh.clear(),0!==e.length){this.Bh||(this.Bh=new Rh(this._instance),this.Bh.init(),this.Bh.bh(t=>this.onAction(t)));var r=[];e.forEach(t=>{var i;null==(i=t.conditions)||null==(i=i.actions)||i.values.forEach(i=>{if(r.push(i),i.name){var e,s=null!==(e=this.Mh.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.Mh.set(i.name,s)}})}),i?this.Bh.replace(r):this.Bh.register(r)}else{var s;i&&(null==(s=this.Bh)||s.replace([]))}}Hh(t,i){i.forEach((i,e)=>{var r,s=null!==(r=t.get(e))&&void 0!==r?r:[];i.forEach(t=>{s.includes(t)||s.push(t)}),t.set(e,s)})}qh(t,i){var e,r,s=t.filter(t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0}),n=t.filter(t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}),o=this.$h(t,jo.Activation),a=this.$h(t,jo.Cancellation);i?(this.Ch=o,this.Th=a):(this.Hh(this.Ch,o),this.Hh(this.Th,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.mh)&&void 0!==e||(this.mh=null==(r=this._instance)?void 0:r._addCaptureHook((t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,r,s=this.zh(),n=(null==i||null==(e=i.properties)?void 0:e.$survey_id)||(null==i||null==(r=i.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.Uh(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Wh([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Vh(n),void this.Gh([n])}if(this.Th.has(t)){var a=this.Dh(t,i,jo.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map(t=>t.id)}),this.Wh(a.map(t=>t.id)),a.forEach(t=>this.Zh(t.id)))}if(this.Ch.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.Ch.get(t)});var l=this.Dh(t,i,jo.Activation);this.Jh(l.map(t=>t.id))}}onAction(t){this.Mh.has(t)&&this.Jh(this.Mh.get(t)||[])}Jh(t){var i;if(0!==t.length){var e=!(null==(i=this._instance)||null==i.get_session_id||!i.get_session_id()),r=[];for(var s of t)e&&this.Rh(s)?this.Vh(s)&&this.Qh(s):r.push(s);r.length>0&&(this.xh=[...new Set([...this.xh,...r])]),this.zh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Vh(t){this.xh=this.xh.filter(i=>i!==t);var i=this.Kh();return!i.includes(t)&&(this.Xh([...i,t]),this.Yh(),!0)}Wh(t){var i=new Set(t);this.xh=this.xh.filter(t=>!i.has(t));var e=this.td(),r=e.filter(t=>!i.has(t));r.length!==e.length&&(this.Xh(r),0===r.length&&this.ed()),this.Gh(t)}rd(){var t,i=this.Ah();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}Qh(t){if(this.Ah()){var i=this.rd();this.Ph(s({},i,{[t]:Date.now()}))}}Gh(t){if(this.Ah()){var i=this.rd(),e={},r=!1;for(var s of Object.entries(i)){var n=s[0],o=s[1];t.includes(n)?r=!0:e[n]=o}r&&(j(e)?this.Fh():this.Ph(e))}}nd(){this.Ah()&&this.Fh()}getActivationTimestamp(t){if(this.Kh().includes(t)){var i=this.rd()[t];return V(i)?i:void 0}}td(){var t,i=this.sd();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}Kh(){var t,i,e=this.td();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.od()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}Yh(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.ad(i)}ed(){this.ld()}Eh(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.od()];if(e&&e!==t){var r=this.td(),s=this.rd();r.length>0&&(this.Xh([]),r.filter(t=>V(s[t])).forEach(t=>this.Zh(t))),this.ed(),this.nd()}}getActivatedIds(){return[...new Set([...this.Kh(),...this.xh])].filter(t=>!this.ud(t))}dispose(){var t,i,e;null==(t=this.Ih)||t.call(this),this.Ih=void 0,null==(i=this.mh)||i.call(this),this.mh=void 0,null==(e=this.Bh)||e.dispose(),this.Bh=void 0}reset(){this.xh=[],this.td().length>0&&this.Xh([]),this.ed(),this.nd()}getEventToItemsMap(){return this.Ch}hd(){return this.Bh}},Oh=class extends Ch{constructor(t){super(t)}sd(){return Rr}od(){return Cr}Ah(){return Or}Ph(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Or]:t})}Fh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Or)}Rh(t){var i,e;this.Lh(i=>{e=i.find(i=>i.id===t)});var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return V(r)&&r>0}dd(){return Go.SHOWN}Lh(t){var i;null==(i=this._instance)||i.getSurveys(t)}Zh(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}zh(){return Sl}Xh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Rr]:t})}ad(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Cr]:t})}ld(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Cr)}ud(){return!1}Uh(t,i){var e;return this.Lh(t=>{e=t.find(t=>t.id===i)}),!e||function(t){var i;return dl(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e)?t===Go.SHOWN?"consume":"ignore":t===Go.SHOWN?"persist":t===Go.DISMISSED||t===Go.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Ah=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var i={};for(var e of t){var r=this._instance.get_property(e);U(r)||(i[e]=r)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},Ih=class{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=null==b?void 0:b.__PosthogExtensions__;if(t){var i=t.generateSurveys,e=t.loadExternalDependency;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new Oh(this._instance)}},Fh=null!=a&&a.location?ho(a.location.hash,"__posthog")||ho(location.hash,"state"):null,Mh="_postHogToolbarParams",Dh=Re("[Toolbar]"),Nh=Re("[FeatureFlags]"),Lh=class{constructor(t,i){void 0===i&&(i=!1),this.vd=!1,this.update(t,i)}update(t,i){this.fd=((t,i)=>{var e,r,s,n,o;return{bootstrap:{featureFlags:null==(e=t.bootstrap)?void 0:e.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},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!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=t.evaluation_contexts)&&void 0!==o?o:t.evaluation_environments)&&void 0!==n?n:[],flagKeys:D(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.vd||(Nh.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.vd=!0),U(t.flag_keys)||D(t.flag_keys)||Nh.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.fd}},jh=Re("[FeatureFlags]"),Uh=Re("[FeatureFlags]",{debugEnabled:!0}),Bh="\" failed. Feature flags didn't load in time.",zh="connection_error",Hh=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},qh=t=>{var i={};for(var e of Ss(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},Vh=t=>Q(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Wh=Re("[Error tracking]"),Gh="webkit-masked-url:",Kh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Gh],Jh=["__firefox__","__gCrWeb"],Yh="Refusing to render web experiment since the viewer is a likely bot",Xh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>vl(i,t),not_regex:(t,i)=>!vl(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},Qh=Re("[Conversations]"),Zh="Conversations not available yet.";function tu(t,i){var e,r,n,o,a,l,u,d=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,v=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,c=null!=i&&i.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,f=U(c)?Math.max(v,2048):Math.max(v,c),p=s({},function(){var t="",i="";try{var e=null==h?void 0:h.userAgent;if(e){var r=si(e);t=r[0],i=r[1]}}catch(t){}return function(t,i){var e=function(t){if(t)return{}.hasOwnProperty.call(pe,t)?pe[t]:t}(t);return s({},e?{"os.name":e}:{},i?{"os.version":i}:{})}(t,i)}(),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==p?void 0:p["service.name"])&&void 0!==a?a:null==t?void 0:t.serviceName)&&void 0!==o?o:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==p?void 0:p["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(u=null==p?void 0:p["deployment.environment"])&&void 0!==u?u:null==t?void 0:t.environment,resourceAttributes:p,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:d,maxBufferSize:v,maxQueueSize:f,maxBatchRecordsPerPost:100,rateCapWindowMs:d,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var iu=["debug","log","warn","error","info"],eu="console",ru="__posthogHandledLogsRequestError",su=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[ru]=!0,e},nu=t=>!!t&&"object"==typeof t&&!0===t[ru],ou={featureFlags:class{constructor(t){this.name="featureFlags",this.pd=!1,this.featureFlagEventHandlers=[],this.A=jh,this.gd={},this.md={},this.yd=[],this.bd=!1,this._d=!1,this.wd=0,this.kd=!1,this.Sd=!1,this.xd=!1,this.Cd=!1,this.Td=0,this.Ve=()=>{var t=this.Md();this.Td=0,t&&this.reloadFeatureFlags()},this.Id=()=>{var t,i=this.Ed;U(i)||this._n.remoteRequestsDisabled||!u||"hidden"===u.visibilityState||Date.now()-(null!==(t=this.Rd)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.Ad())},this.Ze=()=>{"visible"===(null==u?void 0:u.visibilityState)&&this.Id()},"get"in t?this.Us=t:(this._instance=t,this.Pd=new Lh(t.config,t.Ma()),this.Us=this.Pd)}updateConfig(t,i){var e;null==(e=this.Pd)||e.update(t,i),this.Hs&&this.Fd()}setup(t){return this.Zu=t,this.A=t.logger.createLogger("[FeatureFlags]"),Eh(t.kv.initialize(),()=>{this.Zu===t&&(this.Zu=void 0,this.Hs=t,this.Od(t))})}Od(t){var i;if(this.Hs===t)return a&&Ps(a,"online",this.Ve),this.Fd(),this.$d=t.registerDynamicEventProperties(()=>this.Dd()?this.gd:this.md),this.Ld=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.onCrossTabFeatureFlagChange(()=>{this.Nd(),this.qd(),this.jd()}),this.qd(),this.initialize()}Fd(){var t=this._n.refreshIntervalMs,i=!this._n.remoteRequestsDisabled&&u&&!U(t)&&t>0?t:void 0;i!==this.Ed&&(this.Bd(),U(i)||(this.Ed=i,this.Ad(),null!=u&&u.addEventListener&&Ps(u,cs,this.Ze)))}Ad(){U(this.Ed)||(U(this.Hd)||clearInterval(this.Hd),this.Rd=Date.now(),this.Hd=setInterval(this.Id,this.Ed))}Bd(){U(this.Hd)||(clearInterval(this.Hd),this.Hd=void 0,null==u||null==u.removeEventListener||u.removeEventListener(cs,this.Ze)),this.Ed=void 0,this.Rd=void 0}destroy(){this.zd()}dispose(){this.zd()}zd(){var t,i;this.Bd(),this.wd++,this.Sd=!1,this.Zu=void 0,this.Hs&&(this.Ud(),null==(t=this.$d)||t.dispose(),this.$d=void 0,null==(i=this.Ld)||i.call(this),this.Ld=void 0,this.yd=[],null==a||a.removeEventListener("online",this.Ve),this.Hs=void 0)}get _n(){return this.Us.get()}Wd(t){var i;return this.Vd&&t in this.Vd?this.Vd[t]:null==(i=this.Hs)?void 0:i.kv.get(t)}Nd(){return!!this.Vd&&(this.Vd=void 0,!0)}Gd(){var t;return!U(null==(t=this.Hs)?void 0:t.kv.get("$enabled_feature_flags"))&&this.Nd()}ui(t){this.Zd(()=>{var i;return null==(i=this.Hs)?void 0:i.kv.set(t)})}Jd(t,i,e){var r;if(null!=(r=this._instance)&&r.persistence&&t.$enabled_feature_flags){var s=this.Wd("$enabled_feature_flags")||{},n=t.$enabled_feature_flags||{},o=i.flags||i.featureFlags,a=i.flags?Object.entries(i.flags).filter(t=>{var i=t[1];return!(null!=i&&i.failed)}).map(t=>t[0]):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,h=l?a:e&&!D(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.Wd("$feature_flag_payloads")||{},d=t.$feature_flag_payloads||{},v=l||e?h:Array.from(new Set([...Object.keys(u),...Object.keys(d)])),c=!l&&!e,f=!!c||h,p=!!c||v,_={[_r]:f,[pr]:f,[br]:p};for(var g of(t.$feature_flag_details&&(_[mr]=f),[yr,zr,wr]))U(t[g])||(_[g]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(_)}}hi(t){this.Zd(()=>{var i;return null==(i=this.Hs)?void 0:i.kv.remove(t)})}Zd(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}qd(){var t={};for(var i of[_r,br,yr,Sr]){var e=this.Wd(i);U(e)||(t[i]=e)}this.gd=t;var r=s({},t),n=this.Wd(pr);if(n)for(var o of Object.entries(n))r["$feature/"+o[0]]=o[1];this.md=r}Dd(){var t=this._n.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Wd(zr);return"number"!=typeof i||Date.now()-i>t}Qd(){return!!this.Dd()&&(this.Cd||this._d||(this.Cd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Kd(){var t=this._n.evaluationContexts;return null!=t&&t.length?t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}Xd(){var t=this._n.flagKeys;if(!U(t))return t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i,e=this._n,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter(t=>!U(r[t])).reduce((t,i)=>(t[i]=r[i],t),{}),l=Object.keys(o).filter(t=>a[t]).reduce((t,i)=>(t[i]=o[i],t),{});return this.Yd({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(t,i,e){var r,n,o=null!=e&&e.merge&&null!==(r=this.Wd("$enabled_feature_flags"))&&void 0!==r?r:{},a=null!=e&&e.merge&&null!==(n=this.Wd("$feature_flag_payloads"))&&void 0!==n?n:{},l=s({},o,t),h=s({},a,i),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Qi(c),variant:Zi(c),reason:void 0,metadata:U(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.Yd({flags:u})}get hasLoadedFlags(){return this.bd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Wd(mr),i=this.Wd(Sr),e=this.Wd(xr);if(!e&&!i)return t||{};var r=ws({},t||{});for(var n of[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])]){var o,a,l=r[n],h=null==i?void 0:i[n],u=U(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=U(h)?null==l?void 0:l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=s({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=s({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.pd||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.pd=!0),r}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{var r=t[e];return{key:e,enabled:Qi(r),variant:Zi(r),payload:Xi(i[e])}})}getFlagVariants(){var t=this.Wd(pr),i=this.Wd(Sr);if(!i)return t||{};for(var e=ws({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.pd||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.pd=!0),e}getFlagPayloads(){var t=this.Wd(br),i=this.Wd(xr);if(!i)return t||{};for(var e=ws({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.pd||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.pd=!0),e}reloadFeatureFlags(){this.kd||this._n.featureFlagsDisabled||this.Md()||(this._d&&(this.Sd=!0),this.tv||(this.yd.slice().forEach(t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.tv=setTimeout(()=>{this.ev()},5)))}Ud(){clearTimeout(this.tv),this.tv=void 0}onReloading(t){return this.yd.push(t),()=>{this.yd=this.yd.filter(i=>i!==t)}}ensureFlagsLoaded(){this.bd||this._d||this.tv||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.kd=t}resetFlagCallReported(){this.hi(jr)}ev(t){this.Ud();var i=this.Hs;if(i&&!this._n.remoteRequestsDisabled&&!this.Md())if(this._d)this.Sd=!0;else{var e={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:s({},i.initialPersonProperties,this.Wd("$stored_person_properties")||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Wd(kr),timezone:ko()};U(i.deviceId)||(e.$device_id=i.deviceId),(null!=t&&t.disableFlags||this._n.featureFlagsDisabled)&&(e.disable_flags=!0);var r=this.Kd();r.length&&(e.evaluation_contexts=r);var n=this.Xd();U(n)||(e.flag_keys=n);var o=this._n.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.wd;this._d=!0;var h=()=>{this.Sd&&(this.Sd=!1,this.ev())},u=t=>{this._d=!1,l===this.wd?(this.ui({[Br]:[zh]}),this.A.error("Feature flag request failed",t),this.Gd()&&this.jd(!0),h()):h()};try{i.sendRequest(a,{target:"flags",method:"POST",body:e,compression:this._n.compression,sentAt:"body",timeoutMs:this._n.requestTimeoutMs}).then(t=>{var i,r,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this._d=!1,l===this.wd){if(this.iv(t.statusCode),n||this.Sd||(this.$anon_distinct_id=void 0),!e.disable_flags||this.Sd){this.xd=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?zh:"unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var u=!(null==(r=s.quotaLimited)||!r.includes("feature_flags"));u&&a.push("quota_limited"),this.ui({[Br]:a}),u?this.A.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):e.disable_flags||this.Yd(s,n,{partialResponse:o}),h()}}else h()}).catch(u)}catch(t){u(t)}}}Md(){return uo(this.Td,3)}iv(t){this.Td=vo(t,this.Td,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.xd)if(this.bd||this.getFlags()&&this.getFlags().length>0){if(!this.Qd()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else this.A.warn('getFeatureFlag for key "'+t+Bh)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i;return null==(i=this.getFeatureFlagResult(t,{send_event:!1}))?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.xd)if(this.bd||this.getFlags()&&this.getFlags().length>0){if(!this.Qd()){var e,r=this.getFlagVariants(),n=t in r,o=r[t],a=this.getFlagPayloads()[t],l=String(o),h=this.Wd("$feature_flag_request_id")||void 0,u=this.Wd("$feature_flag_evaluated_at")||void 0,d=this.Wd("$flag_call_reported")||{};if(this._n.deduplicateCallsPerSession){var v,c=null==(v=this.Hs)?void 0:v.session.sessionId,f=this.Wd(Ur);c&&c!==f&&(d={},e=c)}if(i.send_event||!("send_event"in i))if(t in d&&d[t].includes(l))e&&this.ui({[jr]:d,[Ur]:e});else{var p,_,g,m,b,y,w,S,x,E,k,T,P;D(d[t])?d[t].push(l):d[t]=[l],this.ui(s({[jr]:d},e?{[Ur]:e}:{}));var R=this.getFeatureFlagDetails(t),C=[...null!==(p=this.Wd("$feature_flag_errors"))&&void 0!==p?p:[]];U(o)&&C.push("flag_missing");var O={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(_=null==(g=this._n.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(m=null==(b=this._n.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.xd};U(null==R||null==(y=R.metadata)?void 0:y.has_experiment)||(O.$feature_flag_has_experiment=R.metadata.has_experiment),U(null==R||null==(w=R.metadata)?void 0:w.version)||(O.$feature_flag_version=R.metadata.version);var A=null!==(S=null==R||null==(x=R.reason)?void 0:x.description)&&void 0!==S?S:null==R||null==(E=R.reason)?void 0:E.code;A&&(O.$feature_flag_reason=A),null!=R&&null!=(k=R.metadata)&&k.id&&(O.$feature_flag_id=R.metadata.id),U(null==R?void 0:R.original_variant)&&U(null==R?void 0:R.original_enabled)||(O.$feature_flag_original_response=U(R.original_variant)?R.original_enabled:R.original_variant),null!=R&&null!=(T=R.metadata)&&T.original_payload&&(O.$feature_flag_original_payload=null==R||null==(P=R.metadata)?void 0:P.original_payload),C.length&&(O.$feature_flag_error=C.join(",")),this.rv(O)}else e&&this.ui({[jr]:d,[Ur]:e});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Xi(a)}}}else this.A.warn('getFeatureFlagResult for key "'+t+Bh)}rv(t){try{var i;null==(i=this.Hs)||i.capture("$feature_flag_called",t).catch(t=>{this.A.error("Failed to capture feature flag call",t)})}catch(t){this.A.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.nv(t,i)}nv(t,i){var e=this;return o(function*(){var r=e.Hs;if(r){var s={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},n=e.Kd();n.length&&(s.evaluation_contexts=n);var o,a=e.Xd();U(a)||(s.flag_keys=a);try{var l;o=(null==(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:e._n.compression,sentAt:"body",timeoutMs:e._n.requestTimeoutMs})).json)||null==(l=l.featureFlagPayloads)?void 0:l[t])||void 0}catch(t){return void e.A.error("Remote config feature flag request failed",t)}try{i(o)}catch(t){e.A.error("Remote config feature flag callback failed",t)}}})()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.xd)return i.defaultValue;if(!(this.bd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+Bh),i.defaultValue;var e=this.getFeatureFlag(t,i);return U(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.Yd(t,i,e)}Yd(t,i,e){if(this.Hs){this.bd=!0;var r=function(t,i,e,r,n,o){void 0===i&&(i={}),void 0===e&&(e={}),void 0===r&&(r={}),void 0===o&&(o=jh);var a=((t,i)=>{var e=t.flags;return e?s({},t,{featureFlags:Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return!U(null==(i=e[t].metadata)?void 0:i.payload)}).map(t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]}))}):(t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,o),l=a.flags,h=a.featureFlags,u=a.featureFlagPayloads;if(h){var d=t.requestId,v=t.evaluatedAt;if(D(h)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(h)for(var f=0;h.length>f;f++)c[h[f]]=!0;return{[_r]:h,[pr]:c,[wr]:!1}}var p=h,_=u,g=l;if(null!=n&&n.partialResponse){var m=Object.keys(p),b=_||{};p=s({},i,p),_=s({},e,b),m.forEach(t=>{var i;t in b||null==(i=_)||delete i[t]}),g=s({},r,g)}else if(t.errorsWhileComputingFlags)if(l){var y=new Set(Object.keys(l).filter(t=>{var i;return!(null!=(i=l[t])&&i.failed)}));p=s({},i,Object.fromEntries(Object.entries(p).filter(t=>y.has(t[0]))));var w=Object.fromEntries(Object.entries(_||{}).filter(t=>y.has(t[0])));_=s({},e,w),y.forEach(t=>{var i;t in w||null==(i=_)||delete i[t]}),g=s({},r,Object.fromEntries(Object.entries(g||{}).filter(t=>y.has(t[0]))))}else p=s({},i,p),_=s({},e,_),g=s({},r,g);return s({[_r]:Object.keys(qh(p)),[pr]:p||{},[br]:_||{},[mr]:g||{},[wr]:!0===t.minimalFlagCalledEvents},d?{[yr]:d}:{},v?{[zr]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.A);if(r)if(!1===(null==e?void 0:e.persist)){var n=!U(this.Hs.kv.get(pr));this.Vd=r,n||this.ui(r)}else this.Nd(),this.Jd(r,t,!(null==e||!e.partialResponse)),this.ui(r);else i&&this.Gd();i||(this.Cd=!1),this.jd(i)}}override(t,i){void 0===i&&(i=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.sv(t)}sv(t){if(this.Hs){if(!1===t)return this.hi([Sr,xr]),this.jd(),void Uh.info("All overrides cleared");if(D(t))return this.ui({[Sr]:Hh(t)}),this.jd(),void Uh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.pd=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[Sr]=D(s)?Hh(s):s),n&&(r[xr]=n),Object.keys(r).length&&this.ui(r),!1===s&&!1===n?this.hi([Sr,xr]):!1===s?this.hi(Sr):!1===n&&this.hi(xr),this.jd(),!1===s?Uh.info("Flag overrides cleared"):s&&Uh.info("Flag overrides set",{flags:s}),void(!1===n?Uh.info("Payload overrides cleared"):n&&Uh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.ui({[Sr]:t}),this.jd(),void Uh.info("Flag overrides set",{flags:t});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.bd){var i=this.ov(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,n=(this.Wd("$early_access_features")||[]).find(i=>i.flagKey===t),o={["$feature_enrollment/"+t]:i},a={$feature_flag:t,$feature_enrollment:i,$set:o};n&&(a.$early_access_feature_name=n.name),e&&(a.$feature_enrollment_stage=e);var l=s({},this.getFlagVariants(),{[t]:i});null==(r=this._instance)||null==(r=r.persistence)||r.markCrossTabFeatureFlagChanges({[_r]:[t],[pr]:[t],[Er]:Object.keys(o)}),this.ui({[_r]:Object.keys(qh(l)),[pr]:l,[Er]:s({},this.Wd("$stored_person_properties")||{},o)}),this.jd();try{var h;null==(h=this.Hs)||h.capture("$feature_enrollment_update",a).catch(t=>{this.A.error("Failed to capture early access feature enrollment",t)})}catch(t){this.A.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Wd(gr);!r||i?this.av(t,e):t(r)}av(t,i){var e=this;return o(function*(){var r=e.Hs;if(r){var s,n=i?"&"+i.map(t=>"stage="+t).join("&"):"";try{var o=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;s=o.json.earlyAccessFeatures,e.ui({[gr]:s})}catch(t){return void e.A.error("Early access feature request failed",t)}try{t(s)}catch(t){e.A.error("Early access feature callback failed",t)}}})()}ov(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter(t=>i[t]),flagVariants:Object.keys(i).filter(t=>i[t]).reduce((t,e)=>(t[e]=i[e],t),{})}}jd(t){this.qd();var i=this.ov(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach(i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.A.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.lv(t,i)}lv(t,i){void 0===i&&(i=!0);var e=this.Wd("$stored_person_properties")||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in e||(o[a]=n[a]));this.ui({[Er]:s({},e,o,r)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=s({},this.Wd("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.ui({[Er]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.hi(Er),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.Wd("$stored_group_properties")||{},r=s({},e);for(var n of Object.keys(t))r[n]=s({},e[n],t[n]);this.ui({[kr]:r}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Wd("$stored_group_properties")||{};this.ui({[kr]:s({},i,{[t]:{}})})}else this.hi(kr)}reset(){this.wd++,this.Sd=!1,this.gd={},this.md={},this.Vd=void 0,this.bd=!1,this.kd=!1,this.xd=!1,this.$anon_distinct_id=void 0,this.Ud(),this.pd=!1,this.Td=0}}},au={sessionRecording:class{get _n(){return this._instance.config}get Ya(){return this._instance.persistence}get started(){var t;return!(null==(t=this.uv)||!t.isStarted)}get status(){var t,i;return"awaiting_config"===this.hv||"missing_config"===this.hv?this.hv:null!==(t=null==(i=this.uv)?void 0:i.status)&&void 0!==t?t:this.hv}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.hv=ph,this.dv=void 0,this.vv=!1,this.je=(()=>{var t;if(null==u||!u.visibilityState||"visible"===u.visibilityState)return!0;var i=null==a||null==(t=a.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some(t=>"visible"===t.name)})(),this.Ze=()=>{var t;"visible"===(null==u?void 0:u.visibilityState)&&(this.je=!0,null==(t=this.uv)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},!this._instance.sessionManager)throw gh.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this._n.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');null!=u&&u.addEventListener&&Ps(u,"visibilitychange",this.Ze)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.vv=!0,null==u||null==u.removeEventListener||u.removeEventListener("visibilitychange",this.Ze),e?this.fv(!0):this.stopRecording()}get pv(){var t,i=!(null==(t=this._instance.get_property(ir))||!t.enabled),e=!this._n.disable_session_recording,r=this._n.disable_session_recording||this._instance.consent.isOptedOut();return a&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.vv||this.pv&&null!=(i=this.uv)&&i.isStarted)){var e=!U(Object.assign)&&!U(Array.from);this.pv&&e?(this.gv(t),gh.info("starting")):(this.hv=ph,this.stopRecording())}}gv(t){var i,e;if(this.pv)if("awaiting_config"!==this.hv&&"missing_config"!==this.hv&&(this.hv=_h),null!=b&&null!=(i=b.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=b.__PosthogExtensions__)&&e.initSessionRecording)this.mv(t);else{var r,s=this._instance.sessionManager;null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.yv,i=>{if(!this.vv&&this.pv&&this._instance.sessionManager===s)return i?(this._instance.register_for_session({[ts]:!0}),gh.error("could not load recorder",i)):void this.mv(t);this.hv=ph})}}stopRecording(){var t,i;null==(t=this.dv)||t.call(this),this.dv=void 0,null==(i=this.uv)||i.stop()}fv(t){var i,e;void 0===t&&(t=!1),null==(i=this.dv)||i.call(this),this.dv=void 0,null==(e=this.uv)||e.discard({discardProducerEvents:t})}bv(){var t,i;null==(t=this.Ya)||t.unregister(hr),null==(i=this.Ya)||i.unregister(rr)}_v(t,i){if(q(t))return null;var e,r=V(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(gh.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}wv(t){if(this.Ya){var i,e,r=this.Ya,n=()=>{var i,e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this._v(null==(i=this._n.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this._v(null==e?void 0:e.sampleRate,"remote config sampleRate"),a=null!=n?n:o;q(a)&&this.bv();var l=null==e?void 0:e.minimumDurationMilliseconds;r.register({[ir]:s({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:s({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:a,minimumDurationMilliseconds:U(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.dv)||i.call(this),this.dv=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(n)}}onRemoteConfig(t){var i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.wv(i),void this.fv()):(this.wv(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.hv&&(this.hv="missing_config",gh.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.uv)&&e.log?this.uv.log(t,i):gh.warn("log called before recorder was ready")}get yv(){var t;return(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.get_property("$session_recording_remote_config"))||null==(t=t.scriptConfig)?void 0:t.script)||"lazy-recorder"}Sv(){var t,i=this._instance.get_property(ir);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return gh.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!q(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}mv(t){var i,e,r;if(!this.vv&&this.pv&&this._instance.sessionManager){if(null==(i=b.__PosthogExtensions__)||!i.initSessionRecording)return gh.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ts]:!0});var s;if(this.uv||(this.uv=null==(s=b.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.je),this.uv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Sv()){if("missing_config"===this.hv||"awaiting_config"===this.hv)return;return this.hv="awaiting_config",gh.info("persisted remote config is stale, requesting fresh config before starting"),void new ra(this._instance).load()}this.hv=_h,null==(e=(r=this.uv).setDocumentWasEverVisible)||e.call(r,this.je),this.uv.start(t)}else this.hv=ph}onRRwebEmit(t){var i;null==(i=this.uv)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.uv||null==(t=this.Ya)||t.register({[nr]:!0}),null==(i=this.uv)||i.overrideLinkedFlag()}overrideSampling(){var t,i;this.uv||null==(t=this.Ya)||t.register({[sr]:!0}),null==(i=this.uv)||i.overrideSampling()}overrideTrigger(t){var i,e;this.uv||null==(i=this.Ya)||i.register({["url"===t?or:ar]:!0}),null==(e=this.uv)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.uv)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.uv)||!e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t;null==(t=this.uv)||null==t.flushBeforeIdentityReset||t.flushBeforeIdentityReset()}}},lu={autocapture:class extends rh{constructor(t){super(new sh(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.xv=this.Cv()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.Tv();return!!(t.path||t.search||this.Mv(t))}startIfEnabled(){this.isEnabled&&(Pe.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.xv=this.Cv(),this.startIfEnabled()}stop(){this.Iv&&this.Iv(),this.Iv=void 0,this.Ev&&this.Ev(),this.Ev=void 0,Pe.info("History API monitoring stopped")}monitorHistoryChanges(){a&&a.history&&(this.Rv("pushState"),this.Rv("replaceState"),this.Av(),this.Mv()&&this.Pv())}Rv(t){var i;if(a&&(null==(i=a.history[t])||!i.__posthog_wrapped__)){var e=this;lh(a.history,t,i=>function(r,s,n){i.call(this,r,s,n),e.Fv(t)})}}Cv(){var t=null==a?void 0:a.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Tv(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:L(t)?t:{}}Mv(t){return void 0===t&&(t=this.Tv()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}Ov(t){var i=this.Tv(),e=this.xv;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.Mv(i)&&t.hash!==e.hash))}Fv(t){try{var i=this.Cv();if(!i)return;this.Ov(i)&&this._instance.capture(ps,{navigation_type:t}),this.xv=i}catch(i){Pe.error("Error capturing "+t+" pageview",i)}}Av(){if(!this.Iv){var t=()=>{this.Fv("popstate")};Ps(a,"popstate",t),this.Iv=()=>{a&&a.removeEventListener("popstate",t)}}}Pv(){if(!this.Ev){var t=()=>{this.Fv("hashchange")};Ps(a,"hashchange",t),this.Ev=()=>{a&&a.removeEventListener("hashchange",t)}}}},heatmaps:class{get _n(){return this.instance.config}constructor(t){var i;this.$v=!1,this.Ws=!1,this.Dv=null,this.instance=t,this.$v=!(null==(i=this.instance.persistence)||!i.props[We]),this.rageclicks=new Xl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return L(this._n.capture_heatmaps)&&this._n.capture_heatmaps.flush_interval_milliseconds&&(t=this._n.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return q(this._n.capture_heatmaps)?q(this._n.enable_heatmaps)?this.$v:this._n.enable_heatmaps:!1!==this._n.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Ws)return;mh.info("starting..."),this.Lv(),this.Ze()}else{var t;clearInterval(null!==(t=this.Dv)&&void 0!==t?t:void 0),this.Nv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var i=t.config;if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[We]:e}),this.$v=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.Pe;return this.Pe=void 0,t}qv(t){bh(t.originalEvent)&&this.an(t.originalEvent,"deadclick")}Ze(){this.Dv&&clearInterval(this.Dv),this.Dv="visible"===(null==u?void 0:u.visibilityState)?setInterval(this.za.bind(this),this.flushIntervalMilliseconds):null}Lv(){a&&u&&(this.jv=this.za.bind(this),Ps(a,fs,this.jv),this.Bv=t=>this.an(t||(null==a?void 0:a.event)),Ps(u,"click",this.Bv,{capture:!0}),this.Hv=t=>this.zv(t||(null==a?void 0:a.event)),Ps(u,"mousemove",this.Hv,{capture:!0}),this.Uv=new Kn(this.instance,Wn,this.qv.bind(this)),this.Uv.startIfEnabledOrStop(),this.Wv=this.Ze.bind(this),Ps(u,cs,this.Wv),this.Ws=!0)}Nv(){var t;a&&u&&(this.jv&&a.removeEventListener(fs,this.jv),this.Bv&&u.removeEventListener("click",this.Bv,{capture:!0}),this.Hv&&u.removeEventListener("mousemove",this.Hv,{capture:!0}),this.Wv&&u.removeEventListener(cs,this.Wv),clearTimeout(this.Vv),null==(t=this.Uv)||t.stop(),this.Ws=!1)}Gv(t,i){var e=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,i,e){for(var r=t;r&&ln(r)&&!hn(r,"body");){if(r===e)return!1;var s=void 0;try{var n,o,l;s=null==(n=null!==(o=null==(l=r.ownerDocument)?void 0:l.defaultView)&&void 0!==o?o:a)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(E(i,s))return!0;r=wn(r)}return!1}(gn(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:e),target_fixed:n,type:i}}an(t,i){var e;if(void 0===i&&(i="click"),!an(t.target)&&bh(t)){var r=this.Gv(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&Pn(gn(t),this.instance.config.rageclick)&&this.Is(s({},r,{type:"rageclick"})),this.Is(r)}}zv(t){!an(t.target)&&bh(t)&&(clearTimeout(this.Vv),this.Vv=setTimeout(()=>{this.Is(this.Gv(t,"mousemove"))},500))}Is(t){if(a){var i=this._n.disable_capture_url_hashes?gi(a.location.href):a.location.href,e=this._n.custom_personal_data_properties,r=lo(i,this._n.mask_personal_data_properties?[...co,...e||[]]:[],po);this.Pe=this.Pe||{},this.Pe[r]||(this.Pe[r]=[]),this.Pe[r].push(t)}}za(){this.Pe&&!j(this.Pe)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Kn,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this.$v=!1,this.Ws=!1,this.Pe={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Zv=()=>{clearTimeout(this.Jv),this.Jv=void 0,0!==this.Pe.metrics.length&&(this._instance.capture("$web_vitals",s({$current_url:this.Pe.url},this.Pe.metrics.reduce((t,i)=>s({},t,{["$web_vitals_"+i.name+"_event"]:s({},i),["$web_vitals_"+i.name+"_value"]:i.value}),{}))),this.Pe={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Qv=t=>{var i;if(this.Pe=this.Pe||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},q(null==t?void 0:t.name)||q(null==t?void 0:t.value))uh.error("Invalid metric received",t);else{var e="string"==typeof t.navigationURL?t.navigationURL:void 0,r=this.Kv(e);if(!U(r)){var n=V(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+r;if(!this.Xv||this.Xv>t.value){this.Pe.navigationKey!==n&&(this.Zv(),this.Jv=setTimeout(this.Zv,this.flushToCaptureTimeoutMs)),U(this.Pe.navigationKey)&&(this.Pe.navigationKey=n,this.Pe.url=r),this.Pe.firstMetricTimestamp=U(this.Pe.firstMetricTimestamp)?Date.now():this.Pe.firstMetricTimestamp;var o=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),a=s({},t,e?{navigationURL:r}:{},{$current_url:r,timestamp:Date.now()});if(delete a.entries,L(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of fh){var u="url"===h&&"string"==typeof t.attribution[h]?this.Kv(t.attribution[h]):t.attribution[h];U(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;U(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.Pe.metrics.push(a),this.Pe.metrics.length===this.allowedMetrics.length&&this.Zv()}else uh.error("Ignoring metric with value >= "+this.Xv,t)}}},this.Yv=()=>{if(!this.Ws){var t,i,e,r,n=!1,o=b.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.tc])||("web-vitals"===this.tc&&U(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!U(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!U(h),t=u.indexOf("LCP")>-1?l.onLCP:(null==h?void 0:h.onLCP)||l.onLCP,i=u.indexOf("CLS")>-1?l.onCLS:(null==h?void 0:h.onCLS)||l.onCLS,e=u.indexOf("FCP")>-1?l.onFCP:(null==h?void 0:h.onFCP)||l.onFCP,r=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&i&&e&&r){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?s({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Qv.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Qv.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&e(this.Qv.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&r(this.Qv.bind(this),v),this.Ws=!0}else uh.error("web vitals callbacks not loaded - not starting")}},this.$v=!(null==(i=this._instance.persistence)||!i.props[Ye]),this.startIfEnabled()}get ec(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=L(this.ec)?null==(t=this.ec)?void 0:t.web_vitals_allowed_metrics:void 0;return q(e)?(null==(i=this._instance.persistence)?void 0:i.props.$web_vitals_allowed_metrics)||vh:e}get flushToCaptureTimeoutMs(){return(L(this.ec)?this.ec.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=L(this.ec)?this.ec.web_vitals_attribution:void 0;return G(t)?t?vh:[]:D(t)?t:ch}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t;return null!==(t=L(this.ec)?this.ec.__preview_web_vitals_soft_navs:void 0)&&void 0!==t&&t}get Xv(){var t=L(this.ec)&&V(this.ec.__web_vitals_max_value)?this.ec.__web_vitals_max_value:dh;return t>0&&6e4>=t?dh:t}get isEnabled(){var t=null==d?void 0:d.protocol;if("http:"!==t&&"https:"!==t)return uh.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=L(this.ec)?this.ec.web_vitals:G(this.ec)?this.ec:void 0;return G(i)?i:this.$v}startIfEnabled(){this.isEnabled&&!this.Ws&&(uh.info("enabled, starting..."),this.do(this.Yv))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=L(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=L(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ye]:e}),this._instance.persistence.register({[tr]:r})),this.$v=e,this.startIfEnabled()}}}get tc(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}do(t){var i=b.__PosthogExtensions__,e=this.tc,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&U(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,i=>{i?uh.error("failed to load script",i):t()})}Kv(t){var i=t||(null==a?void 0:a.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?gi(i):i,r=this._instance.config.custom_personal_data_properties;return lo(e,this._instance.config.mask_personal_data_properties?[...co,...r||[]]:[],po)}uh.error("Could not determine current URL")}}},hu={exceptionObserver:class{constructor(t){var i;this.Yv=()=>{var t;if(a&&this.isEnabled&&null!=(t=b.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=b.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=b.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=b.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.rc&&this._n.capture_unhandled_errors&&(this.rc=i(this.captureException.bind(this))),!this.nc&&this._n.capture_unhandled_rejections&&(this.nc=e(this.captureException.bind(this))),!this.sc&&this._n.capture_console_errors&&(this.sc=r(this.captureException.bind(this)))}catch(t){nh.error("failed to start",t),this.oc()}}},this._instance=t,this.ac=!(null==(i=this._instance.persistence)||!i.props[Ge]),this.wt=new nt(s({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,A:nh})),this._n=this.lc(),this.startIfEnabledOrStop()}lc(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return L(t)?i=s({},i,t):(U(t)?this.ac:t)&&(i=s({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this._n.capture_console_errors||this._n.capture_unhandled_errors||this._n.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(nh.info("enabled"),this.oc(),this.do(this.Yv)):this.oc()}do(t){var i,e;null!=(i=b.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=b.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return nh.error("failed to load script",i);t()})}oc(){var t,i,e;null==(t=this.rc)||t.call(this),this.rc=void 0,null==(i=this.nc)||i.call(this),this.nc=void 0,null==(e=this.sc)||e.call(this),this.sc=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.ac=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Ge]:this.ac}),this._n=this.lc(),this.startIfEnabledOrStop())}}onConfigChange(){this._n=this.lc()}captureException(t){try{var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";if(this.wt.consumeRateLimit(s))return void nh.info("Skipping exception capture because of client rate limiting.",{exception:s});null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var i,e;this.uc=[],this.hc=new Si([new Ii,new Hi,new Mi,new Fi,new Bi,new Ui,new Ni,new zi],function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];return function(i,r){void 0===r&&(r=0);for(var n=[],o=i.split("\n"),a=r;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=Ai.test(l)?l.replace(Ai,"$1"):l;if(!h.match(/\S*Error: /)){for(var u of e){var d=u(h,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return s({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",Pi,Oi)),this._instance=t,this.uc=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this.dc=Ki(this.vc()),this.cc=new Ji(this.dc)}onConfigChange(){this.dc=Ki(this.vc()),this.cc.setConfig(this.dc)}onRemoteConfig(t){var i,e,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(i=null==(e=s.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.uc=n,this._instance.persistence&&this._instance.persistence.register({[Ke]:this.uc,[Je]:o})}}}get fc(){var t,i,e=!!this._instance.get_property(Je);return null!==(t=null!==(i=this._instance.config.error_tracking.captureExtensionExceptions)&&void 0!==i?i:e)&&void 0!==t&&t}buildProperties(t,i){return this.hc.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.dc.enabled)try{if(!B(t)||0===t.trim().length)return void Wh.warn("Ignoring exception step because message must be a non-empty string");var e=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var i=[];return{sanitizedProperties:Object.keys(t).reduce((e,r)=>Wi.has(r)?(i.push(r),e):(e[r]=t[r],e),{}),droppedKeys:i}}(this.gc(i)),r=e.sanitizedProperties,n=e.droppedKeys;n.length>0&&Wh.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.cc.add(s({[qi]:t,[Vi]:(new Date).toISOString()},r))}catch(t){Wh.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.mc(i)){if(this.yc(i))return this.bc("Exception dropped: matched a suppression rule"),void Wh.info("Skipping exception capture because a suppression rule matched");if(!this.fc&&this._c(i))return this.bc("Exception dropped: thrown by a browser extension"),void Wh.info("Skipping exception capture because it was thrown by an extension");if(!this.fc&&this.wc(i))return this.bc("Exception dropped: thrown by an injected browser script"),void Wh.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.kc(i))return this.bc("Exception dropped: thrown by the PostHog SDK"),void Wh.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.dc.enabled&&q(t.$exception_steps)?this.Sc(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",Iu:!0});return s&&this.cc.clear(),s}catch(t){return Vh(t)||Wh.error("Failed to capture exception event. Dropping this exception.",t),void this.cc.clear()}}catch(t){return void(Vh(t)||Wh.error("Failed to process exception event. Ignoring this exception.",t))}var n}Sc(t){try{var i=this.cc.getAttachable();return 0===i.length?t:s({},t,{$exception_steps:i})}catch(i){return Wh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}bc(t){this.dc.enabled&&this.cc.add({[qi]:t,[Vi]:(new Date).toISOString()})}gc(t){return L(t)?s({},t):{}}vc(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}yc(t){if(0===t.length)return!1;try{var i=t.reduce((t,i)=>{var e=i.type,r=i.value;return B(e)&&e.length>0&&t.$exception_types.push(e),B(r)&&r.length>0&&t.$exception_values.push(r),t},{$exception_types:[],$exception_values:[]});return this.uc.some(t=>{var e=t.values.map(t=>{var e=fl[t.operator],r=i[t.key];if(!e||!r)return!1;var s=D(t.value)?t.value:[t.value];return s.length>0&&e(s,r)});return"OR"===t.type?e.some(Boolean):e.every(Boolean)})}catch(t){return Wh.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}_c(t){var i=t.flatMap(t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]}),e=i.filter(t=>{var i=t.filename;return!!i&&Kh.some(t=>i.startsWith(t))});return 0!==e.length&&(!e.every(t=>{var i=t.filename;return!!i&&i.startsWith(Gh)})||t.some(t=>{var i=t.value;return B(i)&&i.includes("isolatedAPI.contexts.topHostname")})&&!i.some(t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith(Gh))}))}wc(t){return t.some(t=>{var i=t.value;return B(i)&&Jh.some(t=>i.includes(t))})}kc(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[];return null!==(r=null==(s=n[n.length-1])||null==(s=s.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}mc(t){return!q(t)&&D(t)}}},uu=s({productTours:class{get Ya(){return this._instance.persistence}constructor(t){this.xc=null,this.Cc=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var i=t.config;if("productTours"in i){var e,r;if(this.Ya&&this.Ya.register({[Qe]:!!i.productTours}),!wh(this._instance))return!this.xc&&q(null==(e=this.Ya)?void 0:e.props.ph_product_tours)||yh.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.xc)||r.stop(),this.xc=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.xc&&wh(this._instance)&&this.do(()=>this.Tc())}do(t){var i,e;null!=(i=b.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=b.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",i=>{i?yh.error("Could not load product tours script",i):t()})}Tc(){var t;!this.xc&&null!=(t=b.__PosthogExtensions__)&&t.generateProductTours&&(this.xc=b.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!D(this.Cc)||i){var e=this.Ya;if(e){var r=e.props[Ar];if(D(r)&&!i)return this.Cc=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if(wh(this._instance)){var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?i.error||yh.warn(s):yh.error(s),void t([],{isLoaded:!1,error:s})}var n=D(i.json.product_tours)?i.json.product_tours:[];this.Cc=n,e&&e.register({[Ar]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Cc,{isLoaded:!0})}getActiveProductTours(t){q(this.xc)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.xc.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.xc)||i.showTourById(t)}previewTour(t){this.xc?this.xc.previewTour(t):this.do(()=>{var i;this.Tc(),null==(i=this.xc)||i.previewTour(t)})}dismissProductTour(){var t;null==(t=this.xc)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.xc)||t.nextStep()}previousStep(){var t;null==(t=this.xc)||t.previousStep()}clearCache(){var t;this.Cc=null,null==(t=this.Ya)||t.unregister(Ar)}resetTour(t){var i;null==(i=this.xc)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.xc)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.xc)||i.cancelPendingTour(t)}}},ou),du={siteApps:class{constructor(t){this._instance=t,this.Mc=0,this.Ic=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ec(t,i){if(i){var e=this.globalsForEvent(i);this.Ic.push(e),this.Ic.length>1e3&&(this.Ic=this.Ic.slice(10))}}get siteAppLoaders(){var t;return null==(t=b._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Ec.bind(this));this.Rc=()=>{t(),this.Ic=[],this.Rc=void 0}}}globalsForEvent(t){var i,n,o,a,l,h,u;if(!t)throw new Error("Event payload is required");var d={},v=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var f of Object.entries(c)){var p=f[0];d[p]={id:v[p],type:p,properties:f[1]}}var _=t.$set_once,g=t.$set;return{event:s({},r(t,e),{properties:s({},t.properties,g?{$set:s({},null!==(i=null==(n=t.properties)?void 0:n.$set)&&void 0!==i?i:{},g)}:{},_?{$set_once:s({},null!==(o=null==(a=t.properties)?void 0:a.$set_once)&&void 0!==o?o:{},_)}:{}),elements_chain:null!==(l=null==(h=t.properties)?void 0:h.$elements_chain)&&void 0!==l?l:"",distinct_id:null==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:d}}Ac(t){var i,e=null==(i=t.tagName)?void 0:i.toLowerCase();return"style"===e&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Sh.error("prepare_external_dependency_stylesheet returned null"),null):"script"===e&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Sh.error("prepare_external_dependency_script returned null"),null):t}Pc(){var t,i,e,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==u?void 0:u.defaultView,h=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!h)return()=>{};if(this.Mc++,this.Fc)return this.Oc();var d=[],v=this,c=new WeakSet,f=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),d.push(()=>{t[i]=r})}},p=t=>{if(c.has(t))return t;var i=v.Ac(t);return i&&c.add(i),i},_=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!H(t));return f(h,"appendChild",t=>function(i){var e=p(i);return e?t.call(this,e):i}),f(h,"insertBefore",t=>function(i,e){var r=p(i);return r?t.call(this,r,e):i}),f(h,"replaceChild",t=>function(i,e){var r=p(i);return r?t.call(this,r,e):e}),[null==(i=l.Element)?void 0:i.prototype,null==(e=l.Document)?void 0:e.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach(t=>{f(t,"append",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,_(e))}),f(t,"prepend",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,_(e))})}),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach(t=>{f(t,"before",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,_(e))}),f(t,"after",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,_(e))}),f(t,"replaceWith",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=_(e);return e.length&&!s.length?void 0:t.apply(this,s)})}),f(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",t=>function(i,e){var r=p(e);return r?t.call(this,i,r):null}),this.Fc=()=>{d.forEach(t=>t()),this.Fc=void 0},this.Oc()}Oc(){var t=!1;return()=>{var i;t||(t=!0,this.Mc--,0===this.Mc&&(null==(i=this.Fc)||i.call(this)))}}$c(t,i){void 0===i&&(i=!0);var e=this.Pc();try{var r=t(e);return i&&e(),r}catch(t){throw e(),t}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.Ic.length&&(Sh.info("Processing "+this.Ic.length+" events for site app with id "+t.id),this.Ic.forEach(t=>this.$c(()=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null==(e=this.Rc)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,Sh.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.$c(i=>t.init({posthog:this._instance,callback(t){i(),s(t)}}),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){Sh.error(xh+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){Sh.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}Dc(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}Lc(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.$c(()=>null==r.processEvent?void 0:r.processEvent(e))}catch(i){Sh.error("Error while processing event "+t.event+" for site app "+r.id,i)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.Dc(),void this._instance.on("eventCaptured",t=>this.Lc(t))):void Sh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.Rc)||e.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,i=a.id,e=a.url;b["__$$ph_site_app_"+i]=s._instance,null==(t=b.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,t=>{if(t)return Sh.error(xh+i,t)})};for(var a of n.siteApps)o()}else Sh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},vu={tracingHeaders:class{constructor(t){this._instance=t,this.Nc=void 0,this.qc=void 0,this.jc=void 0,this.Yv=()=>{var t,i,e=this.Bc();e?(U(this.Nc)&&(this.Nc=null==(t=b.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),U(this.qc)&&(this.qc=null==(i=b.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.oc()}}initialize(){this.startIfEnabledOrStop()}do(t){var i,e;null!=(i=b.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=b.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return hh.error("failed to load script",i);t()})}Hc(){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}Bc(){var t=this.Hc();return D(t)?(D(this.jc)?this.jc.splice(0,this.jc.length,...t):this.jc=[...t],t.length>0?this.jc:void 0):(D(this.jc)&&this.jc.splice(0),this.jc=t||void 0,this.jc)}oc(){var t,i;null==(t=this.Nc)||t.call(this),null==(i=this.qc)||i.call(this),this.Nc=void 0,this.qc=void 0}startIfEnabledOrStop(){this.Bc()?this.do(this.Yv):this.oc()}}},cu=s({surveys:class extends Th{constructor(t){var i;super(new Ih(t),(i=t,{get projectToken(){return i.config.token},kv:new Ah(i)})),this._instance=t}Yu(t,i){var e=i.query?za(t,i.query):t;return new Promise(t=>{var r;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",e),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})})}}},ou),fu={toolbar:class{constructor(t){this.instance=t}zc(t){b.ph_toolbar_state=t}Uc(){var t;return null!==(t=b.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,i,e){if(void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),Rs(this.instance.config))return!1;if(!a||!u)return!1;t=null!=t?t:a.location,e=null!=e?e:a.history;try{if(!i){try{a.localStorage.setItem("test","test"),a.localStorage.removeItem("test")}catch(t){return!1}i=null==a?void 0:a.localStorage}var r,s=Fh||ho(t.hash,"__posthog")||ho(t.hash,"state"),n=s?xs(()=>JSON.parse(atob(decodeURIComponent(s))))||xs(()=>JSON.parse(decodeURIComponent(s))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(i.getItem(Mh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Wc(t){var i=b.ph_load_toolbar||b.ph_load_editor;!q(i)&&N(i)?i(t,this.instance):Dh.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==u||!u.getElementById("__POSTHOG_TOOLBAR__"));if(!a||i)return!1;var e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=s({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(a.localStorage.setItem(Mh,JSON.stringify(s({},r,{source:void 0}))),2===this.Uc())this.Wc(r);else if(0===this.Uc()){var n;this.zc(1),null==(n=b.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",t=>{if(t)return Dh.error("[Toolbar] Failed to load",t),void this.zc(0);this.zc(2),this.Wc(r)}),Ps(a,"turbolinks:load",()=>{this.zc(0),this.loadToolbar(r)})}return!0}Vc(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},pu=s({experiments:class t{get _n(){return this._instance.config}constructor(i){var e=this;this._instance=i,this.getWebExperimentsAndEvaluateDisplayLogic=function(i){void 0===i&&(i=!1),e.getWebExperiments(i=>{t.Gc("retrieved web experiments from the server"),e.Zc=new Map,i.forEach(i=>{if(i.feature_flag_key){var r;e.Zc&&(t.Gc("setting flag key ",i.feature_flag_key," to web experiment ",i),null==(r=e.Zc)||r.set(i.feature_flag_key,i));var s=e._instance.getFeatureFlag(i.feature_flag_key);B(s)&&i.variants[s]&&e.Jc(i.name,s,i.variants[s].transforms)}else if(i.variants)for(var n in i.variants){var o=i.variants[n];t.Qc(o,e._instance)&&e.Jc(i.name,n,o.transforms)}})},i)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(i){if(this._is_bot())t.Gc(Yh);else if(!this._n.disable_web_experiments){if(q(this.Zc))return this.Zc=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Gc("applying feature flags",i),i.forEach(t=>{var i;if(this.Zc&&null!=(i=this.Zc)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Zc)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Jc(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var i=t.getWindowLocation();if(null!=i&&i.search){var e=ao(null==i?void 0:i.search,"__experiment_id"),r=ao(null==i?void 0:i.search,"__experiment_variant");e&&r&&(t.Gc("previewing web experiments "+e+" && "+r),this.getWebExperiments(t=>{this.Kc(parseInt(e),r,t)},!1,!0))}}loadIfEnabled(){this._n.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this._n.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._n.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Kc(i,e,r){var s=r.filter(t=>t.id===i);s&&s.length>0&&(t.Gc("Previewing web experiment ["+s[0].name+"] with variant ["+e+"]"),this.Jc(s[0].name,e,s[0].variants[e].transforms))}static Qc(i,e){return!q(i.conditions)&&t.Xc(i,e)&&t.Yc(i)}static Xc(i,e){var r;if(q(i.conditions)||q(null==(r=i.conditions)?void 0:r.url))return!0;var s=t.getWindowLocation();if(s){var n,o,a,l=on(e,s.href);return null==(n=i.conditions)||!n.url||Xh[null!==(o=null==(a=i.conditions)?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](i.conditions.url,l)}return!1}static getWindowLocation(){return null==a?void 0:a.location}static Yc(t){var i;if(q(t.conditions)||q(null==(i=t.conditions)?void 0:i.utm))return!0;var e=go();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static Gc(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];Pe.info("[WebExperiments] "+t,e)}Jc(i,e,r){this._is_bot()?t.Gc(Yh):"control"!==e?r.forEach(r=>{var s;r.selector&&(t.Gc("applying transform of variant "+e+" for experiment "+i+" ",r),null==(s=document)||null==(s=s.querySelectorAll(r.selector))||s.forEach(t=>{var i=t;r.html&&(i.innerHTML=r.html),r.css&&i.setAttribute("style",r.css)}))}):t.Gc("Control variants leave the page unmodified.")}_is_bot(){return h&&this._instance?ll(h,this._n.custom_blocked_useragents):void 0}}},ou),_u=s({},ou,au,lu,hu,uu,du,cu,vu,fu,pu,{conversations:class{constructor(t){this._instance=t,this.tf=void 0,this._conversationsManager=null,this.ef=!1,this.zt=null,this.if=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.rf=t.ok,t.ok)){var i=t.config.conversations;q(i)||(G(i)?this.tf=i:(this.tf=i.enabled,this.zt=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.tf=void 0,this.zt=null,this.rf=void 0,this.if=!1}loadIfEnabled(){if(!(this._conversationsManager||this.ef||this._instance.config.disable_conversations||Rs(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==b?void 0:b.__PosthogExtensions__;if(t&&!U(this.tf)&&this.tf)if(this.zt&&this.zt.token){this.ef=!0;try{var i=t.initConversations;if(i)return this.nf(i),void(this.ef=!1);var e=t.loadExternalDependency;if(!e)return void this.sf(hs);e(this._instance,"conversations",i=>{i||!t.initConversations?this.sf("Could not load conversations script",i):this.nf(t.initConversations),this.ef=!1})}catch(t){this.sf("Error initializing conversations",t),this.ef=!1}}else Qh.error("Conversations enabled but missing token in remote config.")}}nf(t){if(this.zt)try{this._conversationsManager=t(this.zt,this._instance),this.if=!1,Qh.info("Conversations loaded successfully")}catch(t){this.sf("Error completing conversations initialization",t)}else Qh.error("Cannot complete initialization: remote config is null")}sf(t,i){Qh.error(t,i),this._conversationsManager=null,this.ef=!1,this.if=!0}show(){this._conversationsManager?this._conversationsManager.show():Qh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.tf&&!H(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Rs(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.rf?"remote_config_failed":U(this.tf)?this.rf?"disabled_in_project":"remote_config_pending":this.tf?q(this.zt)||!this.zt.token?"missing_token":null!=b&&b.__PosthogExtensions__?this.ef?"initializing":this.if?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var r=this;return o(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(Qh.warn(Zh),null)})()}getMessages(t,i){var e=this;return o(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(Qh.warn(Zh),null)})()}markAsRead(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Qh.warn(Zh),null)})()}getTickets(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Qh.warn(Zh),null)})()}requestRestoreLink(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Qh.warn(Zh),null)})()}restoreFromToken(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Qh.warn(Zh),null)})()}restoreFromUrlToken(){var t=this;return o(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Qh.warn(Zh),null)})()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Lu(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Nu(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},{logs:class{constructor(t){var i,e=this;this._instance=t,this.name="logs",this.af=!1,this.lf=!1,this.uf=!1,this.A=Re("[logs]"),this.hf=s({},this.A,{error(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];i.some(nu)||e.A.error(...i)}}),this.Aa=[],this.df=[],this.Td=0,this.Js=!1,this.vf=[],this.cf=[],this.ff=!1,this.pf=!1,this.gf=()=>{var t,i;this.Js||(this.Td=0,null==(t=this.mf)||t.onReconnect(),null==(i=this.yf)||i.onReconnect())},this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.af=!0),a&&Ps(a,"online",this.gf)}bf(t,i,e,r){var s,n=tu(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new Se(this._f(t,i),n,this.hf,()=>this.wf(),t=>t(),void 0,r),n]}kf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.mf||this.Sf!==i){var e;null==(e=this.mf)||e.reset(),this.Sf=i;var r=this.bf(()=>this.Aa,t=>{this.Aa=t});this.mf=r[0],this.xf=r[1]}return this.mf}Cf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.yf||this.Tf!==i){var e;null==(e=this.yf)||e.reset(),this.Tf=i;var r=this.bf(()=>this.df,t=>{this.df=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},eu);this.yf=r[0],this.Mf=r[1]}return this.yf}setup(t){var i;if(!this.Js){this.Hs=t,null!=(i=this._instance)&&null!=(i=i.config)&&null!=(i=i.logs)&&i.captureConsoleLogs&&(this.af=!0),(this.af||this.If()&&this.Ef())&&this.Rf();var e=!1,r=t.onRemoteConfig(t=>{var i;e=t.ok&&!0===(null==(i=t.config.logs)?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)});this.Js?r.dispose():(this.Xs=r,e||this.loadIfEnabled())}}dispose(){var t,i,e,r;this.Js||(this.Js=!0,this.Af(),null==(t=this.Xs)||t.dispose(),this.Xs=void 0,this.Hs=void 0,this.uf=!1,null==a||a.removeEventListener("online",this.gf),null==(i=this.Pf)||i.call(this),this.Pf=void 0,null==(e=this.mf)||e.reset(),null==(r=this.yf)||r.reset())}onRemoteConfig(t){var i,e;if(!this.Js){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;q(r)?this.Ff():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[Ze]:!!r}),r?(this.af=!0,this.lf||this.Rf(),this.loadIfEnabled()):this.Ff())}}reset(){var t,i,e,r;this.Af(),null==(t=this.mf)||t.clearQueue(),this.Aa=[],null==(i=this.mf)||i.reset(),null==(e=this.yf)||e.clearQueue(),this.df=[],null==(r=this.yf)||r.reset(),this.Td=0}captureLog(t){this.Js||this.kf().captureLog(t)}captureConsoleLog(t){this.Js||this.Cf().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.Js||this.Cf().captureLog(t,{context:i,occurredAtMs:e})}Ef(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[Ze])}If(){var t,i;return null==(t=this._instance)||null==t.Ma||!t.Ma()||!(null==(i=b._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])||!i.config)}ju(){var t;this.Af(),null==(t=this.yf)||t.clearQueue(),this.df=[]}Ff(){this.af||this.Af()}Rf(){var t,i=this;if(!this.ff&&null!=b&&b.console){var e=tu(null==(t=this._instance)||null==(t=t.config)?void 0:t.logs).maxBufferSize,r=function(t){var r;try{r=(t=>{for(;null!=(i=t)&&i.__rrweb_original__;){var i;t=t.__rrweb_original__}return t})(b.console[t])}catch(t){return 0}if(!r)return 0;i.cf.push(lh(b.console,t,s=>{var n=function(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];try{i.Of(t,n,e)}catch(t){}return s.apply(b.console,n)};return n.__rrweb_original__=r,n}))};for(var s of iu)r(s);this.ff=!0,this.$f=setTimeout(()=>{this.Af()},3e4)}}Of(t,i,e){var r;if(this.ff&&!this.pf&&0!==i.length)if(null!=(r=this._instance)&&r.is_capturing()){if(e>this.vf.length){this.pf=!0;try{this.vf.push({level:t,args:i,occurredAtMs:Date.now(),context:this.wf()})}finally{this.pf=!1}}}else this.Af()}Af(){if(this.vf=[],this.ff){for(var t of(this.ff=!1,this.$f&&(clearTimeout(this.$f),this.$f=void 0),this.cf))t();this.cf=[]}}Df(){var t=this.vf;return this.Af(),t}get logger(){return this.Lf||(this.Lf={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.Lf}flushLogs(t){t?this.Nf(t):(this.mf&&this.mf.flush().catch(t=>this.qf(t)),this.yf&&this.yf.flush().catch(t=>this.qf(t)))}qf(t){nu(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Js&&this.af&&!this.lf&&!this.uf){var t=null==b?void 0:b.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.Af();var i=t.loadExternalDependency;if(!i)return this.A.error(hs),void this.Af();this.uf=!0;try{i(this._instance,"logs",i=>{if(this.uf=!1,!this.Js&&this.af){var e=t.logs;if(i||null==e||!e.initializeLogs)this.A.error("Could not load logs script",i),this.Af();else{var r,s,n=this.Df();this.Pf=e.initializeLogs(null!==(r=this.Hs)&&void 0!==r?r:this._instance),this.lf=!0,n.length>0&&(null==e.replayConsoleBuffer||e.replayConsoleBuffer(null!==(s=this.Hs)&&void 0!==s?s:this._instance,n))}}})}catch(t){throw this.uf=!1,t}}}_f(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===R.LogsQueue?t():void 0,setPersistedProperty(t,e){t===R.LogsQueue&&i(null!=e?e:[])},gs:t=>this.gs(t),getLibraryId:()=>Me.LIB_NAME,getLibraryVersion:()=>Me.LIB_VERSION}}gs(t){return new Promise(i=>{if(uo(this.Td,3))i({kind:"fatal",error:su(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:su(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.jf(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.Bf(i),i>=200&&300>i)r({kind:"ok"});else if(413===i)r({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)r({kind:"fatal",error:new Error("logs request failed with status "+i)});else{var e;0===i?(t.error||this.A.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:su(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("logs request failed with status "+i)})}}})}})}Bf(t){(0!==t||this._instance.__loaded)&&(this.Td=vo(t,this.Td,3,()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Nf(t){this.Aa.length>0&&this.Hf(t,this.Aa,this.xf,Me.LIB_NAME,t=>{this.Aa=t}),this.df.length>0&&this.Hf(t,this.df,this.Mf,eu,t=>{this.df=t})}Hf(t,i,e,r,s){if(0!==i.length){var n=i.map(t=>t.record);s([]);var o=we(n,ye(e,Me.LIB_NAME,Me.LIB_VERSION),r,Me.LIB_VERSION);this._instance._send_request({method:"POST",url:this.jf(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}jf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}wf(){var t,i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var e=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=e.windowId,s=e.sessionStartTimestamp,n=e.lastActivityTimestamp;i.sessionId=e.sessionId,i.windowId=r,q(s)||(i.sessionStartTimestamp=s),q(n)||(i.lastActivityTimestamp=n)}if(null!=b&&null!=(t=b.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?gi(b.location.href):b.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(i.activeFeatureFlags=o)}return i}}},{metrics:class{constructor(t){this._instance=t,this.A=Re("[metrics]")}initialize(){}kf(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.mf&&this.Sf===e||(null==(i=this.mf)||i.reset(),this.Sf=e,this.mf=new $e(this._f(),function(t){var i,e,r,s,n,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!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(e),this.A)),this.mf}count(t,i,e){void 0===i&&(i=1),this.kf().count(t,i,e)}gauge(t,i,e){this.kf().gauge(t,i,e)}histogram(t,i,e){this.kf().histogram(t,i,e)}flush(t){if(!this.mf)return Promise.resolve();if(t){var i=this.mf.drainWindow();return i&&this.Fs(i,t),Promise.resolve()}return this.mf.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var t;null==(t=this.mf)||t.reset()}_f(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Fs:t=>i.Fs(t),getLibraryId:()=>Me.LIB_NAME,getLibraryVersion:()=>Me.LIB_VERSION}}Fs(t,i){return new Promise(e=>{var r=!1,n=t=>{r||(r=!0,clearTimeout(o),e(t))},o=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(s({method:"POST",url:this.zf(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i},{fireCallbackOnDrop:!0,callback(t){var i,e=t.statusCode;n(e>=200&&300>e?{kind:"ok"}:413===e?{kind:"too-large"}:0!==e&&408!==e&&429!==e&&500>e?{kind:"fatal",error:new Error("metrics request failed with status "+e)}:{kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("metrics request failed with status "+e)})}}))})}zf(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}});Yl.__defaultExtensionClasses=s({},_u);var gu=function(){Me.SDK_DIST_CHANNEL="npm";var t=Il[Hl]=new Yl;return function(){function t(){t.done||(t.done=!0,ql=!1,ys(Il,function(t){t._dom_loaded()}))}null!=u&&u.addEventListener?"complete"===u.readyState?t():Ps(u,"DOMContentLoaded",t,{capture:!1}):a&&Pe.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}(),mu=gu;export{Lo as Compression,Xo as DEFAULT_PRODUCT_TOUR_APPEARANCE,Jo as DisplaySurveyType,Yl as PostHog,Qo as ProductTourEventName,Zo as ProductTourEventProperties,Go as SurveyEventName,Ko as SurveyEventProperties,jo as SurveyEventType,Bo as SurveyPosition,Vo as SurveyQuestionBranchingType,qo as SurveyQuestionType,Wo as SurveySchedule,zo as SurveyTabPosition,Ho as SurveyType,Uo as SurveyWidgetType,mu as default,gu as posthog,sa as severityLevels};
|
|
1
|
+
var t,i=["retriesPerformedSoFar"],e=["$set_once","$set"];function r(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}function s(){return s=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},s.apply(null,arguments)}function n(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function o(t){return function(){var i=this,e=arguments;return new Promise(function(r,s){var o=t.apply(i,e);function a(t){n(o,r,s,a,l,"next",t)}function l(t){n(o,r,s,a,l,"throw",t)}a(void 0)})}}var a="u">typeof window?window:void 0,l="u">typeof globalThis?globalThis:a,h=null==l?void 0:l.navigator,u=null==l?void 0:l.document,d=null==l?void 0:l.location,v=null==l?void 0:l.fetch,c=null!=l&&l.XMLHttpRequest&&"withCredentials"in new l.XMLHttpRequest?l.XMLHttpRequest:void 0,f=null==l?void 0:l.AbortController,p=null==l?void 0:l.CompressionStream,_=null==h?void 0:h.userAgent;function g(){return!(!a||!1===a.navigator.onLine)}var m="undefined"!=typeof globalThis?globalThis:a;m&&"undefined"==typeof self&&(m.self=m),m&&"undefined"==typeof File&&(m.File=function(){});var b=null!=a?a:{},y="0.8.2",w={DEBUG:!1,LIB_VERSION:y,LIB_NAME:"browser-common",JS_SDK_VERSION:y},S=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],x=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return S.concat(i).some(t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)})};function E(t,i){return-1!==t.indexOf(i)}var k=function(t){return t.trim()},T=function(t){return t.replace(/^\$/,"")};function P(t){var i,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"}var R=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.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),C=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),O=["$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"],A=["token"],I=Object.prototype,F=I.hasOwnProperty,M=I.toString,D=Array.isArray||function(t){return"[object Array]"===M.call(t)},N=t=>"function"==typeof t,L=t=>t===Object(t)&&!D(t),j=t=>{if(L(t)){for(var i in t)if(F.call(t,i))return!1;return!0}return!1},U=t=>void 0===t,B=t=>"[object String]"==M.call(t),z=t=>B(t)&&0===t.trim().length,H=t=>null===t,q=t=>U(t)||H(t),V=t=>"[object Number]"==M.call(t)&&t==t,W=t=>V(t)&&t>0,G=t=>"[object Boolean]"===M.call(t),K=t=>E(O,t),J=t=>E(A,t);function Y(t){return null===t||"object"!=typeof t}function X(t,i){return{}.toString.call(t)==="[object "+i+"]"}function Q(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 tt(t,Error)}}function Z(t){return"u">typeof Event&&tt(t,Event)}function tt(t,i){try{return t instanceof i}catch(t){return!1}}var it=[!0,"true",1,"1","yes"],et=t=>E(it,t),rt=[!1,"false",0,"0","no"];function st(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),V(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),st(null!=s?s:e,i,e,r))}var nt=class{constructor(t){this.C={},this.I=t.I,this.R=st(t.bucketSize,0,100,t.A),this.O=st(t.refillRate,0,this.R,t.A),this.F=st(t.refillInterval,0,864e5,t.A)}N(t,i){var e=Math.floor((i-t.lastAccess)/this.F);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.R),t.lastAccess=t.lastAccess+e*this.F)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.C[r];return s?this.N(s,e):this.C[r]=s={tokens:this.R,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.I)||i.call(this,t)),0===s.tokens)}stop(){this.C={}}},ot="Mobile",at="Android",lt="Tablet",ht="Android Tablet",ut="iPad",dt="Apple Watch",vt="Safari",ct="BlackBerry",ft="Samsung Internet",pt="Chrome",_t="Chrome iOS",gt="Internet Explorer",mt="Internet Explorer Mobile",bt="Opera",yt="Microsoft Edge",wt="Firefox",St="Firefox iOS",xt="Nintendo",Et="PlayStation",kt="Xbox",$t="Android Mobile",Tt="Mobile Safari",Pt="Windows",Rt="Windows Phone",Ct="Nokia",Ot="Ouya",At="Generic "+ot.toLowerCase(),It="Generic "+lt.toLowerCase(),Ft="Konqueror",Mt="Oculus Browser",Dt="Vivaldi",Nt="Yandex",Lt="Whale",jt="DuckDuckGo",Ut="Pale Moon",Bt="Waterfox",zt="Brave",Ht="Claude",qt="Codex",Vt="ChatGPT",Wt="Google Search App",Gt=new RegExp("Version/(\\d+(\\.\\d+)?)"),Kt=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Jt=new RegExp(kt,"i"),Yt=new RegExp("PlayStation \\w+","i"),Xt=new RegExp("Nintendo \\w+","i"),Qt=new RegExp("BlackBerry|PlayBook|BB10","i"),Zt={"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"},ti=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?zt:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&E(t,"GSA/")?Wt:E(t," OPR/")&&E(t,"Mini")?"Opera Mini":E(t," OPR/")?bt:Qt.test(t)?ct:E(t,"IEMobile")||E(t,"WPDesktop")?mt:E(t,"OculusBrowser")?Mt:E(t,"SamsungBrowser")?ft:E(t,"Edge")||E(t,"Edg/")?yt:E(t,"Vivaldi/")?Dt:E(t,"YaBrowser/")?Nt:E(t,"Whale/")?Lt:E(t,"DuckDuckGo/")||E(t,"Ddg/")?jt:E(t,"Claude/")?Ht:E(t,"Codex/")?qt:E(t,"ChatGPT/")?Vt:E(t,"FBIOS")?"Facebook Mobile":E(t,"UCWEB")||E(t,"UCBrowser")?"UC Browser":E(t,"CriOS")?_t:E(t,"CrMo")||E(t,pt)?pt:E(t,at)&&E(t,vt)?$t:E(t,"FxiOS")?St:E(t.toLowerCase(),Ft.toLowerCase())?Ft:E(t,"Brave/")?zt:((t,i)=>i&&E(i,"Apple")||function(t){return E(t,vt)&&!E(t,pt)&&!E(t,at)}(t))(t,i)?E(t,ot)?Tt:vt:E(t,"PaleMoon/")?Ut:E(t,"Waterfox/")?Bt:E(t,wt)?wt:E(t,"MSIE")||E(t,"Trident/")?gt:E(t,"Gecko")?wt:"")},ii={[mt]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[yt]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[pt]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[_t]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[vt]:[Gt],[Tt]:[Gt],[bt]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[wt]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[St]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Ft]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[ct]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Gt],[$t]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ft]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Mt]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Dt]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Nt]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Lt]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[zt]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ht]:[Kt],[qt]:[Kt],[Vt]:[Kt],[jt]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ut]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Bt]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Wt]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[gt]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},ei=function(t,i,e,r){var s=ii[ti(t,i,e,r)];if(U(s))return null;for(var n=0;s.length>n;n++){var o=t.match(s[n]);if(o)return parseFloat(o[o.length-2])}return null},ri=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[kt,t&&t[1]||""]],[new RegExp(xt,"i"),[xt,""]],[new RegExp(Et,"i"),[Et,""]],[Qt,[ct,""]],[new RegExp(Pt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Rt,""];if(new RegExp(ot).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Zt[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[Pt,r]}return[Pt,""]}],[/((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=>{var i="";return t&&t.length>=3&&(i=U(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[at,[t[2],t[3],t[4]||"0"].join(".")]:[at,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],si=function(t){for(var i=0;ri.length>i;i++){var e=ri[i],r=e[1],s=e[0].exec(t),n=s&&(N(r)?r(s,t):r);if(n)return n}return["",""]},ni=function(t){return Xt.test(t)?xt:Yt.test(t)?Et:Jt.test(t)?kt:new RegExp(Ot,"i").test(t)?Ot:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?Rt:/iPad/.test(t)?ut:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?dt:Qt.test(t)?ct:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ct,"i").test(t)?Ct:/(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(ot).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)?at:ht:new RegExp("(pda|Mobile)","i").test(t)?At:new RegExp(lt,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?It:""},oi=/\bFBAV\/(\d+(?:\.\d+)*)/i,ai=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",oi],[/\bFBAN\/EMA\b/i,"Facebook Lite",oi],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",oi],[/\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"]],li="[Truncated]",hi="[Unserializable]";function ui(t){for(var i="",e=0;t.length>e;e++){var r=t.charCodeAt(e);if(55296>r||r>56319)i+=56320>r||r>57343?t[e]:"�";else{var s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}Date,Date;var di,vi,ci,fi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function pi(t,i){return"string"==typeof(e=t)&&fi.test(e)?t:i();var e}function _i(t,i){var e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function gi(t){return t?t.split("#")[0]:t}function mi(t,i){var e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function bi(t,i,e){return yi.apply(this,arguments)}function yi(){return(yi=o(function*(t,i,e){var r;try{return yield Promise.race([t,new Promise((t,s)=>{r=mi(()=>{try{null==e||e(),t()}catch(t){s(t)}},i)})])}finally{clearTimeout(r)}})).apply(this,arguments)}function wi(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return ci&&e.length===vi?ci:(vi=e.length,ci=e.reduce((e,r)=>{di||(di={});var s=di[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a,l=null==(a=n[o])?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,di[r]=[l,h];break}}return e},{}))}}var Si=class{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return o(function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&D(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t})()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),s({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return o(function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e})()}convertToExceptionList(t,i){var e,r,n,o={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,s({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:wi(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return s({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}};function xi(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:!!i&&!i.startsWith("webkit-masked-url://")&&"<anonymous>"!==i};return U(r)||(n.lineno=r),U(s)||(n.colno=s),n}var Ei=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:"?",e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},ki=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,$i=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ti=/\((\S*)(?::(\d+))(?::(\d+))\)/,Pi=(t,i)=>{var e=ki.exec(t);if(e)return xi(i,e[1],"?",+e[2],+e[3]);var r=$i.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=Ti.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=Ei(r[1]||"?",r[2]);return xi(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},Ri=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Ci=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Oi=(t,i)=>{var e=Ri.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=Ci.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||"?",o=Ei(n,s);return xi(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Ai=/\(error: (.*)\)/;var Ii=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=B(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return X(t,"DOMException")}isDOMError(t){return X(t,"DOMError")}},Fi=class{match(t){return Q(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:null==(e=i.syntheticException)?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}},Mi=class{match(t){return!!X(t,"ErrorEvent")&&(null!=t.error||this.Ki(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);var r=i.apply(t.message);return s({},r,{stack:null!==(e=this.Xi(t))&&void 0!==e?e:r.stack,synthetic:!0})}Ki(t){return B(t.message)&&t.message.length>0}Xi(t){var i,e,r=t,s=null!==(i=r.lineno)&&void 0!==i?i:0,n=null!==(e=r.colno)&&void 0!==e?e:0;if(B(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}},Di=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Ni=class{match(t){return"string"==typeof t}coerce(t,i){var e,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(Di);return r&&(i=r[1],e=r[2]),[i,e]}},Li=["fatal","error","warning","log","info","debug"];function ji(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}var Ui=class{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r,s=this.getErrorPropertyFromObject(t);return s?i.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null==(r=i.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Z(t))return t.constructor.name;var i="name"in t?t.name:void 0;return B(i)&&!z(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+ji(t)}isSeverityLevel(t){return B(t)&&!z(t)&&Li.indexOf(t)>=0}getStack(t){try{return B(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:B(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(Q(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},Bi=class{match(t){return Z(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+ji(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}},zi=class{match(t){return Y(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}},Hi=class{match(t){return X(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Z(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return Y(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}},qi="$message",Vi="$timestamp",Wi=new Set([qi,Vi]),Gi={enabled:!0,max_bytes:32768};function Ki(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Gi.enabled,max_bytes:Yi(t.max_bytes,Gi.max_bytes)}:s({},Gi)}var Ji=class{constructor(t){this.$n=[],this.Bn=0,this._n=Ki(t)}setConfig(t){this._n=Ki(t),this.Hn()}add(t){var i=function(t){var i;try{i=P(t)}catch(t){return}try{var e=JSON.parse(i);if(!L(e))return;var r=e,s=r[qi],n=r[Vi];if(!B(s)||0===s.trim().length)return;if(!B(n)&&!V(n))return;return{step:r,json:i}}catch(t){return}}(t);if(i){var e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var i=encodeURIComponent(t),e=0,r=0;i.length>r;r++)"%"===i[r]?(e+=1,r+=2):e+=1;return e}(i.json);e>this._n.max_bytes||(this.$n.push({step:i.step,bytes:e}),this.Bn+=e,this.Hn())}}getAttachable(){return this.$n.map(t=>t.step)}clear(){this.$n=[],this.Bn=0}size(){return this.$n.length}Hn(){for(;this.Bn>this._n.max_bytes&&this.$n.length>0;){var t=this.$n.shift();t&&(this.Bn-=t.bytes)}}};function Yi(t,i){if(!V(t)||1/0===t||-1/0===t)return i;var e=Math.floor(t);return 0>e?i:e}var Xi=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Qi(t){return"string"==typeof t||t}function Zi(t){return"string"==typeof t?t:void 0}var te,ie=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],ee="NativeGzipValidationError",re=t=>t.length>=2&&31===t[0]&&139===t[1],se=(t,i)=>t===C.GZipJS||i===C.GZipJS||"gzip"===i,ne=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),oe=t=>{throw _i(ee,"Native gzip produced invalid output: "+t)},ae=function(){var t=o(function*(t,i){18>t.size&&oe("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());re(e)&&8===e[2]||oe("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(te)return te;te=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;te[t]=i>>>0}return te})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&oe("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&oe("invalid-size")});return function(i,e){return t.apply(this,arguments)}}();function le(){return le=o(function*(t,i,e){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),a=n.write(r).then(()=>n.close()).catch(function(){var t=o(function*(t){try{yield n.abort(t)}catch(t){}throw t});return function(i){return t.apply(this,arguments)}}()),l=new Response(s.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield ae(h,r),h}catch(t){if(null!=e&&e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}}),le.apply(this,arguments)}var he={}.propertyIsEnumerable;function ue(t,i){try{return ce(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function de(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:li};if(e.remainingNodes--,G(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){var e=t.toString(),r=BigInt("9223372036854775808");return t>=r||-r>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)};var s=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==i||i.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:ui(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(r>=20)return{stringValue:li};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?ui(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return de(a.call(t),i,e,r+1)}catch(t){}return D(t)?{arrayValue:{values:ve(t,i,e,r+1)}}:{kvlistValue:{values:ce(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:ui(String(t))}}function ve(t,i,e,r){for(var s=[],n=Math.min(t.length,1e3),o=0;n>o&&e.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(q(a))continue;s.push(de(a,i,e,r))}catch(t){s.push({stringValue:hi})}return t.length>o&&s.push({stringValue:li}),s}function ce(t,i,e,r){var s=[];for(var n in t)if(he.call(t,n)){if(!n){null==i||i.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(H(o)||U(o))continue;s.push({key:ui(n),value:de(o,i,e,r)})}catch(t){s.push({key:ui(n),value:{stringValue:hi}})}}return s}function fe(t,i,e){return s({},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})}var pe={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var _e={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},ge=_e.info;function me(t){try{return ui(String(t))}catch(t){return hi}}function be(t,i,e,r){var n,o=_e[t.level||"info"]||ge,a=o.text,l=o.number,h=(void 0===(n=V(r)?r:void 0)&&(n=Date.now()),String(n)+"000000"),u={};i.distinctId&&(u.posthogDistinctId=i.distinctId),i.sessionId&&(u.sessionId=i.sessionId),i.windowId&&(u["window.id"]=i.windowId),q(i.sessionStartTimestamp)||(u.sessionStartTimestamp=String(i.sessionStartTimestamp)),q(i.lastActivityTimestamp)||(u.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(u["url.full"]=i.currentUrl),i.screenName&&(u["screen.name"]=i.screenName),i.appState&&(u["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(u.feature_flags=i.activeFeatureFlags);var d=s({},u),v=t.attributes;if(v){var c=[];try{c=Object.keys(v)}catch(t){c=[]}for(var f of c){var p=void 0;try{p=v[f]}catch(t){p=hi}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var _={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:me(t.body)},attributes:ue(d,e)};return t.trace_id&&(_.traceId=t.trace_id),t.span_id&&(_.spanId=t.span_id),U(t.trace_flags)||(_.flags=t.trace_flags),_}function ye(t,i,e){return fe(t,i,e)}function we(t,i,e,r){return{resourceLogs:[{resource:{attributes:ue(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}var Se=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this._n=i,this.A=e,this.zn=r,this.Un=s,this.Wn=n,this.Vn=o,this.Gn=null,this.Zn=0,this.Jn=0,this.Qn=0,this.Kn=0,this.Xn=0,this.Yn=!1,this.ts=i.maxBufferSize,this.es=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.rs=i.flushIntervalMs,this.ns=i.maxBatchRecordsPerPost,this.ss=i.rateCapWindowMs,this.ls=i.maxLogsPerInterval}clearQueue(){this.Jn++,this._instance.setPersistedProperty(R.LogsQueue,[])}reset(){this.us(),this.Kn=0,this.Xn=0,this.Yn=!1,this.Qn=0,this.ns=this._n.maxBatchRecordsPerPost}onReconnect(){this.Qn=0,this.hs()}captureLog(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.ds(t);if(null!==r)if(r.body){if(this.vs()){var s={record:be(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.zn(),this.A,null==i?void 0:i.occurredAtMs)};this.Un(()=>this.cs(s))}}else this.A.info("Log was rejected in beforeSend function")}}ds(t){var i=this._n.beforeSend;if(!i)return t;var e=D(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for log:",t),null}return r}vs(){if(void 0===this.ls)return!0;var t=Date.now(),i=t-this.Kn;return this.ss>i&&i>=0||(this.Kn=t,this.Xn=0,this.Yn=!1),this.ls>this.Xn?(this.Xn++,!0):(this.Yn||(this.A.warn("captureLog dropping logs: exceeded "+this.ls+" logs per "+this.ss+"ms"),this.Yn=!0),!1)}flush(){var t=this;return o(function*(){if(!t._instance.isDisabled)return t.Gn||(t.Gn=t.fs().finally(()=>{t.Gn=null})),t.Gn})()}fs(){var t=this;return o(function*(){var i;t.us();var e=null!==(i=t._instance.getPersistedProperty(R.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var r=e.length,s=0;e.length>0&&r>s;){var n,o,a=t.Jn;t.Zn=0;var l=Math.min(e.length,t.ns),h=e.slice(0,l),u=we(h.map(t=>t.record),t.ps(),null!==(n=t.Vn)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.gs(u);if(t.Jn!==a)return;if("too-large"===d.kind&&h.length>1)t.ns=Math.max(1,Math.floor(h.length/2)),t.A.warn("Received 413 when sending logs batch of size "+h.length+", reducing batch size to "+t.ns);else{if("retry-later"===d.kind)throw d.error;if("too-large"===d.kind?t.A.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===d.kind&&t._n.maxBatchRecordsPerPost>t.ns&&(t.ns=Math.min(t._n.maxBatchRecordsPerPost,t.ns+1)),yield t.ys(h.length),e=null!==(o=t._instance.getPersistedProperty(R.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}})()}ys(t){var i=this;return o(function*(){var e,r=Math.max(0,t-i.Zn),s=null!==(e=i._instance.getPersistedProperty(R.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(R.LogsQueue,s.slice(r)),yield i.Wn()})()}ps(){return ye(this._n,this._instance.getLibraryId(),this._instance.getLibraryVersion())}cs(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(R.LogsQueue))&&void 0!==i?i:[];this.es>e.length||(e.shift(),this.Zn++,this.A.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(R.LogsQueue,e),this.ts>e.length?this.bs():this.hs()}}bs(t){void 0===t&&(t=this.rs),this._s||(this._s=mi(()=>{this._s=void 0,this.hs()},t))}ws(){var t=Math.min(Math.max(0,this.Qn-1),6);return this.rs*Math.pow(2,t)}ks(){var t=this._instance.getPersistedProperty(R.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return o(function*(){i.us();var e=i.flush().catch(()=>{});void 0!==t?yield bi(e,t):yield e})()}flushWithTimeout(t){var i=this;return o(function*(){var e=i.flush();yield bi(e,t,()=>{e.catch(()=>{})})})()}hs(){this.flush().then(()=>{this.Qn=0},t=>{this.Qn++,this.A.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.ks()&&this.bs(this.ws())})}us(){this._s&&(clearTimeout(this._s),this._s=void 0)}},xe=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Ee(t){return String(t)+"000000"}function ke(t,i,e,r){var s="";return r&&(s=Object.keys(r).sort().map(t=>JSON.stringify(t)+":"+JSON.stringify(r[t])).join(",")),t+"\0"+i+"\0"+(null!=e?e:"")+"\0"+s}var $e=class{constructor(t,i,e){this._instance=t,this._n=i,this.A=e,this.Ss=new Map,this.Gn=null,this.xs=!1,this.Cs=new Map,this.Ts=new Set,this.Ms=0}count(t,i,e){void 0===i&&(i=1),this.Is({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.Is({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.Is({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,i=this.Gn,e=function(){var e=o(function*(){i&&(yield i.catch(()=>{})),yield t.Es()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.Gn===e&&(this.Gn=null)});return this.Gn=e,e}drainWindow(){if(0===this.Ss.size)return null;var t=this.Ss;return this.Ss=new Map,this.xs=!1,this.Cs=new Map,this.Ts=new Set,this.Rs(t)}reset(){this.Ms++,this.us(),this.Ss=new Map,this.Gn=null,this.xs=!1,this.Cs=new Map,this.Ts=new Set}Is(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.ds(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.A.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var e,r;try{e=i.attributes?s({},i.attributes):void 0,r=ke(i.type,i.name,i.unit,e)}catch(t){return void this.A.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var n=this.Ss.get(r);if(!n){if(!this.As())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Ss.set(r,n)}var o=this.Cs.get(i.name);void 0===o?this.Cs.set(i.name,i.type):o===i.type||this.Ts.has(i.name)||(this.Ts.add(i.name),this.A.warn("Metric name '"+i.name+"' is already used as a "+o+"; recording it as a "+i.type+" too will blend both series in charts. Use a distinct name.")),this.Ps(n,i.value),this.bs()}else this.A.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}As(){return this._n.maxSeriesPerFlush>this.Ss.size||(this.xs||(this.xs=!0,this.A.warn("Metric series cap reached ("+this._n.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Ps(t,i){var e;switch(t.type){case"count":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(xe.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=i,r.min=Math.min(r.min,i),r.max=Math.max(r.max,i),r.bucketCounts[function(t,i){for(var e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,xe)]+=1}}ds(t){var i=this._n.beforeSend;if(!i)return t;var e=D(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.A.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.A.error("Error in beforeSend function for metric:",t),null}return r}bs(){this._s||(this._s=mi(()=>{this._s=void 0,this.flush().catch(t=>{this.A.error("Metrics flush failed:",t)})},this._n.flushIntervalMs))}us(){this._s&&(clearTimeout(this._s),this._s=void 0)}Es(){var t=this;return o(function*(){if(0!==t.Ss.size){var i=t.Ss;t.Ss=new Map,t.xs=!1,t.Cs=new Map,t.Ts=new Set;var e=t.Ms,r=yield t._instance.Fs(t.Rs(i));if(e===t.Ms)switch(r.kind){case"ok":return;case"retry-later":return t.Os(i),void t.bs();case"too-large":return void t.A.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.A.error("Failed to send metrics batch:",r.error)}}})()}Rs(t){return i=this.$s(t),e=function(t,i,e){return fe(t,i,e)}(this._n,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ue(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}$s(t){var i=Ee(Date.now()),e=new Map;for(var r of t.values()){var n,o=ke(r.type,r.name,r.unit,void 0),a=e.get(o);a||(a=s({name:r.name},r.unit&&{unit:r.unit}),"count"===r.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===r.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},e.set(o,a));var l=ue(null!==(n=r.attributes)&&void 0!==n?n:{},this.A),h=Ee(r.windowStartMs);if("count"===r.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:i,asDouble:null!==(u=r.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===r.type){var v,c={attributes:l,timeUnixNano:i,asDouble:null!==(v=r.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else r.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:i,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:xe})}return Array.from(e.values())}Os(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.Ss.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(i=o.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.As()&&this.Ss.set(s,n)}}},Te=function(t,i){var e=(void 0===i?{}:i).debugEnabled,r={q(i){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;r>n;n++)s[n-1]=arguments[n];a&&(w.DEBUG||a.POSTHOG_DEBUG||e)&&!U(a.console)&&a.console&&("__rrweb_original__"in a.console[i]?a.console[i].__rrweb_original__:a.console[i])(t,...s)},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.q("error",...i)},critical(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];console.error(t,...e)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(i,e)=>Te(t+" "+i,e)};return r},Pe=Te("[PostHog.js]"),Re=Pe.createLogger,Ce=Re("[ExternalScriptsLoader]"),Oe=t=>{var i=null==u?void 0:u.querySelectorAll("script");if(i)for(var e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},Ae=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Ce.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=Oe(i);if(r){if(r.__posthog_loading_callback_fired)return e();var s=r.__posthog_loading_error;return s?e(s):(r.addEventListener("load",t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)}),void r.addEventListener("error",t=>{r.__posthog_loading_error=t,e(t)}))}var n=()=>{if(!u)return e("document not found");if(Oe(i))return Ae(t,i,e);var r=u.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)u.head.appendChild(r);else{var s,n=u.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):u.body.appendChild(r)}};null!=u&&u.body?n():null==u||u.addEventListener("DOMContentLoaded",n)},Ie={},Fe=(t,i)=>{var e="/static/"+i+".js?v="+t.version;if("toolbar"===i){var r=3e5;e=e+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",e)};b.__PosthogExtensions__=b.__PosthogExtensions__||{},b.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"!==i){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+i+".js"),n=Ie[s];if("fallback"===r&&n){if(Oe(n))return void Ae(t,n,e);delete Ie[s]}Ae(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)e(r);else{var o,a=Fe(t,i);Ie[s]=a;var l=Oe(s);null==l||null==(o=l.parentNode)||o.removeChild(l),Ae(t,a,e)}else e(void 0,n)}:e)}else Ae(t,Fe(t,i),e)}else Ae(t,t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js"),e)},b.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{Ae(t,t.requestRouter.endpointFor("api",i),e)},w.DEBUG=!1,w.LIB_VERSION="1.428.2",w.LIB_NAME="web";var Me=w,De="$people_distinct_id",Ne="distinct_id",Le="$device_id",je="$device_model",Ue="__alias",Be="__cmpns",ze="$fbc",He="$fbc_persistence",qe="__timers",Ve="$autocapture_disabled_server_side",We="$heatmaps_enabled_server_side",Ge="$exception_capture_enabled_server_side",Ke="$error_tracking_suppression_rules",Je="$error_tracking_capture_extension_exceptions",Ye="$web_vitals_enabled_server_side",Xe="$dead_clicks_enabled_server_side",Qe="$product_tours_enabled_server_side",Ze="$logs_capture_enabled_server_side",tr="$web_vitals_allowed_metrics",ir="$session_recording_remote_config",er="$session_recording_enabled_server_side",rr="$replay_sample_rate",sr="$replay_override_sampling",nr="$replay_override_linked_flag",or="$replay_override_url_trigger",ar="$replay_override_event_trigger",lr="$sesid",hr="$session_is_sampled",ur="$session_past_minimum_duration",dr="$session_recording_url_trigger_activated_session",vr="$session_recording_event_trigger_activated_session",cr="$debug_first_full_snapshot_timestamp",fr="$sess_rec_flush_size",pr="$enabled_feature_flags",_r="$active_feature_flags",gr="$early_access_features",mr="$feature_flag_details",br="$feature_flag_payloads",yr="$feature_flag_request_id",wr="$minimal_flag_called_events",Sr="$override_feature_flags",xr="$override_feature_flag_payloads",Er="$stored_person_properties",kr="$stored_group_properties",$r="$groups",Tr="$surveys",Pr="$surveys_loaded_at",Rr="$surveys_activated",Cr="$surveys_activated_session",Or="$surveys_activated_timestamps",Ar="ph_product_tours",Ir="$product_tours_activated",Fr="$product_tours_activated_session",Mr="$conversations_widget_session_id",Dr="$conversations_ticket_id",Nr="$conversations_widget_state",Lr="$conversations_user_traits",jr="$flag_call_reported",Ur="$flag_call_reported_session_id",Br="$feature_flag_errors",zr="$feature_flag_evaluated_at",Hr="$user_state",qr="$client_session_props",Vr="$capture_rate_limit",Wr="$initial_campaign_params",Gr="$initial_referrer_info",Kr="$initial_person_info",Jr="$epp",Yr="$posthog_cookieless",Xr="$cookieless_mode",Qr="$sdk_debug_extensions_init_method",Zr="$sdk_debug_extensions_init_time_ms",ts="$sdk_debug_recording_script_not_loaded",is="$sdk_debug_replay_event_trigger_status",es="$sdk_debug_replay_linked_flag_trigger_status",rs="$sdk_debug_replay_matched_recording_trigger_groups",ss="$sdk_debug_replay_pending_trigger_conditions",ns="$sdk_debug_replay_remote_trigger_matching_config",os="$sdk_debug_replay_trigger_groups_count",as="$sdk_debug_replay_url_trigger_status",ls="$session_recording_start_reason",hs="PostHog loadExternalDependency extension not found.",us="anonymous",ds="identified",vs="identified_only",cs="visibilitychange",fs="beforeunload",ps="$pageview",_s="$pageleave",gs="$identify",ms="$groupidentify";function bs(t,i){D(t)&&t.forEach(i)}function ys(t,i){if(!q(t))if(D(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(var e in t)F.call(t,e)&&i(t[e],e)}var ws=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function Ss(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var xs=function(t){try{return t()}catch(t){return}},Es=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){Pe.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Pe.critical(t)}}},ks=function(t){var i={};return ys(t,function(t,e){(B(t)&&t.length>0||V(t))&&(i[e]=t)}),i};function $s(t){var i=s({},t);for(var e of["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e])}catch(t){}return i}var Ts=["herokuapp.com","vercel.app","netlify.app"];function Ps(t){var i=null==t?void 0:t.hostname;if(!B(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of Ts)if(e===r)return!1;return!0}function Rs(t,i,e,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(i,e,{capture:void 0!==n&&n,passive:void 0===o||o})}function Cs(t){return"ph_toolbar_internal"===t.name}var Os=t=>{if(u){try{for(var i=t+"=",e=u.cookie.split(";").filter(t=>t.length),r=0;e.length>r;r++){for(var s=e[r];" "==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}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return V(t)&&isFinite(t)&&Math.floor(t)===t});var As=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(i,e,r,s){if(!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||!Number.isInteger(s)||0>i||0>e||0>r||0>s||i>0xffffffffffff||e>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=i/Math.pow(2,40),n[1]=i/Math.pow(2,32),n[2]=i/Math.pow(2,24),n[3]=i/Math.pow(2,16),n[4]=i/256,n[5]=i,n[6]=112|e>>>8,n[7]=e,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new t(n)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}},Is=class{generate(){var t=this.generateOrAbort();if(!U(t))return t;this.ri=0;var i=this.generateOrAbort();if(U(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t,i=(t=Date.now(),V(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0);if(i>this.ri)this.ri=i,this.ii();else{if(this.ri>=i+1e4)return;this.ni++,this.ni>4398046511103&&(this.ri++,this.ii())}return As.fromFieldsV7(this.ri,Math.trunc(this.ni/Math.pow(2,30)),this.ni&Math.pow(2,30)-1,this.oi.nextUint32())}ii(){this.ni=1024*this.oi.nextUint32()+(1023&this.oi.nextUint32())}constructor(){this.ri=0,this.ni=0,this.oi=new Ds}},Fs=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};a&&!U(a.crypto)&&crypto.getRandomValues&&(Fs=t=>crypto.getRandomValues(t));var Ms,Ds=class{nextUint32(){return this.Pe.length>this.ai||(Fs(this.Pe),this.ai=0),this.Pe[this.ai++]}constructor(){this.Pe=new Uint32Array(8),this.ai=1/0}},Ns=()=>Ls().toString(),Ls=()=>(Ms||(Ms=new Is)).generate(),js="",Us=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Bs=null,zs={si(){if(!H(Bs))return Bs;if(Bs=!1,u)try{var t="__ph_cookie_support_"+Ns();zs.ui(t,"xyz"),Bs='"xyz"'===Os(t),zs.hi(t)}catch(t){Bs=!1}return Bs},ci(t){Pe.error("cookieStore error: "+t)},li:Os,di(t){var i;try{i=JSON.parse(zs.li(t))||{}}catch(t){}return i},ui(t,i,e,r,s){if(!u)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=u),js)return js;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Ns();!js&&r--;){var n=e.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";i.cookie=o+";max-age=3",i.cookie.includes(s)&&(i.cookie=o+";max-age=0",js=n)}return js}(t);if(!e){var r=(t=>{var i=t.match(Us);return i?i[0]:""})(t);r!==e&&Pe.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(u.location.hostname,r);if(e){var l=new Date;l.setTime(l.getTime()+864e5*e),n="; expires="+l.toUTCString()}s&&(o="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+a+o;return h.length>3686.4&&Pe.warn("cookieStore warning: large cookie, len="+h.length),u.cookie=h,!0}catch(t){return!1}},hi(t,i){if(null!=u&&u.cookie)try{zs.ui(t,"",-1,i)}catch(t){return}}},Hs=null,qs={si(){if(!H(Hs))return Hs;var t=!0;if(U(a))t=!1;else try{var i="__mplssupport__";qs.ui(i,"xyz"),'"xyz"'!==qs.li(i)&&(t=!1),qs.hi(i)}catch(i){t=!1}return t||Pe.error("localStorage unsupported; falling back to cookie store"),Hs=t,t},ci(t){Pe.error("localStorage error: "+t)},li(t){try{return null==a?void 0:a.localStorage.getItem(t)}catch(t){qs.ci(t)}return null},di(t){try{return JSON.parse(qs.li(t))||{}}catch(t){}return null},ui(t,i){try{return null==a||a.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){qs.ci(t)}return!1},hi(t){try{null==a||a.localStorage.removeItem(t)}catch(t){qs.ci(t)}}},Vs=[Er,_r,pr,mr,br,yr,zr,Br,jr],Ws=[Le,Ne,lr,hr,Jr,Kr,He,Hr],Gs=t=>t+"_cpm",Ks=["__proto__","constructor","prototype"],Js=t=>{if(!L(t))return{};var i={};return Object.keys(t).forEach(e=>{-1===Ks.indexOf(e)&&(i[e]=t[e])}),i},Ys=function(t,i){void 0===i&&(i=[]);var e={};return[...Ws,...i].forEach(i=>{var r=t[i];U(r)||H(r)||""===r||(e[i]=r)}),e},Xs=t=>{for(var i=5381,e=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);i=33*i^s,e=Math.imul(e^s,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},Qs=(t,i)=>({p:i,f:Xs(JSON.stringify(t))}),Zs=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=zs.di(Gs(t)),r=(null==e?void 0:e.f)===Xs(i)&&D(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},tn=(t,i)=>i+"|"+(zs.li(Gs(t))||""),en={},rn={si:()=>!0,ci(t){Pe.error("memoryStorage error: "+t)},li:t=>t in en?en[t]:null,di:t=>t in en?en[t]:null,ui:(t,i)=>(en[t]=i,!0),hi(t){delete en[t]}},sn=null,nn={si(){if(!H(sn))return sn;if(sn=!0,U(a))sn=!1;else try{var t="__support__";nn.ui(t,"xyz"),'"xyz"'!==nn.li(t)&&(sn=!1),nn.hi(t)}catch(t){sn=!1}return sn},ci(t){Pe.error("sessionStorage error: ",t)},li(t){try{return null==a?void 0:a.sessionStorage.getItem(t)}catch(t){nn.ci(t)}return null},di(t){try{return JSON.parse(nn.li(t))||null}catch(t){}return null},ui(t,i){try{return null==a||a.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){nn.ci(t)}return!1},hi(t){try{null==a||a.sessionStorage.removeItem(t)}catch(t){nn.ci(t)}}},on=class{constructor(t){this._instance=t}get _n(){return this._instance.config}get consent(){return this.so()?0:this.oo}isOptedOut(){return"always"===this._n.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this._n.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this._n.opt_out_capturing_by_default}optInOut(t){this.ao.ui(this.lo,t?1:0,this._n.cookie_expiration,this._n.cross_subdomain_cookie,this._n.secure_cookie)}reset(){this.ao.hi(this.lo,this._n.cross_subdomain_cookie)}get lo(){var t=this._instance.config,i=t.token,e=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(e?e+i:"__ph_opt_in_out_"+i)}get oo(){var t=this.ao.li(this.lo);return et(t)?1:E(rt,t)?0:-1}get ao(){var t=this._n.opt_out_capturing_persistence_type,i="localStorage"===t?qs:zs,e=i.si()?i:rn;if(!this.uo||this.uo!==e){this.uo=e;var r="localStorage"===t?zs:qs;r.li(this.lo)&&(this.uo.li(this.lo)||this.optInOut(et(r.li(this.lo))),r.hi(this.lo,this._n.cross_subdomain_cookie))}return this.uo}so(){return!!this._n.respect_dnt&&[null==h?void 0:h.doNotTrack,null==h?void 0:h.msDoNotTrack,b.doNotTrack,null==h?void 0:h.globalPrivacyControl].some(t=>et(t))}};function an(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!N(r))return i;try{var s=r(i);return B(s)&&s?s:i}catch(t){return Pe.error("Error in get_current_url, falling back to window.location.href",t),i}}function ln(t){return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function hn(t){return!!t&&1===t.nodeType}function un(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function dn(t){return!!t&&3===t.nodeType}function vn(t){return!!t&&11===t.nodeType&&hn(t.host)}function cn(t){return t?k(t).split(/\s+/):[]}function fn(t,i){var e=function(t){var i,e=null==a||null==(i=a.location)?void 0:i.href;return U(e)?void 0:an(t,e)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function pn(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return cn(i)}function _n(t){return q(t)?null:k(t).split(/(\s+)/).filter(t=>Bn(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function gn(t){var i="";return An(t)&&!In(t)&&t.childNodes&&t.childNodes.length&&ys(t.childNodes,function(t){var e;dn(t)&&t.textContent&&(i+=null!==(e=_n(t.textContent))&&void 0!==e?e:"")}),k(i)}function mn(t){var i;return U(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var bn=["a","button","form","input","select","textarea","label"];function yn(t,i){var 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 wn(t,i){if(U(i))return!0;var e,r=function(t){if(i.some(i=>yn(t,i)))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function Sn(t){var i=t.parentNode;return!(!i||!hn(i))&&i}var xn=[".ph-no-autocapture","[data-ph-no-autocapture]"],En=["next","previous","prev",">","<"],kn=[...En,"+","-","−","–"],$n=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,Tn=[".ph-no-rageclick",".ph-no-capture"],Pn=["","text","search","email","password","url","tel","number"];function Rn(t,i){if(!a||Cn(t))return!1;var e,r,s,n,o;if(G(i)?(e=!!i&&Tn,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:Tn,r=null==i?void 0:i.content_ignorelist,s=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(s&&function(t){return!(!t||!hn(t))&&(!!un(t,"textarea")||(un(t,"input")?E(Pn,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var i=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===i||""===i}(t)))}(t))return!1;var l=On(t,!1).targetElementList;return!function(t,i){if(!1===t||U(t))return!1;var e;if(!0===t)e=En;else{if(!D(t))return!1;if(t.length>10)return Pe.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map(t=>t.toLowerCase())}return i.some(t=>{var i=t.safeText,r=t.ariaLabel;return e.some(t=>$n(i,t)||$n(r,t))})}(r,l.map(t=>{var i;return{safeText:gn(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}}))&&!wn(l,e)}var Cn=t=>!t||un(t,"html")||!hn(t),On=(t,i)=>{if(!a||Cn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!un(s,"body");)if(vn(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Sn(s);if(!n)break;if(i||bn.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var o=a.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function An(t){for(var i=new Set,e=0,r=t;r.parentNode&&!un(r,"body");r=r.parentNode){if(e++>=1e3||i.has(r))return!1;i.add(r);var s=pn(r);if(E(s,"ph-sensitive")||E(s,"ph-no-capture"))return!1}if(E(pn(t),"ph-include"))return!0;var n=t.type||"";if(B(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!B(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function In(t){return!!(un(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||un(t,"select")||un(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Fn=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}))$"),Mn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Dn=[16,15,14,13],Nn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Ln=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),jn=/[0-9A-Za-z_]/;function Un(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function Bn(t,i){if(void 0===i&&(i=!0),q(t))return!1;if(B(t)){if(t=k(t),i?Fn.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(Mn.lastIndex=0;i=Mn.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of Dn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(Fn.test(a)&&Un(a))return!0}}}return!1}(t))return!1;if(i?Nn.test(t):function(t){var i;for(Ln.lastIndex=0;i=Ln.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&jn.test(e)&&jn.test(r)))return!0}return!1}(t))return!1}return!0}function zn(t){var i=gn(t);return Bn(i=(i+" "+Hn(t)).trim())?i:""}function Hn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&ys(t.childNodes,function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=gn(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Hn(t)).trim())}catch(t){Pe.error("[AutoCapture]",t)}}),i}function qn(t){return t.replace(/"|\\"/g,'\\"')}function Vn(t){var i=t.attr__class;if(i)return D(i)?i:cn(i)}var Wn=Re("[Dead Clicks]"),Gn=()=>!0,Kn=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Xe)),r=t.instance.config.capture_dead_clicks;return G(r)?r:!!L(r)||e},Jn=class{get lazyLoadedDeadClicksAutocapture(){return this.ho}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[Xe]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.do(()=>{this.vo()}):this.stop()}do(t){var i,e;null!=(i=b.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=b.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?Wn.error("failed to load script",i):t()})}vo(){var t;if(u){if(!this.ho&&null!=(t=b.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=L(this.instance.config.capture_dead_clicks)?s({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.ho=b.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.ho.start(u),Wn.info("starting...")}}else Wn.error("`document` not found. Cannot start.")}stop(){this.ho&&(this.ho.stop(),this.ho=void 0,Wn.info("stopping..."))}},Yn=Re("[SegmentIntegration]");function Xn(t,i,e){void 0===e&&(e=!0);var r=t.config.segment;if(!r)return i();!function(t,i,e){var r=t.config.segment;if(!r)return i();var s=r=>{var s=()=>r.anonymousId()||Ns();t.config.get_device_id=s,e&&r.id()&&(t.register({distinct_id:r.id(),$device_id:s()}),t.persistence.set_property(Hr,ds)),i(e?void 0:r.anonymousId()||void 0)},n=r.user();"then"in n&&N(n.then)?n.then(s):s(n)}(t,e=>{r.register(((t,i)=>{"undefined"!=typeof Promise&&Promise.resolve||Yn.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,r)=>{if(!r)return e;var s=!!i&&e.event.anonymousId===i&&!e.event.userId;s||e.event.userId||e.event.anonymousId===t.get_distinct_id()||(Yn.info("No userId set, resetting PostHog"),t.reset()),s||(i=void 0),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Yn.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var n=t.calculateEventProperties(r,e.event.properties);return e.event.properties=Object.assign({},n,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return e(t,t.event.event)},page(t){return e(t,ps)},identify(t){return e(t,gs)},screen(t){return e(t,"$screen")}}})(t,e)).then(()=>{i()},t=>{Yn.error("Failed to register the Segment integration",t),i()})},e)}var Qn="posthog-js";function Zn(t,i){var e=void 0===i?{}:i,r=e.organization,n=e.projectId,o=e.prefix,a=e.severityAllowList,l=void 0===a?["error"]:a,h=e.sendExceptionsToPostHog,u=void 0===h||h;return i=>{var e,a,h,d,v,c;if("*"!==l&&!l.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var f=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=f,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p=(null==(e=i.exception)?void 0:e.values)||[],_=p.map(t=>s({},t,{stacktrace:t.stacktrace?s({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>s({},t,{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null==(a=p[0])?void 0:a.value)||i.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:i.level,$exception_list:_,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||i.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:i.tags};return r&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+n+"&query="+i.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),i}}var to=class{constructor(t,i,e,r,s,n){this.name=Qn,this.setupOnce=function(o){o(Zn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},io=class{constructor(t){this.co=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Pe.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.fo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.po()}po(){var t;this.mo=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.co)}destroy(){var t;null==(t=this.mo)||t.call(this),this.mo=void 0}doPageView(t,i){var e,r=this.yo(t,i);return this.fo={pathname:null!==(e=null==a?void 0:a.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.yo(t,null==(i=this.fo)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.fo)?void 0:t.pageViewId}}yo(t,i){var e=this.fo;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(U(n)||U(o)||U(a)||U(l)||U(h)||U(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?st(o/n,0,1,Pe):1,v=n>1?st(a/n,0,1,Pe):1,c=l>1?st(h/l,0,1,Pe):1,f=l>1?st(u/l,0,1,Pe):1;r=ws(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}},eo=["flags","surveys"],ro={[De]:{exposure:"hidden"},[Ue]:{exposure:"hidden"},[Be]:{exposure:"hidden"},[qe]:{exposure:"hidden"},[He]:{exposure:"hidden"},[Ve]:{exposure:"event"},[We]:{exposure:"hidden"},[Ze]:{exposure:"hidden"},[Ge]:{exposure:"event"},[Ke]:{exposure:"hidden"},[Je]:{exposure:"event"},[Ye]:{exposure:"event"},[Xe]:{exposure:"event"},[Qe]:{exposure:"hidden"},[tr]:{exposure:"event"},[ir]:{exposure:"hidden"},[er]:{exposure:"hidden"},[lr]:{exposure:"hidden"},[hr]:{exposure:"event"},[rr]:{exposure:"event",shouldSkipFromEventProperties:t=>H(t)},[ur]:{exposure:"event"},[dr]:{exposure:"event"},[vr]:{exposure:"event"},[cr]:{exposure:"event"},[fr]:{exposure:"hidden"},[pr]:{exposure:"hidden",storageGroup:"flags"},[_r]:{exposure:"hidden",storageGroup:"flags"},[gr]:{exposure:"hidden"},[mr]:{exposure:"hidden",storageGroup:"flags"},[br]:{exposure:"hidden",storageGroup:"flags"},[yr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[wr]:{exposure:"hidden",storageGroup:"flags"},[Sr]:{exposure:"hidden"},[xr]:{exposure:"hidden"},[Er]:{exposure:"hidden"},[kr]:{exposure:"hidden"},[Tr]:{exposure:"hidden",storageGroup:"surveys"},[Pr]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Rr]:{exposure:"event"},[Cr]:{exposure:"hidden"},[Or]:{exposure:"hidden"},[Ar]:{exposure:"hidden"},[Ir]:{exposure:"hidden"},[Fr]:{exposure:"hidden"},[Mr]:{exposure:"event"},[Dr]:{exposure:"event"},[Nr]:{exposure:"event"},[Lr]:{exposure:"event"},[jr]:{exposure:"hidden"},[Ur]:{exposure:"hidden"},[$r]:{exposure:"event"},[Br]:{exposure:"hidden"},[zr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Hr]:{exposure:"hidden"},[qr]:{exposure:"hidden"},[Vr]:{exposure:"hidden"},[Wr]:{exposure:"hidden"},[Gr]:{exposure:"hidden"},[Kr]:{exposure:"hidden"},[Jr]:{exposure:"hidden"},[sr]:{exposure:"event"},[nr]:{exposure:"event"},[or]:{exposure:"event"},[ar]:{exposure:"event"},[Qr]:{exposure:"event"},[Zr]:{exposure:"event"},[ts]:{exposure:"event"},[is]:{exposure:"event"},[es]:{exposure:"event"},[rs]:{exposure:"event"},[ss]:{exposure:"event"},[ns]:{exposure:"event"},[os]:{exposure:"event"},[as]:{exposure:"event"},[ls]:{exposure:"event"}},so=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],no=t=>{var i=ro[t];if(i)return i;for(var e of so){var r=e[1];if(0===t.indexOf(e[0]))return r}},oo=(t,i)=>{try{var e;return JSON.stringify(t,(t,i)=>Q(i)?(null!=e||(e=new WeakMap),e.has(i)||e.set(i,$s(i)),e.get(i)):"bigint"==typeof i?i.toString():i,i)}catch(i){return P(t)}},ao=t=>{var i=null==u?void 0:u.createElement("a");return U(i)?null:(i.href=t,i)},lo=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!D(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Pe.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ho=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");D(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},uo=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},vo=(t,i)=>t>=i&&g(),co=(t,i,e,r)=>{if(0===t){if(g()){var s=i+1;return s===e&&r(),s}return i}return 0},fo=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],po=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...fo],_o="<masked>",go=["li_fat_id"];function mo(t,i,e){if(!u)return{};var r,s=i?[...fo,...e||[]]:[],n=bo(ho(u.URL,s,_o),t);return ws((r={},ys(go,function(t){var i=Os(t);r[t]=i||null}),r),n)}function bo(t,i){var e=po.concat(i||[]),r={};return ys(e,function(i){var e=lo(t,i);r[i]=e||null}),r}function yo(t){var 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",r={};if(!H(i)){r.$search_engine=i;var s=u?lo(u.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function wo(){return navigator.language||navigator.userLanguage}var So="$direct";function xo(){return(null==u?void 0:u.referrer)||So}function Eo(t,i,e){var r;void 0===e&&(e=!1);var s=t?[...fo,...i||[]]:[],n=null==(r=e?gi(null==d?void 0:d.href):null==d?void 0:d.href)?void 0:r.substring(0,1e3);return{r:xo().substring(0,1e3),u:n?ho(n,s,_o):void 0}}function ko(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?gi(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==So?So:null==(e=ao(r))?void 0:e.host};if(n){o.$current_url=n;var a=ao(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,ws(o,bo(n))}return r&&ws(o,yo(r)),o}function $o(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function To(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Po={flags:zr,surveys:Pr},Ro=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Co=t=>t+"_cookie_identity_change_pending",Oo=t=>{var i="",e=0;for(var r of t){var s=encodeURIComponent(JSON.stringify(r).slice(1,-1)).length;if(e+s>1e3)break;i+=r,e+=s}return i},Ao="main",Io=[pr,_r,mr,br,yr,zr,wr,Er],Fo=t=>-1!==Io.indexOf(t),Mo=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},Do=t=>{if(!t)return{};var i=JSON.parse(t);return L(i)?i:{}},No=(t,i)=>{ys(t,(e,r)=>{var s=no(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]})},Lo=class{constructor(t,i,e){if(void 0===e&&(e=!0),this.bo={},this._o=!1,this.wo=!1,this.ko=!1,this.So=!1,this.xo=!1,this.Co=new Map,this.To=!1,this.Mo=!1,this.Io=!1,this.Eo=!1,this.Ro=new Set,this._n=t,this.Ao=e,this.props={},this.Po=void 0,this.Fo=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.ao=this.Oo(t),this.ko=this.$o(t),this.load(),this.Do(),t.debug&&Pe.info("Persistence loaded",t.persistence,s({},this.props)),this.update_config(t,t,i),this.save(),a){var r=()=>this.flush();Rs(a,"beforeunload",r,{capture:!1}),Rs(a,"pagehide",r,{capture:!1}),this.Lo=t=>{if(this._o&&(!t.storageArea||t.storageArea===(null==a?void 0:a.localStorage))&&t.key)if(t.key!==this.Fo){if(this.ko){var i=eo.find(i=>t.key===this.No(i));i&&this.qo(t.key,i)}}else this.qo(t.key,Ao)},Rs(a,"storage",this.Lo)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var i=t[0],e=t[1],r=this.Co.get(i);if(Fo(i)&&!0!==r)if(!0!==e){var s=new Set(r||[]);e.forEach(t=>s.add(t)),s.size&&this.jo(i,s)}else this.jo(i,!0)})}onCrossTabFeatureFlagChange(t){return this.Ro.add(t),()=>this.Ro.delete(t)}destroy(){this.Lo&&a&&(a.removeEventListener("storage",this.Lo),this.Lo=void 0),this.Ro.clear()}qo(t,i,e){if(void 0===e&&(e=!0),this.Bo)return!1;var r,s;try{if(s=qs.li(t),H(s)){var n=this.Ho(i);return n.storageValue=null,i!==Ao&&(n.persisted=!1),!1}r=Do(s)}catch(t){return!1}var o=i===Ao?r:qs.di(this.Fo);if(o&&this.zo(o))return!1;var a=this.Uo(r,i,e);return i===Ao&&this.ko&&!Mo(this.Wo().main,r)||this.Vo(r,i,!0,s),a}zo(t){var i=this.props[Ne],e=t[Ne];return!U(i)&&!U(e)&&i!==e}Vo(t,i,e,r){var s=this.Ho(i);s.storageValue=r,i!==Ao&&(s.persisted=e);try{s.fingerprint=this.Go(t,i)}catch(t){s.fingerprint=void 0}}Uo(t,i,e){var r=!1;return Io.forEach(e=>{var s,n=null==(s=no(e))?void 0:s.storageGroup;if(!(i===Ao&&this.ko&&n||i!==Ao&&n!==i)){var o=e in t,a=this.Zo(e,o?t[e]:void 0),l=this.Co.has(e)?e in this.props:o;l===e in this.props&&Mo(a,this.props[e])||(l?this.Jo(e,a,!1):this.Qo(e,!1),r=!0)}}),r&&e&&this.Ro.forEach(t=>t()),r}Ko(){if(!this._o)return!1;try{this.Io=!1;var t,i=qs.li(this.Fo),e=this.Ho(Ao),r=!1,s=!1;if(i!==e.storageValue)if(H(i))e.storageValue=null;else{if(t=Do(i),this.Io=!this.Mo&&this.zo(t),this.Io)return!1;s=this.Uo(t,Ao,!1),!this.ko||Mo(this.Wo().main,t)?this.Vo(t,Ao,!0,i):e.storageValue=i,r=!0}return this.ko&&eo.forEach(i=>{var e=qs.li(this.No(i)),n=this.Ho(i),o=t||{},a=r&&Io.some(t=>{var e;return(null==(e=no(t))?void 0:e.storageGroup)===i&&t in o});if(e!==n.storageValue||a){if(H(e))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Uo(o,i,!1)||s));var l=Do(e);s=this.Uo(l,i,!1)||s,this.Vo(l,i,!0,e)}}),s}catch(t){return!1}}jo(t,i){this.Co.set(t,i);var e=no(t);null!=e&&e.volatile||(this.Ho((this.ko?null==e?void 0:e.storageGroup:void 0)||Ao).fingerprint=void 0,this.Xo(t))}Yo(){Io.forEach(t=>this.Co.set(t,!0))}Do(){if(this._o)try{var t=qs.li(this.Fo),i=Do(t);this.Ho(Ao).storageValue=t,Io.forEach(t=>{var e,r=this.ko?null==(e=no(t))?void 0:e.storageGroup:void 0,s=r?qs.li(this.No(r)):null;if(r){var n=this.Ho(r);n.storageValue=s,n.persisted=!H(s)}var o=r&&!H(s)?Do(s):i;t in this.props?this.ta(t,o[t],this.props[t]):t in o&&this.jo(t,!0)})}catch(t){}}Zo(t,i){var e=this.Co.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){var r=new Set(D(i)?i:[]),n=new Set(D(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?r.add(t):r.delete(t)),Array.from(r)}var o=L(i)?s({},i):{},a=L(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in a?o[t]=a[t]:delete o[t]}),o}ta(t,i,e){if(Fo(t)){var r=this.Co.get(t);if(!0!==r){var s=i;if(this._o)try{var n,o=this.ko?null==(n=no(t))?void 0:n.storageGroup:void 0,a=o?this.No(o):this.Fo;s=Do(qs.li(a))[t]}catch(t){}var l=new Set(r||[]);if("$active_feature_flags"===t){if(!U(i)&&!D(i)||!U(s)&&!D(s)||!D(e))return void this.jo(t,!0);var h=new Set(i||[]),u=new Set(s||[]),d=new Set(e);new Set([...h,...d]).forEach(t=>{h.has(t)!==d.has(t)&&l.add(t)}),l.forEach(t=>{u.has(t)===d.has(t)&&l.delete(t)})}else{if(!L(e))return void(Mo(s,e)?this.Co.delete(t):this.jo(t,!0));if(!U(i)&&!L(i)||U(i)&&j(e)&&U(s))return void this.jo(t,!0);var v=L(i)?i:{},c=L(s)?s:{};new Set([...Object.keys(v),...Object.keys(e)]).forEach(t=>{t in v==t in e&&Mo(v[t],e[t])||l.add(t)}),l.forEach(t=>{t in c==t in e&&Mo(c[t],e[t])&&l.delete(t)})}l.size?this.jo(t,l):this.Co.delete(t)}}}ea(){var t,i=null==(t=this._n)?void 0:t.persistence_save_debounce_ms;return V(i)&&i>0?i:0}ia(t){if(this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase())if(t)try{var i=Ys(t,this._n.cookie_persisted_properties||[]),e=Qs(i,this._n.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=zs.li(this.Fo)||void 0;s&&tn(this.Fo,s)===r&&(this.ra=r,this.na=s)}catch(t){}else try{var n=zs.li(this.Fo)||void 0;this.ra=n?tn(this.Fo,n):void 0,this.na=n}catch(t){}}syncCookieProperties(){return this.sa(this._n)}sa(t,i){if(void 0===i&&(i=!1),this.Bo&&!i||this.xo||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=zs.li(this.Fo)||void 0}catch(t){}if(!e||e===this.na)return!1;var r,s=tn(this.Fo,e);try{r=Js(JSON.parse(e))}catch(t){return!1}if((zs.li(this.Fo)||void 0)!==e)return!1;this.ra=s,this.na=e;var n=Zs(this.Fo,e),o=[...Ws,...n.properties],a={};if(Object.keys(r).forEach(t=>{var i=r[t];(U(i)||H(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(a[t]=!0,delete r[t])}),j(r))return!1;var l="distinct_id"in r||"anonymous"===r.$user_state||"identified"===r.$user_state,h=this.props,u=h[Ne],d=h[Hr],v=ws({},h);[...Ws,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||"distinct_id"!==t&&"$user_state"!==t)){var i=v[t];(n.isValid||-1===Ws.indexOf(t)||!1!==i&&0!==i)&&delete v[t]}}),this.props=ws(v,r),Io.forEach(t=>{var i=t in this.props;t in h===i&&Mo(h[t],this.props[t])||(i?this.ta(t,h[t],this.props[t]):this.jo(t,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this.Jo(Hr,us);var c=this.props[Ne],f=this.props[Hr];return!l||c===u&&f===d||(this.Mo=!0,this.So=!0,nn.ui(Co(this.Fo),!0),this.Qo(Er),this.Qo(_r),this.Qo(pr),this.Qo(mr),this.Qo(br),this.Qo(yr),this.Qo(zr),this.Qo(Br),this.Qo(jr),"anonymous"!==f||"identified"!==d&&"anonymous"!==r.$user_state&&(U(u)||c===u)||(No(this.props,r),this.Qo(kr)),"identified"===f?this.props.$user_id=c:delete this.props.$user_id,this.Qo(Ue)),!0}consumeCookieIdentityChange(){var t=Co(this.Fo),i=this.So||!!nn.li(t);return this.So=!1,i&&nn.hi(t),i}oa(t){return void 0===t&&(t=!1),!(this.xo||this.Bo&&!t||!this._n.cookieWinsOnConflict||"localstorage+cookie"!==this._n.persistence.toLowerCase()||(this.xo=!0,0))}aa(){this.xo&&(U(this.la)||(clearTimeout(this.la),this.la=void 0),delete this.bo[Ao],this.ua(!0))}ha(t){if(void 0===t&&(t=!0),this.xo)try{t?this.aa():U(this.la)||(clearTimeout(this.la),this.la=void 0)}finally{this.xo=!1}}isDisabled(){return!!this.Bo}Oo(t){-1===Ro.indexOf(t.persistence.toLowerCase())&&(Pe.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i,e=function(t,i){void 0===t&&(t=[]),void 0===i&&(i=!1);var e=[...Ws,...t];return s({},qs,{di(t){try{var r,s={};try{r=zs.li(t)||void 0,s=r?Js(JSON.parse(r)):{}}catch(t){}var n,o=JSON.parse(qs.li(t)||"{}");if(i){var a=Zs(t,r),l=[...Ws,...a.properties],h={};Object.keys(s).forEach(t=>{var i=s[t];H(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(h[t]=i)});var u="distinct_id"in h||"anonymous"===h.$user_state||"identified"===h.$user_state;if(Object.keys(h).length>0){var d,v=o[Ne],c=null!==(d=o.$user_state)&&void 0!==d?d:"anonymous";e.forEach(t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(u||"distinct_id"!==t&&"$user_state"!==t)){var i=o[t];(a.isValid||-1===Ws.indexOf(t)||!1!==i&&0!==i)&&delete o[t]}}),!u||"$user_state"in s||"$user_state"in o||(o[Hr]=us),!u||("distinct_id"in h?h[Ne]:o[Ne])===v&&("$user_state"in h?h[Hr]:o[Hr])===c||(Vs.forEach(t=>delete o[t]),"identified"===h.$user_state&&"distinct_id"in h?o.$user_id=h[Ne]:delete o.$user_id,"identified"!==h.$user_state&&(delete o[$r],delete o[kr]),delete o.__alias)}n=ws(o,h)}else n=ws(s,o);return qs.ui(t,n),n}catch(t){}return null},ui(e,r,s,n,o,a){var l=qs.ui(e,r,void 0,void 0,a);try{var h=Ys(r,t);if(Object.keys(h).length){if(i){var u=Gs(e),d=Qs(h,t);if(zs.ui(u,d,s,n,o,a),zs.li(u)!==JSON.stringify(d)){zs.hi(u,n);var v=Ys(r);return zs.ui(e,v,s,n,o,a),l}}zs.ui(e,h,s,n,o,a)}}catch(t){qs.ci(t)}return l},hi(t,i){try{null==a||a.localStorage.removeItem(t),zs.hi(t,i),zs.hi(Gs(t),i)}catch(t){qs.ci(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),r=!1,n=!1,o=t.persistence.toLowerCase();return"localstorage"===o&&qs.si()?(i=qs,n=!0):"localstorage+cookie"===o&&e.si()?(i=e,n=!0,r=!0):"sessionstorage"===o&&nn.si()?i=nn:"memory"===o?i=rn:"cookie"===o&&zs.si()?(i=zs,r=!0):e.si()?(i=e,n=!0,r=!0):zs.si()?(i=zs,r=!0):i=rn,this._o=n,this.wo=r,i}No(t){return this.Fo+"__"+t}$o(t){return this._o&&!!t.split_storage}properties(){var t={};return ys(this.props,(i,e)=>{var r=no(e);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(i))return;t[e]=i}}),t}load(t){if(void 0===t&&(t=!1),!this.Bo||t){var i=this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase(),e=i?qs.di(this.Fo):null,r={};if(i)try{ys(r=Js(zs.di(this.Fo)),(t,i)=>{(U(t)||H(t)||""===t)&&delete r[i]})}catch(t){}var s=this.ao.di(this.Fo);if(s&&(this.props=ws({},s)),this.ko&&this.da(),i&&s){var n,o,a=null==e?void 0:e[Ne],l=null!==(n=null==e?void 0:e.$user_state)&&void 0!==n?n:"anonymous",h=s[Ne],u=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(h!==a||u!==l){this.So=!0,nn.ui(Co(this.Fo),!0);var d=ws({},this.props);Vs.forEach(t=>delete d[t]),"anonymous"!==u||"identified"!==l&&"anonymous"!==r.$user_state&&(U(a)||h===a)||(No(d,r),delete d[kr]),this.props=d;var v=new Set;Vs.forEach(t=>{var i,e=null==(i=no(t))?void 0:i.storageGroup;e&&v.add(e)}),v.forEach(t=>{var i={};ys(this.props,(e,r)=>{var s;(null==(s=no(r))?void 0:s.storageGroup)===t&&(i[r]=e)}),j(i)?(qs.hi(this.No(t)),this.bo[t]={}):qs.ui(this.No(t),i)&&(this.bo[t]={persisted:!0,fingerprint:this.Go(i,t)})})}}nn.li(Co(this.Fo))&&(this.So=!0)}}da(){for(var t of eo){var i=qs.di(this.No(t));if(i&&!j(i)){var e=this.Ho(t);e.persisted=!0,this.va(t)||(e.fingerprint=this.Go(i,t)),this.ca(t,i)||ws(this.props,i)}}}va(t){return Object.keys(this.props).some(i=>{var e;return(null==(e=no(i))?void 0:e.storageGroup)===t})}ca(t,i){var e=Po[t];if(!e)return!1;var r=i[e],s=this.props[e];return V(r)&&V(s)&&s>r}refreshKey(t){var i;if(!(this.Bo||"$fbc_persistence"===t&&this.Eo)){var e=this.ko?null==(i=no(t))?void 0:i.storageGroup:void 0,r=e?qs.di(this.No(e)):this.ao.di(this.Fo);if(r&&t in r)this.Jo(t,r[t],!1);else{if(e){var s=this.ao.di(this.Fo);if(s&&t in s)return void this.Jo(t,s[t],!1)}this.Qo(t,!1)}}}save(){if(!this.Bo){var t=this.ea();t>0?U(this.la)&&(this.la=setTimeout(()=>{this.la=void 0,this.ua()},t)):this.ua()}}flush(){U(this.la)||(clearTimeout(this.la),this.la=void 0,this.ua())}ua(t){if(void 0===t&&(t=!1),!(this.Bo||this.xo&&!t)){t||(this.syncCookieProperties(),this.Eo||this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase()||this.refreshKey(He));var i=!t&&!this.To;i||(this.Io=!1);var e=!!i&&this.Ko();if(this.Io)this._n.debug&&Pe.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.ko)return this.fa(),void(e&&this.Ro.forEach(t=>t()));var r=this.pa(this.ao,this.Fo,this.props,Ao);"written"===r&&this.ia(this.props),"failed"!==r&&(this.Co.clear(),this.Mo=!1,this.Eo=!1),e&&this.Ro.forEach(t=>t())}}}fa(){var t=this,i=this.Wo(),e=i.main,r=i.groups,s=this.pa(this.ao,this.Fo,e,Ao);"written"===s&&this.ia(e),"failed"!==s&&(this.Mo=!1,this.Eo=!1,Io.forEach(t=>{var i;null!=(i=no(t))&&i.storageGroup||this.Co.delete(t)}));var n=function(i){var e,s=r[i];if(j(s)&&(null==(e=t.bo[i])||!e.persisted))return Io.forEach(e=>{var r;(null==(r=no(e))?void 0:r.storageGroup)===i&&t.Co.delete(e)}),1;var n=t.pa(qs,t.No(i),s,i);"failed"!==n&&Io.forEach(e=>{var r=no(e);(null==r?void 0:r.storageGroup)!==i||"written"!==n&&r.volatile||t.Co.delete(e)})};for(var o of eo)if(n(o))continue}Wo(){var t={},i={flags:{},surveys:{}};return ys(this.props,(e,r)=>{var s,n=null==(s=no(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e}),{main:t,groups:i}}Go(t,i){if(i===Ao)return JSON.stringify(t)+"|"+this.ga+"|"+this.ma+"|"+this.ya;var e={};return ys(t,(t,i)=>{var r;e[i]=null!=(r=no(i))&&r.volatile?"__volatile__":t}),JSON.stringify(e)}pa(t,i,e,r){var s,n=this.Ho(r);if(r!==Ao&&!n.dirty&&!U(n.fingerprint))return"skipped";try{if((s=this.Go(e,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.ui(i,e,this.ga,this.ma,this.ya,this._n.debug)?(n.dirty=!1,r!==Ao&&(n.persisted=!0),U(s)||(n.fingerprint=s),this._o&&(n.storageValue=qs.li(i)),"written"):(this._n.debug&&Pe.warn('failed to persist storage entry "'+i+'"; will retry on next save'),"failed")}remove(t){var i=(void 0===t?{}:t).keepGroupEntries,e=void 0!==i&&i;if(this.Yo(),U(this.la)||(clearTimeout(this.la),this.la=void 0),this.ao.hi(this.Fo,!1),this.ao.hi(this.Fo,!0),!e&&this.Ao)for(var r of eo)qs.hi(this.No(r));e?delete this.bo[Ao]:this.bo={},this.ra=void 0,this.na=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(L(t)){this.syncCookieProperties(),U(i)&&(i="None"),this.ga=U(e)?this.ba:e;var r=!1;if(ys(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.Jo(e,t),r=!0)}),r)return this.save(),!0}return!1}register(t,i){if(L(t)){this.syncCookieProperties(),this.ga=U(i)?this.ba:i;var e=!1;if(ys(t,(i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||L(i)||D(i))&&(this.Jo(r,i),e=!0)}),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var i="string"==typeof t?[t]:t,e=!1;for(var r of i)r in this.props&&(this.Qo(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==u?void 0:u.URL;if(t!==this.Po){var i=mo(this._n.custom_campaign_params,this._n.mask_personal_data_properties,this._n.custom_personal_data_properties),e=!j(ks(i));return e&&this.register(i),this.Po=t,e?i:void 0}}update_search_keyword(){var t;this.register((t=null==u?void 0:u.referrer)?yo(t):{})}update_referrer_info(){var t;this.register_once({$referrer:xo(),$referring_domain:null!=u&&u.referrer&&(null==(t=ao(u.referrer))?void 0:t.host)||So},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=Eo(this._n.mask_personal_data_properties,this._n.custom_personal_data_properties,this._n.disable_capture_url_hashes);this.register_once({[Kr]:this.wo?{r:Oo(t.r),u:t.u?Oo(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};ys([Gr,Wr],i=>{var e=this.props[i];e&&ys(e,function(i,e){t["$initial_"+T(e)]=i})});var i=this.props[Kr];return i&&ws(t,function(t,i){void 0===i&&(i=!1);var e=ko(t,i),r={};return ys(e,function(t,i){r["$initial_"+T(i)]=t}),r}(i,this._n.disable_capture_url_hashes)),t}safe_merge(t){return ys(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){var r=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every((t,i)=>t===r[i])})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),o=r||n,a=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,h=!!this.Bo&&!l;l||this.sa(i,h),this._n=t,!l&&(r||n||a)&&(this.ra=void 0,this.na=void 0,this.sa(s({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),h));var u=o||a?this.Oo(t):this.ao;this._a();var d=this.$o(t),v=o||d!==this.ko,c=!l&&(v||t.cross_subdomain_cookie!==this.ma||t.secure_cookie!==this.ya)&&this.oa(h);this.To=v;try{if(this.ba=this.ga=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),v){var f=this.props;this.clear(),this.ao=u,this.ko=d,this.props=f,this.save()}else a&&(this.ao=u,l||(delete this.bo[Ao],this.ua()))}finally{this.To=!1,c&&this.ha()}}_a(){var t=this.props[Kr];if(this.wo&&L(t)&&"string"==typeof t.r){var i=Oo(t.r),e="string"==typeof t.u?Oo(t.u):t.u;i===t.r&&e===t.u||this.Jo(Kr,s({},t,{r:i,u:e}))}}set_disabled(t){this.Bo=t,this.Bo?this.remove():this.save()}set_cross_subdomain(t){t!==this.ma&&(this.ma=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ya&&(this.ya=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props.__timers||{};e[t]=i,this.Jo(qe,e),this.save()}remove_event_timer(t){var i=this.props.__timers||{},e=i[t];return U(e)||(delete i[t],this.Jo(qe,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.Jo(t,i),this.save()}Jo(t,i,e){var r;void 0===e&&(e=!0);var s=this.props[t];this.props[t]=i,e&&("distinct_id"!==t&&"$user_state"!==t||s===i||(this.Mo=!0),"$fbc_persistence"!==t||Mo(s,i)||(this.Eo=!0),this.ta(t,s,i),null!=(r=no(t))&&r.volatile||this.Xo(t))}Qo(t,i){void 0===i&&(i=!0),delete this.props[t],i&&(Fo(t)&&this.jo(t,!0),"$fbc_persistence"===t&&(this.Eo=!0),this.Xo(t))}Xo(t){var i,e=null==(i=no(t))?void 0:i.storageGroup;e&&(this.Ho(e).dirty=!0)}Ho(t){return this.bo[t]||(this.bo[t]={})}},jo={GZipJS:"gzip-js",Base64:"base64"},Uo={Activation:"events",Cancellation:"cancelEvents"},Bo={Button:"button",Tab:"tab",Selector:"selector"},zo={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},Ho={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},qo={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Vo={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},Wo={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},Go={Once:"once",Recurring:"recurring",Always:"always"},Ko={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Jo={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Yo={Popover:"popover",Inline:"inline"};function Xo(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&N(e.then)&&e.then(void 0,()=>{})}}}}var Qo={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},Zo={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},ta={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ia=Re("[RateLimiter]"),ea=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(t=>{ia.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void ia.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property("$capture_rate_limit"))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(V(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.wa(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Vr,a),{isRateLimited:l,remainingTokens:a.tokens}}ka(t){var i=this.instance.config.property_denylist;return!D(i)||!i.includes(t)}Sa(){var t;if(this.ka("$current_url")&&this.ka("$pathname")&&null!=d&&d.pathname)return""+(null!==(t=d.origin)&&void 0!==t?t:"")+d.pathname}wa(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Sa(),o=this.ka("$session_id")?null==(i=(e=this.instance).get_session_id)?void 0:i.call(e):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}},ra=Re("[RemoteConfig]"),sa=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=b._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}xa(t){var i,e;null!=(i=b.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=b.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Ca(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 ra.info("Using preloaded remote config",this.remoteConfig),void this.Ta(this.remoteConfig);if(this._instance.Ma())return void ra.warn("Remote config is disabled. Falling back to local config.");this.xa(t=>{if(!t)return ra.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ca(t=>{this.Ta(t.json,t)});this.Ta(t)})}catch(t){ra.error("Error loading remote config",t),this.Ta()}}Ta(t,i){!t&&i&&(0===i.statusCode?i.error||ra.warn("Failed to fetch remote config from PostHog."):ra.error("Failed to fetch remote config from PostHog."));try{this._instance.Ta(t?{ok:!0,config:t}:{ok:!1})}catch(t){ra.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)||e.ensureFlagsLoaded()}catch(t){ra.error("Error loading feature flags",t)}}},na=["fatal","error","warning","log","info","debug"],oa=Uint8Array,aa=Uint16Array,la=Uint32Array,ha=new oa([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]),ua=new oa([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]),da=new oa([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),va=function(t,i){for(var e=new aa(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new la(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},ca=va(ha,2),fa=ca[1];ca[0][28]=258,fa[258]=28;for(var pa=va(ua,0)[1],_a=new aa(32768),ga=0;32768>ga;++ga){var ma=(43690&ga)>>>1|(21845&ga)<<1;_a[ga]=((65280&(ma=(61680&(ma=(52428&ma)>>>2|(13107&ma)<<2))>>>4|(3855&ma)<<4))>>>8|(255&ma)<<8)>>>1}var ba=function(t,i,e){for(var r=t.length,s=0,n=new aa(i);r>s;++s)++n[t[s]-1];var o,a=new aa(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new aa(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[_a[d]>>>l]=h}else for(o=new aa(r),s=0;r>s;++s)o[s]=_a[a[t[s]-1]++]>>>15-t[s];return o},ya=new oa(288);for(ga=0;144>ga;++ga)ya[ga]=8;for(ga=144;256>ga;++ga)ya[ga]=9;for(ga=256;280>ga;++ga)ya[ga]=7;for(ga=280;288>ga;++ga)ya[ga]=8;var wa=new oa(32);for(ga=0;32>ga;++ga)wa[ga]=5;var Sa=ba(ya,9,0),xa=ba(wa,5,0),Ea=function(t){return(t/8|0)+(7&t&&1)},ka=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof aa?aa:t instanceof la?la:oa)(e-i);return r.set(t.subarray(i,e)),r},$a=function(t,i,e){var r=i/8|0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},Ta=function(t,i,e){var r=i/8|0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},Pa=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new oa(0),0];if(1==s){var o=new oa(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort(function(t,i){return t.f-i.f}),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[d].f>e[h].f?h++:d++],l=e[h!=u&&e[d].f>e[h].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new aa(v+1),f=Ra(e[u-1],c,0);if(f>i){r=0;var p=0,_=f-i,g=1<<_;for(n.sort(function(t,i){return c[i.s]-c[t.s]||t.f-i.f});s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=g-(1<<f-c[m]),c[m]=i}for(p>>>=_;p>0;){var b=n[r].s;i>c[b]?p-=1<<i-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new oa(c),f]},Ra=function(t,i,e){return-1==t.s?Math.max(Ra(t.l,i,e+1),Ra(t.r,i,e+1)):i[t.s]=e},Ca=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new aa(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},Oa=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},Aa=function(t,i,e){var r=e.length,s=Ea(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=e[n];return 8*(s+4+r)},Ia=function(t,i,e,r,s,n,o,a,l,h,u){$a(i,u++,e),++s[256];for(var d=Pa(s,15),v=d[0],c=d[1],f=Pa(n,15),p=f[0],_=f[1],g=Ca(v),m=g[0],b=g[1],y=Ca(p),w=y[0],S=y[1],x=new aa(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var k=Pa(x,7),T=k[0],P=k[1],R=19;R>4&&!T[da[R-1]];--R);var C,O,A,I,F=h+5<<3,M=Oa(s,ya)+Oa(n,wa)+o,D=Oa(s,v)+Oa(n,p)+o+14+3*R+Oa(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=F&&D>=F)return Aa(i,u,t.subarray(l,l+h));if($a(i,u,1+(M>D)),u+=2,M>D){C=ba(v,c,0),O=v,A=ba(p,_,0),I=p;var N=ba(T,P,0);for($a(i,u,b-257),$a(i,u+5,S-1),$a(i,u+10,R-4),u+=14,E=0;R>E;++E)$a(i,u+3*E,T[da[E]]);u+=3*R;for(var L=[m,w],j=0;2>j;++j){var U=L[j];for(E=0;U.length>E;++E)$a(i,u,N[B=31&U[E]]),u+=T[B],B>15&&($a(i,u,U[E]>>>5&127),u+=U[E]>>>12)}}else C=Sa,O=ya,A=xa,I=wa;for(E=0;a>E;++E)if(r[E]>255){var B;Ta(i,u,C[257+(B=r[E]>>>18&31)]),u+=O[B+257],B>7&&($a(i,u,r[E]>>>23&31),u+=ha[B]);var z=31&r[E];Ta(i,u,A[z]),u+=I[z],z>3&&(Ta(i,u,r[E]>>>5&8191),u+=ua[z])}else Ta(i,u,C[r[E]]),u+=O[r[E]];return Ta(i,u,C[256]),u+O[256]},Fa=new la([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ma=new oa(0),Da=function(){for(var t=new la(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Na=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function La(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=Da[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,h,u=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new oa(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=Aa(l,h,t.subarray(u,d)):(l[u]=n,h=Aa(l,h,t.subarray(u,o)))}else{for(var v=Fa[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,_=new aa(32768),g=new aa(p+1),m=Math.ceil(e/3),b=2*m,y=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<b)&p},w=new la(25e3),S=new aa(288),x=new aa(32),E=0,k=0,T=(u=0,0),P=0,R=0;o>u;++u){var C=y(u),O=32767&u,A=g[C];if(_[O]=A,g[C]=O,u>=P){var I=o-u;if((E>7e3||T>24576)&&I>423){h=Ia(t,l,0,w,S,x,k,T,R,u-R,h),T=E=k=0,R=u;for(var F=0;286>F;++F)S[F]=0;for(F=0;30>F;++F)x[F]=0}var M=2,D=0,N=f,L=O-A&32767;if(I>2&&C==y(u-L))for(var j=Math.min(c,I)-1,U=Math.min(32767,u),B=Math.min(258,I);U>=L&&--N&&O!=A;){if(t[u+M]==t[u+M-L]){for(var z=0;B>z&&t[u+z]==t[u+z-L];++z);if(z>M){if(M=z,D=L,z>j)break;var H=Math.min(L,z-2),q=0;for(F=0;H>F;++F){var V=u-L+F+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,A=V)}}}L+=(O=A)-(A=_[O])+32768&32767}if(D){w[T++]=268435456|fa[M]<<18|pa[D];var G=31&fa[M],K=31&pa[D];k+=ha[G]+ua[K],++S[257+G],++x[K],P=u+M,++E}else w[T++]=t[u],++S[t[u]]}}h=Ia(t,l,n,w,S,x,k,T,R,u-R,h),n||(h=Aa(l,h,Ma))}return ka(a,0,r+Ea(h)+s)}(n=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l,!h)),d=u.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&Na(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(u,i),Na(u,d-8,e.d()),Na(u,d-4,r),u}var ja=!!c||!!v,Ua="text/plain",Ba=!1,za=(t,i)=>{var e=t.split("#"),r=e[1],s=e[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter(t=>t.split("=")[0]!==i).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},Ha=function(t,i,e){var r;void 0===e&&(e=!0);var n=t.split("?"),o=n[0],a=n[1],l=s({},i),h=null!==(r=null==a?void 0:a.split("&").map(t=>{var i,r=t.split("="),s=r[0],n=e&&null!==(i=l[s])&&void 0!==i?i:r[1];return delete l[s],s+"="+n}))&&void 0!==r?r:[],u=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return ys(t,function(t,i){U(t)||U(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)}),s.join(i)}(l);return u&&h.push(u),h.length>0?o+"?"+h.join("&"):o},qa=t=>{if(t.Ia)return t.Ia;var i=t.data,e=t.compression;if(i){if(e===jo.GZipJS){var r=La(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new oa(t.length+(t.length>>>1)),r=0,s=function(t){e[r++]=t},n=0;i>n;++n){if(r+5>e.length){var o=new oa(r+8+(i-n<<1));o.set(e),e=o}var a=t.charCodeAt(n);128>a?s(a):2048>a?(s(192|a>>>6),s(128|63&a)):a>55295&&57344>a?(s(240|(a=65536+(1047552&a)|1023&t.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return ka(e,0,r)}(oo(i)),{mtime:0});return{contentType:Ua,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===jo.Base64){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:oo(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(oo(i)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=oo(i);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Va=t=>{var i,e,r=()=>"sendBeacon"===t.transport?{url:Ha(t.url,{compression:jo.Base64}),encodedBody:qa(s({},t,{compression:jo.Base64,Ia:void 0}))}:{url:za(t.url,"compression"),encodedBody:qa(s({},t,{compression:void 0,Ia:void 0}))};try{i=qa(t)}catch(i){if(se(t.compression,lo(t.url,"compression")))return Pe.error("Failed to gzip request body, sending uncompressed payload",i),r();throw i}return i&&se(t.compression,lo(t.url,"compression"))&&!((e=i.body)instanceof ArrayBuffer?re(new Uint8Array(e)):ArrayBuffer.isView(e)&&re(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?(Ba=!0,r()):{url:t.url,encodedBody:i}},Wa=t=>{try{return Va(t)}catch(i){return Pe.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},Ga=function(){var t=o(function*(t){var i=yield function(t,i,e){return le.apply(this,arguments)}(oo(t.data),Me.DEBUG,{rethrow:!0});if(!i)return t;var e=yield i.arrayBuffer();return s({},t,{Ia:{contentType:Ua,body:e,estimatedSize:e.byteLength}})});return function(i){return t.apply(this,arguments)}}(),Ka=/Failed to fetch|NetworkError|Load failed/i,Ja=t=>"TypeError"===(null==t?void 0:t.name)&&Ka.test((null==t?void 0:t.message)||""),Ya=t=>{var i=Wa(t);if(i){var e=i.url,r=i.encodedBody,n=null!=r?r:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;ys(t.headers,function(t,i){h.append(i,t)}),o&&h.append("Content-Type",o);var u=null,d=!1;if(f){var c=new f;u={signal:c.signal,timeout:setTimeout(()=>{var i;d=!0,c.abort(_i("AbortError","PostHog request timed out"+((i=t.timeout)?" after "+i+"ms":"")))},t.timeout)}}var p=i=>{d&&"AbortError"===(null==i?void 0:i.name)||Ja(i)?Pe.warn(i):Pe.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var _;v(e,s({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.Ea&&52428.8>(l||0),body:a,signal:null==(_=u)?void 0:_.signal},t.fetchOptions)).then(i=>i.text().then(e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){Pe.error(t)}null==t.callback||t.callback(r)})).catch(p).finally(()=>u?clearTimeout(u.timeout):null)}catch(t){u&&clearTimeout(u.timeout),p(t)}}},Xa=t=>{try{var i,e=Va(t),r=e.url,n=e.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(h.sendBeacon(r,u))return;var d=D(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(D(d)&&d.length>1&&(null!=l?l:0)>16384){var v=Math.ceil(d.length/2),c=i=>D(t.data)?i:s({},t.data,{batch:i});return Xa(s({},t,{data:c(d.slice(0,v))})),void Xa(s({},t,{data:c(d.slice(v))}))}Pe.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),Ya(s({},t,{Ea:!0}))}catch(t){Pe.warn("Beacon send failed",t)}},Qa=(t,i,e,r)=>{var n="query"===r?"POST"===i?"sent_at":"_":void 0;return Ha(e===jo.GZipJS?za(t,"compression"):t,s({},n?{[n]:Date.now().toString()}:{},e===jo.GZipJS?{}:{compression:e}))},Za=[];v&&Za.push({transport:"fetch",method:Ya}),c&&Za.push({transport:"XHR",method(t){var i=Wa(t);if(i){var e=new c,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;ys(t.headers,function(t,i){e.setRequestHeader(i,t)}),n&&e.setRequestHeader("Content-Type",n),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(o)}}}),null!=h&&h.sendBeacon&&Za.push({transport:"sendBeacon",method:Xa});var tl=class{constructor(t,i){this.Ra=!0,this.Aa=[],this.Pa=st((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,Pe.createLogger("flush interval"),3e3),this.Fa=t}enqueue(t){this.Aa.push(t),this.Oa||this.$a()}unload(){this.Da();var t=this.Aa.length>0?this.La():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.Na(s({},t,{transport:"sendBeacon"}))})}enable(){this.Ra=!1,this.$a()}$a(){var t=this;this.Ra||(this.Oa=setTimeout(()=>{if(this.Da(),this.Aa.length>0){var i=this.La(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&D(e.data)&&ys(e.data,t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp}),t.Na(e)};for(var r in i)e()}},this.Pa))}Na(t){try{this.Fa(t)}catch(t){Pe.error(t)}}Da(){clearTimeout(this.Oa),this.Oa=void 0}La(){var t={};return ys(this.Aa,i=>{var e,r=i,n=(r?r.batchKey:null)||r.url;U(t[n])&&(t[n]=s({},r,{data:[]})),null==(e=t[n].data)||e.push(r.data)}),this.Aa=[],t}},il=class{constructor(t){this._instance=t,this.qa=!1,this.ja=3e3,this.Aa=[],this.Aa=[],this.Ba=!0,!U(a)&&"onLine"in a.navigator&&(this.Ba=a.navigator.onLine,this.Ha=()=>{this.Ba=!0,this.za()},this.Ua=()=>{this.Ba=!1},Rs(a,"online",this.Ha),Rs(a,"offline",this.Ua))}get length(){return this.Aa.length}retriableRequest(t){var e=t.retriesPerformedSoFar,n=r(t,i);W(e)&&(n.url=Ha(n.url,{retry_count:e})),this._instance._send_request(s({},n,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.cs(s({retriesPerformedSoFar:e},n));0===t.statusCode&&Pe.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.callback||n.callback(t)}}))}cs(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=(Math.random()-.5)*(r-e);return Math.ceil(r+s)}(i),r=Date.now()+e;this.Aa.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Pe.warn(s),this.qa||(this.qa=!0,this.Wa())}Wa(){if(this.Va&&clearTimeout(this.Va),0===this.Aa.length)return this.qa=!1,void(this.Va=void 0);this.Va=setTimeout(()=>{this.Ba&&this.Aa.length>0&&this.za(),this.Wa()},this.ja)}za(){var t=Date.now(),i=[],e=this.Aa.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.Aa=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.Va&&(clearTimeout(this.Va),this.Va=void 0),this.qa=!1,U(a)||(this.Ha&&(a.removeEventListener("online",this.Ha),this.Ha=void 0),this.Ua&&(a.removeEventListener("offline",this.Ua),this.Ua=void 0)),this.Aa)){var i=t.requestOptions;try{this._instance._send_request(s({},i,{transport:"sendBeacon"}))}catch(t){Pe.error(t)}}this.Aa=[]}},el=class{constructor(t){this._instance=t,this.Ga=()=>{var t,i,e,r;this.Za||(this.Za={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Za.lastScrollY=Math.ceil(n),this.Za.maxScrollY=Math.max(n,null!==(t=this.Za.maxScrollY)&&void 0!==t?t:0),this.Za.maxScrollHeight=Math.max(o,null!==(i=this.Za.maxScrollHeight)&&void 0!==i?i:0),this.Za.lastContentY=a,this.Za.maxContentY=Math.max(a,null!==(e=this.Za.maxContentY)&&void 0!==e?e:0),this.Za.maxContentHeight=Math.max(l,null!==(r=this.Za.maxContentHeight)&&void 0!==r?r:0)}}get Ja(){return this._instance.config.scroll_root_selector}getContext(){return this.Za}resetContext(){var t=this.Za;return setTimeout(this.Ga,0),t}startMeasuringScrollPosition(){Rs(a,"scroll",this.Ga,{capture:!0}),Rs(a,"scrollend",this.Ga,{capture:!0}),Rs(a,"resize",this.Ga)}scrollElement(){var t;if(!this.Ja)return null==a||null==(t=a.document)?void 0:t.documentElement;for(var i of D(this.Ja)?this.Ja:[this.Ja]){var e,r=null==a||null==(e=a.document)?void 0:e.querySelector(i);if(r)return r}}Qa(t){var i,e,r="y"===t?"scrollTop":"scrollLeft";if(this.Ja){var s=this.scrollElement();return s&&s[r]||0}return a?"y"===t?a.scrollY||a.pageYOffset||(null==(i=a.document)||null==(i=i.documentElement)?void 0:i.scrollTop)||0:a.scrollX||a.pageXOffset||(null==(e=a.document)||null==(e=e.documentElement)?void 0:e.scrollLeft)||0:0}scrollY(){return this.Qa("y")}scrollX(){return this.Qa("x")}},rl=t=>Eo(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),sl=class{constructor(t,i,e,r){this.Te=t=>{var i=this.Ka();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Xa(this._instance)};this.Ya.register({[qr]:e})}},this._instance=t,this.tl=i,this.Ya=e,this.Xa=r||rl,this.tl.onSessionId(this.Te)}Ka(){return this.Ya.props[qr]}getSetOnceProps(){var t,i=null==(t=this.Ka())?void 0:t.props;return i?"r"in i?ko(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(){var t={};return ys(ks(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+T(e)]=i}),t}},nl=class{on(t,i){return this.el[t]||(this.el[t]=[]),this.el[t].push(i),()=>{this.el[t]=this.el[t].filter(t=>t!==i)}}emit(t,i){for(var e of this.el[t]||[])e(i);for(var r of this.el["*"]||[])r(t,i)}constructor(){this.el={}}},ol=Re("[SessionId]"),al=864e5,ll=class{on(t,i){return this.il.on(t,i)}constructor(t,i,e){var r;if(this.rl=null,this.nl=null,this.sl=[],this.ol=void 0,this.al=!1,this.il=new nl,this.ll=(t,i)=>!(!W(t)||!W(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._n=t.config,this.Ya=t.persistence,this.Ie=void 0,this.Bt=void 0,this._sessionStartTimestamp=null,this.ul=void 0,this._sessionActivityTimestamp=null,this.hl=i||Ns,this.dl=e||Ns;var s=this._n.persistence_name||this._n.token;if(this._sessionTimeoutMs=1e3*st(this._n.session_idle_timeout_seconds||1800,60,36e3,ol.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.vl(),this.cl="ph_"+s+"_window_id",this.fl="ph_"+s+"_primary_window_exists",this.pl()){var n=nn.di(this.cl),o=nn.di(this.fl);n&&!o?this.Ie=n:nn.hi(this.cl),nn.ui(this.fl,!0)}null!=(r=this._n.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this._n.bootstrap.sessionID),this.gl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return U(this.sl)&&(this.sl=[]),this.sl.push(t),this.Bt&&t(this.Bt,this.Ie),()=>{this.sl=this.sl.filter(i=>i!==t)}}pl(){return"memory"!==this._n.persistence&&!this.Ya.Bo&&nn.si()}ml(t){t!==this.Ie&&(this.Ie=t,this.pl()&&nn.ui(this.cl,t))}yl(){return this.Ie?this.Ie:this.pl()?nn.di(this.cl):null}bl(t){var i=this.rl;return!H(i)&&!H(t)&&5e3>Math.abs(t-i)}_l(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this.Bt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Bt=t,s&&!r||s&&this.bl(i)||(this.rl=i,this.Ya.register({[lr]:[i,t,e]}))}wl(){var t,i=null==(t=this._n)?void 0:t.persistence_save_debounce_ms;return W(i)&&i>0}kl(){this.wl()?this.Ya.refreshKey(lr):(this.Ya.flush(),this.Ya.load())}Sl(){var t;if(!H(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.rl){this.kl();var i=this.xl();i[1]===this.Bt&&i[2]===this._sessionStartTimestamp&&(this.rl=this._sessionActivityTimestamp,this.Ya.register({[lr]:[this._sessionActivityTimestamp,null!==(t=this.Bt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ya.flush())}}Cl(){var t=this.xl()[0],i=W(t)?t:0,e=W(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Tl(t){return this.kl(),this.ll(t,this.Cl())}xl(){var t=this.Ya.props[lr];return D(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.rl=null,this.ul=void 0,clearTimeout(this.Ml),this.Ml=void 0,this._l(null,null,null)}setBootstrapSessionId(t,i){void 0===i&&(i=!1);var e=function(t,i){void 0===i&&(i=(new Date).getTime());try{var e=(t=>{var 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 ol.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void ol.error("Invalid sessionID in bootstrap",t)}}(t);return!U(e)&&(i?this.ul={sessionId:t,sessionStartTimestamp:e}:this._l(t,(new Date).getTime(),e),!0)}destroy(){this.al=!0,this.Sl(),clearTimeout(this.Ml),this.Ml=void 0,this.ol&&a&&(a.removeEventListener(fs,this.ol,{capture:!1}),this.ol=void 0),this.sl=[]}gl(){this.ol=()=>{this.Sl(),this.pl()&&nn.hi(this.fl)},Rs(a,fs,this.ol,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),"always"===this._n.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this.Bt;if(e)this.nl=r;else if(H(this.nl)||this.nl>r||r-this.nl>=1e3){var n,o;null==(n=(o=this.Ya).syncCookieProperties)||n.call(o),this.nl=r}var a=this.xl(),l=a[1],h=a[2],u=!U(s)&&l!==s,d=this.Cl(),v=this.yl(),c=this.ul,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>al),p=c?f:W(h)&&Math.abs(r-h)>al,_=!1,g=u,m=!l||!!c,b=l,y=!m&&!t&&this.ll(r,d);if(y){(y=this.Tl(r))||ol.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.xl();l=w[1],h=w[2]}if(m||y||p){g=!1;var S=c&&!f;l=S?c.sessionId:this.hl(),v=this.dl(),ol.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!S,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),h=S?c.sessionStartTimestamp:r,this.ul=void 0,_=!0}else v||(v=this.dl(),_=!0),(g=g||l!==b)&&(ol.info("adopted cross-tab session id",{sessionId:l,windowId:v}),_=!0);var x=W(d)&&t&&!p?d:r,E=W(h)?h:(new Date).getTime();this.ml(v),this._l(l,x,E),t||this.vl();var k={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return _&&this.sl.forEach(t=>t(l,v,k)),{sessionId:l,windowId:v,sessionStartTimestamp:E,changeReason:_?k:void 0,lastActivityTimestamp:d}}vl(){this.al||(clearTimeout(this.Ml),this.Ml=setTimeout(()=>{if(!this.al)if(this.Tl((new Date).getTime())){var t=this.Bt;this.resetSessionId(),this.il.emit("forcedIdleReset",{idleSessionId:t})}else this.vl()},1.1*this.sessionTimeoutMs))}},hl=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&x(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>x(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function ul(){return(ul=o(function*(){var t=null==h?void 0:h.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i,e=null==(i=yield t.getHighEntropyValues(["model"]))?void 0:i.model;return B(e)&&e.length>0?e:void 0}catch(t){return void Pe.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function dl(t,i){var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e}function vl(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var cl=(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}},fl=t=>t.toLowerCase(),pl={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=>cl(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!cl(i,t))),icontains:(t,i)=>i.map(fl).some(i=>t.map(fl).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(fl).every(i=>t.map(fl).every(t=>!i.includes(t))),gt:(t,i)=>i.some(i=>{var e=parseFloat(i);return!isNaN(e)&&t.some(t=>e>parseFloat(t))}),lt:(t,i)=>i.some(i=>{var e=parseFloat(i);return!isNaN(e)&&t.some(t=>e<parseFloat(t))})};function _l(t,i){return!t||Object.entries(t).every(t=>{var e=t[1],r=null==i?void 0:i[t[0]];if(null==r)return!1;var s=pl[e.operator];return!!s&&s(e.values,[String(r)])})}function gl(t,i,e){return oo({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var ml="custom",bl="i.posthog.com",yl=/^\/static\//,wl=["/s/","/e/","/i/"],Sl=class{constructor(t){this.Il={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+bl,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.Il[this.apiHost]||(this.Il[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":ml),this.Il[this.apiHost]}El(t){if(yl.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}Rl(t){var i=ao(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}Al(t,i,e){if("ui"===t)return e;var r=e,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=ao(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&wl.some(t=>0===i.indexOf(t))){var a=this.Rl(r);if(a){var l,h=this.apiHost,u=this.Pl;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(this.Pl=u={apiHost:h,rewriteRequestPath:s,urls:new Set}),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.Pl,e=this.Rl(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(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.Al(t,i,this.uiHost+i);if("flags"===t)return this.Al(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.El(i);if(e)return this.Al(t,i,""+e+i)}if(this.region===ml)return this.Al(t,i,this.apiHost+i);var r=bl+i;switch(t){case"assets":return this.Al(t,i,"https://"+this.region+"-assets."+r);case"api":return this.Al(t,i,"https://"+this.region+"."+r)}}},xl=Re("[Surveys]"),El=t=>{try{var 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){xl.error("Failed to persist survey seen state",t)}},kl=[qo.Popover,qo.Widget,qo.API],$l={ignoreConditions:!1,ignoreDelay:!1,displayType:Yo.Popover},Tl=Re("[PostHog ExternalIntegrations]"),Pl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},Rl=class{constructor(t){this._instance=t}do(t,i){var e;null==(e=b.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,t=>{if(t)return Tl.error("failed to load script",t);i()})}startIfEnabledOrStop(){var t=this,i=function(){var i,r,s,n=e[0],o=e[1];!o||null!=(i=b.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t.do(Pl[n],()=>{var i;null==(i=b.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)}),!o&&null!=(r=b.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=b.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var e of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;i()}}},Cl=class{constructor(t,i){this.A=t,this.Hs=i,this.Fl=new Map,this.Js=!1}add(t){var i=this;return o(function*(){if(i.Js)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.Fl.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.Fl.set(t.name,t);try{var e=t.setup(i.Hs);e&&(yield e)}catch(e){var r=i.Fl.get(t.name)===t;r&&i.Fl.delete(t.name),i.A.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.Ol(t)}})()}getExtension(t){return this.Fl.get(t)}dispose(){if(!this.Js){this.Js=!0;var t=Array.from(this.Fl.values()).reverse();for(var i of(this.Fl.clear(),t))this.Ol(i)}}Ol(t){try{var i=null==t.dispose?void 0:t.dispose();i&&N(i.then)&&i.then(void 0,i=>{this.A.error('Failed to dispose browser extension "'+t.name+'"',i)})}catch(i){this.A.error('Failed to dispose browser extension "'+t.name+'"',i)}}},Ol=class{constructor(t){this._instance=t}initialize(){}get(t){var i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);var e={};for(var r of t){var s=null==i?void 0:i.get_property(r);U(s)||(e[r]=s)}return e}set(t,i){var e;null==(e=this._instance.persistence)||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null==(i=this._instance.persistence)||i.unregister(t)}},Al="extensionsRemoteConfig",Il=class{constructor(t){this.instance=t,this.Js=!1,this.A=Pe,this.$l=t.Dl,this.kv=new Ol(t),this.onEvent=t=>Xo(this.instance.on("eventCaptured",i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.Js)return Xo(()=>{});var i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.Ll.on(Al,i);return this.$l&&i(this.$l),Xo(e)},this.Nl=new Cl(Pe.createLogger("[BrowserExtensions]"),this)}get logger(){return this.A}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(){var t=this.instance.get_property(Le);return"string"==typeof t?t:void 0}get library(){return{name:Me.LIB_NAME,version:Me.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null==(i=this.instance.persistence)?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==s?void 0:s.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==s?void 0:s.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.Nl.add(t)}getExtension(t){return this.Nl.getExtension(t)}capture(t,i,e){var r=this;return o(function*(){e?r.instance.capture(t,i,{timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce}):r.instance.capture(t,i)})()}registerDynamicEventProperties(t){return Xo(this.instance.ql(t))}handleRemoteConfig(t){this.Js||(this.$l=t,this.instance.Ll.emit(Al,t))}sendRequest(t,i){var e=this;return o(function*(){var r;void 0===i&&(i={});var s=e.instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",t),n={method:i.method,url:i.query?Ha(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?C.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(e.instance._send_request(n),{statusCode:202}):new Promise(t=>{n.callback=t,e.instance._send_request(n)})})()}dispose(){this.Js||(this.Js=!0,this.Nl.dispose())}},Fl={},Ml=0,Dl=()=>{},Nl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ll="Surveys module not available",jl="sanitize_properties is deprecated. Use before_send instead",Ul="Invalid value for property_denylist config: ",Bl=/^[A-Za-z0-9_-]{1,400}$/,zl=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Hl=["token","distinct_id",Xr],ql="posthog",Vl=!ja&&-1===(null==_?void 0:_.indexOf("MSIE"))&&-1===(null==_?void 0:_.indexOf("Mozilla")),Wl=t=>{var 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},Gl=t=>{var i;return s({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ps(null==u?void 0:u.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Dl,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:d&&B(null==d?void 0:d.search)&&-1!==d.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==a||null==(i=a.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Pe.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:vs,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Dl},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:kn,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Wl(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)}))(t))},Kl=[["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"]],Jl=t=>{var i={};for(var e of Kl){var r=e[0],s=e[1];U(t[r])||(i[s]=t[r])}var n=ws({},i,t),o=t.__preview_external_dependency_versioned_paths;return U(o)||(U(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),B(o)&&U(t.asset_host)&&(n.asset_host=o)),D(t.property_blacklist)&&(U(t.property_denylist)?n.property_denylist=t.property_blacklist:D(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Pe.error(Ul+t.property_denylist)),n},Yl=class{constructor(){this.__forceAllowLocalhost=!1}get jl(){return this.__forceAllowLocalhost}set jl(t){Pe.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Xl=(t=class t{Bl(t){if(t){var i=this.Fl.indexOf(t);-1!==i&&this.Fl.splice(i,1)}}Hl(t,i){return this.Bl(t),this.Fl.push(i),null==i.initialize||i.initialize(),i}zl(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}Ul(){if(!(this.Wl||this.config.reuseAnonymousId||this.config.segment||this.zl())){var t,i,e,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.Vl||(r?(t="persistence is set to '"+this.config.persistence+"'",i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",e="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(t="persistence is disabled (disable_persistence is true)",i="on every page load",e="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.Wl=!0,console.warn("[PostHog.js]",t+" but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID "+i+", 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. "+e)))}}Gl(){if(!this.zl()&&"$posthog_cookieless"===this.get_distinct_id()){var t=this.persistence;if(t){this.Zl()||t.load(!0);var i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){var e=this.config.get_device_id(Ns());this.register({distinct_id:e,$device_id:e}),t.set_property(Hr,us)}this.Jl()}}}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var i;this.webPerformance=new Yl,this.Ql=!1,this.version=Me.LIB_VERSION,this.Kl=new Set,this.Xl="",this.Ll=new nl,this.Fl=[],this.Yl=[],this.Vl=!1,this.Wl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Gl(),this.SentryIntegration=to,this.sentryIntegration=t=>function(t,i){var e=Zn(t,i);return{name:Qn,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.tu=!1,this.eu=null,this.iu=null,this.ru=null,this.scrollManager=new el(this),this.pageViewManager=new io(this),this.rateLimiter=new ea(this),this.requestRouter=new Sl(this),this.consent=new on(this),this.externalIntegrations=new Rl(this);var e=null!==(i=t.__defaultExtensionClasses)&&void 0!==i?i:{};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)=>{var r=B(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=B(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",t=>Pe.info('send "'+(null==t?void 0:t.event)+'"',t))}init(i,e,r){if(r&&r!==ql){var s,n=null!==(s=Fl[r])&&void 0!==s?s:new t;return n._init(i,e,r),Fl[r]=n,Fl[ql][r]=n,n}return this._init(i,e,r)}_init(t,i,e){var r,n,o;void 0===i&&(i={});var l,h=B(t)?t.trim():"";if(!h)return Pe.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return h!==(null==(l=this.config)?void 0:l.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Gl(i.defaults),i.debug=this.nu(i.debug),this.su=i,this.ou=[],i.person_profiles?this.iu=i.person_profiles:i.process_person&&(this.iu=i.process_person);var u=Gl(i.defaults),d=Jl(i),v=ws({},u,d,{name:e,token:h});L(u.rageclick)&&L(d.rageclick)&&(v.rageclick=ws({},u.rageclick,d.rageclick)),L(u.session_recording)&&L(d.session_recording)&&(v.session_recording=ws({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&Pe.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:jo.GZipJS;var c=this.Zl();if(this.persistence=new Lo(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Lo(s({},this.config,{persistence:"sessionStorage"}),c,!1),this.Xl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!c&&nn.si()){var f=nn.di(this.Xl);D(f)&&f.forEach(t=>{B(t)&&this.Kl.add(t)})}else nn.hi(this.Xl);var p=s({},this.persistence.props),_=s({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.au=new tl(t=>this.lu(t),this.config.request_queue_config),this.uu=new il(this),this.__request_queue=[];var g=this.zl();g||(this.sessionManager=new ll(this),this.sessionPropsManager=new sl(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.hu()})),this.du(),this.config.__preview_deferred_init_extensions?(Pe.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.vu(g)},0)):(Pe.info("Initializing extensions synchronously"),this.vu(g)),Me.DEBUG=Me.DEBUG||this.config.debug,Me.DEBUG&&Pe.info("Starting in debug mode",{this:this,config:i,thisC:s({},this.config),p:p,s:_}),!this.config.identity_distinct_id||null!=(r=i.bootstrap)&&r.distinctID||(i.bootstrap=s({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var m=null==(n=i.bootstrap)?void 0:n.distinctID;if(this.Vl=!!m&&!z(m),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var b=i.bootstrap.distinctID,y=this.get_distinct_id(),w=this.persistence.get_property(Hr);if(i.bootstrap.isIdentifiedID&&null!=y&&y!==b&&"anonymous"===w)this.identify(b);else if(i.bootstrap.isIdentifiedID&&null!=y&&y!==b&&"identified"===w)Pe.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var S=this.config.get_device_id(Ns()),x=i.bootstrap.isIdentifiedID?S:b;this.persistence.set_property(Hr,i.bootstrap.isIdentifiedID?ds:us),this.register({distinct_id:b,$device_id:x})}}if(g)this.register_once({distinct_id:Yr,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(Ns());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(Hr,us)}return Rs(a,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?Xn(this,()=>this.cu()):this.cu(),N(this.config._onCapture)&&this.config._onCapture!==Dl&&(Pe.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Pe.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 ul.apply(this,arguments)}().then(t=>{t&&this.register({[je]:t})}).catch(Dl),this}fu(t){var i=t;return B(i.name)&&N(i.setup)}pu(t,i){this.fu(t)?i.push(()=>{this.gu().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(i=>{Pe.error('Failed to dispose browser extension "'+t.name+'"',i)})}):this.Fl.push(t)}du(){var i,e,r,s,n,o,a=null!==(i=null==(e=this.config.__extensionClasses)?void 0:e.featureFlags)&&void 0!==i?i:null==(r=t.__defaultExtensionClasses)?void 0:r.featureFlags;a&&(this.featureFlags&&this.featureFlags instanceof a||(null==(o=this.mu)||o.call(this),this.mu=void 0,this.featureFlags=new a(this)),N(this.featureFlags.onReloading)&&N(this.featureFlags.setup)?this.mu||(this.mu=this.featureFlags.onReloading(()=>{this.Ll.emit("featureFlagsReloading",!0)}),this.gu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}vu(i){var e,r,n,o,a,l,h,u=performance.now(),d=s({},t.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.exceptions&&this.Fl.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new d.exceptions(this)),d.historyAutocapture&&this.Fl.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.Fl.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.Fl.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!i&&this.Fl.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.pu(this.autocapture=new d.autocapture(this),v),d.surveys&&this.pu(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new d.surveys(this),v),d.logs&&this.pu(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this),v),d.metrics&&this.Fl.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.Fl.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.Fl.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.Fl.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.Fl.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.Fl.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.Fl.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Kn)),d.toolbar&&this.Fl.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this.Fl.push(this.experiments=null!==(h=this.experiments)&&void 0!==h?h:new d.experiments(this)),this.Fl.forEach(t=>{t.initialize&&v.push(()=>{null==t.initialize||t.initialize()})}),v.push(()=>{if(this.yu){var t=this.yu;this.yu=void 0,this.Fl.forEach(i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t))}}),this.bu(v,u)}bu(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this.bu(t,i)},0);var e=t.shift();if(e)try{e()}catch(t){Pe.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[Qr]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Zr]:r}),this.config.__preview_deferred_init_extensions&&Pe.info("PostHog extensions initialized ("+r+"ms)")}Ta(t){var i;if(!u||!u.body)return Pe.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Ta(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.yu=t),this.Dl=t,this.compression=void 0,t.ok){var e,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=E(r.supportedCompression,jo.GZipJS)?jo.GZipJS:E(r.supportedCompression,jo.Base64)?jo.Base64:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.iu?this.iu:vs}),null==(i=this._u)||i.handleRemoteConfig(t),this.Fl.forEach(i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t))}cu(){try{this.config.loaded(this)}catch(t){Pe.critical("`loaded` function failed",t)}if(this.wu(),this.config.internal_or_test_user_hostname&&null!=d&&d.hostname){var t=d.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.zl())&&this.ku()},1),this.Su=new sa(this),this.Su.load()}wu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.au)||t.enable())}_dom_loaded(){this.is_capturing()&&bs(this.__request_queue,t=>this.lu(t)),this.__request_queue=[],this.wu()}_handle_unload(){var t,i,e,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.xu()&&this.capture(_s),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.au)||r.unload(),null==(s=this.uu)||s.unload()):this.xu()&&this.capture(_s,null,{transport:"sendBeacon"})}_send_request(t){var i;this.__loaded?Vl?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=s({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(U(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,n=s({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&U(n.compression)&&n.data&&(n.compression=jo.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(D(o=n.data)?o:[o]).map(t=>s({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,i){return void 0===i&&(i=(new Date).toISOString()),D(t)?t.map(t=>s({},t,{sent_at:i})):s({},t,{sent_at:i})}(n.data))),n.url=Qa(n.url,n.method,n.compression,n.timestampMode);var v=Za.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),c=null!==(e=null==(r=function(t,i){for(var e=0;t.length>e;e++)if(i(t[e]))return t[e]}(v,t=>t.transport===d))?void 0:r.method)&&void 0!==e?e:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){Ja(t)?Pe.warn(t):Pe.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===jo.GZipJS&&p&&"undefined"!=typeof Promise&&!Ba?Ga(n).then(t=>{f(t)}).catch(i=>{if(ne(i))return Ba=!0,void f(s({},n,{compression:void 0,url:Qa(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var i="name"in t?String(t.name):"";return ne(t)||i===ee})(i)&&(Ba=!0),f(n)}):c(n)})(s({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}lu(t){this.uu?this.uu.retriableRequest(t):this._send_request(t)}_execute_array(t){Ml++;try{var i,e=[],r=[],s=[];bs(t,t=>{if(t)if(D(i=t[0]))s.push(t);else if(N(t))try{t.call(this)}catch(i){Pe.error("Error executing queued PostHog call",t,i)}else D(t)&&"alias"===i?e.push(t):D(t)&&-1!==i.indexOf("capture")&&N(this[i])?s.push(t):r.push(t)});var n=function(t,i){bs(t,function(t){try{if(D(t[0])){var e=i;ys(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){Pe.error("Error executing queued PostHog call",t,i)}})};n(e,this),n(r,this),n(s,this)}finally{Ml--}}push(i){if(Ml>0&&D(i)&&B(i[0])){var e=t.prototype[i[0]];N(e)&&e.apply(this,i.slice(1))}else this._execute_array([i])}Cu(){var t,i=null==(t=this.persistence)?void 0:t.get_property(He);return B(i)&&zl.test(i)?{value:i,delivered:!1}:L(i)&&B(i.value)&&zl.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}Tu(t,i,e,r){if(this.persistence){this.persistence.refreshKey(He);var s=this.Cu();if(!r){if(e)return B(i)&&zl.test(i)?(i!==(null==s?void 0:s.value)&&this.persistence.register({[He]:{value:i,delivered:!1}}),{value:i,pending:i!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(He);if(B(t)&&Bl.test(t)){if((null==s?void 0:s.value.split(".")[3])===t)return{value:s.value,pending:!s.delivered};var n="fb.1."+Date.now()+"."+t;return this.persistence.register({[He]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(He)}}Mu(t){if(this.persistence){this.persistence.refreshKey(He);var i=this.Cu();(null==i?void 0:i.value)!==t||i.delivered||this.persistence.register({[He]:{value:t,delivered:!0}})}}capture(t,i,e){var r,n,o,a,l,h,u,d,v,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.au){if(this.is_capturing())if(!U(t)&&B(t)){this.Gl();var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var p=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==p||!p.isRateLimited){var _;null!=i&&i.$current_url&&!B(null==i?void 0:i.$current_url)&&(Pe.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=e&&e.Iu||Pe.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(_=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var g=new Date,m=(null==e?void 0:e.timestamp)||g,b=pi(null==e?void 0:e.uuid,Ns),y={uuid:b,event:t,properties:this.calculateEventProperties(t,i||{},m,b)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&f&&(y.event="$bot_pageview",y.properties.$browser_type="bot"),p&&(y.properties.$lib_rate_limit_remaining_tokens=p.remainingTokens);var w="$feature_flag_called"===t&&!1===y.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=e&&e.$set&&!w&&(y.$set=null==e?void 0:e.$set);var S=L(null==i?void 0:i.$set)?i.$set:void 0,x=!(null==e||!e.$set)&&"$fbc"in e.$set,E=x||!!S&&"$fbc"in S,k=x?null==e||null==(r=e.$set)?void 0:r[ze]:null==S?void 0:S[ze],T=D(null==i?void 0:i.$unset)?i.$unset:[],P=(null==e?void 0:e.$unset)||[],R=-1!==T.indexOf("$fbc")||-1!==P.indexOf("$fbc"),C=this.Tu(null==(n=_)?void 0:n.fbclid,k,E,R);C&&!0===y.properties.$process_person_profile&&C.pending&&!E&&!w&&(y.$set=s({[ze]:C.value},y.$set));var O=null==e?void 0:e.$unset;O&&(y.$unset=O);var A=w?void 0:this.Eu(null==e?void 0:e.$set_once,t!==ms,t===gs);if(A&&(y.$set_once=A),null!=e&&e._noTruncate||(u=this.config.properties_string_max_length,d=y,v=t=>B(t)?t.slice(0,u):t,c=new Set,y=function t(i,e){if(i!==Object(i))return v?v(i):i;if(!c.has(i)){var r;if(c.add(i),D(i))r=[],bs(i,i=>{r.push(t(i))});else{var s={};ys(Q(i)?$s(i):i,(i,e)=>{c.has(i)||(s[e]=t(i,e))}),r=s}return r}}(d)),y.timestamp=m,U(null==e?void 0:e.timestamp)||(y.properties.$event_time_override_provided=!0,y.properties.$event_time_override_system_time=g),w&&(y.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return ie.forEach(r),i.forEach(r),e}(y.properties,Hl)),t===Ko.DISMISSED||t===Ko.SENT){var I=null==i?void 0:i[Jo.SURVEY_ID],F=null==i?void 0:i[Jo.SURVEY_ITERATION];El({id:I,current_iteration:F}),y.$set=s({},y.$set,{[dl({id:I,current_iteration:F},t===Ko.SENT?"responded":"dismissed")]:!0})}else t===Ko.SHOWN&&(y.$set=s({},y.$set,{[Jo.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Zo.SHOWN){var M=null==i?void 0:i[ta.TOUR_TYPE];M&&(y.$set=s({},y.$set,{[ta.TOUR_LAST_SEEN_DATE+"/"+M]:(new Date).toISOString()}))}var N=s({},y.properties.$set,y.$set);if(j(N)||this.setPersonPropertiesForFlags(N),!q(this.config.before_send)){var z=this.ds(y);if(!z)return;(y=z).uuid=pi(y.uuid,Ns)}var H=null!==(o=null==(a=y.$set)?void 0:a.$fbc)&&void 0!==o?o:L(null==(l=y.properties)?void 0:l.$set)?y.properties.$set.$fbc:void 0,V=null!=C&&C.pending&&H===C.value?C.value:void 0;this.Ll.emit("eventCaptured",y);var W=null!==(h=null==e?void 0:e._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),G=s({method:"POST",url:W,data:y,compression:"best-available",timestampMode:"recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(W)?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},null!=e&&e.transport?{transport:e.transport}:{},V?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.Mu(V)}}:{});return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly||V?this.lu(G):this.au.enqueue(G),y}Pe.critical("This capture call is ignored due to client rate limiting.")}}else Pe.error("No event name provided to posthog.capture")}else Pe.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null==(i=this._u)?void 0:i.getExtension(t)}gu(){var t;return null!==(t=this._u)&&void 0!==t?t:this._u=new Il(this)}ql(t){this.Yl.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.Yl.indexOf(t);-1!==e&&this.Yl.splice(e,1)}}}Ru(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.ru=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(r=this.sessionPersistence)||r.clear(),this.Kl.clear(),this.Au()),null==(e=this.featureFlags)||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,e,r,n){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.Ru();var o=n?void 0:this.persistence.remove_event_timer(t),l=s({},i);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.zl()&&(l[Xr]=!0),"$snapshot"===t){var h=s({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!B(l.distinct_id)&&!V(l.distinct_id)||z(l.distinct_id))&&Pe.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var v,c=function(t,i,e,r){var s,n,o,l;if(void 0===r&&(r=!1),!_)return{};var h,u=t?[...fo,...i||[]]:[],v=si(_),c=v[0],f=v[1],p=function(t){for(var i=0;ai.length>i;i++){var e,r=ai[i],s=r[1],n=r[2],o=t.match(r[0]);if(o)return[s,(null==(e=n&&t.match(n)||o)?void 0:e[1])||""]}return["",""]}(_),g=p[0],m=p[1],b=null!=(h="u">typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},y={};U(e)||(y.detectGoogleSearchApp=e);var S={},x=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,E=null==(n=navigator)?void 0:n.maxTouchPoints,k=null==a||null==(o=a.screen)?void 0:o.width,T=null==a||null==(l=a.screen)?void 0:l.height,P=null==a?void 0:a.devicePixelRatio;U(x)||(S.userAgentDataPlatform=x),U(E)||(S.maxTouchPoints=E),U(k)||(S.screenWidth=k),U(T)||(S.screenHeight=T),U(P)||(S.devicePixelRatio=P);var R,C,O,A,I,F,M,D,N=ws(ks({$os:c,$os_version:f,$browser:ti(_,navigator.vendor,b,y),$webview_app:g,$webview_app_version:m,$device:ni(_),$device_type:(C=_,O=S,D=ni(C),D===ut||D===ht||"Kobo"===D||"Kindle Fire"===D||D===It?lt:D===xt||D===kt||D===Et||D===Ot?"Console":D===dt?"Wearable":D?ot:"Android"===(null==O?void 0:O.userAgentDataPlatform)&&(null!==(A=null==O?void 0:O.maxTouchPoints)&&void 0!==A?A:0)>0?600>Math.min(null!==(I=null==O?void 0:O.screenWidth)&&void 0!==I?I:0,null!==(F=null==O?void 0:O.screenHeight)&&void 0!==F?F:0)/(null!==(M=null==O?void 0:O.devicePixelRatio)&&void 0!==M?M:1)?ot:lt:"Desktop"),$timezone:$o(),$timezone_offset:To()}),{$current_url:ho(r?gi(null==d?void 0:d.href):null==d?void 0:d.href,u,_o),$host:null==d?void 0:d.host,$pathname:null==d?void 0:d.pathname,$raw_user_agent:_.length>1e3?_.substring(0,997)+"...":_,$browser_version:ei(_,navigator.vendor,b,y),$browser_language:wo(),$browser_language_prefix:(R=wo(),"string"==typeof R?R.split("-")[0]:void 0),$screen_height:null==a?void 0:a.screen.height,$screen_width:null==a?void 0:a.screen.width,$viewport_height:null==a?void 0:a.innerHeight,$viewport_width:null==a?void 0:a.innerWidth,$lib:w.LIB_NAME,$lib_version:w.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return w.SDK_DIST_CHANNEL&&(N.$sdk_dist_channel=w.SDK_DIST_CHANNEL),N}(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){var f=this.sessionManager.checkAndGetSessionAndWindowId(n,e.getTime(),!0),p=f.windowId;l.$session_id=f.sessionId,l.$window_id=p}this.sessionPropsManager&&ws(l,this.sessionPropsManager.getSessionProps());try{var g;this.sessionRecording&&ws(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(g=this.uu)?void 0:g.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===ml&&(l.$lib_custom_api_host=this.config.api_host),v="$pageview"!==t||n?"$pageleave"!==t||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,r),l=ws(l,v),"$pageview"===t&&u&&(l.title=u.title),!U(o)){var m=e.getTime()-o;l.$duration=parseFloat((m/1e3).toFixed(3))}_&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var b=this.persistence.properties(),y=this.sessionPersistence.properties(),S=l.$groups,x=b.$groups;L(S)&&!j(S)&&(l.$groups=s({},L(x)?x:{},S)),ys(["$referrer","$referring_domain"],t=>{t in b&&delete y[t]});var E={};if(this.Yl.length>0)for(var k of this.Yl.slice())try{ws(E,k())}catch(t){Pe.error("Failed to produce browser extension event properties",t)}(l=ws({},c,b,y,s({},E,l))).$is_identified=this._isIdentified(),D(this.config.property_denylist)?ys(this.config.property_denylist,function(t){delete l[t]}):Pe.error(Ul+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var T=this.config.sanitize_properties;T&&(Pe.error(jl),l=T(l,t));var P=this.Pu();return l.$process_person_profile=P,P&&!n&&this.Fu("_calculate_event_properties"),l}Eu(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.Pu())return t;if(this.Ql&&!e)return t;var s=ws({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(Pe.error(jl),s=n(s,"$set_once")),i&&(this.Ql=!0),j(s)?void 0:s}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i,e;null==(i=this.persistence)||i.syncCookieProperties(),this.Ru(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach(t=>this.Kl.add(t)),this.Au()}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t),this.Kl.delete(t),this.Au()}Ou(t,i){this.register({[t]:i})}hu(){this.Kl.forEach(t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)}),this.Kl.clear(),this.Au()}Au(){var t;if(this.Xl)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Bo||!nn.si())nn.hi(this.Xl);else{var i=[];this.Kl.forEach(t=>i.push(t)),i.length>0?nn.ui(this.Xl,i):nn.hi(this.Xl)}}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,r;return null!==(e=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Ll.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:Ll}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Ll})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Ll})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=$l),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:Ll}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:Ll})}$u(t){return!t||z(t)?(Pe.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Pe.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())||(Pe.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 Pe.uninitializedWarning("posthog.identify");if(V(t)&&(t=t.toString(),Pe.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.$u(t)&&this.Fu("posthog.identify")){this.Gl();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.Ru(!1),o=this.persistence.oa(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property("__alias")&&(this.unregister(Ue),this.register({distinct_id:t}));var h=(this.persistence.get_property("$user_state")||"anonymous")===us,u=t!==l,d=!u&&h;if(u&&h){var v,c=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:l};this.persistence.set_property(Hr,ds),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.aa(),this.capture(gs,c,{$set:i||{},$set_once:e||{}}),this.ru=gl(t,i,e),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(d){this.persistence.set_property(Hr,ds);var f=i||{},p=e||{};this.setPersonPropertiesForFlags({$set:f,$set_once:p},!1),this.config.cookieWinsOnConflict&&this.persistence.aa(),this.capture("$set",{$set:f,$set_once:p}),this.ru=gl(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(jr)):d&&(i||e)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.ha(a)}}}setPersonProperties(t,i){if((t||i)&&this.Fu("posthog.setPersonProperties")){var e=gl(this.get_distinct_id(),t,i);this.ru!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.ru=e):Pe.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(D(t)?t:[t]).filter(t=>B(t)&&t.length>0);0!==e.length&&this.Fu("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.ru=null)}group(t,i,e){var r;if(t&&i){null==(r=this.persistence)||r.syncCookieProperties(),this.Ru();var n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:s({},n,{[t]:i})}),(o||e)&&this.Pu()){var a={$group_type:t,$group_key:i};e&&(a.$group_set=e),this.capture(ms,a)}e&&this.setGroupPropertiesForFlags({[t]:e}),o&&!e&&this.reloadFeatureFlags()}else Pe.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.Fu("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i=G(t)?t:null==t?void 0:t.resetDeviceID,e=G(t)||null==t?void 0:t.bootstrap;this.Du(i,!1,e)}Du(t,i,e){var r,n,o,a;if(void 0===i&&(i=!1),Pe.info("reset"),!this.__loaded)return Pe.uninitializedWarning("posthog.reset");var l=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null==(r=this.su)?void 0:r.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.Ma());var h=this.get_property(Le),u=this.get_property(je),d=this.get_property(ir);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var v=this.is_capturing();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.");var c=null==(a=this.persistence)||null==a.oa?void 0:a.oa(),f=!1;try{var p,_,g,m,b,y,w,S,x,E,k,T,P;if(null==(p=this.persistence)||p.clear(),null==(_=this.sessionPersistence)||_.clear(),this.Kl.clear(),this.Au(),U(d)||null==(g=this.persistence)||g.register({[ir]:d}),null==(m=this.surveys)||m.reset(),null==(b=this.featureFlags)||b.reset(),null==(y=this.conversations)||y.reset(),null==(w=this.logs)||w.reset(),null==(S=this.metrics)||S.reset(),null==(x=this.persistence)||x.set_property(Hr,us),null==(E=this.sessionManager)||E.resetSessionId(),this.ru=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Yr,$device_id:null},"");else{var R=this.config.get_device_id(Ns());this.register_once({distinct_id:R,$device_id:t?R:h},""),t||U(u)||this.register({[je]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(void 0===e.distinctID||this.zl()||(null==(P=this.persistence)||P.set_property(Hr,e.isIdentifiedID?ds:us),this.register({distinct_id:e.distinctID})),null==(k=this.featureFlags)||k.initialize(),!(U(l)||null!=(T=this.sessionManager)&&T.setBootstrapSessionId(l,!0))){var C=s({},e);delete C.sessionID,this.config.bootstrap=C}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,f=!0}finally{var O;c&&(null==(O=this.persistence)||null==O.ha||O.ha(f))}this.reloadFeatureFlags()}shutdown(t){var i=this;return o(function*(){var t,e,r,s,n,o,a;if(i.__loaded){i.gu().dispose(),null==(t=i.sessionRecording)||t.dispose(),null==(e=i.logs)||e.flushLogs("sendBeacon"),null==(r=i.metrics)||r.flush("sendBeacon"),null==(s=i.au)||s.unload(),null==(n=i.uu)||n.unload();try{var l;null==(l=i.featureFlags)||l.destroy()}catch(t){Pe.error("Error while destroying feature flags",t)}null==(o=i.persistence)||o.destroy(),null==(a=i.sessionPersistence)||a.destroy()}else Pe.uninitializedWarning("posthog.shutdown")})()}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)||e.Lu()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t.Nu()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var i=this.sessionManager.checkAndGetSessionAndWindowId(!0),e=i.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i.sessionId);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property("$people_distinct_id")?(Pe.critical("Attempting to create alias for existing People user - aborting."),-2):this.Fu("posthog.alias")?(U(i)&&(i=this.get_distinct_id()),t!==i?(this.Ou(Ue,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Pe.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=s({},this.config);if(L(t)){var e,r,n,o,a,l,h,u,d,v,c,f,p;ws(this.config,Jl(t));var _=this.Zl();null==(e=this.persistence)||e.update_config(this.config,i,_),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Lo(s({},this.config,{persistence:"sessionStorage"}),_,!1);var g=this.nu(this.config.debug);G(g)&&(this.config.debug=g),G(this.config.debug)&&(this.config.debug?(Me.DEBUG=!0,qs.si()&&qs.ui("ph_debug",!0),Pe.info("set_config",{config:t,oldConfig:i,newConfig:s({},this.config)})):(Me.DEBUG=!1,qs.si()&&qs.hi("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this.Ma()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(h=this.autocapture)||h.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(d=this.historyAutocapture)||d.startIfEnabledOrStop()),null==(v=this.exceptionObserver)||v.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||c.startIfEnabledOrStop(),null==(f=this.surveys)||f.loadIfEnabled(),this.Jl(),null==(p=this.externalIntegrations)||p.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&Xn(this,Dl,!1)}}_overrideSDKInfo(t,i){Me.LIB_NAME=t,Me.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){try{if(!this.exceptions)return;var e=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(s({},e,i))}catch(t){return}}addExceptionStep(t,i){var e;null==(e=this.exceptions)||e.addExceptionStep(t,i)}captureLog(t){var i;null==(i=this.logs)||i.captureLog(t)}get logger(){var i,e;return null!==(i=null==(e=this.logs)?void 0:e.logger)&&void 0!==i?i:t.qu}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:ql;return i!==ql&&(i="posthog."+i),i}_isIdentified(){var t,i;return"identified"===(null==(t=this.persistence)?void 0:t.get_property("$user_state"))||"identified"===(null==(i=this.sessionPersistence)?void 0:i.get_property("$user_state"))}Pu(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&j(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t.__alias)&&(null==(i=this.persistence)||null==(i=i.props)||!i.$epp))}xu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.Pu()||this.Fu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Fu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Fu(t){return"never"===this.config.person_profiles?(Pe.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ul(),this.Ou(Jr,!0),!0)}Zl(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}Jl(){var t,i,e,r,s,n=this.Zl();return this.is_capturing()||null==(t=this.logs)||t.ju(),(null==(i=this.persistence)?void 0:i.Bo)!==n&&(null==(e=this.persistence)||e.set_disabled(n)),(null==(r=this.sessionPersistence)?void 0:r.Bo)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.Kl.clear(),this.Au()),n}opt_in_capturing(i){var e,r,s;if("always"!==this.config.cookieless_mode){if(this.zl()){var n,o,a,l,h,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this.Du(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new ll(this),this.pageViewManager=new io(this),this.persistence&&(this.sessionPropsManager=new sl(this,this.sessionManager,this.persistence));var d,v=null!==(l=null==(h=this.config.__extensionClasses)?void 0:h.sessionRecording)&&void 0!==l?l:null==(u=t.__defaultExtensionClasses)?void 0:u.sessionRecording;v&&(this.sessionRecording=this.Hl(this.sessionRecording,new v(this)),this.Dl&&(null==(d=this.sessionRecording)||null==d.onRemoteConfig||d.onRemoteConfig(this.Dl)))}this.consent.optInOut(!0),this.Jl(),this.wu(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(r=this.surveys)||r.loadIfEnabled()),(U(null==i?void 0:i.captureEventName)||null!=i&&i.captureEventName)&&this.capture(null!==(s=null==i?void 0:i.captureEventName)&&void 0!==s?s:"$opt_in",null==i?void 0:i.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.ku()}else Pe.warn(Nl)}opt_out_capturing(){if("always"!==this.config.cookieless_mode){var t,i,e="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;null==e||e.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.Du(!0,!0),this.consent.optInOut(!1),this.Jl(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Yr,$device_id:null}),this.Bl(e),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.ku(),this.wu())}else Pe.warn(Nl)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return"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.Jl()}_is_bot(){return h?hl(h,this.config.custom_blocked_useragents):void 0}ku(){u&&("visible"===u.visibilityState?this.tu||(this.tu=!0,this.capture(ps,{title:u.title},{send_instantly:!0}),this.eu&&(u.removeEventListener(cs,this.eu),this.eu=null)):this.eu||(this.eu=this.ku.bind(this),Rs(u,cs,this.eu)))}debug(t){!1===t?(null==a||a.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==a||a.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}))}Ma(){var t=this.su||{};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?(Pe.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,r,s){var n=i in t&&!q(t[i]),o=e in t&&!q(t[e]);return n?t[i]:!!o&&(s&&s.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,Pe)}ds(t){var i;if(q(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(J),r=D(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),q(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return K(t.event)?Pe.warn(o+". This can cause unexpected behavior."):Pe.info(o),null}s.properties&&!j(s.properties)||Pe.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return Pe.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&q(s.properties[a]))return Pe.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.fo)?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)})}nu(t){var i=G(t)&&!t,e=qs.si()&&"true"===qs.li("ph_debug");return!i&&(!!e||t)}},t.__defaultExtensionClasses={},t.qu=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),t);!function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=Es(t.prototype[i[e]])}(Xl,["identify"]);var Ql=class{constructor(t){this.disabled=!1===t;var i=L(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}},Zl="$copy_autocapture",th=Re("[AutoCapture]");function ih(t,i){return i.length>t?i.slice(0,t)+"...":i}function eh(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!hn(i));return i}function rh(t,i){var e,r,n=i.e,o=i.maskAllElementAttributes,l=i.maskAllText,h=i.elementAttributeIgnoreList,u=i.elementsChainAsString,d=i.disableCaptureUrlHashes;if(!hn(t))return{props:{}};for(var v=[t],c=new Set([t]),f=t;f.parentNode&&!un(f,"body")&&1e3>v.length;)if(vn(f.parentNode)){var p=f.parentNode.host;if(c.has(p))break;c.add(p),v.push(p),f=p}else{if(!hn(f.parentNode))break;if(c.has(f.parentNode))break;c.add(f.parentNode),v.push(f.parentNode),f=f.parentNode}var _="click"===n.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?v.findIndex(t=>un(t,"button")||un(t,"a")):-1;_>0&&(l=l||v.slice(0,_+1).some(t=>!An(t)||In(t)));var g,m,b,y=[],w={},S=!1,x=!1;if(ys(v,t=>{var i=An(t);if(un(t,"a")){var e=t.getAttribute("href");S=!!(i&&e&&Bn(e))&&(d?gi(e):e)}E(pn(t),"ph-no-capture")&&(x=!0),y.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};bn.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?ih(1024,zn(t)):ih(1024,gn(t)));var a=pn(t);a.length>0&&(o.classes=a.filter(function(t){return""!==t})),ys(t.attributes,function(e){var n;if((!In(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Bn(e.value)&&(!B(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=cn(a).join(" ")),o["attr__"+e.name]=ih(1024,"href"===e.name&&s?gi(a):a)}});for(var l=1,h=1,u=t;u=eh(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,l,h,d)),ys(function(t){if(!An(t))return{};var i={};return ys(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Bn(r)&&(i[e]=r)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(w,i)||(w[i]=t)})}),x)return{props:{},explicitNoCapture:x};if(_>0&&(t=v[_],y.splice(0,_)),l||(y[0].$el_text=un(t,"a")||un(t,"button")?zn(t):gn(t)),S){var k,T;y[0].attr__href=S;var P=null==(k=ao(S))?void 0:k.host,R=null==a||null==(T=a.location)?void 0:T.host;P&&R&&P!==R&&(g=S)}return{props:ws((m=n.type,{$event_type:m,$ce_version:1}),u?{}:{$elements:y},{$elements_chain:(b=y,D(b)?function(t){return t.map(t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))r+="."+n.replace(/"/g,"");var o=s({},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),a={};return Ss(o).sort((t,i)=>{return(r=i[0])>(e=t[0])?-1:e>r?1:0;var e,r}).forEach(t=>{var i=t[1];return a[qn(t[0].toString())]=qn(i.toString())}),(r+=":")+Ss(a).map(t=>t[0]+'="'+t[1]+'"').join("")}).join(";")}(function(t){return t.map(t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Vn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Ss(t).filter(t=>0===t[0].indexOf("attr__")).forEach(t=>r.attributes[t[0]]=t[1]),r})}(b)):"")},null!=(e=y[0])&&e.$el_text?{$el_text:null==(r=y[0])?void 0:r.$el_text}:{},g&&"click"===n.type?{$external_click_url:g}:{},w),target:t}}var sh=class{Ds(){this.Ls=void 0,clearTimeout(this.Ns),this.Ns=void 0}qs(t){var i;if(!An(t))return!0;for(var e,r=null!==(i=this.js().css_selector_ignorelist)&&void 0!==i?i:xn,s=new Set,n=t,o=function(){if(s.size>=1e3||s.has(n))return{v:!0};s.add(n);var t=n,i=pn(t);if(E(i,"ph-no-capture")||E(i,"ph-sensitive")||In(t)||r.some(i=>yn(t,i)))return{v:!0};var e=n.parentNode;n=vn(e)?e.host:e&&hn(e)?e:null};n;)if(e=o())return e.v;return!1}Bs(t){if(this.isEnabled&&"pointercancel"!==t.type)if("pointerdown"!==t.type){var i=this.Ls;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.Ds():"pointerup"===t.type&&(i.released=!0,this.Ns=setTimeout(()=>this.Ds(),0)))}else{var e;this.Ds();var r=mn(t);t.isPrimary&&0===t.button&&!t.ctrlKey&&r&&hn(r)&&(this.Ls={target:r,excluded:this.qs(r),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null==(e=this.Hs)?void 0:e.distinctId})}else this.Ds()}zs(t){var i,e=this.Ls;this.Ds();var r=mn(t);if(null!=e&&e.released&&e.target.isConnected&&e.distinctId===(null==(i=this.Hs)?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)&&r&&(un(r,"html")||un(r,"body"))){var s;if(e.excluded)return null;var n=null!==(s=this.js().css_selector_ignorelist)&&void 0!==s?s:xn;return[r,null==u?void 0:u.documentElement,null==u?void 0:u.body].some(t=>{if(!t)return!1;var i=pn(t);return E(i,"ph-no-capture")||E(i,"ph-sensitive")||!An(t)||In(t)||n.some(i=>yn(t,i))})?null:e.target}}constructor(t){this.Us=t,this.name="autocapture",this.Ws=!1,this.Vs=null,this.Gs=!1,this.Zs=!1,this._n={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Js=!1,this.Us.refresh(this._n),this.rageclicks=new Ql(this._n.rageclick),this.Qs=null}setup(t){this.Ks(),this.Hs=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Js?i.dispose():(this.Xs=i,this.startIfEnabled())}dispose(){var t;this.Js||(this.Js=!0,this.Hs=void 0,null==(t=this.Xs)||t.dispose(),this.Xs=void 0,this.Ys())}js(){return this.Us.refresh(this._n),this._n}Ks(){var t,i;return this.js(),this._n.url_allowlist=null==(t=this._n.url_allowlist)?void 0:t.map(t=>new RegExp(t)),this._n.url_ignorelist=null==(i=this._n.url_ignorelist)?void 0:i.map(t=>new RegExp(t)),this._n}eo(){if(this.isBrowserSupported()){if(a&&u){var t=this.io=t=>{t=t||(null==a?void 0:a.event);try{if("blur"===t.type)return void this.Ds();if(0===t.type.indexOf("pointer"))return void this.Bs(t);var i="click"===t.type?this.zs(t):void 0;if(H(i))return;this.ro(t,"$autocapture",i)}catch(t){th.error("Failed to capture event",t)}};if(Rs(a,"blur",t),Rs(u,"submit",t,{capture:!0}),Rs(u,"change",t,{capture:!0}),Rs(u,"click",t,{capture:!0}),ys(["pointerdown","pointermove","pointerup","pointercancel"],i=>{Rs(u,i,t,{capture:!0})}),this.js().capture_copied_text){var i=this.no=t=>{t=t||(null==a?void 0:a.event);try{this.ro(t,Zl)}catch(t){th.error("Failed to capture clipboard event",t)}};Rs(u,"copy",i,{capture:!0}),Rs(u,"cut",i,{capture:!0}),Rs(u,"paste",i,{capture:!0})}}}else th.info("Disabling Automatic Event Collection because this browser is not supported")}Ys(){this.Ds(),this.io&&(null==a||a.removeEventListener("blur",this.io),ys(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==u||u.removeEventListener(t,this.io,!0)}),null==u||u.removeEventListener("submit",this.io,!0),null==u||u.removeEventListener("change",this.io,!0),null==u||u.removeEventListener("click",this.io,!0),this.io=void 0),this.no&&(null==u||u.removeEventListener("copy",this.no,!0),null==u||u.removeEventListener("cut",this.no,!0),null==u||u.removeEventListener("paste",this.no,!0),this.no=void 0),this.Ws=!1}startIfEnabled(){this.isEnabled||this.Ds(),!this.Js&&this.Hs&&this.isEnabled&&!this.Ws&&(this.eo(),this.Ws=!0)}onRemoteConfig(t){if(!this.Js)if(this.Gs=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.Zs=i.elementsChainAsString);var e,r=i.autocapture_opt_out;G(r)&&(null==(e=this.Hs)||e.kv.set(Ve,r),this.Vs=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.Qs=t}getElementSelectors(t,i){var e,r=[];return null==(e=this.Qs)||e.forEach(e=>{var s;null==u||null==(s=u.querySelectorAll(e))||s.forEach(s=>{t!==s&&i!==s||E(r,e)||r.push(e)})}),r}get isEnabled(){var t,i;if(this.Js)return!1;var e=null==(t=this.Hs)?void 0:t.kv.get(Ve),r=this.Vs,s=this.js(),n=s.remoteRequestsDisabled&&!this.Gs;if(H(r)&&!G(e)&&!n)return!1;var o=null!==(i=this.Vs)&&void 0!==i?i:!!e;return!!s.enabled&&!o}ro(t,i,e){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r=e||mn(t);dn(r)&&(r=r.parentNode||null);var n,o=this.Ks();"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&o.rageclick&&null!=(n=this.rageclicks)&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&Rn(r,o.rageclick)&&this.ro(t,"$rageclick",e);var l=i===Zl,h=l?s({},o,{dom_event_allowlist:void 0}):o;if(r&&function(t,i,e,r,s,n){var o;if(!a||Cn(t))return!1;if(null!=e&&e.url_allowlist&&!fn(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&fn(e.url_ignorelist,n))return!1;if(null!=e&&e.dom_event_allowlist){var l=e.dom_event_allowlist;if(l&&!l.some(t=>i.type===t))return!1}var h=On(t,r),u=h.parentIsUsefulElement,d=h.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(U(e))return!0;var r,s=function(t){if(e.some(i=>t.tagName.toLowerCase()===i))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(d,e))return!1;if(!wn(d,null==e?void 0:e.css_selector_allowlist))return!1;if(wn(d,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:xn))return!1;try{var v=a.getComputedStyle(t);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var c=t.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(s||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(i.type)>=0;default:return u?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(bn.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,h,l,l?["copy","cut","paste"]:void 0,{config:{get_current_url:o.getCurrentUrl}})){var u,d=rh(r,{e:t,maskAllElementAttributes:o.maskAllElementAttributes,maskAllText:o.maskAllText,elementAttributeIgnoreList:o.element_attribute_ignorelist,elementsChainAsString:this.Zs,disableCaptureUrlHashes:o.disableCaptureUrlHashes}),v=d.props;if(d.explicitNoCapture)return!1;var c=this.getElementSelectors(r,d.target);if(c&&c.length>0&&(v.$element_selectors=c),i===Zl){var f=t.type||"clipboard";if("paste"!==f){var p,_,g=null==a||null==(p=a.getSelection())?void 0:p.toString(),m=_n(g);if(!m)return!1;v.$selected_content=m,v.$clipboard_text_length=null!==(_=null==g?void 0:g.length)&&void 0!==_?_:0}v.$copy_type=f}return null==(u=this.Hs)||u.capture(i,v).catch(t=>th.error("Failed to capture event",t)),!0}}else this.Ds()}isBrowserSupported(){return N(null==u?void 0:u.querySelectorAll)}},nh=class{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=L(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.Ma(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}},oh=Re("[ExceptionAutocapture]"),ah=()=>{},lh=t=>{var i;if(N(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 ah;var r={next:t[i]},s=e(function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return r.next.apply(this,i)});return N(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[i]=s,()=>{if(t[i]!==s)for(var e=t[i],n=lh(e);n;){if(n.next===s)return void(n.next=r.next);n=lh(e=n.next)}else t[i]=r.next}}catch(t){return ah}}var uh=Re("[TracingHeaders]"),dh=Re("[Web Vitals]"),vh=9e5,ch=["CLS","FCP","INP","LCP"],fh=["INP","LCP"],ph=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],_h="disabled",gh="lazy_loading",mh=Re("[SessionRecording]"),bh=Re("[Heatmaps]");function yh(t){return L(t)&&"clientX"in t&&"clientY"in t&&V(t.clientX)&&V(t.clientY)}var wh=Re("[Product Tours]"),Sh=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(Qe))},xh=Re("[SiteApps]"),Eh="Error while initializing PostHog app with config id ",kh=(t,i)=>null!=t&&t.then?t.then(i):i(t),$h="SDK is not enabled or survey functionality is not yet loaded",Th="Disabled. Not loading surveys.",Ph=class{constructor(t,i){this.Us=t,this.Bu=i,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Hu=!1,this.zu=[],this.Uu=null,this.Wu=null,this.Js=!1,this.Vu=new Set,this.onRemoteConfig=t=>{if(!this.Js&&!this._n.disableSurveys){if(!t.ok)return xl.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(q(i))return xl.warn("Flags not loaded yet. Not loading surveys.");this.Gu=G(i)?i:i.length>0,xl.info("flags response received, isSurveysEnabled: "+this.Gu),this.loadIfEnabled()}}}setup(t){if(!this.Js)return this.Zu=t,kh(t.kv.initialize(),()=>{if(this.Zu===t&&!this.Js){this.Zu=void 0,this.Hs=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Js?i.dispose():(this.Xs=i,this.loadIfEnabled())}})}dispose(){var t,i,e;this.Js||(this.Js=!0,this.Zu=void 0,this.Hs=void 0,null==(t=this.Xs)||t.dispose(),this.Xs=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.zu=[],this.Uu=null,this.Vu.forEach(t=>clearTimeout(t)),this.Vu.clear())}get _n(){return this.Us.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var r=localStorage.key(e);(null!=r&&r.startsWith("seenSurvey_")||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(!this.Js&&this.Hs){var t=this._n;if(!this._surveyManager)if(this.Hu)xl.info("Already initializing surveys, skipping...");else if(t.disableSurveys)xl.info(Th);else if(t.cookielessMode&&this.Us.isOptedOut())xl.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Us.getExtensions();if(i){if(!U(this.Gu)||t.advancedEnableSurveys){var e=this.Gu||t.advancedEnableSurveys;this.Hu=!0;try{var r=i.generateSurveys;if(r)return this.Ju(r,e),void(this.Hu=!1);var s=i.loadExternalDependency;if(!s)return this.Qu(hs),void(this.Hu=!1);s(t=>{try{if(this.Js)return;var i=this.Us.getExtensions();t||null==i||!i.generateSurveys?this.Qu("Could not load surveys script",t):this.Ju(i.generateSurveys,e)}finally{this.Hu=!1}})}catch(t){throw this.Hu=!1,this.Qu("Error initializing surveys",t),t}}}else xl.error("PostHog Extensions not found.")}}}Ju(t,i){this.Js||(this._surveyManager=t(i),this._surveyEventReceiver=this.Us.createEventReceiver(),xl.info("Surveys loaded successfully"),this.Ku({isLoaded:!0}))}Qu(t,i){xl.error(t,i),this.Ku({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.zu.push(t),this._surveyManager&&this.Ku({isLoaded:!0}),()=>{this.zu=this.zu.filter(i=>i!==t)}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.Hs)&&void 0!==e?e:this.Bu;if(r&&!this.Js){if(this._n.disableSurveys)return xl.info(Th),t([]);var s=r.kv.get(Tr);if(s&&!i)return t(s,{isLoaded:!0}),void(this.Xu()&&this.getSurveys(()=>{},!0));if(this.Uu)this.Uu.then(i=>{this.Js||t(i.surveys,i.context)}).catch(t=>xl.error("Error in survey callback",t));else{var n=this.Yu("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this._n.requestTimeoutMs}).then(t=>{try{return this.th(r,t)}catch(t){return xl.error("Error processing surveys response",t),this.th(r,{statusCode:0,error:t})}},t=>this.th(r,{statusCode:0,error:t}));this.Uu=n;var o=()=>{this.Uu===n&&(this.Uu=null)};n.then(i=>{o(),this.Js||t(i.surveys,i.context)},o).catch(t=>xl.error("Error in survey callback",t))}}}Yu(t,i){var e=this.Hs;return e?e.sendRequest(t,i):new Promise(t=>t({statusCode:0,error:new Error($h)}))}th(t,i){var e;if(this.Js)return{surveys:[],context:{isLoaded:!1,error:$h}};var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return 0!==r?xl.error(s):i.error||xl.warn(s),this.Wu=Date.now(),{surveys:[],context:{isLoaded:!1,error:s}}}this.Wu=null;var n=i.json.surveys||[],o=n.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(vl(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t)));return o.length>0&&(null==(e=this._surveyEventReceiver)||e.register(o)),t.kv.set({[Tr]:n,[Pr]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Xu(){return this.eh()&&!this.Uu&&!this.ih()}eh(){var t,i,e=null==(t=null!==(i=this.Hs)&&void 0!==i?i:this.Bu)?void 0:t.kv.get(Pr);return V(e)&&Date.now()-e>3e5}ih(){return V(this.Wu)&&3e5>Date.now()-this.Wu}markSurveyAsSeen(t,i){var e;El({id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Ku(t){for(var i of this.zu)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){xl.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!q(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);xl.warn("init was not called")}rh(t){var i=null;return this.getSurveys(e=>{var r;i=null!==(r=e.find(i=>i.id===t))&&void 0!==r?r:null}),i}nh(t){if(q(this._surveyManager))return{eligible:!1,reason:$h};var i="string"==typeof t?this.rh(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}sh(t){if(q(this._surveyManager))return{eligible:!1,reason:$h};var i="string"==typeof t?this.rh(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(q(this._surveyManager))return xl.warn("init was not called"),{visible:!1,disabledReason:$h};var i=this.sh(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return q(this._surveyManager)?(xl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:$h})):new Promise(e=>{this.getSurveys(i=>{var r,s=null!==(r=i.find(i=>i.id===t))&&void 0!==r?r:null;if(s){var n=this.sh(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var r;if(q(this._surveyManager))xl.warn("init was not called");else{var s="string"==typeof t?this.rh(t):t;if(null!=s&&s.id)if(kl.includes(s.type)){var n=null==u?void 0:u.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){xl.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout(()=>{var t,i;this.Vu.delete(o),this.Js||(xl.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),xl.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this.Vu.add(o)}else this._surveyManager.renderSurvey(s,n,e);else xl.warn("Survey element not found")}else xl.warn("Surveys of type "+s.type+" cannot be rendered in the app");else xl.warn("Survey not found")}}displaySurvey(t,i){var e;if(q(this._surveyManager))xl.warn("init was not called");else{var r=this.rh(t);if(r){var n=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=s({},r,{appearance:s({},r.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==Yo.Popover&&i.initialResponses&&xl.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.nh(r);if(!o.eligible)return void xl.warn("Survey is not eligible to be displayed: ",o.reason)}i.displayType!==Yo.Inline?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else xl.warn("Survey not found")}}cancelPendingSurvey(t){q(this._surveyManager)?xl.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}};function Rh(t,i,e){if(q(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}var Ch=class{constructor(t){this._instance=t,this.oh=new Set,this.ah=new Set,this.uh=new nl,this.hh=(t,i)=>this.dh(t,i)&&this.fh(t,i)&&this.ph(t,i)&&this.gh(t,i),this.dh=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;U(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.mh=null==(i=this._instance)?void 0:i._addCaptureHook((t,i)=>{this.on(t,i)}))}dispose(){var t;null==(t=this.mh)||t.call(this),this.mh=void 0,this.uh=new nl}register(t){var i,e;if(!U(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach(t=>{var i;this.oh.add(t),null==(i=t.steps)||i.forEach(t=>{this.ah.add((null==t?void 0:t.event)||"")})}),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.oh.forEach(t=>{var i;null==(i=t.steps)||i.forEach(t=>{null!=t&&t.selector&&r.add(t.selector)})}),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.oh.clear(),this.ah.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.ah.has(t)||this.ah.has(i.event))&&this.oh.forEach(t=>{this.yh(i,t)&&this.uh.emit("actionCaptured",t.name)})}bh(t){this.onAction("actionCaptured",i=>t(i))}yh(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.hh(t,e))return!0;return!1}onAction(t,i){return this.uh.on(t,i)}fh(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!Rh(r,i.url,i.url_matching||"contains"))return!1}return!0}ph(t,i){return!!this._h(t,i)&&!!this.wh(t,i)&&!!this.kh(t,i)}_h(t,i){var e;if(null==i||!i.href)return!0;var r=this.Sh(t);if(r.length>0)return r.some(t=>Rh(t.href,i.href,i.href_matching||"exact"));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&Rh((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}wh(t,i){var e;if(null==i||!i.text)return!0;var r=this.Sh(t);if(r.length>0)return r.some(t=>Rh(t.text,i.text,i.text_matching||"exact")||Rh(t.$el_text,i.text,i.text_matching||"exact"));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!q(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some(t=>Rh(t,n,o)))}kh(t,i){var e,r;if(null==i||!i.selector)return!0;if(null!=t&&null!=(e=t.properties)&&null!=(e=e.$element_selectors)&&e.includes(i.selector))return!0;var s=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&s)try{return new RegExp(i.selector_regex).test(s)}catch(t){return!1}return!1}Sh(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}gh(t,i){return null==i||!i.properties||0===i.properties.length||_l(i.properties.reduce((t,i)=>{var e=D(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)}},Oh=class{constructor(t){var i;this.xh=[],this._instance=t,this.Ch=new Map,this.Th=new Map,this.Mh=new Map,this.Ih=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId(t=>this.Eh(t))}Rh(t){return!1}Ah(){return null}Ph(t){}Fh(){}Oh(t,i){return!!t&&_l(t.propertyFilters,null==i?void 0:i.properties)}$h(t,i){var e=new Map;return t.forEach(t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach(i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}})}),e}Dh(t,i,e){var r=(e===Uo.Activation?this.Ch:this.Th).get(t),s=[];return this.Lh(t=>{s=t.filter(t=>null==r?void 0:r.includes(t.id))}),s.filter(r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find(i=>i.name===t);return this.Oh(n,i)})}register(t){this.Nh(t,!1)}replace(t){this.Nh(t,!0)}Nh(t,i){var e;U(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.qh(t,i),this.jh(t,i))}jh(t,i){var e=t.filter(t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length});if(i&&this.Mh.clear(),0!==e.length){this.Bh||(this.Bh=new Ch(this._instance),this.Bh.init(),this.Bh.bh(t=>this.onAction(t)));var r=[];e.forEach(t=>{var i;null==(i=t.conditions)||null==(i=i.actions)||i.values.forEach(i=>{if(r.push(i),i.name){var e,s=null!==(e=this.Mh.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.Mh.set(i.name,s)}})}),i?this.Bh.replace(r):this.Bh.register(r)}else{var s;i&&(null==(s=this.Bh)||s.replace([]))}}Hh(t,i){i.forEach((i,e)=>{var r,s=null!==(r=t.get(e))&&void 0!==r?r:[];i.forEach(t=>{s.includes(t)||s.push(t)}),t.set(e,s)})}qh(t,i){var e,r,s=t.filter(t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0}),n=t.filter(t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}),o=this.$h(t,Uo.Activation),a=this.$h(t,Uo.Cancellation);i?(this.Ch=o,this.Th=a):(this.Hh(this.Ch,o),this.Hh(this.Th,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.mh)&&void 0!==e||(this.mh=null==(r=this._instance)?void 0:r._addCaptureHook((t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,r,s=this.zh(),n=(null==i||null==(e=i.properties)?void 0:e.$survey_id)||(null==i||null==(r=i.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.Uh(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Wh([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Vh(n),void this.Gh([n])}if(this.Th.has(t)){var a=this.Dh(t,i,Uo.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map(t=>t.id)}),this.Wh(a.map(t=>t.id)),a.forEach(t=>this.Zh(t.id)))}if(this.Ch.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.Ch.get(t)});var l=this.Dh(t,i,Uo.Activation);this.Jh(l.map(t=>t.id))}}onAction(t){this.Mh.has(t)&&this.Jh(this.Mh.get(t)||[])}Jh(t){var i;if(0!==t.length){var e=!(null==(i=this._instance)||null==i.get_session_id||!i.get_session_id()),r=[];for(var s of t)e&&this.Rh(s)?this.Vh(s)&&this.Qh(s):r.push(s);r.length>0&&(this.xh=[...new Set([...this.xh,...r])]),this.zh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Vh(t){this.xh=this.xh.filter(i=>i!==t);var i=this.Kh();return!i.includes(t)&&(this.Xh([...i,t]),this.Yh(),!0)}Wh(t){var i=new Set(t);this.xh=this.xh.filter(t=>!i.has(t));var e=this.td(),r=e.filter(t=>!i.has(t));r.length!==e.length&&(this.Xh(r),0===r.length&&this.ed()),this.Gh(t)}rd(){var t,i=this.Ah();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}Qh(t){if(this.Ah()){var i=this.rd();this.Ph(s({},i,{[t]:Date.now()}))}}Gh(t){if(this.Ah()){var i=this.rd(),e={},r=!1;for(var s of Object.entries(i)){var n=s[0],o=s[1];t.includes(n)?r=!0:e[n]=o}r&&(j(e)?this.Fh():this.Ph(e))}}nd(){this.Ah()&&this.Fh()}getActivationTimestamp(t){if(this.Kh().includes(t)){var i=this.rd()[t];return V(i)?i:void 0}}td(){var t,i=this.sd();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}Kh(){var t,i,e=this.td();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.od()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}Yh(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.ad(i)}ed(){this.ld()}Eh(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.od()];if(e&&e!==t){var r=this.td(),s=this.rd();r.length>0&&(this.Xh([]),r.filter(t=>V(s[t])).forEach(t=>this.Zh(t))),this.ed(),this.nd()}}getActivatedIds(){return[...new Set([...this.Kh(),...this.xh])].filter(t=>!this.ud(t))}dispose(){var t,i,e;null==(t=this.Ih)||t.call(this),this.Ih=void 0,null==(i=this.mh)||i.call(this),this.mh=void 0,null==(e=this.Bh)||e.dispose(),this.Bh=void 0}reset(){this.xh=[],this.td().length>0&&this.Xh([]),this.ed(),this.nd()}getEventToItemsMap(){return this.Ch}hd(){return this.Bh}},Ah=class extends Oh{constructor(t){super(t)}sd(){return Rr}od(){return Cr}Ah(){return Or}Ph(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Or]:t})}Fh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Or)}Rh(t){var i,e;this.Lh(i=>{e=i.find(i=>i.id===t)});var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return V(r)&&r>0}dd(){return Ko.SHOWN}Lh(t){var i;null==(i=this._instance)||i.getSurveys(t)}Zh(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}zh(){return xl}Xh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Rr]:t})}ad(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Cr]:t})}ld(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Cr)}ud(){return!1}Uh(t,i){var e;return this.Lh(t=>{e=t.find(t=>t.id===i)}),!e||function(t){var i;return vl(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e)?t===Ko.SHOWN?"consume":"ignore":t===Ko.SHOWN?"persist":t===Ko.DISMISSED||t===Ko.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Ih=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var i={};for(var e of t){var r=this._instance.get_property(e);U(r)||(i[e]=r)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},Fh=class{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=null==b?void 0:b.__PosthogExtensions__;if(t){var i=t.generateSurveys,e=t.loadExternalDependency;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new Ah(this._instance)}},Mh=null!=a&&a.location?uo(a.location.hash,"__posthog")||uo(location.hash,"state"):null,Dh="_postHogToolbarParams",Nh=Re("[Toolbar]"),Lh=Re("[FeatureFlags]"),jh=class{constructor(t,i){void 0===i&&(i=!1),this.vd=!1,this.update(t,i)}update(t,i){this.fd=((t,i)=>{var e,r,s,n,o;return{bootstrap:{featureFlags:null==(e=t.bootstrap)?void 0:e.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},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!==(s=t.remote_config_refresh_interval_ms)&&void 0!==s?s:3e5,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(n=null!==(o=t.evaluation_contexts)&&void 0!==o?o:t.evaluation_environments)&&void 0!==n?n:[],flagKeys:D(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.vd||(Lh.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.vd=!0),U(t.flag_keys)||D(t.flag_keys)||Lh.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.fd}},Uh=Re("[FeatureFlags]"),Bh=Re("[FeatureFlags]",{debugEnabled:!0}),zh="\" failed. Feature flags didn't load in time.",Hh="connection_error",qh=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},Vh=t=>{var i={};for(var e of Ss(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},Wh=t=>Q(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Gh=Re("[Error tracking]"),Kh="webkit-masked-url:",Jh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Kh],Yh=["__firefox__","__gCrWeb"],Xh="Refusing to render web experiment since the viewer is a likely bot",Qh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>cl(i,t),not_regex:(t,i)=>!cl(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},Zh=Re("[Conversations]"),tu="Conversations not available yet.";function iu(t,i){var e,r,n,o,a,l,u,d=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,v=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,c=null!=i&&i.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,f=U(c)?Math.max(v,2048):Math.max(v,c),p=s({},function(){var t="",i="";try{var e=null==h?void 0:h.userAgent;if(e){var r=si(e);t=r[0],i=r[1]}}catch(t){}return function(t,i){var e=function(t){if(t)return{}.hasOwnProperty.call(pe,t)?pe[t]:t}(t);return s({},e?{"os.name":e}:{},i?{"os.version":i}:{})}(t,i)}(),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==p?void 0:p["service.name"])&&void 0!==a?a:null==t?void 0:t.serviceName)&&void 0!==o?o:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==p?void 0:p["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(u=null==p?void 0:p["deployment.environment"])&&void 0!==u?u:null==t?void 0:t.environment,resourceAttributes:p,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:d,maxBufferSize:v,maxQueueSize:f,maxBatchRecordsPerPost:100,rateCapWindowMs:d,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var eu=["debug","log","warn","error","info"],ru="console",su="__posthogHandledLogsRequestError",nu=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[su]=!0,e},ou=t=>!!t&&"object"==typeof t&&!0===t[su],au={featureFlags:class{constructor(t){this.name="featureFlags",this.pd=!1,this.featureFlagEventHandlers=[],this.A=Uh,this.gd={},this.md={},this.yd=[],this.bd=!1,this._d=!1,this.wd=0,this.kd=!1,this.Sd=!1,this.xd=!1,this.Cd=!1,this.Td=0,this.Ve=()=>{var t=this.Md();this.Td=0,t&&this.reloadFeatureFlags()},this.Id=()=>{var t,i=this.Ed;U(i)||this._n.remoteRequestsDisabled||!u||"hidden"===u.visibilityState||Date.now()-(null!==(t=this.Rd)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.Ad())},this.Ze=()=>{"visible"===(null==u?void 0:u.visibilityState)&&this.Id()},"get"in t?this.Us=t:(this._instance=t,this.Pd=new jh(t.config,t.Ma()),this.Us=this.Pd)}updateConfig(t,i){var e;null==(e=this.Pd)||e.update(t,i),this.Hs&&this.Fd()}setup(t){return this.Zu=t,this.A=t.logger.createLogger("[FeatureFlags]"),kh(t.kv.initialize(),()=>{this.Zu===t&&(this.Zu=void 0,this.Hs=t,this.Od(t))})}Od(t){var i;if(this.Hs===t)return a&&Rs(a,"online",this.Ve),this.Fd(),this.$d=t.registerDynamicEventProperties(()=>this.Dd()?this.gd:this.md),this.Ld=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.onCrossTabFeatureFlagChange(()=>{this.Nd(),this.qd(),this.jd()}),this.qd(),this.initialize()}Fd(){var t=this._n.refreshIntervalMs,i=!this._n.remoteRequestsDisabled&&u&&!U(t)&&t>0?t:void 0;i!==this.Ed&&(this.Bd(),U(i)||(this.Ed=i,this.Ad(),null!=u&&u.addEventListener&&Rs(u,cs,this.Ze)))}Ad(){U(this.Ed)||(U(this.Hd)||clearInterval(this.Hd),this.Rd=Date.now(),this.Hd=setInterval(this.Id,this.Ed))}Bd(){U(this.Hd)||(clearInterval(this.Hd),this.Hd=void 0,null==u||null==u.removeEventListener||u.removeEventListener(cs,this.Ze)),this.Ed=void 0,this.Rd=void 0}destroy(){this.zd()}dispose(){this.zd()}zd(){var t,i;this.Bd(),this.wd++,this.Sd=!1,this.Zu=void 0,this.Hs&&(this.Ud(),null==(t=this.$d)||t.dispose(),this.$d=void 0,null==(i=this.Ld)||i.call(this),this.Ld=void 0,this.yd=[],null==a||a.removeEventListener("online",this.Ve),this.Hs=void 0)}get _n(){return this.Us.get()}Wd(t){var i;return this.Vd&&t in this.Vd?this.Vd[t]:null==(i=this.Hs)?void 0:i.kv.get(t)}Nd(){return!!this.Vd&&(this.Vd=void 0,!0)}Gd(){var t;return!U(null==(t=this.Hs)?void 0:t.kv.get("$enabled_feature_flags"))&&this.Nd()}ui(t){this.Zd(()=>{var i;return null==(i=this.Hs)?void 0:i.kv.set(t)})}Jd(t,i,e){var r;if(null!=(r=this._instance)&&r.persistence&&t.$enabled_feature_flags){var s=this.Wd("$enabled_feature_flags")||{},n=t.$enabled_feature_flags||{},o=i.flags||i.featureFlags,a=i.flags?Object.entries(i.flags).filter(t=>{var i=t[1];return!(null!=i&&i.failed)}).map(t=>t[0]):[],l=!!i.errorsWhileComputingFlags&&!!i.flags,h=l?a:e&&!D(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.Wd("$feature_flag_payloads")||{},d=t.$feature_flag_payloads||{},v=l||e?h:Array.from(new Set([...Object.keys(u),...Object.keys(d)])),c=!l&&!e,f=!!c||h,p=!!c||v,_={[_r]:f,[pr]:f,[br]:p};for(var g of(t.$feature_flag_details&&(_[mr]=f),[yr,zr,wr]))U(t[g])||(_[g]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(_)}}hi(t){this.Zd(()=>{var i;return null==(i=this.Hs)?void 0:i.kv.remove(t)})}Zd(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}qd(){var t={};for(var i of[_r,br,yr,Sr]){var e=this.Wd(i);U(e)||(t[i]=e)}this.gd=t;var r=s({},t),n=this.Wd(pr);if(n)for(var o of Object.entries(n))r["$feature/"+o[0]]=o[1];this.md=r}Dd(){var t=this._n.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Wd(zr);return"number"!=typeof i||Date.now()-i>t}Qd(){return!!this.Dd()&&(this.Cd||this._d||(this.Cd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Kd(){var t=this._n.evaluationContexts;return null!=t&&t.length?t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}Xd(){var t=this._n.flagKeys;if(!U(t))return t.filter(t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var t,i,e=this._n,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter(t=>!U(r[t])).reduce((t,i)=>(t[i]=r[i],t),{}),l=Object.keys(o).filter(t=>a[t]).reduce((t,i)=>(t[i]=o[i],t),{});return this.Yd({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(t,i,e){var r,n,o=null!=e&&e.merge&&null!==(r=this.Wd("$enabled_feature_flags"))&&void 0!==r?r:{},a=null!=e&&e.merge&&null!==(n=this.Wd("$feature_flag_payloads"))&&void 0!==n?n:{},l=s({},o,t),h=s({},a,i),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Qi(c),variant:Zi(c),reason:void 0,metadata:U(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.Yd({flags:u})}get hasLoadedFlags(){return this.bd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Wd(mr),i=this.Wd(Sr),e=this.Wd(xr);if(!e&&!i)return t||{};var r=ws({},t||{});for(var n of[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])]){var o,a,l=r[n],h=null==i?void 0:i[n],u=U(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=U(h)?null==l?void 0:l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=s({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=s({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.pd||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.pd=!0),r}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{var r=t[e];return{key:e,enabled:Qi(r),variant:Zi(r),payload:Xi(i[e])}})}getFlagVariants(){var t=this.Wd(pr),i=this.Wd(Sr);if(!i)return t||{};for(var e=ws({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.pd||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.pd=!0),e}getFlagPayloads(){var t=this.Wd(br),i=this.Wd(xr);if(!i)return t||{};for(var e=ws({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.pd||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.pd=!0),e}reloadFeatureFlags(){this.kd||this._n.featureFlagsDisabled||this.Md()||(this._d&&(this.Sd=!0),this.tv||(this.yd.slice().forEach(t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.tv=setTimeout(()=>{this.ev()},5)))}Ud(){clearTimeout(this.tv),this.tv=void 0}onReloading(t){return this.yd.push(t),()=>{this.yd=this.yd.filter(i=>i!==t)}}ensureFlagsLoaded(){this.bd||this._d||this.tv||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.kd=t}resetFlagCallReported(){this.hi(jr)}ev(t){this.Ud();var i=this.Hs;if(i&&!this._n.remoteRequestsDisabled&&!this.Md())if(this._d)this.Sd=!0;else{var e={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:s({},i.initialPersonProperties,this.Wd("$stored_person_properties")||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Wd(kr),timezone:$o()};U(i.deviceId)||(e.$device_id=i.deviceId),(null!=t&&t.disableFlags||this._n.featureFlagsDisabled)&&(e.disable_flags=!0);var r=this.Kd();r.length&&(e.evaluation_contexts=r);var n=this.Xd();U(n)||(e.flag_keys=n);var o=this._n.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.wd;this._d=!0;var h=()=>{this.Sd&&(this.Sd=!1,this.ev())},u=t=>{this._d=!1,l===this.wd?(this.ui({[Br]:[Hh]}),this.A.error("Feature flag request failed",t),this.Gd()&&this.jd(!0),h()):h()};try{i.sendRequest(a,{target:"flags",method:"POST",body:e,compression:this._n.compression,sentAt:"body",timeoutMs:this._n.requestTimeoutMs}).then(t=>{var i,r,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this._d=!1,l===this.wd){if(this.iv(t.statusCode),n||this.Sd||(this.$anon_distinct_id=void 0),!e.disable_flags||this.Sd){this.xd=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Hh:"unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var u=!(null==(r=s.quotaLimited)||!r.includes("feature_flags"));u&&a.push("quota_limited"),this.ui({[Br]:a}),u?this.A.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):e.disable_flags||this.Yd(s,n,{partialResponse:o}),h()}}else h()}).catch(u)}catch(t){u(t)}}}Md(){return vo(this.Td,3)}iv(t){this.Td=co(t,this.Td,3,()=>this.A.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.xd)if(this.bd||this.getFlags()&&this.getFlags().length>0){if(!this.Qd()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else this.A.warn('getFeatureFlag for key "'+t+zh)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i;return null==(i=this.getFeatureFlagResult(t,{send_event:!1}))?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.xd)if(this.bd||this.getFlags()&&this.getFlags().length>0){if(!this.Qd()){var e,r=this.getFlagVariants(),n=t in r,o=r[t],a=this.getFlagPayloads()[t],l=String(o),h=this.Wd("$feature_flag_request_id")||void 0,u=this.Wd("$feature_flag_evaluated_at")||void 0,d=this.Wd("$flag_call_reported")||{};if(this._n.deduplicateCallsPerSession){var v,c=null==(v=this.Hs)?void 0:v.session.sessionId,f=this.Wd(Ur);c&&c!==f&&(d={},e=c)}if(i.send_event||!("send_event"in i))if(t in d&&d[t].includes(l))e&&this.ui({[jr]:d,[Ur]:e});else{var p,_,g,m,b,y,w,S,x,E,k,T,P;D(d[t])?d[t].push(l):d[t]=[l],this.ui(s({[jr]:d},e?{[Ur]:e}:{}));var R=this.getFeatureFlagDetails(t),C=[...null!==(p=this.Wd("$feature_flag_errors"))&&void 0!==p?p:[]];U(o)&&C.push("flag_missing");var O={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(_=null==(g=this._n.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(m=null==(b=this._n.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.xd};U(null==R||null==(y=R.metadata)?void 0:y.has_experiment)||(O.$feature_flag_has_experiment=R.metadata.has_experiment),U(null==R||null==(w=R.metadata)?void 0:w.version)||(O.$feature_flag_version=R.metadata.version);var A=null!==(S=null==R||null==(x=R.reason)?void 0:x.description)&&void 0!==S?S:null==R||null==(E=R.reason)?void 0:E.code;A&&(O.$feature_flag_reason=A),null!=R&&null!=(k=R.metadata)&&k.id&&(O.$feature_flag_id=R.metadata.id),U(null==R?void 0:R.original_variant)&&U(null==R?void 0:R.original_enabled)||(O.$feature_flag_original_response=U(R.original_variant)?R.original_enabled:R.original_variant),null!=R&&null!=(T=R.metadata)&&T.original_payload&&(O.$feature_flag_original_payload=null==R||null==(P=R.metadata)?void 0:P.original_payload),C.length&&(O.$feature_flag_error=C.join(",")),this.rv(O)}else e&&this.ui({[jr]:d,[Ur]:e});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Xi(a)}}}else this.A.warn('getFeatureFlagResult for key "'+t+zh)}rv(t){try{var i;null==(i=this.Hs)||i.capture("$feature_flag_called",t).catch(t=>{this.A.error("Failed to capture feature flag call",t)})}catch(t){this.A.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.nv(t,i)}nv(t,i){var e=this;return o(function*(){var r=e.Hs;if(r){var s={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},n=e.Kd();n.length&&(s.evaluation_contexts=n);var o,a=e.Xd();U(a)||(s.flag_keys=a);try{var l;o=(null==(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:e._n.compression,sentAt:"body",timeoutMs:e._n.requestTimeoutMs})).json)||null==(l=l.featureFlagPayloads)?void 0:l[t])||void 0}catch(t){return void e.A.error("Remote config feature flag request failed",t)}try{i(o)}catch(t){e.A.error("Remote config feature flag callback failed",t)}}})()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.xd)return i.defaultValue;if(!(this.bd||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+zh),i.defaultValue;var e=this.getFeatureFlag(t,i);return U(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.Yd(t,i,e)}Yd(t,i,e){if(this.Hs){this.bd=!0;var r=function(t,i,e,r,n,o){void 0===i&&(i={}),void 0===e&&(e={}),void 0===r&&(r={}),void 0===o&&(o=Uh);var a=((t,i)=>{var e=t.flags;return e?s({},t,{featureFlags:Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return!U(null==(i=e[t].metadata)?void 0:i.payload)}).map(t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]}))}):(t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,o),l=a.flags,h=a.featureFlags,u=a.featureFlagPayloads;if(h){var d=t.requestId,v=t.evaluatedAt;if(D(h)){o.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(h)for(var f=0;h.length>f;f++)c[h[f]]=!0;return{[_r]:h,[pr]:c,[wr]:!1}}var p=h,_=u,g=l;if(null!=n&&n.partialResponse){var m=Object.keys(p),b=_||{};p=s({},i,p),_=s({},e,b),m.forEach(t=>{var i;t in b||null==(i=_)||delete i[t]}),g=s({},r,g)}else if(t.errorsWhileComputingFlags)if(l){var y=new Set(Object.keys(l).filter(t=>{var i;return!(null!=(i=l[t])&&i.failed)}));p=s({},i,Object.fromEntries(Object.entries(p).filter(t=>y.has(t[0]))));var w=Object.fromEntries(Object.entries(_||{}).filter(t=>y.has(t[0])));_=s({},e,w),y.forEach(t=>{var i;t in w||null==(i=_)||delete i[t]}),g=s({},r,Object.fromEntries(Object.entries(g||{}).filter(t=>y.has(t[0]))))}else p=s({},i,p),_=s({},e,_),g=s({},r,g);return s({[_r]:Object.keys(Vh(p)),[pr]:p||{},[br]:_||{},[mr]:g||{},[wr]:!0===t.minimalFlagCalledEvents},d?{[yr]:d}:{},v?{[zr]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.A);if(r)if(!1===(null==e?void 0:e.persist)){var n=!U(this.Hs.kv.get(pr));this.Vd=r,n||this.ui(r)}else this.Nd(),this.Jd(r,t,!(null==e||!e.partialResponse)),this.ui(r);else i&&this.Gd();i||(this.Cd=!1),this.jd(i)}}override(t,i){void 0===i&&(i=!1),this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.sv(t)}sv(t){if(this.Hs){if(!1===t)return this.hi([Sr,xr]),this.jd(),void Bh.info("All overrides cleared");if(D(t))return this.ui({[Sr]:qh(t)}),this.jd(),void Bh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.pd=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[Sr]=D(s)?qh(s):s),n&&(r[xr]=n),Object.keys(r).length&&this.ui(r),!1===s&&!1===n?this.hi([Sr,xr]):!1===s?this.hi(Sr):!1===n&&this.hi(xr),this.jd(),!1===s?Bh.info("Flag overrides cleared"):s&&Bh.info("Flag overrides set",{flags:s}),void(!1===n?Bh.info("Payload overrides cleared"):n&&Bh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.ui({[Sr]:t}),this.jd(),void Bh.info("Flag overrides set",{flags:t});this.A.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.A.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.bd){var i=this.ov(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,n=(this.Wd("$early_access_features")||[]).find(i=>i.flagKey===t),o={["$feature_enrollment/"+t]:i},a={$feature_flag:t,$feature_enrollment:i,$set:o};n&&(a.$early_access_feature_name=n.name),e&&(a.$feature_enrollment_stage=e);var l=s({},this.getFlagVariants(),{[t]:i});null==(r=this._instance)||null==(r=r.persistence)||r.markCrossTabFeatureFlagChanges({[_r]:[t],[pr]:[t],[Er]:Object.keys(o)}),this.ui({[_r]:Object.keys(Vh(l)),[pr]:l,[Er]:s({},this.Wd("$stored_person_properties")||{},o)}),this.jd();try{var h;null==(h=this.Hs)||h.capture("$feature_enrollment_update",a).catch(t=>{this.A.error("Failed to capture early access feature enrollment",t)})}catch(t){this.A.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Wd(gr);!r||i?this.av(t,e):t(r)}av(t,i){var e=this;return o(function*(){var r=e.Hs;if(r){var s,n=i?"&"+i.map(t=>"stage="+t).join("&"):"";try{var o=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;s=o.json.earlyAccessFeatures,e.ui({[gr]:s})}catch(t){return void e.A.error("Early access feature request failed",t)}try{t(s)}catch(t){e.A.error("Early access feature callback failed",t)}}})()}ov(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter(t=>i[t]),flagVariants:Object.keys(i).filter(t=>i[t]).reduce((t,e)=>(t[e]=i[e],t),{})}}jd(t){this.qd();var i=this.ov(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach(i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.A.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.lv(t,i)}lv(t,i){void 0===i&&(i=!0);var e=this.Wd("$stored_person_properties")||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in e||(o[a]=n[a]));this.ui({[Er]:s({},e,o,r)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=s({},this.Wd("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.ui({[Er]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.hi(Er),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.Wd("$stored_group_properties")||{},r=s({},e);for(var n of Object.keys(t))r[n]=s({},e[n],t[n]);this.ui({[kr]:r}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Wd("$stored_group_properties")||{};this.ui({[kr]:s({},i,{[t]:{}})})}else this.hi(kr)}reset(){this.wd++,this.Sd=!1,this.gd={},this.md={},this.Vd=void 0,this.bd=!1,this.kd=!1,this.xd=!1,this.$anon_distinct_id=void 0,this.Ud(),this.pd=!1,this.Td=0}}},lu={sessionRecording:class{get _n(){return this._instance.config}get Ya(){return this._instance.persistence}get started(){var t;return!(null==(t=this.uv)||!t.isStarted)}get status(){var t,i;return"awaiting_config"===this.hv||"missing_config"===this.hv?this.hv:null!==(t=null==(i=this.uv)?void 0:i.status)&&void 0!==t?t:this.hv}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.hv=_h,this.dv=void 0,this.vv=!1,this.je=(()=>{var t;if(null==u||!u.visibilityState||"visible"===u.visibilityState)return!0;var i=null==a||null==(t=a.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some(t=>"visible"===t.name)})(),this.Ze=()=>{var t;"visible"===(null==u?void 0:u.visibilityState)&&(this.je=!0,null==(t=this.uv)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},!this._instance.sessionManager)throw mh.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this._n.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');null!=u&&u.addEventListener&&Rs(u,"visibilitychange",this.Ze)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.vv=!0,null==u||null==u.removeEventListener||u.removeEventListener("visibilitychange",this.Ze),e?this.fv(!0):this.stopRecording()}get pv(){var t,i=!(null==(t=this._instance.get_property(ir))||!t.enabled),e=!this._n.disable_session_recording,r=this._n.disable_session_recording||this._instance.consent.isOptedOut();return a&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.vv||this.pv&&null!=(i=this.uv)&&i.isStarted)){var e=!U(Object.assign)&&!U(Array.from);this.pv&&e?(this.gv(t),mh.info("starting")):(this.hv=_h,this.stopRecording())}}gv(t){var i,e;if(this.pv)if("awaiting_config"!==this.hv&&"missing_config"!==this.hv&&(this.hv=gh),null!=b&&null!=(i=b.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=b.__PosthogExtensions__)&&e.initSessionRecording)this.mv(t);else{var r,s=this._instance.sessionManager;null==(r=b.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.yv,i=>{if(!this.vv&&this.pv&&this._instance.sessionManager===s)return i?(this._instance.register_for_session({[ts]:!0}),mh.error("could not load recorder",i)):void this.mv(t);this.hv=_h})}}stopRecording(){var t,i;null==(t=this.dv)||t.call(this),this.dv=void 0,null==(i=this.uv)||i.stop()}fv(t){var i,e;void 0===t&&(t=!1),null==(i=this.dv)||i.call(this),this.dv=void 0,null==(e=this.uv)||e.discard({discardProducerEvents:t})}bv(){var t,i;null==(t=this.Ya)||t.unregister(hr),null==(i=this.Ya)||i.unregister(rr)}_v(t,i){if(q(t))return null;var e,r=V(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(mh.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}wv(t){if(this.Ya){var i,e,r=this.Ya,n=()=>{var i,e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this._v(null==(i=this._n.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this._v(null==e?void 0:e.sampleRate,"remote config sampleRate"),a=null!=n?n:o;q(a)&&this.bv();var l=null==e?void 0:e.minimumDurationMilliseconds;r.register({[ir]:s({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:s({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:a,minimumDurationMilliseconds:U(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.dv)||i.call(this),this.dv=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(n)}}onRemoteConfig(t){var i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.wv(i),void this.fv()):(this.wv(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.hv&&(this.hv="missing_config",mh.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.uv)&&e.log?this.uv.log(t,i):mh.warn("log called before recorder was ready")}get yv(){var t;return(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.get_property("$session_recording_remote_config"))||null==(t=t.scriptConfig)?void 0:t.script)||"lazy-recorder"}Sv(){var t,i=this._instance.get_property(ir);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return mh.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!q(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}mv(t){var i,e,r;if(!this.vv&&this.pv&&this._instance.sessionManager){if(null==(i=b.__PosthogExtensions__)||!i.initSessionRecording)return mh.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ts]:!0});var s;if(this.uv||(this.uv=null==(s=b.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.je),this.uv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Sv()){if("missing_config"===this.hv||"awaiting_config"===this.hv)return;return this.hv="awaiting_config",mh.info("persisted remote config is stale, requesting fresh config before starting"),void new sa(this._instance).load()}this.hv=gh,null==(e=(r=this.uv).setDocumentWasEverVisible)||e.call(r,this.je),this.uv.start(t)}else this.hv=_h}onRRwebEmit(t){var i;null==(i=this.uv)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.uv||null==(t=this.Ya)||t.register({[nr]:!0}),null==(i=this.uv)||i.overrideLinkedFlag()}overrideSampling(){var t,i;this.uv||null==(t=this.Ya)||t.register({[sr]:!0}),null==(i=this.uv)||i.overrideSampling()}overrideTrigger(t){var i,e;this.uv||null==(i=this.Ya)||i.register({["url"===t?or:ar]:!0}),null==(e=this.uv)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.uv)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.uv)||!e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t;null==(t=this.uv)||null==t.flushBeforeIdentityReset||t.flushBeforeIdentityReset()}}},hu={autocapture:class extends sh{constructor(t){super(new nh(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.xv=this.Cv()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.Tv();return!!(t.path||t.search||this.Mv(t))}startIfEnabled(){this.isEnabled&&(Pe.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.xv=this.Cv(),this.startIfEnabled()}stop(){this.Iv&&this.Iv(),this.Iv=void 0,this.Ev&&this.Ev(),this.Ev=void 0,Pe.info("History API monitoring stopped")}monitorHistoryChanges(){a&&a.history&&(this.Rv("pushState"),this.Rv("replaceState"),this.Av(),this.Mv()&&this.Pv())}Rv(t){var i;if(a&&(null==(i=a.history[t])||!i.__posthog_wrapped__)){var e=this;hh(a.history,t,i=>function(r,s,n){i.call(this,r,s,n),e.Fv(t)})}}Cv(){var t=null==a?void 0:a.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Tv(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:L(t)?t:{}}Mv(t){return void 0===t&&(t=this.Tv()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}Ov(t){var i=this.Tv(),e=this.xv;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.Mv(i)&&t.hash!==e.hash))}Fv(t){try{var i=this.Cv();if(!i)return;this.Ov(i)&&this._instance.capture(ps,{navigation_type:t}),this.xv=i}catch(i){Pe.error("Error capturing "+t+" pageview",i)}}Av(){if(!this.Iv){var t=()=>{this.Fv("popstate")};Rs(a,"popstate",t),this.Iv=()=>{a&&a.removeEventListener("popstate",t)}}}Pv(){if(!this.Ev){var t=()=>{this.Fv("hashchange")};Rs(a,"hashchange",t),this.Ev=()=>{a&&a.removeEventListener("hashchange",t)}}}},heatmaps:class{get _n(){return this.instance.config}constructor(t){var i;this.$v=!1,this.Ws=!1,this.Dv=null,this.instance=t,this.$v=!(null==(i=this.instance.persistence)||!i.props[We]),this.rageclicks=new Ql(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return L(this._n.capture_heatmaps)&&this._n.capture_heatmaps.flush_interval_milliseconds&&(t=this._n.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return q(this._n.capture_heatmaps)?q(this._n.enable_heatmaps)?this.$v:this._n.enable_heatmaps:!1!==this._n.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Ws)return;bh.info("starting..."),this.Lv(),this.Ze()}else{var t;clearInterval(null!==(t=this.Dv)&&void 0!==t?t:void 0),this.Nv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var i=t.config;if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[We]:e}),this.$v=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.Pe;return this.Pe=void 0,t}qv(t){yh(t.originalEvent)&&this.an(t.originalEvent,"deadclick")}Ze(){this.Dv&&clearInterval(this.Dv),this.Dv="visible"===(null==u?void 0:u.visibilityState)?setInterval(this.za.bind(this),this.flushIntervalMilliseconds):null}Lv(){a&&u&&(this.jv=this.za.bind(this),Rs(a,fs,this.jv),this.Bv=t=>this.an(t||(null==a?void 0:a.event)),Rs(u,"click",this.Bv,{capture:!0}),this.Hv=t=>this.zv(t||(null==a?void 0:a.event)),Rs(u,"mousemove",this.Hv,{capture:!0}),this.Uv=new Jn(this.instance,Gn,this.qv.bind(this)),this.Uv.startIfEnabledOrStop(),this.Wv=this.Ze.bind(this),Rs(u,cs,this.Wv),this.Ws=!0)}Nv(){var t;a&&u&&(this.jv&&a.removeEventListener(fs,this.jv),this.Bv&&u.removeEventListener("click",this.Bv,{capture:!0}),this.Hv&&u.removeEventListener("mousemove",this.Hv,{capture:!0}),this.Wv&&u.removeEventListener(cs,this.Wv),clearTimeout(this.Vv),null==(t=this.Uv)||t.stop(),this.Ws=!1)}Gv(t,i){var e=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,i,e){for(var r=t;r&&hn(r)&&!un(r,"body");){if(r===e)return!1;var s=void 0;try{var n,o,l;s=null==(n=null!==(o=null==(l=r.ownerDocument)?void 0:l.defaultView)&&void 0!==o?o:a)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(E(i,s))return!0;r=Sn(r)}return!1}(mn(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:e),target_fixed:n,type:i}}an(t,i){var e;if(void 0===i&&(i="click"),!ln(t.target)&&yh(t)){var r=this.Gv(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&Rn(mn(t),this.instance.config.rageclick)&&this.Is(s({},r,{type:"rageclick"})),this.Is(r)}}zv(t){!ln(t.target)&&yh(t)&&(clearTimeout(this.Vv),this.Vv=setTimeout(()=>{this.Is(this.Gv(t,"mousemove"))},500))}Is(t){if(a){var i=this._n.disable_capture_url_hashes?gi(a.location.href):a.location.href,e=this._n.custom_personal_data_properties,r=ho(i,this._n.mask_personal_data_properties?[...fo,...e||[]]:[],_o);this.Pe=this.Pe||{},this.Pe[r]||(this.Pe[r]=[]),this.Pe[r].push(t)}}za(){this.Pe&&!j(this.Pe)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Jn,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this.$v=!1,this.Ws=!1,this.Pe={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Zv=()=>{clearTimeout(this.Jv),this.Jv=void 0,0!==this.Pe.metrics.length&&(this._instance.capture("$web_vitals",s({$current_url:this.Pe.url},this.Pe.metrics.reduce((t,i)=>s({},t,{["$web_vitals_"+i.name+"_event"]:s({},i),["$web_vitals_"+i.name+"_value"]:i.value}),{}))),this.Pe={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Qv=t=>{var i;if(this.Pe=this.Pe||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},q(null==t?void 0:t.name)||q(null==t?void 0:t.value))dh.error("Invalid metric received",t);else{var e="string"==typeof t.navigationURL?t.navigationURL:void 0,r=this.Kv(e);if(!U(r)){var n=V(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+r;if(!this.Xv||this.Xv>t.value){this.Pe.navigationKey!==n&&(this.Zv(),this.Jv=setTimeout(this.Zv,this.flushToCaptureTimeoutMs)),U(this.Pe.navigationKey)&&(this.Pe.navigationKey=n,this.Pe.url=r),this.Pe.firstMetricTimestamp=U(this.Pe.firstMetricTimestamp)?Date.now():this.Pe.firstMetricTimestamp;var o=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),a=s({},t,e?{navigationURL:r}:{},{$current_url:r,timestamp:Date.now()});if(delete a.entries,L(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of ph){var u="url"===h&&"string"==typeof t.attribution[h]?this.Kv(t.attribution[h]):t.attribution[h];U(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;U(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.Pe.metrics.push(a),this.Pe.metrics.length===this.allowedMetrics.length&&this.Zv()}else dh.error("Ignoring metric with value >= "+this.Xv,t)}}},this.Yv=()=>{if(!this.Ws){var t,i,e,r,n=!1,o=b.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.tc])||("web-vitals"===this.tc&&U(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!U(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!U(h),t=u.indexOf("LCP")>-1?l.onLCP:(null==h?void 0:h.onLCP)||l.onLCP,i=u.indexOf("CLS")>-1?l.onCLS:(null==h?void 0:h.onCLS)||l.onCLS,e=u.indexOf("FCP")>-1?l.onFCP:(null==h?void 0:h.onFCP)||l.onFCP,r=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&i&&e&&r){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?s({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Qv.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Qv.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&e(this.Qv.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&r(this.Qv.bind(this),v),this.Ws=!0}else dh.error("web vitals callbacks not loaded - not starting")}},this.$v=!(null==(i=this._instance.persistence)||!i.props[Ye]),this.startIfEnabled()}get ec(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=L(this.ec)?null==(t=this.ec)?void 0:t.web_vitals_allowed_metrics:void 0;return q(e)?(null==(i=this._instance.persistence)?void 0:i.props.$web_vitals_allowed_metrics)||ch:e}get flushToCaptureTimeoutMs(){return(L(this.ec)?this.ec.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=L(this.ec)?this.ec.web_vitals_attribution:void 0;return G(t)?t?ch:[]:D(t)?t:fh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t;return null!==(t=L(this.ec)?this.ec.__preview_web_vitals_soft_navs:void 0)&&void 0!==t&&t}get Xv(){var t=L(this.ec)&&V(this.ec.__web_vitals_max_value)?this.ec.__web_vitals_max_value:vh;return t>0&&6e4>=t?vh:t}get isEnabled(){var t=null==d?void 0:d.protocol;if("http:"!==t&&"https:"!==t)return dh.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=L(this.ec)?this.ec.web_vitals:G(this.ec)?this.ec:void 0;return G(i)?i:this.$v}startIfEnabled(){this.isEnabled&&!this.Ws&&(dh.info("enabled, starting..."),this.do(this.Yv))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=L(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=L(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Ye]:e}),this._instance.persistence.register({[tr]:r})),this.$v=e,this.startIfEnabled()}}}get tc(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}do(t){var i=b.__PosthogExtensions__,e=this.tc,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&U(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,i=>{i?dh.error("failed to load script",i):t()})}Kv(t){var i=t||(null==a?void 0:a.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?gi(i):i,r=this._instance.config.custom_personal_data_properties;return ho(e,this._instance.config.mask_personal_data_properties?[...fo,...r||[]]:[],_o)}dh.error("Could not determine current URL")}}},uu={exceptionObserver:class{constructor(t){var i;this.Yv=()=>{var t;if(a&&this.isEnabled&&null!=(t=b.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=b.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=b.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=b.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.rc&&this._n.capture_unhandled_errors&&(this.rc=i(this.captureException.bind(this))),!this.nc&&this._n.capture_unhandled_rejections&&(this.nc=e(this.captureException.bind(this))),!this.sc&&this._n.capture_console_errors&&(this.sc=r(this.captureException.bind(this)))}catch(t){oh.error("failed to start",t),this.oc()}}},this._instance=t,this.ac=!(null==(i=this._instance.persistence)||!i.props[Ge]),this.wt=new nt(s({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,A:oh})),this._n=this.lc(),this.startIfEnabledOrStop()}lc(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return L(t)?i=s({},i,t):(U(t)?this.ac:t)&&(i=s({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this._n.capture_console_errors||this._n.capture_unhandled_errors||this._n.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(oh.info("enabled"),this.oc(),this.do(this.Yv)):this.oc()}do(t){var i,e;null!=(i=b.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=b.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return oh.error("failed to load script",i);t()})}oc(){var t,i,e;null==(t=this.rc)||t.call(this),this.rc=void 0,null==(i=this.nc)||i.call(this),this.nc=void 0,null==(e=this.sc)||e.call(this),this.sc=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.ac=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Ge]:this.ac}),this._n=this.lc(),this.startIfEnabledOrStop())}}onConfigChange(){this._n=this.lc()}captureException(t){try{var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";if(this.wt.consumeRateLimit(s))return void oh.info("Skipping exception capture because of client rate limiting.",{exception:s});null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var i,e;this.uc=[],this.hc=new Si([new Ii,new Hi,new Mi,new Fi,new Bi,new Ui,new Ni,new zi],function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];return function(i,r){void 0===r&&(r=0);for(var n=[],o=i.split("\n"),a=r;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=Ai.test(l)?l.replace(Ai,"$1"):l;if(!h.match(/\S*Error: /)){for(var u of e){var d=u(h,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return s({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",Pi,Oi)),this._instance=t,this.uc=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this.dc=Ki(this.vc()),this.cc=new Ji(this.dc)}onConfigChange(){this.dc=Ki(this.vc()),this.cc.setConfig(this.dc)}onRemoteConfig(t){var i,e,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(i=null==(e=s.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.uc=n,this._instance.persistence&&this._instance.persistence.register({[Ke]:this.uc,[Je]:o})}}}get fc(){var t,i,e=!!this._instance.get_property(Je);return null!==(t=null!==(i=this._instance.config.error_tracking.captureExtensionExceptions)&&void 0!==i?i:e)&&void 0!==t&&t}buildProperties(t,i){return this.hc.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.dc.enabled)try{if(!B(t)||0===t.trim().length)return void Gh.warn("Ignoring exception step because message must be a non-empty string");var e=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var i=[];return{sanitizedProperties:Object.keys(t).reduce((e,r)=>Wi.has(r)?(i.push(r),e):(e[r]=t[r],e),{}),droppedKeys:i}}(this.gc(i)),r=e.sanitizedProperties,n=e.droppedKeys;n.length>0&&Gh.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.cc.add(s({[qi]:t,[Vi]:(new Date).toISOString()},r))}catch(t){Gh.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.mc(i)){if(this.yc(i))return this.bc("Exception dropped: matched a suppression rule"),void Gh.info("Skipping exception capture because a suppression rule matched");if(!this.fc&&this._c(i))return this.bc("Exception dropped: thrown by a browser extension"),void Gh.info("Skipping exception capture because it was thrown by an extension");if(!this.fc&&this.wc(i))return this.bc("Exception dropped: thrown by an injected browser script"),void Gh.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.kc(i))return this.bc("Exception dropped: thrown by the PostHog SDK"),void Gh.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.dc.enabled&&q(t.$exception_steps)?this.Sc(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",Iu:!0});return s&&this.cc.clear(),s}catch(t){return Wh(t)||Gh.error("Failed to capture exception event. Dropping this exception.",t),void this.cc.clear()}}catch(t){return void(Wh(t)||Gh.error("Failed to process exception event. Ignoring this exception.",t))}var n}Sc(t){try{var i=this.cc.getAttachable();return 0===i.length?t:s({},t,{$exception_steps:i})}catch(i){return Gh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}bc(t){this.dc.enabled&&this.cc.add({[qi]:t,[Vi]:(new Date).toISOString()})}gc(t){return L(t)?s({},t):{}}vc(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}yc(t){if(0===t.length)return!1;try{var i=t.reduce((t,i)=>{var e=i.type,r=i.value;return B(e)&&e.length>0&&t.$exception_types.push(e),B(r)&&r.length>0&&t.$exception_values.push(r),t},{$exception_types:[],$exception_values:[]});return this.uc.some(t=>{var e=t.values.map(t=>{var e=pl[t.operator],r=i[t.key];if(!e||!r)return!1;var s=D(t.value)?t.value:[t.value];return s.length>0&&e(s,r)});return"OR"===t.type?e.some(Boolean):e.every(Boolean)})}catch(t){return Gh.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}_c(t){var i=t.flatMap(t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]}),e=i.filter(t=>{var i=t.filename;return!!i&&Jh.some(t=>i.startsWith(t))});return 0!==e.length&&(!e.every(t=>{var i=t.filename;return!!i&&i.startsWith(Kh)})||t.some(t=>{var i=t.value;return B(i)&&i.includes("isolatedAPI.contexts.topHostname")})&&!i.some(t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith(Kh))}))}wc(t){return t.some(t=>{var i=t.value;return B(i)&&Yh.some(t=>i.includes(t))})}kc(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[];return null!==(r=null==(s=n[n.length-1])||null==(s=s.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}mc(t){return!q(t)&&D(t)}}},du=s({productTours:class{get Ya(){return this._instance.persistence}constructor(t){this.xc=null,this.Cc=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var i=t.config;if("productTours"in i){var e,r;if(this.Ya&&this.Ya.register({[Qe]:!!i.productTours}),!Sh(this._instance))return!this.xc&&q(null==(e=this.Ya)?void 0:e.props.ph_product_tours)||wh.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.xc)||r.stop(),this.xc=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.xc&&Sh(this._instance)&&this.do(()=>this.Tc())}do(t){var i,e;null!=(i=b.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=b.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",i=>{i?wh.error("Could not load product tours script",i):t()})}Tc(){var t;!this.xc&&null!=(t=b.__PosthogExtensions__)&&t.generateProductTours&&(this.xc=b.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!D(this.Cc)||i){var e=this.Ya;if(e){var r=e.props[Ar];if(D(r)&&!i)return this.Cc=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:i=>{if(Sh(this._instance)){var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?i.error||wh.warn(s):wh.error(s),void t([],{isLoaded:!1,error:s})}var n=D(i.json.product_tours)?i.json.product_tours:[];this.Cc=n,e&&e.register({[Ar]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Cc,{isLoaded:!0})}getActiveProductTours(t){q(this.xc)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.xc.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.xc)||i.showTourById(t)}previewTour(t){this.xc?this.xc.previewTour(t):this.do(()=>{var i;this.Tc(),null==(i=this.xc)||i.previewTour(t)})}dismissProductTour(){var t;null==(t=this.xc)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.xc)||t.nextStep()}previousStep(){var t;null==(t=this.xc)||t.previousStep()}clearCache(){var t;this.Cc=null,null==(t=this.Ya)||t.unregister(Ar)}resetTour(t){var i;null==(i=this.xc)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.xc)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.xc)||i.cancelPendingTour(t)}}},au),vu={siteApps:class{constructor(t){this._instance=t,this.Mc=0,this.Ic=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ec(t,i){if(i){var e=this.globalsForEvent(i);this.Ic.push(e),this.Ic.length>1e3&&(this.Ic=this.Ic.slice(10))}}get siteAppLoaders(){var t;return null==(t=b._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Ec.bind(this));this.Rc=()=>{t(),this.Ic=[],this.Rc=void 0}}}globalsForEvent(t){var i,n,o,a,l,h,u;if(!t)throw new Error("Event payload is required");var d={},v=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var f of Object.entries(c)){var p=f[0];d[p]={id:v[p],type:p,properties:f[1]}}var _=t.$set_once,g=t.$set;return{event:s({},r(t,e),{properties:s({},t.properties,g?{$set:s({},null!==(i=null==(n=t.properties)?void 0:n.$set)&&void 0!==i?i:{},g)}:{},_?{$set_once:s({},null!==(o=null==(a=t.properties)?void 0:a.$set_once)&&void 0!==o?o:{},_)}:{}),elements_chain:null!==(l=null==(h=t.properties)?void 0:h.$elements_chain)&&void 0!==l?l:"",distinct_id:null==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:d}}Ac(t){var i,e=null==(i=t.tagName)?void 0:i.toLowerCase();return"style"===e&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(xh.error("prepare_external_dependency_stylesheet returned null"),null):"script"===e&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(xh.error("prepare_external_dependency_script returned null"),null):t}Pc(){var t,i,e,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==u?void 0:u.defaultView,h=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!h)return()=>{};if(this.Mc++,this.Fc)return this.Oc();var d=[],v=this,c=new WeakSet,f=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),d.push(()=>{t[i]=r})}},p=t=>{if(c.has(t))return t;var i=v.Ac(t);return i&&c.add(i),i},_=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!H(t));return f(h,"appendChild",t=>function(i){var e=p(i);return e?t.call(this,e):i}),f(h,"insertBefore",t=>function(i,e){var r=p(i);return r?t.call(this,r,e):i}),f(h,"replaceChild",t=>function(i,e){var r=p(i);return r?t.call(this,r,e):e}),[null==(i=l.Element)?void 0:i.prototype,null==(e=l.Document)?void 0:e.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach(t=>{f(t,"append",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,_(e))}),f(t,"prepend",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,_(e))})}),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach(t=>{f(t,"before",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,_(e))}),f(t,"after",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,_(e))}),f(t,"replaceWith",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=_(e);return e.length&&!s.length?void 0:t.apply(this,s)})}),f(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",t=>function(i,e){var r=p(e);return r?t.call(this,i,r):null}),this.Fc=()=>{d.forEach(t=>t()),this.Fc=void 0},this.Oc()}Oc(){var t=!1;return()=>{var i;t||(t=!0,this.Mc--,0===this.Mc&&(null==(i=this.Fc)||i.call(this)))}}$c(t,i){void 0===i&&(i=!0);var e=this.Pc();try{var r=t(e);return i&&e(),r}catch(t){throw e(),t}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.Ic.length&&(xh.info("Processing "+this.Ic.length+" events for site app with id "+t.id),this.Ic.forEach(t=>this.$c(()=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null==(e=this.Rc)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,xh.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.$c(i=>t.init({posthog:this._instance,callback(t){i(),s(t)}}),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){xh.error(Eh+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){xh.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}Dc(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}Lc(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.$c(()=>null==r.processEvent?void 0:r.processEvent(e))}catch(i){xh.error("Error while processing event "+t.event+" for site app "+r.id,i)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.Dc(),void this._instance.on("eventCaptured",t=>this.Lc(t))):void xh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.Rc)||e.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,i=a.id,e=a.url;b["__$$ph_site_app_"+i]=s._instance,null==(t=b.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,t=>{if(t)return xh.error(Eh+i,t)})};for(var a of n.siteApps)o()}else xh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},cu={tracingHeaders:class{constructor(t){this._instance=t,this.Nc=void 0,this.qc=void 0,this.jc=void 0,this.Yv=()=>{var t,i,e=this.Bc();e?(U(this.Nc)&&(this.Nc=null==(t=b.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),U(this.qc)&&(this.qc=null==(i=b.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.oc()}}initialize(){this.startIfEnabledOrStop()}do(t){var i,e;null!=(i=b.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=b.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return uh.error("failed to load script",i);t()})}Hc(){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}Bc(){var t=this.Hc();return D(t)?(D(this.jc)?this.jc.splice(0,this.jc.length,...t):this.jc=[...t],t.length>0?this.jc:void 0):(D(this.jc)&&this.jc.splice(0),this.jc=t||void 0,this.jc)}oc(){var t,i;null==(t=this.Nc)||t.call(this),null==(i=this.qc)||i.call(this),this.Nc=void 0,this.qc=void 0}startIfEnabledOrStop(){this.Bc()?this.do(this.Yv):this.oc()}}},fu=s({surveys:class extends Ph{constructor(t){var i;super(new Fh(t),(i=t,{get projectToken(){return i.config.token},kv:new Ih(i)})),this._instance=t}Yu(t,i){var e=i.query?Ha(t,i.query):t;return new Promise(t=>{var r;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",e),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})})}}},au),pu={toolbar:class{constructor(t){this.instance=t}zc(t){b.ph_toolbar_state=t}Uc(){var t;return null!==(t=b.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,i,e){if(void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),Cs(this.instance.config))return!1;if(!a||!u)return!1;t=null!=t?t:a.location,e=null!=e?e:a.history;try{if(!i){try{a.localStorage.setItem("test","test"),a.localStorage.removeItem("test")}catch(t){return!1}i=null==a?void 0:a.localStorage}var r,s=Mh||uo(t.hash,"__posthog")||uo(t.hash,"state"),n=s?xs(()=>JSON.parse(atob(decodeURIComponent(s))))||xs(()=>JSON.parse(decodeURIComponent(s))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(i.getItem(Dh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Wc(t){var i=b.ph_load_toolbar||b.ph_load_editor;!q(i)&&N(i)?i(t,this.instance):Nh.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==u||!u.getElementById("__POSTHOG_TOOLBAR__"));if(!a||i)return!1;var e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=s({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(a.localStorage.setItem(Dh,JSON.stringify(s({},r,{source:void 0}))),2===this.Uc())this.Wc(r);else if(0===this.Uc()){var n;this.zc(1),null==(n=b.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",t=>{if(t)return Nh.error("[Toolbar] Failed to load",t),void this.zc(0);this.zc(2),this.Wc(r)}),Rs(a,"turbolinks:load",()=>{this.zc(0),this.loadToolbar(r)})}return!0}Vc(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},_u=s({experiments:class t{get _n(){return this._instance.config}constructor(i){var e=this;this._instance=i,this.getWebExperimentsAndEvaluateDisplayLogic=function(i){void 0===i&&(i=!1),e.getWebExperiments(i=>{t.Gc("retrieved web experiments from the server"),e.Zc=new Map,i.forEach(i=>{if(i.feature_flag_key){var r;e.Zc&&(t.Gc("setting flag key ",i.feature_flag_key," to web experiment ",i),null==(r=e.Zc)||r.set(i.feature_flag_key,i));var s=e._instance.getFeatureFlag(i.feature_flag_key);B(s)&&i.variants[s]&&e.Jc(i.name,s,i.variants[s].transforms)}else if(i.variants)for(var n in i.variants){var o=i.variants[n];t.Qc(o,e._instance)&&e.Jc(i.name,n,o.transforms)}})},i)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(i){if(this._is_bot())t.Gc(Xh);else if(!this._n.disable_web_experiments){if(q(this.Zc))return this.Zc=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.Gc("applying feature flags",i),i.forEach(t=>{var i;if(this.Zc&&null!=(i=this.Zc)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Zc)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Jc(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var i=t.getWindowLocation();if(null!=i&&i.search){var e=lo(null==i?void 0:i.search,"__experiment_id"),r=lo(null==i?void 0:i.search,"__experiment_variant");e&&r&&(t.Gc("previewing web experiments "+e+" && "+r),this.getWebExperiments(t=>{this.Kc(parseInt(e),r,t)},!1,!0))}}loadIfEnabled(){this._n.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this._n.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._n.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Kc(i,e,r){var s=r.filter(t=>t.id===i);s&&s.length>0&&(t.Gc("Previewing web experiment ["+s[0].name+"] with variant ["+e+"]"),this.Jc(s[0].name,e,s[0].variants[e].transforms))}static Qc(i,e){return!q(i.conditions)&&t.Xc(i,e)&&t.Yc(i)}static Xc(i,e){var r;if(q(i.conditions)||q(null==(r=i.conditions)?void 0:r.url))return!0;var s=t.getWindowLocation();if(s){var n,o,a,l=an(e,s.href);return null==(n=i.conditions)||!n.url||Qh[null!==(o=null==(a=i.conditions)?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](i.conditions.url,l)}return!1}static getWindowLocation(){return null==a?void 0:a.location}static Yc(t){var i;if(q(t.conditions)||q(null==(i=t.conditions)?void 0:i.utm))return!0;var e=mo();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static Gc(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];Pe.info("[WebExperiments] "+t,e)}Jc(i,e,r){this._is_bot()?t.Gc(Xh):"control"!==e?r.forEach(r=>{var s;r.selector&&(t.Gc("applying transform of variant "+e+" for experiment "+i+" ",r),null==(s=document)||null==(s=s.querySelectorAll(r.selector))||s.forEach(t=>{var i=t;r.html&&(i.innerHTML=r.html),r.css&&i.setAttribute("style",r.css)}))}):t.Gc("Control variants leave the page unmodified.")}_is_bot(){return h&&this._instance?hl(h,this._n.custom_blocked_useragents):void 0}}},au),gu=s({},au,lu,hu,uu,du,vu,fu,cu,pu,_u,{conversations:class{constructor(t){this._instance=t,this.tf=void 0,this._conversationsManager=null,this.ef=!1,this.zt=null,this.if=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.rf=t.ok,t.ok)){var i=t.config.conversations;q(i)||(G(i)?this.tf=i:(this.tf=i.enabled,this.zt=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.tf=void 0,this.zt=null,this.rf=void 0,this.if=!1}loadIfEnabled(){if(!(this._conversationsManager||this.ef||this._instance.config.disable_conversations||Cs(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==b?void 0:b.__PosthogExtensions__;if(t&&!U(this.tf)&&this.tf)if(this.zt&&this.zt.token){this.ef=!0;try{var i=t.initConversations;if(i)return this.nf(i),void(this.ef=!1);var e=t.loadExternalDependency;if(!e)return void this.sf(hs);e(this._instance,"conversations",i=>{i||!t.initConversations?this.sf("Could not load conversations script",i):this.nf(t.initConversations),this.ef=!1})}catch(t){this.sf("Error initializing conversations",t),this.ef=!1}}else Zh.error("Conversations enabled but missing token in remote config.")}}nf(t){if(this.zt)try{this._conversationsManager=t(this.zt,this._instance),this.if=!1,Zh.info("Conversations loaded successfully")}catch(t){this.sf("Error completing conversations initialization",t)}else Zh.error("Cannot complete initialization: remote config is null")}sf(t,i){Zh.error(t,i),this._conversationsManager=null,this.ef=!1,this.if=!0}show(){this._conversationsManager?this._conversationsManager.show():Zh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.tf&&!H(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":Cs(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.rf?"remote_config_failed":U(this.tf)?this.rf?"disabled_in_project":"remote_config_pending":this.tf?q(this.zt)||!this.zt.token?"missing_token":null!=b&&b.__PosthogExtensions__?this.ef?"initializing":this.if?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var r=this;return o(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(Zh.warn(tu),null)})()}getMessages(t,i){var e=this;return o(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(Zh.warn(tu),null)})()}markAsRead(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Zh.warn(tu),null)})()}getTickets(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Zh.warn(tu),null)})()}requestRestoreLink(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Zh.warn(tu),null)})()}restoreFromToken(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Zh.warn(tu),null)})()}restoreFromUrlToken(){var t=this;return o(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Zh.warn(tu),null)})()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Lu(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Nu(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},{logs:class{constructor(t){var i,e=this;this._instance=t,this.name="logs",this.af=!1,this.lf=!1,this.uf=!1,this.A=Re("[logs]"),this.hf=s({},this.A,{error(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];i.some(ou)||e.A.error(...i)}}),this.Aa=[],this.df=[],this.Td=0,this.Js=!1,this.vf=[],this.cf=[],this.ff=!1,this.pf=!1,this.gf=()=>{var t,i;this.Js||(this.Td=0,null==(t=this.mf)||t.onReconnect(),null==(i=this.yf)||i.onReconnect())},this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.af=!0),a&&Rs(a,"online",this.gf)}bf(t,i,e,r){var s,n=iu(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new Se(this._f(t,i),n,this.hf,()=>this.wf(),t=>t(),void 0,r),n]}kf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.mf||this.Sf!==i){var e;null==(e=this.mf)||e.reset(),this.Sf=i;var r=this.bf(()=>this.Aa,t=>{this.Aa=t});this.mf=r[0],this.xf=r[1]}return this.mf}Cf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.yf||this.Tf!==i){var e;null==(e=this.yf)||e.reset(),this.Tf=i;var r=this.bf(()=>this.df,t=>{this.df=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},ru);this.yf=r[0],this.Mf=r[1]}return this.yf}setup(t){var i;if(!this.Js){this.Hs=t,null!=(i=this._instance)&&null!=(i=i.config)&&null!=(i=i.logs)&&i.captureConsoleLogs&&(this.af=!0),(this.af||this.If()&&this.Ef())&&this.Rf();var e=!1,r=t.onRemoteConfig(t=>{var i;e=t.ok&&!0===(null==(i=t.config.logs)?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)});this.Js?r.dispose():(this.Xs=r,e||this.loadIfEnabled())}}dispose(){var t,i,e,r;this.Js||(this.Js=!0,this.Af(),null==(t=this.Xs)||t.dispose(),this.Xs=void 0,this.Hs=void 0,this.uf=!1,null==a||a.removeEventListener("online",this.gf),null==(i=this.Pf)||i.call(this),this.Pf=void 0,null==(e=this.mf)||e.reset(),null==(r=this.yf)||r.reset())}onRemoteConfig(t){var i,e;if(!this.Js){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;q(r)?this.Ff():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[Ze]:!!r}),r?(this.af=!0,this.lf||this.Rf(),this.loadIfEnabled()):this.Ff())}}reset(){var t,i,e,r;this.Af(),null==(t=this.mf)||t.clearQueue(),this.Aa=[],null==(i=this.mf)||i.reset(),null==(e=this.yf)||e.clearQueue(),this.df=[],null==(r=this.yf)||r.reset(),this.Td=0}captureLog(t){this.Js||this.kf().captureLog(t)}captureConsoleLog(t){this.Js||this.Cf().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.Js||this.Cf().captureLog(t,{context:i,occurredAtMs:e})}Ef(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[Ze])}If(){var t,i;return null==(t=this._instance)||null==t.Ma||!t.Ma()||!(null==(i=b._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])||!i.config)}ju(){var t;this.Af(),null==(t=this.yf)||t.clearQueue(),this.df=[]}Ff(){this.af||this.Af()}Rf(){var t,i=this;if(!this.ff&&null!=b&&b.console){var e=iu(null==(t=this._instance)||null==(t=t.config)?void 0:t.logs).maxBufferSize,r=function(t){var r;try{r=(t=>{for(;null!=(i=t)&&i.__rrweb_original__;){var i;t=t.__rrweb_original__}return t})(b.console[t])}catch(t){return 0}if(!r)return 0;i.cf.push(hh(b.console,t,s=>{var n=function(){for(var r=arguments.length,n=new Array(r),o=0;r>o;o++)n[o]=arguments[o];try{i.Of(t,n,e)}catch(t){}return s.apply(b.console,n)};return n.__rrweb_original__=r,n}))};for(var s of eu)r(s);this.ff=!0,this.$f=setTimeout(()=>{this.Af()},3e4)}}Of(t,i,e){var r;if(this.ff&&!this.pf&&0!==i.length)if(null!=(r=this._instance)&&r.is_capturing()){if(e>this.vf.length){this.pf=!0;try{this.vf.push({level:t,args:i,occurredAtMs:Date.now(),context:this.wf()})}finally{this.pf=!1}}}else this.Af()}Af(){if(this.vf=[],this.ff){for(var t of(this.ff=!1,this.$f&&(clearTimeout(this.$f),this.$f=void 0),this.cf))t();this.cf=[]}}Df(){var t=this.vf;return this.Af(),t}get logger(){return this.Lf||(this.Lf={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.Lf}flushLogs(t){t?this.Nf(t):(this.mf&&this.mf.flush().catch(t=>this.qf(t)),this.yf&&this.yf.flush().catch(t=>this.qf(t)))}qf(t){ou(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Js&&this.af&&!this.lf&&!this.uf){var t=null==b?void 0:b.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.Af();var i=t.loadExternalDependency;if(!i)return this.A.error(hs),void this.Af();this.uf=!0;try{i(this._instance,"logs",i=>{if(this.uf=!1,!this.Js&&this.af){var e=t.logs;if(i||null==e||!e.initializeLogs)this.A.error("Could not load logs script",i),this.Af();else{var r,s,n=this.Df();this.Pf=e.initializeLogs(null!==(r=this.Hs)&&void 0!==r?r:this._instance),this.lf=!0,n.length>0&&(null==e.replayConsoleBuffer||e.replayConsoleBuffer(null!==(s=this.Hs)&&void 0!==s?s:this._instance,n))}}})}catch(t){throw this.uf=!1,t}}}_f(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===R.LogsQueue?t():void 0,setPersistedProperty(t,e){t===R.LogsQueue&&i(null!=e?e:[])},gs:t=>this.gs(t),getLibraryId:()=>Me.LIB_NAME,getLibraryVersion:()=>Me.LIB_VERSION}}gs(t){return new Promise(i=>{if(vo(this.Td,3))i({kind:"fatal",error:nu(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:nu(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.jf(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.Bf(i),i>=200&&300>i)r({kind:"ok"});else if(413===i)r({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)r({kind:"fatal",error:new Error("logs request failed with status "+i)});else{var e;0===i?(t.error||this.A.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:nu(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("logs request failed with status "+i)})}}})}})}Bf(t){(0!==t||this._instance.__loaded)&&(this.Td=co(t,this.Td,3,()=>this.A.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}Nf(t){this.Aa.length>0&&this.Hf(t,this.Aa,this.xf,Me.LIB_NAME,t=>{this.Aa=t}),this.df.length>0&&this.Hf(t,this.df,this.Mf,ru,t=>{this.df=t})}Hf(t,i,e,r,s){if(0!==i.length){var n=i.map(t=>t.record);s([]);var o=we(n,ye(e,Me.LIB_NAME,Me.LIB_VERSION),r,Me.LIB_VERSION);this._instance._send_request({method:"POST",url:this.jf(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}jf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}wf(){var t,i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var e=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=e.windowId,s=e.sessionStartTimestamp,n=e.lastActivityTimestamp;i.sessionId=e.sessionId,i.windowId=r,q(s)||(i.sessionStartTimestamp=s),q(n)||(i.lastActivityTimestamp=n)}if(null!=b&&null!=(t=b.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?gi(b.location.href):b.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(i.activeFeatureFlags=o)}return i}}},{metrics:class{constructor(t){this._instance=t,this.A=Re("[metrics]")}initialize(){}kf(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.mf&&this.Sf===e||(null==(i=this.mf)||i.reset(),this.Sf=e,this.mf=new $e(this._f(),function(t){var i,e,r,s,n,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!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(e),this.A)),this.mf}count(t,i,e){void 0===i&&(i=1),this.kf().count(t,i,e)}gauge(t,i,e){this.kf().gauge(t,i,e)}histogram(t,i,e){this.kf().histogram(t,i,e)}flush(t){if(!this.mf)return Promise.resolve();if(t){var i=this.mf.drainWindow();return i&&this.Fs(i,t),Promise.resolve()}return this.mf.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var t;null==(t=this.mf)||t.reset()}_f(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Fs:t=>i.Fs(t),getLibraryId:()=>Me.LIB_NAME,getLibraryVersion:()=>Me.LIB_VERSION}}Fs(t,i){return new Promise(e=>{var r=!1,n=t=>{r||(r=!0,clearTimeout(o),e(t))},o=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(s({method:"POST",url:this.zf(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i},{fireCallbackOnDrop:!0,callback(t){var i,e=t.statusCode;n(e>=200&&300>e?{kind:"ok"}:413===e?{kind:"too-large"}:0!==e&&408!==e&&429!==e&&500>e?{kind:"fatal",error:new Error("metrics request failed with status "+e)}:{kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("metrics request failed with status "+e)})}}))})}zf(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}});Xl.__defaultExtensionClasses=s({},gu);var mu=function(){Me.SDK_DIST_CHANNEL="npm";var t=Fl[ql]=new Xl;return function(){function t(){t.done||(t.done=!0,Vl=!1,ys(Fl,function(t){t._dom_loaded()}))}null!=u&&u.addEventListener?"complete"===u.readyState?t():Rs(u,"DOMContentLoaded",t,{capture:!1}):a&&Pe.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}(),bu=mu;export{jo as Compression,Qo as DEFAULT_PRODUCT_TOUR_APPEARANCE,Yo as DisplaySurveyType,Xl as PostHog,Zo as ProductTourEventName,ta as ProductTourEventProperties,Ko as SurveyEventName,Jo as SurveyEventProperties,Uo as SurveyEventType,zo as SurveyPosition,Wo as SurveyQuestionBranchingType,Vo as SurveyQuestionType,Go as SurveySchedule,Ho as SurveyTabPosition,qo as SurveyType,Bo as SurveyWidgetType,bu as default,mu as posthog,na as severityLevels};
|
|
2
2
|
//# sourceMappingURL=module.js.map
|