posthog-js 1.428.2 → 1.428.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(){var t=["retriesPerformedSoFar"],i=["$set_once","$set"];function e(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 r(){return r=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},r.apply(null,arguments)}function s(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 n(t){return function(){var i=this,e=arguments;return new Promise(function(r,n){var o=t.apply(i,e);function a(t){s(o,r,n,a,l,"next",t)}function l(t){s(o,r,n,a,l,"throw",t)}a(void 0)})}}!function(s){var o="0.8.2",a={DEBUG:(!1,!1),LIB_VERSION:(o,"1.428.2"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:o},l=a,h="$people_distinct_id",u="distinct_id",d="$device_id",v="$device_model",c="__alias",f="__cmpns",p="$fbc",g="$fbc_persistence",_="__timers",m="$autocapture_disabled_server_side",b="$heatmaps_enabled_server_side",y="$exception_capture_enabled_server_side",w="$error_tracking_suppression_rules",x="$error_tracking_capture_extension_exceptions",S="$web_vitals_enabled_server_side",k="$dead_clicks_enabled_server_side",E="$product_tours_enabled_server_side",P="$logs_capture_enabled_server_side",T="$web_vitals_allowed_metrics",C="$session_recording_remote_config",F="$session_recording_enabled_server_side",A="$replay_sample_rate",I="$replay_override_sampling",R="$replay_override_linked_flag",O="$replay_override_url_trigger",M="$replay_override_event_trigger",D="$sesid",j="$session_is_sampled",B="$session_past_minimum_duration",L="$session_recording_url_trigger_activated_session",N="$session_recording_event_trigger_activated_session",z="$debug_first_full_snapshot_timestamp",U="$sess_rec_flush_size",H="$enabled_feature_flags",q="$active_feature_flags",V="$early_access_features",W="$feature_flag_details",G="$feature_flag_payloads",K="$feature_flag_request_id",J="$minimal_flag_called_events",Y="$override_feature_flags",X="$override_feature_flag_payloads",Z="$stored_person_properties",Q="$stored_group_properties",tt="$groups",it="$surveys",et="$surveys_loaded_at",rt="$surveys_activated",st="$surveys_activated_session",nt="$surveys_activated_timestamps",ot="ph_product_tours",at="$product_tours_activated",lt="$product_tours_activated_session",ht="$conversations_widget_session_id",ut="$conversations_ticket_id",dt="$conversations_widget_state",vt="$conversations_user_traits",ct="$flag_call_reported",ft="$flag_call_reported_session_id",pt="$feature_flag_errors",gt="$feature_flag_evaluated_at",_t="$user_state",mt="$client_session_props",bt="$capture_rate_limit",yt="$initial_campaign_params",wt="$initial_referrer_info",xt="$initial_person_info",St="$epp",kt="$posthog_cookieless",Et="$cookieless_mode",$t="$sdk_debug_extensions_init_method",Pt="$sdk_debug_extensions_init_time_ms",Tt="$sdk_debug_recording_script_not_loaded",Ct="$sdk_debug_replay_event_trigger_status",Ft="$sdk_debug_replay_linked_flag_trigger_status",At="$sdk_debug_replay_matched_recording_trigger_groups",It="$sdk_debug_replay_pending_trigger_conditions",Rt="$sdk_debug_replay_remote_trigger_matching_config",Ot="$sdk_debug_replay_trigger_groups_count",Mt="$sdk_debug_replay_url_trigger_status",Dt="$session_recording_start_reason",jt="PostHog loadExternalDependency extension not found.",Bt="anonymous",Lt="identified",Nt="identified_only",zt="visibilitychange",Ut="beforeunload",Ht="$pageview",qt="$pageleave",Vt="$identify",Wt="$groupidentify",Gt="u">typeof window?window:void 0,Kt="u">typeof globalThis?globalThis:Gt,Jt=null==Kt?void 0:Kt.navigator,Yt=null==Kt?void 0:Kt.document,Xt=null==Kt?void 0:Kt.location,Zt=null==Kt?void 0:Kt.fetch,Qt=null!=Kt&&Kt.XMLHttpRequest&&"withCredentials"in new Kt.XMLHttpRequest?Kt.XMLHttpRequest:void 0,ti=null==Kt?void 0:Kt.AbortController,ii=null==Kt?void 0:Kt.CompressionStream,ei=null==Jt?void 0:Jt.userAgent;function ri(){return!(!Gt||!1===Gt.navigator.onLine)}var si="undefined"!=typeof globalThis?globalThis:Gt;si&&"undefined"==typeof self&&(si.self=si),si&&"undefined"==typeof File&&(si.File=function(){});var ni=null!=Gt?Gt:{},oi=["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"],ai=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return oi.concat(i).some(t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)})};function li(t,i){return-1!==t.indexOf(i)}var hi=function(t){return t.trim()},ui=function(t){return t.replace(/^\$/,"")};function di(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 vi=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}({}),ci=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),fi=["$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"],pi=["token"],gi=Object.prototype,_i=gi.hasOwnProperty,mi=gi.toString,bi=Array.isArray||function(t){return"[object Array]"===mi.call(t)},yi=t=>"function"==typeof t,wi=t=>t===Object(t)&&!bi(t),xi=t=>{if(wi(t)){for(var i in t)if(_i.call(t,i))return!1;return!0}return!1},Si=t=>void 0===t,ki=t=>"[object String]"==mi.call(t),Ei=t=>ki(t)&&0===t.trim().length,$i=t=>null===t,Pi=t=>Si(t)||$i(t),Ti=t=>"[object Number]"==mi.call(t)&&t==t,Ci=t=>Ti(t)&&t>0,Fi=t=>"[object Boolean]"===mi.call(t),Ai=t=>li(fi,t),Ii=t=>li(pi,t);function Ri(t){return null===t||"object"!=typeof t}function Oi(t,i){return{}.toString.call(t)==="[object "+i+"]"}function Mi(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 ji(t,Error)}}function Di(t){return"u">typeof Event&&ji(t,Event)}function ji(t,i){try{return t instanceof i}catch(t){return!1}}var Bi=[!0,"true",1,"1","yes"],Li=t=>li(Bi,t),Ni=[!1,"false",0,"0","no"];function zi(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),Ti(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),zi(null!=s?s:e,i,e,r))}var Ui=class{constructor(t){this.C={},this.I=t.I,this.R=zi(t.bucketSize,0,100,t.A),this.O=zi(t.refillRate,0,this.R,t.A),this.F=zi(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={}}},Hi="Mobile",qi="Android",Vi="Tablet",Wi="Android Tablet",Gi="iPad",Ki="Apple Watch",Ji="Safari",Yi="BlackBerry",Xi="Samsung Internet",Zi="Chrome",Qi="Chrome iOS",te="Internet Explorer",ie="Internet Explorer Mobile",ee="Opera",re="Microsoft Edge",se="Firefox",ne="Firefox iOS",oe="Nintendo",ae="PlayStation",le="Xbox",he="Android Mobile",ue="Mobile Safari",de="Windows",ve="Windows Phone",ce="Nokia",fe="Ouya",pe="Generic "+Hi.toLowerCase(),ge="Generic "+Vi.toLowerCase(),_e="Konqueror",me="Oculus Browser",be="Vivaldi",ye="Yandex",we="Whale",xe="DuckDuckGo",Se="Pale Moon",ke="Waterfox",Ee="Brave",$e="Claude",Pe="Codex",Te="ChatGPT",Ce="Google Search App",Fe=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ae=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ie=new RegExp(le,"i"),Re=new RegExp("PlayStation \\w+","i"),Oe=new RegExp("Nintendo \\w+","i"),Me=new RegExp("BlackBerry|PlayBook|BB10","i"),De={"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"},je=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?Ee:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&li(t,"GSA/")?Ce:li(t," OPR/")&&li(t,"Mini")?"Opera Mini":li(t," OPR/")?ee:Me.test(t)?Yi:li(t,"IEMobile")||li(t,"WPDesktop")?ie:li(t,"OculusBrowser")?me:li(t,"SamsungBrowser")?Xi:li(t,"Edge")||li(t,"Edg/")?re:li(t,"Vivaldi/")?be:li(t,"YaBrowser/")?ye:li(t,"Whale/")?we:li(t,"DuckDuckGo/")||li(t,"Ddg/")?xe:li(t,"Claude/")?$e:li(t,"Codex/")?Pe:li(t,"ChatGPT/")?Te:li(t,"FBIOS")?"Facebook Mobile":li(t,"UCWEB")||li(t,"UCBrowser")?"UC Browser":li(t,"CriOS")?Qi:li(t,"CrMo")||li(t,Zi)?Zi:li(t,qi)&&li(t,Ji)?he:li(t,"FxiOS")?ne:li(t.toLowerCase(),_e.toLowerCase())?_e:li(t,"Brave/")?Ee:((t,i)=>i&&li(i,"Apple")||function(t){return li(t,Ji)&&!li(t,Zi)&&!li(t,qi)}(t))(t,i)?li(t,Hi)?ue:Ji:li(t,"PaleMoon/")?Se:li(t,"Waterfox/")?ke:li(t,se)?se:li(t,"MSIE")||li(t,"Trident/")?te:li(t,"Gecko")?se:"")},Be={[ie]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[re]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Zi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Qi]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Ji]:[Fe],[ue]:[Fe],[ee]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[se]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[ne]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[_e]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Yi]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Fe],[he]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Xi]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[me]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[be]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[ye]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[we]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ee]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[$e]:[Ae],[Pe]:[Ae],[Te]:[Ae],[xe]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Se]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[ke]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Ce]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[te]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Le=function(t,i,e,r){var s=Be[je(t,i,e,r)];if(Si(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},Ne=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[le,t&&t[1]||""]],[new RegExp(oe,"i"),[oe,""]],[new RegExp(ae,"i"),[ae,""]],[Me,[Yi,""]],[new RegExp(de,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[ve,""];if(new RegExp(Hi).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=De[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[de,r]}return[de,""]}],[/((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=Si(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[qi,[t[2],t[3],t[4]||"0"].join(".")]:[qi,""]],[/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",""]]],ze=function(t){for(var i=0;Ne.length>i;i++){var e=Ne[i],r=e[1],s=e[0].exec(t),n=s&&(yi(r)?r(s,t):r);if(n)return n}return["",""]},Ue=function(t){return Oe.test(t)?oe:Re.test(t)?ae:Ie.test(t)?le:new RegExp(fe,"i").test(t)?fe:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?ve:/iPad/.test(t)?Gi:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ki:Me.test(t)?Yi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(ce,"i").test(t)?ce:/(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(Hi).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)?qi:Wi:new RegExp("(pda|Mobile)","i").test(t)?pe:new RegExp(Vi,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?ge:""},He=/\bFBAV\/(\d+(?:\.\d+)*)/i,qe=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",He],[/\bFBAN\/EMA\b/i,"Facebook Lite",He],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",He],[/\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"]],Ve="[Truncated]",We="[Unserializable]";function Ge(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 Ke,Je,Ye,Xe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ze(t,i){return"string"==typeof(e=t)&&Xe.test(e)?t:i();var e}function Qe(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 tr(t){return t?t.split("#")[0]:t}function ir(t,i){var e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function er(t,i,e){return rr.apply(this,arguments)}function rr(){return(rr=n(function*(t,i,e){var r;try{return yield Promise.race([t,new Promise((t,s)=>{r=ir(()=>{try{null==e||e(),t()}catch(t){s(t)}},i)})])}finally{clearTimeout(r)}})).apply(this,arguments)}function sr(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Ye&&e.length===Je?Ye:(Je=e.length,Ye=e.reduce((e,r)=>{Ke||(Ke={});var s=Ke[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,Ke[r]=[l,h];break}}return e},{}))}}var nr=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 n(function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&bi(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,s;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),r({},t,{cause:e,stack:s})}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 n(function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e})()}convertToExceptionList(t,i){var e,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(s=i.handled)||void 0===s||s,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,r({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:sr(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var s=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return r({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,e),next:t=>s(t,e+1)})}};function or(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 Si(r)||(n.lineno=r),Si(s)||(n.colno=s),n}var ar=(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]},lr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,hr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ur=/\((\S*)(?::(\d+))(?::(\d+))\)/,dr=(t,i)=>{var e=lr.exec(t);if(e)return or(i,e[1],"?",+e[2],+e[3]);var r=hr.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=ur.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=ar(r[1]||"?",r[2]);return or(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},vr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,cr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,fr=(t,i)=>{var e=vr.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=cr.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=ar(n,s);return or(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},pr=/\(error: (.*)\)/;var gr=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=ki(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 Oi(t,"DOMException")}isDOMError(t){return Oi(t,"DOMError")}},_r=class{match(t){return Mi(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}},mr=class{match(t){return!!Oi(t,"ErrorEvent")&&(null!=t.error||this.Ki(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);var s=i.apply(t.message);return r({},s,{stack:null!==(e=this.Xi(t))&&void 0!==e?e:s.stack,synthetic:!0})}Ki(t){return ki(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(ki(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}},br=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,yr=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(br);return r&&(i=r[1],e=r[2]),[i,e]}},wr=["fatal","error","warning","log","info","debug"];function xr(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 Sr=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(Di(t))return t.constructor.name;var i="name"in t?t.name:void 0;return ki(i)&&!Ei(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: "+xr(t)}isSeverityLevel(t){return ki(t)&&!Ei(t)&&wr.indexOf(t)>=0}getStack(t){try{return ki(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:ki(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(Mi(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},kr=class{match(t){return Di(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+xr(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}},Er=class{match(t){return Ri(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}}},$r=class{match(t){return Oi(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Di(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 Ri(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}},Pr="$message",Tr="$timestamp",Cr=new Set([Pr,Tr]),Fr={enabled:!0,max_bytes:32768};function Ar(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Fr.enabled,max_bytes:Rr(t.max_bytes,Fr.max_bytes)}:r({},Fr)}var Ir=class{constructor(t){this.$n=[],this.Bn=0,this._n=Ar(t)}setConfig(t){this._n=Ar(t),this.Hn()}add(t){var i=function(t){var i;try{i=di(t)}catch(t){return}try{var e=JSON.parse(i);if(!wi(e))return;var r=e,s=r[Pr],n=r[Tr];if(!ki(s)||0===s.trim().length)return;if(!ki(n)&&!Ti(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 Rr(t,i){if(!Ti(t)||1/0===t||-1/0===t)return i;var e=Math.floor(t);return 0>e?i:e}var Or=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Mr(t){return"string"==typeof t||t}function Dr(t){return"string"==typeof t?t:void 0}var jr,Br=["$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"],Lr="NativeGzipValidationError",Nr=t=>t.length>=2&&31===t[0]&&139===t[1],zr=(t,i)=>t===ci.GZipJS||i===ci.GZipJS||"gzip"===i,Ur=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Hr=t=>{throw Qe(Lr,"Native gzip produced invalid output: "+t)},qr=function(){var t=n(function*(t,i){18>t.size&&Hr("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());Nr(e)&&8===e[2]||Hr("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(jr)return jr;jr=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;jr[t]=i>>>0}return jr})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&Hr("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&Hr("invalid-size")});return function(i,e){return t.apply(this,arguments)}}();function Vr(){return Vr=n(function*(t,i,e){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),o=s.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch(function(){var t=n(function*(t){try{yield o.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 qr(h,r),h}catch(t){if(null!=e&&e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}}),Vr.apply(this,arguments)}var Wr={}.propertyIsEnumerable;function Gr(t,i){try{return Yr(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function Kr(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:Ve};if(e.remainingNodes--,Fi(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:Ge(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:Ve};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?Ge(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Kr(a.call(t),i,e,r+1)}catch(t){}return bi(t)?{arrayValue:{values:Jr(t,i,e,r+1)}}:{kvlistValue:{values:Yr(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:Ge(String(t))}}function Jr(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(Pi(a))continue;s.push(Kr(a,i,e,r))}catch(t){s.push({stringValue:We})}return t.length>o&&s.push({stringValue:Ve}),s}function Yr(t,i,e,r){var s=[];for(var n in t)if(Wr.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($i(o)||Si(o))continue;s.push({key:Ge(n),value:Kr(o,i,e,r)})}catch(t){s.push({key:Ge(n),value:{stringValue:We}})}}return s}function Xr(t,i,e){return r({},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 Zr={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var Qr={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}},ts=Qr.info;function is(t){try{return Ge(String(t))}catch(t){return We}}function es(t,i,e,s){var n,o=Qr[t.level||"info"]||ts,a=o.text,l=o.number,h=(void 0===(n=Ti(s)?s: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),Pi(i.sessionStartTimestamp)||(u.sessionStartTimestamp=String(i.sessionStartTimestamp)),Pi(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=r({},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=We}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var g={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:is(t.body)},attributes:Gr(d,e)};return t.trace_id&&(g.traceId=t.trace_id),t.span_id&&(g.spanId=t.span_id),Si(t.trace_flags)||(g.flags=t.trace_flags),g}function rs(t,i,e){return Xr(t,i,e)}function ss(t,i,e,r){return{resourceLogs:[{resource:{attributes:Gr(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}var ns=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(vi.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:es(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=bi(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 n(function*(){if(!t._instance.isDisabled)return t.Gn||(t.Gn=t.fs().finally(()=>{t.Gn=null})),t.Gn})()}fs(){var t=this;return n(function*(){var i;t.us();var e=null!==(i=t._instance.getPersistedProperty(vi.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=ss(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(vi.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}})()}ys(t){var i=this;return n(function*(){var e,r=Math.max(0,t-i.Zn),s=null!==(e=i._instance.getPersistedProperty(vi.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(vi.LogsQueue,s.slice(r)),yield i.Wn()})()}ps(){return rs(this._n,this._instance.getLibraryId(),this._instance.getLibraryVersion())}cs(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(vi.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(vi.LogsQueue,e),this.ts>e.length?this.bs():this.hs()}}bs(t){void 0===t&&(t=this.rs),this._s||(this._s=ir(()=>{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(vi.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return n(function*(){i.us();var e=i.flush().catch(()=>{});void 0!==t?yield er(e,t):yield e})()}flushWithTimeout(t){var i=this;return n(function*(){var e=i.flush();yield er(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)}},os=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function as(t){return String(t)+"000000"}function ls(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 hs=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=n(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,s;try{e=i.attributes?r({},i.attributes):void 0,s=ls(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(s);if(!n){if(!this.As())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Ss.set(s,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(os.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,os)]+=1}}ds(t){var i=this._n.beforeSend;if(!i)return t;var e=bi(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=ir(()=>{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 n(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 Xr(t,i,e)}(this._n,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Gr(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}$s(t){var i=as(Date.now()),e=new Map;for(var s of t.values()){var n,o=ls(s.type,s.name,s.unit,void 0),a=e.get(o);a||(a=r({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},e.set(o,a));var l=Gr(null!==(n=s.attributes)&&void 0!==n?n:{},this.A),h=as(s.windowStartMs);if("count"===s.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:i,asDouble:null!==(u=s.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:i,asDouble:null!==(v=s.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else s.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:i,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:os})}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)}}},us=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];Gt&&(a.DEBUG||Gt.POSTHOG_DEBUG||e)&&!Si(Gt.console)&&Gt.console&&("__rrweb_original__"in Gt.console[i]?Gt.console[i].__rrweb_original__:Gt.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)=>us(t+" "+i,e)};return r},ds=us("[PostHog.js]"),vs=ds.createLogger;function cs(t,i){bi(t)&&t.forEach(i)}function fs(t,i){if(!Pi(t))if(bi(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(var e in t)_i.call(t,e)&&i(t[e],e)}var ps=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 gs(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 _s=function(t){try{return t()}catch(t){return}},ms=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){ds.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ds.critical(t)}}},bs=function(t){var i={};return fs(t,function(t,e){(ki(t)&&t.length>0||Ti(t))&&(i[e]=t)}),i};function ys(t){var i=r({},t);for(var e of["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e])}catch(t){}return i}var ws=["herokuapp.com","vercel.app","netlify.app"];function xs(t){var i=null==t?void 0:t.hostname;if(!ki(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of ws)if(e===r)return!1;return!0}function Ss(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 ks(t){return"ph_toolbar_internal"===t.name}var Es=t=>{if(Yt){try{for(var i=t+"=",e=Yt.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 Ti(t)&&isFinite(t)&&Math.floor(t)===t});var $s=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}},Ps=class{generate(){var t=this.generateOrAbort();if(!Si(t))return t;this.ri=0;var i=this.generateOrAbort();if(Si(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t,i=(t=Date.now(),Ti(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 $s.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 Fs}},Ts=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};Gt&&!Si(Gt.crypto)&&crypto.getRandomValues&&(Ts=t=>crypto.getRandomValues(t));var Cs,Fs=class{nextUint32(){return this.Pe.length>this.ai||(Ts(this.Pe),this.ai=0),this.Pe[this.ai++]}constructor(){this.Pe=new Uint32Array(8),this.ai=1/0}},As=()=>Is().toString(),Is=()=>(Cs||(Cs=new Ps)).generate(),Rs="",Os=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Ms=null,Ds={si(){if(!$i(Ms))return Ms;if(Ms=!1,Yt)try{var t="__ph_cookie_support_"+As();Ds.ui(t,"xyz"),Ms='"xyz"'===Es(t),Ds.hi(t)}catch(t){Ms=!1}return Ms},ci(t){ds.error("cookieStore error: "+t)},li:Es,di(t){var i;try{i=JSON.parse(Ds.li(t))||{}}catch(t){}return i},ui(t,i,e,r,s){if(!Yt)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=Yt),Rs)return Rs;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_"+As();!Rs&&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",Rs=n)}return Rs}(t);if(!e){var r=(t=>{var i=t.match(Os);return i?i[0]:""})(t);r!==e&&ds.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(Yt.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&&ds.warn("cookieStore warning: large cookie, len="+h.length),Yt.cookie=h,!0}catch(t){return!1}},hi(t,i){if(null!=Yt&&Yt.cookie)try{Ds.ui(t,"",-1,i)}catch(t){return}}},js=null,Bs={si(){if(!$i(js))return js;var t=!0;if(Si(Gt))t=!1;else try{var i="__mplssupport__";Bs.ui(i,"xyz"),'"xyz"'!==Bs.li(i)&&(t=!1),Bs.hi(i)}catch(i){t=!1}return t||ds.error("localStorage unsupported; falling back to cookie store"),js=t,t},ci(t){ds.error("localStorage error: "+t)},li(t){try{return null==Gt?void 0:Gt.localStorage.getItem(t)}catch(t){Bs.ci(t)}return null},di(t){try{return JSON.parse(Bs.li(t))||{}}catch(t){}return null},ui(t,i){try{return null==Gt||Gt.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Bs.ci(t)}return!1},hi(t){try{null==Gt||Gt.localStorage.removeItem(t)}catch(t){Bs.ci(t)}}},Ls=[Z,q,H,W,G,K,gt,pt,ct],Ns=[d,u,D,j,St,xt,g,_t],zs=t=>t+"_cpm",Us=["__proto__","constructor","prototype"],Hs=t=>{if(!wi(t))return{};var i={};return Object.keys(t).forEach(e=>{-1===Us.indexOf(e)&&(i[e]=t[e])}),i},qs=function(t,i){void 0===i&&(i=[]);var e={};return[...Ns,...i].forEach(i=>{var r=t[i];Si(r)||$i(r)||""===r||(e[i]=r)}),e},Vs=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)},Ws=(t,i)=>({p:i,f:Vs(JSON.stringify(t))}),Gs=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=Ds.di(zs(t)),r=(null==e?void 0:e.f)===Vs(i)&&bi(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Ks=(t,i)=>i+"|"+(Ds.li(zs(t))||""),Js={},Ys={si:()=>!0,ci(t){ds.error("memoryStorage error: "+t)},li:t=>t in Js?Js[t]:null,di:t=>t in Js?Js[t]:null,ui:(t,i)=>(Js[t]=i,!0),hi(t){delete Js[t]}},Xs=null,Zs={si(){if(!$i(Xs))return Xs;if(Xs=!0,Si(Gt))Xs=!1;else try{var t="__support__";Zs.ui(t,"xyz"),'"xyz"'!==Zs.li(t)&&(Xs=!1),Zs.hi(t)}catch(t){Xs=!1}return Xs},ci(t){ds.error("sessionStorage error: ",t)},li(t){try{return null==Gt?void 0:Gt.sessionStorage.getItem(t)}catch(t){Zs.ci(t)}return null},di(t){try{return JSON.parse(Zs.li(t))||null}catch(t){}return null},ui(t,i){try{return null==Gt||Gt.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Zs.ci(t)}return!1},hi(t){try{null==Gt||Gt.sessionStorage.removeItem(t)}catch(t){Zs.ci(t)}}},Qs=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 Li(t)?1:li(Ni,t)?0:-1}get ao(){var t=this._n.opt_out_capturing_persistence_type,i="localStorage"===t?Bs:Ds,e=i.si()?i:Ys;if(!this.uo||this.uo!==e){this.uo=e;var r="localStorage"===t?Ds:Bs;r.li(this.lo)&&(this.uo.li(this.lo)||this.optInOut(Li(r.li(this.lo))),r.hi(this.lo,this._n.cross_subdomain_cookie))}return this.uo}so(){return!!this._n.respect_dnt&&[null==Jt?void 0:Jt.doNotTrack,null==Jt?void 0:Jt.msDoNotTrack,ni.doNotTrack,null==Jt?void 0:Jt.globalPrivacyControl].some(t=>Li(t))}};function tn(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!yi(r))return i;try{var s=r(i);return ki(s)&&s?s:i}catch(t){return ds.error("Error in get_current_url, falling back to window.location.href",t),i}}function en(t){return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function rn(t){return!!t&&1===t.nodeType}function sn(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function nn(t){return!!t&&3===t.nodeType}function on(t){return!!t&&11===t.nodeType&&rn(t.host)}function an(t){return t?hi(t).split(/\s+/):[]}function ln(t,i){var e=function(t){var i,e=null==Gt||null==(i=Gt.location)?void 0:i.href;return Si(e)?void 0:tn(t,e)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function hn(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 an(i)}function un(t){return Pi(t)?null:hi(t).split(/(\s+)/).filter(t=>Mn(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function dn(t){var i="";return $n(t)&&!Pn(t)&&t.childNodes&&t.childNodes.length&&fs(t.childNodes,function(t){var e;nn(t)&&t.textContent&&(i+=null!==(e=un(t.textContent))&&void 0!==e?e:"")}),hi(i)}function vn(t){var i;return Si(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var cn=["a","button","form","input","select","textarea","label"];function fn(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 pn(t,i){if(Si(i))return!0;var e,r=function(t){if(i.some(i=>fn(t,i)))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function gn(t){var i=t.parentNode;return!(!i||!rn(i))&&i}var _n=[".ph-no-autocapture","[data-ph-no-autocapture]"],mn=["next","previous","prev",">","<"],bn=[...mn,"+","-","−","–"],yn=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,wn=[".ph-no-rageclick",".ph-no-capture"],xn=["","text","search","email","password","url","tel","number"];function Sn(t,i){if(!Gt||kn(t))return!1;var e,r,s,n,o;if(Fi(i)?(e=!!i&&wn,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:wn,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||!rn(t))&&(!!sn(t,"textarea")||(sn(t,"input")?li(xn,(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 a=En(t,!1).targetElementList;return!function(t,i){if(!1===t||Si(t))return!1;var e;if(!0===t)e=mn;else{if(!bi(t))return!1;if(t.length>10)return ds.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=>yn(i,t)||yn(r,t))})}(r,a.map(t=>{var i;return{safeText:dn(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}}))&&!pn(a,e)}var kn=t=>!t||sn(t,"html")||!rn(t),En=(t,i)=>{if(!Gt||kn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!sn(s,"body");)if(on(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=gn(s);if(!n)break;if(i||cn.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var o=Gt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function $n(t){for(var i=new Set,e=0,r=t;r.parentNode&&!sn(r,"body");r=r.parentNode){if(e++>=1e3||i.has(r))return!1;i.add(r);var s=hn(r);if(li(s,"ph-sensitive")||li(s,"ph-no-capture"))return!1}if(li(hn(t),"ph-include"))return!0;var n=t.type||"";if(ki(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!ki(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 Pn(t){return!!(sn(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||sn(t,"select")||sn(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Tn=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}))$"),Cn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Fn=[16,15,14,13],An=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),In=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Rn=/[0-9A-Za-z_]/;function On(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 Mn(t,i){if(void 0===i&&(i=!0),Pi(t))return!1;if(ki(t)){if(t=hi(t),i?Tn.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(Cn.lastIndex=0;i=Cn.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of Fn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(Tn.test(a)&&On(a))return!0}}}return!1}(t))return!1;if(i?An.test(t):function(t){var i;for(In.lastIndex=0;i=In.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&Rn.test(e)&&Rn.test(r)))return!0}return!1}(t))return!1}return!0}function Dn(t){var i=dn(t);return Mn(i=(i+" "+jn(t)).trim())?i:""}function jn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&fs(t.childNodes,function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=dn(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+jn(t)).trim())}catch(t){ds.error("[AutoCapture]",t)}}),i}function Bn(t){return t.replace(/"|\\"/g,'\\"')}function Ln(t){var i=t.attr__class;if(i)return bi(i)?i:an(i)}var Nn=vs("[Dead Clicks]"),zn=()=>!0,Un=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(k)),r=t.instance.config.capture_dead_clicks;return Fi(r)?r:!!wi(r)||e},Hn=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({[k]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.do(()=>{this.vo()}):this.stop()}do(t){var i,e;null!=(i=ni.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=ni.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?Nn.error("failed to load script",i):t()})}vo(){var t;if(Yt){if(!this.ho&&null!=(t=ni.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=wi(this.instance.config.capture_dead_clicks)?r({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.ho=ni.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.ho.start(Yt),Nn.info("starting...")}}else Nn.error("`document` not found. Cannot start.")}stop(){this.ho&&(this.ho.stop(),this.ho=void 0,Nn.info("stopping..."))}},qn=vs("[SegmentIntegration]");function Vn(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()||As();t.config.get_device_id=s,e&&r.id()&&(t.register({distinct_id:r.id(),$device_id:s()}),t.persistence.set_property(_t,Lt)),i(e?void 0:r.anonymousId()||void 0)},n=r.user();"then"in n&&yi(n.then)?n.then(s):s(n)}(t,e=>{r.register(((t,i)=>{"undefined"!=typeof Promise&&Promise.resolve||qn.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()||(qn.info("No userId set, resetting PostHog"),t.reset()),s||(i=void 0),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(qn.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,Ht)},identify(t){return e(t,Vt)},screen(t){return e(t,"$screen")}}})(t,e)).then(()=>{i()},t=>{qn.error("Failed to register the Segment integration",t),i()})},e)}var Wn="posthog-js";function Gn(t,i){var e=void 0===i?{}:i,s=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)||[],g=p.map(t=>r({},t,{stacktrace:t.stacktrace?r({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>r({},t,{platform:"web:javascript"}))}):void 0})),_={$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:g,$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 s&&n&&(_.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+i.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(_)),i}}var Kn=class{constructor(t,i,e,r,s,n){this.name=Wn,this.setupOnce=function(o){o(Gn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},Jn=class{constructor(t){this.co=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(ds.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==Gt?void 0:Gt.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(!(Si(n)||Si(o)||Si(a)||Si(l)||Si(h)||Si(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?zi(o/n,0,1,ds):1,v=n>1?zi(a/n,0,1,ds):1,c=l>1?zi(h/l,0,1,ds):1,f=l>1?zi(u/l,0,1,ds):1;r=ps(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}},Yn=["flags","surveys"],Xn={[h]:{exposure:"hidden"},[c]:{exposure:"hidden"},[f]:{exposure:"hidden"},[_]:{exposure:"hidden"},[g]:{exposure:"hidden"},[m]:{exposure:"event"},[b]:{exposure:"hidden"},[P]:{exposure:"hidden"},[y]:{exposure:"event"},[w]:{exposure:"hidden"},[x]:{exposure:"event"},[S]:{exposure:"event"},[k]:{exposure:"event"},[E]:{exposure:"hidden"},[T]:{exposure:"event"},[C]:{exposure:"hidden"},[F]:{exposure:"hidden"},[D]:{exposure:"hidden"},[j]:{exposure:"event"},[A]:{exposure:"event",shouldSkipFromEventProperties:t=>$i(t)},[B]:{exposure:"event"},[L]:{exposure:"event"},[N]:{exposure:"event"},[z]:{exposure:"event"},[U]:{exposure:"hidden"},[H]:{exposure:"hidden",storageGroup:"flags"},[q]:{exposure:"hidden",storageGroup:"flags"},[V]:{exposure:"hidden"},[W]:{exposure:"hidden",storageGroup:"flags"},[G]:{exposure:"hidden",storageGroup:"flags"},[K]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[J]:{exposure:"hidden",storageGroup:"flags"},[Y]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[it]:{exposure:"hidden",storageGroup:"surveys"},[et]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[rt]:{exposure:"event"},[st]:{exposure:"hidden"},[nt]:{exposure:"hidden"},[ot]:{exposure:"hidden"},[at]:{exposure:"hidden"},[lt]:{exposure:"hidden"},[ht]:{exposure:"event"},[ut]:{exposure:"event"},[dt]:{exposure:"event"},[vt]:{exposure:"event"},[ct]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[tt]:{exposure:"event"},[pt]:{exposure:"hidden"},[gt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[_t]:{exposure:"hidden"},[mt]:{exposure:"hidden"},[bt]:{exposure:"hidden"},[yt]:{exposure:"hidden"},[wt]:{exposure:"hidden"},[xt]:{exposure:"hidden"},[St]:{exposure:"hidden"},[I]:{exposure:"event"},[R]:{exposure:"event"},[O]:{exposure:"event"},[M]:{exposure:"event"},[$t]:{exposure:"event"},[Pt]:{exposure:"event"},[Tt]:{exposure:"event"},[Ct]:{exposure:"event"},[Ft]:{exposure:"event"},[At]:{exposure:"event"},[It]:{exposure:"event"},[Rt]:{exposure:"event"},[Ot]:{exposure:"event"},[Mt]:{exposure:"event"},[Dt]:{exposure:"event"}},Zn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Qn=t=>{var i=Xn[t];if(i)return i;for(var e of Zn){var r=e[1];if(0===t.indexOf(e[0]))return r}},to=(t,i)=>{try{var e;return JSON.stringify(t,(t,i)=>Mi(i)?(null!=e||(e=new WeakMap),e.has(i)||e.set(i,ys(i)),e.get(i)):"bigint"==typeof i?i.toString():i,i)}catch(i){return di(t)}},io=t=>{var i=null==Yt?void 0:Yt.createElement("a");return Si(i)?null:(i.href=t,i)},eo=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(!bi(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){ds.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ro=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("=");bi(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},so=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},no=(t,i)=>t>=i&&ri(),oo=(t,i,e,r)=>{if(0===t){if(ri()){var s=i+1;return s===e&&r(),s}return i}return 0},ao=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],lo=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ao],ho="<masked>",uo=["li_fat_id"];function vo(t,i,e){if(!Yt)return{};var r,s=i?[...ao,...e||[]]:[],n=co(ro(Yt.URL,s,ho),t);return ps((r={},fs(uo,function(t){var i=Es(t);r[t]=i||null}),r),n)}function co(t,i){var e=lo.concat(i||[]),r={};return fs(e,function(i){var e=eo(t,i);r[i]=e||null}),r}function fo(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(!$i(i)){r.$search_engine=i;var s=Yt?eo(Yt.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function po(){return navigator.language||navigator.userLanguage}var go="$direct";function _o(){return(null==Yt?void 0:Yt.referrer)||go}function mo(t,i,e){var r;void 0===e&&(e=!1);var s=t?[...ao,...i||[]]:[],n=null==(r=e?tr(null==Xt?void 0:Xt.href):null==Xt?void 0:Xt.href)?void 0:r.substring(0,1e3);return{r:_o().substring(0,1e3),u:n?ro(n,s,ho):void 0}}function bo(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?tr(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==go?go:null==(e=io(r))?void 0:e.host};if(n){o.$current_url=n;var a=io(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,ps(o,co(n))}return r&&ps(o,fo(r)),o}function yo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function wo(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var xo={flags:gt,surveys:et},So=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ko=t=>t+"_cookie_identity_change_pending",Eo=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},$o="main",Po=[H,q,W,G,K,gt,J,Z],To=t=>-1!==Po.indexOf(t),Co=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},Fo=t=>{if(!t)return{};var i=JSON.parse(t);return wi(i)?i:{}},Ao=(t,i)=>{fs(t,(e,r)=>{var s=Qn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]})},Io=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&&ds.info("Persistence loaded",t.persistence,r({},this.props)),this.update_config(t,t,i),this.save(),Gt){var s=()=>this.flush();Ss(Gt,"beforeunload",s,{capture:!1}),Ss(Gt,"pagehide",s,{capture:!1}),this.Lo=t=>{if(this._o&&(!t.storageArea||t.storageArea===(null==Gt?void 0:Gt.localStorage))&&t.key)if(t.key!==this.Fo){if(this.ko){var i=Yn.find(i=>t.key===this.No(i));i&&this.qo(t.key,i)}}else this.qo(t.key,$o)},Ss(Gt,"storage",this.Lo)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var i=t[0],e=t[1],r=this.Co.get(i);if(To(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&&Gt&&(Gt.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=Bs.li(t),$i(s)){var n=this.Ho(i);return n.storageValue=null,i!==$o&&(n.persisted=!1),!1}r=Fo(s)}catch(t){return!1}var o=i===$o?r:Bs.di(this.Fo);if(o&&this.zo(o))return!1;var a=this.Uo(r,i,e);return i===$o&&this.ko&&!Co(this.Wo().main,r)||this.Vo(r,i,!0,s),a}zo(t){var i=this.props[u],e=t[u];return!Si(i)&&!Si(e)&&i!==e}Vo(t,i,e,r){var s=this.Ho(i);s.storageValue=r,i!==$o&&(s.persisted=e);try{s.fingerprint=this.Go(t,i)}catch(t){s.fingerprint=void 0}}Uo(t,i,e){var r=!1;return Po.forEach(e=>{var s,n=null==(s=Qn(e))?void 0:s.storageGroup;if(!(i===$o&&this.ko&&n||i!==$o&&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&&Co(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=Bs.li(this.Fo),e=this.Ho($o),r=!1,s=!1;if(i!==e.storageValue)if($i(i))e.storageValue=null;else{if(t=Fo(i),this.Io=!this.Mo&&this.zo(t),this.Io)return!1;s=this.Uo(t,$o,!1),!this.ko||Co(this.Wo().main,t)?this.Vo(t,$o,!0,i):e.storageValue=i,r=!0}return this.ko&&Yn.forEach(i=>{var e=Bs.li(this.No(i)),n=this.Ho(i),o=t||{},a=r&&Po.some(t=>{var e;return(null==(e=Qn(t))?void 0:e.storageGroup)===i&&t in o});if(e!==n.storageValue||a){if($i(e))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Uo(o,i,!1)||s));var l=Fo(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=Qn(t);null!=e&&e.volatile||(this.Ho((this.ko?null==e?void 0:e.storageGroup:void 0)||$o).fingerprint=void 0,this.Xo(t))}Yo(){Po.forEach(t=>this.Co.set(t,!0))}Do(){if(this._o)try{var t=Bs.li(this.Fo),i=Fo(t);this.Ho($o).storageValue=t,Po.forEach(t=>{var e,r=this.ko?null==(e=Qn(t))?void 0:e.storageGroup:void 0,s=r?Bs.li(this.No(r)):null;if(r){var n=this.Ho(r);n.storageValue=s,n.persisted=!$i(s)}var o=r&&!$i(s)?Fo(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 s=new Set(bi(i)?i:[]),n=new Set(bi(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}var o=wi(i)?r({},i):{},a=wi(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(To(t)){var r=this.Co.get(t);if(!0!==r){var s=i;if(this._o)try{var n,o=this.ko?null==(n=Qn(t))?void 0:n.storageGroup:void 0,a=o?this.No(o):this.Fo;s=Fo(Bs.li(a))[t]}catch(t){}var l=new Set(r||[]);if("$active_feature_flags"===t){if(!Si(i)&&!bi(i)||!Si(s)&&!bi(s)||!bi(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(!wi(e))return void(Co(s,e)?this.Co.delete(t):this.jo(t,!0));if(!Si(i)&&!wi(i)||Si(i)&&xi(e)&&Si(s))return void this.jo(t,!0);var v=wi(i)?i:{},c=wi(s)?s:{};new Set([...Object.keys(v),...Object.keys(e)]).forEach(t=>{t in v==t in e&&Co(v[t],e[t])||l.add(t)}),l.forEach(t=>{t in c==t in e&&Co(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 Ti(i)&&i>0?i:0}ia(t){if(this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase())if(t)try{var i=qs(t,this._n.cookie_persisted_properties||[]),e=Ws(i,this._n.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=Ds.li(this.Fo)||void 0;s&&Ks(this.Fo,s)===r&&(this.ra=r,this.na=s)}catch(t){}else try{var n=Ds.li(this.Fo)||void 0;this.ra=n?Ks(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=Ds.li(this.Fo)||void 0}catch(t){}if(!e||e===this.na)return!1;var r,s=Ks(this.Fo,e);try{r=Hs(JSON.parse(e))}catch(t){return!1}if((Ds.li(this.Fo)||void 0)!==e)return!1;this.ra=s,this.na=e;var n=Gs(this.Fo,e),o=[...Ns,...n.properties],a={};if(Object.keys(r).forEach(t=>{var i=r[t];(Si(i)||$i(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(a[t]=!0,delete r[t])}),xi(r))return!1;var l="distinct_id"in r||"anonymous"===r.$user_state||"identified"===r.$user_state,h=this.props,d=h[u],v=h[_t],f=ps({},h);[...Ns,...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=f[t];(n.isValid||-1===Ns.indexOf(t)||!1!==i&&0!==i)&&delete f[t]}}),this.props=ps(f,r),Po.forEach(t=>{var i=t in this.props;t in h===i&&Co(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(_t,Bt);var p=this.props[u],g=this.props[_t];return!l||p===d&&g===v||(this.Mo=!0,this.So=!0,Zs.ui(ko(this.Fo),!0),this.Qo(Z),this.Qo(q),this.Qo(H),this.Qo(W),this.Qo(G),this.Qo(K),this.Qo(gt),this.Qo(pt),this.Qo(ct),"anonymous"!==g||"identified"!==v&&"anonymous"!==r.$user_state&&(Si(d)||p===d)||(Ao(this.props,r),this.Qo(Q)),"identified"===g?this.props.$user_id=p:delete this.props.$user_id,this.Qo(c)),!0}consumeCookieIdentityChange(){var t=ko(this.Fo),i=this.So||!!Zs.li(t);return this.So=!1,i&&Zs.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&&(Si(this.la)||(clearTimeout(this.la),this.la=void 0),delete this.bo[$o],this.ua(!0))}ha(t){if(void 0===t&&(t=!0),this.xo)try{t?this.aa():Si(this.la)||(clearTimeout(this.la),this.la=void 0)}finally{this.xo=!1}}isDisabled(){return!!this.Bo}Oo(t){-1===So.indexOf(t.persistence.toLowerCase())&&(ds.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=[...Ns,...t];return r({},Bs,{di(t){try{var r,s={};try{r=Ds.li(t)||void 0,s=r?Hs(JSON.parse(r)):{}}catch(t){}var n,o=JSON.parse(Bs.li(t)||"{}");if(i){var a=Gs(t,r),l=[...Ns,...a.properties],h={};Object.keys(s).forEach(t=>{var i=s[t];$i(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(h[t]=i)});var d="distinct_id"in h||"anonymous"===h.$user_state||"identified"===h.$user_state;if(Object.keys(h).length>0){var v,c=o[u],f=null!==(v=o.$user_state)&&void 0!==v?v:"anonymous";e.forEach(t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(d||"distinct_id"!==t&&"$user_state"!==t)){var i=o[t];(a.isValid||-1===Ns.indexOf(t)||!1!==i&&0!==i)&&delete o[t]}}),!d||"$user_state"in s||"$user_state"in o||(o[_t]=Bt),!d||("distinct_id"in h?h[u]:o[u])===c&&("$user_state"in h?h[_t]:o[_t])===f||(Ls.forEach(t=>delete o[t]),"identified"===h.$user_state&&"distinct_id"in h?o.$user_id=h[u]:delete o.$user_id,"identified"!==h.$user_state&&(delete o[tt],delete o[Q]),delete o.__alias)}n=ps(o,h)}else n=ps(s,o);return Bs.ui(t,n),n}catch(t){}return null},ui(e,r,s,n,o,a){var l=Bs.ui(e,r,void 0,void 0,a);try{var h=qs(r,t);if(Object.keys(h).length){if(i){var u=zs(e),d=Ws(h,t);if(Ds.ui(u,d,s,n,o,a),Ds.li(u)!==JSON.stringify(d)){Ds.hi(u,n);var v=qs(r);return Ds.ui(e,v,s,n,o,a),l}}Ds.ui(e,h,s,n,o,a)}}catch(t){Bs.ci(t)}return l},hi(t,i){try{null==Gt||Gt.localStorage.removeItem(t),Ds.hi(t,i),Ds.hi(zs(t),i)}catch(t){Bs.ci(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=!1,o=t.persistence.toLowerCase();return"localstorage"===o&&Bs.si()?(i=Bs,n=!0):"localstorage+cookie"===o&&e.si()?(i=e,n=!0,s=!0):"sessionstorage"===o&&Zs.si()?i=Zs:"memory"===o?i=Ys:"cookie"===o&&Ds.si()?(i=Ds,s=!0):e.si()?(i=e,n=!0,s=!0):Ds.si()?(i=Ds,s=!0):i=Ys,this._o=n,this.wo=s,i}No(t){return this.Fo+"__"+t}$o(t){return this._o&&!!t.split_storage}properties(){var t={};return fs(this.props,(i,e)=>{var r=Qn(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?Bs.di(this.Fo):null,r={};if(i)try{fs(r=Hs(Ds.di(this.Fo)),(t,i)=>{(Si(t)||$i(t)||""===t)&&delete r[i]})}catch(t){}var s=this.ao.di(this.Fo);if(s&&(this.props=ps({},s)),this.ko&&this.da(),i&&s){var n,o,a=null==e?void 0:e[u],l=null!==(n=null==e?void 0:e.$user_state)&&void 0!==n?n:"anonymous",h=s[u],d=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(h!==a||d!==l){this.So=!0,Zs.ui(ko(this.Fo),!0);var v=ps({},this.props);Ls.forEach(t=>delete v[t]),"anonymous"!==d||"identified"!==l&&"anonymous"!==r.$user_state&&(Si(a)||h===a)||(Ao(v,r),delete v[Q]),this.props=v;var c=new Set;Ls.forEach(t=>{var i,e=null==(i=Qn(t))?void 0:i.storageGroup;e&&c.add(e)}),c.forEach(t=>{var i={};fs(this.props,(e,r)=>{var s;(null==(s=Qn(r))?void 0:s.storageGroup)===t&&(i[r]=e)}),xi(i)?(Bs.hi(this.No(t)),this.bo[t]={}):Bs.ui(this.No(t),i)&&(this.bo[t]={persisted:!0,fingerprint:this.Go(i,t)})})}}Zs.li(ko(this.Fo))&&(this.So=!0)}}da(){for(var t of Yn){var i=Bs.di(this.No(t));if(i&&!xi(i)){var e=this.Ho(t);e.persisted=!0,this.va(t)||(e.fingerprint=this.Go(i,t)),this.ca(t,i)||ps(this.props,i)}}}va(t){return Object.keys(this.props).some(i=>{var e;return(null==(e=Qn(i))?void 0:e.storageGroup)===t})}ca(t,i){var e=xo[t];if(!e)return!1;var r=i[e],s=this.props[e];return Ti(r)&&Ti(s)&&s>r}refreshKey(t){var i;if(!(this.Bo||"$fbc_persistence"===t&&this.Eo)){var e=this.ko?null==(i=Qn(t))?void 0:i.storageGroup:void 0,r=e?Bs.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?Si(this.la)&&(this.la=setTimeout(()=>{this.la=void 0,this.ua()},t)):this.ua()}}flush(){Si(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(g));var i=!t&&!this.To;i||(this.Io=!1);var e=!!i&&this.Ko();if(this.Io)this._n.debug&&ds.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,$o);"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,$o);"written"===s&&this.ia(e),"failed"!==s&&(this.Mo=!1,this.Eo=!1,Po.forEach(t=>{var i;null!=(i=Qn(t))&&i.storageGroup||this.Co.delete(t)}));var n=function(i){var e,s=r[i];if(xi(s)&&(null==(e=t.bo[i])||!e.persisted))return Po.forEach(e=>{var r;(null==(r=Qn(e))?void 0:r.storageGroup)===i&&t.Co.delete(e)}),1;var n=t.pa(Bs,t.No(i),s,i);"failed"!==n&&Po.forEach(e=>{var r=Qn(e);(null==r?void 0:r.storageGroup)!==i||"written"!==n&&r.volatile||t.Co.delete(e)})};for(var o of Yn)if(n(o))continue}Wo(){var t={},i={flags:{},surveys:{}};return fs(this.props,(e,r)=>{var s,n=null==(s=Qn(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e}),{main:t,groups:i}}Go(t,i){if(i===$o)return JSON.stringify(t)+"|"+this.ga+"|"+this.ma+"|"+this.ya;var e={};return fs(t,(t,i)=>{var r;e[i]=null!=(r=Qn(i))&&r.volatile?"__volatile__":t}),JSON.stringify(e)}pa(t,i,e,r){var s,n=this.Ho(r);if(r!==$o&&!n.dirty&&!Si(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!==$o&&(n.persisted=!0),Si(s)||(n.fingerprint=s),this._o&&(n.storageValue=Bs.li(i)),"written"):(this._n.debug&&ds.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(),Si(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 Yn)Bs.hi(this.No(r));e?delete this.bo[$o]:this.bo={},this.ra=void 0,this.na=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(wi(t)){this.syncCookieProperties(),Si(i)&&(i="None"),this.ga=Si(e)?this.ba:e;var r=!1;if(fs(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(wi(t)){this.syncCookieProperties(),this.ga=Si(i)?this.ba:i;var e=!1;if(fs(t,(i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||wi(i)||bi(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==Yt?void 0:Yt.URL;if(t!==this.Po){var i=vo(this._n.custom_campaign_params,this._n.mask_personal_data_properties,this._n.custom_personal_data_properties),e=!xi(bs(i));return e&&this.register(i),this.Po=t,e?i:void 0}}update_search_keyword(){var t;this.register((t=null==Yt?void 0:Yt.referrer)?fo(t):{})}update_referrer_info(){var t;this.register_once({$referrer:_o(),$referring_domain:null!=Yt&&Yt.referrer&&(null==(t=io(Yt.referrer))?void 0:t.host)||go},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=mo(this._n.mask_personal_data_properties,this._n.custom_personal_data_properties,this._n.disable_capture_url_hashes);this.register_once({[xt]:this.wo?{r:Eo(t.r),u:t.u?Eo(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};fs([wt,yt],i=>{var e=this.props[i];e&&fs(e,function(i,e){t["$initial_"+ui(e)]=i})});var i=this.props[xt];return i&&ps(t,function(t,i){void 0===i&&(i=!1);var e=bo(t,i),r={};return fs(e,function(t,i){r["$initial_"+ui(i)]=t}),r}(i,this._n.disable_capture_url_hashes)),t}safe_merge(t){return fs(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){var s=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=s||n,a=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,h=!!this.Bo&&!l;l||this.sa(i,h),this._n=t,!l&&(s||n||a)&&(this.ra=void 0,this.na=void 0,this.sa(r({},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[$o],this.ua()))}finally{this.To=!1,c&&this.ha()}}_a(){var t=this.props[xt];if(this.wo&&wi(t)&&"string"==typeof t.r){var i=Eo(t.r),e="string"==typeof t.u?Eo(t.u):t.u;i===t.r&&e===t.u||this.Jo(xt,r({},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(_,e),this.save()}remove_event_timer(t){var i=this.props.__timers||{},e=i[t];return Si(e)||(delete i[t],this.Jo(_,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||Co(s,i)||(this.Eo=!0),this.ta(t,s,i),null!=(r=Qn(t))&&r.volatile||this.Xo(t))}Qo(t,i){void 0===i&&(i=!0),delete this.props[t],i&&(To(t)&&this.jo(t,!0),"$fbc_persistence"===t&&(this.Eo=!0),this.Xo(t))}Xo(t){var i,e=null==(i=Qn(t))?void 0:i.storageGroup;e&&(this.Ho(e).dirty=!0)}Ho(t){return this.bo[t]||(this.bo[t]={})}},Ro="gzip-js",Oo="base64",Mo="events",Do="cancelEvents",jo="survey shown",Bo="survey dismissed",Lo="survey sent",No="$survey_last_seen_date",zo="popover";function Uo(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&yi(e.then)&&e.then(void 0,()=>{})}}}}var Ho=vs("[RateLimiter]"),qo=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=>{Ho.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void Ho.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=(Ti(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(bt,a),{isRateLimited:l,remainingTokens:a.tokens}}ka(t){var i=this.instance.config.property_denylist;return!bi(i)||!i.includes(t)}Sa(){var t;if(this.ka("$current_url")&&this.ka("$pathname")&&null!=Xt&&Xt.pathname)return""+(null!==(t=Xt.origin)&&void 0!==t?t:"")+Xt.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}},Vo=vs("[RemoteConfig]"),Wo=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=ni._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}xa(t){var i,e;null!=(i=ni.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=ni.__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 Vo.info("Using preloaded remote config",this.remoteConfig),void this.Ta(this.remoteConfig);if(this._instance.Ma())return void Vo.warn("Remote config is disabled. Falling back to local config.");this.xa(t=>{if(!t)return Vo.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){Vo.error("Error loading remote config",t),this.Ta()}}Ta(t,i){!t&&i&&(0===i.statusCode?i.error||Vo.warn("Failed to fetch remote config from PostHog."):Vo.error("Failed to fetch remote config from PostHog."));try{this._instance.Ta(t?{ok:!0,config:t}:{ok:!1})}catch(t){Vo.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){Vo.error("Error loading feature flags",t)}}},Go=Uint8Array,Ko=Uint16Array,Jo=Uint32Array,Yo=new Go([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]),Xo=new Go([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]),Zo=new Go([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qo=function(t,i){for(var e=new Ko(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new Jo(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]},ta=Qo(Yo,2),ia=ta[1];ta[0][28]=258,ia[258]=28;for(var ea=Qo(Xo,0)[1],ra=new Ko(32768),sa=0;32768>sa;++sa){var na=(43690&sa)>>>1|(21845&sa)<<1;ra[sa]=((65280&(na=(61680&(na=(52428&na)>>>2|(13107&na)<<2))>>>4|(3855&na)<<4))>>>8|(255&na)<<8)>>>1}var oa=function(t,i,e){for(var r=t.length,s=0,n=new Ko(i);r>s;++s)++n[t[s]-1];var o,a=new Ko(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Ko(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[ra[d]>>>l]=h}else for(o=new Ko(r),s=0;r>s;++s)o[s]=ra[a[t[s]-1]++]>>>15-t[s];return o},aa=new Go(288);for(sa=0;144>sa;++sa)aa[sa]=8;for(sa=144;256>sa;++sa)aa[sa]=9;for(sa=256;280>sa;++sa)aa[sa]=7;for(sa=280;288>sa;++sa)aa[sa]=8;var la=new Go(32);for(sa=0;32>sa;++sa)la[sa]=5;var ha=oa(aa,9,0),ua=oa(la,5,0),da=function(t){return(t/8|0)+(7&t&&1)},va=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Ko?Ko:t instanceof Jo?Jo:Go)(e-i);return r.set(t.subarray(i,e)),r},ca=function(t,i,e){var r=i/8|0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},fa=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 Go(0),0];if(1==s){var o=new Go(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 Ko(v+1),f=ga(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;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+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;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 Go(c),f]},ga=function(t,i,e){return-1==t.s?Math.max(ga(t.l,i,e+1),ga(t.r,i,e+1)):i[t.s]=e},_a=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Ko(++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]},ma=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},ba=function(t,i,e){var r=e.length,s=da(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)},ya=function(t,i,e,r,s,n,o,a,l,h,u){ca(i,u++,e),++s[256];for(var d=pa(s,15),v=d[0],c=d[1],f=pa(n,15),p=f[0],g=f[1],_=_a(v),m=_[0],b=_[1],y=_a(p),w=y[0],x=y[1],S=new Ko(19),k=0;m.length>k;++k)S[31&m[k]]++;for(k=0;w.length>k;++k)S[31&w[k]]++;for(var E=pa(S,7),P=E[0],T=E[1],C=19;C>4&&!P[Zo[C-1]];--C);var F,A,I,R,O=h+5<<3,M=ma(s,aa)+ma(n,la)+o,D=ma(s,v)+ma(n,p)+o+14+3*C+ma(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(M>=O&&D>=O)return ba(i,u,t.subarray(l,l+h));if(ca(i,u,1+(M>D)),u+=2,M>D){F=oa(v,c,0),A=v,I=oa(p,g,0),R=p;var j=oa(P,T,0);for(ca(i,u,b-257),ca(i,u+5,x-1),ca(i,u+10,C-4),u+=14,k=0;C>k;++k)ca(i,u+3*k,P[Zo[k]]);u+=3*C;for(var B=[m,w],L=0;2>L;++L){var N=B[L];for(k=0;N.length>k;++k)ca(i,u,j[z=31&N[k]]),u+=P[z],z>15&&(ca(i,u,N[k]>>>5&127),u+=N[k]>>>12)}}else F=ha,A=aa,I=ua,R=la;for(k=0;a>k;++k)if(r[k]>255){var z;fa(i,u,F[257+(z=r[k]>>>18&31)]),u+=A[z+257],z>7&&(ca(i,u,r[k]>>>23&31),u+=Yo[z]);var U=31&r[k];fa(i,u,I[U]),u+=R[U],U>3&&(fa(i,u,r[k]>>>5&8191),u+=Xo[U])}else fa(i,u,F[r[k]]),u+=A[r[k]];return fa(i,u,F[256]),u+A[256]},wa=new Jo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),xa=new Go(0),Sa=function(){for(var t=new Jo(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),ka=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function Ea(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=Sa[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 Go(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=ba(l,h,t.subarray(u,d)):(l[u]=n,h=ba(l,h,t.subarray(u,o)))}else{for(var v=wa[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new Ko(32768),_=new Ko(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 Jo(25e3),x=new Ko(288),S=new Ko(32),k=0,E=0,P=(u=0,0),T=0,C=0;o>u;++u){var F=y(u),A=32767&u,I=_[F];if(g[A]=I,_[F]=A,u>=T){var R=o-u;if((k>7e3||P>24576)&&R>423){h=ya(t,l,0,w,x,S,E,P,C,u-C,h),P=k=E=0,C=u;for(var O=0;286>O;++O)x[O]=0;for(O=0;30>O;++O)S[O]=0}var M=2,D=0,j=f,B=A-I&32767;if(R>2&&F==y(u-B))for(var L=Math.min(c,R)-1,N=Math.min(32767,u),z=Math.min(258,R);N>=B&&--j&&A!=I;){if(t[u+M]==t[u+M-B]){for(var U=0;z>U&&t[u+U]==t[u+U-B];++U);if(U>M){if(M=U,D=B,U>L)break;var H=Math.min(B,U-2),q=0;for(O=0;H>O;++O){var V=u-B+O+32768&32767,W=V-g[V]+32768&32767;W>q&&(q=W,I=V)}}}B+=(A=I)-(I=g[A])+32768&32767}if(D){w[P++]=268435456|ia[M]<<18|ea[D];var G=31&ia[M],K=31&ea[D];E+=Yo[G]+Xo[K],++x[257+G],++S[K],T=u+M,++k}else w[P++]=t[u],++x[t[u]]}}h=ya(t,l,n,w,x,S,E,P,C,u-C,h),n||(h=ba(l,h,xa))}return va(a,0,r+da(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&&ka(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),ka(u,d-8,e.d()),ka(u,d-4,r),u}var $a=!!Qt||!!Zt,Pa="text/plain",Ta=!1,Ca=(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:"")},Fa=function(t,i,e){var s;void 0===e&&(e=!0);var n=t.split("?"),o=n[0],a=n[1],l=r({},i),h=null!==(s=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!==s?s:[],u=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return fs(t,function(t,i){Si(t)||Si(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},Aa=t=>{if(t.Ia)return t.Ia;var i=t.data,e=t.compression;if(i){if(e===Ro){var r=Ea(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new Go(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 Go(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 va(e,0,r)}(to(i)),{mtime:0});return{contentType:Pa,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Oo){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:to(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(to(i)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=to(i);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Ia=t=>{var i,e,s=()=>"sendBeacon"===t.transport?{url:Fa(t.url,{compression:Oo}),encodedBody:Aa(r({},t,{compression:Oo,Ia:void 0}))}:{url:Ca(t.url,"compression"),encodedBody:Aa(r({},t,{compression:void 0,Ia:void 0}))};try{i=Aa(t)}catch(i){if(zr(t.compression,eo(t.url,"compression")))return ds.error("Failed to gzip request body, sending uncompressed payload",i),s();throw i}return i&&zr(t.compression,eo(t.url,"compression"))&&!((e=i.body)instanceof ArrayBuffer?Nr(new Uint8Array(e)):ArrayBuffer.isView(e)&&Nr(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?(Ta=!0,s()):{url:t.url,encodedBody:i}},Ra=t=>{try{return Ia(t)}catch(i){return ds.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},Oa=function(){var t=n(function*(t){var i=yield function(t,i,e){return Vr.apply(this,arguments)}(to(t.data),l.DEBUG,{rethrow:!0});if(!i)return t;var e=yield i.arrayBuffer();return r({},t,{Ia:{contentType:Pa,body:e,estimatedSize:e.byteLength}})});return function(i){return t.apply(this,arguments)}}(),Ma=/Failed to fetch|NetworkError|Load failed/i,Da=t=>"TypeError"===(null==t?void 0:t.name)&&Ma.test((null==t?void 0:t.message)||""),ja=t=>{var i=Ra(t);if(i){var e=i.url,s=i.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;fs(t.headers,function(t,i){h.append(i,t)}),o&&h.append("Content-Type",o);var u=null,d=!1;if(ti){var v=new ti;u={signal:v.signal,timeout:setTimeout(()=>{var i;d=!0,v.abort(Qe("AbortError","PostHog request timed out"+((i=t.timeout)?" after "+i+"ms":"")))},t.timeout)}}var c=i=>{d&&"AbortError"===(null==i?void 0:i.name)||Da(i)?ds.warn(i):ds.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var f;Zt(e,r({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.Ea&&52428.8>(l||0),body:a,signal:null==(f=u)?void 0:f.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){ds.error(t)}null==t.callback||t.callback(r)})).catch(c).finally(()=>u?clearTimeout(u.timeout):null)}catch(t){u&&clearTimeout(u.timeout),c(t)}}},Ba=t=>{try{var i,e=Ia(t),s=e.url,n=e.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var h=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(Jt.sendBeacon(s,h))return;var u=bi(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(bi(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=i=>bi(t.data)?i:r({},t.data,{batch:i});return Ba(r({},t,{data:v(u.slice(0,d))})),void Ba(r({},t,{data:v(u.slice(d))}))}ds.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),ja(r({},t,{Ea:!0}))}catch(t){ds.warn("Beacon send failed",t)}},La=(t,i,e,s)=>{var n="query"===s?"POST"===i?"sent_at":"_":void 0;return Fa(e===Ro?Ca(t,"compression"):t,r({},n?{[n]:Date.now().toString()}:{},e===Ro?{}:{compression:e}))},Na=[];Zt&&Na.push({transport:"fetch",method:ja}),Qt&&Na.push({transport:"XHR",method(t){var i=Ra(t);if(i){var e=new Qt,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;fs(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!=Jt&&Jt.sendBeacon&&Na.push({transport:"sendBeacon",method:Ba});var za=class{constructor(t,i){this.Ra=!0,this.Aa=[],this.Pa=zi((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,ds.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(r({},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&&bi(e.data)&&fs(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){ds.error(t)}}Da(){clearTimeout(this.Oa),this.Oa=void 0}La(){var t={};return fs(this.Aa,i=>{var e,s=i,n=(s?s.batchKey:null)||s.url;Si(t[n])&&(t[n]=r({},s,{data:[]})),null==(e=t[n].data)||e.push(s.data)}),this.Aa=[],t}},Ua=class{constructor(t){this._instance=t,this.qa=!1,this.ja=3e3,this.Aa=[],this.Aa=[],this.Ba=!0,!Si(Gt)&&"onLine"in Gt.navigator&&(this.Ba=Gt.navigator.onLine,this.Ha=()=>{this.Ba=!0,this.za()},this.Ua=()=>{this.Ba=!1},Ss(Gt,"online",this.Ha),Ss(Gt,"offline",this.Ua))}get length(){return this.Aa.length}retriableRequest(i){var s=i.retriesPerformedSoFar,n=e(i,t);Ci(s)&&(n.url=Fa(n.url,{retry_count:s})),this._instance._send_request(r({},n,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=s?s:0))return void this.cs(r({retriesPerformedSoFar:s},n));0===t.statusCode&&ds.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!=s?s: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)"),ds.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,Si(Gt)||(this.Ha&&(Gt.removeEventListener("online",this.Ha),this.Ha=void 0),this.Ua&&(Gt.removeEventListener("offline",this.Ua),this.Ua=void 0)),this.Aa)){var i=t.requestOptions;try{this._instance._send_request(r({},i,{transport:"sendBeacon"}))}catch(t){ds.error(t)}}this.Aa=[]}},Ha=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(){Ss(Gt,"scroll",this.Ga,{capture:!0}),Ss(Gt,"scrollend",this.Ga,{capture:!0}),Ss(Gt,"resize",this.Ga)}scrollElement(){var t;if(!this.Ja)return null==Gt||null==(t=Gt.document)?void 0:t.documentElement;for(var i of bi(this.Ja)?this.Ja:[this.Ja]){var e,r=null==Gt||null==(e=Gt.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 Gt?"y"===t?Gt.scrollY||Gt.pageYOffset||(null==(i=Gt.document)||null==(i=i.documentElement)?void 0:i.scrollTop)||0:Gt.scrollX||Gt.pageXOffset||(null==(e=Gt.document)||null==(e=e.documentElement)?void 0:e.scrollLeft)||0:0}scrollY(){return this.Qa("y")}scrollX(){return this.Qa("x")}},qa=t=>mo(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),Va=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({[mt]:e})}},this._instance=t,this.tl=i,this.Ya=e,this.Xa=r||qa,this.tl.onSessionId(this.Te)}Ka(){return this.Ya.props[mt]}getSetOnceProps(){var t,i=null==(t=this.Ka())?void 0:t.props;return i?"r"in i?bo(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 fs(bs(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+ui(e)]=i}),t}},Wa=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={}}},Ga=vs("[SessionId]"),Ka=864e5,Ja=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 Wa,this.ll=(t,i)=>!(!Ci(t)||!Ci(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||As,this.dl=e||As;var s=this._n.persistence_name||this._n.token;if(this._sessionTimeoutMs=1e3*zi(this._n.session_idle_timeout_seconds||1800,60,36e3,Ga.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=Zs.di(this.cl),o=Zs.di(this.fl);n&&!o?this.Ie=n:Zs.hi(this.cl),Zs.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 Si(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&&Zs.si()}ml(t){t!==this.Ie&&(this.Ie=t,this.pl()&&Zs.ui(this.cl,t))}yl(){return this.Ie?this.Ie:this.pl()?Zs.di(this.cl):null}bl(t){var i=this.rl;return!$i(i)&&!$i(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({[D]:[i,t,e]}))}wl(){var t,i=null==(t=this._n)?void 0:t.persistence_save_debounce_ms;return Ci(i)&&i>0}kl(){this.wl()?this.Ya.refreshKey(D):(this.Ya.flush(),this.Ya.load())}Sl(){var t;if(!$i(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({[D]:[this._sessionActivityTimestamp,null!==(t=this.Bt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ya.flush())}}Cl(){var t=this.xl()[0],i=Ci(t)?t:0,e=Ci(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[D];return bi(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 Ga.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Ga.error("Invalid sessionID in bootstrap",t)}}(t);return!Si(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&&Gt&&(Gt.removeEventListener(Ut,this.ol,{capture:!1}),this.ol=void 0),this.sl=[]}gl(){this.ol=()=>{this.Sl(),this.pl()&&Zs.hi(this.fl)},Ss(Gt,Ut,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($i(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=!Si(s)&&l!==s,d=this.Cl(),v=this.yl(),c=this.ul,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ka),p=c?f:Ci(h)&&Math.abs(r-h)>Ka,g=!1,_=u,m=!l||!!c,b=l,y=!m&&!t&&this.ll(r,d);if(y){(y=this.Tl(r))||Ga.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.xl();l=w[1],h=w[2]}if(m||y||p){_=!1;var x=c&&!f;l=x?c.sessionId:this.hl(),v=this.dl(),Ga.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.ul=void 0,g=!0}else v||(v=this.dl(),g=!0),(_=_||l!==b)&&(Ga.info("adopted cross-tab session id",{sessionId:l,windowId:v}),g=!0);var S=Ci(d)&&t&&!p?d:r,k=Ci(h)?h:(new Date).getTime();this.ml(v),this._l(l,S,k),t||this.vl();var E={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:_};return g&&this.sl.forEach(t=>t(l,v,E)),{sessionId:l,windowId:v,sessionStartTimestamp:k,changeReason:g?E: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))}},Ya=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&ai(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>ai(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function Xa(){return(Xa=n(function*(){var t=null==Jt?void 0:Jt.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i,e=null==(i=yield t.getHighEntropyValues(["model"]))?void 0:i.model;return ki(e)&&e.length>0?e:void 0}catch(t){return void ds.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Za(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 Qa(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var tl=(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}},il=t=>t.toLowerCase(),el={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=>tl(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!tl(i,t))),icontains:(t,i)=>i.map(il).some(i=>t.map(il).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(il).every(i=>t.map(il).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 rl(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=el[e.operator];return!!s&&s(e.values,[String(r)])})}function sl(t,i,e){return to({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var nl="custom",ol="i.posthog.com",al=/^\/static\//,ll=["/s/","/e/","/i/"],hl=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("."+ol,".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":nl),this.Il[this.apiHost]}El(t){if(al.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}Rl(t){var i=io(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=io(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&ll.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===nl)return this.Al(t,i,this.apiHost+i);var r=ol+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)}}},ul=vs("[Surveys]"),dl=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){ul.error("Failed to persist survey seen state",t)}},vl=["popover","widget","api"],cl={ignoreConditions:!1,ignoreDelay:!1,displayType:zo},fl=vs("[PostHog ExternalIntegrations]"),pl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},gl=class{constructor(t){this._instance=t}do(t,i){var e;null==(e=ni.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,t=>{if(t)return fl.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=ni.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t.do(pl[n],()=>{var i;null==(i=ni.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)}),!o&&null!=(r=ni.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=ni.__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()}}},_l=class{constructor(t,i){this.A=t,this.Hs=i,this.Fl=new Map,this.Js=!1}add(t){var i=this;return n(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&&yi(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)}}},ml=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);Si(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)}},bl="extensionsRemoteConfig",yl=class{constructor(t){this.instance=t,this.Js=!1,this.A=ds,this.$l=t.Dl,this.kv=new ml(t),this.onEvent=t=>Uo(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 Uo(()=>{});var i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.Ll.on(bl,i);return this.$l&&i(this.$l),Uo(e)},this.Nl=new _l(ds.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(d);return"string"==typeof t?t:void 0}get library(){return{name:l.LIB_NAME,version:l.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 n(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 Uo(this.instance.ql(t))}handleRemoteConfig(t){this.Js||(this.$l=t,this.instance.Ll.emit(bl,t))}sendRequest(t,i){var e=this;return n(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?Fa(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?ci.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())}},wl={},xl=0,Sl=()=>{},kl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',El="Surveys module not available",$l="sanitize_properties is deprecated. Use before_send instead",Pl="Invalid value for property_denylist config: ",Tl=/^[A-Za-z0-9_-]{1,400}$/,Cl=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Fl=["token","distinct_id",Et],Al="posthog",Il=!$a&&-1===(null==ei?void 0:ei.indexOf("MSIE"))&&-1===(null==ei?void 0:ei.indexOf("Mozilla")),Rl=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},Ol=t=>{var i;return r({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:xs(null==Yt?void 0:Yt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Sl,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:Xt&&ki(null==Xt?void 0:Xt.search)&&-1!==Xt.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==Gt||null==(i=Gt.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){ds.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:Nt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Sl},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:bn,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Rl(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))},Ml=[["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"]],Dl=t=>{var i={};for(var e of Ml){var r=e[0],s=e[1];Si(t[r])||(i[s]=t[r])}var n=ps({},i,t),o=t.__preview_external_dependency_versioned_paths;return Si(o)||(Si(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),ki(o)&&Si(t.asset_host)&&(n.asset_host=o)),bi(t.property_blacklist)&&(Si(t.property_denylist)?n.property_denylist=t.property_blacklist:bi(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:ds.error(Pl+t.property_denylist)),n},jl=class{constructor(){this.__forceAllowLocalhost=!1}get jl(){return this.__forceAllowLocalhost}set jl(t){ds.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Bl=(s=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(As());this.register({distinct_id:e,$device_id:e}),t.set_property(_t,Bt)}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=l.LIB_VERSION,this.Kl=new Set,this.Xl="",this.Ll=new Wa,this.Fl=[],this.Yl=[],this.Vl=!1,this.Wl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ol(),this.SentryIntegration=Kn,this.sentryIntegration=t=>function(t,i){var e=Gn(t,i);return{name:Wn,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 Ha(this),this.pageViewManager=new Jn(this),this.rateLimiter=new qo(this),this.requestRouter=new hl(this),this.consent=new Qs(this),this.externalIntegrations=new gl(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=ki(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=ki(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",t=>ds.info('send "'+(null==t?void 0:t.event)+'"',t))}init(i,e,r){if(r&&r!==Al){var s,n=null!==(s=wl[r])&&void 0!==s?s:new t;return n._init(i,e,r),wl[r]=n,wl[Al][r]=n,n}return this._init(i,e,r)}_init(t,i,e){var s,n,o;void 0===i&&(i={});var a,h=ki(t)?t.trim():"";if(!h)return ds.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==(a=this.config)?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ol(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=Ol(i.defaults),d=Dl(i),c=ps({},u,d,{name:e,token:h});wi(u.rageclick)&&wi(d.rageclick)&&(c.rageclick=ps({},u.rageclick,d.rageclick)),wi(u.session_recording)&&wi(d.session_recording)&&(c.session_recording=ps({},u.session_recording,d.session_recording)),this.set_config(c),this.config.on_xhr_error&&ds.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Ro;var f=this.Zl();if(this.persistence=new Io(this.config,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Io(r({},this.config,{persistence:"sessionStorage"}),f,!1),this.Xl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!f&&Zs.si()){var p=Zs.di(this.Xl);bi(p)&&p.forEach(t=>{ki(t)&&this.Kl.add(t)})}else Zs.hi(this.Xl);var g=r({},this.persistence.props),_=r({},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 Ua(this),this.__request_queue=[];var m=this.zl();m||(this.sessionManager=new Ja(this),this.sessionPropsManager=new Va(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?(ds.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.vu(m)},0)):(ds.info("Initializing extensions synchronously"),this.vu(m)),l.DEBUG=l.DEBUG||this.config.debug,l.DEBUG&&ds.info("Starting in debug mode",{this:this,config:i,thisC:r({},this.config),p:g,s:_}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=r({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var b=null==(n=i.bootstrap)?void 0:n.distinctID;if(this.Vl=!!b&&!Ei(b),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var y=i.bootstrap.distinctID,w=this.get_distinct_id(),x=this.persistence.get_property(_t);if(i.bootstrap.isIdentifiedID&&null!=w&&w!==y&&"anonymous"===x)this.identify(y);else if(i.bootstrap.isIdentifiedID&&null!=w&&w!==y&&"identified"===x)ds.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(As()),k=i.bootstrap.isIdentifiedID?S:y;this.persistence.set_property(_t,i.bootstrap.isIdentifiedID?Lt:Bt),this.register({distinct_id:y,$device_id:k})}}if(m)this.register_once({distinct_id:kt,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(As());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(_t,Bt)}return Ss(Gt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?Vn(this,()=>this.cu()):this.cu(),yi(this.config._onCapture)&&this.config._onCapture!==Sl&&(ds.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&ds.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 Xa.apply(this,arguments)}().then(t=>{t&&this.register({[v]:t})}).catch(Sl),this}fu(t){var i=t;return ki(i.name)&&yi(i.setup)}pu(t,i){this.fu(t)?i.push(()=>{this.gu().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(i=>{ds.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)),yi(this.featureFlags.onReloading)&&yi(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,s,n,o,a,l,h,u=performance.now(),d=r({},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!==(s=this.surveys)&&void 0!==s?s: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,Un)),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){ds.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[$t]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Pt]:r}),this.config.__preview_deferred_init_extensions&&ds.info("PostHog extensions initialized ("+r+"ms)")}Ta(t){var i;if(!Yt||!Yt.body)return ds.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=li(r.supportedCompression,Ro)?Ro:li(r.supportedCompression,Oo)?Oo:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.iu?this.iu:Nt}),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){ds.critical("`loaded` function failed",t)}if(this.wu(),this.config.internal_or_test_user_hostname&&null!=Xt&&Xt.hostname){var t=Xt.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 Wo(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()&&cs(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(qt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.au)||r.unload(),null==(s=this.uu)||s.unload()):this.xu()&&this.capture(qt,null,{transport:"sendBeacon"})}_send_request(t){var i;this.__loaded?Il?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=r({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(Si(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,s,n=r({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&Si(n.compression)&&n.data&&(n.compression=Oo),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(bi(o=n.data)?o:[o]).map(t=>r({},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()),bi(t)?t.map(t=>r({},t,{sent_at:i})):r({},t,{sent_at:i})}(n.data))),n.url=La(n.url,n.method,n.compression,n.timestampMode);var v=Na.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),c=null!==(e=null==(s=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:s.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){Da(t)?ds.warn(t):ds.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Ro&&ii&&"undefined"!=typeof Promise&&!Ta?Oa(n).then(t=>{f(t)}).catch(i=>{if(Ur(i))return Ta=!0,void f(r({},n,{compression:void 0,url:La(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 Ur(t)||i===Lr})(i)&&(Ta=!0),f(n)}):c(n)})(r({},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){xl++;try{var i,e=[],r=[],s=[];cs(t,t=>{if(t)if(bi(i=t[0]))s.push(t);else if(yi(t))try{t.call(this)}catch(i){ds.error("Error executing queued PostHog call",t,i)}else bi(t)&&"alias"===i?e.push(t):bi(t)&&-1!==i.indexOf("capture")&&yi(this[i])?s.push(t):r.push(t)});var n=function(t,i){cs(t,function(t){try{if(bi(t[0])){var e=i;fs(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){ds.error("Error executing queued PostHog call",t,i)}})};n(e,this),n(r,this),n(s,this)}finally{xl--}}push(i){if(xl>0&&bi(i)&&ki(i[0])){var e=t.prototype[i[0]];yi(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(g);return ki(i)&&Cl.test(i)?{value:i,delivered:!1}:wi(i)&&ki(i.value)&&Cl.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}Tu(t,i,e,r){if(this.persistence){this.persistence.refreshKey(g);var s=this.Cu();if(!r){if(e)return ki(i)&&Cl.test(i)?(i!==(null==s?void 0:s.value)&&this.persistence.register({[g]:{value:i,delivered:!1}}),{value:i,pending:i!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(g);if(ki(t)&&Tl.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({[g]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(g)}}Mu(t){if(this.persistence){this.persistence.refreshKey(g);var i=this.Cu();(null==i?void 0:i.value)!==t||i.delivered||this.persistence.register({[g]:{value:t,delivered:!0}})}}capture(t,i,e){var s,n,o,a,l,h,u,d,v,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.au){if(this.is_capturing())if(!Si(t)&&ki(t)){this.Gl();var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var g=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==g||!g.isRateLimited){var _;null!=i&&i.$current_url&&!ki(null==i?void 0:i.$current_url)&&(ds.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||ds.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 m=new Date,b=(null==e?void 0:e.timestamp)||m,y=Ze(null==e?void 0:e.uuid,As),w={uuid:y,event:t,properties:this.calculateEventProperties(t,i||{},b,y)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&f&&(w.event="$bot_pageview",w.properties.$browser_type="bot"),g&&(w.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens);var x="$feature_flag_called"===t&&!1===w.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=e&&e.$set&&!x&&(w.$set=null==e?void 0:e.$set);var S=wi(null==i?void 0:i.$set)?i.$set:void 0,k=!(null==e||!e.$set)&&"$fbc"in e.$set,E=k||!!S&&"$fbc"in S,P=k?null==e||null==(s=e.$set)?void 0:s[p]:null==S?void 0:S[p],T=bi(null==i?void 0:i.$unset)?i.$unset:[],C=(null==e?void 0:e.$unset)||[],F=-1!==T.indexOf("$fbc")||-1!==C.indexOf("$fbc"),A=this.Tu(null==(n=_)?void 0:n.fbclid,P,E,F);A&&!0===w.properties.$process_person_profile&&A.pending&&!E&&!x&&(w.$set=r({[p]:A.value},w.$set));var I=null==e?void 0:e.$unset;I&&(w.$unset=I);var R=x?void 0:this.Eu(null==e?void 0:e.$set_once,t!==Wt,t===Vt);if(R&&(w.$set_once=R),null!=e&&e._noTruncate||(u=this.config.properties_string_max_length,d=w,v=t=>ki(t)?t.slice(0,u):t,c=new Set,w=function t(i,e){if(i!==Object(i))return v?v(i):i;if(!c.has(i)){var r;if(c.add(i),bi(i))r=[],cs(i,i=>{r.push(t(i))});else{var s={};fs(Mi(i)?ys(i):i,(i,e)=>{c.has(i)||(s[e]=t(i,e))}),r=s}return r}}(d)),w.timestamp=b,Si(null==e?void 0:e.timestamp)||(w.properties.$event_time_override_provided=!0,w.properties.$event_time_override_system_time=m),x&&(w.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return Br.forEach(r),i.forEach(r),e}(w.properties,Fl)),t===Bo||t===Lo){var O=null==i?void 0:i.$survey_id,M=null==i?void 0:i.$survey_iteration;dl({id:O,current_iteration:M}),w.$set=r({},w.$set,{[Za({id:O,current_iteration:M},t===Lo?"responded":"dismissed")]:!0})}else t===jo&&(w.$set=r({},w.$set,{[No]:(new Date).toISOString()}));if("product tour shown"===t){var D=null==i?void 0:i.$product_tour_type;D&&(w.$set=r({},w.$set,{["$product_tour_last_seen_date/"+D]:(new Date).toISOString()}))}var j=r({},w.properties.$set,w.$set);if(xi(j)||this.setPersonPropertiesForFlags(j),!Pi(this.config.before_send)){var B=this.ds(w);if(!B)return;(w=B).uuid=Ze(w.uuid,As)}var L=null!==(o=null==(a=w.$set)?void 0:a.$fbc)&&void 0!==o?o:wi(null==(l=w.properties)?void 0:l.$set)?w.properties.$set.$fbc:void 0,N=null!=A&&A.pending&&L===A.value?A.value:void 0;this.Ll.emit("eventCaptured",w);var z=null!==(h=null==e?void 0:e._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),U=r({method:"POST",url:z,data:w,compression:"best-available",timestampMode:"recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(z)?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},null!=e&&e.transport?{transport:e.transport}:{},N?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.Mu(N)}}:{});return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly||N?this.lu(U):this.au.enqueue(U),w}ds.critical("This capture call is ignored due to client rate limiting.")}}else ds.error("No event name provided to posthog.capture")}else ds.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 yl(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,s,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=r({},i);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.zl()&&(l[Et]=!0),"$snapshot"===t){var h=r({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!ki(l.distinct_id)&&!Ti(l.distinct_id)||Ei(l.distinct_id))&&ds.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(t,i,e,r){var s,n,o,l;if(void 0===r&&(r=!1),!ei)return{};var h,u=t?[...ao,...i||[]]:[],d=ze(ei),v=d[0],c=d[1],f=function(t){for(var i=0;qe.length>i;i++){var e,r=qe[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["",""]}(ei),p=f[0],g=f[1],_=null!=(h="u">typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},m={};Si(e)||(m.detectGoogleSearchApp=e);var b={},y=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,w=null==(n=navigator)?void 0:n.maxTouchPoints,x=null==Gt||null==(o=Gt.screen)?void 0:o.width,S=null==Gt||null==(l=Gt.screen)?void 0:l.height,k=null==Gt?void 0:Gt.devicePixelRatio;Si(y)||(b.userAgentDataPlatform=y),Si(w)||(b.maxTouchPoints=w),Si(x)||(b.screenWidth=x),Si(S)||(b.screenHeight=S),Si(k)||(b.devicePixelRatio=k);var E,P,T,C,F,A,I,R,O=ps(bs({$os:v,$os_version:c,$browser:je(ei,navigator.vendor,_,m),$webview_app:p,$webview_app_version:g,$device:Ue(ei),$device_type:(P=ei,T=b,R=Ue(P),R===Gi||R===Wi||"Kobo"===R||"Kindle Fire"===R||R===ge?Vi:R===oe||R===le||R===ae||R===fe?"Console":R===Ki?"Wearable":R?Hi:"Android"===(null==T?void 0:T.userAgentDataPlatform)&&(null!==(C=null==T?void 0:T.maxTouchPoints)&&void 0!==C?C:0)>0?600>Math.min(null!==(F=null==T?void 0:T.screenWidth)&&void 0!==F?F:0,null!==(A=null==T?void 0:T.screenHeight)&&void 0!==A?A:0)/(null!==(I=null==T?void 0:T.devicePixelRatio)&&void 0!==I?I:1)?Hi:Vi:"Desktop"),$timezone:yo(),$timezone_offset:wo()}),{$current_url:ro(r?tr(null==Xt?void 0:Xt.href):null==Xt?void 0:Xt.href,u,ho),$host:null==Xt?void 0:Xt.host,$pathname:null==Xt?void 0:Xt.pathname,$raw_user_agent:ei.length>1e3?ei.substring(0,997)+"...":ei,$browser_version:Le(ei,navigator.vendor,_,m),$browser_language:po(),$browser_language_prefix:(E=po(),"string"==typeof E?E.split("-")[0]:void 0),$screen_height:null==Gt?void 0:Gt.screen.height,$screen_width:null==Gt?void 0:Gt.screen.width,$viewport_height:null==Gt?void 0:Gt.innerHeight,$viewport_width:null==Gt?void 0:Gt.innerWidth,$lib:a.LIB_NAME,$lib_version:a.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return a.SDK_DIST_CHANNEL&&(O.$sdk_dist_channel=a.SDK_DIST_CHANNEL),O}(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 v=this.sessionManager.checkAndGetSessionAndWindowId(n,e.getTime(),!0),c=v.windowId;l.$session_id=v.sessionId,l.$window_id=c}this.sessionPropsManager&&ps(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&ps(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.uu)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===nl&&(l.$lib_custom_api_host=this.config.api_host),u="$pageview"!==t||n?"$pageleave"!==t||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,s),l=ps(l,u),"$pageview"===t&&Yt&&(l.title=Yt.title),!Si(o)){var p=e.getTime()-o;l.$duration=parseFloat((p/1e3).toFixed(3))}ei&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var g=this.persistence.properties(),_=this.sessionPersistence.properties(),m=l.$groups,b=g.$groups;wi(m)&&!xi(m)&&(l.$groups=r({},wi(b)?b:{},m)),fs(["$referrer","$referring_domain"],t=>{t in g&&delete _[t]});var y={};if(this.Yl.length>0)for(var w of this.Yl.slice())try{ps(y,w())}catch(t){ds.error("Failed to produce browser extension event properties",t)}(l=ps({},d,g,_,r({},y,l))).$is_identified=this._isIdentified(),bi(this.config.property_denylist)?fs(this.config.property_denylist,function(t){delete l[t]}):ds.error(Pl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(ds.error($l),l=x(l,t));var S=this.Pu();return l.$process_person_profile=S,S&&!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=ps({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(ds.error($l),s=n(s,"$set_once")),i&&(this.Ql=!0),xi(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||!Zs.si())Zs.hi(this.Xl);else{var i=[];this.Kl.forEach(t=>i.push(t)),i.length>0?Zs.ui(this.Xl,i):Zs.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:El}),()=>{})}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:El})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:El})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=cl),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:El}}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:El})}$u(t){return!t||Ei(t)?(ds.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(ds.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())||(ds.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 ds.uninitializedWarning("posthog.identify");if(Ti(t)&&(t=t.toString(),ds.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(c),this.register({distinct_id:t}));var h=(this.persistence.get_property("$user_state")||"anonymous")===Bt,u=t!==l,d=!u&&h;if(u&&h){var v,f=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:l};this.persistence.set_property(_t,Lt),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.aa(),this.capture(Vt,f,{$set:i||{},$set_once:e||{}}),this.ru=sl(t,i,e),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(d){this.persistence.set_property(_t,Lt);var p=i||{},g=e||{};this.setPersonPropertiesForFlags({$set:p,$set_once:g},!1),this.config.cookieWinsOnConflict&&this.persistence.aa(),this.capture("$set",{$set:p,$set_once:g}),this.ru=sl(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ct)):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=sl(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):ds.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(bi(t)?t:[t]).filter(t=>ki(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 s;if(t&&i){null==(s=this.persistence)||s.syncCookieProperties(),this.Ru();var n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:r({},n,{[t]:i})}),(o||e)&&this.Pu()){var a={$group_type:t,$group_key:i};e&&(a.$group_set=e),this.capture(Wt,a)}e&&this.setGroupPropertiesForFlags({[t]:e}),o&&!e&&this.reloadFeatureFlags()}else ds.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=Fi(t)?t:null==t?void 0:t.resetDeviceID,e=Fi(t)||null==t?void 0:t.bootstrap;this.Du(i,!1,e)}Du(t,i,e){var s,n,o,a;if(void 0===i&&(i=!1),ds.info("reset"),!this.__loaded)return ds.uninitializedWarning("posthog.reset");var l=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null==(s=this.su)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.Ma());var h=this.get_property(d),u=this.get_property(v),c=this.get_property(C);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var f=this.is_capturing();this.consent.reset(),i||!f||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 p=null==(a=this.persistence)||null==a.oa?void 0:a.oa(),g=!1;try{var _,m,b,y,w,x,S,k,E,P,T,F,A;if(null==(_=this.persistence)||_.clear(),null==(m=this.sessionPersistence)||m.clear(),this.Kl.clear(),this.Au(),Si(c)||null==(b=this.persistence)||b.register({[C]:c}),null==(y=this.surveys)||y.reset(),null==(w=this.featureFlags)||w.reset(),null==(x=this.conversations)||x.reset(),null==(S=this.logs)||S.reset(),null==(k=this.metrics)||k.reset(),null==(E=this.persistence)||E.set_property(_t,Bt),null==(P=this.sessionManager)||P.resetSessionId(),this.ru=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:kt,$device_id:null},"");else{var I=this.config.get_device_id(As());this.register_once({distinct_id:I,$device_id:t?I:h},""),t||Si(u)||this.register({[v]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(void 0===e.distinctID||this.zl()||(null==(A=this.persistence)||A.set_property(_t,e.isIdentifiedID?Lt:Bt),this.register({distinct_id:e.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(Si(l)||null!=(F=this.sessionManager)&&F.setBootstrapSessionId(l,!0))){var R=r({},e);delete R.sessionID,this.config.bootstrap=R}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,g=!0}finally{var O;p&&(null==(O=this.persistence)||null==O.ha||O.ha(g))}this.reloadFeatureFlags()}shutdown(t){var i=this;return n(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){ds.error("Error while destroying feature flags",t)}null==(o=i.persistence)||o.destroy(),null==(a=i.sessionPersistence)||a.destroy()}else ds.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")?(ds.critical("Attempting to create alias for existing People user - aborting."),-2):this.Fu("posthog.alias")?(Si(i)&&(i=this.get_distinct_id()),t!==i?(this.Ou(c,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(ds.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=r({},this.config);if(wi(t)){var e,s,n,o,a,h,u,d,v,c,f,p,g;ps(this.config,Dl(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 Io(r({},this.config,{persistence:"sessionStorage"}),_,!1);var m=this.nu(this.config.debug);Fi(m)&&(this.config.debug=m),Fi(this.config.debug)&&(this.config.debug?(l.DEBUG=!0,Bs.si()&&Bs.ui("ph_debug",!0),ds.info("set_config",{config:t,oldConfig:i,newConfig:r({},this.config)})):(l.DEBUG=!1,Bs.si()&&Bs.hi("ph_debug"))),null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this.Ma()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(h=this.tracingHeaders)||h.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(v=this.historyAutocapture)||v.startIfEnabledOrStop()),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(f=this.deadClicksAutocapture)||f.startIfEnabledOrStop(),null==(p=this.surveys)||p.loadIfEnabled(),this.Jl(),null==(g=this.externalIntegrations)||g.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&Vn(this,Sl,!1)}}_overrideSDKInfo(t,i){l.LIB_NAME=t,l.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(r({},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:Al;return i!==Al&&(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()&&xi(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?(ds.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ul(),this.Ou(St,!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 Ja(this),this.pageViewManager=new Jn(this),this.persistence&&(this.sessionPropsManager=new Va(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()),(Si(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 ds.warn(kl)}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:kt,$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 ds.warn(kl)}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 Jt?Ya(Jt,this.config.custom_blocked_useragents):void 0}ku(){Yt&&("visible"===Yt.visibilityState?this.tu||(this.tu=!0,this.capture(Ht,{title:Yt.title},{send_instantly:!0}),this.eu&&(Yt.removeEventListener(zt,this.eu),this.eu=null)):this.eu||(this.eu=this.ku.bind(this),Ss(Yt,zt,this.eu)))}debug(t){!1===t?(null==Gt||Gt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Gt||Gt.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?(ds.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&&!Pi(t[i]),o=e in t&&!Pi(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,ds)}ds(t){var i;if(Pi(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(Ii),r=bi(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),Pi(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return Ai(t.event)?ds.warn(o+". This can cause unexpected behavior."):ds.info(o),null}s.properties&&!xi(s.properties)||ds.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return ds.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&Pi(s.properties[a]))return ds.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=Fi(t)&&!t,e=Bs.si()&&"true"===Bs.li("ph_debug");return!i&&(!!e||t)}},s.__defaultExtensionClasses={},s.qu=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),s);!function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=ms(t.prototype[i[e]])}(Bl,["identify"]);var Ll=class{constructor(t){this.disabled=!1===t;var i=wi(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}},Nl="$copy_autocapture",zl=vs("[AutoCapture]");function Ul(t,i){return i.length>t?i.slice(0,t)+"...":i}function Hl(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!rn(i));return i}function ql(t,i){var e,s,n=i.e,o=i.maskAllElementAttributes,a=i.maskAllText,l=i.elementAttributeIgnoreList,h=i.elementsChainAsString,u=i.disableCaptureUrlHashes;if(!rn(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!sn(c,"body")&&1e3>d.length;)if(on(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!rn(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode}var p="click"===n.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?d.findIndex(t=>sn(t,"button")||sn(t,"a")):-1;p>0&&(a=a||d.slice(0,p+1).some(t=>!$n(t)||Pn(t)));var g,_,m,b=[],y={},w=!1,x=!1;if(fs(d,t=>{var i=$n(t);if(sn(t,"a")){var e=t.getAttribute("href");w=!!(i&&e&&Mn(e))&&(u?tr(e):e)}li(hn(t),"ph-no-capture")&&(x=!0),b.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};cn.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Ul(1024,Dn(t)):Ul(1024,dn(t)));var a=hn(t);a.length>0&&(o.classes=a.filter(function(t){return""!==t})),fs(t.attributes,function(e){var n;if((!Pn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Mn(e.value)&&(!ki(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=an(a).join(" ")),o["attr__"+e.name]=Ul(1024,"href"===e.name&&s?tr(a):a)}});for(var l=1,h=1,u=t;u=Hl(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,a,l,u)),fs(function(t){if(!$n(t))return{};var i={};return fs(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&&Mn(r)&&(i[e]=r)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(y,i)||(y[i]=t)})}),x)return{props:{},explicitNoCapture:x};if(p>0&&(t=d[p],b.splice(0,p)),a||(b[0].$el_text=sn(t,"a")||sn(t,"button")?Dn(t):dn(t)),w){var S,k;b[0].attr__href=w;var E=null==(S=io(w))?void 0:S.host,P=null==Gt||null==(k=Gt.location)?void 0:k.host;E&&P&&E!==P&&(g=w)}return{props:ps((_=n.type,{$event_type:_,$ce_version:1}),h?{}:{$elements:b},{$elements_chain:(m=b,bi(m)?function(t){return t.map(t=>{var i,e,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=r({},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 gs(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[Bn(t[0].toString())]=Bn(i.toString())}),(s+=":")+gs(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:Ln(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return gs(t).filter(t=>0===t[0].indexOf("attr__")).forEach(t=>r.attributes[t[0]]=t[1]),r})}(m)):"")},null!=(e=b[0])&&e.$el_text?{$el_text:null==(s=b[0])?void 0:s.$el_text}:{},g&&"click"===n.type?{$external_click_url:g}:{},y),target:t}}var Vl=class{Ds(){this.Ls=void 0,clearTimeout(this.Ns),this.Ns=void 0}qs(t){var i;if(!$n(t))return!0;for(var e,r=null!==(i=this.js().css_selector_ignorelist)&&void 0!==i?i:_n,s=new Set,n=t,o=function(){if(s.size>=1e3||s.has(n))return{v:!0};s.add(n);var t=n,i=hn(t);if(li(i,"ph-no-capture")||li(i,"ph-sensitive")||Pn(t)||r.some(i=>fn(t,i)))return{v:!0};var e=n.parentNode;n=on(e)?e.host:e&&rn(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=vn(t);t.isPrimary&&0===t.button&&!t.ctrlKey&&r&&rn(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=vn(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&&(sn(r,"html")||sn(r,"body"))){var s;if(e.excluded)return null;var n=null!==(s=this.js().css_selector_ignorelist)&&void 0!==s?s:_n;return[r,null==Yt?void 0:Yt.documentElement,null==Yt?void 0:Yt.body].some(t=>{if(!t)return!1;var i=hn(t);return li(i,"ph-no-capture")||li(i,"ph-sensitive")||!$n(t)||Pn(t)||n.some(i=>fn(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 Ll(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(Gt&&Yt){var t=this.io=t=>{t=t||(null==Gt?void 0:Gt.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($i(i))return;this.ro(t,"$autocapture",i)}catch(t){zl.error("Failed to capture event",t)}};if(Ss(Gt,"blur",t),Ss(Yt,"submit",t,{capture:!0}),Ss(Yt,"change",t,{capture:!0}),Ss(Yt,"click",t,{capture:!0}),fs(["pointerdown","pointermove","pointerup","pointercancel"],i=>{Ss(Yt,i,t,{capture:!0})}),this.js().capture_copied_text){var i=this.no=t=>{t=t||(null==Gt?void 0:Gt.event);try{this.ro(t,Nl)}catch(t){zl.error("Failed to capture clipboard event",t)}};Ss(Yt,"copy",i,{capture:!0}),Ss(Yt,"cut",i,{capture:!0}),Ss(Yt,"paste",i,{capture:!0})}}}else zl.info("Disabling Automatic Event Collection because this browser is not supported")}Ys(){this.Ds(),this.io&&(null==Gt||Gt.removeEventListener("blur",this.io),fs(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==Yt||Yt.removeEventListener(t,this.io,!0)}),null==Yt||Yt.removeEventListener("submit",this.io,!0),null==Yt||Yt.removeEventListener("change",this.io,!0),null==Yt||Yt.removeEventListener("click",this.io,!0),this.io=void 0),this.no&&(null==Yt||Yt.removeEventListener("copy",this.no,!0),null==Yt||Yt.removeEventListener("cut",this.no,!0),null==Yt||Yt.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;Fi(r)&&(null==(e=this.Hs)||e.kv.set(m,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==Yt||null==(s=Yt.querySelectorAll(e))||s.forEach(s=>{t!==s&&i!==s||li(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(m),r=this.Vs,s=this.js(),n=s.remoteRequestsDisabled&&!this.Gs;if($i(r)&&!Fi(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 s=e||vn(t);nn(s)&&(s=s.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())&&Sn(s,o.rageclick)&&this.ro(t,"$rageclick",e);var a=i===Nl,l=a?r({},o,{dom_event_allowlist:void 0}):o;if(s&&function(t,i,e,r,s,n){var o;if(!Gt||kn(t))return!1;if(null!=e&&e.url_allowlist&&!ln(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&ln(e.url_ignorelist,n))return!1;if(null!=e&&e.dom_event_allowlist){var a=e.dom_event_allowlist;if(a&&!a.some(t=>i.type===t))return!1}var l=En(t,r),h=l.parentIsUsefulElement,u=l.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(Si(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}(u,e))return!1;if(!pn(u,null==e?void 0:e.css_selector_allowlist))return!1;if(pn(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:_n))return!1;try{var d=Gt.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var v=t.tagName.toLowerCase();switch(v){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 h?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(cn.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(s,t,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:o.getCurrentUrl}})){var h,u=ql(s,{e:t,maskAllElementAttributes:o.maskAllElementAttributes,maskAllText:o.maskAllText,elementAttributeIgnoreList:o.element_attribute_ignorelist,elementsChainAsString:this.Zs,disableCaptureUrlHashes:o.disableCaptureUrlHashes}),d=u.props;if(u.explicitNoCapture)return!1;var v=this.getElementSelectors(s,u.target);if(v&&v.length>0&&(d.$element_selectors=v),i===Nl){var c=t.type||"clipboard";if("paste"!==c){var f,p,g=null==Gt||null==(f=Gt.getSelection())?void 0:f.toString(),_=un(g);if(!_)return!1;d.$selected_content=_,d.$clipboard_text_length=null!==(p=null==g?void 0:g.length)&&void 0!==p?p:0}d.$copy_type=c}return null==(h=this.Hs)||h.capture(i,d).catch(t=>zl.error("Failed to capture event",t)),!0}}else this.Ds()}isBrowserSupported(){return yi(null==Yt?void 0:Yt.querySelectorAll)}},Wl=class{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=wi(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}},Gl=vs("[ExceptionAutocapture]"),Kl=()=>{},Jl=t=>{var i;if(yi(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Yl(t,i,e){try{if(!(i in t))return Kl;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 yi(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=Jl(e);n;){if(n.next===s)return void(n.next=r.next);n=Jl(e=n.next)}else t[i]=r.next}}catch(t){return Kl}}var Xl=vs("[TracingHeaders]"),Zl=vs("[Web Vitals]"),Ql=9e5,th=["CLS","FCP","INP","LCP"],ih=["INP","LCP"],eh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],rh="disabled",sh="lazy_loading",nh=vs("[SessionRecording]"),oh=vs("[Heatmaps]");function ah(t){return wi(t)&&"clientX"in t&&"clientY"in t&&Ti(t.clientX)&&Ti(t.clientY)}var lh=vs("[Product Tours]"),hh=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(E))},uh=vs("[SiteApps]"),dh="Error while initializing PostHog app with config id ",vh=(t,i)=>null!=t&&t.then?t.then(i):i(t),ch="SDK is not enabled or survey functionality is not yet loaded",fh="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 ul.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(Pi(i))return ul.warn("Flags not loaded yet. Not loading surveys.");this.Gu=Fi(i)?i:i.length>0,ul.info("flags response received, isSurveysEnabled: "+this.Gu),this.loadIfEnabled()}}}setup(t){if(!this.Js)return this.Zu=t,vh(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)ul.info("Already initializing surveys, skipping...");else if(t.disableSurveys)ul.info(fh);else if(t.cookielessMode&&this.Us.isOptedOut())ul.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Us.getExtensions();if(i){if(!Si(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(jt),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 ul.error("PostHog Extensions not found.")}}}Ju(t,i){this.Js||(this._surveyManager=t(i),this._surveyEventReceiver=this.Us.createEventReceiver(),ul.info("Surveys loaded successfully"),this.Ku({isLoaded:!0}))}Qu(t,i){ul.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 ul.info(fh),t([]);var s=r.kv.get(it);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=>ul.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 ul.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=>ul.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(ch)}))}th(t,i){var e;if(this.Js)return{surveys:[],context:{isLoaded:!1,error:ch}};var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return 0!==r?ul.error(s):i.error||ul.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)&&(Qa(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({[it]:n,[et]: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(et);return Ti(e)&&Date.now()-e>3e5}ih(){return Ti(this.Wu)&&3e5>Date.now()-this.Wu}markSurveyAsSeen(t,i){var e;dl({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){ul.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!Pi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);ul.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(Pi(this._surveyManager))return{eligible:!1,reason:ch};var i="string"==typeof t?this.rh(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}sh(t){if(Pi(this._surveyManager))return{eligible:!1,reason:ch};var i="string"==typeof t?this.rh(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Pi(this._surveyManager))return ul.warn("init was not called"),{visible:!1,disabledReason:ch};var i=this.sh(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return Pi(this._surveyManager)?(ul.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ch})):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(Pi(this._surveyManager))ul.warn("init was not called");else{var s="string"==typeof t?this.rh(t):t;if(null!=s&&s.id)if(vl.includes(s.type)){var n=null==Yt?void 0:Yt.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){ul.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout(()=>{var t,i;this.Vu.delete(o),this.Js||(ul.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),ul.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this.Vu.add(o)}else this._surveyManager.renderSurvey(s,n,e);else ul.warn("Survey element not found")}else ul.warn("Surveys of type "+s.type+" cannot be rendered in the app");else ul.warn("Survey not found")}}displaySurvey(t,i){var e;if(Pi(this._surveyManager))ul.warn("init was not called");else{var s=this.rh(t);if(s){var n=s;if(null!=(e=s.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=r({},s,{appearance:r({},s.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==zo&&i.initialResponses&&ul.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.nh(s);if(!o.eligible)return void ul.warn("Survey is not eligible to be displayed: ",o.reason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else ul.warn("Survey not found")}}cancelPendingSurvey(t){Pi(this._surveyManager)?ul.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}};function gh(t,i,e){if(Pi(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 _h=class{constructor(t){this._instance=t,this.oh=new Set,this.ah=new Set,this.uh=new Wa,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;Si(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 Wa}register(t){var i,e;if(!Si(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(!gh(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=>gh(t.href,i.href,i.href_matching||"exact"));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&gh((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=>gh(t.text,i.text,i.text_matching||"exact")||gh(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;!Pi(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=>gh(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||rl(i.properties.reduce((t,i)=>{var e=bi(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)}},mh=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&&rl(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===Mo?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;Si(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 _h(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,Mo),a=this.$h(t,Do);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,Do);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,Mo);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(r({},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&&(xi(e)?this.Fh():this.Ph(e))}}nd(){this.Ah()&&this.Fh()}getActivationTimestamp(t){if(this.Kh().includes(t)){var i=this.rd()[t];return Ti(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=>Ti(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}},bh=class extends mh{constructor(t){super(t)}sd(){return rt}od(){return st}Ah(){return nt}Ph(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[nt]:t})}Fh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(nt)}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 Ti(r)&&r>0}dd(){return jo}Lh(t){var i;null==(i=this._instance)||i.getSurveys(t)}Zh(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}zh(){return ul}Xh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[rt]:t})}ad(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[st]:t})}ld(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(st)}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 Qa(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e)?t===jo?"consume":"ignore":t===jo?"persist":t===Bo||t===Lo?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},yh=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);Si(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)}},wh=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==ni?void 0:ni.__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 bh(this._instance)}},xh=null!=Gt&&Gt.location?so(Gt.location.hash,"__posthog")||so(location.hash,"state"):null,Sh="_postHogToolbarParams",kh=vs("[Toolbar]"),Eh=vs("[FeatureFlags]"),$h=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:bi(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.vd||(Eh.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.vd=!0),Si(t.flag_keys)||bi(t.flag_keys)||Eh.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.fd}},Ph=vs("[FeatureFlags]"),Th=vs("[FeatureFlags]",{debugEnabled:!0}),Ch="\" failed. Feature flags didn't load in time.",Fh="connection_error",Ah=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},Ih=t=>{var i={};for(var e of gs(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},Rh=t=>Mi(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Oh=vs("[Error tracking]"),Mh="webkit-masked-url:",Dh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Mh],jh=["__firefox__","__gCrWeb"],Bh="Refusing to render web experiment since the viewer is a likely bot",Lh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>tl(i,t),not_regex:(t,i)=>!tl(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},Nh=vs("[Conversations]"),zh="Conversations not available yet.";function Uh(t,i){var e,s,n,o,a,l,h,u=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,d=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,v=null!=i&&i.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,c=Si(v)?Math.max(d,2048):Math.max(d,v),f=r({},function(){var t="",i="";try{var e=null==Jt?void 0:Jt.userAgent;if(e){var s=ze(e);t=s[0],i=s[1]}}catch(t){}return function(t,i){var e=function(t){if(t)return{}.hasOwnProperty.call(Zr,t)?Zr[t]:t}(t);return r({},e?{"os.name":e}:{},i?{"os.version":i}:{})}(t,i)}(),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==f?void 0:f["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==f?void 0:f["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(h=null==f?void 0:f["deployment.environment"])&&void 0!==h?h:null==t?void 0:t.environment,resourceAttributes:f,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:d,maxQueueSize:c,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Hh=["debug","log","warn","error","info"],qh="console",Vh="__posthogHandledLogsRequestError",Wh=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[Vh]=!0,e},Gh=t=>!!t&&"object"==typeof t&&!0===t[Vh],Kh={featureFlags:class{constructor(t){this.name="featureFlags",this.pd=!1,this.featureFlagEventHandlers=[],this.A=Ph,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;Si(i)||this._n.remoteRequestsDisabled||!Yt||"hidden"===Yt.visibilityState||Date.now()-(null!==(t=this.Rd)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.Ad())},this.Ze=()=>{"visible"===(null==Yt?void 0:Yt.visibilityState)&&this.Id()},"get"in t?this.Us=t:(this._instance=t,this.Pd=new $h(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]"),vh(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 Gt&&Ss(Gt,"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&&Yt&&!Si(t)&&t>0?t:void 0;i!==this.Ed&&(this.Bd(),Si(i)||(this.Ed=i,this.Ad(),null!=Yt&&Yt.addEventListener&&Ss(Yt,zt,this.Ze)))}Ad(){Si(this.Ed)||(Si(this.Hd)||clearInterval(this.Hd),this.Rd=Date.now(),this.Hd=setInterval(this.Id,this.Ed))}Bd(){Si(this.Hd)||(clearInterval(this.Hd),this.Hd=void 0,null==Yt||null==Yt.removeEventListener||Yt.removeEventListener(zt,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==Gt||Gt.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!Si(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&&!bi(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,g={[q]:f,[H]:f,[G]:p};for(var _ of(t.$feature_flag_details&&(g[W]=f),[K,gt,J]))Si(t[_])||(g[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}}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[q,G,K,Y]){var e=this.Wd(i);Si(e)||(t[i]=e)}this.gd=t;var s=r({},t),n=this.Wd(H);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.md=s}Dd(){var t=this._n.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Wd(gt);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(!Si(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=>!Si(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 s,n,o=null!=e&&e.merge&&null!==(s=this.Wd("$enabled_feature_flags"))&&void 0!==s?s:{},a=null!=e&&e.merge&&null!==(n=this.Wd("$feature_flag_payloads"))&&void 0!==n?n:{},l=r({},o,t),h=r({},a,i),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Mr(c),variant:Dr(c),reason:void 0,metadata:Si(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(W),i=this.Wd(Y),e=this.Wd(X);if(!e&&!i)return t||{};var s=ps({},t||{});for(var n of[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])]){var o,a,l=s[n],h=null==i?void 0:i[n],u=Si(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=Si(h)?null==l?void 0:l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=r({},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=r({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),s[n]=c}return this.pd||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:s}),this.pd=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{var r=t[e];return{key:e,enabled:Mr(r),variant:Dr(r),payload:Or(i[e])}})}getFlagVariants(){var t=this.Wd(H),i=this.Wd(Y);if(!i)return t||{};for(var e=ps({},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(G),i=this.Wd(X);if(!i)return t||{};for(var e=ps({},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(ct)}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:r({},i.initialPersonProperties,this.Wd("$stored_person_properties")||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Wd(Q),timezone:yo()};Si(i.deviceId)||(e.$device_id=i.deviceId),(null!=t&&t.disableFlags||this._n.featureFlagsDisabled)&&(e.disable_flags=!0);var s=this.Kd();s.length&&(e.evaluation_contexts=s);var n=this.Xd();Si(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({[pt]:[Fh]}),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?Fh:"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({[pt]: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 no(this.Td,3)}iv(t){this.Td=oo(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+Ch)}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,s=this.getFlagVariants(),n=t in s,o=s[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(ft);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({[ct]:d,[ft]:e});else{var p,g,_,m,b,y,w,x,S,k,E,P,T;bi(d[t])?d[t].push(l):d[t]=[l],this.ui(r({[ct]:d},e?{[ft]:e}:{}));var C=this.getFeatureFlagDetails(t),F=[...null!==(p=this.Wd("$feature_flag_errors"))&&void 0!==p?p:[]];Si(o)&&F.push("flag_missing");var A={$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!==(g=null==(_=this._n.bootstrap)||null==(_=_.featureFlags)?void 0:_[t])&&void 0!==g?g: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};Si(null==C||null==(y=C.metadata)?void 0:y.has_experiment)||(A.$feature_flag_has_experiment=C.metadata.has_experiment),Si(null==C||null==(w=C.metadata)?void 0:w.version)||(A.$feature_flag_version=C.metadata.version);var I=null!==(x=null==C||null==(S=C.reason)?void 0:S.description)&&void 0!==x?x:null==C||null==(k=C.reason)?void 0:k.code;I&&(A.$feature_flag_reason=I),null!=C&&null!=(E=C.metadata)&&E.id&&(A.$feature_flag_id=C.metadata.id),Si(null==C?void 0:C.original_variant)&&Si(null==C?void 0:C.original_enabled)||(A.$feature_flag_original_response=Si(C.original_variant)?C.original_enabled:C.original_variant),null!=C&&null!=(P=C.metadata)&&P.original_payload&&(A.$feature_flag_original_payload=null==C||null==(T=C.metadata)?void 0:T.original_payload),F.length&&(A.$feature_flag_error=F.join(",")),this.rv(A)}else e&&this.ui({[ct]:d,[ft]:e});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Or(a)}}}else this.A.warn('getFeatureFlagResult for key "'+t+Ch)}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 n(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();Si(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+Ch),i.defaultValue;var e=this.getFeatureFlag(t,i);return Si(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 s=function(t,i,e,s,n,o){void 0===i&&(i={}),void 0===e&&(e={}),void 0===s&&(s={}),void 0===o&&(o=Ph);var a=((t,i)=>{var e=t.flags;return e?r({},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!Si(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(bi(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{[q]:h,[H]:c,[J]:!1}}var p=h,g=u,_=l;if(null!=n&&n.partialResponse){var m=Object.keys(p),b=g||{};p=r({},i,p),g=r({},e,b),m.forEach(t=>{var i;t in b||null==(i=g)||delete i[t]}),_=r({},s,_)}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=r({},i,Object.fromEntries(Object.entries(p).filter(t=>y.has(t[0]))));var w=Object.fromEntries(Object.entries(g||{}).filter(t=>y.has(t[0])));g=r({},e,w),y.forEach(t=>{var i;t in w||null==(i=g)||delete i[t]}),_=r({},s,Object.fromEntries(Object.entries(_||{}).filter(t=>y.has(t[0]))))}else p=r({},i,p),g=r({},e,g),_=r({},s,_);return r({[q]:Object.keys(Ih(p)),[H]:p||{},[G]:g||{},[W]:_||{},[J]:!0===t.minimalFlagCalledEvents},d?{[K]:d}:{},v?{[gt]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.A);if(s)if(!1===(null==e?void 0:e.persist)){var n=!Si(this.Hs.kv.get(H));this.Vd=s,n||this.ui(s)}else this.Nd(),this.Jd(s,t,!(null==e||!e.partialResponse)),this.ui(s);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([Y,X]),this.jd(),void Th.info("All overrides cleared");if(bi(t))return this.ui({[Y]:Ah(t)}),this.jd(),void Th.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[Y]=bi(s)?Ah(s):s),n&&(r[X]=n),Object.keys(r).length&&this.ui(r),!1===s&&!1===n?this.hi([Y,X]):!1===s?this.hi(Y):!1===n&&this.hi(X),this.jd(),!1===s?Th.info("Flag overrides cleared"):s&&Th.info("Flag overrides set",{flags:s}),void(!1===n?Th.info("Payload overrides cleared"):n&&Th.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.ui({[Y]:t}),this.jd(),void Th.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 s,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=r({},this.getFlagVariants(),{[t]:i});null==(s=this._instance)||null==(s=s.persistence)||s.markCrossTabFeatureFlagChanges({[q]:[t],[H]:[t],[Z]:Object.keys(o)}),this.ui({[q]:Object.keys(Ih(l)),[H]:l,[Z]:r({},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(V);!r||i?this.av(t,e):t(r)}av(t,i){var e=this;return n(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({[V]: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")||{},s=(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({[Z]:r({},e,o,s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=r({},this.Wd("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.ui({[Z]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.hi(Z),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.Wd("$stored_group_properties")||{},s=r({},e);for(var n of Object.keys(t))s[n]=r({},e[n],t[n]);this.ui({[Q]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Wd("$stored_group_properties")||{};this.ui({[Q]:r({},i,{[t]:{}})})}else this.hi(Q)}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}}},Jh={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=rh,this.dv=void 0,this.vv=!1,this.je=(()=>{var t;if(null==Yt||!Yt.visibilityState||"visible"===Yt.visibilityState)return!0;var i=null==Gt||null==(t=Gt.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==Yt?void 0:Yt.visibilityState)&&(this.je=!0,null==(t=this.uv)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},!this._instance.sessionManager)throw nh.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!=Yt&&Yt.addEventListener&&Ss(Yt,"visibilitychange",this.Ze)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.vv=!0,null==Yt||null==Yt.removeEventListener||Yt.removeEventListener("visibilitychange",this.Ze),e?this.fv(!0):this.stopRecording()}get pv(){var t,i=!(null==(t=this._instance.get_property(C))||!t.enabled),e=!this._n.disable_session_recording,r=this._n.disable_session_recording||this._instance.consent.isOptedOut();return Gt&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.vv||this.pv&&null!=(i=this.uv)&&i.isStarted)){var e=!Si(Object.assign)&&!Si(Array.from);this.pv&&e?(this.gv(t),nh.info("starting")):(this.hv=rh,this.stopRecording())}}gv(t){var i,e;if(this.pv)if("awaiting_config"!==this.hv&&"missing_config"!==this.hv&&(this.hv=sh),null!=ni&&null!=(i=ni.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=ni.__PosthogExtensions__)&&e.initSessionRecording)this.mv(t);else{var r,s=this._instance.sessionManager;null==(r=ni.__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({[Tt]:!0}),nh.error("could not load recorder",i)):void this.mv(t);this.hv=rh})}}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(j),null==(i=this.Ya)||i.unregister(A)}_v(t,i){if(Pi(t))return null;var e,r=Ti(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(nh.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}wv(t){if(this.Ya){var i,e,s=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;Pi(a)&&this.bv();var l=null==e?void 0:e.minimumDurationMilliseconds;s.register({[C]:r({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:r({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:Si(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",nh.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):nh.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(C);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return nh.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!Pi(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=ni.__PosthogExtensions__)||!i.initSessionRecording)return nh.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Tt]:!0});var s;if(this.uv||(this.uv=null==(s=ni.__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",nh.info("persisted remote config is stale, requesting fresh config before starting"),void new Wo(this._instance).load()}this.hv=sh,null==(e=(r=this.uv).setDocumentWasEverVisible)||e.call(r,this.je),this.uv.start(t)}else this.hv=rh}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({[R]:!0}),null==(i=this.uv)||i.overrideLinkedFlag()}overrideSampling(){var t,i;this.uv||null==(t=this.Ya)||t.register({[I]:!0}),null==(i=this.uv)||i.overrideSampling()}overrideTrigger(t){var i,e;this.uv||null==(i=this.Ya)||i.register({["url"===t?O:M]:!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()}}},Yh={autocapture:class extends Vl{constructor(t){super(new Wl(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&&(ds.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,ds.info("History API monitoring stopped")}monitorHistoryChanges(){Gt&&Gt.history&&(this.Rv("pushState"),this.Rv("replaceState"),this.Av(),this.Mv()&&this.Pv())}Rv(t){var i;if(Gt&&(null==(i=Gt.history[t])||!i.__posthog_wrapped__)){var e=this;Yl(Gt.history,t,i=>function(r,s,n){i.call(this,r,s,n),e.Fv(t)})}}Cv(){var t=null==Gt?void 0:Gt.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}:wi(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(Ht,{navigation_type:t}),this.xv=i}catch(i){ds.error("Error capturing "+t+" pageview",i)}}Av(){if(!this.Iv){var t=()=>{this.Fv("popstate")};Ss(Gt,"popstate",t),this.Iv=()=>{Gt&&Gt.removeEventListener("popstate",t)}}}Pv(){if(!this.Ev){var t=()=>{this.Fv("hashchange")};Ss(Gt,"hashchange",t),this.Ev=()=>{Gt&&Gt.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[b]),this.rageclicks=new Ll(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return wi(this._n.capture_heatmaps)&&this._n.capture_heatmaps.flush_interval_milliseconds&&(t=this._n.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Pi(this._n.capture_heatmaps)?Pi(this._n.enable_heatmaps)?this.$v:this._n.enable_heatmaps:!1!==this._n.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Ws)return;oh.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({[b]:e}),this.$v=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.Pe;return this.Pe=void 0,t}qv(t){ah(t.originalEvent)&&this.an(t.originalEvent,"deadclick")}Ze(){this.Dv&&clearInterval(this.Dv),this.Dv=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(Yt)?setInterval(this.za.bind(this),this.flushIntervalMilliseconds):null}Lv(){Gt&&Yt&&(this.jv=this.za.bind(this),Ss(Gt,Ut,this.jv),this.Bv=t=>this.an(t||(null==Gt?void 0:Gt.event)),Ss(Yt,"click",this.Bv,{capture:!0}),this.Hv=t=>this.zv(t||(null==Gt?void 0:Gt.event)),Ss(Yt,"mousemove",this.Hv,{capture:!0}),this.Uv=new Hn(this.instance,zn,this.qv.bind(this)),this.Uv.startIfEnabledOrStop(),this.Wv=this.Ze.bind(this),Ss(Yt,zt,this.Wv),this.Ws=!0)}Nv(){var t;Gt&&Yt&&(this.jv&&Gt.removeEventListener(Ut,this.jv),this.Bv&&Yt.removeEventListener("click",this.Bv,{capture:!0}),this.Hv&&Yt.removeEventListener("mousemove",this.Hv,{capture:!0}),this.Wv&&Yt.removeEventListener(zt,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&&rn(r)&&!sn(r,"body");){if(r===e)return!1;var s=void 0;try{var n,o,a;s=null==(n=null!==(o=null==(a=r.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:Gt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(li(i,s))return!0;r=gn(r)}return!1}(vn(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"),!en(t.target)&&ah(t)){var s=this.Gv(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&Sn(vn(t),this.instance.config.rageclick)&&this.Is(r({},s,{type:"rageclick"})),this.Is(s)}}zv(t){!en(t.target)&&ah(t)&&(clearTimeout(this.Vv),this.Vv=setTimeout(()=>{this.Is(this.Gv(t,"mousemove"))},500))}Is(t){if(Gt){var i=this._n.disable_capture_url_hashes?tr(Gt.location.href):Gt.location.href,e=this._n.custom_personal_data_properties,r=ro(i,this._n.mask_personal_data_properties?[...ao,...e||[]]:[],ho);this.Pe=this.Pe||{},this.Pe[r]||(this.Pe[r]=[]),this.Pe[r].push(t)}}za(){this.Pe&&!xi(this.Pe)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Hn,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",r({$current_url:this.Pe.url},this.Pe.metrics.reduce((t,i)=>r({},t,{["$web_vitals_"+i.name+"_event"]:r({},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},Pi(null==t?void 0:t.name)||Pi(null==t?void 0:t.value))Zl.error("Invalid metric received",t);else{var e="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Kv(e);if(!Si(s)){var n=Ti(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.Xv||this.Xv>t.value){this.Pe.navigationKey!==n&&(this.Zv(),this.Jv=setTimeout(this.Zv,this.flushToCaptureTimeoutMs)),Si(this.Pe.navigationKey)&&(this.Pe.navigationKey=n,this.Pe.url=s),this.Pe.firstMetricTimestamp=Si(this.Pe.firstMetricTimestamp)?Date.now():this.Pe.firstMetricTimestamp;var o=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),a=r({},t,e?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete a.entries,wi(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of eh){var u="url"===h&&"string"==typeof t.attribution[h]?this.Kv(t.attribution[h]):t.attribution[h];Si(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;Si(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 Zl.error("Ignoring metric with value >= "+this.Xv,t)}}},this.Yv=()=>{if(!this.Ws){var t,i,e,s,n=!1,o=ni.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.tc])||("web-vitals"===this.tc&&Si(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!Si(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!Si(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,s=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&i&&e&&s){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?r({},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&&s(this.Qv.bind(this),v),this.Ws=!0}else Zl.error("web vitals callbacks not loaded - not starting")}},this.$v=!(null==(i=this._instance.persistence)||!i.props[S]),this.startIfEnabled()}get ec(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=wi(this.ec)?null==(t=this.ec)?void 0:t.web_vitals_allowed_metrics:void 0;return Pi(e)?(null==(i=this._instance.persistence)?void 0:i.props.$web_vitals_allowed_metrics)||th:e}get flushToCaptureTimeoutMs(){return(wi(this.ec)?this.ec.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=wi(this.ec)?this.ec.web_vitals_attribution:void 0;return Fi(t)?t?th:[]:bi(t)?t:ih}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t;return null!==(t=wi(this.ec)?this.ec.__preview_web_vitals_soft_navs:void 0)&&void 0!==t&&t}get Xv(){var t=wi(this.ec)&&Ti(this.ec.__web_vitals_max_value)?this.ec.__web_vitals_max_value:Ql;return t>0&&6e4>=t?Ql:t}get isEnabled(){var t=null==Xt?void 0:Xt.protocol;if("http:"!==t&&"https:"!==t)return Zl.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=wi(this.ec)?this.ec.web_vitals:Fi(this.ec)?this.ec:void 0;return Fi(i)?i:this.$v}startIfEnabled(){this.isEnabled&&!this.Ws&&(Zl.info("enabled, starting..."),this.do(this.Yv))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=wi(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=wi(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[S]:e}),this._instance.persistence.register({[T]: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=ni.__PosthogExtensions__,e=this.tc,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&Si(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,i=>{i?Zl.error("failed to load script",i):t()})}Kv(t){var i=t||(null==Gt?void 0:Gt.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?tr(i):i,r=this._instance.config.custom_personal_data_properties;return ro(e,this._instance.config.mask_personal_data_properties?[...ao,...r||[]]:[],ho)}Zl.error("Could not determine current URL")}}},Xh={exceptionObserver:class{constructor(t){var i;this.Yv=()=>{var t;if(Gt&&this.isEnabled&&null!=(t=ni.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=ni.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=ni.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=ni.__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){Gl.error("failed to start",t),this.oc()}}},this._instance=t,this.ac=!(null==(i=this._instance.persistence)||!i.props[y]),this.wt=new Ui(r({},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:Gl})),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 wi(t)?i=r({},i,t):(Si(t)?this.ac:t)&&(i=r({},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?(Gl.info("enabled"),this.oc(),this.do(this.Yv)):this.oc()}do(t){var i,e;null!=(i=ni.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=ni.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return Gl.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({[y]: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 Gl.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 nr([new gr,new $r,new mr,new _r,new kr,new Sr,new yr,new Er],function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),s=1;i>s;s++)e[s-1]=arguments[s];return function(i,s){void 0===s&&(s=0);for(var n=[],o=i.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=pr.test(l)?l.replace(pr,"$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 r({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",dr,fr)),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=Ar(this.vc()),this.cc=new Ir(this.dc)}onConfigChange(){this.dc=Ar(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({[w]:this.uc,[x]:o})}}}get fc(){var t,i,e=!!this._instance.get_property(x);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(!ki(t)||0===t.trim().length)return void Oh.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)=>Cr.has(r)?(i.push(r),e):(e[r]=t[r],e),{}),droppedKeys:i}}(this.gc(i)),s=e.sanitizedProperties,n=e.droppedKeys;n.length>0&&Oh.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.cc.add(r({[Pr]:t,[Tr]:(new Date).toISOString()},s))}catch(t){Oh.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 Oh.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 Oh.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 Oh.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 Oh.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.dc.enabled&&Pi(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 Rh(t)||Oh.error("Failed to capture exception event. Dropping this exception.",t),void this.cc.clear()}}catch(t){return void(Rh(t)||Oh.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:r({},t,{$exception_steps:i})}catch(i){return Oh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}bc(t){this.dc.enabled&&this.cc.add({[Pr]:t,[Tr]:(new Date).toISOString()})}gc(t){return wi(t)?r({},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 ki(e)&&e.length>0&&t.$exception_types.push(e),ki(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=el[t.operator],r=i[t.key];if(!e||!r)return!1;var s=bi(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 Oh.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&&Dh.some(t=>i.startsWith(t))});return 0!==e.length&&(!e.every(t=>{var i=t.filename;return!!i&&i.startsWith(Mh)})||t.some(t=>{var i=t.value;return ki(i)&&i.includes("isolatedAPI.contexts.topHostname")})&&!i.some(t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith(Mh))}))}wc(t){return t.some(t=>{var i=t.value;return ki(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!Pi(t)&&bi(t)}}},Zh=r({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({[E]:!!i.productTours}),!hh(this._instance))return!this.xc&&Pi(null==(e=this.Ya)?void 0:e.props.ph_product_tours)||lh.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&&hh(this._instance)&&this.do(()=>this.Tc())}do(t){var i,e;null!=(i=ni.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=ni.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",i=>{i?lh.error("Could not load product tours script",i):t()})}Tc(){var t;!this.xc&&null!=(t=ni.__PosthogExtensions__)&&t.generateProductTours&&(this.xc=ni.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!bi(this.Cc)||i){var e=this.Ya;if(e){var r=e.props[ot];if(bi(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(hh(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||lh.warn(s):lh.error(s),void t([],{isLoaded:!1,error:s})}var n=bi(i.json.product_tours)?i.json.product_tours:[];this.Cc=n,e&&e.register({[ot]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Cc,{isLoaded:!0})}getActiveProductTours(t){Pi(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(ot)}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)}}},Kh),Qh={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=ni._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 s,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 g=t.$set_once,_=t.$set;return{event:r({},e(t,i),{properties:r({},t.properties,_?{$set:r({},null!==(s=null==(n=t.properties)?void 0:n.$set)&&void 0!==s?s:{},_)}:{},g?{$set_once:r({},null!==(o=null==(a=t.properties)?void 0:a.$set_once)&&void 0!==o?o:{},g)}:{}),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)||(uh.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)||(uh.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==Yt?void 0:Yt.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 u=[],d=this,v=new WeakSet,c=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),u.push(()=>{t[i]=r})}},f=t=>{if(v.has(t))return t;var i=d.Ac(t);return i&&v.add(i),i},p=t=>t.map(t=>"string"==typeof t?t:f(t)).filter(t=>!$i(t));return c(h,"appendChild",t=>function(i){var e=f(i);return e?t.call(this,e):i}),c(h,"insertBefore",t=>function(i,e){var r=f(i);return r?t.call(this,r,e):i}),c(h,"replaceChild",t=>function(i,e){var r=f(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=>{c(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,p(e))}),c(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,p(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=>{c(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,p(e))}),c(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,p(e))}),c(t,"replaceWith",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=p(e);return e.length&&!s.length?void 0:t.apply(this,s)})}),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",t=>function(i,e){var r=f(e);return r?t.call(this,i,r):null}),this.Fc=()=>{u.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&&(uh.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,uh.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){uh.error(dh+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){uh.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){uh.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 uh.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;ni["__$$ph_site_app_"+i]=s._instance,null==(t=ni.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,t=>{if(t)return uh.error(dh+i,t)})};for(var a of n.siteApps)o()}else uh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},tu={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?(Si(this.Nc)&&(this.Nc=null==(t=ni.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Si(this.qc)&&(this.qc=null==(i=ni.__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=ni.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=ni.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return Xl.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 bi(t)?(bi(this.jc)?this.jc.splice(0,this.jc.length,...t):this.jc=[...t],t.length>0?this.jc:void 0):(bi(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()}}},iu=r({surveys:class extends ph{constructor(t){var i;super(new wh(t),(i=t,{get projectToken(){return i.config.token},kv:new yh(i)})),this._instance=t}Yu(t,i){var e=i.query?Fa(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})})}}},Kh),eu={toolbar:class{constructor(t){this.instance=t}zc(t){ni.ph_toolbar_state=t}Uc(){var t;return null!==(t=ni.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),ks(this.instance.config))return!1;if(!Gt||!Yt)return!1;t=null!=t?t:Gt.location,e=null!=e?e:Gt.history;try{if(!i){try{Gt.localStorage.setItem("test","test"),Gt.localStorage.removeItem("test")}catch(t){return!1}i=null==Gt?void 0:Gt.localStorage}var r,s=xh||so(t.hash,"__posthog")||so(t.hash,"state"),n=s?_s(()=>JSON.parse(atob(decodeURIComponent(s))))||_s(()=>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(Sh)||"{}")).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=ni.ph_load_toolbar||ni.ph_load_editor;!Pi(i)&&yi(i)?i(t,this.instance):kh.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==Yt||!Yt.getElementById("__POSTHOG_TOOLBAR__"));if(!Gt||i)return!1;var e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=r({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(Gt.localStorage.setItem(Sh,JSON.stringify(r({},s,{source:void 0}))),2===this.Uc())this.Wc(s);else if(0===this.Uc()){var n;this.zc(1),null==(n=ni.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",t=>{if(t)return kh.error("[Toolbar] Failed to load",t),void this.zc(0);this.zc(2),this.Wc(s)}),Ss(Gt,"turbolinks:load",()=>{this.zc(0),this.loadToolbar(s)})}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)}}},ru=r({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);ki(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(Bh);else if(!this._n.disable_web_experiments){if(Pi(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=eo(null==i?void 0:i.search,"__experiment_id"),r=eo(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!Pi(i.conditions)&&t.Xc(i,e)&&t.Yc(i)}static Xc(i,e){var r;if(Pi(i.conditions)||Pi(null==(r=i.conditions)?void 0:r.url))return!0;var s=t.getWindowLocation();if(s){var n,o,a,l=tn(e,s.href);return null==(n=i.conditions)||!n.url||Lh[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==Gt?void 0:Gt.location}static Yc(t){var i;if(Pi(t.conditions)||Pi(null==(i=t.conditions)?void 0:i.utm))return!0;var e=vo();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];ds.info("[WebExperiments] "+t,e)}Jc(i,e,r){this._is_bot()?t.Gc(Bh):"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 Jt&&this._instance?Ya(Jt,this._n.custom_blocked_useragents):void 0}}},Kh),su=r({},Kh,Jh,Yh,Xh,Zh,Qh,iu,tu,eu,ru,{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;Pi(i)||(Fi(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||ks(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==ni?void 0:ni.__PosthogExtensions__;if(t&&!Si(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(jt);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 Nh.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,Nh.info("Conversations loaded successfully")}catch(t){this.sf("Error completing conversations initialization",t)}else Nh.error("Cannot complete initialization: remote config is null")}sf(t,i){Nh.error(t,i),this._conversationsManager=null,this.ef=!1,this.if=!0}show(){this._conversationsManager?this._conversationsManager.show():Nh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.tf&&!$i(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":ks(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.rf?"remote_config_failed":Si(this.tf)?this.rf?"disabled_in_project":"remote_config_pending":this.tf?Pi(this.zt)||!this.zt.token?"missing_token":null!=ni&&ni.__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 n(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(Nh.warn(zh),null)})()}getMessages(t,i){var e=this;return n(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(Nh.warn(zh),null)})()}markAsRead(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Nh.warn(zh),null)})()}getTickets(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Nh.warn(zh),null)})()}requestRestoreLink(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Nh.warn(zh),null)})()}restoreFromToken(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Nh.warn(zh),null)})()}restoreFromUrlToken(){var t=this;return n(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Nh.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=vs("[logs]"),this.hf=r({},this.A,{error(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];i.some(Gh)||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),Gt&&Ss(Gt,"online",this.gf)}bf(t,i,e,r){var s,n=Uh(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new ns(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},qh);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==Gt||Gt.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;Pi(r)?this.Ff():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[P]:!!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[P])}If(){var t,i;return null==(t=this._instance)||null==t.Ma||!t.Ma()||!(null==(i=ni._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!=ni&&ni.console){var e=Uh(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})(ni.console[t])}catch(t){return 0}if(!r)return 0;i.cf.push(Yl(ni.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(ni.console,n)};return n.__rrweb_original__=r,n}))};for(var s of Hh)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){Gh(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Js&&this.af&&!this.lf&&!this.uf){var t=null==ni?void 0:ni.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.Af();var i=t.loadExternalDependency;if(!i)return this.A.error(jt),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===vi.LogsQueue?t():void 0,setPersistedProperty(t,e){t===vi.LogsQueue&&i(null!=e?e:[])},gs:t=>this.gs(t),getLibraryId:()=>l.LIB_NAME,getLibraryVersion:()=>l.LIB_VERSION}}gs(t){return new Promise(i=>{if(no(this.Td,3))i({kind:"fatal",error:Wh(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:Wh(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:Wh(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=oo(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,l.LIB_NAME,t=>{this.Aa=t}),this.df.length>0&&this.Hf(t,this.df,this.Mf,qh,t=>{this.df=t})}Hf(t,i,e,r,s){if(0!==i.length){var n=i.map(t=>t.record);s([]);var o=ss(n,rs(e,l.LIB_NAME,l.LIB_VERSION),r,l.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,Pi(s)||(i.sessionStartTimestamp=s),Pi(n)||(i.lastActivityTimestamp=n)}if(null!=ni&&null!=(t=ni.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?tr(ni.location.href):ni.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=vs("[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 hs(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:()=>l.LIB_NAME,getLibraryVersion:()=>l.LIB_VERSION}}Fs(t,i){return new Promise(e=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(o),e(t))},o=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(r({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)}}});Bl.__defaultExtensionClasses=r({},su)}()}();
1
+ !function(){var t=["retriesPerformedSoFar"],i=["$set_once","$set"];function e(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 r(){return r=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},r.apply(null,arguments)}function s(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 n(t){return function(){var i=this,e=arguments;return new Promise(function(r,n){var o=t.apply(i,e);function a(t){s(o,r,n,a,l,"next",t)}function l(t){s(o,r,n,a,l,"throw",t)}a(void 0)})}}!function(s){var o="0.8.2",a={DEBUG:(!1,!1),LIB_VERSION:(o,"1.428.3"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:o},l=a,h="$people_distinct_id",u="distinct_id",d="$device_id",v="$device_model",c="__alias",f="__cmpns",p="$fbc",g="$fbc_persistence",_="__timers",m="$autocapture_disabled_server_side",b="$heatmaps_enabled_server_side",y="$exception_capture_enabled_server_side",w="$error_tracking_suppression_rules",x="$error_tracking_capture_extension_exceptions",S="$web_vitals_enabled_server_side",k="$dead_clicks_enabled_server_side",E="$product_tours_enabled_server_side",P="$logs_capture_enabled_server_side",T="$web_vitals_allowed_metrics",C="$session_recording_remote_config",F="$session_recording_enabled_server_side",A="$replay_sample_rate",I="$replay_override_sampling",R="$replay_override_linked_flag",O="$replay_override_url_trigger",M="$replay_override_event_trigger",D="$sesid",j="$session_is_sampled",B="$session_past_minimum_duration",L="$session_recording_url_trigger_activated_session",N="$session_recording_event_trigger_activated_session",z="$debug_first_full_snapshot_timestamp",U="$sess_rec_flush_size",H="$enabled_feature_flags",q="$active_feature_flags",V="$early_access_features",W="$feature_flag_details",G="$feature_flag_payloads",K="$feature_flag_request_id",J="$minimal_flag_called_events",Y="$override_feature_flags",X="$override_feature_flag_payloads",Z="$stored_person_properties",Q="$stored_group_properties",tt="$groups",it="$surveys",et="$surveys_loaded_at",rt="$surveys_activated",st="$surveys_activated_session",nt="$surveys_activated_timestamps",ot="ph_product_tours",at="$product_tours_activated",lt="$product_tours_activated_session",ht="$conversations_widget_session_id",ut="$conversations_ticket_id",dt="$conversations_widget_state",vt="$conversations_user_traits",ct="$flag_call_reported",ft="$flag_call_reported_session_id",pt="$feature_flag_errors",gt="$feature_flag_evaluated_at",_t="$user_state",mt="$client_session_props",bt="$capture_rate_limit",yt="$initial_campaign_params",wt="$initial_referrer_info",xt="$initial_person_info",St="$epp",kt="$posthog_cookieless",Et="$cookieless_mode",$t="$sdk_debug_extensions_init_method",Pt="$sdk_debug_extensions_init_time_ms",Tt="$sdk_debug_recording_script_not_loaded",Ct="$sdk_debug_replay_event_trigger_status",Ft="$sdk_debug_replay_linked_flag_trigger_status",At="$sdk_debug_replay_matched_recording_trigger_groups",It="$sdk_debug_replay_pending_trigger_conditions",Rt="$sdk_debug_replay_remote_trigger_matching_config",Ot="$sdk_debug_replay_trigger_groups_count",Mt="$sdk_debug_replay_url_trigger_status",Dt="$session_recording_start_reason",jt="PostHog loadExternalDependency extension not found.",Bt="anonymous",Lt="identified",Nt="identified_only",zt="visibilitychange",Ut="beforeunload",Ht="$pageview",qt="$pageleave",Vt="$identify",Wt="$groupidentify",Gt="u">typeof window?window:void 0,Kt="u">typeof globalThis?globalThis:Gt,Jt=null==Kt?void 0:Kt.navigator,Yt=null==Kt?void 0:Kt.document,Xt=null==Kt?void 0:Kt.location,Zt=null==Kt?void 0:Kt.fetch,Qt=null!=Kt&&Kt.XMLHttpRequest&&"withCredentials"in new Kt.XMLHttpRequest?Kt.XMLHttpRequest:void 0,ti=null==Kt?void 0:Kt.AbortController,ii=null==Kt?void 0:Kt.CompressionStream,ei=null==Jt?void 0:Jt.userAgent;function ri(){return!(!Gt||!1===Gt.navigator.onLine)}var si="undefined"!=typeof globalThis?globalThis:Gt;si&&"undefined"==typeof self&&(si.self=si),si&&"undefined"==typeof File&&(si.File=function(){});var ni=null!=Gt?Gt:{},oi=["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"],ai=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return oi.concat(i).some(t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)})};function li(t,i){return-1!==t.indexOf(i)}var hi=function(t){return t.trim()},ui=function(t){return t.replace(/^\$/,"")};function di(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 vi=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}({}),ci=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),fi=["$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"],pi=["token"],gi=Object.prototype,_i=gi.hasOwnProperty,mi=gi.toString,bi=Array.isArray||function(t){return"[object Array]"===mi.call(t)},yi=t=>"function"==typeof t,wi=t=>t===Object(t)&&!bi(t),xi=t=>{if(wi(t)){for(var i in t)if(_i.call(t,i))return!1;return!0}return!1},Si=t=>void 0===t,ki=t=>"[object String]"==mi.call(t),Ei=t=>ki(t)&&0===t.trim().length,$i=t=>null===t,Pi=t=>Si(t)||$i(t),Ti=t=>"[object Number]"==mi.call(t)&&t==t,Ci=t=>Ti(t)&&t>0,Fi=t=>"[object Boolean]"===mi.call(t),Ai=t=>li(fi,t),Ii=t=>li(pi,t);function Ri(t){return null===t||"object"!=typeof t}function Oi(t,i){return{}.toString.call(t)==="[object "+i+"]"}function Mi(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 ji(t,Error)}}function Di(t){return"u">typeof Event&&ji(t,Event)}function ji(t,i){try{return t instanceof i}catch(t){return!1}}var Bi=[!0,"true",1,"1","yes"],Li=t=>li(Bi,t),Ni=[!1,"false",0,"0","no"];function zi(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),Ti(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),zi(null!=s?s:e,i,e,r))}var Ui=class{constructor(t){this.C={},this.I=t.I,this.R=zi(t.bucketSize,0,100,t.A),this.O=zi(t.refillRate,0,this.R,t.A),this.F=zi(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={}}},Hi="Mobile",qi="Android",Vi="Tablet",Wi="Android Tablet",Gi="iPad",Ki="Apple Watch",Ji="Safari",Yi="BlackBerry",Xi="Samsung Internet",Zi="Chrome",Qi="Chrome iOS",te="Internet Explorer",ie="Internet Explorer Mobile",ee="Opera",re="Microsoft Edge",se="Firefox",ne="Firefox iOS",oe="Nintendo",ae="PlayStation",le="Xbox",he="Android Mobile",ue="Mobile Safari",de="Windows",ve="Windows Phone",ce="Nokia",fe="Ouya",pe="Generic "+Hi.toLowerCase(),ge="Generic "+Vi.toLowerCase(),_e="Konqueror",me="Oculus Browser",be="Vivaldi",ye="Yandex",we="Whale",xe="DuckDuckGo",Se="Pale Moon",ke="Waterfox",Ee="Brave",$e="Claude",Pe="Codex",Te="ChatGPT",Ce="Google Search App",Fe=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ae=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ie=new RegExp(le,"i"),Re=new RegExp("PlayStation \\w+","i"),Oe=new RegExp("Nintendo \\w+","i"),Me=new RegExp("BlackBerry|PlayBook|BB10","i"),De={"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"},je=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?Ee:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&li(t,"GSA/")?Ce:li(t," OPR/")&&li(t,"Mini")?"Opera Mini":li(t," OPR/")?ee:Me.test(t)?Yi:li(t,"IEMobile")||li(t,"WPDesktop")?ie:li(t,"OculusBrowser")?me:li(t,"SamsungBrowser")?Xi:li(t,"Edge")||li(t,"Edg/")?re:li(t,"Vivaldi/")?be:li(t,"YaBrowser/")?ye:li(t,"Whale/")?we:li(t,"DuckDuckGo/")||li(t,"Ddg/")?xe:li(t,"Claude/")?$e:li(t,"Codex/")?Pe:li(t,"ChatGPT/")?Te:li(t,"FBIOS")?"Facebook Mobile":li(t,"UCWEB")||li(t,"UCBrowser")?"UC Browser":li(t,"CriOS")?Qi:li(t,"CrMo")||li(t,Zi)?Zi:li(t,qi)&&li(t,Ji)?he:li(t,"FxiOS")?ne:li(t.toLowerCase(),_e.toLowerCase())?_e:li(t,"Brave/")?Ee:((t,i)=>i&&li(i,"Apple")||function(t){return li(t,Ji)&&!li(t,Zi)&&!li(t,qi)}(t))(t,i)?li(t,Hi)?ue:Ji:li(t,"PaleMoon/")?Se:li(t,"Waterfox/")?ke:li(t,se)?se:li(t,"MSIE")||li(t,"Trident/")?te:li(t,"Gecko")?se:"")},Be={[ie]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[re]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Zi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Qi]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Ji]:[Fe],[ue]:[Fe],[ee]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[se]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[ne]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[_e]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Yi]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Fe],[he]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Xi]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[me]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[be]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[ye]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[we]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ee]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[$e]:[Ae],[Pe]:[Ae],[Te]:[Ae],[xe]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Se]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[ke]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Ce]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[te]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Le=function(t,i,e,r){var s=Be[je(t,i,e,r)];if(Si(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},Ne=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[le,t&&t[1]||""]],[new RegExp(oe,"i"),[oe,""]],[new RegExp(ae,"i"),[ae,""]],[Me,[Yi,""]],[new RegExp(de,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[ve,""];if(new RegExp(Hi).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=De[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[de,r]}return[de,""]}],[/((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=Si(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[qi,[t[2],t[3],t[4]||"0"].join(".")]:[qi,""]],[/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",""]]],ze=function(t){for(var i=0;Ne.length>i;i++){var e=Ne[i],r=e[1],s=e[0].exec(t),n=s&&(yi(r)?r(s,t):r);if(n)return n}return["",""]},Ue=function(t){return Oe.test(t)?oe:Re.test(t)?ae:Ie.test(t)?le:new RegExp(fe,"i").test(t)?fe:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?ve:/iPad/.test(t)?Gi:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ki:Me.test(t)?Yi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(ce,"i").test(t)?ce:/(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(Hi).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)?qi:Wi:new RegExp("(pda|Mobile)","i").test(t)?pe:new RegExp(Vi,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?ge:""},He=/\bFBAV\/(\d+(?:\.\d+)*)/i,qe=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",He],[/\bFBAN\/EMA\b/i,"Facebook Lite",He],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",He],[/\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"]],Ve="[Truncated]",We="[Unserializable]";function Ge(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 Ke,Je,Ye,Xe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ze(t,i){return"string"==typeof(e=t)&&Xe.test(e)?t:i();var e}function Qe(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 tr(t){return t?t.split("#")[0]:t}function ir(t,i){var e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function er(t,i,e){return rr.apply(this,arguments)}function rr(){return(rr=n(function*(t,i,e){var r;try{return yield Promise.race([t,new Promise((t,s)=>{r=ir(()=>{try{null==e||e(),t()}catch(t){s(t)}},i)})])}finally{clearTimeout(r)}})).apply(this,arguments)}function sr(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Ye&&e.length===Je?Ye:(Je=e.length,Ye=e.reduce((e,r)=>{Ke||(Ke={});var s=Ke[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,Ke[r]=[l,h];break}}return e},{}))}}var nr=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 n(function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&bi(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,s;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),r({},t,{cause:e,stack:s})}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 n(function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e})()}convertToExceptionList(t,i){var e,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(s=i.handled)||void 0===s||s,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,r({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:sr(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var s=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return r({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,e),next:t=>s(t,e+1)})}};function or(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 Si(r)||(n.lineno=r),Si(s)||(n.colno=s),n}var ar=(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]},lr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,hr=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ur=/\((\S*)(?::(\d+))(?::(\d+))\)/,dr=(t,i)=>{var e=lr.exec(t);if(e)return or(i,e[1],"?",+e[2],+e[3]);var r=hr.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=ur.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=ar(r[1]||"?",r[2]);return or(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},vr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,cr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,fr=(t,i)=>{var e=vr.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=cr.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=ar(n,s);return or(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},pr=/\(error: (.*)\)/;var gr=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=ki(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 Oi(t,"DOMException")}isDOMError(t){return Oi(t,"DOMError")}},_r=class{match(t){return Mi(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}},mr=class{match(t){return!!Oi(t,"ErrorEvent")&&(null!=t.error||this.Ki(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);var s=i.apply(t.message);return r({},s,{stack:null!==(e=this.Xi(t))&&void 0!==e?e:s.stack,synthetic:!0})}Ki(t){return ki(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(ki(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}},br=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,yr=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(br);return r&&(i=r[1],e=r[2]),[i,e]}},wr=["fatal","error","warning","log","info","debug"];function xr(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 Sr=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(Di(t))return t.constructor.name;var i="name"in t?t.name:void 0;return ki(i)&&!Ei(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: "+xr(t)}isSeverityLevel(t){return ki(t)&&!Ei(t)&&wr.indexOf(t)>=0}getStack(t){try{return ki(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:ki(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(Mi(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},kr=class{match(t){return Di(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+xr(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}},Er=class{match(t){return Ri(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}}},$r=class{match(t){return Oi(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Di(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 Ri(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}},Pr="$message",Tr="$timestamp",Cr=new Set([Pr,Tr]),Fr={enabled:!0,max_bytes:32768};function Ar(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Fr.enabled,max_bytes:Rr(t.max_bytes,Fr.max_bytes)}:r({},Fr)}var Ir=class{constructor(t){this.$n=[],this.Bn=0,this._n=Ar(t)}setConfig(t){this._n=Ar(t),this.Hn()}add(t){var i=function(t){var i;try{i=di(t)}catch(t){return}try{var e=JSON.parse(i);if(!wi(e))return;var r=e,s=r[Pr],n=r[Tr];if(!ki(s)||0===s.trim().length)return;if(!ki(n)&&!Ti(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 Rr(t,i){if(!Ti(t)||1/0===t||-1/0===t)return i;var e=Math.floor(t);return 0>e?i:e}var Or=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Mr(t){return"string"==typeof t||t}function Dr(t){return"string"==typeof t?t:void 0}var jr,Br=["$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"],Lr="NativeGzipValidationError",Nr=t=>t.length>=2&&31===t[0]&&139===t[1],zr=(t,i)=>t===ci.GZipJS||i===ci.GZipJS||"gzip"===i,Ur=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Hr=t=>{throw Qe(Lr,"Native gzip produced invalid output: "+t)},qr=function(){var t=n(function*(t,i){18>t.size&&Hr("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());Nr(e)&&8===e[2]||Hr("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(jr)return jr;jr=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;jr[t]=i>>>0}return jr})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&Hr("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&Hr("invalid-size")});return function(i,e){return t.apply(this,arguments)}}();function Vr(){return Vr=n(function*(t,i,e){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),o=s.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch(function(){var t=n(function*(t){try{yield o.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 qr(h,r),h}catch(t){if(null!=e&&e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}}),Vr.apply(this,arguments)}var Wr={}.propertyIsEnumerable;function Gr(t,i){try{return Yr(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function Kr(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:Ve};if(e.remainingNodes--,Fi(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:Ge(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:Ve};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?Ge(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Kr(a.call(t),i,e,r+1)}catch(t){}return bi(t)?{arrayValue:{values:Jr(t,i,e,r+1)}}:{kvlistValue:{values:Yr(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:Ge(String(t))}}function Jr(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(Pi(a))continue;s.push(Kr(a,i,e,r))}catch(t){s.push({stringValue:We})}return t.length>o&&s.push({stringValue:Ve}),s}function Yr(t,i,e,r){var s=[];for(var n in t)if(Wr.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($i(o)||Si(o))continue;s.push({key:Ge(n),value:Kr(o,i,e,r)})}catch(t){s.push({key:Ge(n),value:{stringValue:We}})}}return s}function Xr(t,i,e){return r({},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 Zr={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var Qr={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}},ts=Qr.info;function is(t){try{return Ge(String(t))}catch(t){return We}}function es(t,i,e,s){var n,o=Qr[t.level||"info"]||ts,a=o.text,l=o.number,h=(void 0===(n=Ti(s)?s: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),Pi(i.sessionStartTimestamp)||(u.sessionStartTimestamp=String(i.sessionStartTimestamp)),Pi(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=r({},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=We}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var g={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:is(t.body)},attributes:Gr(d,e)};return t.trace_id&&(g.traceId=t.trace_id),t.span_id&&(g.spanId=t.span_id),Si(t.trace_flags)||(g.flags=t.trace_flags),g}function rs(t,i,e){return Xr(t,i,e)}function ss(t,i,e,r){return{resourceLogs:[{resource:{attributes:Gr(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}var ns=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(vi.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:es(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=bi(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 n(function*(){if(!t._instance.isDisabled)return t.Gn||(t.Gn=t.fs().finally(()=>{t.Gn=null})),t.Gn})()}fs(){var t=this;return n(function*(){var i;t.us();var e=null!==(i=t._instance.getPersistedProperty(vi.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=ss(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(vi.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}})()}ys(t){var i=this;return n(function*(){var e,r=Math.max(0,t-i.Zn),s=null!==(e=i._instance.getPersistedProperty(vi.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(vi.LogsQueue,s.slice(r)),yield i.Wn()})()}ps(){return rs(this._n,this._instance.getLibraryId(),this._instance.getLibraryVersion())}cs(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(vi.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(vi.LogsQueue,e),this.ts>e.length?this.bs():this.hs()}}bs(t){void 0===t&&(t=this.rs),this._s||(this._s=ir(()=>{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(vi.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return n(function*(){i.us();var e=i.flush().catch(()=>{});void 0!==t?yield er(e,t):yield e})()}flushWithTimeout(t){var i=this;return n(function*(){var e=i.flush();yield er(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)}},os=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function as(t){return String(t)+"000000"}function ls(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 hs=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=n(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,s;try{e=i.attributes?r({},i.attributes):void 0,s=ls(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(s);if(!n){if(!this.As())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Ss.set(s,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(os.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,os)]+=1}}ds(t){var i=this._n.beforeSend;if(!i)return t;var e=bi(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=ir(()=>{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 n(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 Xr(t,i,e)}(this._n,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Gr(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}$s(t){var i=as(Date.now()),e=new Map;for(var s of t.values()){var n,o=ls(s.type,s.name,s.unit,void 0),a=e.get(o);a||(a=r({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},e.set(o,a));var l=Gr(null!==(n=s.attributes)&&void 0!==n?n:{},this.A),h=as(s.windowStartMs);if("count"===s.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:i,asDouble:null!==(u=s.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===s.type){var v,c={attributes:l,timeUnixNano:i,asDouble:null!==(v=s.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else s.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:i,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:os})}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)}}},us=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];Gt&&(a.DEBUG||Gt.POSTHOG_DEBUG||e)&&!Si(Gt.console)&&Gt.console&&("__rrweb_original__"in Gt.console[i]?Gt.console[i].__rrweb_original__:Gt.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)=>us(t+" "+i,e)};return r},ds=us("[PostHog.js]"),vs=ds.createLogger;function cs(t,i){bi(t)&&t.forEach(i)}function fs(t,i){if(!Pi(t))if(bi(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(var e in t)_i.call(t,e)&&i(t[e],e)}var ps=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 gs(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 _s=function(t){try{return t()}catch(t){return}},ms=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){ds.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ds.critical(t)}}},bs=function(t){var i={};return fs(t,function(t,e){(ki(t)&&t.length>0||Ti(t))&&(i[e]=t)}),i};function ys(t){var i=r({},t);for(var e of["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e])}catch(t){}return i}var ws=["herokuapp.com","vercel.app","netlify.app"];function xs(t){var i=null==t?void 0:t.hostname;if(!ki(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of ws)if(e===r)return!1;return!0}function Ss(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 ks(t){return"ph_toolbar_internal"===t.name}var Es=t=>{if(Yt){try{for(var i=t+"=",e=Yt.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 Ti(t)&&isFinite(t)&&Math.floor(t)===t});var $s=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}},Ps=class{generate(){var t=this.generateOrAbort();if(!Si(t))return t;this.ri=0;var i=this.generateOrAbort();if(Si(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t,i=(t=Date.now(),Ti(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 $s.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 Fs}},Ts=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};Gt&&!Si(Gt.crypto)&&crypto.getRandomValues&&(Ts=t=>crypto.getRandomValues(t));var Cs,Fs=class{nextUint32(){return this.Pe.length>this.ai||(Ts(this.Pe),this.ai=0),this.Pe[this.ai++]}constructor(){this.Pe=new Uint32Array(8),this.ai=1/0}},As=()=>Is().toString(),Is=()=>(Cs||(Cs=new Ps)).generate(),Rs="",Os=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Ms=null,Ds={si(){if(!$i(Ms))return Ms;if(Ms=!1,Yt)try{var t="__ph_cookie_support_"+As();Ds.ui(t,"xyz"),Ms='"xyz"'===Es(t),Ds.hi(t)}catch(t){Ms=!1}return Ms},ci(t){ds.error("cookieStore error: "+t)},li:Es,di(t){var i;try{i=JSON.parse(Ds.li(t))||{}}catch(t){}return i},ui(t,i,e,r,s){if(!Yt)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=Yt),Rs)return Rs;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_"+As();!Rs&&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",Rs=n)}return Rs}(t);if(!e){var r=(t=>{var i=t.match(Os);return i?i[0]:""})(t);r!==e&&ds.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(Yt.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&&ds.warn("cookieStore warning: large cookie, len="+h.length),Yt.cookie=h,!0}catch(t){return!1}},hi(t,i){if(null!=Yt&&Yt.cookie)try{Ds.ui(t,"",-1,i)}catch(t){return}}},js=null,Bs={si(){if(!$i(js))return js;var t=!0;if(Si(Gt))t=!1;else try{var i="__mplssupport__";Bs.ui(i,"xyz"),'"xyz"'!==Bs.li(i)&&(t=!1),Bs.hi(i)}catch(i){t=!1}return t||ds.error("localStorage unsupported; falling back to cookie store"),js=t,t},ci(t){ds.error("localStorage error: "+t)},li(t){try{return null==Gt?void 0:Gt.localStorage.getItem(t)}catch(t){Bs.ci(t)}return null},di(t){try{return JSON.parse(Bs.li(t))||{}}catch(t){}return null},ui(t,i){try{return null==Gt||Gt.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Bs.ci(t)}return!1},hi(t){try{null==Gt||Gt.localStorage.removeItem(t)}catch(t){Bs.ci(t)}}},Ls=[Z,q,H,W,G,K,gt,pt,ct],Ns=[d,u,D,j,St,xt,g,_t],zs=t=>t+"_cpm",Us=["__proto__","constructor","prototype"],Hs=t=>{if(!wi(t))return{};var i={};return Object.keys(t).forEach(e=>{-1===Us.indexOf(e)&&(i[e]=t[e])}),i},qs=function(t,i){void 0===i&&(i=[]);var e={};return[...Ns,...i].forEach(i=>{var r=t[i];Si(r)||$i(r)||""===r||(e[i]=r)}),e},Vs=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)},Ws=(t,i)=>({p:i,f:Vs(JSON.stringify(t))}),Gs=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=Ds.di(zs(t)),r=(null==e?void 0:e.f)===Vs(i)&&bi(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Ks=(t,i)=>i+"|"+(Ds.li(zs(t))||""),Js={},Ys={si:()=>!0,ci(t){ds.error("memoryStorage error: "+t)},li:t=>t in Js?Js[t]:null,di:t=>t in Js?Js[t]:null,ui:(t,i)=>(Js[t]=i,!0),hi(t){delete Js[t]}},Xs=null,Zs={si(){if(!$i(Xs))return Xs;if(Xs=!0,Si(Gt))Xs=!1;else try{var t="__support__";Zs.ui(t,"xyz"),'"xyz"'!==Zs.li(t)&&(Xs=!1),Zs.hi(t)}catch(t){Xs=!1}return Xs},ci(t){ds.error("sessionStorage error: ",t)},li(t){try{return null==Gt?void 0:Gt.sessionStorage.getItem(t)}catch(t){Zs.ci(t)}return null},di(t){try{return JSON.parse(Zs.li(t))||null}catch(t){}return null},ui(t,i){try{return null==Gt||Gt.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Zs.ci(t)}return!1},hi(t){try{null==Gt||Gt.sessionStorage.removeItem(t)}catch(t){Zs.ci(t)}}},Qs=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 Li(t)?1:li(Ni,t)?0:-1}get ao(){var t=this._n.opt_out_capturing_persistence_type,i="localStorage"===t?Bs:Ds,e=i.si()?i:Ys;if(!this.uo||this.uo!==e){this.uo=e;var r="localStorage"===t?Ds:Bs;r.li(this.lo)&&(this.uo.li(this.lo)||this.optInOut(Li(r.li(this.lo))),r.hi(this.lo,this._n.cross_subdomain_cookie))}return this.uo}so(){return!!this._n.respect_dnt&&[null==Jt?void 0:Jt.doNotTrack,null==Jt?void 0:Jt.msDoNotTrack,ni.doNotTrack,null==Jt?void 0:Jt.globalPrivacyControl].some(t=>Li(t))}};function tn(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!yi(r))return i;try{var s=r(i);return ki(s)&&s?s:i}catch(t){return ds.error("Error in get_current_url, falling back to window.location.href",t),i}}function en(t){return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function rn(t){return!!t&&1===t.nodeType}function sn(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function nn(t){return!!t&&3===t.nodeType}function on(t){return!!t&&11===t.nodeType&&rn(t.host)}function an(t){return t?hi(t).split(/\s+/):[]}function ln(t,i){var e=function(t){var i,e=null==Gt||null==(i=Gt.location)?void 0:i.href;return Si(e)?void 0:tn(t,e)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function hn(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 an(i)}function un(t){return Pi(t)?null:hi(t).split(/(\s+)/).filter(t=>Mn(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function dn(t){var i="";return $n(t)&&!Pn(t)&&t.childNodes&&t.childNodes.length&&fs(t.childNodes,function(t){var e;nn(t)&&t.textContent&&(i+=null!==(e=un(t.textContent))&&void 0!==e?e:"")}),hi(i)}function vn(t){var i;return Si(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var cn=["a","button","form","input","select","textarea","label"];function fn(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 pn(t,i){if(Si(i))return!0;var e,r=function(t){if(i.some(i=>fn(t,i)))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function gn(t){var i=t.parentNode;return!(!i||!rn(i))&&i}var _n=[".ph-no-autocapture","[data-ph-no-autocapture]"],mn=["next","previous","prev",">","<"],bn=[...mn,"+","-","−","–"],yn=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,wn=[".ph-no-rageclick",".ph-no-capture"],xn=["","text","search","email","password","url","tel","number"];function Sn(t,i){if(!Gt||kn(t))return!1;var e,r,s,n,o;if(Fi(i)?(e=!!i&&wn,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:wn,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||!rn(t))&&(!!sn(t,"textarea")||(sn(t,"input")?li(xn,(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 a=En(t,!1).targetElementList;return!function(t,i){if(!1===t||Si(t))return!1;var e;if(!0===t)e=mn;else{if(!bi(t))return!1;if(t.length>10)return ds.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=>yn(i,t)||yn(r,t))})}(r,a.map(t=>{var i;return{safeText:dn(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}}))&&!pn(a,e)}var kn=t=>!t||sn(t,"html")||!rn(t),En=(t,i)=>{if(!Gt||kn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!sn(s,"body");)if(on(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=gn(s);if(!n)break;if(i||cn.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var o=Gt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function $n(t){for(var i=new Set,e=0,r=t;r.parentNode&&!sn(r,"body");r=r.parentNode){if(e++>=1e3||i.has(r))return!1;i.add(r);var s=hn(r);if(li(s,"ph-sensitive")||li(s,"ph-no-capture"))return!1}if(li(hn(t),"ph-include"))return!0;var n=t.type||"";if(ki(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!ki(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 Pn(t){return!!(sn(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||sn(t,"select")||sn(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Tn=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}))$"),Cn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Fn=[16,15,14,13],An=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),In=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Rn=/[0-9A-Za-z_]/;function On(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 Mn(t,i){if(void 0===i&&(i=!0),Pi(t))return!1;if(ki(t)){if(t=hi(t),i?Tn.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(Cn.lastIndex=0;i=Cn.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of Fn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(Tn.test(a)&&On(a))return!0}}}return!1}(t))return!1;if(i?An.test(t):function(t){var i;for(In.lastIndex=0;i=In.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&Rn.test(e)&&Rn.test(r)))return!0}return!1}(t))return!1}return!0}function Dn(t){var i=dn(t);return Mn(i=(i+" "+jn(t)).trim())?i:""}function jn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&fs(t.childNodes,function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=dn(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+jn(t)).trim())}catch(t){ds.error("[AutoCapture]",t)}}),i}function Bn(t){return t.replace(/"|\\"/g,'\\"')}function Ln(t){var i=t.attr__class;if(i)return bi(i)?i:an(i)}var Nn=vs("[Dead Clicks]"),zn=()=>!0,Un=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(k)),r=t.instance.config.capture_dead_clicks;return Fi(r)?r:!!wi(r)||e},Hn=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({[k]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.do(()=>{this.vo()}):this.stop()}do(t){var i,e;null!=(i=ni.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=ni.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?Nn.error("failed to load script",i):t()})}vo(){var t;if(Yt){if(!this.ho&&null!=(t=ni.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=wi(this.instance.config.capture_dead_clicks)?r({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.ho=ni.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.ho.start(Yt),Nn.info("starting...")}}else Nn.error("`document` not found. Cannot start.")}stop(){this.ho&&(this.ho.stop(),this.ho=void 0,Nn.info("stopping..."))}},qn=vs("[SegmentIntegration]");function Vn(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()||As();t.config.get_device_id=s,e&&r.id()&&(t.register({distinct_id:r.id(),$device_id:s()}),t.persistence.set_property(_t,Lt)),i(e?void 0:r.anonymousId()||void 0)},n=r.user();"then"in n&&yi(n.then)?n.then(s):s(n)}(t,e=>{r.register(((t,i)=>{"undefined"!=typeof Promise&&Promise.resolve||qn.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()||(qn.info("No userId set, resetting PostHog"),t.reset()),s||(i=void 0),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(qn.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,Ht)},identify(t){return e(t,Vt)},screen(t){return e(t,"$screen")}}})(t,e)).then(()=>{i()},t=>{qn.error("Failed to register the Segment integration",t),i()})},e)}var Wn="posthog-js";function Gn(t,i){var e=void 0===i?{}:i,s=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)||[],g=p.map(t=>r({},t,{stacktrace:t.stacktrace?r({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>r({},t,{platform:"web:javascript"}))}):void 0})),_={$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:g,$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 s&&n&&(_.$sentry_url=(o||"https://sentry.io/organizations/")+s+"/issues/?project="+n+"&query="+i.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(_)),i}}var Kn=class{constructor(t,i,e,r,s,n){this.name=Wn,this.setupOnce=function(o){o(Gn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},Jn=class{constructor(t){this.co=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(ds.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==Gt?void 0:Gt.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(!(Si(n)||Si(o)||Si(a)||Si(l)||Si(h)||Si(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?zi(o/n,0,1,ds):1,v=n>1?zi(a/n,0,1,ds):1,c=l>1?zi(h/l,0,1,ds):1,f=l>1?zi(u/l,0,1,ds):1;r=ps(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}},Yn=["flags","surveys"],Xn={[h]:{exposure:"hidden"},[c]:{exposure:"hidden"},[f]:{exposure:"hidden"},[_]:{exposure:"hidden"},[g]:{exposure:"hidden"},[m]:{exposure:"event"},[b]:{exposure:"hidden"},[P]:{exposure:"hidden"},[y]:{exposure:"event"},[w]:{exposure:"hidden"},[x]:{exposure:"event"},[S]:{exposure:"event"},[k]:{exposure:"event"},[E]:{exposure:"hidden"},[T]:{exposure:"event"},[C]:{exposure:"hidden"},[F]:{exposure:"hidden"},[D]:{exposure:"hidden"},[j]:{exposure:"event"},[A]:{exposure:"event",shouldSkipFromEventProperties:t=>$i(t)},[B]:{exposure:"event"},[L]:{exposure:"event"},[N]:{exposure:"event"},[z]:{exposure:"event"},[U]:{exposure:"hidden"},[H]:{exposure:"hidden",storageGroup:"flags"},[q]:{exposure:"hidden",storageGroup:"flags"},[V]:{exposure:"hidden"},[W]:{exposure:"hidden",storageGroup:"flags"},[G]:{exposure:"hidden",storageGroup:"flags"},[K]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[J]:{exposure:"hidden",storageGroup:"flags"},[Y]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[it]:{exposure:"hidden",storageGroup:"surveys"},[et]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[rt]:{exposure:"event"},[st]:{exposure:"hidden"},[nt]:{exposure:"hidden"},[ot]:{exposure:"hidden"},[at]:{exposure:"hidden"},[lt]:{exposure:"hidden"},[ht]:{exposure:"event"},[ut]:{exposure:"event"},[dt]:{exposure:"event"},[vt]:{exposure:"event"},[ct]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[tt]:{exposure:"event"},[pt]:{exposure:"hidden"},[gt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[_t]:{exposure:"hidden"},[mt]:{exposure:"hidden"},[bt]:{exposure:"hidden"},[yt]:{exposure:"hidden"},[wt]:{exposure:"hidden"},[xt]:{exposure:"hidden"},[St]:{exposure:"hidden"},[I]:{exposure:"event"},[R]:{exposure:"event"},[O]:{exposure:"event"},[M]:{exposure:"event"},[$t]:{exposure:"event"},[Pt]:{exposure:"event"},[Tt]:{exposure:"event"},[Ct]:{exposure:"event"},[Ft]:{exposure:"event"},[At]:{exposure:"event"},[It]:{exposure:"event"},[Rt]:{exposure:"event"},[Ot]:{exposure:"event"},[Mt]:{exposure:"event"},[Dt]:{exposure:"event"}},Zn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Qn=t=>{var i=Xn[t];if(i)return i;for(var e of Zn){var r=e[1];if(0===t.indexOf(e[0]))return r}},to=(t,i)=>{try{var e;return JSON.stringify(t,(t,i)=>Mi(i)?(null!=e||(e=new WeakMap),e.has(i)||e.set(i,ys(i)),e.get(i)):"bigint"==typeof i?i.toString():i,i)}catch(i){return di(t)}},io=t=>{var i=null==Yt?void 0:Yt.createElement("a");return Si(i)?null:(i.href=t,i)},eo=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(!bi(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){ds.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ro=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("=");bi(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},so=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},no=(t,i)=>t>=i&&ri(),oo=(t,i,e,r)=>{if(0===t){if(ri()){var s=i+1;return s===e&&r(),s}return i}return 0},ao=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],lo=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ao],ho="<masked>",uo=["li_fat_id"];function vo(t,i,e){if(!Yt)return{};var r,s=i?[...ao,...e||[]]:[],n=co(ro(Yt.URL,s,ho),t);return ps((r={},fs(uo,function(t){var i=Es(t);r[t]=i||null}),r),n)}function co(t,i){var e=lo.concat(i||[]),r={};return fs(e,function(i){var e=eo(t,i);r[i]=e||null}),r}function fo(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(!$i(i)){r.$search_engine=i;var s=Yt?eo(Yt.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function po(){return navigator.language||navigator.userLanguage}var go="$direct";function _o(){return(null==Yt?void 0:Yt.referrer)||go}function mo(t,i,e){var r;void 0===e&&(e=!1);var s=t?[...ao,...i||[]]:[],n=null==(r=e?tr(null==Xt?void 0:Xt.href):null==Xt?void 0:Xt.href)?void 0:r.substring(0,1e3);return{r:_o().substring(0,1e3),u:n?ro(n,s,ho):void 0}}function bo(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?tr(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==go?go:null==(e=io(r))?void 0:e.host};if(n){o.$current_url=n;var a=io(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,ps(o,co(n))}return r&&ps(o,fo(r)),o}function yo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function wo(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var xo={flags:gt,surveys:et},So=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ko=t=>t+"_cookie_identity_change_pending",Eo=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},$o="main",Po=[H,q,W,G,K,gt,J,Z],To=t=>-1!==Po.indexOf(t),Co=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},Fo=t=>{if(!t)return{};var i=JSON.parse(t);return wi(i)?i:{}},Ao=(t,i)=>{fs(t,(e,r)=>{var s=Qn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]})},Io=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&&ds.info("Persistence loaded",t.persistence,r({},this.props)),this.update_config(t,t,i),this.save(),Gt){var s=()=>this.flush();Ss(Gt,"beforeunload",s,{capture:!1}),Ss(Gt,"pagehide",s,{capture:!1}),this.Lo=t=>{if(this._o&&(!t.storageArea||t.storageArea===(null==Gt?void 0:Gt.localStorage))&&t.key)if(t.key!==this.Fo){if(this.ko){var i=Yn.find(i=>t.key===this.No(i));i&&this.qo(t.key,i)}}else this.qo(t.key,$o)},Ss(Gt,"storage",this.Lo)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var i=t[0],e=t[1],r=this.Co.get(i);if(To(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&&Gt&&(Gt.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=Bs.li(t),$i(s)){var n=this.Ho(i);return n.storageValue=null,i!==$o&&(n.persisted=!1),!1}r=Fo(s)}catch(t){return!1}var o=i===$o?r:Bs.di(this.Fo);if(o&&this.zo(o))return!1;var a=this.Uo(r,i,e);return i===$o&&this.ko&&!Co(this.Wo().main,r)||this.Vo(r,i,!0,s),a}zo(t){var i=this.props[u],e=t[u];return!Si(i)&&!Si(e)&&i!==e}Vo(t,i,e,r){var s=this.Ho(i);s.storageValue=r,i!==$o&&(s.persisted=e);try{s.fingerprint=this.Go(t,i)}catch(t){s.fingerprint=void 0}}Uo(t,i,e){var r=!1;return Po.forEach(e=>{var s,n=null==(s=Qn(e))?void 0:s.storageGroup;if(!(i===$o&&this.ko&&n||i!==$o&&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&&Co(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=Bs.li(this.Fo),e=this.Ho($o),r=!1,s=!1;if(i!==e.storageValue)if($i(i))e.storageValue=null;else{if(t=Fo(i),this.Io=!this.Mo&&this.zo(t),this.Io)return!1;s=this.Uo(t,$o,!1),!this.ko||Co(this.Wo().main,t)?this.Vo(t,$o,!0,i):e.storageValue=i,r=!0}return this.ko&&Yn.forEach(i=>{var e=Bs.li(this.No(i)),n=this.Ho(i),o=t||{},a=r&&Po.some(t=>{var e;return(null==(e=Qn(t))?void 0:e.storageGroup)===i&&t in o});if(e!==n.storageValue||a){if($i(e))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Uo(o,i,!1)||s));var l=Fo(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=Qn(t);null!=e&&e.volatile||(this.Ho((this.ko?null==e?void 0:e.storageGroup:void 0)||$o).fingerprint=void 0,this.Xo(t))}Yo(){Po.forEach(t=>this.Co.set(t,!0))}Do(){if(this._o)try{var t=Bs.li(this.Fo),i=Fo(t);this.Ho($o).storageValue=t,Po.forEach(t=>{var e,r=this.ko?null==(e=Qn(t))?void 0:e.storageGroup:void 0,s=r?Bs.li(this.No(r)):null;if(r){var n=this.Ho(r);n.storageValue=s,n.persisted=!$i(s)}var o=r&&!$i(s)?Fo(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 s=new Set(bi(i)?i:[]),n=new Set(bi(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}var o=wi(i)?r({},i):{},a=wi(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(To(t)){var r=this.Co.get(t);if(!0!==r){var s=i;if(this._o)try{var n,o=this.ko?null==(n=Qn(t))?void 0:n.storageGroup:void 0,a=o?this.No(o):this.Fo;s=Fo(Bs.li(a))[t]}catch(t){}var l=new Set(r||[]);if("$active_feature_flags"===t){if(!Si(i)&&!bi(i)||!Si(s)&&!bi(s)||!bi(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(!wi(e))return void(Co(s,e)?this.Co.delete(t):this.jo(t,!0));if(!Si(i)&&!wi(i)||Si(i)&&xi(e)&&Si(s))return void this.jo(t,!0);var v=wi(i)?i:{},c=wi(s)?s:{};new Set([...Object.keys(v),...Object.keys(e)]).forEach(t=>{t in v==t in e&&Co(v[t],e[t])||l.add(t)}),l.forEach(t=>{t in c==t in e&&Co(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 Ti(i)&&i>0?i:0}ia(t){if(this._n.cookieWinsOnConflict&&"localstorage+cookie"===this._n.persistence.toLowerCase())if(t)try{var i=qs(t,this._n.cookie_persisted_properties||[]),e=Ws(i,this._n.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=Ds.li(this.Fo)||void 0;s&&Ks(this.Fo,s)===r&&(this.ra=r,this.na=s)}catch(t){}else try{var n=Ds.li(this.Fo)||void 0;this.ra=n?Ks(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=Ds.li(this.Fo)||void 0}catch(t){}if(!e||e===this.na)return!1;var r,s=Ks(this.Fo,e);try{r=Hs(JSON.parse(e))}catch(t){return!1}if((Ds.li(this.Fo)||void 0)!==e)return!1;this.ra=s,this.na=e;var n=Gs(this.Fo,e),o=[...Ns,...n.properties],a={};if(Object.keys(r).forEach(t=>{var i=r[t];(Si(i)||$i(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(a[t]=!0,delete r[t])}),xi(r))return!1;var l="distinct_id"in r||"anonymous"===r.$user_state||"identified"===r.$user_state,h=this.props,d=h[u],v=h[_t],f=ps({},h);[...Ns,...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=f[t];(n.isValid||-1===Ns.indexOf(t)||!1!==i&&0!==i)&&delete f[t]}}),this.props=ps(f,r),Po.forEach(t=>{var i=t in this.props;t in h===i&&Co(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(_t,Bt);var p=this.props[u],g=this.props[_t];return!l||p===d&&g===v||(this.Mo=!0,this.So=!0,Zs.ui(ko(this.Fo),!0),this.Qo(Z),this.Qo(q),this.Qo(H),this.Qo(W),this.Qo(G),this.Qo(K),this.Qo(gt),this.Qo(pt),this.Qo(ct),"anonymous"!==g||"identified"!==v&&"anonymous"!==r.$user_state&&(Si(d)||p===d)||(Ao(this.props,r),this.Qo(Q)),"identified"===g?this.props.$user_id=p:delete this.props.$user_id,this.Qo(c)),!0}consumeCookieIdentityChange(){var t=ko(this.Fo),i=this.So||!!Zs.li(t);return this.So=!1,i&&Zs.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&&(Si(this.la)||(clearTimeout(this.la),this.la=void 0),delete this.bo[$o],this.ua(!0))}ha(t){if(void 0===t&&(t=!0),this.xo)try{t?this.aa():Si(this.la)||(clearTimeout(this.la),this.la=void 0)}finally{this.xo=!1}}isDisabled(){return!!this.Bo}Oo(t){-1===So.indexOf(t.persistence.toLowerCase())&&(ds.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=[...Ns,...t];return r({},Bs,{di(t){try{var r,s={};try{r=Ds.li(t)||void 0,s=r?Hs(JSON.parse(r)):{}}catch(t){}var n,o=JSON.parse(Bs.li(t)||"{}");if(i){var a=Gs(t,r),l=[...Ns,...a.properties],h={};Object.keys(s).forEach(t=>{var i=s[t];$i(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(h[t]=i)});var d="distinct_id"in h||"anonymous"===h.$user_state||"identified"===h.$user_state;if(Object.keys(h).length>0){var v,c=o[u],f=null!==(v=o.$user_state)&&void 0!==v?v:"anonymous";e.forEach(t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(d||"distinct_id"!==t&&"$user_state"!==t)){var i=o[t];(a.isValid||-1===Ns.indexOf(t)||!1!==i&&0!==i)&&delete o[t]}}),!d||"$user_state"in s||"$user_state"in o||(o[_t]=Bt),!d||("distinct_id"in h?h[u]:o[u])===c&&("$user_state"in h?h[_t]:o[_t])===f||(Ls.forEach(t=>delete o[t]),"identified"===h.$user_state&&"distinct_id"in h?o.$user_id=h[u]:delete o.$user_id,"identified"!==h.$user_state&&(delete o[tt],delete o[Q]),delete o.__alias)}n=ps(o,h)}else n=ps(s,o);return Bs.ui(t,n),n}catch(t){}return null},ui(e,r,s,n,o,a){var l=Bs.ui(e,r,void 0,void 0,a);try{var h=qs(r,t);if(Object.keys(h).length){if(i){var u=zs(e),d=Ws(h,t);if(Ds.ui(u,d,s,n,o,a),Ds.li(u)!==JSON.stringify(d)){Ds.hi(u,n);var v=qs(r);return Ds.ui(e,v,s,n,o,a),l}}Ds.ui(e,h,s,n,o,a)}}catch(t){Bs.ci(t)}return l},hi(t,i){try{null==Gt||Gt.localStorage.removeItem(t),Ds.hi(t,i),Ds.hi(zs(t),i)}catch(t){Bs.ci(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),s=!1,n=!1,o=t.persistence.toLowerCase();return"localstorage"===o&&Bs.si()?(i=Bs,n=!0):"localstorage+cookie"===o&&e.si()?(i=e,n=!0,s=!0):"sessionstorage"===o&&Zs.si()?i=Zs:"memory"===o?i=Ys:"cookie"===o&&Ds.si()?(i=Ds,s=!0):e.si()?(i=e,n=!0,s=!0):Ds.si()?(i=Ds,s=!0):i=Ys,this._o=n,this.wo=s,i}No(t){return this.Fo+"__"+t}$o(t){return this._o&&!!t.split_storage}properties(){var t={};return fs(this.props,(i,e)=>{var r=Qn(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?Bs.di(this.Fo):null,r={};if(i)try{fs(r=Hs(Ds.di(this.Fo)),(t,i)=>{(Si(t)||$i(t)||""===t)&&delete r[i]})}catch(t){}var s=this.ao.di(this.Fo);if(s&&(this.props=ps({},s)),this.ko&&this.da(),i&&s){var n,o,a=null==e?void 0:e[u],l=null!==(n=null==e?void 0:e.$user_state)&&void 0!==n?n:"anonymous",h=s[u],d=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(h!==a||d!==l){this.So=!0,Zs.ui(ko(this.Fo),!0);var v=ps({},this.props);Ls.forEach(t=>delete v[t]),"anonymous"!==d||"identified"!==l&&"anonymous"!==r.$user_state&&(Si(a)||h===a)||(Ao(v,r),delete v[Q]),this.props=v;var c=new Set;Ls.forEach(t=>{var i,e=null==(i=Qn(t))?void 0:i.storageGroup;e&&c.add(e)}),c.forEach(t=>{var i={};fs(this.props,(e,r)=>{var s;(null==(s=Qn(r))?void 0:s.storageGroup)===t&&(i[r]=e)}),xi(i)?(Bs.hi(this.No(t)),this.bo[t]={}):Bs.ui(this.No(t),i)&&(this.bo[t]={persisted:!0,fingerprint:this.Go(i,t)})})}}Zs.li(ko(this.Fo))&&(this.So=!0)}}da(){for(var t of Yn){var i=Bs.di(this.No(t));if(i&&!xi(i)){var e=this.Ho(t);e.persisted=!0,this.va(t)||(e.fingerprint=this.Go(i,t)),this.ca(t,i)||ps(this.props,i)}}}va(t){return Object.keys(this.props).some(i=>{var e;return(null==(e=Qn(i))?void 0:e.storageGroup)===t})}ca(t,i){var e=xo[t];if(!e)return!1;var r=i[e],s=this.props[e];return Ti(r)&&Ti(s)&&s>r}refreshKey(t){var i;if(!(this.Bo||"$fbc_persistence"===t&&this.Eo)){var e=this.ko?null==(i=Qn(t))?void 0:i.storageGroup:void 0,r=e?Bs.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?Si(this.la)&&(this.la=setTimeout(()=>{this.la=void 0,this.ua()},t)):this.ua()}}flush(){Si(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(g));var i=!t&&!this.To;i||(this.Io=!1);var e=!!i&&this.Ko();if(this.Io)this._n.debug&&ds.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,$o);"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,$o);"written"===s&&this.ia(e),"failed"!==s&&(this.Mo=!1,this.Eo=!1,Po.forEach(t=>{var i;null!=(i=Qn(t))&&i.storageGroup||this.Co.delete(t)}));var n=function(i){var e,s=r[i];if(xi(s)&&(null==(e=t.bo[i])||!e.persisted))return Po.forEach(e=>{var r;(null==(r=Qn(e))?void 0:r.storageGroup)===i&&t.Co.delete(e)}),1;var n=t.pa(Bs,t.No(i),s,i);"failed"!==n&&Po.forEach(e=>{var r=Qn(e);(null==r?void 0:r.storageGroup)!==i||"written"!==n&&r.volatile||t.Co.delete(e)})};for(var o of Yn)if(n(o))continue}Wo(){var t={},i={flags:{},surveys:{}};return fs(this.props,(e,r)=>{var s,n=null==(s=Qn(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e}),{main:t,groups:i}}Go(t,i){if(i===$o)return JSON.stringify(t)+"|"+this.ga+"|"+this.ma+"|"+this.ya;var e={};return fs(t,(t,i)=>{var r;e[i]=null!=(r=Qn(i))&&r.volatile?"__volatile__":t}),JSON.stringify(e)}pa(t,i,e,r){var s,n=this.Ho(r);if(r!==$o&&!n.dirty&&!Si(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!==$o&&(n.persisted=!0),Si(s)||(n.fingerprint=s),this._o&&(n.storageValue=Bs.li(i)),"written"):(this._n.debug&&ds.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(),Si(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 Yn)Bs.hi(this.No(r));e?delete this.bo[$o]:this.bo={},this.ra=void 0,this.na=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(wi(t)){this.syncCookieProperties(),Si(i)&&(i="None"),this.ga=Si(e)?this.ba:e;var r=!1;if(fs(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(wi(t)){this.syncCookieProperties(),this.ga=Si(i)?this.ba:i;var e=!1;if(fs(t,(i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||wi(i)||bi(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==Yt?void 0:Yt.URL;if(t!==this.Po){var i=vo(this._n.custom_campaign_params,this._n.mask_personal_data_properties,this._n.custom_personal_data_properties),e=!xi(bs(i));return e&&this.register(i),this.Po=t,e?i:void 0}}update_search_keyword(){var t;this.register((t=null==Yt?void 0:Yt.referrer)?fo(t):{})}update_referrer_info(){var t;this.register_once({$referrer:_o(),$referring_domain:null!=Yt&&Yt.referrer&&(null==(t=io(Yt.referrer))?void 0:t.host)||go},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=mo(this._n.mask_personal_data_properties,this._n.custom_personal_data_properties,this._n.disable_capture_url_hashes);this.register_once({[xt]:this.wo?{r:Eo(t.r),u:t.u?Eo(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};fs([wt,yt],i=>{var e=this.props[i];e&&fs(e,function(i,e){t["$initial_"+ui(e)]=i})});var i=this.props[xt];return i&&ps(t,function(t,i){void 0===i&&(i=!1);var e=bo(t,i),r={};return fs(e,function(t,i){r["$initial_"+ui(i)]=t}),r}(i,this._n.disable_capture_url_hashes)),t}safe_merge(t){return fs(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){var s=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=s||n,a=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,h=!!this.Bo&&!l;l||this.sa(i,h),this._n=t,!l&&(s||n||a)&&(this.ra=void 0,this.na=void 0,this.sa(r({},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[$o],this.ua()))}finally{this.To=!1,c&&this.ha()}}_a(){var t=this.props[xt];if(this.wo&&wi(t)&&"string"==typeof t.r){var i=Eo(t.r),e="string"==typeof t.u?Eo(t.u):t.u;i===t.r&&e===t.u||this.Jo(xt,r({},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(_,e),this.save()}remove_event_timer(t){var i=this.props.__timers||{},e=i[t];return Si(e)||(delete i[t],this.Jo(_,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||Co(s,i)||(this.Eo=!0),this.ta(t,s,i),null!=(r=Qn(t))&&r.volatile||this.Xo(t))}Qo(t,i){void 0===i&&(i=!0),delete this.props[t],i&&(To(t)&&this.jo(t,!0),"$fbc_persistence"===t&&(this.Eo=!0),this.Xo(t))}Xo(t){var i,e=null==(i=Qn(t))?void 0:i.storageGroup;e&&(this.Ho(e).dirty=!0)}Ho(t){return this.bo[t]||(this.bo[t]={})}},Ro="gzip-js",Oo="base64",Mo="events",Do="cancelEvents",jo="survey shown",Bo="survey dismissed",Lo="survey sent",No="$survey_last_seen_date",zo="popover";function Uo(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&yi(e.then)&&e.then(void 0,()=>{})}}}}var Ho=vs("[RateLimiter]"),qo=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=>{Ho.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void Ho.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=(Ti(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(bt,a),{isRateLimited:l,remainingTokens:a.tokens}}ka(t){var i=this.instance.config.property_denylist;return!bi(i)||!i.includes(t)}Sa(){var t;if(this.ka("$current_url")&&this.ka("$pathname")&&null!=Xt&&Xt.pathname)return""+(null!==(t=Xt.origin)&&void 0!==t?t:"")+Xt.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}},Vo=vs("[RemoteConfig]"),Wo=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=ni._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}xa(t){var i,e;null!=(i=ni.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=ni.__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 Vo.info("Using preloaded remote config",this.remoteConfig),void this.Ta(this.remoteConfig);if(this._instance.Ma())return void Vo.warn("Remote config is disabled. Falling back to local config.");this.xa(t=>{if(!t)return Vo.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){Vo.error("Error loading remote config",t),this.Ta()}}Ta(t,i){!t&&i&&(0===i.statusCode?i.error||Vo.warn("Failed to fetch remote config from PostHog."):Vo.error("Failed to fetch remote config from PostHog."));try{this._instance.Ta(t?{ok:!0,config:t}:{ok:!1})}catch(t){Vo.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){Vo.error("Error loading feature flags",t)}}},Go=Uint8Array,Ko=Uint16Array,Jo=Uint32Array,Yo=new Go([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]),Xo=new Go([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]),Zo=new Go([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qo=function(t,i){for(var e=new Ko(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new Jo(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]},ta=Qo(Yo,2),ia=ta[1];ta[0][28]=258,ia[258]=28;for(var ea=Qo(Xo,0)[1],ra=new Ko(32768),sa=0;32768>sa;++sa){var na=(43690&sa)>>>1|(21845&sa)<<1;ra[sa]=((65280&(na=(61680&(na=(52428&na)>>>2|(13107&na)<<2))>>>4|(3855&na)<<4))>>>8|(255&na)<<8)>>>1}var oa=function(t,i,e){for(var r=t.length,s=0,n=new Ko(i);r>s;++s)++n[t[s]-1];var o,a=new Ko(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Ko(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[ra[d]>>>l]=h}else for(o=new Ko(r),s=0;r>s;++s)o[s]=ra[a[t[s]-1]++]>>>15-t[s];return o},aa=new Go(288);for(sa=0;144>sa;++sa)aa[sa]=8;for(sa=144;256>sa;++sa)aa[sa]=9;for(sa=256;280>sa;++sa)aa[sa]=7;for(sa=280;288>sa;++sa)aa[sa]=8;var la=new Go(32);for(sa=0;32>sa;++sa)la[sa]=5;var ha=oa(aa,9,0),ua=oa(la,5,0),da=function(t){return(t/8|0)+(7&t&&1)},va=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Ko?Ko:t instanceof Jo?Jo:Go)(e-i);return r.set(t.subarray(i,e)),r},ca=function(t,i,e){var r=i/8|0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},fa=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 Go(0),0];if(1==s){var o=new Go(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 Ko(v+1),f=ga(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;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+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;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 Go(c),f]},ga=function(t,i,e){return-1==t.s?Math.max(ga(t.l,i,e+1),ga(t.r,i,e+1)):i[t.s]=e},_a=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Ko(++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]},ma=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},ba=function(t,i,e){var r=e.length,s=da(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)},ya=function(t,i,e,r,s,n,o,a,l,h,u){ca(i,u++,e),++s[256];for(var d=pa(s,15),v=d[0],c=d[1],f=pa(n,15),p=f[0],g=f[1],_=_a(v),m=_[0],b=_[1],y=_a(p),w=y[0],x=y[1],S=new Ko(19),k=0;m.length>k;++k)S[31&m[k]]++;for(k=0;w.length>k;++k)S[31&w[k]]++;for(var E=pa(S,7),P=E[0],T=E[1],C=19;C>4&&!P[Zo[C-1]];--C);var F,A,I,R,O=h+5<<3,M=ma(s,aa)+ma(n,la)+o,D=ma(s,v)+ma(n,p)+o+14+3*C+ma(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(M>=O&&D>=O)return ba(i,u,t.subarray(l,l+h));if(ca(i,u,1+(M>D)),u+=2,M>D){F=oa(v,c,0),A=v,I=oa(p,g,0),R=p;var j=oa(P,T,0);for(ca(i,u,b-257),ca(i,u+5,x-1),ca(i,u+10,C-4),u+=14,k=0;C>k;++k)ca(i,u+3*k,P[Zo[k]]);u+=3*C;for(var B=[m,w],L=0;2>L;++L){var N=B[L];for(k=0;N.length>k;++k)ca(i,u,j[z=31&N[k]]),u+=P[z],z>15&&(ca(i,u,N[k]>>>5&127),u+=N[k]>>>12)}}else F=ha,A=aa,I=ua,R=la;for(k=0;a>k;++k)if(r[k]>255){var z;fa(i,u,F[257+(z=r[k]>>>18&31)]),u+=A[z+257],z>7&&(ca(i,u,r[k]>>>23&31),u+=Yo[z]);var U=31&r[k];fa(i,u,I[U]),u+=R[U],U>3&&(fa(i,u,r[k]>>>5&8191),u+=Xo[U])}else fa(i,u,F[r[k]]),u+=A[r[k]];return fa(i,u,F[256]),u+A[256]},wa=new Jo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),xa=new Go(0),Sa=function(){for(var t=new Jo(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),ka=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function Ea(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=Sa[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 Go(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=ba(l,h,t.subarray(u,d)):(l[u]=n,h=ba(l,h,t.subarray(u,o)))}else{for(var v=wa[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new Ko(32768),_=new Ko(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 Jo(25e3),x=new Ko(288),S=new Ko(32),k=0,E=0,P=(u=0,0),T=0,C=0;o>u;++u){var F=y(u),A=32767&u,I=_[F];if(g[A]=I,_[F]=A,u>=T){var R=o-u;if((k>7e3||P>24576)&&R>423){h=ya(t,l,0,w,x,S,E,P,C,u-C,h),P=k=E=0,C=u;for(var O=0;286>O;++O)x[O]=0;for(O=0;30>O;++O)S[O]=0}var M=2,D=0,j=f,B=A-I&32767;if(R>2&&F==y(u-B))for(var L=Math.min(c,R)-1,N=Math.min(32767,u),z=Math.min(258,R);N>=B&&--j&&A!=I;){if(t[u+M]==t[u+M-B]){for(var U=0;z>U&&t[u+U]==t[u+U-B];++U);if(U>M){if(M=U,D=B,U>L)break;var H=Math.min(B,U-2),q=0;for(O=0;H>O;++O){var V=u-B+O+32768&32767,W=V-g[V]+32768&32767;W>q&&(q=W,I=V)}}}B+=(A=I)-(I=g[A])+32768&32767}if(D){w[P++]=268435456|ia[M]<<18|ea[D];var G=31&ia[M],K=31&ea[D];E+=Yo[G]+Xo[K],++x[257+G],++S[K],T=u+M,++k}else w[P++]=t[u],++x[t[u]]}}h=ya(t,l,n,w,x,S,E,P,C,u-C,h),n||(h=ba(l,h,xa))}return va(a,0,r+da(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&&ka(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),ka(u,d-8,e.d()),ka(u,d-4,r),u}var $a=!!Qt||!!Zt,Pa="text/plain",Ta=!1,Ca=(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:"")},Fa=function(t,i,e){var s;void 0===e&&(e=!0);var n=t.split("?"),o=n[0],a=n[1],l=r({},i),h=null!==(s=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!==s?s:[],u=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return fs(t,function(t,i){Si(t)||Si(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},Aa=t=>{if(t.Ia)return t.Ia;var i=t.data,e=t.compression;if(i){if(e===Ro){var r=Ea(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new Go(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 Go(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 va(e,0,r)}(to(i)),{mtime:0});return{contentType:Pa,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Oo){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:to(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(to(i)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=to(i);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Ia=t=>{var i,e,s=()=>"sendBeacon"===t.transport?{url:Fa(t.url,{compression:Oo}),encodedBody:Aa(r({},t,{compression:Oo,Ia:void 0}))}:{url:Ca(t.url,"compression"),encodedBody:Aa(r({},t,{compression:void 0,Ia:void 0}))};try{i=Aa(t)}catch(i){if(zr(t.compression,eo(t.url,"compression")))return ds.error("Failed to gzip request body, sending uncompressed payload",i),s();throw i}return i&&zr(t.compression,eo(t.url,"compression"))&&!((e=i.body)instanceof ArrayBuffer?Nr(new Uint8Array(e)):ArrayBuffer.isView(e)&&Nr(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?(Ta=!0,s()):{url:t.url,encodedBody:i}},Ra=t=>{try{return Ia(t)}catch(i){return ds.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},Oa=function(){var t=n(function*(t){var i=yield function(t,i,e){return Vr.apply(this,arguments)}(to(t.data),l.DEBUG,{rethrow:!0});if(!i)return t;var e=yield i.arrayBuffer();return r({},t,{Ia:{contentType:Pa,body:e,estimatedSize:e.byteLength}})});return function(i){return t.apply(this,arguments)}}(),Ma=/Failed to fetch|NetworkError|Load failed/i,Da=t=>"TypeError"===(null==t?void 0:t.name)&&Ma.test((null==t?void 0:t.message)||""),ja=t=>{var i=Ra(t);if(i){var e=i.url,s=i.encodedBody,n=null!=s?s:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;fs(t.headers,function(t,i){h.append(i,t)}),o&&h.append("Content-Type",o);var u=null,d=!1;if(ti){var v=new ti;u={signal:v.signal,timeout:setTimeout(()=>{var i;d=!0,v.abort(Qe("AbortError","PostHog request timed out"+((i=t.timeout)?" after "+i+"ms":"")))},t.timeout)}}var c=i=>{d&&"AbortError"===(null==i?void 0:i.name)||Da(i)?ds.warn(i):ds.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var f;Zt(e,r({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.Ea&&52428.8>(l||0),body:a,signal:null==(f=u)?void 0:f.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){ds.error(t)}null==t.callback||t.callback(r)})).catch(c).finally(()=>u?clearTimeout(u.timeout):null)}catch(t){u&&clearTimeout(u.timeout),c(t)}}},Ba=t=>{try{var i,e=Ia(t),s=e.url,n=e.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var h=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(Jt.sendBeacon(s,h))return;var u=bi(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(bi(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=i=>bi(t.data)?i:r({},t.data,{batch:i});return Ba(r({},t,{data:v(u.slice(0,d))})),void Ba(r({},t,{data:v(u.slice(d))}))}ds.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),ja(r({},t,{Ea:!0}))}catch(t){ds.warn("Beacon send failed",t)}},La=(t,i,e,s)=>{var n="query"===s?"POST"===i?"sent_at":"_":void 0;return Fa(e===Ro?Ca(t,"compression"):t,r({},n?{[n]:Date.now().toString()}:{},e===Ro?{}:{compression:e}))},Na=[];Zt&&Na.push({transport:"fetch",method:ja}),Qt&&Na.push({transport:"XHR",method(t){var i=Ra(t);if(i){var e=new Qt,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;fs(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!=Jt&&Jt.sendBeacon&&Na.push({transport:"sendBeacon",method:Ba});var za=class{constructor(t,i){this.Ra=!0,this.Aa=[],this.Pa=zi((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,ds.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(r({},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&&bi(e.data)&&fs(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){ds.error(t)}}Da(){clearTimeout(this.Oa),this.Oa=void 0}La(){var t={};return fs(this.Aa,i=>{var e,s=i,n=(s?s.batchKey:null)||s.url;Si(t[n])&&(t[n]=r({},s,{data:[]})),null==(e=t[n].data)||e.push(s.data)}),this.Aa=[],t}},Ua=class{constructor(t){this._instance=t,this.qa=!1,this.ja=3e3,this.Aa=[],this.Aa=[],this.Ba=!0,!Si(Gt)&&"onLine"in Gt.navigator&&(this.Ba=Gt.navigator.onLine,this.Ha=()=>{this.Ba=!0,this.za()},this.Ua=()=>{this.Ba=!1},Ss(Gt,"online",this.Ha),Ss(Gt,"offline",this.Ua))}get length(){return this.Aa.length}retriableRequest(i){var s=i.retriesPerformedSoFar,n=e(i,t);Ci(s)&&(n.url=Fa(n.url,{retry_count:s})),this._instance._send_request(r({},n,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=s?s:0))return void this.cs(r({retriesPerformedSoFar:s},n));0===t.statusCode&&ds.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!=s?s: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)"),ds.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,Si(Gt)||(this.Ha&&(Gt.removeEventListener("online",this.Ha),this.Ha=void 0),this.Ua&&(Gt.removeEventListener("offline",this.Ua),this.Ua=void 0)),this.Aa)){var i=t.requestOptions;try{this._instance._send_request(r({},i,{transport:"sendBeacon"}))}catch(t){ds.error(t)}}this.Aa=[]}},Ha=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(){Ss(Gt,"scroll",this.Ga,{capture:!0}),Ss(Gt,"scrollend",this.Ga,{capture:!0}),Ss(Gt,"resize",this.Ga)}scrollElement(){var t;if(!this.Ja)return null==Gt||null==(t=Gt.document)?void 0:t.documentElement;for(var i of bi(this.Ja)?this.Ja:[this.Ja]){var e,r=null==Gt||null==(e=Gt.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 Gt?"y"===t?Gt.scrollY||Gt.pageYOffset||(null==(i=Gt.document)||null==(i=i.documentElement)?void 0:i.scrollTop)||0:Gt.scrollX||Gt.pageXOffset||(null==(e=Gt.document)||null==(e=e.documentElement)?void 0:e.scrollLeft)||0:0}scrollY(){return this.Qa("y")}scrollX(){return this.Qa("x")}},qa=t=>mo(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),Va=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({[mt]:e})}},this._instance=t,this.tl=i,this.Ya=e,this.Xa=r||qa,this.tl.onSessionId(this.Te)}Ka(){return this.Ya.props[mt]}getSetOnceProps(){var t,i=null==(t=this.Ka())?void 0:t.props;return i?"r"in i?bo(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 fs(bs(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+ui(e)]=i}),t}},Wa=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={}}},Ga=vs("[SessionId]"),Ka=864e5,Ja=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 Wa,this.ll=(t,i)=>!(!Ci(t)||!Ci(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||As,this.dl=e||As;var s=this._n.persistence_name||this._n.token;if(this._sessionTimeoutMs=1e3*zi(this._n.session_idle_timeout_seconds||1800,60,36e3,Ga.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=Zs.di(this.cl),o=Zs.di(this.fl);n&&!o?this.Ie=n:Zs.hi(this.cl),Zs.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 Si(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&&Zs.si()}ml(t){t!==this.Ie&&(this.Ie=t,this.pl()&&Zs.ui(this.cl,t))}yl(){return this.Ie?this.Ie:this.pl()?Zs.di(this.cl):null}bl(t){var i=this.rl;return!$i(i)&&!$i(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({[D]:[i,t,e]}))}wl(){var t,i=null==(t=this._n)?void 0:t.persistence_save_debounce_ms;return Ci(i)&&i>0}kl(){this.wl()?this.Ya.refreshKey(D):(this.Ya.flush(),this.Ya.load())}Sl(){var t;if(!$i(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({[D]:[this._sessionActivityTimestamp,null!==(t=this.Bt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ya.flush())}}Cl(){var t=this.xl()[0],i=Ci(t)?t:0,e=Ci(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[D];return bi(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 Ga.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Ga.error("Invalid sessionID in bootstrap",t)}}(t);return!Si(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&&Gt&&(Gt.removeEventListener(Ut,this.ol,{capture:!1}),this.ol=void 0),this.sl=[]}gl(){this.ol=()=>{this.Sl(),this.pl()&&Zs.hi(this.fl)},Ss(Gt,Ut,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($i(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=!Si(s)&&l!==s,d=this.Cl(),v=this.yl(),c=this.ul,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ka),p=c?f:Ci(h)&&Math.abs(r-h)>Ka,g=!1,_=u,m=!l||!!c,b=l,y=!m&&!t&&this.ll(r,d);if(y){(y=this.Tl(r))||Ga.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.xl();l=w[1],h=w[2]}if(m||y||p){_=!1;var x=c&&!f;l=x?c.sessionId:this.hl(),v=this.dl(),Ga.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.ul=void 0,g=!0}else v||(v=this.dl(),g=!0),(_=_||l!==b)&&(Ga.info("adopted cross-tab session id",{sessionId:l,windowId:v}),g=!0);var S=Ci(d)&&t&&!p?d:r,k=Ci(h)?h:(new Date).getTime();this.ml(v),this._l(l,S,k),t||this.vl();var E={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:_};return g&&this.sl.forEach(t=>t(l,v,E)),{sessionId:l,windowId:v,sessionStartTimestamp:k,changeReason:g?E: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))}},Ya=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&ai(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>ai(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function Xa(){return(Xa=n(function*(){var t=null==Jt?void 0:Jt.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i,e=null==(i=yield t.getHighEntropyValues(["model"]))?void 0:i.model;return ki(e)&&e.length>0?e:void 0}catch(t){return void ds.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Za(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 Qa(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var tl=(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}},il=t=>t.toLowerCase(),el={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=>tl(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!tl(i,t))),icontains:(t,i)=>i.map(il).some(i=>t.map(il).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(il).every(i=>t.map(il).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 rl(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=el[e.operator];return!!s&&s(e.values,[String(r)])})}function sl(t,i,e){return to({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var nl="custom",ol="i.posthog.com",al=/^\/static\//,ll=["/s/","/e/","/i/"],hl=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("."+ol,".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":nl),this.Il[this.apiHost]}El(t){if(al.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}Rl(t){var i=io(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=io(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&ll.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===nl)return this.Al(t,i,this.apiHost+i);var r=ol+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)}}},ul=vs("[Surveys]"),dl=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){ul.error("Failed to persist survey seen state",t)}},vl=["popover","widget","api"],cl={ignoreConditions:!1,ignoreDelay:!1,displayType:zo},fl=vs("[PostHog ExternalIntegrations]"),pl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},gl=class{constructor(t){this._instance=t}do(t,i){var e;null==(e=ni.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,t=>{if(t)return fl.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=ni.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t.do(pl[n],()=>{var i;null==(i=ni.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)}),!o&&null!=(r=ni.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=ni.__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()}}},_l=class{constructor(t,i){this.A=t,this.Hs=i,this.Fl=new Map,this.Js=!1}add(t){var i=this;return n(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&&yi(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)}}},ml=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);Si(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)}},bl="extensionsRemoteConfig",yl=class{constructor(t){this.instance=t,this.Js=!1,this.A=ds,this.$l=t.Dl,this.kv=new ml(t),this.onEvent=t=>Uo(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 Uo(()=>{});var i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.Ll.on(bl,i);return this.$l&&i(this.$l),Uo(e)},this.Nl=new _l(ds.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(d);return"string"==typeof t?t:void 0}get library(){return{name:l.LIB_NAME,version:l.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 n(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 Uo(this.instance.ql(t))}handleRemoteConfig(t){this.Js||(this.$l=t,this.instance.Ll.emit(bl,t))}sendRequest(t,i){var e=this;return n(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?Fa(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?ci.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())}},wl={},xl=0,Sl=()=>{},kl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',El="Surveys module not available",$l="sanitize_properties is deprecated. Use before_send instead",Pl="Invalid value for property_denylist config: ",Tl=/^[A-Za-z0-9_-]{1,400}$/,Cl=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Fl=["token","distinct_id",Et],Al="posthog",Il=!$a&&-1===(null==ei?void 0:ei.indexOf("MSIE"))&&-1===(null==ei?void 0:ei.indexOf("Mozilla")),Rl=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},Ol=t=>{var i;return r({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:xs(null==Yt?void 0:Yt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Sl,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:Xt&&ki(null==Xt?void 0:Xt.search)&&-1!==Xt.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==Gt||null==(i=Gt.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){ds.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:Nt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Sl},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:bn,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Rl(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))},Ml=[["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"]],Dl=t=>{var i={};for(var e of Ml){var r=e[0],s=e[1];Si(t[r])||(i[s]=t[r])}var n=ps({},i,t),o=t.__preview_external_dependency_versioned_paths;return Si(o)||(Si(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),ki(o)&&Si(t.asset_host)&&(n.asset_host=o)),bi(t.property_blacklist)&&(Si(t.property_denylist)?n.property_denylist=t.property_blacklist:bi(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:ds.error(Pl+t.property_denylist)),n},jl=class{constructor(){this.__forceAllowLocalhost=!1}get jl(){return this.__forceAllowLocalhost}set jl(t){ds.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Bl=(s=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(As());this.register({distinct_id:e,$device_id:e}),t.set_property(_t,Bt)}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=l.LIB_VERSION,this.Kl=new Set,this.Xl="",this.Ll=new Wa,this.Fl=[],this.Yl=[],this.Vl=!1,this.Wl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ol(),this.SentryIntegration=Kn,this.sentryIntegration=t=>function(t,i){var e=Gn(t,i);return{name:Wn,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 Ha(this),this.pageViewManager=new Jn(this),this.rateLimiter=new qo(this),this.requestRouter=new hl(this),this.consent=new Qs(this),this.externalIntegrations=new gl(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=ki(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=ki(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",t=>ds.info('send "'+(null==t?void 0:t.event)+'"',t))}init(i,e,r){if(r&&r!==Al){var s,n=null!==(s=wl[r])&&void 0!==s?s:new t;return n._init(i,e,r),wl[r]=n,wl[Al][r]=n,n}return this._init(i,e,r)}_init(t,i,e){var s,n,o;void 0===i&&(i={});var a,h=ki(t)?t.trim():"";if(!h)return ds.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==(a=this.config)?void 0:a.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+h+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ol(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=Ol(i.defaults),d=Dl(i),c=ps({},u,d,{name:e,token:h});wi(u.rageclick)&&wi(d.rageclick)&&(c.rageclick=ps({},u.rageclick,d.rageclick)),wi(u.session_recording)&&wi(d.session_recording)&&(c.session_recording=ps({},u.session_recording,d.session_recording)),this.set_config(c),this.config.on_xhr_error&&ds.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Ro;var f=this.Zl();if(this.persistence=new Io(this.config,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Io(r({},this.config,{persistence:"sessionStorage"}),f,!1),this.Xl="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!f&&Zs.si()){var p=Zs.di(this.Xl);bi(p)&&p.forEach(t=>{ki(t)&&this.Kl.add(t)})}else Zs.hi(this.Xl);var g=r({},this.persistence.props),_=r({},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 Ua(this),this.__request_queue=[];var m=this.zl();m||(this.sessionManager=new Ja(this),this.sessionPropsManager=new Va(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?(ds.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.vu(m)},0)):(ds.info("Initializing extensions synchronously"),this.vu(m)),l.DEBUG=l.DEBUG||this.config.debug,l.DEBUG&&ds.info("Starting in debug mode",{this:this,config:i,thisC:r({},this.config),p:g,s:_}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=r({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var b=null==(n=i.bootstrap)?void 0:n.distinctID;if(this.Vl=!!b&&!Ei(b),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var y=i.bootstrap.distinctID,w=this.get_distinct_id(),x=this.persistence.get_property(_t);if(i.bootstrap.isIdentifiedID&&null!=w&&w!==y&&"anonymous"===x)this.identify(y);else if(i.bootstrap.isIdentifiedID&&null!=w&&w!==y&&"identified"===x)ds.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(As()),k=i.bootstrap.isIdentifiedID?S:y;this.persistence.set_property(_t,i.bootstrap.isIdentifiedID?Lt:Bt),this.register({distinct_id:y,$device_id:k})}}if(m)this.register_once({distinct_id:kt,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(As());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(_t,Bt)}return Ss(Gt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?Vn(this,()=>this.cu()):this.cu(),yi(this.config._onCapture)&&this.config._onCapture!==Sl&&(ds.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&ds.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 Xa.apply(this,arguments)}().then(t=>{t&&this.register({[v]:t})}).catch(Sl),this}fu(t){var i=t;return ki(i.name)&&yi(i.setup)}pu(t,i){this.fu(t)?i.push(()=>{this.gu().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(i=>{ds.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)),yi(this.featureFlags.onReloading)&&yi(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,s,n,o,a,l,h,u=performance.now(),d=r({},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!==(s=this.surveys)&&void 0!==s?s: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,Un)),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){ds.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[$t]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Pt]:r}),this.config.__preview_deferred_init_extensions&&ds.info("PostHog extensions initialized ("+r+"ms)")}Ta(t){var i;if(!Yt||!Yt.body)return ds.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=li(r.supportedCompression,Ro)?Ro:li(r.supportedCompression,Oo)?Oo:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.iu?this.iu:Nt}),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){ds.critical("`loaded` function failed",t)}if(this.wu(),this.config.internal_or_test_user_hostname&&null!=Xt&&Xt.hostname){var t=Xt.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 Wo(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()&&cs(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(qt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.au)||r.unload(),null==(s=this.uu)||s.unload()):this.xu()&&this.capture(qt,null,{transport:"sendBeacon"})}_send_request(t){var i;this.__loaded?Il?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=r({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(Si(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,s,n=r({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&Si(n.compression)&&n.data&&(n.compression=Oo),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(bi(o=n.data)?o:[o]).map(t=>r({},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()),bi(t)?t.map(t=>r({},t,{sent_at:i})):r({},t,{sent_at:i})}(n.data))),n.url=La(n.url,n.method,n.compression,n.timestampMode);var v=Na.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),c=null!==(e=null==(s=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:s.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){Da(t)?ds.warn(t):ds.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Ro&&ii&&"undefined"!=typeof Promise&&!Ta?Oa(n).then(t=>{f(t)}).catch(i=>{if(Ur(i))return Ta=!0,void f(r({},n,{compression:void 0,url:La(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 Ur(t)||i===Lr})(i)&&(Ta=!0),f(n)}):c(n)})(r({},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){xl++;try{var i,e=[],r=[],s=[];cs(t,t=>{if(t)if(bi(i=t[0]))s.push(t);else if(yi(t))try{t.call(this)}catch(i){ds.error("Error executing queued PostHog call",t,i)}else bi(t)&&"alias"===i?e.push(t):bi(t)&&-1!==i.indexOf("capture")&&yi(this[i])?s.push(t):r.push(t)});var n=function(t,i){cs(t,function(t){try{if(bi(t[0])){var e=i;fs(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){ds.error("Error executing queued PostHog call",t,i)}})};n(e,this),n(r,this),n(s,this)}finally{xl--}}push(i){if(xl>0&&bi(i)&&ki(i[0])){var e=t.prototype[i[0]];yi(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(g);return ki(i)&&Cl.test(i)?{value:i,delivered:!1}:wi(i)&&ki(i.value)&&Cl.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}Tu(t,i,e,r){if(this.persistence){this.persistence.refreshKey(g);var s=this.Cu();if(!r){if(e)return ki(i)&&Cl.test(i)?(i!==(null==s?void 0:s.value)&&this.persistence.register({[g]:{value:i,delivered:!1}}),{value:i,pending:i!==(null==s?void 0:s.value)||!s.delivered}):void this.persistence.unregister(g);if(ki(t)&&Tl.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({[g]:{value:n,delivered:!1}}),{value:n,pending:!0}}return s?{value:s.value,pending:!s.delivered}:void 0}this.persistence.unregister(g)}}Mu(t){if(this.persistence){this.persistence.refreshKey(g);var i=this.Cu();(null==i?void 0:i.value)!==t||i.delivered||this.persistence.register({[g]:{value:t,delivered:!0}})}}capture(t,i,e){var s,n,o,a,l,h,u,d,v,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.au){if(this.is_capturing())if(!Si(t)&&ki(t)){this.Gl();var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var g=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==g||!g.isRateLimited){var _;null!=i&&i.$current_url&&!ki(null==i?void 0:i.$current_url)&&(ds.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||ds.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 m=new Date,b=(null==e?void 0:e.timestamp)||m,y=Ze(null==e?void 0:e.uuid,As),w={uuid:y,event:t,properties:this.calculateEventProperties(t,i||{},b,y)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&f&&(w.event="$bot_pageview",w.properties.$browser_type="bot"),g&&(w.properties.$lib_rate_limit_remaining_tokens=g.remainingTokens);var x="$feature_flag_called"===t&&!1===w.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=e&&e.$set&&!x&&(w.$set=null==e?void 0:e.$set);var S=wi(null==i?void 0:i.$set)?i.$set:void 0,k=!(null==e||!e.$set)&&"$fbc"in e.$set,E=k||!!S&&"$fbc"in S,P=k?null==e||null==(s=e.$set)?void 0:s[p]:null==S?void 0:S[p],T=bi(null==i?void 0:i.$unset)?i.$unset:[],C=(null==e?void 0:e.$unset)||[],F=-1!==T.indexOf("$fbc")||-1!==C.indexOf("$fbc"),A=this.Tu(null==(n=_)?void 0:n.fbclid,P,E,F);A&&!0===w.properties.$process_person_profile&&A.pending&&!E&&!x&&(w.$set=r({[p]:A.value},w.$set));var I=null==e?void 0:e.$unset;I&&(w.$unset=I);var R=x?void 0:this.Eu(null==e?void 0:e.$set_once,t!==Wt,t===Vt);if(R&&(w.$set_once=R),null!=e&&e._noTruncate||(u=this.config.properties_string_max_length,d=w,v=t=>ki(t)?t.slice(0,u):t,c=new Set,w=function t(i,e){if(i!==Object(i))return v?v(i):i;if(!c.has(i)){var r;if(c.add(i),bi(i))r=[],cs(i,i=>{r.push(t(i))});else{var s={};fs(Mi(i)?ys(i):i,(i,e)=>{c.has(i)||(s[e]=t(i,e))}),r=s}return r}}(d)),w.timestamp=b,Si(null==e?void 0:e.timestamp)||(w.properties.$event_time_override_provided=!0,w.properties.$event_time_override_system_time=m),x&&(w.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return Br.forEach(r),i.forEach(r),e}(w.properties,Fl)),t===Bo||t===Lo){var O=null==i?void 0:i.$survey_id,M=null==i?void 0:i.$survey_iteration;dl({id:O,current_iteration:M}),w.$set=r({},w.$set,{[Za({id:O,current_iteration:M},t===Lo?"responded":"dismissed")]:!0})}else t===jo&&(w.$set=r({},w.$set,{[No]:(new Date).toISOString()}));if("product tour shown"===t){var D=null==i?void 0:i.$product_tour_type;D&&(w.$set=r({},w.$set,{["$product_tour_last_seen_date/"+D]:(new Date).toISOString()}))}var j=r({},w.properties.$set,w.$set);if(xi(j)||this.setPersonPropertiesForFlags(j),!Pi(this.config.before_send)){var B=this.ds(w);if(!B)return;(w=B).uuid=Ze(w.uuid,As)}var L=null!==(o=null==(a=w.$set)?void 0:a.$fbc)&&void 0!==o?o:wi(null==(l=w.properties)?void 0:l.$set)?w.properties.$set.$fbc:void 0,N=null!=A&&A.pending&&L===A.value?A.value:void 0;this.Ll.emit("eventCaptured",w);var z=null!==(h=null==e?void 0:e._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),U=r({method:"POST",url:z,data:w,compression:"best-available",timestampMode:"recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(z)?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},null!=e&&e.transport?{transport:e.transport}:{},N?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.Mu(N)}}:{});return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly||N?this.lu(U):this.au.enqueue(U),w}ds.critical("This capture call is ignored due to client rate limiting.")}}else ds.error("No event name provided to posthog.capture")}else ds.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 yl(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,s,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=r({},i);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.zl()&&(l[Et]=!0),"$snapshot"===t){var h=r({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!ki(l.distinct_id)&&!Ti(l.distinct_id)||Ei(l.distinct_id))&&ds.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(t,i,e,r){var s,n,o,l;if(void 0===r&&(r=!1),!ei)return{};var h,u=t?[...ao,...i||[]]:[],d=ze(ei),v=d[0],c=d[1],f=function(t){for(var i=0;qe.length>i;i++){var e,r=qe[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["",""]}(ei),p=f[0],g=f[1],_=null!=(h="u">typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},m={};Si(e)||(m.detectGoogleSearchApp=e);var b={},y=null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,w=null==(n=navigator)?void 0:n.maxTouchPoints,x=null==Gt||null==(o=Gt.screen)?void 0:o.width,S=null==Gt||null==(l=Gt.screen)?void 0:l.height,k=null==Gt?void 0:Gt.devicePixelRatio;Si(y)||(b.userAgentDataPlatform=y),Si(w)||(b.maxTouchPoints=w),Si(x)||(b.screenWidth=x),Si(S)||(b.screenHeight=S),Si(k)||(b.devicePixelRatio=k);var E,P,T,C,F,A,I,R,O=ps(bs({$os:v,$os_version:c,$browser:je(ei,navigator.vendor,_,m),$webview_app:p,$webview_app_version:g,$device:Ue(ei),$device_type:(P=ei,T=b,R=Ue(P),R===Gi||R===Wi||"Kobo"===R||"Kindle Fire"===R||R===ge?Vi:R===oe||R===le||R===ae||R===fe?"Console":R===Ki?"Wearable":R?Hi:"Android"===(null==T?void 0:T.userAgentDataPlatform)&&(null!==(C=null==T?void 0:T.maxTouchPoints)&&void 0!==C?C:0)>0?600>Math.min(null!==(F=null==T?void 0:T.screenWidth)&&void 0!==F?F:0,null!==(A=null==T?void 0:T.screenHeight)&&void 0!==A?A:0)/(null!==(I=null==T?void 0:T.devicePixelRatio)&&void 0!==I?I:1)?Hi:Vi:"Desktop"),$timezone:yo(),$timezone_offset:wo()}),{$current_url:ro(r?tr(null==Xt?void 0:Xt.href):null==Xt?void 0:Xt.href,u,ho),$host:null==Xt?void 0:Xt.host,$pathname:null==Xt?void 0:Xt.pathname,$raw_user_agent:ei.length>1e3?ei.substring(0,997)+"...":ei,$browser_version:Le(ei,navigator.vendor,_,m),$browser_language:po(),$browser_language_prefix:(E=po(),"string"==typeof E?E.split("-")[0]:void 0),$screen_height:null==Gt?void 0:Gt.screen.height,$screen_width:null==Gt?void 0:Gt.screen.width,$viewport_height:null==Gt?void 0:Gt.innerHeight,$viewport_width:null==Gt?void 0:Gt.innerWidth,$lib:a.LIB_NAME,$lib_version:a.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return a.SDK_DIST_CHANNEL&&(O.$sdk_dist_channel=a.SDK_DIST_CHANNEL),O}(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 v=this.sessionManager.checkAndGetSessionAndWindowId(n,e.getTime(),!0),c=v.windowId;l.$session_id=v.sessionId,l.$window_id=c}this.sessionPropsManager&&ps(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&ps(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.uu)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===nl&&(l.$lib_custom_api_host=this.config.api_host),u="$pageview"!==t||n?"$pageleave"!==t||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(e):this.pageViewManager.doPageView(e,s),l=ps(l,u),"$pageview"===t&&Yt&&(l.title=Yt.title),!Si(o)){var p=e.getTime()-o;l.$duration=parseFloat((p/1e3).toFixed(3))}ei&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var g=this.persistence.properties(),_=this.sessionPersistence.properties(),m=l.$groups,b=g.$groups;wi(m)&&!xi(m)&&(l.$groups=r({},wi(b)?b:{},m)),fs(["$referrer","$referring_domain"],t=>{t in g&&delete _[t]});var y={};if(this.Yl.length>0)for(var w of this.Yl.slice())try{ps(y,w())}catch(t){ds.error("Failed to produce browser extension event properties",t)}(l=ps({},d,g,_,r({},y,l))).$is_identified=this._isIdentified(),bi(this.config.property_denylist)?fs(this.config.property_denylist,function(t){delete l[t]}):ds.error(Pl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(ds.error($l),l=x(l,t));var S=this.Pu();return l.$process_person_profile=S,S&&!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=ps({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(ds.error($l),s=n(s,"$set_once")),i&&(this.Ql=!0),xi(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||!Zs.si())Zs.hi(this.Xl);else{var i=[];this.Kl.forEach(t=>i.push(t)),i.length>0?Zs.ui(this.Xl,i):Zs.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:El}),()=>{})}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:El})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:El})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=cl),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:El}}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:El})}$u(t){return!t||Ei(t)?(ds.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(ds.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())||(ds.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 ds.uninitializedWarning("posthog.identify");if(Ti(t)&&(t=t.toString(),ds.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(c),this.register({distinct_id:t}));var h=(this.persistence.get_property("$user_state")||"anonymous")===Bt,u=t!==l,d=!u&&h;if(u&&h){var v,f=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:l};this.persistence.set_property(_t,Lt),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.aa(),this.capture(Vt,f,{$set:i||{},$set_once:e||{}}),this.ru=sl(t,i,e),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(d){this.persistence.set_property(_t,Lt);var p=i||{},g=e||{};this.setPersonPropertiesForFlags({$set:p,$set_once:g},!1),this.config.cookieWinsOnConflict&&this.persistence.aa(),this.capture("$set",{$set:p,$set_once:g}),this.ru=sl(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ct)):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=sl(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):ds.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(bi(t)?t:[t]).filter(t=>ki(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 s;if(t&&i){null==(s=this.persistence)||s.syncCookieProperties(),this.Ru();var n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:r({},n,{[t]:i})}),(o||e)&&this.Pu()){var a={$group_type:t,$group_key:i};e&&(a.$group_set=e),this.capture(Wt,a)}e&&this.setGroupPropertiesForFlags({[t]:e}),o&&!e&&this.reloadFeatureFlags()}else ds.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=Fi(t)?t:null==t?void 0:t.resetDeviceID,e=Fi(t)||null==t?void 0:t.bootstrap;this.Du(i,!1,e)}Du(t,i,e){var s,n,o,a;if(void 0===i&&(i=!1),ds.info("reset"),!this.__loaded)return ds.uninitializedWarning("posthog.reset");var l=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null==(s=this.su)?void 0:s.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.Ma());var h=this.get_property(d),u=this.get_property(v),c=this.get_property(C);null==(o=this.sessionRecording)||o.flushBeforeIdentityReset();var f=this.is_capturing();this.consent.reset(),i||!f||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 p=null==(a=this.persistence)||null==a.oa?void 0:a.oa(),g=!1;try{var _,m,b,y,w,x,S,k,E,P,T,F,A;if(null==(_=this.persistence)||_.clear(),null==(m=this.sessionPersistence)||m.clear(),this.Kl.clear(),this.Au(),Si(c)||null==(b=this.persistence)||b.register({[C]:c}),null==(y=this.surveys)||y.reset(),null==(w=this.featureFlags)||w.reset(),null==(x=this.conversations)||x.reset(),null==(S=this.logs)||S.reset(),null==(k=this.metrics)||k.reset(),null==(E=this.persistence)||E.set_property(_t,Bt),null==(P=this.sessionManager)||P.resetSessionId(),this.ru=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:kt,$device_id:null},"");else{var I=this.config.get_device_id(As());this.register_once({distinct_id:I,$device_id:t?I:h},""),t||Si(u)||this.register({[v]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(void 0===e.distinctID||this.zl()||(null==(A=this.persistence)||A.set_property(_t,e.isIdentifiedID?Lt:Bt),this.register({distinct_id:e.distinctID})),null==(T=this.featureFlags)||T.initialize(),!(Si(l)||null!=(F=this.sessionManager)&&F.setBootstrapSessionId(l,!0))){var R=r({},e);delete R.sessionID,this.config.bootstrap=R}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,g=!0}finally{var O;p&&(null==(O=this.persistence)||null==O.ha||O.ha(g))}this.reloadFeatureFlags()}shutdown(t){var i=this;return n(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){ds.error("Error while destroying feature flags",t)}null==(o=i.persistence)||o.destroy(),null==(a=i.sessionPersistence)||a.destroy()}else ds.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")?(ds.critical("Attempting to create alias for existing People user - aborting."),-2):this.Fu("posthog.alias")?(Si(i)&&(i=this.get_distinct_id()),t!==i?(this.Ou(c,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(ds.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=r({},this.config);if(wi(t)){var e,s,n,o,a,h,u,d,v,c,f,p,g;ps(this.config,Dl(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 Io(r({},this.config,{persistence:"sessionStorage"}),_,!1);var m=this.nu(this.config.debug);Fi(m)&&(this.config.debug=m),Fi(this.config.debug)&&(this.config.debug?(l.DEBUG=!0,Bs.si()&&Bs.ui("ph_debug",!0),ds.info("set_config",{config:t,oldConfig:i,newConfig:r({},this.config)})):(l.DEBUG=!1,Bs.si()&&Bs.hi("ph_debug"))),null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this.Ma()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(h=this.tracingHeaders)||h.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(d=this.heatmaps)||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(v=this.historyAutocapture)||v.startIfEnabledOrStop()),null==(c=this.exceptionObserver)||c.startIfEnabledOrStop(),null==(f=this.deadClicksAutocapture)||f.startIfEnabledOrStop(),null==(p=this.surveys)||p.loadIfEnabled(),this.Jl(),null==(g=this.externalIntegrations)||g.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&Vn(this,Sl,!1)}}_overrideSDKInfo(t,i){l.LIB_NAME=t,l.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(r({},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:Al;return i!==Al&&(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()&&xi(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?(ds.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ul(),this.Ou(St,!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 Ja(this),this.pageViewManager=new Jn(this),this.persistence&&(this.sessionPropsManager=new Va(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()),(Si(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 ds.warn(kl)}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:kt,$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 ds.warn(kl)}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 Jt?Ya(Jt,this.config.custom_blocked_useragents):void 0}ku(){Yt&&("visible"===Yt.visibilityState?this.tu||(this.tu=!0,this.capture(Ht,{title:Yt.title},{send_instantly:!0}),this.eu&&(Yt.removeEventListener(zt,this.eu),this.eu=null)):this.eu||(this.eu=this.ku.bind(this),Ss(Yt,zt,this.eu)))}debug(t){!1===t?(null==Gt||Gt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Gt||Gt.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?(ds.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&&!Pi(t[i]),o=e in t&&!Pi(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,ds)}ds(t){var i;if(Pi(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(Ii),r=bi(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),Pi(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return Ai(t.event)?ds.warn(o+". This can cause unexpected behavior."):ds.info(o),null}s.properties&&!xi(s.properties)||ds.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return ds.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&Pi(s.properties[a]))return ds.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=Fi(t)&&!t,e=Bs.si()&&"true"===Bs.li("ph_debug");return!i&&(!!e||t)}},s.__defaultExtensionClasses={},s.qu=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),s);!function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=ms(t.prototype[i[e]])}(Bl,["identify"]);var Ll=class{constructor(t){this.disabled=!1===t;var i=wi(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}},Nl="$copy_autocapture",zl=vs("[AutoCapture]");function Ul(t,i){return i.length>t?i.slice(0,t)+"...":i}function Hl(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!rn(i));return i}function ql(t,i){var e,s,n=i.e,o=i.maskAllElementAttributes,a=i.maskAllText,l=i.elementAttributeIgnoreList,h=i.elementsChainAsString,u=i.disableCaptureUrlHashes;if(!rn(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!sn(c,"body")&&1e3>d.length;)if(on(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!rn(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode}var p="click"===n.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?d.findIndex(t=>sn(t,"button")||sn(t,"a")):-1;p>0&&(a=a||d.slice(0,p+1).some(t=>!$n(t)||Pn(t)));var g,_,m,b=[],y={},w=!1,x=!1;if(fs(d,t=>{var i=$n(t);if(sn(t,"a")){var e=t.getAttribute("href");w=!!(i&&e&&Mn(e))&&(u?tr(e):e)}li(hn(t),"ph-no-capture")&&(x=!0),b.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};cn.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Ul(1024,Dn(t)):Ul(1024,dn(t)));var a=hn(t);a.length>0&&(o.classes=a.filter(function(t){return""!==t})),fs(t.attributes,function(e){var n;if((!Pn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Mn(e.value)&&(!ki(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=an(a).join(" ")),o["attr__"+e.name]=Ul(1024,"href"===e.name&&s?tr(a):a)}});for(var l=1,h=1,u=t;u=Hl(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,a,l,u)),fs(function(t){if(!$n(t))return{};var i={};return fs(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&&Mn(r)&&(i[e]=r)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(y,i)||(y[i]=t)})}),x)return{props:{},explicitNoCapture:x};if(p>0&&(t=d[p],b.splice(0,p)),a||(b[0].$el_text=sn(t,"a")||sn(t,"button")?Dn(t):dn(t)),w){var S,k;b[0].attr__href=w;var E=null==(S=io(w))?void 0:S.host,P=null==Gt||null==(k=Gt.location)?void 0:k.host;E&&P&&E!==P&&(g=w)}return{props:ps((_=n.type,{$event_type:_,$ce_version:1}),h?{}:{$elements:b},{$elements_chain:(m=b,bi(m)?function(t){return t.map(t=>{var i,e,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=r({},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 gs(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[Bn(t[0].toString())]=Bn(i.toString())}),(s+=":")+gs(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:Ln(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return gs(t).filter(t=>0===t[0].indexOf("attr__")).forEach(t=>r.attributes[t[0]]=t[1]),r})}(m)):"")},null!=(e=b[0])&&e.$el_text?{$el_text:null==(s=b[0])?void 0:s.$el_text}:{},g&&"click"===n.type?{$external_click_url:g}:{},y),target:t}}var Vl=class{Ds(){this.Ls=void 0,clearTimeout(this.Ns),this.Ns=void 0}qs(t){var i;if(!$n(t))return!0;for(var e,r=null!==(i=this.js().css_selector_ignorelist)&&void 0!==i?i:_n,s=new Set,n=t,o=function(){if(s.size>=1e3||s.has(n))return{v:!0};s.add(n);var t=n,i=hn(t);if(li(i,"ph-no-capture")||li(i,"ph-sensitive")||Pn(t)||r.some(i=>fn(t,i)))return{v:!0};var e=n.parentNode;n=on(e)?e.host:e&&rn(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=vn(t);t.isPrimary&&0===t.button&&!t.ctrlKey&&r&&rn(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=vn(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&&(sn(r,"html")||sn(r,"body"))){var s;if(e.excluded)return null;var n=null!==(s=this.js().css_selector_ignorelist)&&void 0!==s?s:_n;return[r,null==Yt?void 0:Yt.documentElement,null==Yt?void 0:Yt.body].some(t=>{if(!t)return!1;var i=hn(t);return li(i,"ph-no-capture")||li(i,"ph-sensitive")||!$n(t)||Pn(t)||n.some(i=>fn(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 Ll(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(Gt&&Yt){var t=this.io=t=>{t=t||(null==Gt?void 0:Gt.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($i(i))return;this.ro(t,"$autocapture",i)}catch(t){zl.error("Failed to capture event",t)}};if(Ss(Gt,"blur",t),Ss(Yt,"submit",t,{capture:!0}),Ss(Yt,"change",t,{capture:!0}),Ss(Yt,"click",t,{capture:!0}),fs(["pointerdown","pointermove","pointerup","pointercancel"],i=>{Ss(Yt,i,t,{capture:!0})}),this.js().capture_copied_text){var i=this.no=t=>{t=t||(null==Gt?void 0:Gt.event);try{this.ro(t,Nl)}catch(t){zl.error("Failed to capture clipboard event",t)}};Ss(Yt,"copy",i,{capture:!0}),Ss(Yt,"cut",i,{capture:!0}),Ss(Yt,"paste",i,{capture:!0})}}}else zl.info("Disabling Automatic Event Collection because this browser is not supported")}Ys(){this.Ds(),this.io&&(null==Gt||Gt.removeEventListener("blur",this.io),fs(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==Yt||Yt.removeEventListener(t,this.io,!0)}),null==Yt||Yt.removeEventListener("submit",this.io,!0),null==Yt||Yt.removeEventListener("change",this.io,!0),null==Yt||Yt.removeEventListener("click",this.io,!0),this.io=void 0),this.no&&(null==Yt||Yt.removeEventListener("copy",this.no,!0),null==Yt||Yt.removeEventListener("cut",this.no,!0),null==Yt||Yt.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;Fi(r)&&(null==(e=this.Hs)||e.kv.set(m,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==Yt||null==(s=Yt.querySelectorAll(e))||s.forEach(s=>{t!==s&&i!==s||li(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(m),r=this.Vs,s=this.js();if(!s.remoteRequestsDisabled&&!this.Gs)return!1;var n=s.remoteRequestsDisabled&&!this.Gs;if($i(r)&&!Fi(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 s=e||vn(t);nn(s)&&(s=s.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())&&Sn(s,o.rageclick)&&this.ro(t,"$rageclick",e);var a=i===Nl,l=a?r({},o,{dom_event_allowlist:void 0}):o;if(s&&function(t,i,e,r,s,n){var o;if(!Gt||kn(t))return!1;if(null!=e&&e.url_allowlist&&!ln(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&ln(e.url_ignorelist,n))return!1;if(null!=e&&e.dom_event_allowlist){var a=e.dom_event_allowlist;if(a&&!a.some(t=>i.type===t))return!1}var l=En(t,r),h=l.parentIsUsefulElement,u=l.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(Si(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}(u,e))return!1;if(!pn(u,null==e?void 0:e.css_selector_allowlist))return!1;if(pn(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:_n))return!1;try{var d=Gt.getComputedStyle(t);if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}var v=t.tagName.toLowerCase();switch(v){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 h?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(cn.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(s,t,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:o.getCurrentUrl}})){var h,u=ql(s,{e:t,maskAllElementAttributes:o.maskAllElementAttributes,maskAllText:o.maskAllText,elementAttributeIgnoreList:o.element_attribute_ignorelist,elementsChainAsString:this.Zs,disableCaptureUrlHashes:o.disableCaptureUrlHashes}),d=u.props;if(u.explicitNoCapture)return!1;var v=this.getElementSelectors(s,u.target);if(v&&v.length>0&&(d.$element_selectors=v),i===Nl){var c=t.type||"clipboard";if("paste"!==c){var f,p,g=null==Gt||null==(f=Gt.getSelection())?void 0:f.toString(),_=un(g);if(!_)return!1;d.$selected_content=_,d.$clipboard_text_length=null!==(p=null==g?void 0:g.length)&&void 0!==p?p:0}d.$copy_type=c}return null==(h=this.Hs)||h.capture(i,d).catch(t=>zl.error("Failed to capture event",t)),!0}}else this.Ds()}isBrowserSupported(){return yi(null==Yt?void 0:Yt.querySelectorAll)}},Wl=class{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=wi(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}},Gl=vs("[ExceptionAutocapture]"),Kl=()=>{},Jl=t=>{var i;if(yi(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Yl(t,i,e){try{if(!(i in t))return Kl;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 yi(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=Jl(e);n;){if(n.next===s)return void(n.next=r.next);n=Jl(e=n.next)}else t[i]=r.next}}catch(t){return Kl}}var Xl=vs("[TracingHeaders]"),Zl=vs("[Web Vitals]"),Ql=9e5,th=["CLS","FCP","INP","LCP"],ih=["INP","LCP"],eh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],rh="disabled",sh="lazy_loading",nh=vs("[SessionRecording]"),oh=vs("[Heatmaps]");function ah(t){return wi(t)&&"clientX"in t&&"clientY"in t&&Ti(t.clientX)&&Ti(t.clientY)}var lh=vs("[Product Tours]"),hh=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(E))},uh=vs("[SiteApps]"),dh="Error while initializing PostHog app with config id ",vh=(t,i)=>null!=t&&t.then?t.then(i):i(t),ch="SDK is not enabled or survey functionality is not yet loaded",fh="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 ul.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(Pi(i))return ul.warn("Flags not loaded yet. Not loading surveys.");this.Gu=Fi(i)?i:i.length>0,ul.info("flags response received, isSurveysEnabled: "+this.Gu),this.loadIfEnabled()}}}setup(t){if(!this.Js)return this.Zu=t,vh(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)ul.info("Already initializing surveys, skipping...");else if(t.disableSurveys)ul.info(fh);else if(t.cookielessMode&&this.Us.isOptedOut())ul.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Us.getExtensions();if(i){if(!Si(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(jt),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 ul.error("PostHog Extensions not found.")}}}Ju(t,i){this.Js||(this._surveyManager=t(i),this._surveyEventReceiver=this.Us.createEventReceiver(),ul.info("Surveys loaded successfully"),this.Ku({isLoaded:!0}))}Qu(t,i){ul.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 ul.info(fh),t([]);var s=r.kv.get(it);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=>ul.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 ul.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=>ul.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(ch)}))}th(t,i){var e;if(this.Js)return{surveys:[],context:{isLoaded:!1,error:ch}};var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return 0!==r?ul.error(s):i.error||ul.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)&&(Qa(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({[it]:n,[et]: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(et);return Ti(e)&&Date.now()-e>3e5}ih(){return Ti(this.Wu)&&3e5>Date.now()-this.Wu}markSurveyAsSeen(t,i){var e;dl({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){ul.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!Pi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);ul.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(Pi(this._surveyManager))return{eligible:!1,reason:ch};var i="string"==typeof t?this.rh(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}sh(t){if(Pi(this._surveyManager))return{eligible:!1,reason:ch};var i="string"==typeof t?this.rh(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Pi(this._surveyManager))return ul.warn("init was not called"),{visible:!1,disabledReason:ch};var i=this.sh(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return Pi(this._surveyManager)?(ul.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ch})):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(Pi(this._surveyManager))ul.warn("init was not called");else{var s="string"==typeof t?this.rh(t):t;if(null!=s&&s.id)if(vl.includes(s.type)){var n=null==Yt?void 0:Yt.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){ul.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout(()=>{var t,i;this.Vu.delete(o),this.Js||(ul.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),ul.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this.Vu.add(o)}else this._surveyManager.renderSurvey(s,n,e);else ul.warn("Survey element not found")}else ul.warn("Surveys of type "+s.type+" cannot be rendered in the app");else ul.warn("Survey not found")}}displaySurvey(t,i){var e;if(Pi(this._surveyManager))ul.warn("init was not called");else{var s=this.rh(t);if(s){var n=s;if(null!=(e=s.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=r({},s,{appearance:r({},s.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==zo&&i.initialResponses&&ul.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.nh(s);if(!o.eligible)return void ul.warn("Survey is not eligible to be displayed: ",o.reason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else ul.warn("Survey not found")}}cancelPendingSurvey(t){Pi(this._surveyManager)?ul.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}};function gh(t,i,e){if(Pi(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 _h=class{constructor(t){this._instance=t,this.oh=new Set,this.ah=new Set,this.uh=new Wa,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;Si(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 Wa}register(t){var i,e;if(!Si(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(!gh(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=>gh(t.href,i.href,i.href_matching||"exact"));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&gh((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=>gh(t.text,i.text,i.text_matching||"exact")||gh(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;!Pi(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=>gh(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||rl(i.properties.reduce((t,i)=>{var e=bi(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)}},mh=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&&rl(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===Mo?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;Si(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 _h(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,Mo),a=this.$h(t,Do);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,Do);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,Mo);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(r({},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&&(xi(e)?this.Fh():this.Ph(e))}}nd(){this.Ah()&&this.Fh()}getActivationTimestamp(t){if(this.Kh().includes(t)){var i=this.rd()[t];return Ti(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=>Ti(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}},bh=class extends mh{constructor(t){super(t)}sd(){return rt}od(){return st}Ah(){return nt}Ph(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[nt]:t})}Fh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(nt)}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 Ti(r)&&r>0}dd(){return jo}Lh(t){var i;null==(i=this._instance)||i.getSurveys(t)}Zh(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}zh(){return ul}Xh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[rt]:t})}ad(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[st]:t})}ld(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(st)}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 Qa(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e)?t===jo?"consume":"ignore":t===jo?"persist":t===Bo||t===Lo?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},yh=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);Si(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)}},wh=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==ni?void 0:ni.__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 bh(this._instance)}},xh=null!=Gt&&Gt.location?so(Gt.location.hash,"__posthog")||so(location.hash,"state"):null,Sh="_postHogToolbarParams",kh=vs("[Toolbar]"),Eh=vs("[FeatureFlags]"),$h=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:bi(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.vd||(Eh.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.vd=!0),Si(t.flag_keys)||bi(t.flag_keys)||Eh.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.fd}},Ph=vs("[FeatureFlags]"),Th=vs("[FeatureFlags]",{debugEnabled:!0}),Ch="\" failed. Feature flags didn't load in time.",Fh="connection_error",Ah=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},Ih=t=>{var i={};for(var e of gs(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},Rh=t=>Mi(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Oh=vs("[Error tracking]"),Mh="webkit-masked-url:",Dh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Mh],jh=["__firefox__","__gCrWeb"],Bh="Refusing to render web experiment since the viewer is a likely bot",Lh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>tl(i,t),not_regex:(t,i)=>!tl(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},Nh=vs("[Conversations]"),zh="Conversations not available yet.";function Uh(t,i){var e,s,n,o,a,l,h,u=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,d=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,v=null!=i&&i.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,c=Si(v)?Math.max(d,2048):Math.max(d,v),f=r({},function(){var t="",i="";try{var e=null==Jt?void 0:Jt.userAgent;if(e){var s=ze(e);t=s[0],i=s[1]}}catch(t){}return function(t,i){var e=function(t){if(t)return{}.hasOwnProperty.call(Zr,t)?Zr[t]:t}(t);return r({},e?{"os.name":e}:{},i?{"os.version":i}:{})}(t,i)}(),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==f?void 0:f["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==f?void 0:f["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(h=null==f?void 0:f["deployment.environment"])&&void 0!==h?h:null==t?void 0:t.environment,resourceAttributes:f,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:d,maxQueueSize:c,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var Hh=["debug","log","warn","error","info"],qh="console",Vh="__posthogHandledLogsRequestError",Wh=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[Vh]=!0,e},Gh=t=>!!t&&"object"==typeof t&&!0===t[Vh],Kh={featureFlags:class{constructor(t){this.name="featureFlags",this.pd=!1,this.featureFlagEventHandlers=[],this.A=Ph,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;Si(i)||this._n.remoteRequestsDisabled||!Yt||"hidden"===Yt.visibilityState||Date.now()-(null!==(t=this.Rd)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.Ad())},this.Ze=()=>{"visible"===(null==Yt?void 0:Yt.visibilityState)&&this.Id()},"get"in t?this.Us=t:(this._instance=t,this.Pd=new $h(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]"),vh(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 Gt&&Ss(Gt,"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&&Yt&&!Si(t)&&t>0?t:void 0;i!==this.Ed&&(this.Bd(),Si(i)||(this.Ed=i,this.Ad(),null!=Yt&&Yt.addEventListener&&Ss(Yt,zt,this.Ze)))}Ad(){Si(this.Ed)||(Si(this.Hd)||clearInterval(this.Hd),this.Rd=Date.now(),this.Hd=setInterval(this.Id,this.Ed))}Bd(){Si(this.Hd)||(clearInterval(this.Hd),this.Hd=void 0,null==Yt||null==Yt.removeEventListener||Yt.removeEventListener(zt,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==Gt||Gt.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!Si(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&&!bi(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,g={[q]:f,[H]:f,[G]:p};for(var _ of(t.$feature_flag_details&&(g[W]=f),[K,gt,J]))Si(t[_])||(g[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}}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[q,G,K,Y]){var e=this.Wd(i);Si(e)||(t[i]=e)}this.gd=t;var s=r({},t),n=this.Wd(H);if(n)for(var o of Object.entries(n))s["$feature/"+o[0]]=o[1];this.md=s}Dd(){var t=this._n.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Wd(gt);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(!Si(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=>!Si(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 s,n,o=null!=e&&e.merge&&null!==(s=this.Wd("$enabled_feature_flags"))&&void 0!==s?s:{},a=null!=e&&e.merge&&null!==(n=this.Wd("$feature_flag_payloads"))&&void 0!==n?n:{},l=r({},o,t),h=r({},a,i),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Mr(c),variant:Dr(c),reason:void 0,metadata:Si(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(W),i=this.Wd(Y),e=this.Wd(X);if(!e&&!i)return t||{};var s=ps({},t||{});for(var n of[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])]){var o,a,l=s[n],h=null==i?void 0:i[n],u=Si(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=Si(h)?null==l?void 0:l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=r({},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=r({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),s[n]=c}return this.pd||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:s}),this.pd=!0),s}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{var r=t[e];return{key:e,enabled:Mr(r),variant:Dr(r),payload:Or(i[e])}})}getFlagVariants(){var t=this.Wd(H),i=this.Wd(Y);if(!i)return t||{};for(var e=ps({},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(G),i=this.Wd(X);if(!i)return t||{};for(var e=ps({},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(ct)}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:r({},i.initialPersonProperties,this.Wd("$stored_person_properties")||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Wd(Q),timezone:yo()};Si(i.deviceId)||(e.$device_id=i.deviceId),(null!=t&&t.disableFlags||this._n.featureFlagsDisabled)&&(e.disable_flags=!0);var s=this.Kd();s.length&&(e.evaluation_contexts=s);var n=this.Xd();Si(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({[pt]:[Fh]}),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?Fh:"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({[pt]: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 no(this.Td,3)}iv(t){this.Td=oo(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+Ch)}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,s=this.getFlagVariants(),n=t in s,o=s[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(ft);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({[ct]:d,[ft]:e});else{var p,g,_,m,b,y,w,x,S,k,E,P,T;bi(d[t])?d[t].push(l):d[t]=[l],this.ui(r({[ct]:d},e?{[ft]:e}:{}));var C=this.getFeatureFlagDetails(t),F=[...null!==(p=this.Wd("$feature_flag_errors"))&&void 0!==p?p:[]];Si(o)&&F.push("flag_missing");var A={$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!==(g=null==(_=this._n.bootstrap)||null==(_=_.featureFlags)?void 0:_[t])&&void 0!==g?g: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};Si(null==C||null==(y=C.metadata)?void 0:y.has_experiment)||(A.$feature_flag_has_experiment=C.metadata.has_experiment),Si(null==C||null==(w=C.metadata)?void 0:w.version)||(A.$feature_flag_version=C.metadata.version);var I=null!==(x=null==C||null==(S=C.reason)?void 0:S.description)&&void 0!==x?x:null==C||null==(k=C.reason)?void 0:k.code;I&&(A.$feature_flag_reason=I),null!=C&&null!=(E=C.metadata)&&E.id&&(A.$feature_flag_id=C.metadata.id),Si(null==C?void 0:C.original_variant)&&Si(null==C?void 0:C.original_enabled)||(A.$feature_flag_original_response=Si(C.original_variant)?C.original_enabled:C.original_variant),null!=C&&null!=(P=C.metadata)&&P.original_payload&&(A.$feature_flag_original_payload=null==C||null==(T=C.metadata)?void 0:T.original_payload),F.length&&(A.$feature_flag_error=F.join(",")),this.rv(A)}else e&&this.ui({[ct]:d,[ft]:e});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Or(a)}}}else this.A.warn('getFeatureFlagResult for key "'+t+Ch)}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 n(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();Si(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+Ch),i.defaultValue;var e=this.getFeatureFlag(t,i);return Si(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 s=function(t,i,e,s,n,o){void 0===i&&(i={}),void 0===e&&(e={}),void 0===s&&(s={}),void 0===o&&(o=Ph);var a=((t,i)=>{var e=t.flags;return e?r({},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!Si(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(bi(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{[q]:h,[H]:c,[J]:!1}}var p=h,g=u,_=l;if(null!=n&&n.partialResponse){var m=Object.keys(p),b=g||{};p=r({},i,p),g=r({},e,b),m.forEach(t=>{var i;t in b||null==(i=g)||delete i[t]}),_=r({},s,_)}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=r({},i,Object.fromEntries(Object.entries(p).filter(t=>y.has(t[0]))));var w=Object.fromEntries(Object.entries(g||{}).filter(t=>y.has(t[0])));g=r({},e,w),y.forEach(t=>{var i;t in w||null==(i=g)||delete i[t]}),_=r({},s,Object.fromEntries(Object.entries(_||{}).filter(t=>y.has(t[0]))))}else p=r({},i,p),g=r({},e,g),_=r({},s,_);return r({[q]:Object.keys(Ih(p)),[H]:p||{},[G]:g||{},[W]:_||{},[J]:!0===t.minimalFlagCalledEvents},d?{[K]:d}:{},v?{[gt]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.A);if(s)if(!1===(null==e?void 0:e.persist)){var n=!Si(this.Hs.kv.get(H));this.Vd=s,n||this.ui(s)}else this.Nd(),this.Jd(s,t,!(null==e||!e.partialResponse)),this.ui(s);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([Y,X]),this.jd(),void Th.info("All overrides cleared");if(bi(t))return this.ui({[Y]:Ah(t)}),this.jd(),void Th.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[Y]=bi(s)?Ah(s):s),n&&(r[X]=n),Object.keys(r).length&&this.ui(r),!1===s&&!1===n?this.hi([Y,X]):!1===s?this.hi(Y):!1===n&&this.hi(X),this.jd(),!1===s?Th.info("Flag overrides cleared"):s&&Th.info("Flag overrides set",{flags:s}),void(!1===n?Th.info("Payload overrides cleared"):n&&Th.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.ui({[Y]:t}),this.jd(),void Th.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 s,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=r({},this.getFlagVariants(),{[t]:i});null==(s=this._instance)||null==(s=s.persistence)||s.markCrossTabFeatureFlagChanges({[q]:[t],[H]:[t],[Z]:Object.keys(o)}),this.ui({[q]:Object.keys(Ih(l)),[H]:l,[Z]:r({},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(V);!r||i?this.av(t,e):t(r)}av(t,i){var e=this;return n(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({[V]: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")||{},s=(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({[Z]:r({},e,o,s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=r({},this.Wd("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.ui({[Z]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.hi(Z),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.Wd("$stored_group_properties")||{},s=r({},e);for(var n of Object.keys(t))s[n]=r({},e[n],t[n]);this.ui({[Q]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Wd("$stored_group_properties")||{};this.ui({[Q]:r({},i,{[t]:{}})})}else this.hi(Q)}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}}},Jh={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=rh,this.dv=void 0,this.vv=!1,this.je=(()=>{var t;if(null==Yt||!Yt.visibilityState||"visible"===Yt.visibilityState)return!0;var i=null==Gt||null==(t=Gt.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==Yt?void 0:Yt.visibilityState)&&(this.je=!0,null==(t=this.uv)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},!this._instance.sessionManager)throw nh.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!=Yt&&Yt.addEventListener&&Ss(Yt,"visibilitychange",this.Ze)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.vv=!0,null==Yt||null==Yt.removeEventListener||Yt.removeEventListener("visibilitychange",this.Ze),e?this.fv(!0):this.stopRecording()}get pv(){var t,i=!(null==(t=this._instance.get_property(C))||!t.enabled),e=!this._n.disable_session_recording,r=this._n.disable_session_recording||this._instance.consent.isOptedOut();return Gt&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.vv||this.pv&&null!=(i=this.uv)&&i.isStarted)){var e=!Si(Object.assign)&&!Si(Array.from);this.pv&&e?(this.gv(t),nh.info("starting")):(this.hv=rh,this.stopRecording())}}gv(t){var i,e;if(this.pv)if("awaiting_config"!==this.hv&&"missing_config"!==this.hv&&(this.hv=sh),null!=ni&&null!=(i=ni.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=ni.__PosthogExtensions__)&&e.initSessionRecording)this.mv(t);else{var r,s=this._instance.sessionManager;null==(r=ni.__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({[Tt]:!0}),nh.error("could not load recorder",i)):void this.mv(t);this.hv=rh})}}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(j),null==(i=this.Ya)||i.unregister(A)}_v(t,i){if(Pi(t))return null;var e,r=Ti(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(nh.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}wv(t){if(this.Ya){var i,e,s=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;Pi(a)&&this.bv();var l=null==e?void 0:e.minimumDurationMilliseconds;s.register({[C]:r({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:r({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:Si(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",nh.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):nh.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(C);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return nh.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!Pi(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=ni.__PosthogExtensions__)||!i.initSessionRecording)return nh.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Tt]:!0});var s;if(this.uv||(this.uv=null==(s=ni.__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",nh.info("persisted remote config is stale, requesting fresh config before starting"),void new Wo(this._instance).load()}this.hv=sh,null==(e=(r=this.uv).setDocumentWasEverVisible)||e.call(r,this.je),this.uv.start(t)}else this.hv=rh}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({[R]:!0}),null==(i=this.uv)||i.overrideLinkedFlag()}overrideSampling(){var t,i;this.uv||null==(t=this.Ya)||t.register({[I]:!0}),null==(i=this.uv)||i.overrideSampling()}overrideTrigger(t){var i,e;this.uv||null==(i=this.Ya)||i.register({["url"===t?O:M]:!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()}}},Yh={autocapture:class extends Vl{constructor(t){super(new Wl(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&&(ds.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,ds.info("History API monitoring stopped")}monitorHistoryChanges(){Gt&&Gt.history&&(this.Rv("pushState"),this.Rv("replaceState"),this.Av(),this.Mv()&&this.Pv())}Rv(t){var i;if(Gt&&(null==(i=Gt.history[t])||!i.__posthog_wrapped__)){var e=this;Yl(Gt.history,t,i=>function(r,s,n){i.call(this,r,s,n),e.Fv(t)})}}Cv(){var t=null==Gt?void 0:Gt.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}:wi(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(Ht,{navigation_type:t}),this.xv=i}catch(i){ds.error("Error capturing "+t+" pageview",i)}}Av(){if(!this.Iv){var t=()=>{this.Fv("popstate")};Ss(Gt,"popstate",t),this.Iv=()=>{Gt&&Gt.removeEventListener("popstate",t)}}}Pv(){if(!this.Ev){var t=()=>{this.Fv("hashchange")};Ss(Gt,"hashchange",t),this.Ev=()=>{Gt&&Gt.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[b]),this.rageclicks=new Ll(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return wi(this._n.capture_heatmaps)&&this._n.capture_heatmaps.flush_interval_milliseconds&&(t=this._n.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Pi(this._n.capture_heatmaps)?Pi(this._n.enable_heatmaps)?this.$v:this._n.enable_heatmaps:!1!==this._n.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Ws)return;oh.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({[b]:e}),this.$v=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.Pe;return this.Pe=void 0,t}qv(t){ah(t.originalEvent)&&this.an(t.originalEvent,"deadclick")}Ze(){this.Dv&&clearInterval(this.Dv),this.Dv=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(Yt)?setInterval(this.za.bind(this),this.flushIntervalMilliseconds):null}Lv(){Gt&&Yt&&(this.jv=this.za.bind(this),Ss(Gt,Ut,this.jv),this.Bv=t=>this.an(t||(null==Gt?void 0:Gt.event)),Ss(Yt,"click",this.Bv,{capture:!0}),this.Hv=t=>this.zv(t||(null==Gt?void 0:Gt.event)),Ss(Yt,"mousemove",this.Hv,{capture:!0}),this.Uv=new Hn(this.instance,zn,this.qv.bind(this)),this.Uv.startIfEnabledOrStop(),this.Wv=this.Ze.bind(this),Ss(Yt,zt,this.Wv),this.Ws=!0)}Nv(){var t;Gt&&Yt&&(this.jv&&Gt.removeEventListener(Ut,this.jv),this.Bv&&Yt.removeEventListener("click",this.Bv,{capture:!0}),this.Hv&&Yt.removeEventListener("mousemove",this.Hv,{capture:!0}),this.Wv&&Yt.removeEventListener(zt,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&&rn(r)&&!sn(r,"body");){if(r===e)return!1;var s=void 0;try{var n,o,a;s=null==(n=null!==(o=null==(a=r.ownerDocument)?void 0:a.defaultView)&&void 0!==o?o:Gt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(li(i,s))return!0;r=gn(r)}return!1}(vn(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"),!en(t.target)&&ah(t)){var s=this.Gv(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&Sn(vn(t),this.instance.config.rageclick)&&this.Is(r({},s,{type:"rageclick"})),this.Is(s)}}zv(t){!en(t.target)&&ah(t)&&(clearTimeout(this.Vv),this.Vv=setTimeout(()=>{this.Is(this.Gv(t,"mousemove"))},500))}Is(t){if(Gt){var i=this._n.disable_capture_url_hashes?tr(Gt.location.href):Gt.location.href,e=this._n.custom_personal_data_properties,r=ro(i,this._n.mask_personal_data_properties?[...ao,...e||[]]:[],ho);this.Pe=this.Pe||{},this.Pe[r]||(this.Pe[r]=[]),this.Pe[r].push(t)}}za(){this.Pe&&!xi(this.Pe)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Hn,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",r({$current_url:this.Pe.url},this.Pe.metrics.reduce((t,i)=>r({},t,{["$web_vitals_"+i.name+"_event"]:r({},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},Pi(null==t?void 0:t.name)||Pi(null==t?void 0:t.value))Zl.error("Invalid metric received",t);else{var e="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.Kv(e);if(!Si(s)){var n=Ti(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+s;if(!this.Xv||this.Xv>t.value){this.Pe.navigationKey!==n&&(this.Zv(),this.Jv=setTimeout(this.Zv,this.flushToCaptureTimeoutMs)),Si(this.Pe.navigationKey)&&(this.Pe.navigationKey=n,this.Pe.url=s),this.Pe.firstMetricTimestamp=Si(this.Pe.firstMetricTimestamp)?Date.now():this.Pe.firstMetricTimestamp;var o=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),a=r({},t,e?{navigationURL:s}:{},{$current_url:s,timestamp:Date.now()});if(delete a.entries,wi(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of eh){var u="url"===h&&"string"==typeof t.attribution[h]?this.Kv(t.attribution[h]):t.attribution[h];Si(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;Si(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 Zl.error("Ignoring metric with value >= "+this.Xv,t)}}},this.Yv=()=>{if(!this.Ws){var t,i,e,s,n=!1,o=ni.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.tc])||("web-vitals"===this.tc&&Si(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!Si(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!Si(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,s=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&i&&e&&s){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?r({},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&&s(this.Qv.bind(this),v),this.Ws=!0}else Zl.error("web vitals callbacks not loaded - not starting")}},this.$v=!(null==(i=this._instance.persistence)||!i.props[S]),this.startIfEnabled()}get ec(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=wi(this.ec)?null==(t=this.ec)?void 0:t.web_vitals_allowed_metrics:void 0;return Pi(e)?(null==(i=this._instance.persistence)?void 0:i.props.$web_vitals_allowed_metrics)||th:e}get flushToCaptureTimeoutMs(){return(wi(this.ec)?this.ec.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=wi(this.ec)?this.ec.web_vitals_attribution:void 0;return Fi(t)?t?th:[]:bi(t)?t:ih}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t;return null!==(t=wi(this.ec)?this.ec.__preview_web_vitals_soft_navs:void 0)&&void 0!==t&&t}get Xv(){var t=wi(this.ec)&&Ti(this.ec.__web_vitals_max_value)?this.ec.__web_vitals_max_value:Ql;return t>0&&6e4>=t?Ql:t}get isEnabled(){var t=null==Xt?void 0:Xt.protocol;if("http:"!==t&&"https:"!==t)return Zl.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=wi(this.ec)?this.ec.web_vitals:Fi(this.ec)?this.ec:void 0;return Fi(i)?i:this.$v}startIfEnabled(){this.isEnabled&&!this.Ws&&(Zl.info("enabled, starting..."),this.do(this.Yv))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=wi(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=wi(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[S]:e}),this._instance.persistence.register({[T]: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=ni.__PosthogExtensions__,e=this.tc,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&Si(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,i=>{i?Zl.error("failed to load script",i):t()})}Kv(t){var i=t||(null==Gt?void 0:Gt.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?tr(i):i,r=this._instance.config.custom_personal_data_properties;return ro(e,this._instance.config.mask_personal_data_properties?[...ao,...r||[]]:[],ho)}Zl.error("Could not determine current URL")}}},Xh={exceptionObserver:class{constructor(t){var i;this.Yv=()=>{var t;if(Gt&&this.isEnabled&&null!=(t=ni.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=ni.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=ni.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=ni.__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){Gl.error("failed to start",t),this.oc()}}},this._instance=t,this.ac=!(null==(i=this._instance.persistence)||!i.props[y]),this.wt=new Ui(r({},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:Gl})),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 wi(t)?i=r({},i,t):(Si(t)?this.ac:t)&&(i=r({},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?(Gl.info("enabled"),this.oc(),this.do(this.Yv)):this.oc()}do(t){var i,e;null!=(i=ni.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=ni.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return Gl.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({[y]: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 Gl.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 nr([new gr,new $r,new mr,new _r,new kr,new Sr,new yr,new Er],function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),s=1;i>s;s++)e[s-1]=arguments[s];return function(i,s){void 0===s&&(s=0);for(var n=[],o=i.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=pr.test(l)?l.replace(pr,"$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 r({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",dr,fr)),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=Ar(this.vc()),this.cc=new Ir(this.dc)}onConfigChange(){this.dc=Ar(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({[w]:this.uc,[x]:o})}}}get fc(){var t,i,e=!!this._instance.get_property(x);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(!ki(t)||0===t.trim().length)return void Oh.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)=>Cr.has(r)?(i.push(r),e):(e[r]=t[r],e),{}),droppedKeys:i}}(this.gc(i)),s=e.sanitizedProperties,n=e.droppedKeys;n.length>0&&Oh.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.cc.add(r({[Pr]:t,[Tr]:(new Date).toISOString()},s))}catch(t){Oh.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 Oh.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 Oh.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 Oh.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 Oh.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.dc.enabled&&Pi(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 Rh(t)||Oh.error("Failed to capture exception event. Dropping this exception.",t),void this.cc.clear()}}catch(t){return void(Rh(t)||Oh.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:r({},t,{$exception_steps:i})}catch(i){return Oh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}bc(t){this.dc.enabled&&this.cc.add({[Pr]:t,[Tr]:(new Date).toISOString()})}gc(t){return wi(t)?r({},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 ki(e)&&e.length>0&&t.$exception_types.push(e),ki(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=el[t.operator],r=i[t.key];if(!e||!r)return!1;var s=bi(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 Oh.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&&Dh.some(t=>i.startsWith(t))});return 0!==e.length&&(!e.every(t=>{var i=t.filename;return!!i&&i.startsWith(Mh)})||t.some(t=>{var i=t.value;return ki(i)&&i.includes("isolatedAPI.contexts.topHostname")})&&!i.some(t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith(Mh))}))}wc(t){return t.some(t=>{var i=t.value;return ki(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!Pi(t)&&bi(t)}}},Zh=r({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({[E]:!!i.productTours}),!hh(this._instance))return!this.xc&&Pi(null==(e=this.Ya)?void 0:e.props.ph_product_tours)||lh.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&&hh(this._instance)&&this.do(()=>this.Tc())}do(t){var i,e;null!=(i=ni.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=ni.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",i=>{i?lh.error("Could not load product tours script",i):t()})}Tc(){var t;!this.xc&&null!=(t=ni.__PosthogExtensions__)&&t.generateProductTours&&(this.xc=ni.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!bi(this.Cc)||i){var e=this.Ya;if(e){var r=e.props[ot];if(bi(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(hh(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||lh.warn(s):lh.error(s),void t([],{isLoaded:!1,error:s})}var n=bi(i.json.product_tours)?i.json.product_tours:[];this.Cc=n,e&&e.register({[ot]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Cc,{isLoaded:!0})}getActiveProductTours(t){Pi(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(ot)}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)}}},Kh),Qh={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=ni._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 s,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 g=t.$set_once,_=t.$set;return{event:r({},e(t,i),{properties:r({},t.properties,_?{$set:r({},null!==(s=null==(n=t.properties)?void 0:n.$set)&&void 0!==s?s:{},_)}:{},g?{$set_once:r({},null!==(o=null==(a=t.properties)?void 0:a.$set_once)&&void 0!==o?o:{},g)}:{}),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)||(uh.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)||(uh.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==Yt?void 0:Yt.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 u=[],d=this,v=new WeakSet,c=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),u.push(()=>{t[i]=r})}},f=t=>{if(v.has(t))return t;var i=d.Ac(t);return i&&v.add(i),i},p=t=>t.map(t=>"string"==typeof t?t:f(t)).filter(t=>!$i(t));return c(h,"appendChild",t=>function(i){var e=f(i);return e?t.call(this,e):i}),c(h,"insertBefore",t=>function(i,e){var r=f(i);return r?t.call(this,r,e):i}),c(h,"replaceChild",t=>function(i,e){var r=f(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=>{c(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,p(e))}),c(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,p(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=>{c(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,p(e))}),c(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,p(e))}),c(t,"replaceWith",t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=p(e);return e.length&&!s.length?void 0:t.apply(this,s)})}),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",t=>function(i,e){var r=f(e);return r?t.call(this,i,r):null}),this.Fc=()=>{u.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&&(uh.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,uh.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){uh.error(dh+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){uh.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){uh.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 uh.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;ni["__$$ph_site_app_"+i]=s._instance,null==(t=ni.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,t=>{if(t)return uh.error(dh+i,t)})};for(var a of n.siteApps)o()}else uh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},tu={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?(Si(this.Nc)&&(this.Nc=null==(t=ni.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Si(this.qc)&&(this.qc=null==(i=ni.__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=ni.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=ni.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return Xl.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 bi(t)?(bi(this.jc)?this.jc.splice(0,this.jc.length,...t):this.jc=[...t],t.length>0?this.jc:void 0):(bi(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()}}},iu=r({surveys:class extends ph{constructor(t){var i;super(new wh(t),(i=t,{get projectToken(){return i.config.token},kv:new yh(i)})),this._instance=t}Yu(t,i){var e=i.query?Fa(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})})}}},Kh),eu={toolbar:class{constructor(t){this.instance=t}zc(t){ni.ph_toolbar_state=t}Uc(){var t;return null!==(t=ni.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),ks(this.instance.config))return!1;if(!Gt||!Yt)return!1;t=null!=t?t:Gt.location,e=null!=e?e:Gt.history;try{if(!i){try{Gt.localStorage.setItem("test","test"),Gt.localStorage.removeItem("test")}catch(t){return!1}i=null==Gt?void 0:Gt.localStorage}var r,s=xh||so(t.hash,"__posthog")||so(t.hash,"state"),n=s?_s(()=>JSON.parse(atob(decodeURIComponent(s))))||_s(()=>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(Sh)||"{}")).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=ni.ph_load_toolbar||ni.ph_load_editor;!Pi(i)&&yi(i)?i(t,this.instance):kh.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==Yt||!Yt.getElementById("__POSTHOG_TOOLBAR__"));if(!Gt||i)return!1;var e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=r({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(Gt.localStorage.setItem(Sh,JSON.stringify(r({},s,{source:void 0}))),2===this.Uc())this.Wc(s);else if(0===this.Uc()){var n;this.zc(1),null==(n=ni.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",t=>{if(t)return kh.error("[Toolbar] Failed to load",t),void this.zc(0);this.zc(2),this.Wc(s)}),Ss(Gt,"turbolinks:load",()=>{this.zc(0),this.loadToolbar(s)})}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)}}},ru=r({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);ki(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(Bh);else if(!this._n.disable_web_experiments){if(Pi(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=eo(null==i?void 0:i.search,"__experiment_id"),r=eo(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!Pi(i.conditions)&&t.Xc(i,e)&&t.Yc(i)}static Xc(i,e){var r;if(Pi(i.conditions)||Pi(null==(r=i.conditions)?void 0:r.url))return!0;var s=t.getWindowLocation();if(s){var n,o,a,l=tn(e,s.href);return null==(n=i.conditions)||!n.url||Lh[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==Gt?void 0:Gt.location}static Yc(t){var i;if(Pi(t.conditions)||Pi(null==(i=t.conditions)?void 0:i.utm))return!0;var e=vo();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];ds.info("[WebExperiments] "+t,e)}Jc(i,e,r){this._is_bot()?t.Gc(Bh):"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 Jt&&this._instance?Ya(Jt,this._n.custom_blocked_useragents):void 0}}},Kh),su=r({},Kh,Jh,Yh,Xh,Zh,Qh,iu,tu,eu,ru,{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;Pi(i)||(Fi(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||ks(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==ni?void 0:ni.__PosthogExtensions__;if(t&&!Si(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(jt);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 Nh.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,Nh.info("Conversations loaded successfully")}catch(t){this.sf("Error completing conversations initialization",t)}else Nh.error("Cannot complete initialization: remote config is null")}sf(t,i){Nh.error(t,i),this._conversationsManager=null,this.ef=!1,this.if=!0}show(){this._conversationsManager?this._conversationsManager.show():Nh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.tf&&!$i(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":ks(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.rf?"remote_config_failed":Si(this.tf)?this.rf?"disabled_in_project":"remote_config_pending":this.tf?Pi(this.zt)||!this.zt.token?"missing_token":null!=ni&&ni.__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 n(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(Nh.warn(zh),null)})()}getMessages(t,i){var e=this;return n(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(Nh.warn(zh),null)})()}markAsRead(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Nh.warn(zh),null)})()}getTickets(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Nh.warn(zh),null)})()}requestRestoreLink(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Nh.warn(zh),null)})()}restoreFromToken(t){var i=this;return n(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Nh.warn(zh),null)})()}restoreFromUrlToken(){var t=this;return n(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Nh.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=vs("[logs]"),this.hf=r({},this.A,{error(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];i.some(Gh)||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),Gt&&Ss(Gt,"online",this.gf)}bf(t,i,e,r){var s,n=Uh(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new ns(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},qh);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==Gt||Gt.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;Pi(r)?this.Ff():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[P]:!!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[P])}If(){var t,i;return null==(t=this._instance)||null==t.Ma||!t.Ma()||!(null==(i=ni._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!=ni&&ni.console){var e=Uh(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})(ni.console[t])}catch(t){return 0}if(!r)return 0;i.cf.push(Yl(ni.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(ni.console,n)};return n.__rrweb_original__=r,n}))};for(var s of Hh)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){Gh(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.Js&&this.af&&!this.lf&&!this.uf){var t=null==ni?void 0:ni.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.Af();var i=t.loadExternalDependency;if(!i)return this.A.error(jt),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===vi.LogsQueue?t():void 0,setPersistedProperty(t,e){t===vi.LogsQueue&&i(null!=e?e:[])},gs:t=>this.gs(t),getLibraryId:()=>l.LIB_NAME,getLibraryVersion:()=>l.LIB_VERSION}}gs(t){return new Promise(i=>{if(no(this.Td,3))i({kind:"fatal",error:Wh(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:Wh(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:Wh(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=oo(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,l.LIB_NAME,t=>{this.Aa=t}),this.df.length>0&&this.Hf(t,this.df,this.Mf,qh,t=>{this.df=t})}Hf(t,i,e,r,s){if(0!==i.length){var n=i.map(t=>t.record);s([]);var o=ss(n,rs(e,l.LIB_NAME,l.LIB_VERSION),r,l.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,Pi(s)||(i.sessionStartTimestamp=s),Pi(n)||(i.lastActivityTimestamp=n)}if(null!=ni&&null!=(t=ni.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?tr(ni.location.href):ni.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=vs("[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 hs(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:()=>l.LIB_NAME,getLibraryVersion:()=>l.LIB_VERSION}}Fs(t,i){return new Promise(e=>{var s=!1,n=t=>{s||(s=!0,clearTimeout(o),e(t))},o=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(r({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)}}});Bl.__defaultExtensionClasses=r({},su)}()}();
2
2
  //# sourceMappingURL=default-extensions.js.map