posthog-js 1.428.7 → 1.428.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/all-external-dependencies.js.map +1 -1
  3. package/dist/array.full.es5.js +1 -1
  4. package/dist/array.full.es5.js.map +1 -1
  5. package/dist/array.full.js +1 -1
  6. package/dist/array.full.js.map +1 -1
  7. package/dist/array.full.no-external.js +1 -1
  8. package/dist/array.full.no-external.js.map +1 -1
  9. package/dist/array.js +1 -1
  10. package/dist/array.js.map +1 -1
  11. package/dist/array.no-external.js +1 -1
  12. package/dist/array.no-external.js.map +1 -1
  13. package/dist/customizations.full.js +1 -1
  14. package/dist/customizations.js +1 -1
  15. package/dist/default-extensions.js +1 -1
  16. package/dist/default-extensions.js.map +1 -1
  17. package/dist/exception-autocapture.js +1 -1
  18. package/dist/exception-autocapture.js.map +1 -1
  19. package/dist/extension-bundles.js +1 -1
  20. package/dist/extension-bundles.js.map +1 -1
  21. package/dist/lazy-recorder.js +1 -1
  22. package/dist/main.js +1 -1
  23. package/dist/main.js.map +1 -1
  24. package/dist/module.full.js +1 -1
  25. package/dist/module.full.js.map +1 -1
  26. package/dist/module.full.no-external.js +1 -1
  27. package/dist/module.full.no-external.js.map +1 -1
  28. package/dist/module.js +1 -1
  29. package/dist/module.js.map +1 -1
  30. package/dist/module.mjs +1 -1
  31. package/dist/module.mjs.map +1 -1
  32. package/dist/module.no-external.js +1 -1
  33. package/dist/module.no-external.js.map +1 -1
  34. package/dist/module.slim.js +1 -1
  35. package/dist/module.slim.no-external.js +1 -1
  36. package/dist/posthog-recorder.js +1 -1
  37. package/lib/package.json +10 -4
  38. package/package.json +14 -8
package/dist/main.js CHANGED
@@ -1,2 +1,2 @@
1
- var t,i=["retriesPerformedSoFar"],e=["$set_once","$set"];function r(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}function s(){return s=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},s.apply(null,arguments)}function n(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function o(t){return function(){var i=this,e=arguments;return new Promise(function(r,s){var o=t.apply(i,e);function a(t){n(o,r,s,a,l,"next",t)}function l(t){n(o,r,s,a,l,"throw",t)}a(void 0)})}}Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var a="0.8.2",l={DEBUG:(!1,!1),LIB_VERSION:(a,"1.428.7"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:a},h=l,u="$people_distinct_id",d="distinct_id",v="$device_id",c="$device_model",f="__alias",p="__cmpns",_="$fbc",g="$fbc_persistence",m="__timers",b="$autocapture_disabled_server_side",y="$heatmaps_enabled_server_side",w="$exception_capture_enabled_server_side",S="$error_tracking_suppression_rules",x="$error_tracking_capture_extension_exceptions",E="$web_vitals_enabled_server_side",k="$dead_clicks_enabled_server_side",T="$product_tours_enabled_server_side",P="$logs_capture_enabled_server_side",R="$web_vitals_allowed_metrics",C="$session_recording_remote_config",O="$session_recording_enabled_server_side",A="$replay_sample_rate",I="$replay_override_sampling",F="$replay_override_linked_flag",M="$replay_override_url_trigger",D="$replay_override_event_trigger",N="$sesid",L="$session_is_sampled",j="$session_past_minimum_duration",B="$session_recording_url_trigger_activated_session",U="$session_recording_event_trigger_activated_session",z="$debug_first_full_snapshot_timestamp",H="$sess_rec_flush_size",q="$enabled_feature_flags",V="$active_feature_flags",W="$early_access_features",G="$feature_flag_details",K="$feature_flag_payloads",J="$feature_flag_request_id",Y="$minimal_flag_called_events",X="$override_feature_flags",Q="$override_feature_flag_payloads",Z="$stored_person_properties",tt="$stored_group_properties",it="$groups",et="$surveys",rt="$surveys_loaded_at",st="$surveys_activated",nt="$surveys_activated_session",ot="$surveys_activated_timestamps",at="ph_product_tours",lt="$product_tours_activated",ht="$product_tours_activated_session",ut="$conversations_widget_session_id",dt="$conversations_ticket_id",vt="$conversations_widget_state",ct="$conversations_user_traits",ft="$flag_call_reported",pt="$flag_call_reported_session_id",_t="$feature_flag_errors",gt="$feature_flag_evaluated_at",mt="$user_state",bt="$client_session_props",yt="$capture_rate_limit",wt="$initial_campaign_params",St="$initial_referrer_info",xt="$initial_person_info",Et="$epp",kt="$posthog_cookieless",$t="$cookieless_mode",Tt="$sdk_debug_extensions_init_method",Pt="$sdk_debug_extensions_init_time_ms",Rt="$sdk_debug_recording_script_not_loaded",Ct="$sdk_debug_replay_event_trigger_status",Ot="$sdk_debug_replay_linked_flag_trigger_status",At="$sdk_debug_replay_matched_recording_trigger_groups",It="$sdk_debug_replay_pending_trigger_conditions",Ft="$sdk_debug_replay_remote_trigger_matching_config",Mt="$sdk_debug_replay_trigger_groups_count",Dt="$sdk_debug_replay_url_trigger_status",Nt="$session_recording_start_reason",Lt="PostHog loadExternalDependency extension not found.",jt="anonymous",Bt="identified",Ut="identified_only",zt="visibilitychange",Ht="beforeunload",qt="$pageview",Vt="$pageleave",Wt="$identify",Gt="$groupidentify",Kt="u">typeof window?window:void 0,Jt="u">typeof globalThis?globalThis:Kt,Yt=null==Jt?void 0:Jt.navigator,Xt=null==Jt?void 0:Jt.document,Qt=null==Jt?void 0:Jt.location,Zt=null==Jt?void 0:Jt.fetch,ti=null!=Jt&&Jt.XMLHttpRequest&&"withCredentials"in new Jt.XMLHttpRequest?Jt.XMLHttpRequest:void 0,ii=null==Jt?void 0:Jt.AbortController,ei=null==Jt?void 0:Jt.CompressionStream,ri=null==Yt?void 0:Yt.userAgent;function si(){return!(!Kt||!1===Kt.navigator.onLine)}var ni="undefined"!=typeof globalThis?globalThis:Kt;ni&&"undefined"==typeof self&&(ni.self=ni),ni&&"undefined"==typeof File&&(ni.File=function(){});var oi=null!=Kt?Kt:{},ai=["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"],li=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return ai.concat(i).some(t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)})};function hi(t,i){return-1!==t.indexOf(i)}var ui=function(t){return t.trim()},di=function(t){return t.replace(/^\$/,"")};function vi(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 ci=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}({}),fi=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),pi=["$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"],_i=["token"],gi=Object.prototype,mi=gi.hasOwnProperty,bi=gi.toString,yi=Array.isArray||function(t){return"[object Array]"===bi.call(t)},wi=t=>"function"==typeof t,Si=t=>t===Object(t)&&!yi(t),xi=t=>{if(Si(t)){for(var i in t)if(mi.call(t,i))return!1;return!0}return!1},Ei=t=>void 0===t,ki=t=>"[object String]"==bi.call(t),$i=t=>ki(t)&&0===t.trim().length,Ti=t=>null===t,Pi=t=>Ei(t)||Ti(t),Ri=t=>"[object Number]"==bi.call(t)&&t==t,Ci=t=>Ri(t)&&t>0,Oi=t=>"[object Boolean]"===bi.call(t),Ai=t=>hi(pi,t),Ii=t=>hi(_i,t);function Fi(t){return null===t||"object"!=typeof t}function Mi(t,i){return{}.toString.call(t)==="[object "+i+"]"}function Di(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 Li(t,Error)}}function Ni(t){return"u">typeof Event&&Li(t,Event)}function Li(t,i){try{return t instanceof i}catch(t){return!1}}var ji=[!0,"true",1,"1","yes"],Bi=t=>hi(ji,t),Ui=[!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),Ri(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 Hi=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.N=zi(t.refillInterval,0,864e5,t.A)}F(t,i){var e=Math.floor((i-t.lastAccess)/this.N);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.R),t.lastAccess=t.lastAccess+e*this.N)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.C[r];return s?this.F(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={}}},qi="Mobile",Vi="Android",Wi="Tablet",Gi="Android Tablet",Ki="iPad",Ji="Apple Watch",Yi="Safari",Xi="BlackBerry",Qi="Samsung Internet",Zi="Chrome",te="Chrome iOS",ie="Internet Explorer",ee="Internet Explorer Mobile",re="Opera",se="Microsoft Edge",ne="Firefox",oe="Firefox iOS",ae="Nintendo",le="PlayStation",he="Xbox",ue="Android Mobile",de="Mobile Safari",ve="Windows",ce="Windows Phone",fe="Nokia",pe="Ouya",_e="Generic "+qi.toLowerCase(),ge="Generic "+Wi.toLowerCase(),me="Konqueror",be="Oculus Browser",ye="Vivaldi",we="Yandex",Se="Whale",xe="DuckDuckGo",Ee="Pale Moon",ke="Waterfox",$e="Brave",Te="Claude",Pe="Codex",Re="ChatGPT",Ce="Google Search App",Oe=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ae=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ie=new RegExp(he,"i"),Fe=new RegExp("PlayStation \\w+","i"),Me=new RegExp("Nintendo \\w+","i"),De=new RegExp("BlackBerry|PlayBook|BB10","i"),Ne={"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"},Le=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?$e:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&hi(t,"GSA/")?Ce:hi(t," OPR/")&&hi(t,"Mini")?"Opera Mini":hi(t," OPR/")?re:De.test(t)?Xi:hi(t,"IEMobile")||hi(t,"WPDesktop")?ee:hi(t,"OculusBrowser")?be:hi(t,"SamsungBrowser")?Qi:hi(t,"Edge")||hi(t,"Edg/")?se:hi(t,"Vivaldi/")?ye:hi(t,"YaBrowser/")?we:hi(t,"Whale/")?Se:hi(t,"DuckDuckGo/")||hi(t,"Ddg/")?xe:hi(t,"Claude/")?Te:hi(t,"Codex/")?Pe:hi(t,"ChatGPT/")?Re:hi(t,"FBIOS")?"Facebook Mobile":hi(t,"UCWEB")||hi(t,"UCBrowser")?"UC Browser":hi(t,"CriOS")?te:hi(t,"CrMo")||hi(t,Zi)?Zi:hi(t,Vi)&&hi(t,Yi)?ue:hi(t,"FxiOS")?oe:hi(t.toLowerCase(),me.toLowerCase())?me:hi(t,"Brave/")?$e:((t,i)=>i&&hi(i,"Apple")||function(t){return hi(t,Yi)&&!hi(t,Zi)&&!hi(t,Vi)}(t))(t,i)?hi(t,qi)?de:Yi:hi(t,"PaleMoon/")?Ee:hi(t,"Waterfox/")?ke:hi(t,ne)?ne:hi(t,"MSIE")||hi(t,"Trident/")?ie:hi(t,"Gecko")?ne:"")},je={[ee]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[se]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Zi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[te]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Yi]:[Oe],[de]:[Oe],[re]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ne]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[oe]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[me]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Xi]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Oe],[ue]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Qi]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[be]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[ye]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[we]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Se]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[$e]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Te]:[Ae],[Pe]:[Ae],[Re]:[Ae],[xe]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ee]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[ke]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Ce]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ie]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Be=function(t,i,e,r){var s=je[Le(t,i,e,r)];if(Ei(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},Ue=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[he,t&&t[1]||""]],[new RegExp(ae,"i"),[ae,""]],[new RegExp(le,"i"),[le,""]],[De,[Xi,""]],[new RegExp(ve,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[ce,""];if(new RegExp(qi).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Ne[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[ve,r]}return[ve,""]}],[/((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=Ei(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Vi,[t[2],t[3],t[4]||"0"].join(".")]:[Vi,""]],[/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;Ue.length>i;i++){var e=Ue[i],r=e[1],s=e[0].exec(t),n=s&&(wi(r)?r(s,t):r);if(n)return n}return["",""]},He=function(t){return Me.test(t)?ae:Fe.test(t)?le:Ie.test(t)?he:new RegExp(pe,"i").test(t)?pe:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?ce:/iPad/.test(t)?Ki:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ji:De.test(t)?Xi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(fe,"i").test(t)?fe:/(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(qi).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)?Vi:Gi:new RegExp("(pda|Mobile)","i").test(t)?_e:new RegExp(Wi,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?ge:""},qe=/\bFBAV\/(\d+(?:\.\d+)*)/i,Ve=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",qe],[/\bFBAN\/EMA\b/i,"Facebook Lite",qe],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",qe],[/\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"]],We="[Truncated]",Ge="[Unserializable]";function Ke(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 Je,Ye,Xe,Qe=/^[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)&&Qe.test(e)?t:i();var e}function tr(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 ir(t){return t?t.split("#")[0]:t}function er(t,i){var e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function rr(t,i,e){return sr.apply(this,arguments)}function sr(){return(sr=o(function*(t,i,e){var r;try{return yield Promise.race([t,new Promise((t,s)=>{r=er(()=>{try{null==e||e(),t()}catch(t){s(t)}},i)})])}finally{clearTimeout(r)}})).apply(this,arguments)}function nr(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Xe&&e.length===Ye?Xe:(Ye=e.length,Xe=e.reduce((e,r)=>{Je||(Je={});var s=Je[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,Je[r]=[l,h];break}}return e},{}))}}var or=class{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return o(function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&yi(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t})()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),s({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return o(function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e})()}convertToExceptionList(t,i){var e,r,n,o={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,s({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:nr(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return s({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}};function ar(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 Ei(r)||(n.lineno=r),Ei(s)||(n.colno=s),n}var lr=(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]},hr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ur=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,dr=/\((\S*)(?::(\d+))(?::(\d+))\)/,vr=(t,i)=>{var e=hr.exec(t);if(e)return ar(i,e[1],"?",+e[2],+e[3]);var r=ur.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=dr.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=lr(r[1]||"?",r[2]);return ar(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},cr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,fr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,pr=(t,i)=>{var e=cr.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=fr.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=lr(n,s);return ar(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},_r=/\(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 Mi(t,"DOMException")}isDOMError(t){return Mi(t,"DOMError")}},mr=class{match(t){return Di(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}},br=class{match(t){return!!Mi(t,"ErrorEvent")&&(null!=t.error||this.an(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);var r=i.apply(t.message);return s({},r,{stack:null!==(e=this.sn(t))&&void 0!==e?e:r.stack,synthetic:!0})}an(t){return ki(t.message)&&t.message.length>0}sn(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}},yr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,wr=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(yr);return r&&(i=r[1],e=r[2]),[i,e]}},Sr=["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 Er=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(Ni(t))return t.constructor.name;var i="name"in t?t.name:void 0;return ki(i)&&!$i(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)&&!$i(t)&&Sr.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(Di(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 Ni(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}}},$r=class{match(t){return Fi(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}}},Tr=class{match(t){return Mi(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Ni(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 Fi(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",Rr="$timestamp",Cr=new Set([Pr,Rr]),Or={enabled:!0,max_bytes:32768};function Ar(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Or.enabled,max_bytes:Fr(t.max_bytes,Or.max_bytes)}:s({},Or)}var Ir=class{constructor(t){this.Gn=[],this.Zn=0,this.Rn=Ar(t)}setConfig(t){this.Rn=Ar(t),this.Jn()}add(t){var i=function(t){var i;try{i=vi(t)}catch(t){return}try{var e=JSON.parse(i);if(!Si(e))return;var r=e,s=r[Pr],n=r[Rr];if(!ki(s)||0===s.trim().length)return;if(!ki(n)&&!Ri(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.Rn.max_bytes||(this.Gn.push({step:i.step,bytes:e}),this.Zn+=e,this.Jn())}}getAttachable(){return this.Gn.map(t=>t.step)}clear(){this.Gn=[],this.Zn=0}size(){return this.Gn.length}Jn(){for(;this.Zn>this.Rn.max_bytes&&this.Gn.length>0;){var t=this.Gn.shift();t&&(this.Zn-=t.bytes)}}};function Fr(t,i){if(!Ri(t)||1/0===t||-1/0===t)return i;var e=Math.floor(t);return 0>e?i:e}var Mr=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Dr(t){return"string"==typeof t||t}function Nr(t){return"string"==typeof t?t:void 0}var Lr,jr=["$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"],Br="NativeGzipValidationError",Ur=t=>t.length>=2&&31===t[0]&&139===t[1],zr=(t,i)=>t===fi.GZipJS||i===fi.GZipJS||"gzip"===i,Hr=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),qr=t=>{throw tr(Br,"Native gzip produced invalid output: "+t)},Vr=function(){var t=o(function*(t,i){18>t.size&&qr("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());Ur(e)&&8===e[2]||qr("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(Lr)return Lr;Lr=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;Lr[t]=i>>>0}return Lr})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&qr("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&qr("invalid-size")});return function(i,e){return t.apply(this,arguments)}}();function Wr(){return Wr=o(function*(t,i,e){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),a=n.write(r).then(()=>n.close()).catch(function(){var t=o(function*(t){try{yield n.abort(t)}catch(t){}throw t});return function(i){return t.apply(this,arguments)}}()),l=new Response(s.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield Vr(h,r),h}catch(t){if(null!=e&&e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}}),Wr.apply(this,arguments)}var Gr={}.propertyIsEnumerable;function Kr(t,i){try{return Xr(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function Jr(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:We};if(e.remainingNodes--,Oi(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:Ke(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:We};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?Ke(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Jr(a.call(t),i,e,r+1)}catch(t){}return yi(t)?{arrayValue:{values:Yr(t,i,e,r+1)}}:{kvlistValue:{values:Xr(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:Ke(String(t))}}function Yr(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(Jr(a,i,e,r))}catch(t){s.push({stringValue:Ge})}return t.length>o&&s.push({stringValue:We}),s}function Xr(t,i,e,r){var s=[];for(var n in t)if(Gr.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(Ti(o)||Ei(o))continue;s.push({key:Ke(n),value:Jr(o,i,e,r)})}catch(t){s.push({key:Ke(n),value:{stringValue:Ge}})}}return s}function Qr(t,i,e){return s({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}var Zr={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var ts={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}},is=ts.info;function es(t){try{return Ke(String(t))}catch(t){return Ge}}function rs(t,i,e,r){var n,o=ts[t.level||"info"]||is,a=o.text,l=o.number,h=(void 0===(n=Ri(r)?r:void 0)&&(n=Date.now()),String(n)+"000000"),u={};i.distinctId&&(u.posthogDistinctId=i.distinctId),i.sessionId&&(u.sessionId=i.sessionId),i.windowId&&(u["window.id"]=i.windowId),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=s({},u),v=t.attributes;if(v){var c=[];try{c=Object.keys(v)}catch(t){c=[]}for(var f of c){var p=void 0;try{p=v[f]}catch(t){p=Ge}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var _={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:es(t.body)},attributes:Kr(d,e)};return t.trace_id&&(_.traceId=t.trace_id),t.span_id&&(_.spanId=t.span_id),Ei(t.trace_flags)||(_.flags=t.trace_flags),_}function ss(t,i,e){return Qr(t,i,e)}function ns(t,i,e,r){return{resourceLogs:[{resource:{attributes:Kr(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}var os=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Rn=i,this.A=e,this.Qn=r,this.Kn=s,this.Xn=n,this.Yn=o,this.ts=null,this.es=0,this.rs=0,this.ns=0,this.ss=0,this.ls=0,this.us=!1,this.hs=i.maxBufferSize,this.ds=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.vs=i.flushIntervalMs,this.cs=i.maxBatchRecordsPerPost,this.fs=i.rateCapWindowMs,this.ps=i.maxLogsPerInterval}clearQueue(){this.rs++,this._instance.setPersistedProperty(ci.LogsQueue,[])}reset(){this.gs(),this.ss=0,this.ls=0,this.us=!1,this.ns=0,this.cs=this.Rn.maxBatchRecordsPerPost}onReconnect(){this.ns=0,this.ys()}captureLog(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.bs(t);if(null!==r)if(r.body){if(this._s()){var s={record:rs(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.Qn(),this.A,null==i?void 0:i.occurredAtMs)};this.Kn(()=>this.ws(s))}}else this.A.info("Log was rejected in beforeSend function")}}bs(t){var i=this.Rn.beforeSend;if(!i)return t;var e=yi(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}_s(){if(void 0===this.ps)return!0;var t=Date.now(),i=t-this.ss;return this.fs>i&&i>=0||(this.ss=t,this.ls=0,this.us=!1),this.ps>this.ls?(this.ls++,!0):(this.us||(this.A.warn("captureLog dropping logs: exceeded "+this.ps+" logs per "+this.fs+"ms"),this.us=!0),!1)}flush(){var t=this;return o(function*(){if(!t._instance.isDisabled)return t.ts||(t.ts=t.ks().finally(()=>{t.ts=null})),t.ts})()}ks(){var t=this;return o(function*(){var i;t.gs();var e=null!==(i=t._instance.getPersistedProperty(ci.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.rs;t.es=0;var l=Math.min(e.length,t.cs),h=e.slice(0,l),u=ns(h.map(t=>t.record),t.Ss(),null!==(n=t.Yn)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.xs(u);if(t.rs!==a)return;if("too-large"===d.kind&&h.length>1)t.cs=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.cs);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.Rn.maxBatchRecordsPerPost>t.cs&&(t.cs=Math.min(t.Rn.maxBatchRecordsPerPost,t.cs+1)),yield t.Cs(h.length),e=null!==(o=t._instance.getPersistedProperty(ci.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}})()}Cs(t){var i=this;return o(function*(){var e,r=Math.max(0,t-i.es),s=null!==(e=i._instance.getPersistedProperty(ci.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(ci.LogsQueue,s.slice(r)),yield i.Xn()})()}Ss(){return ss(this.Rn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}ws(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(ci.LogsQueue))&&void 0!==i?i:[];this.ds>e.length||(e.shift(),this.es++,this.A.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(ci.LogsQueue,e),this.hs>e.length?this.Ts():this.ys()}}Ts(t){void 0===t&&(t=this.vs),this.Ms||(this.Ms=er(()=>{this.Ms=void 0,this.ys()},t))}Is(){var t=Math.min(Math.max(0,this.ns-1),6);return this.vs*Math.pow(2,t)}Es(){var t=this._instance.getPersistedProperty(ci.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return o(function*(){i.gs();var e=i.flush().catch(()=>{});void 0!==t?yield rr(e,t):yield e})()}flushWithTimeout(t){var i=this;return o(function*(){var e=i.flush();yield rr(e,t,()=>{e.catch(()=>{})})})()}ys(){this.flush().then(()=>{this.ns=0},t=>{this.ns++,this.A.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.Es()&&this.Ts(this.Is())})}gs(){this.Ms&&(clearTimeout(this.Ms),this.Ms=void 0)}},as=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ls(t){return String(t)+"000000"}function hs(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 us=class{constructor(t,i,e){this._instance=t,this.Rn=i,this.A=e,this.Rs=new Map,this.ts=null,this.As=!1,this.Ps=new Map,this.Fs=new Set,this.Os=0}count(t,i,e){void 0===i&&(i=1),this.$s({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.$s({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.$s({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.ts,e=function(){var e=o(function*(){i&&(yield i.catch(()=>{})),yield t.Ds()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.ts===e&&(this.ts=null)});return this.ts=e,e}drainWindow(){if(0===this.Rs.size)return null;var t=this.Rs;return this.Rs=new Map,this.As=!1,this.Ps=new Map,this.Fs=new Set,this.Ls(t)}reset(){this.Os++,this.gs(),this.Rs=new Map,this.ts=null,this.As=!1,this.Ps=new Map,this.Fs=new Set}$s(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.bs(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.A.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var e,r;try{e=i.attributes?s({},i.attributes):void 0,r=hs(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.Rs.get(r);if(!n){if(!this.Ns())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Rs.set(r,n)}var o=this.Ps.get(i.name);void 0===o?this.Ps.set(i.name,i.type):o===i.type||this.Fs.has(i.name)||(this.Fs.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.qs(n,i.value),this.Ts()}else this.A.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}Ns(){return this.Rn.maxSeriesPerFlush>this.Rs.size||(this.As||(this.As=!0,this.A.warn("Metric series cap reached ("+this.Rn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}qs(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(as.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,as)]+=1}}bs(t){var i=this.Rn.beforeSend;if(!i)return t;var e=yi(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}Ts(){this.Ms||(this.Ms=er(()=>{this.Ms=void 0,this.flush().catch(t=>{this.A.error("Metrics flush failed:",t)})},this.Rn.flushIntervalMs))}gs(){this.Ms&&(clearTimeout(this.Ms),this.Ms=void 0)}Ds(){var t=this;return o(function*(){if(0!==t.Rs.size){var i=t.Rs;t.Rs=new Map,t.As=!1,t.Ps=new Map,t.Fs=new Set;var e=t.Os,r=yield t._instance.js(t.Ls(i));if(e===t.Os)switch(r.kind){case"ok":return;case"retry-later":return t.Bs(i),void t.Ts();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)}}})()}Ls(t){return i=this.Hs(t),e=function(t,i,e){return Qr(t,i,e)}(this.Rn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Kr(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}Hs(t){var i=ls(Date.now()),e=new Map;for(var r of t.values()){var n,o=hs(r.type,r.name,r.unit,void 0),a=e.get(o);a||(a=s({name:r.name},r.unit&&{unit:r.unit}),"count"===r.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===r.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},e.set(o,a));var l=Kr(null!==(n=r.attributes)&&void 0!==n?n:{},this.A),h=ls(r.windowStartMs);if("count"===r.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:i,asDouble:null!==(u=r.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===r.type){var v,c={attributes:l,timeUnixNano:i,asDouble:null!==(v=r.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else r.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:i,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:as})}return Array.from(e.values())}Bs(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.Rs.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.Ns()&&this.Rs.set(s,n)}}},ds=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];Kt&&(l.DEBUG||Kt.POSTHOG_DEBUG||e)&&!Ei(Kt.console)&&Kt.console&&("__rrweb_original__"in Kt.console[i]?Kt.console[i].__rrweb_original__:Kt.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)=>ds(t+" "+i,e)};return r},vs=ds("[PostHog.js]"),cs=vs.createLogger;function fs(t,i){yi(t)&&t.forEach(i)}function ps(t,i){if(!Pi(t))if(yi(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(var e in t)mi.call(t,e)&&i(t[e],e)}var _s=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 ms=function(t){try{return t()}catch(t){return}},bs=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){vs.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),vs.critical(t)}}},ys=function(t){var i={};return ps(t,function(t,e){(ki(t)&&t.length>0||Ri(t))&&(i[e]=t)}),i};function ws(t){var i=s({},t);for(var e of["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e])}catch(t){}return i}var Ss=["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 Ss)if(e===r)return!1;return!0}function Es(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 $s=t=>{if(Xt){try{for(var i=t+"=",e=Xt.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 Ri(t)&&isFinite(t)&&Math.floor(t)===t});var Ts=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(!Ei(t))return t;this.Ct=0;var i=this.generateOrAbort();if(Ei(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t,i=(t=Date.now(),Ri(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0);if(i>this.Ct)this.Ct=i,this.Mt();else{if(this.Ct>=i+1e4)return;this.Tt++,this.Tt>4398046511103&&(this.Ct++,this.Mt())}return Ts.fromFieldsV7(this.Ct,Math.trunc(this.Tt/Math.pow(2,30)),this.Tt&Math.pow(2,30)-1,this.It.nextUint32())}Mt(){this.Tt=1024*this.It.nextUint32()+(1023&this.It.nextUint32())}constructor(){this.Ct=0,this.Tt=0,this.It=new Os}},Rs=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};Kt&&!Ei(Kt.crypto)&&crypto.getRandomValues&&(Rs=t=>crypto.getRandomValues(t));var Cs,Os=class{nextUint32(){return this.Rt.length>this.At||(Rs(this.Rt),this.At=0),this.Rt[this.At++]}constructor(){this.Rt=new Uint32Array(8),this.At=1/0}},As=()=>Is().toString(),Is=()=>(Cs||(Cs=new Ps)).generate(),Fs="",Ms=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Ds=null,Ns={Et(){if(!Ti(Ds))return Ds;if(Ds=!1,Xt)try{var t="__ph_cookie_support_"+As();Ns.Ot(t,"xyz"),Ds='"xyz"'===$s(t),Ns.Dt(t)}catch(t){Ds=!1}return Ds},Pt(t){vs.error("cookieStore error: "+t)},Lt:$s,Nt(t){var i;try{i=JSON.parse(Ns.Lt(t))||{}}catch(t){}return i},Ot(t,i,e,r,s){if(!Xt)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=Xt),Fs)return Fs;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();!Fs&&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",Fs=n)}return Fs}(t);if(!e){var r=(t=>{var i=t.match(Ms);return i?i[0]:""})(t);r!==e&&vs.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(Xt.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&&vs.warn("cookieStore warning: large cookie, len="+h.length),Xt.cookie=h,!0}catch(t){return!1}},Dt(t,i){if(null!=Xt&&Xt.cookie)try{Ns.Ot(t,"",-1,i)}catch(t){return}}},Ls=null,js={Et(){if(!Ti(Ls))return Ls;var t=!0;if(Ei(Kt))t=!1;else try{var i="__mplssupport__";js.Ot(i,"xyz"),'"xyz"'!==js.Lt(i)&&(t=!1),js.Dt(i)}catch(i){t=!1}return t||vs.error("localStorage unsupported; falling back to cookie store"),Ls=t,t},Pt(t){vs.error("localStorage error: "+t)},Lt(t){try{return null==Kt?void 0:Kt.localStorage.getItem(t)}catch(t){js.Pt(t)}return null},Nt(t){try{return JSON.parse(js.Lt(t))||{}}catch(t){}return null},Ot(t,i){try{return null==Kt||Kt.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){js.Pt(t)}return!1},Dt(t){try{null==Kt||Kt.localStorage.removeItem(t)}catch(t){js.Pt(t)}}},Bs=[Z,V,q,G,K,J,gt,_t,ft],Us=[v,d,N,L,Et,xt,g,mt],zs=t=>t+"_cpm",Hs=["__proto__","constructor","prototype"],qs=t=>{if(!Si(t))return{};var i={};return Object.keys(t).forEach(e=>{-1===Hs.indexOf(e)&&(i[e]=t[e])}),i},Vs=function(t,i){void 0===i&&(i=[]);var e={};return[...Us,...i].forEach(i=>{var r=t[i];Ei(r)||Ti(r)||""===r||(e[i]=r)}),e},Ws=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)},Gs=(t,i)=>({p:i,f:Ws(JSON.stringify(t))}),Ks=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=Ns.Nt(zs(t)),r=(null==e?void 0:e.f)===Ws(i)&&yi(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Js=(t,i)=>i+"|"+(Ns.Lt(zs(t))||""),Ys={},Xs={Et:()=>!0,Pt(t){vs.error("memoryStorage error: "+t)},Lt:t=>t in Ys?Ys[t]:null,Nt:t=>t in Ys?Ys[t]:null,Ot:(t,i)=>(Ys[t]=i,!0),Dt(t){delete Ys[t]}},Qs=null,Zs={Et(){if(!Ti(Qs))return Qs;if(Qs=!0,Ei(Kt))Qs=!1;else try{var t="__support__";Zs.Ot(t,"xyz"),'"xyz"'!==Zs.Lt(t)&&(Qs=!1),Zs.Dt(t)}catch(t){Qs=!1}return Qs},Pt(t){vs.error("sessionStorage error: ",t)},Lt(t){try{return null==Kt?void 0:Kt.sessionStorage.getItem(t)}catch(t){Zs.Pt(t)}return null},Nt(t){try{return JSON.parse(Zs.Lt(t))||null}catch(t){}return null},Ot(t,i){try{return null==Kt||Kt.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Zs.Pt(t)}return!1},Dt(t){try{null==Kt||Kt.sessionStorage.removeItem(t)}catch(t){Zs.Pt(t)}}},tn=class{constructor(t){this._instance=t}get Rn(){return this._instance.config}get consent(){return this.vo()?0:this.co}isOptedOut(){return"always"===this.Rn.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Rn.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Rn.opt_out_capturing_by_default}optInOut(t){this.fo.Ot(this.po,t?1:0,this.Rn.cookie_expiration,this.Rn.cross_subdomain_cookie,this.Rn.secure_cookie)}reset(){this.fo.Dt(this.po,this.Rn.cross_subdomain_cookie)}get po(){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 co(){var t=this.fo.Lt(this.po);return Bi(t)?1:hi(Ui,t)?0:-1}get fo(){var t=this.Rn.opt_out_capturing_persistence_type,i="localStorage"===t?js:Ns,e=i.Et()?i:Xs;if(!this.mo||this.mo!==e){this.mo=e;var r="localStorage"===t?Ns:js;r.Lt(this.po)&&(this.mo.Lt(this.po)||this.optInOut(Bi(r.Lt(this.po))),r.Dt(this.po,this.Rn.cross_subdomain_cookie))}return this.mo}vo(){return!!this.Rn.respect_dnt&&[null==Yt?void 0:Yt.doNotTrack,null==Yt?void 0:Yt.msDoNotTrack,oi.doNotTrack,null==Yt?void 0:Yt.globalPrivacyControl].some(t=>Bi(t))}};function en(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!wi(r))return i;try{var s=r(i);return ki(s)&&s?s:i}catch(t){return vs.error("Error in get_current_url, falling back to window.location.href",t),i}}function rn(t){return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function sn(t){return!!t&&1===t.nodeType}function nn(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function on(t){return!!t&&3===t.nodeType}function an(t){return!!t&&11===t.nodeType&&sn(t.host)}function ln(t){return t?ui(t).split(/\s+/):[]}function hn(t,i){var e=function(t){var i,e=null==Kt||null==(i=Kt.location)?void 0:i.href;return Ei(e)?void 0:en(t,e)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function un(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 ln(i)}function dn(t){return Pi(t)?null:ui(t).split(/(\s+)/).filter(t=>Dn(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function vn(t){var i="";return Tn(t)&&!Pn(t)&&t.childNodes&&t.childNodes.length&&ps(t.childNodes,function(t){var e;on(t)&&t.textContent&&(i+=null!==(e=dn(t.textContent))&&void 0!==e?e:"")}),ui(i)}function cn(t){var i;return Ei(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var fn=["a","button","form","input","select","textarea","label"];function pn(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 _n(t,i){if(Ei(i))return!0;var e,r=function(t){if(i.some(i=>pn(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||!sn(i))&&i}var mn=[".ph-no-autocapture","[data-ph-no-autocapture]"],bn=["next","previous","prev",">","<"],yn=[...bn,"+","-","−","–"],wn=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,Sn=[".ph-no-rageclick",".ph-no-capture"],xn=["","text","search","email","password","url","tel","number"];function En(t,i){if(!Kt||kn(t))return!1;var e,r,s,n,o;if(Oi(i)?(e=!!i&&Sn,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:Sn,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||!sn(t))&&(!!nn(t,"textarea")||(nn(t,"input")?hi(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=$n(t,!1).targetElementList;return!function(t,i){if(!1===t||Ei(t))return!1;var e;if(!0===t)e=bn;else{if(!yi(t))return!1;if(t.length>10)return vs.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=>wn(i,t)||wn(r,t))})}(r,a.map(t=>{var i;return{safeText:vn(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}}))&&!_n(a,e)}var kn=t=>!t||nn(t,"html")||!sn(t),$n=(t,i)=>{if(!Kt||kn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!nn(s,"body");)if(an(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=gn(s);if(!n)break;if(i||fn.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var o=Kt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function Tn(t){for(var i=new Set,e=0,r=t;r.parentNode&&!nn(r,"body");r=r.parentNode){if(e++>=1e3||i.has(r))return!1;i.add(r);var s=un(r);if(hi(s,"ph-sensitive")||hi(s,"ph-no-capture"))return!1}if(hi(un(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!!(nn(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||nn(t,"select")||nn(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Rn=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,On=[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"),Fn=/[0-9A-Za-z_]/;function Mn(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 Dn(t,i){if(void 0===i&&(i=!0),Pi(t))return!1;if(ki(t)){if(t=ui(t),i?Rn.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 On){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(Rn.test(a)&&Mn(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&&Fn.test(e)&&Fn.test(r)))return!0}return!1}(t))return!1}return!0}function Nn(t){var i=vn(t);return Dn(i=(i+" "+Ln(t)).trim())?i:""}function Ln(t){var i="";return t&&t.childNodes&&t.childNodes.length&&ps(t.childNodes,function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=vn(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Ln(t)).trim())}catch(t){vs.error("[AutoCapture]",t)}}),i}function jn(t){return t.replace(/"|\\"/g,'\\"')}function Bn(t){var i=t.attr__class;if(i)return yi(i)?i:ln(i)}var Un=cs("[Dead Clicks]"),zn=()=>!0,Hn=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(k)),r=t.instance.config.capture_dead_clicks;return Oi(r)?r:!!Si(r)||e},qn=class{get lazyLoadedDeadClicksAutocapture(){return this.yo}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.bo(()=>{this._o()}):this.stop()}bo(t){var i,e;null!=(i=oi.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=oi.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?Un.error("failed to load script",i):t()})}_o(){var t;if(Xt){if(!this.yo&&null!=(t=oi.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=Si(this.instance.config.capture_dead_clicks)?s({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.yo=oi.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.yo.start(Xt),Un.info("starting...")}}else Un.error("`document` not found. Cannot start.")}stop(){this.yo&&(this.yo.stop(),this.yo=void 0,Un.info("stopping..."))}},Vn=cs("[SegmentIntegration]");function Wn(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(mt,Bt)),i(e?void 0:r.anonymousId()||void 0)},n=r.user();"then"in n&&wi(n.then)?n.then(s):s(n)}(t,e=>{r.register(((t,i)=>{"undefined"!=typeof Promise&&Promise.resolve||Vn.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()||(Vn.info("No userId set, resetting PostHog"),t.reset()),s||(i=void 0),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(Vn.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,qt)},identify(t){return e(t,Wt)},screen(t){return e(t,"$screen")}}})(t,e)).then(()=>{i()},t=>{Vn.error("Failed to register the Segment integration",t),i()})},e)}var Gn="posthog-js";function Kn(t,i){var e=void 0===i?{}:i,r=e.organization,n=e.projectId,o=e.prefix,a=e.severityAllowList,l=void 0===a?["error"]:a,h=e.sendExceptionsToPostHog,u=void 0===h||h;return i=>{var e,a,h,d,v,c;if("*"!==l&&!l.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var f=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=f,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p=(null==(e=i.exception)?void 0:e.values)||[],_=p.map(t=>s({},t,{stacktrace:t.stacktrace?s({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>s({},t,{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null==(a=p[0])?void 0:a.value)||i.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:i.level,$exception_list:_,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||i.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:i.tags};return r&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+n+"&query="+i.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),i}}var Jn=class{constructor(t,i,e,r,s,n){this.name=Gn,this.setupOnce=function(o){o(Kn(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},Yn=class{constructor(t){this.wo=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(vs.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.ko=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.So()}So(){var t;this.xo=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.wo)}destroy(){var t;null==(t=this.xo)||t.call(this),this.xo=void 0}doPageView(t,i){var e,r=this.Co(t,i);return this.ko={pathname:null!==(e=null==Kt?void 0:Kt.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.Co(t,null==(i=this.ko)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ko)?void 0:t.pageViewId}}Co(t,i){var e=this.ko;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(!(Ei(n)||Ei(o)||Ei(a)||Ei(l)||Ei(h)||Ei(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,vs):1,v=n>1?zi(a/n,0,1,vs):1,c=l>1?zi(h/l,0,1,vs):1,f=l>1?zi(u/l,0,1,vs):1;r=_s(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}},Xn=["flags","surveys"],Qn={[u]:{exposure:"hidden"},[f]:{exposure:"hidden"},[p]:{exposure:"hidden"},[m]:{exposure:"hidden"},[g]:{exposure:"hidden"},[b]:{exposure:"event"},[y]:{exposure:"hidden"},[P]:{exposure:"hidden"},[w]:{exposure:"event"},[S]:{exposure:"hidden"},[x]:{exposure:"event"},[E]:{exposure:"event"},[k]:{exposure:"event"},[T]:{exposure:"hidden"},[R]:{exposure:"event"},[C]:{exposure:"hidden"},[O]:{exposure:"hidden"},[N]:{exposure:"hidden"},[L]:{exposure:"event"},[A]:{exposure:"event",shouldSkipFromEventProperties:t=>Ti(t)},[j]:{exposure:"event"},[B]:{exposure:"event"},[U]:{exposure:"event"},[z]:{exposure:"event"},[H]:{exposure:"hidden"},[q]:{exposure:"hidden",storageGroup:"flags"},[V]:{exposure:"hidden",storageGroup:"flags"},[W]:{exposure:"hidden"},[G]:{exposure:"hidden",storageGroup:"flags"},[K]:{exposure:"hidden",storageGroup:"flags"},[J]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Y]:{exposure:"hidden",storageGroup:"flags"},[X]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[et]:{exposure:"hidden",storageGroup:"surveys"},[rt]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[st]:{exposure:"event"},[nt]:{exposure:"hidden"},[ot]:{exposure:"hidden"},[at]:{exposure:"hidden"},[lt]:{exposure:"hidden"},[ht]:{exposure:"hidden"},[ut]:{exposure:"event"},[dt]:{exposure:"event"},[vt]:{exposure:"event"},[ct]:{exposure:"event"},[ft]:{exposure:"hidden"},[pt]:{exposure:"hidden"},[it]:{exposure:"event"},[_t]:{exposure:"hidden"},[gt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[mt]:{exposure:"hidden"},[bt]:{exposure:"hidden"},[yt]:{exposure:"hidden"},[wt]:{exposure:"hidden"},[St]:{exposure:"hidden"},[xt]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[I]:{exposure:"event"},[F]:{exposure:"event"},[M]:{exposure:"event"},[D]:{exposure:"event"},[Tt]:{exposure:"event"},[Pt]:{exposure:"event"},[Rt]:{exposure:"event"},[Ct]:{exposure:"event"},[Ot]:{exposure:"event"},[At]:{exposure:"event"},[It]:{exposure:"event"},[Ft]:{exposure:"event"},[Mt]:{exposure:"event"},[Dt]:{exposure:"event"},[Nt]:{exposure:"event"}},Zn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],to=t=>{var i=Qn[t];if(i)return i;for(var e of Zn){var r=e[1];if(0===t.indexOf(e[0]))return r}},io=(t,i)=>{try{var e;return JSON.stringify(t,(t,i)=>Di(i)?(null!=e||(e=new WeakMap),e.has(i)||e.set(i,ws(i)),e.get(i)):"bigint"==typeof i?i.toString():i,i)}catch(i){return vi(t)}},eo=t=>{var i=null==Xt?void 0:Xt.createElement("a");return Ei(i)?null:(i.href=t,i)},ro=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(!yi(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){vs.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},so=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("=");yi(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},no=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},oo=(t,i)=>t>=i&&si(),ao=(t,i,e,r)=>{if(0===t){if(si()){var s=i+1;return s===e&&r(),s}return i}return 0},lo=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ho=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...lo],uo="<masked>",vo=["li_fat_id"];function co(t,i,e){if(!Xt)return{};var r,s=i?[...lo,...e||[]]:[],n=fo(so(Xt.URL,s,uo),t);return _s((r={},ps(vo,function(t){var i=$s(t);r[t]=i||null}),r),n)}function fo(t,i){var e=ho.concat(i||[]),r={};return ps(e,function(i){var e=ro(t,i);r[i]=e||null}),r}function po(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(!Ti(i)){r.$search_engine=i;var s=Xt?ro(Xt.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function _o(){return navigator.language||navigator.userLanguage}var go="$direct";function mo(){return(null==Xt?void 0:Xt.referrer)||go}function bo(t,i,e){var r;void 0===e&&(e=!1);var s=t?[...lo,...i||[]]:[],n=null==(r=e?ir(null==Qt?void 0:Qt.href):null==Qt?void 0:Qt.href)?void 0:r.substring(0,1e3);return{r:mo().substring(0,1e3),u:n?so(n,s,uo):void 0}}function yo(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?ir(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==go?go:null==(e=eo(r))?void 0:e.host};if(n){o.$current_url=n;var a=eo(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,_s(o,fo(n))}return r&&_s(o,po(r)),o}function wo(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function So(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var xo={flags:gt,surveys:rt},Eo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ko=t=>t+"_cookie_identity_change_pending",$o=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},To="main",Po=[q,V,G,K,J,gt,Y,Z],Ro=t=>-1!==Po.indexOf(t),Co=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},Oo=t=>{if(!t)return{};var i=JSON.parse(t);return Si(i)?i:{}},Ao=(t,i)=>{ps(t,(e,r)=>{var s=to(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.To={},this.Mo=!1,this.Io=!1,this.Eo=!1,this.Ro=!1,this.Ao=!1,this.Po=new Map,this.Fo=!1,this.Oo=!1,this.$o=!1,this.Do=!1,this.Lo=new Set,this.Rn=t,this.No=e,this.props={},this.qo=void 0,this.jo=(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.fo=this.Bo(t),this.Eo=this.Ho(t),this.load(),this.zo(),t.debug&&vs.info("Persistence loaded",t.persistence,s({},this.props)),this.update_config(t,t,i),this.save(),Kt){var r=()=>this.flush();Es(Kt,"beforeunload",r,{capture:!1}),Es(Kt,"pagehide",r,{capture:!1}),this.Uo=t=>{if(this.Mo&&(!t.storageArea||t.storageArea===(null==Kt?void 0:Kt.localStorage))&&t.key)if(t.key!==this.jo){if(this.Eo){var i=Xn.find(i=>t.key===this.Wo(i));i&&this.Vo(t.key,i)}}else this.Vo(t.key,To)},Es(Kt,"storage",this.Uo)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var i=t[0],e=t[1],r=this.Po.get(i);if(Ro(i)&&!0!==r)if(!0!==e){var s=new Set(r||[]);e.forEach(t=>s.add(t)),s.size&&this.Go(i,s)}else this.Go(i,!0)})}onCrossTabFeatureFlagChange(t){return this.Lo.add(t),()=>this.Lo.delete(t)}destroy(){this.Uo&&Kt&&(Kt.removeEventListener("storage",this.Uo),this.Uo=void 0),this.Lo.clear()}Vo(t,i,e){if(void 0===e&&(e=!0),this.gi)return!1;var r,s;try{if(s=js.Lt(t),Ti(s)){var n=this.Zo(i);return n.storageValue=null,i!==To&&(n.persisted=!1),!1}r=Oo(s)}catch(t){return!1}var o=i===To?r:js.Nt(this.jo);if(o&&this.Jo(o))return!1;var a=this.Qo(r,i,e);return i===To&&this.Eo&&!Co(this.Ko().main,r)||this.Xo(r,i,!0,s),a}Jo(t){var i=this.props[d],e=t[d];return!Ei(i)&&!Ei(e)&&i!==e}Xo(t,i,e,r){var s=this.Zo(i);s.storageValue=r,i!==To&&(s.persisted=e);try{s.fingerprint=this.Yo(t,i)}catch(t){s.fingerprint=void 0}}Qo(t,i,e){var r=!1;return Po.forEach(e=>{var s,n=null==(s=to(e))?void 0:s.storageGroup;if(!(i===To&&this.Eo&&n||i!==To&&n!==i)){var o=e in t,a=this.ta(e,o?t[e]:void 0),l=this.Po.has(e)?e in this.props:o;l===e in this.props&&Co(a,this.props[e])||(l?this.ea(e,a,!1):this.ia(e,!1),r=!0)}}),r&&e&&this.Lo.forEach(t=>t()),r}ra(){if(!this.Mo)return!1;try{this.$o=!1;var t,i=js.Lt(this.jo),e=this.Zo(To),r=!1,s=!1;if(i!==e.storageValue)if(Ti(i))e.storageValue=null;else{if(t=Oo(i),this.$o=!this.Oo&&this.Jo(t),this.$o)return!1;s=this.Qo(t,To,!1),!this.Eo||Co(this.Ko().main,t)?this.Xo(t,To,!0,i):e.storageValue=i,r=!0}return this.Eo&&Xn.forEach(i=>{var e=js.Lt(this.Wo(i)),n=this.Zo(i),o=t||{},a=r&&Po.some(t=>{var e;return(null==(e=to(t))?void 0:e.storageGroup)===i&&t in o});if(e!==n.storageValue||a){if(Ti(e))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Qo(o,i,!1)||s));var l=Oo(e);s=this.Qo(l,i,!1)||s,this.Xo(l,i,!0,e)}}),s}catch(t){return!1}}Go(t,i){this.Po.set(t,i);var e=to(t);null!=e&&e.volatile||(this.Zo((this.Eo?null==e?void 0:e.storageGroup:void 0)||To).fingerprint=void 0,this.na(t))}sa(){Po.forEach(t=>this.Po.set(t,!0))}zo(){if(this.Mo)try{var t=js.Lt(this.jo),i=Oo(t);this.Zo(To).storageValue=t,Po.forEach(t=>{var e,r=this.Eo?null==(e=to(t))?void 0:e.storageGroup:void 0,s=r?js.Lt(this.Wo(r)):null;if(r){var n=this.Zo(r);n.storageValue=s,n.persisted=!Ti(s)}var o=r&&!Ti(s)?Oo(s):i;t in this.props?this.oa(t,o[t],this.props[t]):t in o&&this.Go(t,!0)})}catch(t){}}ta(t,i){var e=this.Po.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){var r=new Set(yi(i)?i:[]),n=new Set(yi(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?r.add(t):r.delete(t)),Array.from(r)}var o=Si(i)?s({},i):{},a=Si(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in a?o[t]=a[t]:delete o[t]}),o}oa(t,i,e){if(Ro(t)){var r=this.Po.get(t);if(!0!==r){var s=i;if(this.Mo)try{var n,o=this.Eo?null==(n=to(t))?void 0:n.storageGroup:void 0,a=o?this.Wo(o):this.jo;s=Oo(js.Lt(a))[t]}catch(t){}var l=new Set(r||[]);if("$active_feature_flags"===t){if(!Ei(i)&&!yi(i)||!Ei(s)&&!yi(s)||!yi(e))return void this.Go(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(!Si(e))return void(Co(s,e)?this.Po.delete(t):this.Go(t,!0));if(!Ei(i)&&!Si(i)||Ei(i)&&xi(e)&&Ei(s))return void this.Go(t,!0);var v=Si(i)?i:{},c=Si(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.Go(t,l):this.Po.delete(t)}}}aa(){var t,i=null==(t=this.Rn)?void 0:t.persistence_save_debounce_ms;return Ri(i)&&i>0?i:0}la(t){if(this.Rn.cookieWinsOnConflict&&"localstorage+cookie"===this.Rn.persistence.toLowerCase())if(t)try{var i=Vs(t,this.Rn.cookie_persisted_properties||[]),e=Gs(i,this.Rn.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=Ns.Lt(this.jo)||void 0;s&&Js(this.jo,s)===r&&(this.ua=r,this.ha=s)}catch(t){}else try{var n=Ns.Lt(this.jo)||void 0;this.ua=n?Js(this.jo,n):void 0,this.ha=n}catch(t){}}syncCookieProperties(){return this.da(this.Rn)}da(t,i){if(void 0===i&&(i=!1),this.gi&&!i||this.Ao||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=Ns.Lt(this.jo)||void 0}catch(t){}if(!e||e===this.ha)return!1;var r,s=Js(this.jo,e);try{r=qs(JSON.parse(e))}catch(t){return!1}if((Ns.Lt(this.jo)||void 0)!==e)return!1;this.ua=s,this.ha=e;var n=Ks(this.jo,e),o=[...Us,...n.properties],a={};if(Object.keys(r).forEach(t=>{var i=r[t];(Ei(i)||Ti(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,u=h[d],v=h[mt],c=_s({},h);[...Us,...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=c[t];(n.isValid||-1===Us.indexOf(t)||!1!==i&&0!==i)&&delete c[t]}}),this.props=_s(c,r),Po.forEach(t=>{var i=t in this.props;t in h===i&&Co(h[t],this.props[t])||(i?this.oa(t,h[t],this.props[t]):this.Go(t,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this.ea(mt,jt);var p=this.props[d],_=this.props[mt];return!l||p===u&&_===v||(this.Oo=!0,this.Ro=!0,Zs.Ot(ko(this.jo),!0),this.ia(Z),this.ia(V),this.ia(q),this.ia(G),this.ia(K),this.ia(J),this.ia(gt),this.ia(_t),this.ia(ft),"anonymous"!==_||"identified"!==v&&"anonymous"!==r.$user_state&&(Ei(u)||p===u)||(Ao(this.props,r),this.ia(tt)),"identified"===_?this.props.$user_id=p:delete this.props.$user_id,this.ia(f)),!0}consumeCookieIdentityChange(){var t=ko(this.jo),i=this.Ro||!!Zs.Lt(t);return this.Ro=!1,i&&Zs.Dt(t),i}va(t){return void 0===t&&(t=!1),!(this.Ao||this.gi&&!t||!this.Rn.cookieWinsOnConflict||"localstorage+cookie"!==this.Rn.persistence.toLowerCase()||(this.Ao=!0,0))}ca(){this.Ao&&(Ei(this.fa)||(clearTimeout(this.fa),this.fa=void 0),delete this.To[To],this.pa(!0))}ga(t){if(void 0===t&&(t=!0),this.Ao)try{t?this.ca():Ei(this.fa)||(clearTimeout(this.fa),this.fa=void 0)}finally{this.Ao=!1}}isDisabled(){return!!this.gi}Bo(t){-1===Eo.indexOf(t.persistence.toLowerCase())&&(vs.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=[...Us,...t];return s({},js,{Nt(t){try{var r,s={};try{r=Ns.Lt(t)||void 0,s=r?qs(JSON.parse(r)):{}}catch(t){}var n,o=JSON.parse(js.Lt(t)||"{}");if(i){var a=Ks(t,r),l=[...Us,...a.properties],h={};Object.keys(s).forEach(t=>{var i=s[t];Ti(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(h[t]=i)});var u="distinct_id"in h||"anonymous"===h.$user_state||"identified"===h.$user_state;if(Object.keys(h).length>0){var v,c=o[d],f=null!==(v=o.$user_state)&&void 0!==v?v:"anonymous";e.forEach(t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(u||"distinct_id"!==t&&"$user_state"!==t)){var i=o[t];(a.isValid||-1===Us.indexOf(t)||!1!==i&&0!==i)&&delete o[t]}}),!u||"$user_state"in s||"$user_state"in o||(o[mt]=jt),!u||("distinct_id"in h?h[d]:o[d])===c&&("$user_state"in h?h[mt]:o[mt])===f||(Bs.forEach(t=>delete o[t]),"identified"===h.$user_state&&"distinct_id"in h?o.$user_id=h[d]:delete o.$user_id,"identified"!==h.$user_state&&(delete o[it],delete o[tt]),delete o.__alias)}n=_s(o,h)}else n=_s(s,o);return js.Ot(t,n),n}catch(t){}return null},Ot(e,r,s,n,o,a){var l=js.Ot(e,r,void 0,void 0,a);try{var h=Vs(r,t);if(Object.keys(h).length){if(i){var u=zs(e),d=Gs(h,t);if(Ns.Ot(u,d,s,n,o,a),Ns.Lt(u)!==JSON.stringify(d)){Ns.Dt(u,n);var v=Vs(r);return Ns.Ot(e,v,s,n,o,a),l}}Ns.Ot(e,h,s,n,o,a)}}catch(t){js.Pt(t)}return l},Dt(t,i){try{null==Kt||Kt.localStorage.removeItem(t),Ns.Dt(t,i),Ns.Dt(zs(t),i)}catch(t){js.Pt(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),r=!1,n=!1,o=t.persistence.toLowerCase();return"localstorage"===o&&js.Et()?(i=js,n=!0):"localstorage+cookie"===o&&e.Et()?(i=e,n=!0,r=!0):"sessionstorage"===o&&Zs.Et()?i=Zs:"memory"===o?i=Xs:"cookie"===o&&Ns.Et()?(i=Ns,r=!0):e.Et()?(i=e,n=!0,r=!0):Ns.Et()?(i=Ns,r=!0):i=Xs,this.Mo=n,this.Io=r,i}Wo(t){return this.jo+"__"+t}Ho(t){return this.Mo&&!!t.split_storage}properties(){var t={};return ps(this.props,(i,e)=>{var r=to(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.gi||t){var i=this.Rn.cookieWinsOnConflict&&"localstorage+cookie"===this.Rn.persistence.toLowerCase(),e=i?js.Nt(this.jo):null,r={};if(i)try{ps(r=qs(Ns.Nt(this.jo)),(t,i)=>{(Ei(t)||Ti(t)||""===t)&&delete r[i]})}catch(t){}var s=this.fo.Nt(this.jo);if(s&&(this.props=_s({},s)),this.Eo&&this.ma(),i&&s){var n,o,a=null==e?void 0:e[d],l=null!==(n=null==e?void 0:e.$user_state)&&void 0!==n?n:"anonymous",h=s[d],u=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(h!==a||u!==l){this.Ro=!0,Zs.Ot(ko(this.jo),!0);var v=_s({},this.props);Bs.forEach(t=>delete v[t]),"anonymous"!==u||"identified"!==l&&"anonymous"!==r.$user_state&&(Ei(a)||h===a)||(Ao(v,r),delete v[tt]),this.props=v;var c=new Set;Bs.forEach(t=>{var i,e=null==(i=to(t))?void 0:i.storageGroup;e&&c.add(e)}),c.forEach(t=>{var i={};ps(this.props,(e,r)=>{var s;(null==(s=to(r))?void 0:s.storageGroup)===t&&(i[r]=e)}),xi(i)?(js.Dt(this.Wo(t)),this.To[t]={}):js.Ot(this.Wo(t),i)&&(this.To[t]={persisted:!0,fingerprint:this.Yo(i,t)})})}}Zs.Lt(ko(this.jo))&&(this.Ro=!0)}}ma(){for(var t of Xn){var i=js.Nt(this.Wo(t));if(i&&!xi(i)){var e=this.Zo(t);e.persisted=!0,this.ya(t)||(e.fingerprint=this.Yo(i,t)),this.ba(t,i)||_s(this.props,i)}}}ya(t){return Object.keys(this.props).some(i=>{var e;return(null==(e=to(i))?void 0:e.storageGroup)===t})}ba(t,i){var e=xo[t];if(!e)return!1;var r=i[e],s=this.props[e];return Ri(r)&&Ri(s)&&s>r}refreshKey(t){var i;if(!(this.gi||"$fbc_persistence"===t&&this.Do)){var e=this.Eo?null==(i=to(t))?void 0:i.storageGroup:void 0,r=e?js.Nt(this.Wo(e)):this.fo.Nt(this.jo);if(r&&t in r)this.ea(t,r[t],!1);else{if(e){var s=this.fo.Nt(this.jo);if(s&&t in s)return void this.ea(t,s[t],!1)}this.ia(t,!1)}}}save(){if(!this.gi){var t=this.aa();t>0?Ei(this.fa)&&(this.fa=setTimeout(()=>{this.fa=void 0,this.pa()},t)):this.pa()}}flush(){Ei(this.fa)||(clearTimeout(this.fa),this.fa=void 0,this.pa())}pa(t){if(void 0===t&&(t=!1),!(this.gi||this.Ao&&!t)){t||(this.syncCookieProperties(),this.Do||this.Rn.cookieWinsOnConflict&&"localstorage+cookie"===this.Rn.persistence.toLowerCase()||this.refreshKey(g));var i=!t&&!this.Fo;i||(this.$o=!1);var e=!!i&&this.ra();if(this.$o)this.Rn.debug&&vs.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.Eo)return this._a(),void(e&&this.Lo.forEach(t=>t()));var r=this.wa(this.fo,this.jo,this.props,To);"written"===r&&this.la(this.props),"failed"!==r&&(this.Po.clear(),this.Oo=!1,this.Do=!1),e&&this.Lo.forEach(t=>t())}}}_a(){var t=this,i=this.Ko(),e=i.main,r=i.groups,s=this.wa(this.fo,this.jo,e,To);"written"===s&&this.la(e),"failed"!==s&&(this.Oo=!1,this.Do=!1,Po.forEach(t=>{var i;null!=(i=to(t))&&i.storageGroup||this.Po.delete(t)}));var n=function(i){var e,s=r[i];if(xi(s)&&(null==(e=t.To[i])||!e.persisted))return Po.forEach(e=>{var r;(null==(r=to(e))?void 0:r.storageGroup)===i&&t.Po.delete(e)}),1;var n=t.wa(js,t.Wo(i),s,i);"failed"!==n&&Po.forEach(e=>{var r=to(e);(null==r?void 0:r.storageGroup)!==i||"written"!==n&&r.volatile||t.Po.delete(e)})};for(var o of Xn)if(n(o))continue}Ko(){var t={},i={flags:{},surveys:{}};return ps(this.props,(e,r)=>{var s,n=null==(s=to(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e}),{main:t,groups:i}}Yo(t,i){if(i===To)return JSON.stringify(t)+"|"+this.ka+"|"+this.Sa+"|"+this.xa;var e={};return ps(t,(t,i)=>{var r;e[i]=null!=(r=to(i))&&r.volatile?"__volatile__":t}),JSON.stringify(e)}wa(t,i,e,r){var s,n=this.Zo(r);if(r!==To&&!n.dirty&&!Ei(n.fingerprint))return"skipped";try{if((s=this.Yo(e,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.Ot(i,e,this.ka,this.Sa,this.xa,this.Rn.debug)?(n.dirty=!1,r!==To&&(n.persisted=!0),Ei(s)||(n.fingerprint=s),this.Mo&&(n.storageValue=js.Lt(i)),"written"):(this.Rn.debug&&vs.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.sa(),Ei(this.fa)||(clearTimeout(this.fa),this.fa=void 0),this.fo.Dt(this.jo,!1),this.fo.Dt(this.jo,!0),!e&&this.No)for(var r of Xn)js.Dt(this.Wo(r));e?delete this.To[To]:this.To={},this.ua=void 0,this.ha=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(Si(t)){this.syncCookieProperties(),Ei(i)&&(i="None"),this.ka=Ei(e)?this.Ca:e;var r=!1;if(ps(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.ea(e,t),r=!0)}),r)return this.save(),!0}return!1}register(t,i){if(Si(t)){this.syncCookieProperties(),this.ka=Ei(i)?this.Ca:i;var e=!1;if(ps(t,(i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||Si(i)||yi(i))&&(this.ea(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.ia(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==Xt?void 0:Xt.URL;if(t!==this.qo){var i=co(this.Rn.custom_campaign_params,this.Rn.mask_personal_data_properties,this.Rn.custom_personal_data_properties),e=!xi(ys(i));return e&&this.register(i),this.qo=t,e?i:void 0}}update_search_keyword(){var t;this.register((t=null==Xt?void 0:Xt.referrer)?po(t):{})}update_referrer_info(){var t;this.register_once({$referrer:mo(),$referring_domain:null!=Xt&&Xt.referrer&&(null==(t=eo(Xt.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=bo(this.Rn.mask_personal_data_properties,this.Rn.custom_personal_data_properties,this.Rn.disable_capture_url_hashes);this.register_once({[xt]:this.Io?{r:$o(t.r),u:t.u?$o(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};ps([St,wt],i=>{var e=this.props[i];e&&ps(e,function(i,e){t["$initial_"+di(e)]=i})});var i=this.props[xt];return i&&_s(t,function(t,i){void 0===i&&(i=!1);var e=yo(t,i),r={};return ps(e,function(t,i){r["$initial_"+di(i)]=t}),r}(i,this.Rn.disable_capture_url_hashes)),t}safe_merge(t){return ps(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){var r=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every((t,i)=>t===r[i])})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),o=r||n,a=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,h=!!this.gi&&!l;l||this.da(i,h),this.Rn=t,!l&&(r||n||a)&&(this.ua=void 0,this.ha=void 0,this.da(s({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),h));var u=o||a?this.Bo(t):this.fo;this.Ta();var d=this.Ho(t),v=o||d!==this.Eo,c=!l&&(v||t.cross_subdomain_cookie!==this.Sa||t.secure_cookie!==this.xa)&&this.va(h);this.Fo=v;try{if(this.Ca=this.ka=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.fo=u,this.Eo=d,this.props=f,this.save()}else a&&(this.fo=u,l||(delete this.To[To],this.pa()))}finally{this.Fo=!1,c&&this.ga()}}Ta(){var t=this.props[xt];if(this.Io&&Si(t)&&"string"==typeof t.r){var i=$o(t.r),e="string"==typeof t.u?$o(t.u):t.u;i===t.r&&e===t.u||this.ea(xt,s({},t,{r:i,u:e}))}}set_disabled(t){this.gi=t,this.gi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Sa&&(this.Sa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.xa&&(this.xa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props.__timers||{};e[t]=i,this.ea(m,e),this.save()}remove_event_timer(t){var i=this.props.__timers||{},e=i[t];return Ei(e)||(delete i[t],this.ea(m,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.ea(t,i),this.save()}ea(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.Oo=!0),"$fbc_persistence"!==t||Co(s,i)||(this.Do=!0),this.oa(t,s,i),null!=(r=to(t))&&r.volatile||this.na(t))}ia(t,i){void 0===i&&(i=!0),delete this.props[t],i&&(Ro(t)&&this.Go(t,!0),"$fbc_persistence"===t&&(this.Do=!0),this.na(t))}na(t){var i,e=null==(i=to(t))?void 0:i.storageGroup;e&&(this.Zo(e).dirty=!0)}Zo(t){return this.To[t]||(this.To[t]={})}},Fo={GZipJS:"gzip-js",Base64:"base64"},Mo={Activation:"events",Cancellation:"cancelEvents"},Do={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},No={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Lo={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},jo={Popover:"popover",Inline:"inline"};function Bo(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&wi(e.then)&&e.then(void 0,()=>{})}}}}var Uo={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},zo={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Ho=cs("[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=(Ri(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.Ma(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(yt,a),{isRateLimited:l,remainingTokens:a.tokens}}Ia(t){var i=this.instance.config.property_denylist;return!yi(i)||!i.includes(t)}Ea(){var t;if(this.Ia("$current_url")&&this.Ia("$pathname")&&null!=Qt&&Qt.pathname)return""+(null!==(t=Qt.origin)&&void 0!==t?t:"")+Qt.pathname}Ma(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Ea(),o=this.Ia("$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=cs("[RemoteConfig]"),Wo=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=oi._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ra(t){var i,e;null!=(i=oi.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=oi.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Aa(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.Pa(this.remoteConfig);if(this._instance.Fa())return void Vo.warn("Remote config is disabled. Falling back to local config.");this.Ra(t=>{if(!t)return Vo.info("No config found after loading remote JS config. Falling back to JSON."),void this.Aa(t=>{this.Pa(t.json,t)});this.Pa(t)})}catch(t){Vo.error("Error loading remote config",t),this.Pa()}}Pa(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.Pa(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]),Qo=new Go([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Zo=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=Zo(Yo,2),ia=ta[1];ta[0][28]=258,ia[258]=28;for(var ea=Zo(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=_a(e[u-1],c,0);if(f>i){r=0;var p=0,_=f-i,g=1<<_;for(n.sort(function(t,i){return c[i.s]-c[t.s]||t.f-i.f});s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=g-(1<<f-c[m]),c[m]=i}for(p>>>=_;p>0;){var b=n[r].s;i>c[b]?p-=1<<i-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new Go(c),f]},_a=function(t,i,e){return-1==t.s?Math.max(_a(t.l,i,e+1),_a(t.r,i,e+1)):i[t.s]=e},ga=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],_=f[1],g=ga(v),m=g[0],b=g[1],y=ga(p),w=y[0],S=y[1],x=new Ko(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var k=pa(x,7),T=k[0],P=k[1],R=19;R>4&&!T[Qo[R-1]];--R);var C,O,A,I,F=h+5<<3,M=ma(s,aa)+ma(n,la)+o,D=ma(s,v)+ma(n,p)+o+14+3*R+ma(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=F&&D>=F)return ba(i,u,t.subarray(l,l+h));if(ca(i,u,1+(M>D)),u+=2,M>D){C=oa(v,c,0),O=v,A=oa(p,_,0),I=p;var N=oa(T,P,0);for(ca(i,u,b-257),ca(i,u+5,S-1),ca(i,u+10,R-4),u+=14,E=0;R>E;++E)ca(i,u+3*E,T[Qo[E]]);u+=3*R;for(var L=[m,w],j=0;2>j;++j){var B=L[j];for(E=0;B.length>E;++E)ca(i,u,N[U=31&B[E]]),u+=T[U],U>15&&(ca(i,u,B[E]>>>5&127),u+=B[E]>>>12)}}else C=ha,O=aa,A=ua,I=la;for(E=0;a>E;++E)if(r[E]>255){var U;fa(i,u,C[257+(U=r[E]>>>18&31)]),u+=O[U+257],U>7&&(ca(i,u,r[E]>>>23&31),u+=Yo[U]);var z=31&r[E];fa(i,u,A[z]),u+=I[z],z>3&&(fa(i,u,r[E]>>>5&8191),u+=Xo[z])}else fa(i,u,C[r[E]]),u+=O[r[E]];return fa(i,u,C[256]),u+O[256]},wa=new Jo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Sa=new Go(0),xa=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}(),Ea=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function ka(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=xa[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,_=new Ko(32768),g=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),S=new Ko(288),x=new Ko(32),E=0,k=0,T=(u=0,0),P=0,R=0;o>u;++u){var C=y(u),O=32767&u,A=g[C];if(_[O]=A,g[C]=O,u>=P){var I=o-u;if((E>7e3||T>24576)&&I>423){h=ya(t,l,0,w,S,x,k,T,R,u-R,h),T=E=k=0,R=u;for(var F=0;286>F;++F)S[F]=0;for(F=0;30>F;++F)x[F]=0}var M=2,D=0,N=f,L=O-A&32767;if(I>2&&C==y(u-L))for(var j=Math.min(c,I)-1,B=Math.min(32767,u),U=Math.min(258,I);B>=L&&--N&&O!=A;){if(t[u+M]==t[u+M-L]){for(var z=0;U>z&&t[u+z]==t[u+z-L];++z);if(z>M){if(M=z,D=L,z>j)break;var H=Math.min(L,z-2),q=0;for(F=0;H>F;++F){var V=u-L+F+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,A=V)}}}L+=(O=A)-(A=_[O])+32768&32767}if(D){w[T++]=268435456|ia[M]<<18|ea[D];var G=31&ia[M],K=31&ea[D];k+=Yo[G]+Xo[K],++S[257+G],++x[K],P=u+M,++E}else w[T++]=t[u],++S[t[u]]}}h=ya(t,l,n,w,S,x,k,T,R,u-R,h),n||(h=ba(l,h,Sa))}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&&Ea(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),Ea(u,d-8,e.d()),Ea(u,d-4,r),u}var $a=!!ti||!!Zt,Ta="text/plain",Pa=!1,Ra=(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:"")},Ca=function(t,i,e){var r;void 0===e&&(e=!0);var n=t.split("?"),o=n[0],a=n[1],l=s({},i),h=null!==(r=null==a?void 0:a.split("&").map(t=>{var i,r=t.split("="),s=r[0],n=e&&null!==(i=l[s])&&void 0!==i?i:r[1];return delete l[s],s+"="+n}))&&void 0!==r?r:[],u=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return ps(t,function(t,i){Ei(t)||Ei(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},Oa=t=>{if(t.Oa)return t.Oa;var i=t.data,e=t.compression;if(i){if(e===Fo.GZipJS){var r=ka(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)}(io(i)),{mtime:0});return{contentType:Ta,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Fo.Base64){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:io(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(io(i)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=io(i);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},Aa=t=>{var i,e,r=()=>"sendBeacon"===t.transport?{url:Ca(t.url,{compression:Fo.Base64}),encodedBody:Oa(s({},t,{compression:Fo.Base64,Oa:void 0}))}:{url:Ra(t.url,"compression"),encodedBody:Oa(s({},t,{compression:void 0,Oa:void 0}))};try{i=Oa(t)}catch(i){if(zr(t.compression,ro(t.url,"compression")))return vs.error("Failed to gzip request body, sending uncompressed payload",i),r();throw i}return i&&zr(t.compression,ro(t.url,"compression"))&&!((e=i.body)instanceof ArrayBuffer?Ur(new Uint8Array(e)):ArrayBuffer.isView(e)&&Ur(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?(Pa=!0,r()):{url:t.url,encodedBody:i}},Ia=t=>{try{return Aa(t)}catch(i){return vs.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},Fa=function(){var t=o(function*(t){var i=yield function(t,i,e){return Wr.apply(this,arguments)}(io(t.data),h.DEBUG,{rethrow:!0});if(!i)return t;var e=yield i.arrayBuffer();return s({},t,{Oa:{contentType:Ta,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)||""),Na=t=>{var i=Ia(t);if(i){var e=new ti,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;ps(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)}},La=t=>{var i=Ia(t);if(i){var e=i.url,r=i.encodedBody,n=null!=r?r:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;ps(t.headers,function(t,i){h.append(i,t)}),o&&h.append("Content-Type",o);var u=null,d=!1;if(ii){var v=new ii;u={signal:v.signal,timeout:setTimeout(()=>{var i;d=!0,v.abort(tr("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)?vs.warn(i):vs.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var f;Zt(e,s({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.$a&&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){vs.error(t)}null==t.callback||t.callback(r)})).catch(c).finally(()=>u?clearTimeout(u.timeout):null)}catch(t){u&&clearTimeout(u.timeout),c(t)}}},ja=t=>{try{var i,e=Aa(t),r=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(Yt.sendBeacon(r,h))return;var u=yi(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(yi(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=i=>yi(t.data)?i:s({},t.data,{batch:i});return ja(s({},t,{data:v(u.slice(0,d))})),void ja(s({},t,{data:v(u.slice(d))}))}vs.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to "+(Zt?"fetch":"XHR")),Zt?La(s({},t,{$a:!0})):Na(t)}catch(t){vs.warn("Beacon send failed",t)}},Ba=(t,i,e,r)=>{var n="query"===r?"POST"===i?"sent_at":"_":void 0;return Ca(e===Fo.GZipJS?Ra(t,"compression"):t,s({},n?{[n]:Date.now().toString()}:{},e===Fo.GZipJS?{}:{compression:e}))},Ua=[];Zt&&Ua.push({transport:"fetch",method:La}),ti&&Ua.push({transport:"XHR",method:Na}),null!=Yt&&Yt.sendBeacon&&Ua.push({transport:"sendBeacon",method:ja});var za=class{constructor(t,i){this.Da=!0,this.La=[],this.Na=zi((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,vs.createLogger("flush interval"),3e3),this.qa=t}enqueue(t){this.La.push(t),this.ja||this.Ba()}unload(){this.Ha();var t=this.La.length>0?this.za():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.Ua(s({},t,{transport:"sendBeacon"}))})}enable(){this.Da=!1,this.Ba()}Ba(){var t=this;this.Da||(this.ja=setTimeout(()=>{if(this.Ha(),this.La.length>0){var i=this.za(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&yi(e.data)&&ps(e.data,t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp}),t.Ua(e)};for(var r in i)e()}},this.Na))}Ua(t){try{this.qa(t)}catch(t){vs.error(t)}}Ha(){clearTimeout(this.ja),this.ja=void 0}za(){var t={};return ps(this.La,i=>{var e,r=i,n=(r?r.batchKey:null)||r.url;Ei(t[n])&&(t[n]=s({},r,{data:[]})),null==(e=t[n].data)||e.push(r.data)}),this.La=[],t}},Ha=class{constructor(t){this._instance=t,this.Wa=!1,this.Va=3e3,this.La=[],this.La=[],this.Ga=!0,this.resume()}resume(){if(!Ei(Kt)&&"onLine"in Kt.navigator){if(this.Ga=Kt.navigator.onLine,this.Za)return;this.Za=()=>{this.Ga=!0,this.Ja()},this.Qa=()=>{this.Ga=!1},Es(Kt,"online",this.Za),Es(Kt,"offline",this.Qa)}}get length(){return this.La.length}retriableRequest(t){var e=t.retriesPerformedSoFar,n=r(t,i);Ci(e)&&(n.url=Ca(n.url,{retry_count:e})),this._instance._send_request(s({},n,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.ws(s({retriesPerformedSoFar:e},n));0===t.statusCode&&vs.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=e?e:0)+" retries.")}null==n.callback||n.callback(t)}}))}ws(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.La.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),vs.warn(s),this.Wa||(this.Wa=!0,this.Ka())}Ka(){if(this.Xa&&clearTimeout(this.Xa),0===this.La.length)return this.Wa=!1,void(this.Xa=void 0);this.Xa=setTimeout(()=>{this.Ga&&this.La.length>0&&this.Ja(),this.Ka()},this.Va)}Ja(){var t=Date.now(),i=[],e=this.La.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.La=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.Xa&&(clearTimeout(this.Xa),this.Xa=void 0),this.Wa=!1,Ei(Kt)||(this.Za&&(Kt.removeEventListener("online",this.Za),this.Za=void 0),this.Qa&&(Kt.removeEventListener("offline",this.Qa),this.Qa=void 0)),this.La)){var i=t.requestOptions;try{this._instance._send_request(s({},i,{transport:"sendBeacon"}))}catch(t){vs.error(t)}}this.La=[]}},qa=class{constructor(t){this._instance=t,this.Ya=()=>{var t,i,e,r;this.tl||(this.tl={});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.tl.lastScrollY=Math.ceil(n),this.tl.maxScrollY=Math.max(n,null!==(t=this.tl.maxScrollY)&&void 0!==t?t:0),this.tl.maxScrollHeight=Math.max(o,null!==(i=this.tl.maxScrollHeight)&&void 0!==i?i:0),this.tl.lastContentY=a,this.tl.maxContentY=Math.max(a,null!==(e=this.tl.maxContentY)&&void 0!==e?e:0),this.tl.maxContentHeight=Math.max(l,null!==(r=this.tl.maxContentHeight)&&void 0!==r?r:0)}}get el(){return this._instance.config.scroll_root_selector}getContext(){return this.tl}resetContext(){var t=this.tl;return setTimeout(this.Ya,0),t}startMeasuringScrollPosition(){Es(Kt,"scroll",this.Ya,{capture:!0}),Es(Kt,"scrollend",this.Ya,{capture:!0}),Es(Kt,"resize",this.Ya)}scrollElement(){var t;if(!this.el)return null==Kt||null==(t=Kt.document)?void 0:t.documentElement;for(var i of yi(this.el)?this.el:[this.el]){var e,r=null==Kt||null==(e=Kt.document)?void 0:e.querySelector(i);if(r)return r}}il(t){var i,e,r="y"===t?"scrollTop":"scrollLeft";if(this.el){var s=this.scrollElement();return s&&s[r]||0}return Kt?"y"===t?Kt.scrollY||Kt.pageYOffset||(null==(i=Kt.document)||null==(i=i.documentElement)?void 0:i.scrollTop)||0:Kt.scrollX||Kt.pageXOffset||(null==(e=Kt.document)||null==(e=e.documentElement)?void 0:e.scrollLeft)||0:0}scrollY(){return this.il("y")}scrollX(){return this.il("x")}},Va=t=>bo(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),Wa=class{constructor(t,i,e,r){this.Be=t=>{var i=this.rl();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.nl(this._instance)};this.sl.register({[bt]:e})}},this._instance=t,this.ol=i,this.sl=e,this.nl=r||Va,this.ol.onSessionId(this.Be)}rl(){return this.sl.props[bt]}getSetOnceProps(){var t,i=null==(t=this.rl())?void 0:t.props;return i?"r"in i?yo(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 ps(ys(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+di(e)]=i}),t}},Ga=class{on(t,i){return this.al[t]||(this.al[t]=[]),this.al[t].push(i),()=>{this.al[t]=this.al[t].filter(t=>t!==i)}}emit(t,i){for(var e of this.al[t]||[])e(i);for(var r of this.al["*"]||[])r(t,i)}constructor(){this.al={}}},Ka=cs("[SessionId]"),Ja=864e5,Ya=class{on(t,i){return this.ll.on(t,i)}constructor(t,i,e){var r;if(this.ul=null,this.hl=null,this.dl=[],this.vl=void 0,this.cl=!1,this.ll=new Ga,this.fl=(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.Rn=t.config,this.sl=t.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.pl=void 0,this._sessionActivityTimestamp=null,this.gl=i||As,this.ml=e||As;var s=this.Rn.persistence_name||this.Rn.token;if(this._sessionTimeoutMs=1e3*zi(this.Rn.session_idle_timeout_seconds||1800,60,36e3,Ka.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.yl(),this.bl="ph_"+s+"_window_id",this._l="ph_"+s+"_primary_window_exists",this.wl()){var n=Zs.Nt(this.bl),o=Zs.Nt(this._l);n&&!o?this.He=n:Zs.Dt(this.bl),Zs.Ot(this._l,!0)}null!=(r=this.Rn.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.Rn.bootstrap.sessionID),this.kl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Ei(this.dl)&&(this.dl=[]),this.dl.push(t),this.Xt&&t(this.Xt,this.He),()=>{this.dl=this.dl.filter(i=>i!==t)}}wl(){return"memory"!==this.Rn.persistence&&!this.sl.gi&&Zs.Et()}Sl(t){t!==this.He&&(this.He=t,this.wl()&&Zs.Ot(this.bl,t))}xl(){return this.He?this.He:this.wl()?Zs.Nt(this.bl):null}Cl(t){var i=this.ul;return!Ti(i)&&!Ti(t)&&5e3>Math.abs(t-i)}Tl(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this.Xt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Xt=t,s&&!r||s&&this.Cl(i)||(this.ul=i,this.sl.register({[N]:[i,t,e]}))}Ml(){var t,i=null==(t=this.Rn)?void 0:t.persistence_save_debounce_ms;return Ci(i)&&i>0}Il(){this.Ml()?this.sl.refreshKey(N):(this.sl.flush(),this.sl.load())}El(){var t;if(!Ti(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.ul){this.Il();var i=this.Rl();i[1]===this.Xt&&i[2]===this._sessionStartTimestamp&&(this.ul=this._sessionActivityTimestamp,this.sl.register({[N]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.sl.flush())}}Al(){var t=this.Rl()[0],i=Ci(t)?t:0,e=Ci(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Pl(t){return this.Il(),this.fl(t,this.Al())}Rl(){var t=this.sl.props[N];return yi(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.ul=null,this.pl=void 0,clearTimeout(this.Fl),this.Fl=void 0,this.Tl(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 Ka.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Ka.error("Invalid sessionID in bootstrap",t)}}(t);return!Ei(e)&&(i?this.pl={sessionId:t,sessionStartTimestamp:e}:this.Tl(t,(new Date).getTime(),e),!0)}destroy(){this.cl=!0,this.El(),clearTimeout(this.Fl),this.Fl=void 0,this.vl&&Kt&&(Kt.removeEventListener(Ht,this.vl,{capture:!1}),this.vl=void 0),this.dl=[]}kl(){this.vl=()=>{this.El(),this.wl()&&Zs.Dt(this._l)},Es(Kt,Ht,this.vl,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),"always"===this.Rn.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this.Xt;if(e)this.hl=r;else if(Ti(this.hl)||this.hl>r||r-this.hl>=1e3){var n,o;null==(n=(o=this.sl).syncCookieProperties)||n.call(o),this.hl=r}var a=this.Rl(),l=a[1],h=a[2],u=!Ei(s)&&l!==s,d=this.Al(),v=this.xl(),c=this.pl,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ja),p=c?f:Ci(h)&&Math.abs(r-h)>Ja,_=!1,g=u,m=!l||!!c,b=l,y=!m&&!t&&this.fl(r,d);if(y){(y=this.Pl(r))||Ka.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.Rl();l=w[1],h=w[2]}if(m||y||p){g=!1;var S=c&&!f;l=S?c.sessionId:this.gl(),v=this.ml(),Ka.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!S,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),h=S?c.sessionStartTimestamp:r,this.pl=void 0,_=!0}else v||(v=this.ml(),_=!0),(g=g||l!==b)&&(Ka.info("adopted cross-tab session id",{sessionId:l,windowId:v}),_=!0);var x=Ci(d)&&t&&!p?d:r,E=Ci(h)?h:(new Date).getTime();this.Sl(v),this.Tl(l,x,E),t||this.yl();var k={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return _&&this.dl.forEach(t=>t(l,v,k)),{sessionId:l,windowId:v,sessionStartTimestamp:E,changeReason:_?k:void 0,lastActivityTimestamp:d}}yl(){this.cl||(clearTimeout(this.Fl),this.Fl=setTimeout(()=>{if(!this.cl)if(this.Pl((new Date).getTime())){var t=this.Xt;this.resetSessionId(),this.ll.emit("forcedIdleReset",{idleSessionId:t})}else this.yl()},1.1*this.sessionTimeoutMs))}},Xa=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&li(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>li(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function Qa(){return(Qa=o(function*(){var t=null==Yt?void 0:Yt.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 vs.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 tl(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var il=(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}},el=t=>t.toLowerCase(),rl={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=>il(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!il(i,t))),icontains:(t,i)=>i.map(el).some(i=>t.map(el).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(el).every(i=>t.map(el).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 sl(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=rl[e.operator];return!!s&&s(e.values,[String(r)])})}function nl(t,i,e){return io({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var ol="custom",al="i.posthog.com",ll=/^\/static\//,hl=["/s/","/e/","/i/"],ul=class{constructor(t){this.Ol={},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("."+al,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.Ol[this.apiHost]||(this.Ol[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":ol),this.Ol[this.apiHost]}$l(t){if(ll.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}Dl(t){var i=eo(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}Ll(t,i,e){if("ui"===t)return e;var r=e,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=eo(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&hl.some(t=>0===i.indexOf(t))){var a=this.Dl(r);if(a){var l,h=this.apiHost,u=this.Nl;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(this.Nl=u={apiHost:h,rewriteRequestPath:s,urls:new Set}),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.Nl,e=this.Dl(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.Ll(t,i,this.uiHost+i);if("flags"===t)return this.Ll(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.$l(i);if(e)return this.Ll(t,i,""+e+i)}if(this.region===ol)return this.Ll(t,i,this.apiHost+i);var r=al+i;switch(t){case"assets":return this.Ll(t,i,"https://"+this.region+"-assets."+r);case"api":return this.Ll(t,i,"https://"+this.region+"."+r)}}},dl=cs("[Surveys]"),vl=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){dl.error("Failed to persist survey seen state",t)}},cl=[Do.Popover,Do.Widget,Do.API],fl={ignoreConditions:!1,ignoreDelay:!1,displayType:jo.Popover},pl=cs("[PostHog ExternalIntegrations]"),_l={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},gl=class{constructor(t){this._instance=t}bo(t,i){var e;null==(e=oi.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,t=>{if(t)return pl.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=oi.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t.bo(_l[n],()=>{var i;null==(i=oi.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)}),!o&&null!=(r=oi.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=oi.__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()}}},ml=class{constructor(t,i){this.A=t,this.Js=i,this.ql=new Map,this.ro=!1}add(t){var i=this;return o(function*(){if(i.ro)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.ql.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.ql.set(t.name,t);try{var e=t.setup(i.Js);e&&(yield e)}catch(e){var r=i.ql.get(t.name)===t;r&&i.ql.delete(t.name),i.A.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.jl(t)}})()}getExtension(t){return this.ql.get(t)}dispose(){if(!this.ro){this.ro=!0;var t=Array.from(this.ql.values()).reverse();for(var i of(this.ql.clear(),t))this.jl(i)}}jl(t){try{var i=null==t.dispose?void 0:t.dispose();i&&wi(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)}}},bl=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);Ei(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)}},yl="extensionsRemoteConfig",wl=class{constructor(t){this.instance=t,this.ro=!1,this.A=vs,this.Bl=t.Hl,this.kv=new bl(t),this.onEvent=t=>Bo(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.ro)return Bo(()=>{});var i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.zl.on(yl,i);return this.Bl&&i(this.Bl),Bo(e)},this.Ul=new ml(vs.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(v);return"string"==typeof t?t:void 0}get library(){return{name:h.LIB_NAME,version:h.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.Ul.add(t)}getExtension(t){return this.Ul.getExtension(t)}capture(t,i,e){var r=this;return o(function*(){e?r.instance.capture(t,i,{timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce}):r.instance.capture(t,i)})()}registerDynamicEventProperties(t){return Bo(this.instance.Wl(t))}handleRemoteConfig(t){this.ro||(this.Bl=t,this.instance.zl.emit(yl,t))}sendRequest(t,i){var e=this;return o(function*(){var r;void 0===i&&(i={});var s=e.instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",t),n={method:i.method,url:i.query?Ca(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?fi.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.ro||(this.ro=!0,this.Ul.dispose())}},Sl={},xl=0,El=()=>{},kl='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',$l="Surveys module not available",Tl="sanitize_properties is deprecated. Use before_send instead",Pl="Invalid value for property_denylist config: ",Rl=/^[A-Za-z0-9_-]{1,400}$/,Cl=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Ol=["token","distinct_id",$t],Al="posthog",Il=!$a&&-1===(null==ri?void 0:ri.indexOf("MSIE"))&&-1===(null==ri?void 0:ri.indexOf("Mozilla")),Fl=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},Ml=t=>{var i;return s({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:xs(null==Xt?void 0:Xt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:El,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:Qt&&ki(null==Qt?void 0:Qt.search)&&-1!==Qt.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==Kt||null==(i=Kt.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){vs.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:Ut,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:El},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:yn,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Fl(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))},Dl=[["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"]],Nl=t=>{var i={};for(var e of Dl){var r=e[0],s=e[1];Ei(t[r])||(i[s]=t[r])}var n=_s({},i,t),o=t.__preview_external_dependency_versioned_paths;return Ei(o)||(Ei(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),ki(o)&&Ei(t.asset_host)&&(n.asset_host=o)),yi(t.property_blacklist)&&(Ei(t.property_denylist)?n.property_denylist=t.property_blacklist:yi(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:vs.error(Pl+t.property_denylist)),n},Ll=class{constructor(){this.__forceAllowLocalhost=!1}get Vl(){return this.__forceAllowLocalhost}set Vl(t){vs.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},jl=(t=class t{Gl(t){if(t){var i=this.ql.indexOf(t);-1!==i&&this.ql.splice(i,1)}}Zl(t,i){return this.Gl(t),this.ql.push(i),null==i.initialize||i.initialize(),i}Jl(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}Ql(){if(!(this.Kl||this.config.reuseAnonymousId||this.config.segment||this.Jl())){var t,i,e,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.Xl||(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.Kl=!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)))}}Yl(){if(!this.Jl()&&"$posthog_cookieless"===this.get_distinct_id()){var t=this.persistence;if(t){this.tu()||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(mt,jt)}this.eu()}}}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.iu=!1,this.ru=!1,this.webPerformance=new Ll,this.nu=!1,this.version=h.LIB_VERSION,this.su=new Set,this.ou="",this.zl=new Ga,this.ql=[],this.au=[],this.Xl=!1,this.Kl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ml(),this.SentryIntegration=Jn,this.sentryIntegration=t=>function(t,i){var e=Kn(t,i);return{name:Gn,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.lu=!1,this.uu=null,this.hu=null,this.du=null,this.scrollManager=new qa(this),this.pageViewManager=new Yn(this),this.rateLimiter=new qo(this),this.requestRouter=new ul(this),this.consent=new tn(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=>vs.info('send "'+(null==t?void 0:t.event)+'"',t))}init(i,e,r){if(r&&r!==Al){var s,n=null!==(s=Sl[r])&&void 0!==s?s:new t;return n._init(i,e,r),Sl[r]=n,Sl[Al][r]=n,n}return this._init(i,e,r)}_init(t,i,e){var r,n,o;void 0===i&&(i={});var a,l=ki(t)?t.trim():"";if(!l)return vs.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 l!==(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('"+l+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Ml(i.defaults),i.debug=this.vu(i.debug),this.cu=i,this.fu=[],i.person_profiles?this.hu=i.person_profiles:i.process_person&&(this.hu=i.process_person);var u=Ml(i.defaults),d=Nl(i),v=_s({},u,d,{name:e,token:l});Si(u.rageclick)&&Si(d.rageclick)&&(v.rageclick=_s({},u.rageclick,d.rageclick)),Si(u.session_recording)&&Si(d.session_recording)&&(v.session_recording=_s({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&vs.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Fo.GZipJS;var f=this.tu();if(this.persistence=new Io(this.config,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Io(s({},this.config,{persistence:"sessionStorage"}),f,!1),this.ou="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!f&&Zs.Et()){var p=Zs.Nt(this.ou);yi(p)&&p.forEach(t=>{ki(t)&&this.su.add(t)})}else Zs.Dt(this.ou);var _=s({},this.persistence.props),g=s({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.pu=new za(t=>this.gu(t),this.config.request_queue_config),this.mu=new Ha(this),this.__request_queue=[];var m=this.Jl();m||(this.sessionManager=new Ya(this),this.sessionPropsManager=new Wa(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.yu()})),this.bu(),this.config.__preview_deferred_init_extensions?(vs.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._u(m)},0)):(vs.info("Initializing extensions synchronously"),this._u(m)),h.DEBUG=h.DEBUG||this.config.debug,h.DEBUG&&vs.info("Starting in debug mode",{this:this,config:i,thisC:s({},this.config),p:_,s:g}),!this.config.identity_distinct_id||null!=(r=i.bootstrap)&&r.distinctID||(i.bootstrap=s({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var b=null==(n=i.bootstrap)?void 0:n.distinctID;if(this.Xl=!!b&&!$i(b),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var y=i.bootstrap.distinctID,w=this.get_distinct_id(),S=this.persistence.get_property(mt);if(i.bootstrap.isIdentifiedID&&null!=w&&w!==y&&"anonymous"===S)this.identify(y);else if(i.bootstrap.isIdentifiedID&&null!=w&&w!==y&&"identified"===S)vs.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 x=this.config.get_device_id(As()),E=i.bootstrap.isIdentifiedID?x:y;this.persistence.set_property(mt,i.bootstrap.isIdentifiedID?Bt:jt),this.register({distinct_id:y,$device_id:E})}}if(m)this.register_once({distinct_id:kt,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(As());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(mt,jt)}return Es(Kt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Es(Kt,"pageshow",()=>{var t;this.iu=!1,this.ru||null==(t=this.mu)||t.resume()}),i.segment?Wn(this,()=>this.wu()):this.wu(),wi(this.config._onCapture)&&this.config._onCapture!==El&&(vs.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&vs.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 Qa.apply(this,arguments)}().then(t=>{t&&this.register({[c]:t})}).catch(El),this}ku(t){var i=t;return ki(i.name)&&wi(i.setup)}Su(t,i){this.ku(t)?i.push(()=>{this.xu().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(i=>{vs.error('Failed to dispose browser extension "'+t.name+'"',i)})}):this.ql.push(t)}bu(){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.Cu)||o.call(this),this.Cu=void 0,this.featureFlags=new a(this)),wi(this.featureFlags.onReloading)&&wi(this.featureFlags.setup)?this.Cu||(this.Cu=this.featureFlags.onReloading(()=>{this.zl.emit("featureFlagsReloading",!0)}),this.xu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}_u(i){var e,r,n,o,a,l,h,u=performance.now(),d=s({},t.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.exceptions&&this.ql.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new d.exceptions(this)),d.historyAutocapture&&this.ql.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.ql.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.ql.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!i&&this.ql.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.Su(this.autocapture=new d.autocapture(this),v),d.surveys&&this.Su(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new d.surveys(this),v),d.logs&&this.Su(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this),v),d.metrics&&this.ql.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.ql.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.ql.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.ql.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.ql.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.ql.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.ql.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Hn)),d.toolbar&&this.ql.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this.ql.push(this.experiments=null!==(h=this.experiments)&&void 0!==h?h:new d.experiments(this)),this.ql.forEach(t=>{t.initialize&&v.push(()=>{null==t.initialize||t.initialize()})}),v.push(()=>{if(this.Tu){var t=this.Tu;this.Tu=void 0,this.ql.forEach(i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t))}}),this.Mu(v,u)}Mu(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this.Mu(t,i)},0);var e=t.shift();if(e)try{e()}catch(t){vs.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[Tt]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Pt]:r}),this.config.__preview_deferred_init_extensions&&vs.info("PostHog extensions initialized ("+r+"ms)")}Pa(t){var i;if(!Xt||!Xt.body)return vs.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Pa(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Tu=t),this.Hl=t,this.compression=void 0,t.ok){var e,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=hi(r.supportedCompression,Fo.GZipJS)?Fo.GZipJS:hi(r.supportedCompression,Fo.Base64)?Fo.Base64:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.hu?this.hu:Ut}),null==(i=this.Iu)||i.handleRemoteConfig(t),this.ql.forEach(i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t))}wu(){try{this.config.loaded(this)}catch(t){vs.critical("`loaded` function failed",t)}if(this.Eu(),this.config.internal_or_test_user_hostname&&null!=Qt&&Qt.hostname){var t=Qt.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.Jl())&&this.Ru()},1),this.Au=new Wo(this),this.Au.load()}Eu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.pu)||t.enable())}_dom_loaded(){this.is_capturing()&&fs(this.__request_queue,t=>this.gu(t)),this.__request_queue=[],this.Eu()}_handle_unload(){var t,i,e,r,s;this.iu=!0,null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.Pu()&&this.capture(Vt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.pu)||r.unload(),null==(s=this.mu)||s.unload()):this.Pu()&&this.capture(Vt,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=s({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(Ei(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,n=s({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&Ei(n.compression)&&n.data&&(n.compression=Fo.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(yi(o=n.data)?o:[o]).map(t=>s({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,i){return void 0===i&&(i=(new Date).toISOString()),yi(t)?t.map(t=>s({},t,{sent_at:i})):s({},t,{sent_at:i})}(n.data))),n.url=Ba(n.url,n.method,n.compression,n.timestampMode);var v=Ua.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),c=null!==(e=null==(r=function(t,i){for(var e=0;t.length>e;e++)if(i(t[e]))return t[e]}(v,t=>t.transport===d))?void 0:r.method)&&void 0!==e?e:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){Da(t)?vs.warn(t):vs.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Fo.GZipJS&&ei&&"undefined"!=typeof Promise&&!Pa?Fa(n).then(t=>{f(t)}).catch(i=>{if(Hr(i))return Pa=!0,void f(s({},n,{compression:void 0,url:Ba(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 Hr(t)||i===Br})(i)&&(Pa=!0),f(n)}):c(n)})(s({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}gu(t){this.mu?this.mu.retriableRequest(t):this._send_request(t)}_execute_array(t){xl++;try{var i,e=[],r=[],s=[];fs(t,t=>{if(t)if(yi(i=t[0]))s.push(t);else if(wi(t))try{t.call(this)}catch(i){vs.error("Error executing queued PostHog call",t,i)}else yi(t)&&"alias"===i?e.push(t):yi(t)&&-1!==i.indexOf("capture")&&wi(this[i])?s.push(t):r.push(t)});var n=function(t,i){fs(t,function(t){try{if(yi(t[0])){var e=i;ps(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){vs.error("Error executing queued PostHog call",t,i)}})};n(e,this),n(r,this),n(s,this)}finally{xl--}}push(i){if(xl>0&&yi(i)&&ki(i[0])){var e=t.prototype[i[0]];wi(e)&&e.apply(this,i.slice(1))}else this._execute_array([i])}Fu(){var t,i=null==(t=this.persistence)?void 0:t.get_property(g);return ki(i)&&Cl.test(i)?{value:i,delivered:!1}:Si(i)&&ki(i.value)&&Cl.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}Ou(t,i,e,r){if(this.persistence){this.persistence.refreshKey(g);var s=this.Fu();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)&&Rl.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)}}$u(t){if(this.persistence){this.persistence.refreshKey(g);var i=this.Fu();(null==i?void 0:i.value)!==t||i.delivered||this.persistence.register({[g]:{value:t,delivered:!0}})}}capture(t,i,e){var r,n,o,a,l,h,u,d,v,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.pu){if(this.is_capturing())if(!Ei(t)&&ki(t)){this.Yl();var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var p=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==p||!p.isRateLimited){var g;null!=i&&i.$current_url&&!ki(null==i?void 0:i.$current_url)&&(vs.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.Du||vs.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&&(g=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"),p&&(w.properties.$lib_rate_limit_remaining_tokens=p.remainingTokens);var S="$feature_flag_called"===t&&!1===w.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=e&&e.$set&&!S&&(w.$set=null==e?void 0:e.$set);var x=Si(null==i?void 0:i.$set)?i.$set:void 0,E=!(null==e||!e.$set)&&"$fbc"in e.$set,k=E||!!x&&"$fbc"in x,T=E?null==e||null==(r=e.$set)?void 0:r[_]:null==x?void 0:x[_],P=yi(null==i?void 0:i.$unset)?i.$unset:[],R=(null==e?void 0:e.$unset)||[],C=-1!==P.indexOf("$fbc")||-1!==R.indexOf("$fbc"),O=this.Ou(null==(n=g)?void 0:n.fbclid,T,k,C);O&&!0===w.properties.$process_person_profile&&O.pending&&!k&&!S&&(w.$set=s({[_]:O.value},w.$set));var A=null==e?void 0:e.$unset;A&&(w.$unset=A);var I=S?void 0:this.Lu(null==e?void 0:e.$set_once,t!==Gt,t===Wt);if(I&&(w.$set_once=I),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),yi(i))r=[],fs(i,i=>{r.push(t(i))});else{var s={};ps(Di(i)?ws(i):i,(i,e)=>{c.has(i)||(s[e]=t(i,e))}),r=s}return r}}(d)),w.timestamp=b,Ei(null==e?void 0:e.timestamp)||(w.properties.$event_time_override_provided=!0,w.properties.$event_time_override_system_time=m),S&&(w.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return jr.forEach(r),i.forEach(r),e}(w.properties,Ol)),t===No.DISMISSED||t===No.SENT){var F=null==i?void 0:i[Lo.SURVEY_ID],M=null==i?void 0:i[Lo.SURVEY_ITERATION];vl({id:F,current_iteration:M}),w.$set=s({},w.$set,{[Za({id:F,current_iteration:M},t===No.SENT?"responded":"dismissed")]:!0})}else t===No.SHOWN&&(w.$set=s({},w.$set,{[Lo.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Uo.SHOWN){var D=null==i?void 0:i[zo.TOUR_TYPE];D&&(w.$set=s({},w.$set,{[zo.TOUR_LAST_SEEN_DATE+"/"+D]:(new Date).toISOString()}))}var N=s({},w.properties.$set,w.$set);if(xi(N)||this.setPersonPropertiesForFlags(N),!Pi(this.config.before_send)){var L=this.bs(w);if(!L)return;(w=L).uuid=Ze(w.uuid,As)}var j=null!==(o=null==(a=w.$set)?void 0:a.$fbc)&&void 0!==o?o:Si(null==(l=w.properties)?void 0:l.$set)?w.properties.$set.$fbc:void 0,B=null!=O&&O.pending&&j===O.value?O.value:void 0;this.zl.emit("eventCaptured",w);var U,z=null!==(h=null==e?void 0:e._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),H=s({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}:{},B?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.$u(B)}}:{});return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly||B?(!H.transport&&!H.callback&&xi(null!==(U=this.config.request_headers)&&void 0!==U?U:{})&&this.iu&&(H.transport="sendBeacon"),this.gu(H)):this.pu.enqueue(H),w}vs.critical("This capture call is ignored due to client rate limiting.")}}else vs.error("No event name provided to posthog.capture")}else vs.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null==(i=this.Iu)?void 0:i.getExtension(t)}xu(){var t;return null!==(t=this.Iu)&&void 0!==t?t:this.Iu=new wl(this)}Wl(t){this.au.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.au.indexOf(t);-1!==e&&this.au.splice(e,1)}}}Nu(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.du=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(r=this.sessionPersistence)||r.clear(),this.su.clear(),this.qu()),null==(e=this.featureFlags)||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,e,r,n){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.Nu();var o=n?void 0:this.persistence.remove_event_timer(t),a=s({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.Jl()&&(a[$t]=!0),"$snapshot"===t){var h=s({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=h.distinct_id,(!ki(a.distinct_id)&&!Ri(a.distinct_id)||$i(a.distinct_id))&&vs.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,d=function(t,i,e,r){var s,n,o,a;if(void 0===r&&(r=!1),!ri)return{};var h,u=t?[...lo,...i||[]]:[],d=ze(ri),v=d[0],c=d[1],f=function(t){for(var i=0;Ve.length>i;i++){var e,r=Ve[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["",""]}(ri),p=f[0],_=f[1],g=null!=(h="u">typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},m={};Ei(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,S=null==Kt||null==(o=Kt.screen)?void 0:o.width,x=null==Kt||null==(a=Kt.screen)?void 0:a.height,E=null==Kt?void 0:Kt.devicePixelRatio;Ei(y)||(b.userAgentDataPlatform=y),Ei(w)||(b.maxTouchPoints=w),Ei(S)||(b.screenWidth=S),Ei(x)||(b.screenHeight=x),Ei(E)||(b.devicePixelRatio=E);var k,T,P,R,C,O,A,I,F=_s(ys({$os:v,$os_version:c,$browser:Le(ri,navigator.vendor,g,m),$webview_app:p,$webview_app_version:_,$device:He(ri),$device_type:(T=ri,P=b,I=He(T),I===Ki||I===Gi||"Kobo"===I||"Kindle Fire"===I||I===ge?Wi:I===ae||I===he||I===le||I===pe?"Console":I===Ji?"Wearable":I?qi:"Android"===(null==P?void 0:P.userAgentDataPlatform)&&(null!==(R=null==P?void 0:P.maxTouchPoints)&&void 0!==R?R:0)>0?600>Math.min(null!==(C=null==P?void 0:P.screenWidth)&&void 0!==C?C:0,null!==(O=null==P?void 0:P.screenHeight)&&void 0!==O?O:0)/(null!==(A=null==P?void 0:P.devicePixelRatio)&&void 0!==A?A:1)?qi:Wi:"Desktop"),$timezone:wo(),$timezone_offset:So()}),{$current_url:so(r?ir(null==Qt?void 0:Qt.href):null==Qt?void 0:Qt.href,u,uo),$host:null==Qt?void 0:Qt.host,$pathname:null==Qt?void 0:Qt.pathname,$raw_user_agent:ri.length>1e3?ri.substring(0,997)+"...":ri,$browser_version:Be(ri,navigator.vendor,g,m),$browser_language:_o(),$browser_language_prefix:(k=_o(),"string"==typeof k?k.split("-")[0]:void 0),$screen_height:null==Kt?void 0:Kt.screen.height,$screen_width:null==Kt?void 0:Kt.screen.width,$viewport_height:null==Kt?void 0:Kt.innerHeight,$viewport_width:null==Kt?void 0:Kt.innerWidth,$lib:l.LIB_NAME,$lib_version:l.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return l.SDK_DIST_CHANNEL&&(F.$sdk_dist_channel=l.SDK_DIST_CHANNEL),F}(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;a.$session_id=v.sessionId,a.$window_id=c}this.sessionPropsManager&&_s(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&_s(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(f=this.mu)?void 0:f.length}catch(t){a.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===ol&&(a.$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,r),a=_s(a,u),"$pageview"===t&&Xt&&(a.title=Xt.title),!Ei(o)){var p=e.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}ri&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),g=this.sessionPersistence.properties(),m=a.$groups,b=_.$groups;Si(m)&&!xi(m)&&(a.$groups=s({},Si(b)?b:{},m)),ps(["$referrer","$referring_domain"],t=>{t in _&&delete g[t]});var y={};if(this.au.length>0)for(var w of this.au.slice())try{_s(y,w())}catch(t){vs.error("Failed to produce browser extension event properties",t)}(a=_s({},d,_,g,s({},y,a))).$is_identified=this._isIdentified(),yi(this.config.property_denylist)?ps(this.config.property_denylist,function(t){delete a[t]}):vs.error(Pl+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(vs.error(Tl),a=S(a,t));var x=this.ju();return a.$process_person_profile=x,x&&!n&&this.Bu("_calculate_event_properties"),a}Lu(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.ju())return t;if(this.nu&&!e)return t;var s=_s({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(vs.error(Tl),s=n(s,"$set_once")),i&&(this.nu=!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.Nu(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach(t=>this.su.add(t)),this.qu()}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.su.delete(t),this.qu()}Hu(t,i){this.register({[t]:i})}yu(){this.su.forEach(t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)}),this.su.clear(),this.qu()}qu(){var t;if(this.ou)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.gi||!Zs.Et())Zs.Dt(this.ou);else{var i=[];this.su.forEach(t=>i.push(t)),i.length>0?Zs.Ot(this.ou,i):Zs.Dt(this.ou)}}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.zl.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:$l}),()=>{})}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:$l})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:$l})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=fl),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:$l}}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:$l})}zu(t){return!t||$i(t)?(vs.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(vs.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())||(vs.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 vs.uninitializedWarning("posthog.identify");if(Ri(t)&&(t=t.toString(),vs.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.zu(t)&&this.Bu("posthog.identify")){this.Yl();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.Nu(!1),o=this.persistence.va(),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(f),this.register({distinct_id:t}));var h=(this.persistence.get_property("$user_state")||"anonymous")===jt,u=t!==l,d=!u&&h;if(u&&h){var v,c=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:l};this.persistence.set_property(mt,Bt),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.ca(),this.capture(Wt,c,{$set:i||{},$set_once:e||{}}),this.du=nl(t,i,e),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(d){this.persistence.set_property(mt,Bt);var p=i||{},_=e||{};this.setPersonPropertiesForFlags({$set:p,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.ca(),this.capture("$set",{$set:p,$set_once:_}),this.du=nl(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ft)):d&&(i||e)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.ga(a)}}}setPersonProperties(t,i){if((t||i)&&this.Bu("posthog.setPersonProperties")){var e=nl(this.get_distinct_id(),t,i);this.du!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.du=e):vs.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(yi(t)?t:[t]).filter(t=>ki(t)&&t.length>0);0!==e.length&&this.Bu("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.du=null)}group(t,i,e){var r;if(t&&i){null==(r=this.persistence)||r.syncCookieProperties(),this.Nu();var n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:s({},n,{[t]:i})}),(o||e)&&this.ju()){var a={$group_type:t,$group_key:i};e&&(a.$group_set=e),this.capture(Gt,a)}e&&this.setGroupPropertiesForFlags({[t]:e}),o&&!e&&this.reloadFeatureFlags()}else vs.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.Bu("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=Oi(t)?t:null==t?void 0:t.resetDeviceID,e=Oi(t)||null==t?void 0:t.bootstrap;this.Uu(i,!1,e)}Uu(t,i,e){var r,n,o,a;if(void 0===i&&(i=!1),vs.info("reset"),!this.__loaded)return vs.uninitializedWarning("posthog.reset");var l=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null==(r=this.cu)?void 0:r.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.Fa());var h=this.get_property(v),u=this.get_property(c),d=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.va?void 0:a.va(),_=!1;try{var g,m,b,y,w,S,x,E,k,T,P,R,O;if(null==(g=this.persistence)||g.clear(),null==(m=this.sessionPersistence)||m.clear(),this.su.clear(),this.qu(),Ei(d)||null==(b=this.persistence)||b.register({[C]:d}),null==(y=this.surveys)||y.reset(),null==(w=this.featureFlags)||w.reset(),null==(S=this.conversations)||S.reset(),null==(x=this.logs)||x.reset(),null==(E=this.metrics)||E.reset(),null==(k=this.persistence)||k.set_property(mt,jt),null==(T=this.sessionManager)||T.resetSessionId(),this.du=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:kt,$device_id:null},"");else{var A=this.config.get_device_id(As());this.register_once({distinct_id:A,$device_id:t?A:h},""),t||Ei(u)||this.register({[c]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(void 0===e.distinctID||this.Jl()||(null==(O=this.persistence)||O.set_property(mt,e.isIdentifiedID?Bt:jt),this.register({distinct_id:e.distinctID})),null==(P=this.featureFlags)||P.initialize(),!(Ei(l)||null!=(R=this.sessionManager)&&R.setBootstrapSessionId(l,!0))){var I=s({},e);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var F;p&&(null==(F=this.persistence)||null==F.ga||F.ga(_))}this.reloadFeatureFlags()}shutdown(t){var i=this;return o(function*(){var t,e,r,s,n,o,a;if(i.__loaded){i.ru=!0,i.xu().dispose(),null==(t=i.sessionRecording)||t.dispose(),null==(e=i.logs)||e.flushLogs("sendBeacon"),null==(r=i.metrics)||r.flush("sendBeacon"),null==(s=i.pu)||s.unload(),null==(n=i.mu)||n.unload();try{var l;null==(l=i.featureFlags)||l.destroy()}catch(t){vs.error("Error while destroying feature flags",t)}null==(o=i.persistence)||o.destroy(),null==(a=i.sessionPersistence)||a.destroy()}else vs.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.Wu()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t.Vu()}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")?(vs.critical("Attempting to create alias for existing People user - aborting."),-2):this.Bu("posthog.alias")?(Ei(i)&&(i=this.get_distinct_id()),t!==i?(this.Hu(f,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(vs.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=s({},this.config);if(Si(t)){var e,r,n,o,a,l,u,d,v,c,f,p,_;_s(this.config,Nl(t));var g=this.tu();null==(e=this.persistence)||e.update_config(this.config,i,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Io(s({},this.config,{persistence:"sessionStorage"}),g,!1);var m=this.vu(this.config.debug);Oi(m)&&(this.config.debug=m),Oi(this.config.debug)&&(this.config.debug?(h.DEBUG=!0,js.Et()&&js.Ot("ph_debug",!0),vs.info("set_config",{config:t,oldConfig:i,newConfig:s({},this.config)})):(h.DEBUG=!1,js.Et()&&js.Dt("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this.Fa()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(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.eu(),null==(_=this.externalIntegrations)||_.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&Wn(this,El,!1)}}_overrideSDKInfo(t,i){h.LIB_NAME=t,h.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){try{if(!this.exceptions)return;var e=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(s({},e,i))}catch(t){return}}addExceptionStep(t,i){var e;null==(e=this.exceptions)||e.addExceptionStep(t,i)}captureLog(t){var i;null==(i=this.logs)||i.captureLog(t)}get logger(){var i,e;return null!==(i=null==(e=this.logs)?void 0:e.logger)&&void 0!==i?i:t.Gu}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"))}ju(){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))}Pu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.ju()||this.Bu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Bu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Bu(t){return"never"===this.config.person_profiles?(vs.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ql(),this.Hu(Et,!0),!0)}tu(){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)}eu(){var t,i,e,r,s,n=this.tu();return this.is_capturing()||null==(t=this.logs)||t.Zu(),(null==(i=this.persistence)?void 0:i.gi)!==n&&(null==(e=this.persistence)||e.set_disabled(n)),(null==(r=this.sessionPersistence)?void 0:r.gi)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.su.clear(),this.qu()),n}opt_in_capturing(i){var e,r,s;if("always"!==this.config.cookieless_mode){if(this.Jl()){var n,o,a,l,h,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this.Uu(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new Ya(this),this.pageViewManager=new Yn(this),this.persistence&&(this.sessionPropsManager=new Wa(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.Zl(this.sessionRecording,new v(this)),this.Hl&&(null==(d=this.sessionRecording)||null==d.onRemoteConfig||d.onRemoteConfig(this.Hl)))}this.consent.optInOut(!0),this.eu(),this.Eu(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(r=this.surveys)||r.loadIfEnabled()),(Ei(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.Ru()}else vs.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.Uu(!0,!0),this.consent.optInOut(!1),this.eu(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:kt,$device_id:null}),this.Gl(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.Ru(),this.Eu())}else vs.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.eu()}_is_bot(){return Yt?Xa(Yt,this.config.custom_blocked_useragents):void 0}Ru(){Xt&&("visible"===Xt.visibilityState?this.lu||(this.lu=!0,this.capture(qt,{title:Xt.title},{send_instantly:!0}),this.uu&&(Xt.removeEventListener(zt,this.uu),this.uu=null)):this.uu||(this.uu=this.Ru.bind(this),Es(Xt,zt,this.uu)))}debug(t){!1===t?(null==Kt||Kt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Kt||Kt.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}))}Fa(){var t=this.cu||{};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?(vs.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,vs)}bs(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=yi(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)?vs.warn(o+". This can cause unexpected behavior."):vs.info(o),null}s.properties&&!xi(s.properties)||vs.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return vs.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&Pi(s.properties[a]))return vs.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.ko)?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)})}vu(t){var i=Oi(t)&&!t,e=js.Et()&&"true"===js.Lt("ph_debug");return!i&&(!!e||t)}},t.__defaultExtensionClasses={},t.Gu=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),t);!function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=bs(t.prototype[i[e]])}(jl,["identify"]);var Bl=class{constructor(t){this.disabled=!1===t;var i=Si(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}},Ul="$copy_autocapture",zl=cs("[AutoCapture]");function Hl(t,i){return i.length>t?i.slice(0,t)+"...":i}function ql(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!sn(i));return i}function Vl(t,i){var e,r,n=i.e,o=i.maskAllElementAttributes,a=i.maskAllText,l=i.elementAttributeIgnoreList,h=i.elementsChainAsString,u=i.disableCaptureUrlHashes;if(!sn(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!nn(c,"body")&&1e3>d.length;)if(an(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!sn(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=>nn(t,"button")||nn(t,"a")):-1;p>0&&(a=a||d.slice(0,p+1).some(t=>!Tn(t)||Pn(t)));var _,g,m,b=[],y={},w=!1,S=!1;if(ps(d,t=>{var i=Tn(t);if(nn(t,"a")){var e=t.getAttribute("href");w=!!(i&&e&&Dn(e))&&(u?ir(e):e)}hi(un(t),"ph-no-capture")&&(S=!0),b.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};fn.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Hl(1024,Nn(t)):Hl(1024,vn(t)));var a=un(t);a.length>0&&(o.classes=a.filter(function(t){return""!==t})),ps(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&&Dn(e.value)&&(!ki(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=ln(a).join(" ")),o["attr__"+e.name]=Hl(1024,"href"===e.name&&s?ir(a):a)}});for(var l=1,h=1,u=t;u=ql(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,a,l,u)),ps(function(t){if(!Tn(t))return{};var i={};return ps(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&&Dn(r)&&(i[e]=r)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(y,i)||(y[i]=t)})}),S)return{props:{},explicitNoCapture:S};if(p>0&&(t=d[p],b.splice(0,p)),a||(b[0].$el_text=nn(t,"a")||nn(t,"button")?Nn(t):vn(t)),w){var x,E;b[0].attr__href=w;var k=null==(x=eo(w))?void 0:x.host,T=null==Kt||null==(E=Kt.location)?void 0:E.host;k&&T&&k!==T&&(_=w)}return{props:_s((g=n.type,{$event_type:g,$ce_version:1}),h?{}:{$elements:b},{$elements_chain:(m=b,yi(m)?function(t){return t.map(t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))r+="."+n.replace(/"/g,"");var o=s({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return 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[jn(t[0].toString())]=jn(i.toString())}),(r+=":")+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:Bn(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==(r=b[0])?void 0:r.$el_text}:{},_&&"click"===n.type?{$external_click_url:_}:{},y),target:t}}var Wl=class{zs(){this.Us=void 0,clearTimeout(this.Ws),this.Ws=void 0}Vs(t){var i;if(!Tn(t))return!0;for(var e,r=null!==(i=this.Gs().css_selector_ignorelist)&&void 0!==i?i:mn,s=new Set,n=t,o=function(){if(s.size>=1e3||s.has(n))return{v:!0};s.add(n);var t=n,i=un(t);if(hi(i,"ph-no-capture")||hi(i,"ph-sensitive")||Pn(t)||r.some(i=>pn(t,i)))return{v:!0};var e=n.parentNode;n=an(e)?e.host:e&&sn(e)?e:null};n;)if(e=o())return e.v;return!1}Zs(t){if(this.isEnabled&&"pointercancel"!==t.type)if("pointerdown"!==t.type){var i=this.Us;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.zs():"pointerup"===t.type&&(i.released=!0,this.Ws=setTimeout(()=>this.zs(),0)))}else{var e;this.zs();var r=cn(t);t.isPrimary&&0===t.button&&!t.ctrlKey&&r&&sn(r)&&(this.Us={target:r,excluded:this.Vs(r),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null==(e=this.Js)?void 0:e.distinctId})}else this.zs()}Qs(t){var i,e=this.Us;this.zs();var r=cn(t);if(null!=e&&e.released&&e.target.isConnected&&e.distinctId===(null==(i=this.Js)?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&&(nn(r,"html")||nn(r,"body"))){var s;if(e.excluded)return null;var n=null!==(s=this.Gs().css_selector_ignorelist)&&void 0!==s?s:mn;return[r,null==Xt?void 0:Xt.documentElement,null==Xt?void 0:Xt.body].some(t=>{if(!t)return!1;var i=un(t);return hi(i,"ph-no-capture")||hi(i,"ph-sensitive")||!Tn(t)||Pn(t)||n.some(i=>pn(t,i))})?null:e.target}}constructor(t){this.Ks=t,this.name="autocapture",this.Xs=!1,this.Ys=null,this.eo=!1,this.io=!1,this.Rn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.ro=!1,this.Ks.refresh(this.Rn),this.rageclicks=new Bl(this.Rn.rageclick),this.no=null}setup(t){this.so(),this.Js=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.ro?i.dispose():(this.oo=i,this.startIfEnabled())}dispose(){var t;this.ro||(this.ro=!0,this.Js=void 0,null==(t=this.oo)||t.dispose(),this.oo=void 0,this.ao())}Gs(){return this.Ks.refresh(this.Rn),this.Rn}so(){var t,i;return this.Gs(),this.Rn.url_allowlist=null==(t=this.Rn.url_allowlist)?void 0:t.map(t=>new RegExp(t)),this.Rn.url_ignorelist=null==(i=this.Rn.url_ignorelist)?void 0:i.map(t=>new RegExp(t)),this.Rn}lo(){if(this.isBrowserSupported()){if(Kt&&Xt){var t=this.uo=t=>{t=t||(null==Kt?void 0:Kt.event);try{if("blur"===t.type)return void this.zs();if(0===t.type.indexOf("pointer"))return void this.Zs(t);var i="click"===t.type?this.Qs(t):void 0;if(Ti(i))return;this.ho(t,"$autocapture",i)}catch(t){zl.error("Failed to capture event",t)}};if(Es(Kt,"blur",t),Es(Xt,"submit",t,{capture:!0}),Es(Xt,"change",t,{capture:!0}),Es(Xt,"click",t,{capture:!0}),ps(["pointerdown","pointermove","pointerup","pointercancel"],i=>{Es(Xt,i,t,{capture:!0})}),this.Gs().capture_copied_text){var i=this.do=t=>{t=t||(null==Kt?void 0:Kt.event);try{this.ho(t,Ul)}catch(t){zl.error("Failed to capture clipboard event",t)}};Es(Xt,"copy",i,{capture:!0}),Es(Xt,"cut",i,{capture:!0}),Es(Xt,"paste",i,{capture:!0})}}}else zl.info("Disabling Automatic Event Collection because this browser is not supported")}ao(){this.zs(),this.uo&&(null==Kt||Kt.removeEventListener("blur",this.uo),ps(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==Xt||Xt.removeEventListener(t,this.uo,!0)}),null==Xt||Xt.removeEventListener("submit",this.uo,!0),null==Xt||Xt.removeEventListener("change",this.uo,!0),null==Xt||Xt.removeEventListener("click",this.uo,!0),this.uo=void 0),this.do&&(null==Xt||Xt.removeEventListener("copy",this.do,!0),null==Xt||Xt.removeEventListener("cut",this.do,!0),null==Xt||Xt.removeEventListener("paste",this.do,!0),this.do=void 0),this.Xs=!1}startIfEnabled(){this.isEnabled||this.zs(),!this.ro&&this.Js&&this.isEnabled&&!this.Xs&&(this.lo(),this.Xs=!0)}onRemoteConfig(t){if(!this.ro)if(this.eo=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.io=i.elementsChainAsString);var e,r=i.autocapture_opt_out;Oi(r)&&(null==(e=this.Js)||e.kv.set(b,r),this.Ys=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.no=t}getElementSelectors(t,i){var e,r=[];return null==(e=this.no)||e.forEach(e=>{var s;null==Xt||null==(s=Xt.querySelectorAll(e))||s.forEach(s=>{t!==s&&i!==s||hi(r,e)||r.push(e)})}),r}get isEnabled(){var t,i;if(this.ro)return!1;var e=null==(t=this.Js)?void 0:t.kv.get(b),r=this.Ys,s=this.Gs();if(!s.remoteRequestsDisabled&&!this.eo)return!1;var n=s.remoteRequestsDisabled&&!this.eo;if(Ti(r)&&!Oi(e)&&!n)return!1;var o=null!==(i=this.Ys)&&void 0!==i?i:!!e;return!!s.enabled&&!o}ho(t,i,e){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r=e||cn(t);on(r)&&(r=r.parentNode||null);var n,o=this.so();"$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())&&En(r,o.rageclick)&&this.ho(t,"$rageclick",e);var a=i===Ul,l=a?s({},o,{dom_event_allowlist:void 0}):o;if(r&&function(t,i,e,r,s,n){var o;if(!Kt||kn(t))return!1;if(null!=e&&e.url_allowlist&&!hn(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&hn(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=$n(t,r),h=l.parentIsUsefulElement,u=l.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(Ei(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(!_n(u,null==e?void 0:e.css_selector_allowlist))return!1;if(_n(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:mn))return!1;try{var d=Kt.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&&(fn.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:o.getCurrentUrl}})){var h,u=Vl(r,{e:t,maskAllElementAttributes:o.maskAllElementAttributes,maskAllText:o.maskAllText,elementAttributeIgnoreList:o.element_attribute_ignorelist,elementsChainAsString:this.io,disableCaptureUrlHashes:o.disableCaptureUrlHashes}),d=u.props;if(u.explicitNoCapture)return!1;var v=this.getElementSelectors(r,u.target);if(v&&v.length>0&&(d.$element_selectors=v),i===Ul){var c=t.type||"clipboard";if("paste"!==c){var f,p,_=null==Kt||null==(f=Kt.getSelection())?void 0:f.toString(),g=dn(_);if(!g)return!1;d.$selected_content=g,d.$clipboard_text_length=null!==(p=null==_?void 0:_.length)&&void 0!==p?p:0}d.$copy_type=c}return null==(h=this.Js)||h.capture(i,d).catch(t=>zl.error("Failed to capture event",t)),!0}}else this.zs()}isBrowserSupported(){return wi(null==Xt?void 0:Xt.querySelectorAll)}},Gl=class{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=Si(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.Fa(),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}},Kl=cs("[ExceptionAutocapture]"),Jl=()=>{},Yl=t=>{var i;if(wi(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Xl(t,i,e){try{if(!(i in t))return Jl;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 wi(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=Yl(e);n;){if(n.next===s)return void(n.next=r.next);n=Yl(e=n.next)}else t[i]=r.next}}catch(t){return Jl}}var Ql=cs("[TracingHeaders]"),Zl=cs("[Web Vitals]"),th=9e5,ih=["CLS","FCP","INP","LCP"],eh=["INP","LCP"],rh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],sh="disabled",nh="lazy_loading",oh=cs("[SessionRecording]"),ah=cs("[Heatmaps]");function lh(t){return Si(t)&&"clientX"in t&&"clientY"in t&&Ri(t.clientX)&&Ri(t.clientY)}var hh=cs("[Product Tours]"),uh=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(T))},dh=cs("[SiteApps]"),vh="Error while initializing PostHog app with config id ",ch=(t,i)=>null!=t&&t.then?t.then(i):i(t),fh="SDK is not enabled or survey functionality is not yet loaded",ph="Disabled. Not loading surveys.",_h=class{constructor(t,i){this.Ks=t,this.Ju=i,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Qu=!1,this.Ku=[],this.Xu=null,this.Yu=null,this.ro=!1,this.th=new Set,this.onRemoteConfig=t=>{if(!this.ro&&!this.Rn.disableSurveys){if(!t.ok)return dl.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(Pi(i))return dl.warn("Flags not loaded yet. Not loading surveys.");this.eh=Oi(i)?i:i.length>0,dl.info("flags response received, isSurveysEnabled: "+this.eh),this.loadIfEnabled()}}}setup(t){if(!this.ro)return this.ih=t,ch(t.kv.initialize(),()=>{if(this.ih===t&&!this.ro){this.ih=void 0,this.Js=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.ro?i.dispose():(this.oo=i,this.loadIfEnabled())}})}dispose(){var t,i,e;this.ro||(this.ro=!0,this.ih=void 0,this.Js=void 0,null==(t=this.oo)||t.dispose(),this.oo=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.Ku=[],this.Xu=null,this.th.forEach(t=>clearTimeout(t)),this.th.clear())}get Rn(){return this.Ks.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.ro&&this.Js){var t=this.Rn;if(!this._surveyManager)if(this.Qu)dl.info("Already initializing surveys, skipping...");else if(t.disableSurveys)dl.info(ph);else if(t.cookielessMode&&this.Ks.isOptedOut())dl.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Ks.getExtensions();if(i){if(!Ei(this.eh)||t.advancedEnableSurveys){var e=this.eh||t.advancedEnableSurveys;this.Qu=!0;try{var r=i.generateSurveys;if(r)return this.rh(r,e),void(this.Qu=!1);var s=i.loadExternalDependency;if(!s)return this.nh(Lt),void(this.Qu=!1);s(t=>{try{if(this.ro)return;var i=this.Ks.getExtensions();t||null==i||!i.generateSurveys?this.nh("Could not load surveys script",t):this.rh(i.generateSurveys,e)}finally{this.Qu=!1}})}catch(t){throw this.Qu=!1,this.nh("Error initializing surveys",t),t}}}else dl.error("PostHog Extensions not found.")}}}rh(t,i){this.ro||(this._surveyManager=t(i),this._surveyEventReceiver=this.Ks.createEventReceiver(),dl.info("Surveys loaded successfully"),this.sh({isLoaded:!0}))}nh(t,i){dl.error(t,i),this.sh({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ku.push(t),this._surveyManager&&this.sh({isLoaded:!0}),()=>{this.Ku=this.Ku.filter(i=>i!==t)}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.Js)&&void 0!==e?e:this.Ju;if(r&&!this.ro){if(this.Rn.disableSurveys)return dl.info(ph),t([]);var s=r.kv.get(et);if(s&&!i)return t(s,{isLoaded:!0}),void(this.oh()&&this.getSurveys(()=>{},!0));if(this.Xu)this.Xu.then(i=>{this.ro||t(i.surveys,i.context)}).catch(t=>dl.error("Error in survey callback",t));else{var n=this.ah("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.Rn.requestTimeoutMs}).then(t=>{try{return this.uh(r,t)}catch(t){return dl.error("Error processing surveys response",t),this.uh(r,{statusCode:0,error:t})}},t=>this.uh(r,{statusCode:0,error:t}));this.Xu=n;var o=()=>{this.Xu===n&&(this.Xu=null)};n.then(i=>{o(),this.ro||t(i.surveys,i.context)},o).catch(t=>dl.error("Error in survey callback",t))}}}ah(t,i){var e=this.Js;return e?e.sendRequest(t,i):new Promise(t=>t({statusCode:0,error:new Error(fh)}))}uh(t,i){var e;if(this.ro)return{surveys:[],context:{isLoaded:!1,error:fh}};var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return 0!==r?dl.error(s):i.error||dl.warn(s),this.Yu=Date.now(),{surveys:[],context:{isLoaded:!1,error:s}}}this.Yu=null;var n=i.json.surveys||[],o=n.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(tl(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({[et]:n,[rt]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}oh(){return this.hh()&&!this.Xu&&!this.dh()}hh(){var t,i,e=null==(t=null!==(i=this.Js)&&void 0!==i?i:this.Ju)?void 0:t.kv.get(rt);return Ri(e)&&Date.now()-e>3e5}dh(){return Ri(this.Yu)&&3e5>Date.now()-this.Yu}markSurveyAsSeen(t,i){var e;vl({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){}}sh(t){for(var i of this.Ku)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){dl.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!Pi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);dl.warn("init was not called")}fh(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}ph(t){if(Pi(this._surveyManager))return{eligible:!1,reason:fh};var i="string"==typeof t?this.fh(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}gh(t){if(Pi(this._surveyManager))return{eligible:!1,reason:fh};var i="string"==typeof t?this.fh(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Pi(this._surveyManager))return dl.warn("init was not called"),{visible:!1,disabledReason:fh};var i=this.gh(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return Pi(this._surveyManager)?(dl.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:fh})):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.gh(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))dl.warn("init was not called");else{var s="string"==typeof t?this.fh(t):t;if(null!=s&&s.id)if(cl.includes(s.type)){var n=null==Xt?void 0:Xt.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){dl.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout(()=>{var t,i;this.th.delete(o),this.ro||(dl.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),dl.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this.th.add(o)}else this._surveyManager.renderSurvey(s,n,e);else dl.warn("Survey element not found")}else dl.warn("Surveys of type "+s.type+" cannot be rendered in the app");else dl.warn("Survey not found")}}displaySurvey(t,i){var e;if(Pi(this._surveyManager))dl.warn("init was not called");else{var r=this.fh(t);if(r){var n=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=s({},r,{appearance:s({},r.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==jo.Popover&&i.initialResponses&&dl.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.ph(r);if(!o.eligible)return void dl.warn("Survey is not eligible to be displayed: ",o.reason)}i.displayType!==jo.Inline?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else dl.warn("Survey not found")}}cancelPendingSurvey(t){Pi(this._surveyManager)?dl.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 mh=class{constructor(t){this._instance=t,this.mh=new Set,this.yh=new Set,this.bh=new Ga,this._h=(t,i)=>this.wh(t,i)&&this.kh(t,i)&&this.Sh(t,i)&&this.xh(t,i),this.wh=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;Ei(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Ch=null==(i=this._instance)?void 0:i._addCaptureHook((t,i)=>{this.on(t,i)}))}dispose(){var t;null==(t=this.Ch)||t.call(this),this.Ch=void 0,this.bh=new Ga}register(t){var i,e;if(!Ei(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach(t=>{var i;this.mh.add(t),null==(i=t.steps)||i.forEach(t=>{this.yh.add((null==t?void 0:t.event)||"")})}),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.mh.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.mh.clear(),this.yh.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.yh.has(t)||this.yh.has(i.event))&&this.mh.forEach(t=>{this.Th(i,t)&&this.bh.emit("actionCaptured",t.name)})}Mh(t){this.onAction("actionCaptured",i=>t(i))}Th(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this._h(t,e))return!0;return!1}onAction(t,i){return this.bh.on(t,i)}kh(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}Sh(t,i){return!!this.Ih(t,i)&&!!this.Eh(t,i)&&!!this.Rh(t,i)}Ih(t,i){var e;if(null==i||!i.href)return!0;var r=this.Ah(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")}Eh(t,i){var e;if(null==i||!i.text)return!0;var r=this.Ah(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)))}Rh(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}Ah(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}xh(t,i){return null==i||!i.properties||0===i.properties.length||sl(i.properties.reduce((t,i)=>{var e=yi(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)}},bh=class{constructor(t){var i;this.Ph=[],this._instance=t,this.Fh=new Map,this.Oh=new Map,this.$h=new Map,this.Dh=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId(t=>this.Lh(t))}Nh(t){return!1}qh(){return null}jh(t){}Bh(){}Hh(t,i){return!!t&&sl(t.propertyFilters,null==i?void 0:i.properties)}zh(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}Uh(t,i,e){var r=(e===Mo.Activation?this.Fh:this.Oh).get(t),s=[];return this.Wh(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.Hh(n,i)})}register(t){this.Vh(t,!1)}replace(t){this.Vh(t,!0)}Vh(t,i){var e;Ei(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Gh(t,i),this.Zh(t,i))}Zh(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.$h.clear(),0!==e.length){this.Jh||(this.Jh=new mh(this._instance),this.Jh.init(),this.Jh.Mh(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.$h.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.$h.set(i.name,s)}})}),i?this.Jh.replace(r):this.Jh.register(r)}else{var s;i&&(null==(s=this.Jh)||s.replace([]))}}Qh(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)})}Gh(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.zh(t,Mo.Activation),a=this.zh(t,Mo.Cancellation);i?(this.Fh=o,this.Oh=a):(this.Qh(this.Fh,o),this.Qh(this.Oh,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.Ch)&&void 0!==e||(this.Ch=null==(r=this._instance)?void 0:r._addCaptureHook((t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,r,s=this.Kh(),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.Xh(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Yh([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.td(n),void this.ed([n])}if(this.Oh.has(t)){var a=this.Uh(t,i,Mo.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map(t=>t.id)}),this.Yh(a.map(t=>t.id)),a.forEach(t=>this.rd(t.id)))}if(this.Fh.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.Fh.get(t)});var l=this.Uh(t,i,Mo.Activation);this.nd(l.map(t=>t.id))}}onAction(t){this.$h.has(t)&&this.nd(this.$h.get(t)||[])}nd(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.Nh(s)?this.td(s)&&this.sd(s):r.push(s);r.length>0&&(this.Ph=[...new Set([...this.Ph,...r])]),this.Kh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}td(t){this.Ph=this.Ph.filter(i=>i!==t);var i=this.od();return!i.includes(t)&&(this.ad([...i,t]),this.ld(),!0)}Yh(t){var i=new Set(t);this.Ph=this.Ph.filter(t=>!i.has(t));var e=this.ud(),r=e.filter(t=>!i.has(t));r.length!==e.length&&(this.ad(r),0===r.length&&this.hd()),this.ed(t)}dd(){var t,i=this.qh();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}sd(t){if(this.qh()){var i=this.dd();this.jh(s({},i,{[t]:Date.now()}))}}ed(t){if(this.qh()){var i=this.dd(),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.Bh():this.jh(e))}}vd(){this.qh()&&this.Bh()}getActivationTimestamp(t){if(this.od().includes(t)){var i=this.dd()[t];return Ri(i)?i:void 0}}ud(){var t,i=this.fd();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}od(){var t,i,e=this.ud();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.pd()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}ld(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.gd(i)}hd(){this.md()}Lh(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.pd()];if(e&&e!==t){var r=this.ud(),s=this.dd();r.length>0&&(this.ad([]),r.filter(t=>Ri(s[t])).forEach(t=>this.rd(t))),this.hd(),this.vd()}}getActivatedIds(){return[...new Set([...this.od(),...this.Ph])].filter(t=>!this.yd(t))}dispose(){var t,i,e;null==(t=this.Dh)||t.call(this),this.Dh=void 0,null==(i=this.Ch)||i.call(this),this.Ch=void 0,null==(e=this.Jh)||e.dispose(),this.Jh=void 0}reset(){this.Ph=[],this.ud().length>0&&this.ad([]),this.hd(),this.vd()}getEventToItemsMap(){return this.Fh}bd(){return this.Jh}},yh=class extends bh{constructor(t){super(t)}fd(){return st}pd(){return nt}qh(){return ot}jh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[ot]:t})}Bh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(ot)}Nh(t){var i,e;this.Wh(i=>{e=i.find(i=>i.id===t)});var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return Ri(r)&&r>0}_d(){return No.SHOWN}Wh(t){var i;null==(i=this._instance)||i.getSurveys(t)}rd(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}Kh(){return dl}ad(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[st]:t})}gd(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[nt]:t})}md(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(nt)}yd(){return!1}Xh(t,i){var e;return this.Wh(t=>{e=t.find(t=>t.id===i)}),!e||function(t){var i;return tl(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e)?t===No.SHOWN?"consume":"ignore":t===No.SHOWN?"persist":t===No.DISMISSED||t===No.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},wh=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);Ei(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)}},Sh=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==oi?void 0:oi.__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 yh(this._instance)}},xh=null!=Kt&&Kt.location?no(Kt.location.hash,"__posthog")||no(location.hash,"state"):null,Eh="_postHogToolbarParams",kh=cs("[Toolbar]"),$h=cs("[FeatureFlags]"),Th=class{constructor(t,i){void 0===i&&(i=!1),this.wd=!1,this.update(t,i)}update(t,i){this.kd=((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:yi(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.wd||($h.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.wd=!0),Ei(t.flag_keys)||yi(t.flag_keys)||$h.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.kd}},Ph=cs("[FeatureFlags]"),Rh=cs("[FeatureFlags]",{debugEnabled:!0}),Ch="\" failed. Feature flags didn't load in time.",Oh="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},Fh=t=>Di(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Mh=cs("[Error tracking]"),Dh="webkit-masked-url:",Nh=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Lh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Dh],jh=["__firefox__","__gCrWeb"],Bh="Refusing to render web experiment since the viewer is a likely bot",Uh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>il(i,t),not_regex:(t,i)=>!il(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},zh=cs("[Conversations]"),Hh="Conversations not available yet.";function qh(t,i){var e,r,n,o,a,l,h,u=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,d=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,v=null!=i&&i.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,c=Ei(v)?Math.max(d,2048):Math.max(d,v),f=s({},function(){var t="",i="";try{var e=null==Yt?void 0:Yt.userAgent;if(e){var r=ze(e);t=r[0],i=r[1]}}catch(t){}return function(t,i){var e=function(t){if(t)return{}.hasOwnProperty.call(Zr,t)?Zr[t]:t}(t);return s({},e?{"os.name":e}:{},i?{"os.version":i}:{})}(t,i)}(),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==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 Vh=["debug","log","warn","error","info"],Wh="console",Gh="__posthogHandledLogsRequestError",Kh=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[Gh]=!0,e},Jh=t=>!!t&&"object"==typeof t&&!0===t[Gh],Yh={featureFlags:class{constructor(t){this.name="featureFlags",this.Sd=!1,this.featureFlagEventHandlers=[],this.A=Ph,this.xd={},this.Cd={},this.Td=[],this.Md=!1,this.Id=!1,this.Ed=0,this.Rd=!1,this.Ad=!1,this.Pd=!1,this.Fd=!1,this.Od=0,this.nr=()=>{var t=this.$d();this.Od=0,t&&this.reloadFeatureFlags()},this.Dd=()=>{var t,i=this.Ld;Ei(i)||this.Rn.remoteRequestsDisabled||!Xt||"hidden"===Xt.visibilityState||Date.now()-(null!==(t=this.Nd)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.qd())},this.ar=()=>{"visible"===(null==Xt?void 0:Xt.visibilityState)&&this.Dd()},"get"in t?this.Ks=t:(this._instance=t,this.jd=new Th(t.config,t.Fa()),this.Ks=this.jd)}updateConfig(t,i){var e;null==(e=this.jd)||e.update(t,i),this.Js&&this.Bd()}setup(t){return this.ih=t,this.A=t.logger.createLogger("[FeatureFlags]"),ch(t.kv.initialize(),()=>{this.ih===t&&(this.ih=void 0,this.Js=t,this.Hd(t))})}Hd(t){var i;if(this.Js===t)return Kt&&Es(Kt,"online",this.nr),this.Bd(),this.zd=t.registerDynamicEventProperties(()=>this.Ud()?this.xd:this.Cd),this.Wd=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.onCrossTabFeatureFlagChange(()=>{this.Vd(),this.Gd(),this.Zd()}),this.Gd(),this.initialize()}Bd(){var t=this.Rn.refreshIntervalMs,i=!this.Rn.remoteRequestsDisabled&&Xt&&!Ei(t)&&t>0?t:void 0;i!==this.Ld&&(this.Jd(),Ei(i)||(this.Ld=i,this.qd(),null!=Xt&&Xt.addEventListener&&Es(Xt,zt,this.ar)))}qd(){Ei(this.Ld)||(Ei(this.Qd)||clearInterval(this.Qd),this.Nd=Date.now(),this.Qd=setInterval(this.Dd,this.Ld))}Jd(){Ei(this.Qd)||(clearInterval(this.Qd),this.Qd=void 0,null==Xt||null==Xt.removeEventListener||Xt.removeEventListener(zt,this.ar)),this.Ld=void 0,this.Nd=void 0}destroy(){this.Kd()}dispose(){this.Kd()}Kd(){var t,i;this.Jd(),this.Ed++,this.Ad=!1,this.ih=void 0,this.Js&&(this.Xd(),null==(t=this.zd)||t.dispose(),this.zd=void 0,null==(i=this.Wd)||i.call(this),this.Wd=void 0,this.Td=[],null==Kt||Kt.removeEventListener("online",this.nr),this.Js=void 0)}get Rn(){return this.Ks.get()}Yd(t){var i;return this.tv&&t in this.tv?this.tv[t]:null==(i=this.Js)?void 0:i.kv.get(t)}Vd(){return!!this.tv&&(this.tv=void 0,!0)}ev(){var t;return!Ei(null==(t=this.Js)?void 0:t.kv.get("$enabled_feature_flags"))&&this.Vd()}Ot(t){this.iv(()=>{var i;return null==(i=this.Js)?void 0:i.kv.set(t)})}rv(t,i,e){var r;if(null!=(r=this._instance)&&r.persistence&&t.$enabled_feature_flags){var s=this.Yd("$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&&!yi(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.Yd("$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,_={[V]:f,[q]:f,[K]:p};for(var g of(t.$feature_flag_details&&(_[G]=f),[J,gt,Y]))Ei(t[g])||(_[g]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(_)}}Dt(t){this.iv(()=>{var i;return null==(i=this.Js)?void 0:i.kv.remove(t)})}iv(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Gd(){var t={};for(var i of[V,K,J,X]){var e=this.Yd(i);Ei(e)||(t[i]=e)}this.xd=t;var r=s({},t),n=this.Yd(q);if(n)for(var o of Object.entries(n))r["$feature/"+o[0]]=o[1];this.Cd=r}Ud(){var t=this.Rn.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Yd(gt);return"number"!=typeof i||Date.now()-i>t}nv(){return!!this.Ud()&&(this.Fd||this.Id||(this.Fd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}sv(){var t=this.Rn.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}):[]}ov(){var t=this.Rn.flagKeys;if(!Ei(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.Rn,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=>!Ei(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.av({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(t,i,e){var r,n,o=null!=e&&e.merge&&null!==(r=this.Yd("$enabled_feature_flags"))&&void 0!==r?r:{},a=null!=e&&e.merge&&null!==(n=this.Yd("$feature_flag_payloads"))&&void 0!==n?n:{},l=s({},o,t),h=s({},a,i),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Dr(c),variant:Nr(c),reason:void 0,metadata:Ei(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.av({flags:u})}get hasLoadedFlags(){return this.Md}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Yd(G),i=this.Yd(X),e=this.Yd(Q);if(!e&&!i)return t||{};var r=_s({},t||{});for(var n of[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])]){var o,a,l=r[n],h=null==i?void 0:i[n],u=Ei(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=Ei(h)?null==l?void 0:l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=s({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=s({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.Sd||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.Sd=!0),r}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{var r=t[e];return{key:e,enabled:Dr(r),variant:Nr(r),payload:Mr(i[e])}})}getFlagVariants(){var t=this.Yd(q),i=this.Yd(X);if(!i)return t||{};for(var e=_s({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.Sd||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.Sd=!0),e}getFlagPayloads(){var t=this.Yd(K),i=this.Yd(Q);if(!i)return t||{};for(var e=_s({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.Sd||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.Sd=!0),e}reloadFeatureFlags(){this.Rd||this.Rn.featureFlagsDisabled||this.$d()||(this.Id&&(this.Ad=!0),this.lv||(this.Td.slice().forEach(t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.lv=setTimeout(()=>{this.uv()},5)))}Xd(){clearTimeout(this.lv),this.lv=void 0}onReloading(t){return this.Td.push(t),()=>{this.Td=this.Td.filter(i=>i!==t)}}ensureFlagsLoaded(){this.Md||this.Id||this.lv||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Rd=t}resetFlagCallReported(){this.Dt(ft)}uv(t){this.Xd();var i=this.Js;if(i&&!this.Rn.remoteRequestsDisabled&&!this.$d())if(this.Id)this.Ad=!0;else{var e={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:s({},i.initialPersonProperties,this.Yd("$stored_person_properties")||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Yd(tt),timezone:wo()};Ei(i.deviceId)||(e.$device_id=i.deviceId),(null!=t&&t.disableFlags||this.Rn.featureFlagsDisabled)&&(e.disable_flags=!0);var r=this.sv();r.length&&(e.evaluation_contexts=r);var n=this.ov();Ei(n)||(e.flag_keys=n);var o=this.Rn.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.Ed;this.Id=!0;var h=()=>{this.Ad&&(this.Ad=!1,this.uv())},u=t=>{this.Id=!1,l===this.Ed?(this.Ot({[_t]:[Oh]}),this.A.error("Feature flag request failed",t),this.ev()&&this.Zd(!0),h()):h()};try{i.sendRequest(a,{target:"flags",method:"POST",body:e,compression:this.Rn.compression,sentAt:"body",timeoutMs:this.Rn.requestTimeoutMs}).then(t=>{var i,r,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this.Id=!1,l===this.Ed){if(this.hv(t.statusCode),n||this.Ad||(this.$anon_distinct_id=void 0),!e.disable_flags||this.Ad){this.Pd=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Oh:"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.Ot({[_t]: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.av(s,n,{partialResponse:o}),h()}}else h()}).catch(u)}catch(t){u(t)}}}$d(){return oo(this.Od,3)}hv(t){this.Od=ao(t,this.Od,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.Pd)if(this.Md||this.getFlags()&&this.getFlags().length>0){if(!this.nv()){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.Pd)if(this.Md||this.getFlags()&&this.getFlags().length>0){if(!this.nv()){var e,r=this.getFlagVariants(),n=t in r,o=r[t],a=this.getFlagPayloads()[t],l=String(o),h=this.Yd("$feature_flag_request_id")||void 0,u=this.Yd("$feature_flag_evaluated_at")||void 0,d=this.Yd("$flag_call_reported")||{};if(this.Rn.deduplicateCallsPerSession){var v,c=null==(v=this.Js)?void 0:v.session.sessionId,f=this.Yd(pt);c&&c!==f&&(d={},e=c)}if(i.send_event||!("send_event"in i))if(t in d&&d[t].includes(l))e&&this.Ot({[ft]:d,[pt]:e});else{var p,_,g,m,b,y,w,S,x,E,k,T,P;yi(d[t])?d[t].push(l):d[t]=[l],this.Ot(s({[ft]:d},e?{[pt]:e}:{}));var R=this.getFeatureFlagDetails(t),C=[...null!==(p=this.Yd("$feature_flag_errors"))&&void 0!==p?p:[]];Ei(o)&&C.push("flag_missing");var O={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(_=null==(g=this.Rn.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(m=null==(b=this.Rn.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.Pd};Ei(null==R||null==(y=R.metadata)?void 0:y.has_experiment)||(O.$feature_flag_has_experiment=R.metadata.has_experiment),Ei(null==R||null==(w=R.metadata)?void 0:w.version)||(O.$feature_flag_version=R.metadata.version);var A=null!==(S=null==R||null==(x=R.reason)?void 0:x.description)&&void 0!==S?S:null==R||null==(E=R.reason)?void 0:E.code;A&&(O.$feature_flag_reason=A),null!=R&&null!=(k=R.metadata)&&k.id&&(O.$feature_flag_id=R.metadata.id),Ei(null==R?void 0:R.original_variant)&&Ei(null==R?void 0:R.original_enabled)||(O.$feature_flag_original_response=Ei(R.original_variant)?R.original_enabled:R.original_variant),null!=R&&null!=(T=R.metadata)&&T.original_payload&&(O.$feature_flag_original_payload=null==R||null==(P=R.metadata)?void 0:P.original_payload),C.length&&(O.$feature_flag_error=C.join(",")),this.dv(O)}else e&&this.Ot({[ft]:d,[pt]:e});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:Mr(a)}}}else this.A.warn('getFeatureFlagResult for key "'+t+Ch)}dv(t){try{var i;null==(i=this.Js)||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.vv(t,i)}vv(t,i){var e=this;return o(function*(){var r=e.Js;if(r){var s={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},n=e.sv();n.length&&(s.evaluation_contexts=n);var o,a=e.ov();Ei(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.Rn.compression,sentAt:"body",timeoutMs:e.Rn.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.Pd)return i.defaultValue;if(!(this.Md||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+Ch),i.defaultValue;var e=this.getFeatureFlag(t,i);return Ei(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.av(t,i,e)}av(t,i,e){if(this.Js){this.Md=!0;var r=function(t,i,e,r,n,o){void 0===i&&(i={}),void 0===e&&(e={}),void 0===r&&(r={}),void 0===o&&(o=Ph);var a=((t,i)=>{var e=t.flags;return e?s({},t,{featureFlags:Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return!Ei(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(yi(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{[V]:h,[q]:c,[Y]:!1}}var p=h,_=u,g=l;if(null!=n&&n.partialResponse){var m=Object.keys(p),b=_||{};p=s({},i,p),_=s({},e,b),m.forEach(t=>{var i;t in b||null==(i=_)||delete i[t]}),g=s({},r,g)}else if(t.errorsWhileComputingFlags)if(l){var y=new Set(Object.keys(l).filter(t=>{var i;return!(null!=(i=l[t])&&i.failed)}));p=s({},i,Object.fromEntries(Object.entries(p).filter(t=>y.has(t[0]))));var w=Object.fromEntries(Object.entries(_||{}).filter(t=>y.has(t[0])));_=s({},e,w),y.forEach(t=>{var i;t in w||null==(i=_)||delete i[t]}),g=s({},r,Object.fromEntries(Object.entries(g||{}).filter(t=>y.has(t[0]))))}else p=s({},i,p),_=s({},e,_),g=s({},r,g);return s({[V]:Object.keys(Ih(p)),[q]:p||{},[K]:_||{},[G]:g||{},[Y]:!0===t.minimalFlagCalledEvents},d?{[J]:d}:{},v?{[gt]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.A);if(r)if(!1===(null==e?void 0:e.persist)){var n=!Ei(this.Js.kv.get(q));this.tv=r,n||this.Ot(r)}else this.Vd(),this.rv(r,t,!(null==e||!e.partialResponse)),this.Ot(r);else i&&this.ev();i||(this.Fd=!1),this.Zd(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.fv(t)}fv(t){if(this.Js){if(!1===t)return this.Dt([X,Q]),this.Zd(),void Rh.info("All overrides cleared");if(yi(t))return this.Ot({[X]:Ah(t)}),this.Zd(),void Rh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.Sd=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[X]=yi(s)?Ah(s):s),n&&(r[Q]=n),Object.keys(r).length&&this.Ot(r),!1===s&&!1===n?this.Dt([X,Q]):!1===s?this.Dt(X):!1===n&&this.Dt(Q),this.Zd(),!1===s?Rh.info("Flag overrides cleared"):s&&Rh.info("Flag overrides set",{flags:s}),void(!1===n?Rh.info("Payload overrides cleared"):n&&Rh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.Ot({[X]:t}),this.Zd(),void Rh.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.Md){var i=this.pv(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,n=(this.Yd("$early_access_features")||[]).find(i=>i.flagKey===t),o={["$feature_enrollment/"+t]:i},a={$feature_flag:t,$feature_enrollment:i,$set:o};n&&(a.$early_access_feature_name=n.name),e&&(a.$feature_enrollment_stage=e);var l=s({},this.getFlagVariants(),{[t]:i});null==(r=this._instance)||null==(r=r.persistence)||r.markCrossTabFeatureFlagChanges({[V]:[t],[q]:[t],[Z]:Object.keys(o)}),this.Ot({[V]:Object.keys(Ih(l)),[q]:l,[Z]:s({},this.Yd("$stored_person_properties")||{},o)}),this.Zd();try{var h;null==(h=this.Js)||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.Yd(W);!r||i?this.gv(t,e):t(r)}gv(t,i){var e=this;return o(function*(){var r=e.Js;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.Ot({[W]: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)}}})()}pv(){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),{})}}Zd(t){this.Gd();var i=this.pv(),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.mv(t,i)}mv(t,i){void 0===i&&(i=!0);var e=this.Yd("$stored_person_properties")||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in e||(o[a]=n[a]));this.Ot({[Z]:s({},e,o,r)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=s({},this.Yd("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.Ot({[Z]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.Dt(Z),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.Yd("$stored_group_properties")||{},r=s({},e);for(var n of Object.keys(t))r[n]=s({},e[n],t[n]);this.Ot({[tt]:r}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Yd("$stored_group_properties")||{};this.Ot({[tt]:s({},i,{[t]:{}})})}else this.Dt(tt)}reset(){this.Ed++,this.Ad=!1,this.xd={},this.Cd={},this.tv=void 0,this.Md=!1,this.Rd=!1,this.Pd=!1,this.$anon_distinct_id=void 0,this.Xd(),this.Sd=!1,this.Od=0}}},Xh={sessionRecording:class{get Rn(){return this._instance.config}get sl(){return this._instance.persistence}get started(){var t;return!(null==(t=this.yv)||!t.isStarted)}get status(){var t,i;return"awaiting_config"===this.bv||"missing_config"===this.bv?this.bv:null!==(t=null==(i=this.yv)?void 0:i.status)&&void 0!==t?t:this.bv}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.bv=sh,this._v=void 0,this.wv=!1,this.Ke=(()=>{var t;if(null==Xt||!Xt.visibilityState||"visible"===Xt.visibilityState)return!0;var i=null==Kt||null==(t=Kt.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some(t=>"visible"===t.name)})(),this.ar=()=>{var t;"visible"===(null==Xt?void 0:Xt.visibilityState)&&(this.Ke=!0,null==(t=this.yv)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},!this._instance.sessionManager)throw oh.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Rn.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');null!=Xt&&Xt.addEventListener&&Es(Xt,"visibilitychange",this.ar)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.wv=!0,null==Xt||null==Xt.removeEventListener||Xt.removeEventListener("visibilitychange",this.ar),e?this.Sv(!0):this.stopRecording()}get xv(){var t,i=!(null==(t=this._instance.get_property(C))||!t.enabled),e=!this.Rn.disable_session_recording,r=this.Rn.disable_session_recording||this._instance.consent.isOptedOut();return Kt&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.wv||this.xv&&null!=(i=this.yv)&&i.isStarted)){var e=!Ei(Object.assign)&&!Ei(Array.from);this.xv&&e?(this.Cv(t),oh.info("starting")):(this.bv=sh,this.stopRecording())}}Cv(t){var i,e;if(this.xv)if("awaiting_config"!==this.bv&&"missing_config"!==this.bv&&(this.bv=nh),null!=oi&&null!=(i=oi.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=oi.__PosthogExtensions__)&&e.initSessionRecording)this.Tv(t);else{var r,s=this._instance.sessionManager;null==(r=oi.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Mv,i=>{if(!this.wv&&this.xv&&this._instance.sessionManager===s)return i?(this._instance.register_for_session({[Rt]:!0}),oh.error("could not load recorder",i)):void this.Tv(t);this.bv=sh})}}stopRecording(){var t,i;null==(t=this._v)||t.call(this),this._v=void 0,null==(i=this.yv)||i.stop()}Sv(t){var i,e;void 0===t&&(t=!1),null==(i=this._v)||i.call(this),this._v=void 0,null==(e=this.yv)||e.discard({discardProducerEvents:t})}Iv(){var t,i;null==(t=this.sl)||t.unregister(L),null==(i=this.sl)||i.unregister(A)}Ev(t,i){if(Pi(t))return null;var e,r=Ri(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(oh.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Rv(t){if(this.sl){var i,e,r=this.sl,n=()=>{var i,e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Ev(null==(i=this.Rn.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this.Ev(null==e?void 0:e.sampleRate,"remote config sampleRate"),a=null!=n?n:o;Pi(a)&&this.Iv();var l=null==e?void 0:e.minimumDurationMilliseconds;r.register({[C]:s({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:s({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:a,minimumDurationMilliseconds:Ei(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._v)||i.call(this),this._v=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.Rv(i),void this.Sv()):(this.Rv(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.bv&&(this.bv="missing_config",oh.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.yv)&&e.log?this.yv.log(t,i):oh.warn("log called before recorder was ready")}get Mv(){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"}Av(){var t,i=this._instance.get_property(C);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return oh.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}Tv(t){var i,e,r;if(!this.wv&&this.xv&&this._instance.sessionManager){if(null==(i=oi.__PosthogExtensions__)||!i.initSessionRecording)return oh.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Rt]:!0});var s;if(this.yv||(this.yv=null==(s=oi.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.Ke),this.yv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Av()){if("missing_config"===this.bv||"awaiting_config"===this.bv)return;return this.bv="awaiting_config",oh.info("persisted remote config is stale, requesting fresh config before starting"),void new Wo(this._instance).load()}this.bv=nh,null==(e=(r=this.yv).setDocumentWasEverVisible)||e.call(r,this.Ke),this.yv.start(t)}else this.bv=sh}onRRwebEmit(t){var i;null==(i=this.yv)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.yv||null==(t=this.sl)||t.register({[F]:!0}),null==(i=this.yv)||i.overrideLinkedFlag()}overrideSampling(){var t,i;this.yv||null==(t=this.sl)||t.register({[I]:!0}),null==(i=this.yv)||i.overrideSampling()}overrideTrigger(t){var i,e;this.yv||null==(i=this.sl)||i.register({["url"===t?M:D]:!0}),null==(e=this.yv)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.yv)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.yv)||!e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t;null==(t=this.yv)||null==t.flushBeforeIdentityReset||t.flushBeforeIdentityReset()}}},Qh={autocapture:class extends Wl{constructor(t){super(new Gl(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.Pv=this.Fv()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.Ov();return!!(t.path||t.search||this.$v(t))}startIfEnabled(){this.isEnabled&&(vs.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Pv=this.Fv(),this.startIfEnabled()}stop(){this.Dv&&this.Dv(),this.Dv=void 0,this.Lv&&this.Lv(),this.Lv=void 0,vs.info("History API monitoring stopped")}monitorHistoryChanges(){Kt&&Kt.history&&(this.Nv("pushState"),this.Nv("replaceState"),this.qv(),this.$v()&&this.jv())}Nv(t){var i;if(Kt&&(null==(i=Kt.history[t])||!i.__posthog_wrapped__)){var e=this;Xl(Kt.history,t,i=>function(r,s,n){i.call(this,r,s,n),e.Bv(t)})}}Fv(){var t=null==Kt?void 0:Kt.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Ov(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:Si(t)?t:{}}$v(t){return void 0===t&&(t=this.Ov()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}Hv(t){var i=this.Ov(),e=this.Pv;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.$v(i)&&t.hash!==e.hash))}Bv(t){try{var i=this.Fv();if(!i)return;this.Hv(i)&&this._instance.capture(qt,{navigation_type:t}),this.Pv=i}catch(i){vs.error("Error capturing "+t+" pageview",i)}}qv(){if(!this.Dv){var t=()=>{this.Bv("popstate")};Es(Kt,"popstate",t),this.Dv=()=>{Kt&&Kt.removeEventListener("popstate",t)}}}jv(){if(!this.Lv){var t=()=>{this.Bv("hashchange")};Es(Kt,"hashchange",t),this.Lv=()=>{Kt&&Kt.removeEventListener("hashchange",t)}}}},heatmaps:class{get Rn(){return this.instance.config}constructor(t){var i;this.zv=!1,this.Xs=!1,this.Uv=null,this.instance=t,this.zv=!(null==(i=this.instance.persistence)||!i.props[y]),this.rageclicks=new Bl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Si(this.Rn.capture_heatmaps)&&this.Rn.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rn.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Pi(this.Rn.capture_heatmaps)?Pi(this.Rn.enable_heatmaps)?this.zv:this.Rn.enable_heatmaps:!1!==this.Rn.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Xs)return;ah.info("starting..."),this.Wv(),this.ar()}else{var t;clearInterval(null!==(t=this.Uv)&&void 0!==t?t:void 0),this.Vv(),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({[y]:e}),this.zv=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.Rt;return this.Rt=void 0,t}Gv(t){lh(t.originalEvent)&&this.vn(t.originalEvent,"deadclick")}ar(){this.Uv&&clearInterval(this.Uv),this.Uv="visible"===(null==Xt?void 0:Xt.visibilityState)?setInterval(this.Ja.bind(this),this.flushIntervalMilliseconds):null}Wv(){Kt&&Xt&&(this.Zv=this.Ja.bind(this),Es(Kt,Ht,this.Zv),this.Jv=t=>this.vn(t||(null==Kt?void 0:Kt.event)),Es(Xt,"click",this.Jv,{capture:!0}),this.Qv=t=>this.Kv(t||(null==Kt?void 0:Kt.event)),Es(Xt,"mousemove",this.Qv,{capture:!0}),this.Xv=new qn(this.instance,zn,this.Gv.bind(this)),this.Xv.startIfEnabledOrStop(),this.Yv=this.ar.bind(this),Es(Xt,zt,this.Yv),this.Xs=!0)}Vv(){var t;Kt&&Xt&&(this.Zv&&Kt.removeEventListener(Ht,this.Zv),this.Jv&&Xt.removeEventListener("click",this.Jv,{capture:!0}),this.Qv&&Xt.removeEventListener("mousemove",this.Qv,{capture:!0}),this.Yv&&Xt.removeEventListener(zt,this.Yv),clearTimeout(this.tc),null==(t=this.Xv)||t.stop(),this.Xs=!1)}ec(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&&sn(r)&&!nn(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:Kt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(hi(i,s))return!0;r=gn(r)}return!1}(cn(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:e),target_fixed:n,type:i}}vn(t,i){var e;if(void 0===i&&(i="click"),!rn(t.target)&&lh(t)){var r=this.ec(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&En(cn(t),this.instance.config.rageclick)&&this.$s(s({},r,{type:"rageclick"})),this.$s(r)}}Kv(t){!rn(t.target)&&lh(t)&&(clearTimeout(this.tc),this.tc=setTimeout(()=>{this.$s(this.ec(t,"mousemove"))},500))}$s(t){if(Kt){var i=this.Rn.disable_capture_url_hashes?ir(Kt.location.href):Kt.location.href,e=this.Rn.custom_personal_data_properties,r=so(i,this.Rn.mask_personal_data_properties?[...lo,...e||[]]:[],uo);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(t)}}Ja(){this.Rt&&!xi(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:qn,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this.zv=!1,this.Xs=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.rc=()=>{clearTimeout(this.nc),this.nc=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",s({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,i)=>s({},t,{["$web_vitals_"+i.name+"_event"]:s({},i),["$web_vitals_"+i.name+"_value"]:i.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.sc=t=>{var i;if(this.Rt=this.Rt||{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,r=this.oc(e);if(!Ei(r)){var n=Ri(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+r;if(!this.ac||this.ac>t.value){this.Rt.navigationKey!==n&&(this.rc(),this.nc=setTimeout(this.rc,this.flushToCaptureTimeoutMs)),Ei(this.Rt.navigationKey)&&(this.Rt.navigationKey=n,this.Rt.url=r),this.Rt.firstMetricTimestamp=Ei(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;var o=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),a=s({},t,e?{navigationURL:r}:{},{$current_url:r,timestamp:Date.now()});if(delete a.entries,Si(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of rh){var u="url"===h&&"string"==typeof t.attribution[h]?this.oc(t.attribution[h]):t.attribution[h];Ei(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;Ei(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.Rt.metrics.push(a),this.Rt.metrics.length===this.allowedMetrics.length&&this.rc()}else Zl.error("Ignoring metric with value >= "+this.ac,t)}}},this.lc=()=>{if(!this.Xs){var t,i,e,r,n=!1,o=oi.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.uc])||("web-vitals"===this.uc&&Ei(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!Ei(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!Ei(h),t=u.indexOf("LCP")>-1?l.onLCP:(null==h?void 0:h.onLCP)||l.onLCP,i=u.indexOf("CLS")>-1?l.onCLS:(null==h?void 0:h.onCLS)||l.onCLS,e=u.indexOf("FCP")>-1?l.onFCP:(null==h?void 0:h.onFCP)||l.onFCP,r=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&i&&e&&r){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?s({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.sc.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.sc.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&e(this.sc.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&r(this.sc.bind(this),v),this.Xs=!0}else Zl.error("web vitals callbacks not loaded - not starting")}},this.zv=!(null==(i=this._instance.persistence)||!i.props[E]),this.startIfEnabled()}get hc(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=Si(this.hc)?null==(t=this.hc)?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)||ih:e}get flushToCaptureTimeoutMs(){return(Si(this.hc)?this.hc.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=Si(this.hc)?this.hc.web_vitals_attribution:void 0;return Oi(t)?t?ih:[]:yi(t)?t:eh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t;return null!==(t=Si(this.hc)?this.hc.__preview_web_vitals_soft_navs:void 0)&&void 0!==t&&t}get ac(){var t=Si(this.hc)&&Ri(this.hc.__web_vitals_max_value)?this.hc.__web_vitals_max_value:th;return t>0&&6e4>=t?th:t}get isEnabled(){var t=null==Qt?void 0:Qt.protocol;if("http:"!==t&&"https:"!==t)return Zl.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=Si(this.hc)?this.hc.web_vitals:Oi(this.hc)?this.hc:void 0;return Oi(i)?i:this.zv}startIfEnabled(){this.isEnabled&&!this.Xs&&(Zl.info("enabled, starting..."),this.bo(this.lc))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=Si(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=Si(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[E]:e}),this._instance.persistence.register({[R]:r})),this.zv=e,this.startIfEnabled()}}}get uc(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}bo(t){var i=oi.__PosthogExtensions__,e=this.uc,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&Ei(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()})}oc(t){var i=t||(null==Kt?void 0:Kt.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?ir(i):i,r=this._instance.config.custom_personal_data_properties;return so(e,this._instance.config.mask_personal_data_properties?[...lo,...r||[]]:[],uo)}Zl.error("Could not determine current URL")}}},Zh={exceptionObserver:class{constructor(t){var i;this.lc=()=>{var t;if(Kt&&this.isEnabled&&null!=(t=oi.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=oi.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=oi.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=oi.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.dc&&this.Rn.capture_unhandled_errors&&(this.dc=i(this.captureException.bind(this))),!this.vc&&this.Rn.capture_unhandled_rejections&&(this.vc=e(this.captureException.bind(this))),!this.cc&&this.Rn.capture_console_errors&&(this.cc=r(this.captureException.bind(this)))}catch(t){Kl.error("failed to start",t),this.fc()}}},this._instance=t,this.gc=!(null==(i=this._instance.persistence)||!i.props[w]),this.wt=new Hi(s({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,A:Kl})),this.Rn=this.mc(),this.startIfEnabledOrStop()}mc(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Si(t)?i=s({},i,t):(Ei(t)?this.gc:t)&&(i=s({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Rn.capture_console_errors||this.Rn.capture_unhandled_errors||this.Rn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Kl.info("enabled"),this.fc(),this.bo(this.lc)):this.fc()}bo(t){var i,e;null!=(i=oi.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=oi.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return Kl.error("failed to load script",i);t()})}fc(){var t,i,e;null==(t=this.dc)||t.call(this),this.dc=void 0,null==(i=this.vc)||i.call(this),this.vc=void 0,null==(e=this.cc)||e.call(this),this.cc=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.gc=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[w]:this.gc}),this.Rn=this.mc(),this.startIfEnabledOrStop())}}onConfigChange(){this.Rn=this.mc()}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 Kl.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.yc=[],this.bc=new or([new gr,new Tr,new br,new mr,new kr,new Er,new wr,new $r],function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];return function(i,r){void 0===r&&(r=0);for(var n=[],o=i.split("\n"),a=r;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=_r.test(l)?l.replace(_r,"$1"):l;if(!h.match(/\S*Error: /)){for(var u of e){var d=u(h,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return s({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",vr,pr)),this._instance=t,this.yc=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this._c=Ar(this.wc()),this.kc=new Ir(this._c)}onConfigChange(){this._c=Ar(this.wc()),this.kc.setConfig(this._c)}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.yc=n,this._instance.persistence&&this._instance.persistence.register({[S]:this.yc,[x]:o})}}}get Sc(){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.bc.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this._c.enabled)try{if(!ki(t)||0===t.trim().length)return void Mh.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.xc(i)),r=e.sanitizedProperties,n=e.droppedKeys;n.length>0&&Mh.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.kc.add(s({[Pr]:t,[Rr]:(new Date).toISOString()},r))}catch(t){Mh.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.Cc(i)){if(this.Tc(i))return this.Mc("Exception dropped: matched a suppression rule"),void Mh.info("Skipping exception capture because a suppression rule matched");if(!this.Sc&&this.Ic(i))return this.Mc("Exception dropped: thrown by a browser extension"),void Mh.info("Skipping exception capture because it was thrown by an extension");if(!this.Sc&&this.Ec(i))return this.Mc("Exception dropped: thrown by an injected browser script"),void Mh.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Rc(i))return this.Mc("Exception dropped: thrown by the PostHog SDK"),void Mh.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this._c.enabled&&Pi(t.$exception_steps)?this.Ac(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",Du:!0});return s&&this.kc.clear(),s}catch(t){return Fh(t)||Mh.error("Failed to capture exception event. Dropping this exception.",t),void this.kc.clear()}}catch(t){return void(Fh(t)||Mh.error("Failed to process exception event. Ignoring this exception.",t))}var n}Ac(t){try{var i=this.kc.getAttachable();return 0===i.length?t:s({},t,{$exception_steps:i})}catch(i){return Mh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Mc(t){this._c.enabled&&this.kc.add({[Pr]:t,[Rr]:(new Date).toISOString()})}xc(t){return Si(t)?s({},t):{}}wc(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}Tc(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.yc.some(t=>{var e=t.values.map(t=>{var e=rl[t.operator],r=i[t.key];if(!e||!r)return!1;var s=yi(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 Mh.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Ic(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&&Lh.some(t=>i.startsWith(t))});return 0!==e.length&&(!e.every(t=>{var i=t.filename;return!!i&&i.startsWith(Dh)})||t.some(t=>{var i=t.value;return"NoResponse"===t.type||ki(i)&&Nh.some(t=>{var e=t.value;return t.exact?i===e:i.includes(e)})})&&!i.some(t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith(Dh))}))}Ec(t){return t.some(t=>{var i=t.value;return ki(i)&&jh.some(t=>i.includes(t))})}Rc(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}Cc(t){return!Pi(t)&&yi(t)}}},tu=s({productTours:class{get sl(){return this._instance.persistence}constructor(t){this.Pc=null,this.Fc=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.sl&&this.sl.register({[T]:!!i.productTours}),!uh(this._instance))return!this.Pc&&Pi(null==(e=this.sl)?void 0:e.props.ph_product_tours)||hh.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.Pc)||r.stop(),this.Pc=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Pc&&uh(this._instance)&&this.bo(()=>this.Oc())}bo(t){var i,e;null!=(i=oi.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=oi.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",i=>{i?hh.error("Could not load product tours script",i):t()})}Oc(){var t;!this.Pc&&null!=(t=oi.__PosthogExtensions__)&&t.generateProductTours&&(this.Pc=oi.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!yi(this.Fc)||i){var e=this.sl;if(e){var r=e.props[at];if(yi(r)&&!i)return this.Fc=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(uh(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||hh.warn(s):hh.error(s),void t([],{isLoaded:!1,error:s})}var n=yi(i.json.product_tours)?i.json.product_tours:[];this.Fc=n,e&&e.register({[at]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Fc,{isLoaded:!0})}getActiveProductTours(t){Pi(this.Pc)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Pc.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.Pc)||i.showTourById(t)}previewTour(t){this.Pc?this.Pc.previewTour(t):this.bo(()=>{var i;this.Oc(),null==(i=this.Pc)||i.previewTour(t)})}dismissProductTour(){var t;null==(t=this.Pc)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Pc)||t.nextStep()}previousStep(){var t;null==(t=this.Pc)||t.previousStep()}clearCache(){var t;this.Fc=null,null==(t=this.sl)||t.unregister(at)}resetTour(t){var i;null==(i=this.Pc)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.Pc)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.Pc)||i.cancelPendingTour(t)}}},Yh),iu={siteApps:class{constructor(t){this._instance=t,this.$c=0,this.Dc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Lc(t,i){if(i){var e=this.globalsForEvent(i);this.Dc.push(e),this.Dc.length>1e3&&(this.Dc=this.Dc.slice(10))}}get siteAppLoaders(){var t;return null==(t=oi._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Lc.bind(this));this.Nc=()=>{t(),this.Dc=[],this.Nc=void 0}}}globalsForEvent(t){var i,n,o,a,l,h,u;if(!t)throw new Error("Event payload is required");var d={},v=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var f of Object.entries(c)){var p=f[0];d[p]={id:v[p],type:p,properties:f[1]}}var _=t.$set_once,g=t.$set;return{event:s({},r(t,e),{properties:s({},t.properties,g?{$set:s({},null!==(i=null==(n=t.properties)?void 0:n.$set)&&void 0!==i?i:{},g)}:{},_?{$set_once:s({},null!==(o=null==(a=t.properties)?void 0:a.$set_once)&&void 0!==o?o:{},_)}:{}),elements_chain:null!==(l=null==(h=t.properties)?void 0:h.$elements_chain)&&void 0!==l?l:"",distinct_id:null==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:d}}qc(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)||(dh.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)||(dh.error("prepare_external_dependency_script returned null"),null):t}jc(){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==Xt?void 0:Xt.defaultView,h=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!h)return()=>{};if(this.$c++,this.Bc)return this.Hc();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.qc(t);return i&&v.add(i),i},p=t=>t.map(t=>"string"==typeof t?t:f(t)).filter(t=>!Ti(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.Bc=()=>{u.forEach(t=>t()),this.Bc=void 0},this.Hc()}Hc(){var t=!1;return()=>{var i;t||(t=!0,this.$c--,0===this.$c&&(null==(i=this.Bc)||i.call(this)))}}zc(t,i){void 0===i&&(i=!0);var e=this.jc();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.Dc.length&&(dh.info("Processing "+this.Dc.length+" events for site app with id "+t.id),this.Dc.forEach(t=>this.zc(()=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null==(e=this.Nc)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,dh.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.zc(i=>t.init({posthog:this._instance,callback(t){i(),s(t)}}),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){dh.error(vh+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){dh.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}Uc(){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)}Wc(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.zc(()=>null==r.processEvent?void 0:r.processEvent(e))}catch(i){dh.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.Uc(),void this._instance.on("eventCaptured",t=>this.Wc(t))):void dh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.Nc)||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;oi["__$$ph_site_app_"+i]=s._instance,null==(t=oi.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,t=>{if(t)return dh.error(vh+i,t)})};for(var a of n.siteApps)o()}else dh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},eu={tracingHeaders:class{constructor(t){this._instance=t,this.Vc=void 0,this.Gc=void 0,this.Zc=void 0,this.lc=()=>{var t,i,e=this.Jc();e?(Ei(this.Vc)&&(this.Vc=null==(t=oi.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Ei(this.Gc)&&(this.Gc=null==(i=oi.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.fc()}}initialize(){this.startIfEnabledOrStop()}bo(t){var i,e;null!=(i=oi.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=oi.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return Ql.error("failed to load script",i);t()})}Qc(){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}Jc(){var t=this.Qc();return yi(t)?(yi(this.Zc)?this.Zc.splice(0,this.Zc.length,...t):this.Zc=[...t],t.length>0?this.Zc:void 0):(yi(this.Zc)&&this.Zc.splice(0),this.Zc=t||void 0,this.Zc)}fc(){var t,i;null==(t=this.Vc)||t.call(this),null==(i=this.Gc)||i.call(this),this.Vc=void 0,this.Gc=void 0}startIfEnabledOrStop(){this.Jc()?this.bo(this.lc):this.fc()}}},ru=s({surveys:class extends _h{constructor(t){var i;super(new Sh(t),(i=t,{get projectToken(){return i.config.token},kv:new wh(i)})),this._instance=t}ah(t,i){var e=i.query?Ca(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})})}}},Yh),su={toolbar:class{constructor(t){this.instance=t}Kc(t){oi.ph_toolbar_state=t}Xc(){var t;return null!==(t=oi.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(!Kt||!Xt)return!1;t=null!=t?t:Kt.location,e=null!=e?e:Kt.history;try{if(!i){try{Kt.localStorage.setItem("test","test"),Kt.localStorage.removeItem("test")}catch(t){return!1}i=null==Kt?void 0:Kt.localStorage}var r,s=xh||no(t.hash,"__posthog")||no(t.hash,"state"),n=s?ms(()=>JSON.parse(atob(decodeURIComponent(s))))||ms(()=>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(Eh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Yc(t){var i=oi.ph_load_toolbar||oi.ph_load_editor;!Pi(i)&&wi(i)?i(t,this.instance):kh.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==Xt||!Xt.getElementById("__POSTHOG_TOOLBAR__"));if(!Kt||i)return!1;var e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=s({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(Kt.localStorage.setItem(Eh,JSON.stringify(s({},r,{source:void 0}))),2===this.Xc())this.Yc(r);else if(0===this.Xc()){var n;this.Kc(1),null==(n=oi.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",t=>{if(t)return kh.error("[Toolbar] Failed to load",t),void this.Kc(0);this.Kc(2),this.Yc(r)}),Es(Kt,"turbolinks:load",()=>{this.Kc(0),this.loadToolbar(r)})}return!0}tf(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)}}},nu=s({experiments:class t{get Rn(){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.ef("retrieved web experiments from the server"),e.if=new Map,i.forEach(i=>{if(i.feature_flag_key){var r;e.if&&(t.ef("setting flag key ",i.feature_flag_key," to web experiment ",i),null==(r=e.if)||r.set(i.feature_flag_key,i));var s=e._instance.getFeatureFlag(i.feature_flag_key);ki(s)&&i.variants[s]&&e.rf(i.name,s,i.variants[s].transforms)}else if(i.variants)for(var n in i.variants){var o=i.variants[n];t.nf(o,e._instance)&&e.rf(i.name,n,o.transforms)}})},i)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(i){if(this._is_bot())t.ef(Bh);else if(!this.Rn.disable_web_experiments){if(Pi(this.if))return this.if=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.ef("applying feature flags",i),i.forEach(t=>{var i;if(this.if&&null!=(i=this.if)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.if)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.rf(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var i=t.getWindowLocation();if(null!=i&&i.search){var e=ro(null==i?void 0:i.search,"__experiment_id"),r=ro(null==i?void 0:i.search,"__experiment_variant");e&&r&&(t.ef("previewing web experiments "+e+" && "+r),this.getWebExperiments(t=>{this.sf(parseInt(e),r,t)},!1,!0))}}loadIfEnabled(){this.Rn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Rn.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.Rn.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}sf(i,e,r){var s=r.filter(t=>t.id===i);s&&s.length>0&&(t.ef("Previewing web experiment ["+s[0].name+"] with variant ["+e+"]"),this.rf(s[0].name,e,s[0].variants[e].transforms))}static nf(i,e){return!Pi(i.conditions)&&t.af(i,e)&&t.lf(i)}static af(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=en(e,s.href);return null==(n=i.conditions)||!n.url||Uh[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==Kt?void 0:Kt.location}static lf(t){var i;if(Pi(t.conditions)||Pi(null==(i=t.conditions)?void 0:i.utm))return!0;var e=co();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 ef(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];vs.info("[WebExperiments] "+t,e)}rf(i,e,r){this._is_bot()?t.ef(Bh):"control"!==e?r.forEach(r=>{var s;r.selector&&(t.ef("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.ef("Control variants leave the page unmodified.")}_is_bot(){return Yt&&this._instance?Xa(Yt,this.Rn.custom_blocked_useragents):void 0}}},Yh),ou=s({},Yh,Xh,Qh,Zh,tu,iu,ru,eu,su,nu,{conversations:class{constructor(t){this._instance=t,this.uf=void 0,this._conversationsManager=null,this.hf=!1,this.re=null,this.df=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.vf=t.ok,t.ok)){var i=t.config.conversations;Pi(i)||(Oi(i)?this.uf=i:(this.uf=i.enabled,this.re=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.uf=void 0,this.re=null,this.vf=void 0,this.df=!1}loadIfEnabled(){if(!(this._conversationsManager||this.hf||this._instance.config.disable_conversations||ks(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==oi?void 0:oi.__PosthogExtensions__;if(t&&!Ei(this.uf)&&this.uf)if(this.re&&this.re.token){this.hf=!0;try{var i=t.initConversations;if(i)return this.cf(i),void(this.hf=!1);var e=t.loadExternalDependency;if(!e)return void this.ff(Lt);e(this._instance,"conversations",i=>{i||!t.initConversations?this.ff("Could not load conversations script",i):this.cf(t.initConversations),this.hf=!1})}catch(t){this.ff("Error initializing conversations",t),this.hf=!1}}else zh.error("Conversations enabled but missing token in remote config.")}}cf(t){if(this.re)try{this._conversationsManager=t(this.re,this._instance),this.df=!1,zh.info("Conversations loaded successfully")}catch(t){this.ff("Error completing conversations initialization",t)}else zh.error("Cannot complete initialization: remote config is null")}ff(t,i){zh.error(t,i),this._conversationsManager=null,this.hf=!1,this.df=!0}show(){this._conversationsManager?this._conversationsManager.show():zh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.uf&&!Ti(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.vf?"remote_config_failed":Ei(this.uf)?this.vf?"disabled_in_project":"remote_config_pending":this.uf?Pi(this.re)||!this.re.token?"missing_token":null!=oi&&oi.__PosthogExtensions__?this.hf?"initializing":this.df?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var r=this;return o(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(zh.warn(Hh),null)})()}getMessages(t,i){var e=this;return o(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(zh.warn(Hh),null)})()}markAsRead(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(zh.warn(Hh),null)})()}getTickets(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(zh.warn(Hh),null)})()}requestRestoreLink(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(zh.warn(Hh),null)})()}restoreFromToken(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(zh.warn(Hh),null)})()}restoreFromUrlToken(){var t=this;return o(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(zh.warn(Hh),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}Wu(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Vu(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},{logs:class{constructor(t){var i,e=this;this._instance=t,this.name="logs",this.pf=!1,this.gf=!1,this.mf=!1,this.A=cs("[logs]"),this.yf=s({},this.A,{error(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];i.some(Jh)||e.A.error(...i)}}),this.La=[],this.bf=[],this.Od=0,this.ro=!1,this._f=[],this.wf=[],this.kf=!1,this.Sf=!1,this.xf=()=>{var t,i;this.ro||(this.Od=0,null==(t=this.Cf)||t.onReconnect(),null==(i=this.Tf)||i.onReconnect())},this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.pf=!0),Kt&&Es(Kt,"online",this.xf)}Mf(t,i,e,r){var s,n=qh(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new os(this.If(t,i),n,this.yf,()=>this.Ef(),t=>t(),void 0,r),n]}Rf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Cf||this.Af!==i){var e;null==(e=this.Cf)||e.reset(),this.Af=i;var r=this.Mf(()=>this.La,t=>{this.La=t});this.Cf=r[0],this.Pf=r[1]}return this.Cf}Ff(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Tf||this.Of!==i){var e;null==(e=this.Tf)||e.reset(),this.Of=i;var r=this.Mf(()=>this.bf,t=>{this.bf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Wh);this.Tf=r[0],this.$f=r[1]}return this.Tf}setup(t){var i;if(!this.ro){this.Js=t,null!=(i=this._instance)&&null!=(i=i.config)&&null!=(i=i.logs)&&i.captureConsoleLogs&&(this.pf=!0),(this.pf||this.Df()&&this.Lf())&&this.Nf();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.ro?r.dispose():(this.oo=r,e||this.loadIfEnabled())}}dispose(){var t,i,e,r;this.ro||(this.ro=!0,this.qf(),null==(t=this.oo)||t.dispose(),this.oo=void 0,this.Js=void 0,this.mf=!1,null==Kt||Kt.removeEventListener("online",this.xf),null==(i=this.jf)||i.call(this),this.jf=void 0,null==(e=this.Cf)||e.reset(),null==(r=this.Tf)||r.reset())}onRemoteConfig(t){var i,e;if(!this.ro){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;Pi(r)?this.Bf():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[P]:!!r}),r?(this.pf=!0,this.gf||this.Nf(),this.loadIfEnabled()):this.Bf())}}reset(){var t,i,e,r;this.qf(),null==(t=this.Cf)||t.clearQueue(),this.La=[],null==(i=this.Cf)||i.reset(),null==(e=this.Tf)||e.clearQueue(),this.bf=[],null==(r=this.Tf)||r.reset(),this.Od=0}captureLog(t){this.ro||this.Rf().captureLog(t)}captureConsoleLog(t){this.ro||this.Ff().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.ro||this.Ff().captureLog(t,{context:i,occurredAtMs:e})}Lf(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[P])}Df(){var t,i;return null==(t=this._instance)||null==t.Fa||!t.Fa()||!(null==(i=oi._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])||!i.config)}Zu(){var t;this.qf(),null==(t=this.Tf)||t.clearQueue(),this.bf=[]}Bf(){this.pf||this.qf()}Nf(){var t,i=this;if(!this.kf&&null!=oi&&oi.console){var e=qh(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})(oi.console[t])}catch(t){return 0}if(!r)return 0;i.wf.push(Xl(oi.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.Hf(t,n,e)}catch(t){}return s.apply(oi.console,n)};return n.__rrweb_original__=r,n}))};for(var s of Vh)r(s);this.kf=!0,this.zf=setTimeout(()=>{this.qf()},3e4)}}Hf(t,i,e){var r;if(this.kf&&!this.Sf&&0!==i.length)if(null!=(r=this._instance)&&r.is_capturing()){if(e>this._f.length){this.Sf=!0;try{this._f.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Ef()})}finally{this.Sf=!1}}}else this.qf()}qf(){if(this._f=[],this.kf){for(var t of(this.kf=!1,this.zf&&(clearTimeout(this.zf),this.zf=void 0),this.wf))t();this.wf=[]}}Uf(){var t=this._f;return this.qf(),t}get logger(){return this.Wf||(this.Wf={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.Wf}flushLogs(t){t?this.Vf(t):(this.Cf&&this.Cf.flush().catch(t=>this.Gf(t)),this.Tf&&this.Tf.flush().catch(t=>this.Gf(t)))}Gf(t){Jh(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.ro&&this.pf&&!this.gf&&!this.mf){var t=null==oi?void 0:oi.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.qf();var i=t.loadExternalDependency;if(!i)return this.A.error(Lt),void this.qf();this.mf=!0;try{i(this._instance,"logs",i=>{if(this.mf=!1,!this.ro&&this.pf){var e=t.logs;if(i||null==e||!e.initializeLogs)this.A.error("Could not load logs script",i),this.qf();else{var r,s,n=this.Uf();this.jf=e.initializeLogs(null!==(r=this.Js)&&void 0!==r?r:this._instance),this.gf=!0,n.length>0&&(null==e.replayConsoleBuffer||e.replayConsoleBuffer(null!==(s=this.Js)&&void 0!==s?s:this._instance,n))}}})}catch(t){throw this.mf=!1,t}}}If(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===ci.LogsQueue?t():void 0,setPersistedProperty(t,e){t===ci.LogsQueue&&i(null!=e?e:[])},xs:t=>this.xs(t),getLibraryId:()=>h.LIB_NAME,getLibraryVersion:()=>h.LIB_VERSION}}xs(t){return new Promise(i=>{if(oo(this.Od,3))i({kind:"fatal",error:Kh(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:Kh(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Zf(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.Jf(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:Kh(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)})}}})}})}Jf(t){(0!==t||this._instance.__loaded)&&(this.Od=ao(t,this.Od,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.")))}Vf(t){this.La.length>0&&this.Qf(t,this.La,this.Pf,h.LIB_NAME,t=>{this.La=t}),this.bf.length>0&&this.Qf(t,this.bf,this.$f,Wh,t=>{this.bf=t})}Qf(t,i,e,r,s){if(0!==i.length){var n=i.map(t=>t.record);s([]);var o=ns(n,ss(e,h.LIB_NAME,h.LIB_VERSION),r,h.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Zf(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}Zf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Ef(){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!=oi&&null!=(t=oi.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?ir(oi.location.href):oi.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=cs("[metrics]")}initialize(){}Rf(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Cf&&this.Af===e||(null==(i=this.Cf)||i.reset(),this.Af=e,this.Cf=new us(this.If(),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.Cf}count(t,i,e){void 0===i&&(i=1),this.Rf().count(t,i,e)}gauge(t,i,e){this.Rf().gauge(t,i,e)}histogram(t,i,e){this.Rf().histogram(t,i,e)}flush(t){if(!this.Cf)return Promise.resolve();if(t){var i=this.Cf.drainWindow();return i&&this.js(i,t),Promise.resolve()}return this.Cf.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var t;null==(t=this.Cf)||t.reset()}If(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},js:t=>i.js(t),getLibraryId:()=>h.LIB_NAME,getLibraryVersion:()=>h.LIB_VERSION}}js(t,i){return new Promise(e=>{var r=!1,n=t=>{r||(r=!0,clearTimeout(o),e(t))},o=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(s({method:"POST",url:this.Kf(),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)})}}))})}Kf(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}});jl.__defaultExtensionClasses=s({},ou);var au=cs("[ExternalScriptsLoader]"),lu=t=>{var i=null==Xt?void 0:Xt.querySelectorAll("script");if(i)for(var e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},hu=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return au.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=lu(i);if(r){if(r.__posthog_loading_callback_fired)return e();var s=r.__posthog_loading_error;return s?e(s):(r.addEventListener("load",t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)}),void r.addEventListener("error",t=>{r.__posthog_loading_error=t,e(t)}))}var n=()=>{if(!Xt)return e("document not found");if(lu(i))return hu(t,i,e);var r=Xt.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)Xt.head.appendChild(r);else{var s,n=Xt.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):Xt.body.appendChild(r)}};null!=Xt&&Xt.body?n():null==Xt||Xt.addEventListener("DOMContentLoaded",n)},uu={},du=(t,i)=>{var e="/static/"+i+".js?v="+t.version;if("toolbar"===i){var r=3e5;e=e+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",e)};oi.__PosthogExtensions__=oi.__PosthogExtensions__||{},oi.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"!==i){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+i+".js"),n=uu[s];if("fallback"===r&&n){if(lu(n))return void hu(t,n,e);delete uu[s]}hu(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)e(r);else{var o,a=du(t,i);uu[s]=a;var l=lu(s);null==l||null==(o=l.parentNode)||o.removeChild(l),hu(t,a,e)}else e(void 0,n)}:e)}else hu(t,du(t,i),e)}else hu(t,t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js"),e)},oi.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{hu(t,t.requestRouter.endpointFor("api",i),e)};var vu=function(){h.SDK_DIST_CHANNEL="npm";var t=Sl[Al]=new jl;return function(){function t(){t.done||(t.done=!0,Il=!1,ps(Sl,function(t){t._dom_loaded()}))}null!=Xt&&Xt.addEventListener?"complete"===Xt.readyState?t():Es(Xt,"DOMContentLoaded",t,{capture:!1}):Kt&&vs.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=Fo,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},exports.DisplaySurveyType=jo,exports.PostHog=jl,exports.ProductTourEventName=Uo,exports.ProductTourEventProperties=zo,exports.SurveyEventName=No,exports.SurveyEventProperties=Lo,exports.SurveyEventType=Mo,exports.SurveyPosition={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},exports.SurveyQuestionBranchingType={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},exports.SurveyQuestionType={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},exports.SurveySchedule={Once:"once",Recurring:"recurring",Always:"always"},exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=Do,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=vu,exports.posthog=vu,exports.severityLevels=["fatal","error","warning","log","info","debug"];
1
+ var t,i=["retriesPerformedSoFar"],e=["$set_once","$set"];function r(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}function s(){return s=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},s.apply(null,arguments)}function n(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function o(t){return function(){var i=this,e=arguments;return new Promise(function(r,s){var o=t.apply(i,e);function a(t){n(o,r,s,a,l,"next",t)}function l(t){n(o,r,s,a,l,"throw",t)}a(void 0)})}}Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var a="0.8.2",l={DEBUG:(!1,!1),LIB_VERSION:(a,"1.428.8"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:a},h=l,u="$people_distinct_id",d="distinct_id",v="$device_id",c="$device_model",f="__alias",p="__cmpns",_="$fbc",g="$fbc_persistence",m="__timers",b="$autocapture_disabled_server_side",y="$heatmaps_enabled_server_side",w="$exception_capture_enabled_server_side",S="$error_tracking_suppression_rules",x="$error_tracking_capture_extension_exceptions",E="$web_vitals_enabled_server_side",k="$dead_clicks_enabled_server_side",T="$product_tours_enabled_server_side",P="$logs_capture_enabled_server_side",R="$web_vitals_allowed_metrics",C="$session_recording_remote_config",O="$session_recording_enabled_server_side",A="$replay_sample_rate",I="$replay_override_sampling",F="$replay_override_linked_flag",M="$replay_override_url_trigger",D="$replay_override_event_trigger",N="$sesid",L="$session_is_sampled",j="$session_past_minimum_duration",B="$session_recording_url_trigger_activated_session",U="$session_recording_event_trigger_activated_session",z="$debug_first_full_snapshot_timestamp",H="$sess_rec_flush_size",q="$enabled_feature_flags",V="$active_feature_flags",W="$early_access_features",G="$feature_flag_details",K="$feature_flag_payloads",J="$feature_flag_request_id",Y="$minimal_flag_called_events",X="$override_feature_flags",Q="$override_feature_flag_payloads",Z="$stored_person_properties",tt="$stored_group_properties",it="$groups",et="$surveys",rt="$surveys_loaded_at",st="$surveys_activated",nt="$surveys_activated_session",ot="$surveys_activated_timestamps",at="ph_product_tours",lt="$product_tours_activated",ht="$product_tours_activated_session",ut="$conversations_widget_session_id",dt="$conversations_ticket_id",vt="$conversations_widget_state",ct="$conversations_user_traits",ft="$flag_call_reported",pt="$flag_call_reported_session_id",_t="$feature_flag_errors",gt="$feature_flag_evaluated_at",mt="$user_state",bt="$client_session_props",yt="$capture_rate_limit",wt="$initial_campaign_params",St="$initial_referrer_info",xt="$initial_person_info",Et="$epp",kt="$posthog_cookieless",$t="$cookieless_mode",Tt="$sdk_debug_extensions_init_method",Pt="$sdk_debug_extensions_init_time_ms",Rt="$sdk_debug_recording_script_not_loaded",Ct="$sdk_debug_replay_event_trigger_status",Ot="$sdk_debug_replay_linked_flag_trigger_status",At="$sdk_debug_replay_matched_recording_trigger_groups",It="$sdk_debug_replay_pending_trigger_conditions",Ft="$sdk_debug_replay_remote_trigger_matching_config",Mt="$sdk_debug_replay_trigger_groups_count",Dt="$sdk_debug_replay_url_trigger_status",Nt="$session_recording_start_reason",Lt="PostHog loadExternalDependency extension not found.",jt="anonymous",Bt="identified",Ut="identified_only",zt="visibilitychange",Ht="beforeunload",qt="$pageview",Vt="$pageleave",Wt="$identify",Gt="$groupidentify",Kt="u">typeof window?window:void 0,Jt="u">typeof globalThis?globalThis:Kt,Yt=null==Jt?void 0:Jt.navigator,Xt=null==Jt?void 0:Jt.document,Qt=null==Jt?void 0:Jt.location,Zt=null==Jt?void 0:Jt.fetch,ti=null!=Jt&&Jt.XMLHttpRequest&&"withCredentials"in new Jt.XMLHttpRequest?Jt.XMLHttpRequest:void 0,ii=null==Jt?void 0:Jt.AbortController,ei=null==Jt?void 0:Jt.CompressionStream,ri=null==Yt?void 0:Yt.userAgent;function si(){return!(!Kt||!1===Kt.navigator.onLine)}var ni="undefined"!=typeof globalThis?globalThis:Kt;ni&&"undefined"==typeof self&&(ni.self=ni),ni&&"undefined"==typeof File&&(ni.File=function(){});var oi=null!=Kt?Kt:{},ai=["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"],li=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return ai.concat(i).some(t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)})};function hi(t,i){return-1!==t.indexOf(i)}var ui=function(t){return t.trim()},di=function(t){return t.replace(/^\$/,"")};function vi(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 ci=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}({}),fi=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),pi=["$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"],_i=["token"],gi=Object.prototype,mi=gi.hasOwnProperty,bi=gi.toString,yi=Array.isArray||function(t){return"[object Array]"===bi.call(t)},wi=t=>"function"==typeof t,Si=t=>t===Object(t)&&!yi(t),xi=t=>{if(Si(t)){for(var i in t)if(mi.call(t,i))return!1;return!0}return!1},Ei=t=>void 0===t,ki=t=>"[object String]"==bi.call(t),$i=t=>ki(t)&&0===t.trim().length,Ti=t=>null===t,Pi=t=>Ei(t)||Ti(t),Ri=t=>"[object Number]"==bi.call(t)&&t==t,Ci=t=>Ri(t)&&t>0,Oi=t=>"[object Boolean]"===bi.call(t),Ai=t=>hi(pi,t),Ii=t=>hi(_i,t);function Fi(t){return null===t||"object"!=typeof t}function Mi(t,i){return{}.toString.call(t)==="[object "+i+"]"}function Di(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 Li(t,Error)}}function Ni(t){return"u">typeof Event&&Li(t,Event)}function Li(t,i){try{return t instanceof i}catch(t){return!1}}var ji=[!0,"true",1,"1","yes"],Bi=t=>hi(ji,t),Ui=[!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),Ri(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 Hi=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.N=zi(t.refillInterval,0,864e5,t.A)}F(t,i){var e=Math.floor((i-t.lastAccess)/this.N);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.R),t.lastAccess=t.lastAccess+e*this.N)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.C[r];return s?this.F(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={}}},qi="Mobile",Vi="Android",Wi="Tablet",Gi="Android Tablet",Ki="iPad",Ji="Apple Watch",Yi="Safari",Xi="BlackBerry",Qi="Samsung Internet",Zi="Chrome",te="Chrome iOS",ie="Internet Explorer",ee="Internet Explorer Mobile",re="Opera",se="Microsoft Edge",ne="Firefox",oe="Firefox iOS",ae="Nintendo",le="PlayStation",he="Xbox",ue="Android Mobile",de="Mobile Safari",ve="Windows",ce="Windows Phone",fe="Nokia",pe="Ouya",_e="Generic "+qi.toLowerCase(),ge="Generic "+Wi.toLowerCase(),me="Konqueror",be="Oculus Browser",ye="Vivaldi",we="Yandex",Se="Whale",xe="DuckDuckGo",Ee="Pale Moon",ke="Waterfox",$e="Brave",Te="Claude",Pe="Codex",Re="ChatGPT",Ce="Google Search App",Oe=new RegExp("Version/(\\d+(\\.\\d+)?)"),Ae=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ie=new RegExp(he,"i"),Fe=new RegExp("PlayStation \\w+","i"),Me=new RegExp("Nintendo \\w+","i"),De=new RegExp("BlackBerry|PlayBook|BB10","i"),Ne={"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"},Le=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?$e:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&hi(t,"GSA/")?Ce:hi(t," OPR/")&&hi(t,"Mini")?"Opera Mini":hi(t," OPR/")?re:De.test(t)?Xi:hi(t,"IEMobile")||hi(t,"WPDesktop")?ee:hi(t,"OculusBrowser")?be:hi(t,"SamsungBrowser")?Qi:hi(t,"Edge")||hi(t,"Edg/")?se:hi(t,"Vivaldi/")?ye:hi(t,"YaBrowser/")?we:hi(t,"Whale/")?Se:hi(t,"DuckDuckGo/")||hi(t,"Ddg/")?xe:hi(t,"Claude/")?Te:hi(t,"Codex/")?Pe:hi(t,"ChatGPT/")?Re:hi(t,"FBIOS")?"Facebook Mobile":hi(t,"UCWEB")||hi(t,"UCBrowser")?"UC Browser":hi(t,"CriOS")?te:hi(t,"CrMo")||hi(t,Zi)?Zi:hi(t,Vi)&&hi(t,Yi)?ue:hi(t,"FxiOS")?oe:hi(t.toLowerCase(),me.toLowerCase())?me:hi(t,"Brave/")?$e:((t,i)=>i&&hi(i,"Apple")||function(t){return hi(t,Yi)&&!hi(t,Zi)&&!hi(t,Vi)}(t))(t,i)?hi(t,qi)?de:Yi:hi(t,"PaleMoon/")?Ee:hi(t,"Waterfox/")?ke:hi(t,ne)?ne:hi(t,"MSIE")||hi(t,"Trident/")?ie:hi(t,"Gecko")?ne:"")},je={[ee]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[se]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Zi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[te]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Yi]:[Oe],[de]:[Oe],[re]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[ne]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[oe]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[me]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Xi]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Oe],[ue]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Qi]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[be]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[ye]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[we]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Se]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[$e]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Te]:[Ae],[Pe]:[Ae],[Re]:[Ae],[xe]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ee]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[ke]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Ce]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[ie]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Be=function(t,i,e,r){var s=je[Le(t,i,e,r)];if(Ei(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},Ue=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[he,t&&t[1]||""]],[new RegExp(ae,"i"),[ae,""]],[new RegExp(le,"i"),[le,""]],[De,[Xi,""]],[new RegExp(ve,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[ce,""];if(new RegExp(qi).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Ne[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[ve,r]}return[ve,""]}],[/((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=Ei(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Vi,[t[2],t[3],t[4]||"0"].join(".")]:[Vi,""]],[/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;Ue.length>i;i++){var e=Ue[i],r=e[1],s=e[0].exec(t),n=s&&(wi(r)?r(s,t):r);if(n)return n}return["",""]},He=function(t){return Me.test(t)?ae:Fe.test(t)?le:Ie.test(t)?he:new RegExp(pe,"i").test(t)?pe:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?ce:/iPad/.test(t)?Ki:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ji:De.test(t)?Xi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(fe,"i").test(t)?fe:/(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(qi).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)?Vi:Gi:new RegExp("(pda|Mobile)","i").test(t)?_e:new RegExp(Wi,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?ge:""},qe=/\bFBAV\/(\d+(?:\.\d+)*)/i,Ve=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",qe],[/\bFBAN\/EMA\b/i,"Facebook Lite",qe],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",qe],[/\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"]],We="[Truncated]",Ge="[Unserializable]";function Ke(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 Je,Ye,Xe,Qe=/^[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)&&Qe.test(e)?t:i();var e}function tr(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 ir(t){return t?t.split("#")[0]:t}function er(t,i){var e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function rr(t,i,e){return sr.apply(this,arguments)}function sr(){return(sr=o(function*(t,i,e){var r;try{return yield Promise.race([t,new Promise((t,s)=>{r=er(()=>{try{null==e||e(),t()}catch(t){s(t)}},i)})])}finally{clearTimeout(r)}})).apply(this,arguments)}function nr(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Xe&&e.length===Ye?Xe:(Ye=e.length,Xe=e.reduce((e,r)=>{Je||(Je={});var s=Je[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,Je[r]=[l,h];break}}return e},{}))}}var or=class{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return o(function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&yi(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t})()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),s({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return o(function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e})()}convertToExceptionList(t,i){var e,r,n,o={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.handled)||void 0===r||r,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,s({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:nr(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return s({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}};function ar(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 Ei(r)||(n.lineno=r),Ei(s)||(n.colno=s),n}var lr=(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]},hr=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ur=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,dr=/\((\S*)(?::(\d+))(?::(\d+))\)/,vr=(t,i)=>{var e=hr.exec(t);if(e)return ar(i,e[1],"?",+e[2],+e[3]);var r=ur.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=dr.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=lr(r[1]||"?",r[2]);return ar(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},cr=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,fr=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,pr=(t,i)=>{var e=cr.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=fr.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=lr(n,s);return ar(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},_r=/\(error: (.*)\)/;function gr(t,i){return t.filename===i.filename&&t.function===i.function&&t.module===i.module&&t.lineno===i.lineno&&t.colno===i.colno}function mr(t){for(var i=1;10>=i;i++){var e=t.length-2*i;if(0>e)break;for(var r=!0,s=0;i>s;s++)if(!gr(t[e+s],t[e+i+s])){r=!1;break}if(r){for(var n=0;i>n;n++)t[e+n]=t[e+i+n];return t.length=e+i,{start:e,length:i}}}}function br(t,i){var e=i.start+i.length,r=wr(t,i);r&&t.splice(e+r===t.length?e:i.start,r)}function yr(t,i){for(var e=i.start;e>0&&gr(t[e-1],t[e-1+i.length]);)e--;return i.start-e}function wr(t,i){for(var e=i.start+i.length,r=e;t.length>r&&gr(t[r],t[r-i.length]);)r++;return r-e}function Sr(t,i){var e=i[0],r=t.length-(e?yr(t,e):0);for(var s of i)r-=wr(t,s);return r}function xr(t,i,e){for(var r=0;t.length>r;r++){var s=t[(i+r)%t.length],n=t[(e+r)%t.length];if(s!==n)return n>s}return!1}var Er=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 Mi(t,"DOMException")}isDOMError(t){return Mi(t,"DOMError")}},kr=class{match(t){return Di(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}},$r=class{match(t){return!!Mi(t,"ErrorEvent")&&(null!=t.error||this.an(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);var r=i.apply(t.message);return s({},r,{stack:null!==(e=this.sn(t))&&void 0!==e?e:r.stack,synthetic:!0})}an(t){return ki(t.message)&&t.message.length>0}sn(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}},Tr=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,Pr=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(Tr);return r&&(i=r[1],e=r[2]),[i,e]}},Rr=["fatal","error","warning","log","info","debug"];function Cr(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 Or=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(Ni(t))return t.constructor.name;var i="name"in t?t.name:void 0;return ki(i)&&!$i(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: "+Cr(t)}isSeverityLevel(t){return ki(t)&&!$i(t)&&Rr.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(Di(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},Ar=class{match(t){return Ni(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Cr(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}},Ir=class{match(t){return Fi(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}}},Fr=class{match(t){return Mi(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Ni(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 Fi(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}},Mr="$message",Dr="$timestamp",Nr=new Set([Mr,Dr]),Lr={enabled:!0,max_bytes:32768};function jr(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Lr.enabled,max_bytes:Ur(t.max_bytes,Lr.max_bytes)}:s({},Lr)}var Br=class{constructor(t){this.Gn=[],this.Zn=0,this.Rn=jr(t)}setConfig(t){this.Rn=jr(t),this.Jn()}add(t){var i=function(t){var i;try{i=vi(t)}catch(t){return}try{var e=JSON.parse(i);if(!Si(e))return;var r=e,s=r[Mr],n=r[Dr];if(!ki(s)||0===s.trim().length)return;if(!ki(n)&&!Ri(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.Rn.max_bytes||(this.Gn.push({step:i.step,bytes:e}),this.Zn+=e,this.Jn())}}getAttachable(){return this.Gn.map(t=>t.step)}clear(){this.Gn=[],this.Zn=0}size(){return this.Gn.length}Jn(){for(;this.Zn>this.Rn.max_bytes&&this.Gn.length>0;){var t=this.Gn.shift();t&&(this.Zn-=t.bytes)}}};function Ur(t,i){if(!Ri(t)||1/0===t||-1/0===t)return i;var e=Math.floor(t);return 0>e?i:e}var zr=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function Hr(t){return"string"==typeof t||t}function qr(t){return"string"==typeof t?t:void 0}var Vr,Wr=["$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"],Gr="NativeGzipValidationError",Kr=t=>t.length>=2&&31===t[0]&&139===t[1],Jr=(t,i)=>t===fi.GZipJS||i===fi.GZipJS||"gzip"===i,Yr=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Xr=t=>{throw tr(Gr,"Native gzip produced invalid output: "+t)},Qr=function(){var t=o(function*(t,i){18>t.size&&Xr("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());Kr(e)&&8===e[2]||Xr("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(Vr)return Vr;Vr=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;Vr[t]=i>>>0}return Vr})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&Xr("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&Xr("invalid-size")});return function(i,e){return t.apply(this,arguments)}}();function Zr(){return Zr=o(function*(t,i,e){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),a=n.write(r).then(()=>n.close()).catch(function(){var t=o(function*(t){try{yield n.abort(t)}catch(t){}throw t});return function(i){return t.apply(this,arguments)}}()),l=new Response(s.readable).blob(),h=(yield Promise.all([l,a]))[0];return yield Qr(h,r),h}catch(t){if(null!=e&&e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}}),Zr.apply(this,arguments)}var ts={}.propertyIsEnumerable;function is(t,i){try{return ss(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function es(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:We};if(e.remainingNodes--,Oi(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:Ke(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:We};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?Ke(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return es(a.call(t),i,e,r+1)}catch(t){}return yi(t)?{arrayValue:{values:rs(t,i,e,r+1)}}:{kvlistValue:{values:ss(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:Ke(String(t))}}function rs(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(es(a,i,e,r))}catch(t){s.push({stringValue:Ge})}return t.length>o&&s.push({stringValue:We}),s}function ss(t,i,e,r){var s=[];for(var n in t)if(ts.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(Ti(o)||Ei(o))continue;s.push({key:Ke(n),value:es(o,i,e,r)})}catch(t){s.push({key:Ke(n),value:{stringValue:Ge}})}}return s}function ns(t,i,e){return s({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}var os={darwin:"macOS",win32:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",sunos:"SunOS",aix:"AIX","Mac OS X":"macOS"};var as={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}},ls=as.info;function hs(t){try{return Ke(String(t))}catch(t){return Ge}}function us(t,i,e,r){var n,o=as[t.level||"info"]||ls,a=o.text,l=o.number,h=(void 0===(n=Ri(r)?r:void 0)&&(n=Date.now()),String(n)+"000000"),u={};i.distinctId&&(u.posthogDistinctId=i.distinctId),i.sessionId&&(u.sessionId=i.sessionId),i.windowId&&(u["window.id"]=i.windowId),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=s({},u),v=t.attributes;if(v){var c=[];try{c=Object.keys(v)}catch(t){c=[]}for(var f of c){var p=void 0;try{p=v[f]}catch(t){p=Ge}Object.defineProperty(d,f,{value:p,enumerable:!0,writable:!0,configurable:!0})}}var _={timeUnixNano:h,observedTimeUnixNano:h,severityNumber:l,severityText:a,body:{stringValue:hs(t.body)},attributes:is(d,e)};return t.trace_id&&(_.traceId=t.trace_id),t.span_id&&(_.spanId=t.span_id),Ei(t.trace_flags)||(_.flags=t.trace_flags),_}function ds(t,i,e){return ns(t,i,e)}function vs(t,i,e,r){return{resourceLogs:[{resource:{attributes:is(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}var cs=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Rn=i,this.A=e,this.Qn=r,this.Kn=s,this.Xn=n,this.Yn=o,this.ts=null,this.es=0,this.rs=0,this.ns=0,this.ss=0,this.ls=0,this.us=!1,this.hs=i.maxBufferSize,this.ds=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.vs=i.flushIntervalMs,this.cs=i.maxBatchRecordsPerPost,this.fs=i.rateCapWindowMs,this.ps=i.maxLogsPerInterval}clearQueue(){this.rs++,this._instance.setPersistedProperty(ci.LogsQueue,[])}reset(){this.gs(),this.ss=0,this.ls=0,this.us=!1,this.ns=0,this.cs=this.Rn.maxBatchRecordsPerPost}onReconnect(){this.ns=0,this.ys()}captureLog(t,i){var e;if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var r=this.bs(t);if(null!==r)if(r.body){if(this._s()){var s={record:us(r,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.Qn(),this.A,null==i?void 0:i.occurredAtMs)};this.Kn(()=>this.ws(s))}}else this.A.info("Log was rejected in beforeSend function")}}bs(t){var i=this.Rn.beforeSend;if(!i)return t;var e=yi(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}_s(){if(void 0===this.ps)return!0;var t=Date.now(),i=t-this.ss;return this.fs>i&&i>=0||(this.ss=t,this.ls=0,this.us=!1),this.ps>this.ls?(this.ls++,!0):(this.us||(this.A.warn("captureLog dropping logs: exceeded "+this.ps+" logs per "+this.fs+"ms"),this.us=!0),!1)}flush(){var t=this;return o(function*(){if(!t._instance.isDisabled)return t.ts||(t.ts=t.ks().finally(()=>{t.ts=null})),t.ts})()}ks(){var t=this;return o(function*(){var i;t.gs();var e=null!==(i=t._instance.getPersistedProperty(ci.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.rs;t.es=0;var l=Math.min(e.length,t.cs),h=e.slice(0,l),u=vs(h.map(t=>t.record),t.Ss(),null!==(n=t.Yn)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),d=yield t._instance.xs(u);if(t.rs!==a)return;if("too-large"===d.kind&&h.length>1)t.cs=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.cs);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.Rn.maxBatchRecordsPerPost>t.cs&&(t.cs=Math.min(t.Rn.maxBatchRecordsPerPost,t.cs+1)),yield t.Cs(h.length),e=null!==(o=t._instance.getPersistedProperty(ci.LogsQueue))&&void 0!==o?o:[],s+=h.length,"fatal"===d.kind)throw d.error}}})()}Cs(t){var i=this;return o(function*(){var e,r=Math.max(0,t-i.es),s=null!==(e=i._instance.getPersistedProperty(ci.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(ci.LogsQueue,s.slice(r)),yield i.Xn()})()}Ss(){return ds(this.Rn,this._instance.getLibraryId(),this._instance.getLibraryVersion())}ws(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(ci.LogsQueue))&&void 0!==i?i:[];this.ds>e.length||(e.shift(),this.es++,this.A.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(ci.LogsQueue,e),this.hs>e.length?this.Ts():this.ys()}}Ts(t){void 0===t&&(t=this.vs),this.Ms||(this.Ms=er(()=>{this.Ms=void 0,this.ys()},t))}Is(){var t=Math.min(Math.max(0,this.ns-1),6);return this.vs*Math.pow(2,t)}Es(){var t=this._instance.getPersistedProperty(ci.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return o(function*(){i.gs();var e=i.flush().catch(()=>{});void 0!==t?yield rr(e,t):yield e})()}flushWithTimeout(t){var i=this;return o(function*(){var e=i.flush();yield rr(e,t,()=>{e.catch(()=>{})})})()}ys(){this.flush().then(()=>{this.ns=0},t=>{this.ns++,this.A.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.Es()&&this.Ts(this.Is())})}gs(){this.Ms&&(clearTimeout(this.Ms),this.Ms=void 0)}},fs=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function ps(t){return String(t)+"000000"}function _s(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 gs=class{constructor(t,i,e){this._instance=t,this.Rn=i,this.A=e,this.Rs=new Map,this.ts=null,this.As=!1,this.Ps=new Map,this.Fs=new Set,this.Os=0}count(t,i,e){void 0===i&&(i=1),this.$s({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.$s({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.$s({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.ts,e=function(){var e=o(function*(){i&&(yield i.catch(()=>{})),yield t.Ds()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.ts===e&&(this.ts=null)});return this.ts=e,e}drainWindow(){if(0===this.Rs.size)return null;var t=this.Rs;return this.Rs=new Map,this.As=!1,this.Ps=new Map,this.Fs=new Set,this.Ls(t)}reset(){this.Os++,this.gs(),this.Rs=new Map,this.ts=null,this.As=!1,this.Ps=new Map,this.Fs=new Set}$s(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.bs(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.A.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var e,r;try{e=i.attributes?s({},i.attributes):void 0,r=_s(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.Rs.get(r);if(!n){if(!this.Ns())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Rs.set(r,n)}var o=this.Ps.get(i.name);void 0===o?this.Ps.set(i.name,i.type):o===i.type||this.Fs.has(i.name)||(this.Fs.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.qs(n,i.value),this.Ts()}else this.A.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.A.warn("Dropping metric with empty name")}}Ns(){return this.Rn.maxSeriesPerFlush>this.Rs.size||(this.As||(this.As=!0,this.A.warn("Metric series cap reached ("+this.Rn.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}qs(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(fs.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,fs)]+=1}}bs(t){var i=this.Rn.beforeSend;if(!i)return t;var e=yi(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}Ts(){this.Ms||(this.Ms=er(()=>{this.Ms=void 0,this.flush().catch(t=>{this.A.error("Metrics flush failed:",t)})},this.Rn.flushIntervalMs))}gs(){this.Ms&&(clearTimeout(this.Ms),this.Ms=void 0)}Ds(){var t=this;return o(function*(){if(0!==t.Rs.size){var i=t.Rs;t.Rs=new Map,t.As=!1,t.Ps=new Map,t.Fs=new Set;var e=t.Os,r=yield t._instance.js(t.Ls(i));if(e===t.Os)switch(r.kind){case"ok":return;case"retry-later":return t.Bs(i),void t.Ts();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)}}})()}Ls(t){return i=this.Hs(t),e=function(t,i,e){return ns(t,i,e)}(this.Rn,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:is(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}Hs(t){var i=ps(Date.now()),e=new Map;for(var r of t.values()){var n,o=_s(r.type,r.name,r.unit,void 0),a=e.get(o);a||(a=s({name:r.name},r.unit&&{unit:r.unit}),"count"===r.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===r.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},e.set(o,a));var l=is(null!==(n=r.attributes)&&void 0!==n?n:{},this.A),h=ps(r.windowStartMs);if("count"===r.type){var u,d={attributes:l,startTimeUnixNano:h,timeUnixNano:i,asDouble:null!==(u=r.total)&&void 0!==u?u:0};a.sum.dataPoints.push(d)}else if("gauge"===r.type){var v,c={attributes:l,timeUnixNano:i,asDouble:null!==(v=r.last)&&void 0!==v?v:0};a.gauge.dataPoints.push(c)}else r.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:h,timeUnixNano:i,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:fs})}return Array.from(e.values())}Bs(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.Rs.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.Ns()&&this.Rs.set(s,n)}}},ms=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];Kt&&(l.DEBUG||Kt.POSTHOG_DEBUG||e)&&!Ei(Kt.console)&&Kt.console&&("__rrweb_original__"in Kt.console[i]?Kt.console[i].__rrweb_original__:Kt.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)=>ms(t+" "+i,e)};return r},bs=ms("[PostHog.js]"),ys=bs.createLogger;function ws(t,i){yi(t)&&t.forEach(i)}function Ss(t,i){if(!Pi(t))if(yi(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(var e in t)mi.call(t,e)&&i(t[e],e)}var xs=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 Es(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 ks=function(t){try{return t()}catch(t){return}},$s=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){bs.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),bs.critical(t)}}},Ts=function(t){var i={};return Ss(t,function(t,e){(ki(t)&&t.length>0||Ri(t))&&(i[e]=t)}),i};function Ps(t){var i=s({},t);for(var e of["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e])}catch(t){}return i}var Rs=["herokuapp.com","vercel.app","netlify.app"];function Cs(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 Rs)if(e===r)return!1;return!0}function Os(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 As(t){return"ph_toolbar_internal"===t.name}var Is=t=>{if(Xt){try{for(var i=t+"=",e=Xt.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 Ri(t)&&isFinite(t)&&Math.floor(t)===t});var Fs=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}},Ms=class{generate(){var t=this.generateOrAbort();if(!Ei(t))return t;this.Ct=0;var i=this.generateOrAbort();if(Ei(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t,i=(t=Date.now(),Ri(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0);if(i>this.Ct)this.Ct=i,this.Mt();else{if(this.Ct>=i+1e4)return;this.Tt++,this.Tt>4398046511103&&(this.Ct++,this.Mt())}return Fs.fromFieldsV7(this.Ct,Math.trunc(this.Tt/Math.pow(2,30)),this.Tt&Math.pow(2,30)-1,this.It.nextUint32())}Mt(){this.Tt=1024*this.It.nextUint32()+(1023&this.It.nextUint32())}constructor(){this.Ct=0,this.Tt=0,this.It=new Ls}},Ds=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};Kt&&!Ei(Kt.crypto)&&crypto.getRandomValues&&(Ds=t=>crypto.getRandomValues(t));var Ns,Ls=class{nextUint32(){return this.Rt.length>this.At||(Ds(this.Rt),this.At=0),this.Rt[this.At++]}constructor(){this.Rt=new Uint32Array(8),this.At=1/0}},js=()=>Bs().toString(),Bs=()=>(Ns||(Ns=new Ms)).generate(),Us="",zs=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Hs=null,qs={Et(){if(!Ti(Hs))return Hs;if(Hs=!1,Xt)try{var t="__ph_cookie_support_"+js();qs.Ot(t,"xyz"),Hs='"xyz"'===Is(t),qs.Dt(t)}catch(t){Hs=!1}return Hs},Pt(t){bs.error("cookieStore error: "+t)},Lt:Is,Nt(t){var i;try{i=JSON.parse(qs.Lt(t))||{}}catch(t){}return i},Ot(t,i,e,r,s){if(!Xt)return!1;try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=Xt),Us)return Us;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_"+js();!Us&&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",Us=n)}return Us}(t);if(!e){var r=(t=>{var i=t.match(zs);return i?i[0]:""})(t);r!==e&&bs.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(Xt.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&&bs.warn("cookieStore warning: large cookie, len="+h.length),Xt.cookie=h,!0}catch(t){return!1}},Dt(t,i){if(null!=Xt&&Xt.cookie)try{qs.Ot(t,"",-1,i)}catch(t){return}}},Vs=null,Ws={Et(){if(!Ti(Vs))return Vs;var t=!0;if(Ei(Kt))t=!1;else try{var i="__mplssupport__";Ws.Ot(i,"xyz"),'"xyz"'!==Ws.Lt(i)&&(t=!1),Ws.Dt(i)}catch(i){t=!1}return t||bs.error("localStorage unsupported; falling back to cookie store"),Vs=t,t},Pt(t){bs.error("localStorage error: "+t)},Lt(t){try{return null==Kt?void 0:Kt.localStorage.getItem(t)}catch(t){Ws.Pt(t)}return null},Nt(t){try{return JSON.parse(Ws.Lt(t))||{}}catch(t){}return null},Ot(t,i){try{return null==Kt||Kt.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){Ws.Pt(t)}return!1},Dt(t){try{null==Kt||Kt.localStorage.removeItem(t)}catch(t){Ws.Pt(t)}}},Gs=[Z,V,q,G,K,J,gt,_t,ft],Ks=[v,d,N,L,Et,xt,g,mt],Js=t=>t+"_cpm",Ys=["__proto__","constructor","prototype"],Xs=t=>{if(!Si(t))return{};var i={};return Object.keys(t).forEach(e=>{-1===Ys.indexOf(e)&&(i[e]=t[e])}),i},Qs=function(t,i){void 0===i&&(i=[]);var e={};return[...Ks,...i].forEach(i=>{var r=t[i];Ei(r)||Ti(r)||""===r||(e[i]=r)}),e},Zs=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)},tn=(t,i)=>({p:i,f:Zs(JSON.stringify(t))}),en=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=qs.Nt(Js(t)),r=(null==e?void 0:e.f)===Zs(i)&&yi(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},rn=(t,i)=>i+"|"+(qs.Lt(Js(t))||""),sn={},nn={Et:()=>!0,Pt(t){bs.error("memoryStorage error: "+t)},Lt:t=>t in sn?sn[t]:null,Nt:t=>t in sn?sn[t]:null,Ot:(t,i)=>(sn[t]=i,!0),Dt(t){delete sn[t]}},on=null,an={Et(){if(!Ti(on))return on;if(on=!0,Ei(Kt))on=!1;else try{var t="__support__";an.Ot(t,"xyz"),'"xyz"'!==an.Lt(t)&&(on=!1),an.Dt(t)}catch(t){on=!1}return on},Pt(t){bs.error("sessionStorage error: ",t)},Lt(t){try{return null==Kt?void 0:Kt.sessionStorage.getItem(t)}catch(t){an.Pt(t)}return null},Nt(t){try{return JSON.parse(an.Lt(t))||null}catch(t){}return null},Ot(t,i){try{return null==Kt||Kt.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){an.Pt(t)}return!1},Dt(t){try{null==Kt||Kt.sessionStorage.removeItem(t)}catch(t){an.Pt(t)}}},ln=class{constructor(t){this._instance=t}get Rn(){return this._instance.config}get consent(){return this.vo()?0:this.co}isOptedOut(){return"always"===this.Rn.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Rn.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Rn.opt_out_capturing_by_default}optInOut(t){this.fo.Ot(this.po,t?1:0,this.Rn.cookie_expiration,this.Rn.cross_subdomain_cookie,this.Rn.secure_cookie)}reset(){this.fo.Dt(this.po,this.Rn.cross_subdomain_cookie)}get po(){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 co(){var t=this.fo.Lt(this.po);return Bi(t)?1:hi(Ui,t)?0:-1}get fo(){var t=this.Rn.opt_out_capturing_persistence_type,i="localStorage"===t?Ws:qs,e=i.Et()?i:nn;if(!this.mo||this.mo!==e){this.mo=e;var r="localStorage"===t?qs:Ws;r.Lt(this.po)&&(this.mo.Lt(this.po)||this.optInOut(Bi(r.Lt(this.po))),r.Dt(this.po,this.Rn.cross_subdomain_cookie))}return this.mo}vo(){return!!this.Rn.respect_dnt&&[null==Yt?void 0:Yt.doNotTrack,null==Yt?void 0:Yt.msDoNotTrack,oi.doNotTrack,null==Yt?void 0:Yt.globalPrivacyControl].some(t=>Bi(t))}};function hn(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!wi(r))return i;try{var s=r(i);return ki(s)&&s?s:i}catch(t){return bs.error("Error in get_current_url, falling back to window.location.href",t),i}}function un(t){return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function dn(t){return!!t&&1===t.nodeType}function vn(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function cn(t){return!!t&&3===t.nodeType}function fn(t){return!!t&&11===t.nodeType&&dn(t.host)}function pn(t){return t?ui(t).split(/\s+/):[]}function _n(t,i){var e=function(t){var i,e=null==Kt||null==(i=Kt.location)?void 0:i.href;return Ei(e)?void 0:hn(t,e)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function gn(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 pn(i)}function mn(t){return Pi(t)?null:ui(t).split(/(\s+)/).filter(t=>Hn(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function bn(t){var i="";return Fn(t)&&!Mn(t)&&t.childNodes&&t.childNodes.length&&Ss(t.childNodes,function(t){var e;cn(t)&&t.textContent&&(i+=null!==(e=mn(t.textContent))&&void 0!==e?e:"")}),ui(i)}function yn(t){var i;return Ei(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var wn=["a","button","form","input","select","textarea","label"];function Sn(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 xn(t,i){if(Ei(i))return!0;var e,r=function(t){if(i.some(i=>Sn(t,i)))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function En(t){var i=t.parentNode;return!(!i||!dn(i))&&i}var kn=[".ph-no-autocapture","[data-ph-no-autocapture]"],$n=["next","previous","prev",">","<"],Tn=[...$n,"+","-","−","–"],Pn=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,Rn=[".ph-no-rageclick",".ph-no-capture"],Cn=["","text","search","email","password","url","tel","number"];function On(t,i){if(!Kt||An(t))return!1;var e,r,s,n,o;if(Oi(i)?(e=!!i&&Rn,r=void 0,s=!1):(e=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:Rn,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||!dn(t))&&(!!vn(t,"textarea")||(vn(t,"input")?hi(Cn,(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=In(t,!1).targetElementList;return!function(t,i){if(!1===t||Ei(t))return!1;var e;if(!0===t)e=$n;else{if(!yi(t))return!1;if(t.length>10)return bs.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=>Pn(i,t)||Pn(r,t))})}(r,a.map(t=>{var i;return{safeText:bn(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}}))&&!xn(a,e)}var An=t=>!t||vn(t,"html")||!dn(t),In=(t,i)=>{if(!Kt||An(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!vn(s,"body");)if(fn(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=En(s);if(!n)break;if(i||wn.indexOf(n.tagName.toLowerCase())>-1)e=!0;else try{var o=Kt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}catch(t){}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function Fn(t){for(var i=new Set,e=0,r=t;r.parentNode&&!vn(r,"body");r=r.parentNode){if(e++>=1e3||i.has(r))return!1;i.add(r);var s=gn(r);if(hi(s,"ph-sensitive")||hi(s,"ph-no-capture"))return!1}if(hi(gn(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 Mn(t){return!!(vn(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||vn(t,"select")||vn(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Dn=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}))$"),Nn=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Ln=[16,15,14,13],jn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Bn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Un=/[0-9A-Za-z_]/;function zn(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 Hn(t,i){if(void 0===i&&(i=!0),Pi(t))return!1;if(ki(t)){if(t=ui(t),i?Dn.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(Nn.lastIndex=0;i=Nn.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of Ln){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(Dn.test(a)&&zn(a))return!0}}}return!1}(t))return!1;if(i?jn.test(t):function(t){var i;for(Bn.lastIndex=0;i=Bn.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&Un.test(e)&&Un.test(r)))return!0}return!1}(t))return!1}return!0}function qn(t){var i=bn(t);return Hn(i=(i+" "+Vn(t)).trim())?i:""}function Vn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&Ss(t.childNodes,function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=bn(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Vn(t)).trim())}catch(t){bs.error("[AutoCapture]",t)}}),i}function Wn(t){return t.replace(/"|\\"/g,'\\"')}function Gn(t){var i=t.attr__class;if(i)return yi(i)?i:pn(i)}var Kn=ys("[Dead Clicks]"),Jn=()=>!0,Yn=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(k)),r=t.instance.config.capture_dead_clicks;return Oi(r)?r:!!Si(r)||e},Xn=class{get lazyLoadedDeadClicksAutocapture(){return this.yo}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.bo(()=>{this._o()}):this.stop()}bo(t){var i,e;null!=(i=oi.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=oi.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?Kn.error("failed to load script",i):t()})}_o(){var t;if(Xt){if(!this.yo&&null!=(t=oi.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=Si(this.instance.config.capture_dead_clicks)?s({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.yo=oi.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.yo.start(Xt),Kn.info("starting...")}}else Kn.error("`document` not found. Cannot start.")}stop(){this.yo&&(this.yo.stop(),this.yo=void 0,Kn.info("stopping..."))}},Qn=ys("[SegmentIntegration]");function Zn(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()||js();t.config.get_device_id=s,e&&r.id()&&(t.register({distinct_id:r.id(),$device_id:s()}),t.persistence.set_property(mt,Bt)),i(e?void 0:r.anonymousId()||void 0)},n=r.user();"then"in n&&wi(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,qt)},identify(t){return e(t,Wt)},screen(t){return e(t,"$screen")}}})(t,e)).then(()=>{i()},t=>{Qn.error("Failed to register the Segment integration",t),i()})},e)}var to="posthog-js";function io(t,i){var e=void 0===i?{}:i,r=e.organization,n=e.projectId,o=e.prefix,a=e.severityAllowList,l=void 0===a?["error"]:a,h=e.sendExceptionsToPostHog,u=void 0===h||h;return i=>{var e,a,h,d,v,c;if("*"!==l&&!l.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var f=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=f,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p=(null==(e=i.exception)?void 0:e.values)||[],_=p.map(t=>s({},t,{stacktrace:t.stacktrace?s({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>s({},t,{platform:"web:javascript"}))}):void 0})),g={$exception_message:(null==(a=p[0])?void 0:a.value)||i.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:i.level,$exception_list:_,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||i.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:i.tags};return r&&n&&(g.$sentry_url=(o||"https://sentry.io/organizations/")+r+"/issues/?project="+n+"&query="+i.event_id),u&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),i}}var eo=class{constructor(t,i,e,r,s,n){this.name=to,this.setupOnce=function(o){o(io(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}},ro=class{constructor(t){this.wo=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(bs.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.ko=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.So()}So(){var t;this.xo=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.wo)}destroy(){var t;null==(t=this.xo)||t.call(this),this.xo=void 0}doPageView(t,i){var e,r=this.Co(t,i);return this.ko={pathname:null!==(e=null==Kt?void 0:Kt.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.Co(t,null==(i=this.ko)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ko)?void 0:t.pageViewId}}Co(t,i){var e=this.ko;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(!(Ei(n)||Ei(o)||Ei(a)||Ei(l)||Ei(h)||Ei(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,bs):1,v=n>1?zi(a/n,0,1,bs):1,c=l>1?zi(h/l,0,1,bs):1,f=l>1?zi(u/l,0,1,bs):1;r=xs(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}},so=["flags","surveys"],no={[u]:{exposure:"hidden"},[f]:{exposure:"hidden"},[p]:{exposure:"hidden"},[m]:{exposure:"hidden"},[g]:{exposure:"hidden"},[b]:{exposure:"event"},[y]:{exposure:"hidden"},[P]:{exposure:"hidden"},[w]:{exposure:"event"},[S]:{exposure:"hidden"},[x]:{exposure:"event"},[E]:{exposure:"event"},[k]:{exposure:"event"},[T]:{exposure:"hidden"},[R]:{exposure:"event"},[C]:{exposure:"hidden"},[O]:{exposure:"hidden"},[N]:{exposure:"hidden"},[L]:{exposure:"event"},[A]:{exposure:"event",shouldSkipFromEventProperties:t=>Ti(t)},[j]:{exposure:"event"},[B]:{exposure:"event"},[U]:{exposure:"event"},[z]:{exposure:"event"},[H]:{exposure:"hidden"},[q]:{exposure:"hidden",storageGroup:"flags"},[V]:{exposure:"hidden",storageGroup:"flags"},[W]:{exposure:"hidden"},[G]:{exposure:"hidden",storageGroup:"flags"},[K]:{exposure:"hidden",storageGroup:"flags"},[J]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Y]:{exposure:"hidden",storageGroup:"flags"},[X]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[Z]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[et]:{exposure:"hidden",storageGroup:"surveys"},[rt]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[st]:{exposure:"event"},[nt]:{exposure:"hidden"},[ot]:{exposure:"hidden"},[at]:{exposure:"hidden"},[lt]:{exposure:"hidden"},[ht]:{exposure:"hidden"},[ut]:{exposure:"event"},[dt]:{exposure:"event"},[vt]:{exposure:"event"},[ct]:{exposure:"event"},[ft]:{exposure:"hidden"},[pt]:{exposure:"hidden"},[it]:{exposure:"event"},[_t]:{exposure:"hidden"},[gt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[mt]:{exposure:"hidden"},[bt]:{exposure:"hidden"},[yt]:{exposure:"hidden"},[wt]:{exposure:"hidden"},[St]:{exposure:"hidden"},[xt]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[I]:{exposure:"event"},[F]:{exposure:"event"},[M]:{exposure:"event"},[D]:{exposure:"event"},[Tt]:{exposure:"event"},[Pt]:{exposure:"event"},[Rt]:{exposure:"event"},[Ct]:{exposure:"event"},[Ot]:{exposure:"event"},[At]:{exposure:"event"},[It]:{exposure:"event"},[Ft]:{exposure:"event"},[Mt]:{exposure:"event"},[Dt]:{exposure:"event"},[Nt]:{exposure:"event"}},oo=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],ao=t=>{var i=no[t];if(i)return i;for(var e of oo){var r=e[1];if(0===t.indexOf(e[0]))return r}},lo=(t,i)=>{try{var e;return JSON.stringify(t,(t,i)=>Di(i)?(null!=e||(e=new WeakMap),e.has(i)||e.set(i,Ps(i)),e.get(i)):"bigint"==typeof i?i.toString():i,i)}catch(i){return vi(t)}},ho=t=>{var i=null==Xt?void 0:Xt.createElement("a");return Ei(i)?null:(i.href=t,i)},uo=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(!yi(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){bs.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},vo=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("=");yi(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},co=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},fo=(t,i)=>t>=i&&si(),po=(t,i,e,r)=>{if(0===t){if(si()){var s=i+1;return s===e&&r(),s}return i}return 0},_o=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],go=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",..._o],mo="<masked>",bo=["li_fat_id"];function yo(t,i,e){if(!Xt)return{};var r,s=i?[..._o,...e||[]]:[],n=wo(vo(Xt.URL,s,mo),t);return xs((r={},Ss(bo,function(t){var i=Is(t);r[t]=i||null}),r),n)}function wo(t,i){var e=go.concat(i||[]),r={};return Ss(e,function(i){var e=uo(t,i);r[i]=e||null}),r}function So(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(!Ti(i)){r.$search_engine=i;var s=Xt?uo(Xt.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function xo(){return navigator.language||navigator.userLanguage}var Eo="$direct";function ko(){return(null==Xt?void 0:Xt.referrer)||Eo}function $o(t,i,e){var r;void 0===e&&(e=!1);var s=t?[..._o,...i||[]]:[],n=null==(r=e?ir(null==Qt?void 0:Qt.href):null==Qt?void 0:Qt.href)?void 0:r.substring(0,1e3);return{r:ko().substring(0,1e3),u:n?vo(n,s,mo):void 0}}function To(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?ir(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==Eo?Eo:null==(e=ho(r))?void 0:e.host};if(n){o.$current_url=n;var a=ho(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname,xs(o,wo(n))}return r&&xs(o,So(r)),o}function Po(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Ro(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Co={flags:gt,surveys:rt},Oo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Ao=t=>t+"_cookie_identity_change_pending",Io=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},Fo="main",Mo=[q,V,G,K,J,gt,Y,Z],Do=t=>-1!==Mo.indexOf(t),No=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},Lo=t=>{if(!t)return{};var i=JSON.parse(t);return Si(i)?i:{}},jo=(t,i)=>{Ss(t,(e,r)=>{var s=ao(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]})},Bo=class{constructor(t,i,e){if(void 0===e&&(e=!0),this.To={},this.Mo=!1,this.Io=!1,this.Eo=!1,this.Ro=!1,this.Ao=!1,this.Po=new Map,this.Fo=!1,this.Oo=!1,this.$o=!1,this.Do=!1,this.Lo=new Set,this.Rn=t,this.No=e,this.props={},this.qo=void 0,this.jo=(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.fo=this.Bo(t),this.Eo=this.Ho(t),this.load(),this.zo(),t.debug&&bs.info("Persistence loaded",t.persistence,s({},this.props)),this.update_config(t,t,i),this.save(),Kt){var r=()=>this.flush();Os(Kt,"beforeunload",r,{capture:!1}),Os(Kt,"pagehide",r,{capture:!1}),this.Uo=t=>{if(this.Mo&&(!t.storageArea||t.storageArea===(null==Kt?void 0:Kt.localStorage))&&t.key)if(t.key!==this.jo){if(this.Eo){var i=so.find(i=>t.key===this.Wo(i));i&&this.Vo(t.key,i)}}else this.Vo(t.key,Fo)},Os(Kt,"storage",this.Uo)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(t=>{var i=t[0],e=t[1],r=this.Po.get(i);if(Do(i)&&!0!==r)if(!0!==e){var s=new Set(r||[]);e.forEach(t=>s.add(t)),s.size&&this.Go(i,s)}else this.Go(i,!0)})}onCrossTabFeatureFlagChange(t){return this.Lo.add(t),()=>this.Lo.delete(t)}destroy(){this.Uo&&Kt&&(Kt.removeEventListener("storage",this.Uo),this.Uo=void 0),this.Lo.clear()}Vo(t,i,e){if(void 0===e&&(e=!0),this.gi)return!1;var r,s;try{if(s=Ws.Lt(t),Ti(s)){var n=this.Zo(i);return n.storageValue=null,i!==Fo&&(n.persisted=!1),!1}r=Lo(s)}catch(t){return!1}var o=i===Fo?r:Ws.Nt(this.jo);if(o&&this.Jo(o))return!1;var a=this.Qo(r,i,e);return i===Fo&&this.Eo&&!No(this.Ko().main,r)||this.Xo(r,i,!0,s),a}Jo(t){var i=this.props[d],e=t[d];return!Ei(i)&&!Ei(e)&&i!==e}Xo(t,i,e,r){var s=this.Zo(i);s.storageValue=r,i!==Fo&&(s.persisted=e);try{s.fingerprint=this.Yo(t,i)}catch(t){s.fingerprint=void 0}}Qo(t,i,e){var r=!1;return Mo.forEach(e=>{var s,n=null==(s=ao(e))?void 0:s.storageGroup;if(!(i===Fo&&this.Eo&&n||i!==Fo&&n!==i)){var o=e in t,a=this.ta(e,o?t[e]:void 0),l=this.Po.has(e)?e in this.props:o;l===e in this.props&&No(a,this.props[e])||(l?this.ea(e,a,!1):this.ia(e,!1),r=!0)}}),r&&e&&this.Lo.forEach(t=>t()),r}ra(){if(!this.Mo)return!1;try{this.$o=!1;var t,i=Ws.Lt(this.jo),e=this.Zo(Fo),r=!1,s=!1;if(i!==e.storageValue)if(Ti(i))e.storageValue=null;else{if(t=Lo(i),this.$o=!this.Oo&&this.Jo(t),this.$o)return!1;s=this.Qo(t,Fo,!1),!this.Eo||No(this.Ko().main,t)?this.Xo(t,Fo,!0,i):e.storageValue=i,r=!0}return this.Eo&&so.forEach(i=>{var e=Ws.Lt(this.Wo(i)),n=this.Zo(i),o=t||{},a=r&&Mo.some(t=>{var e;return(null==(e=ao(t))?void 0:e.storageGroup)===i&&t in o});if(e!==n.storageValue||a){if(Ti(e))return n.storageValue=null,n.persisted=!1,void(a&&(s=this.Qo(o,i,!1)||s));var l=Lo(e);s=this.Qo(l,i,!1)||s,this.Xo(l,i,!0,e)}}),s}catch(t){return!1}}Go(t,i){this.Po.set(t,i);var e=ao(t);null!=e&&e.volatile||(this.Zo((this.Eo?null==e?void 0:e.storageGroup:void 0)||Fo).fingerprint=void 0,this.na(t))}sa(){Mo.forEach(t=>this.Po.set(t,!0))}zo(){if(this.Mo)try{var t=Ws.Lt(this.jo),i=Lo(t);this.Zo(Fo).storageValue=t,Mo.forEach(t=>{var e,r=this.Eo?null==(e=ao(t))?void 0:e.storageGroup:void 0,s=r?Ws.Lt(this.Wo(r)):null;if(r){var n=this.Zo(r);n.storageValue=s,n.persisted=!Ti(s)}var o=r&&!Ti(s)?Lo(s):i;t in this.props?this.oa(t,o[t],this.props[t]):t in o&&this.Go(t,!0)})}catch(t){}}ta(t,i){var e=this.Po.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){var r=new Set(yi(i)?i:[]),n=new Set(yi(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?r.add(t):r.delete(t)),Array.from(r)}var o=Si(i)?s({},i):{},a=Si(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in a?o[t]=a[t]:delete o[t]}),o}oa(t,i,e){if(Do(t)){var r=this.Po.get(t);if(!0!==r){var s=i;if(this.Mo)try{var n,o=this.Eo?null==(n=ao(t))?void 0:n.storageGroup:void 0,a=o?this.Wo(o):this.jo;s=Lo(Ws.Lt(a))[t]}catch(t){}var l=new Set(r||[]);if("$active_feature_flags"===t){if(!Ei(i)&&!yi(i)||!Ei(s)&&!yi(s)||!yi(e))return void this.Go(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(!Si(e))return void(No(s,e)?this.Po.delete(t):this.Go(t,!0));if(!Ei(i)&&!Si(i)||Ei(i)&&xi(e)&&Ei(s))return void this.Go(t,!0);var v=Si(i)?i:{},c=Si(s)?s:{};new Set([...Object.keys(v),...Object.keys(e)]).forEach(t=>{t in v==t in e&&No(v[t],e[t])||l.add(t)}),l.forEach(t=>{t in c==t in e&&No(c[t],e[t])&&l.delete(t)})}l.size?this.Go(t,l):this.Po.delete(t)}}}aa(){var t,i=null==(t=this.Rn)?void 0:t.persistence_save_debounce_ms;return Ri(i)&&i>0?i:0}la(t){if(this.Rn.cookieWinsOnConflict&&"localstorage+cookie"===this.Rn.persistence.toLowerCase())if(t)try{var i=Qs(t,this.Rn.cookie_persisted_properties||[]),e=tn(i,this.Rn.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=qs.Lt(this.jo)||void 0;s&&rn(this.jo,s)===r&&(this.ua=r,this.ha=s)}catch(t){}else try{var n=qs.Lt(this.jo)||void 0;this.ua=n?rn(this.jo,n):void 0,this.ha=n}catch(t){}}syncCookieProperties(){return this.da(this.Rn)}da(t,i){if(void 0===i&&(i=!1),this.gi&&!i||this.Ao||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=qs.Lt(this.jo)||void 0}catch(t){}if(!e||e===this.ha)return!1;var r,s=rn(this.jo,e);try{r=Xs(JSON.parse(e))}catch(t){return!1}if((qs.Lt(this.jo)||void 0)!==e)return!1;this.ua=s,this.ha=e;var n=en(this.jo,e),o=[...Ks,...n.properties],a={};if(Object.keys(r).forEach(t=>{var i=r[t];(Ei(i)||Ti(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,u=h[d],v=h[mt],c=xs({},h);[...Ks,...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=c[t];(n.isValid||-1===Ks.indexOf(t)||!1!==i&&0!==i)&&delete c[t]}}),this.props=xs(c,r),Mo.forEach(t=>{var i=t in this.props;t in h===i&&No(h[t],this.props[t])||(i?this.oa(t,h[t],this.props[t]):this.Go(t,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this.ea(mt,jt);var p=this.props[d],_=this.props[mt];return!l||p===u&&_===v||(this.Oo=!0,this.Ro=!0,an.Ot(Ao(this.jo),!0),this.ia(Z),this.ia(V),this.ia(q),this.ia(G),this.ia(K),this.ia(J),this.ia(gt),this.ia(_t),this.ia(ft),"anonymous"!==_||"identified"!==v&&"anonymous"!==r.$user_state&&(Ei(u)||p===u)||(jo(this.props,r),this.ia(tt)),"identified"===_?this.props.$user_id=p:delete this.props.$user_id,this.ia(f)),!0}consumeCookieIdentityChange(){var t=Ao(this.jo),i=this.Ro||!!an.Lt(t);return this.Ro=!1,i&&an.Dt(t),i}va(t){return void 0===t&&(t=!1),!(this.Ao||this.gi&&!t||!this.Rn.cookieWinsOnConflict||"localstorage+cookie"!==this.Rn.persistence.toLowerCase()||(this.Ao=!0,0))}ca(){this.Ao&&(Ei(this.fa)||(clearTimeout(this.fa),this.fa=void 0),delete this.To[Fo],this.pa(!0))}ga(t){if(void 0===t&&(t=!0),this.Ao)try{t?this.ca():Ei(this.fa)||(clearTimeout(this.fa),this.fa=void 0)}finally{this.Ao=!1}}isDisabled(){return!!this.gi}Bo(t){-1===Oo.indexOf(t.persistence.toLowerCase())&&(bs.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=[...Ks,...t];return s({},Ws,{Nt(t){try{var r,s={};try{r=qs.Lt(t)||void 0,s=r?Xs(JSON.parse(r)):{}}catch(t){}var n,o=JSON.parse(Ws.Lt(t)||"{}");if(i){var a=en(t,r),l=[...Ks,...a.properties],h={};Object.keys(s).forEach(t=>{var i=s[t];Ti(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(h[t]=i)});var u="distinct_id"in h||"anonymous"===h.$user_state||"identified"===h.$user_state;if(Object.keys(h).length>0){var v,c=o[d],f=null!==(v=o.$user_state)&&void 0!==v?v:"anonymous";e.forEach(t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(u||"distinct_id"!==t&&"$user_state"!==t)){var i=o[t];(a.isValid||-1===Ks.indexOf(t)||!1!==i&&0!==i)&&delete o[t]}}),!u||"$user_state"in s||"$user_state"in o||(o[mt]=jt),!u||("distinct_id"in h?h[d]:o[d])===c&&("$user_state"in h?h[mt]:o[mt])===f||(Gs.forEach(t=>delete o[t]),"identified"===h.$user_state&&"distinct_id"in h?o.$user_id=h[d]:delete o.$user_id,"identified"!==h.$user_state&&(delete o[it],delete o[tt]),delete o.__alias)}n=xs(o,h)}else n=xs(s,o);return Ws.Ot(t,n),n}catch(t){}return null},Ot(e,r,s,n,o,a){var l=Ws.Ot(e,r,void 0,void 0,a);try{var h=Qs(r,t);if(Object.keys(h).length){if(i){var u=Js(e),d=tn(h,t);if(qs.Ot(u,d,s,n,o,a),qs.Lt(u)!==JSON.stringify(d)){qs.Dt(u,n);var v=Qs(r);return qs.Ot(e,v,s,n,o,a),l}}qs.Ot(e,h,s,n,o,a)}}catch(t){Ws.Pt(t)}return l},Dt(t,i){try{null==Kt||Kt.localStorage.removeItem(t),qs.Dt(t,i),qs.Dt(Js(t),i)}catch(t){Ws.Pt(t)}}})}(t.cookie_persisted_properties||[],t.cookieWinsOnConflict),r=!1,n=!1,o=t.persistence.toLowerCase();return"localstorage"===o&&Ws.Et()?(i=Ws,n=!0):"localstorage+cookie"===o&&e.Et()?(i=e,n=!0,r=!0):"sessionstorage"===o&&an.Et()?i=an:"memory"===o?i=nn:"cookie"===o&&qs.Et()?(i=qs,r=!0):e.Et()?(i=e,n=!0,r=!0):qs.Et()?(i=qs,r=!0):i=nn,this.Mo=n,this.Io=r,i}Wo(t){return this.jo+"__"+t}Ho(t){return this.Mo&&!!t.split_storage}properties(){var t={};return Ss(this.props,(i,e)=>{var r=ao(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.gi||t){var i=this.Rn.cookieWinsOnConflict&&"localstorage+cookie"===this.Rn.persistence.toLowerCase(),e=i?Ws.Nt(this.jo):null,r={};if(i)try{Ss(r=Xs(qs.Nt(this.jo)),(t,i)=>{(Ei(t)||Ti(t)||""===t)&&delete r[i]})}catch(t){}var s=this.fo.Nt(this.jo);if(s&&(this.props=xs({},s)),this.Eo&&this.ma(),i&&s){var n,o,a=null==e?void 0:e[d],l=null!==(n=null==e?void 0:e.$user_state)&&void 0!==n?n:"anonymous",h=s[d],u=null!==(o=s.$user_state)&&void 0!==o?o:"anonymous";if(h!==a||u!==l){this.Ro=!0,an.Ot(Ao(this.jo),!0);var v=xs({},this.props);Gs.forEach(t=>delete v[t]),"anonymous"!==u||"identified"!==l&&"anonymous"!==r.$user_state&&(Ei(a)||h===a)||(jo(v,r),delete v[tt]),this.props=v;var c=new Set;Gs.forEach(t=>{var i,e=null==(i=ao(t))?void 0:i.storageGroup;e&&c.add(e)}),c.forEach(t=>{var i={};Ss(this.props,(e,r)=>{var s;(null==(s=ao(r))?void 0:s.storageGroup)===t&&(i[r]=e)}),xi(i)?(Ws.Dt(this.Wo(t)),this.To[t]={}):Ws.Ot(this.Wo(t),i)&&(this.To[t]={persisted:!0,fingerprint:this.Yo(i,t)})})}}an.Lt(Ao(this.jo))&&(this.Ro=!0)}}ma(){for(var t of so){var i=Ws.Nt(this.Wo(t));if(i&&!xi(i)){var e=this.Zo(t);e.persisted=!0,this.ya(t)||(e.fingerprint=this.Yo(i,t)),this.ba(t,i)||xs(this.props,i)}}}ya(t){return Object.keys(this.props).some(i=>{var e;return(null==(e=ao(i))?void 0:e.storageGroup)===t})}ba(t,i){var e=Co[t];if(!e)return!1;var r=i[e],s=this.props[e];return Ri(r)&&Ri(s)&&s>r}refreshKey(t){var i;if(!(this.gi||"$fbc_persistence"===t&&this.Do)){var e=this.Eo?null==(i=ao(t))?void 0:i.storageGroup:void 0,r=e?Ws.Nt(this.Wo(e)):this.fo.Nt(this.jo);if(r&&t in r)this.ea(t,r[t],!1);else{if(e){var s=this.fo.Nt(this.jo);if(s&&t in s)return void this.ea(t,s[t],!1)}this.ia(t,!1)}}}save(){if(!this.gi){var t=this.aa();t>0?Ei(this.fa)&&(this.fa=setTimeout(()=>{this.fa=void 0,this.pa()},t)):this.pa()}}flush(){Ei(this.fa)||(clearTimeout(this.fa),this.fa=void 0,this.pa())}pa(t){if(void 0===t&&(t=!1),!(this.gi||this.Ao&&!t)){t||(this.syncCookieProperties(),this.Do||this.Rn.cookieWinsOnConflict&&"localstorage+cookie"===this.Rn.persistence.toLowerCase()||this.refreshKey(g));var i=!t&&!this.Fo;i||(this.$o=!1);var e=!!i&&this.ra();if(this.$o)this.Rn.debug&&bs.warn("skipping persistence write because storage belongs to a different distinct ID");else{if(this.Eo)return this._a(),void(e&&this.Lo.forEach(t=>t()));var r=this.wa(this.fo,this.jo,this.props,Fo);"written"===r&&this.la(this.props),"failed"!==r&&(this.Po.clear(),this.Oo=!1,this.Do=!1),e&&this.Lo.forEach(t=>t())}}}_a(){var t=this,i=this.Ko(),e=i.main,r=i.groups,s=this.wa(this.fo,this.jo,e,Fo);"written"===s&&this.la(e),"failed"!==s&&(this.Oo=!1,this.Do=!1,Mo.forEach(t=>{var i;null!=(i=ao(t))&&i.storageGroup||this.Po.delete(t)}));var n=function(i){var e,s=r[i];if(xi(s)&&(null==(e=t.To[i])||!e.persisted))return Mo.forEach(e=>{var r;(null==(r=ao(e))?void 0:r.storageGroup)===i&&t.Po.delete(e)}),1;var n=t.wa(Ws,t.Wo(i),s,i);"failed"!==n&&Mo.forEach(e=>{var r=ao(e);(null==r?void 0:r.storageGroup)!==i||"written"!==n&&r.volatile||t.Po.delete(e)})};for(var o of so)if(n(o))continue}Ko(){var t={},i={flags:{},surveys:{}};return Ss(this.props,(e,r)=>{var s,n=null==(s=ao(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e}),{main:t,groups:i}}Yo(t,i){if(i===Fo)return JSON.stringify(t)+"|"+this.ka+"|"+this.Sa+"|"+this.xa;var e={};return Ss(t,(t,i)=>{var r;e[i]=null!=(r=ao(i))&&r.volatile?"__volatile__":t}),JSON.stringify(e)}wa(t,i,e,r){var s,n=this.Zo(r);if(r!==Fo&&!n.dirty&&!Ei(n.fingerprint))return"skipped";try{if((s=this.Yo(e,r))===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){s=void 0}return t.Ot(i,e,this.ka,this.Sa,this.xa,this.Rn.debug)?(n.dirty=!1,r!==Fo&&(n.persisted=!0),Ei(s)||(n.fingerprint=s),this.Mo&&(n.storageValue=Ws.Lt(i)),"written"):(this.Rn.debug&&bs.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.sa(),Ei(this.fa)||(clearTimeout(this.fa),this.fa=void 0),this.fo.Dt(this.jo,!1),this.fo.Dt(this.jo,!0),!e&&this.No)for(var r of so)Ws.Dt(this.Wo(r));e?delete this.To[Fo]:this.To={},this.ua=void 0,this.ha=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(Si(t)){this.syncCookieProperties(),Ei(i)&&(i="None"),this.ka=Ei(e)?this.Ca:e;var r=!1;if(Ss(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.ea(e,t),r=!0)}),r)return this.save(),!0}return!1}register(t,i){if(Si(t)){this.syncCookieProperties(),this.ka=Ei(i)?this.Ca:i;var e=!1;if(Ss(t,(i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||Si(i)||yi(i))&&(this.ea(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.ia(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==Xt?void 0:Xt.URL;if(t!==this.qo){var i=yo(this.Rn.custom_campaign_params,this.Rn.mask_personal_data_properties,this.Rn.custom_personal_data_properties),e=!xi(Ts(i));return e&&this.register(i),this.qo=t,e?i:void 0}}update_search_keyword(){var t;this.register((t=null==Xt?void 0:Xt.referrer)?So(t):{})}update_referrer_info(){var t;this.register_once({$referrer:ko(),$referring_domain:null!=Xt&&Xt.referrer&&(null==(t=ho(Xt.referrer))?void 0:t.host)||Eo},void 0)}set_initial_person_info(){if(!this.props.$initial_campaign_params&&!this.props.$initial_referrer_info){var t=$o(this.Rn.mask_personal_data_properties,this.Rn.custom_personal_data_properties,this.Rn.disable_capture_url_hashes);this.register_once({[xt]:this.Io?{r:Io(t.r),u:t.u?Io(t.u):void 0}:t},void 0)}}get_initial_props(){var t={};Ss([St,wt],i=>{var e=this.props[i];e&&Ss(e,function(i,e){t["$initial_"+di(e)]=i})});var i=this.props[xt];return i&&xs(t,function(t,i){void 0===i&&(i=!1);var e=To(t,i),r={};return Ss(e,function(t,i){r["$initial_"+di(i)]=t}),r}(i,this.Rn.disable_capture_url_hashes)),t}safe_merge(t){return Ss(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){var r=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every((t,i)=>t===r[i])})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),o=r||n,a=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,h=!!this.gi&&!l;l||this.da(i,h),this.Rn=t,!l&&(r||n||a)&&(this.ua=void 0,this.ha=void 0,this.da(s({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),h));var u=o||a?this.Bo(t):this.fo;this.Ta();var d=this.Ho(t),v=o||d!==this.Eo,c=!l&&(v||t.cross_subdomain_cookie!==this.Sa||t.secure_cookie!==this.xa)&&this.va(h);this.Fo=v;try{if(this.Ca=this.ka=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.fo=u,this.Eo=d,this.props=f,this.save()}else a&&(this.fo=u,l||(delete this.To[Fo],this.pa()))}finally{this.Fo=!1,c&&this.ga()}}Ta(){var t=this.props[xt];if(this.Io&&Si(t)&&"string"==typeof t.r){var i=Io(t.r),e="string"==typeof t.u?Io(t.u):t.u;i===t.r&&e===t.u||this.ea(xt,s({},t,{r:i,u:e}))}}set_disabled(t){this.gi=t,this.gi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Sa&&(this.Sa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.xa&&(this.xa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props.__timers||{};e[t]=i,this.ea(m,e),this.save()}remove_event_timer(t){var i=this.props.__timers||{},e=i[t];return Ei(e)||(delete i[t],this.ea(m,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.ea(t,i),this.save()}ea(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.Oo=!0),"$fbc_persistence"!==t||No(s,i)||(this.Do=!0),this.oa(t,s,i),null!=(r=ao(t))&&r.volatile||this.na(t))}ia(t,i){void 0===i&&(i=!0),delete this.props[t],i&&(Do(t)&&this.Go(t,!0),"$fbc_persistence"===t&&(this.Do=!0),this.na(t))}na(t){var i,e=null==(i=ao(t))?void 0:i.storageGroup;e&&(this.Zo(e).dirty=!0)}Zo(t){return this.To[t]||(this.To[t]={})}},Uo={GZipJS:"gzip-js",Base64:"base64"},zo={Activation:"events",Cancellation:"cancelEvents"},Ho={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},qo={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Vo={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},Wo={Popover:"popover",Inline:"inline"};function Go(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&wi(e.then)&&e.then(void 0,()=>{})}}}}var Ko={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Jo={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Yo=ys("[RateLimiter]"),Xo=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=>{Yo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void Yo.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=(Ri(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.Ma(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(yt,a),{isRateLimited:l,remainingTokens:a.tokens}}Ia(t){var i=this.instance.config.property_denylist;return!yi(i)||!i.includes(t)}Ea(){var t;if(this.Ia("$current_url")&&this.Ia("$pathname")&&null!=Qt&&Qt.pathname)return""+(null!==(t=Qt.origin)&&void 0!==t?t:"")+Qt.pathname}Ma(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.Ea(),o=this.Ia("$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}},Qo=ys("[RemoteConfig]"),Zo=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=oi._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ra(t){var i,e;null!=(i=oi.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=oi.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Aa(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 Qo.info("Using preloaded remote config",this.remoteConfig),void this.Pa(this.remoteConfig);if(this._instance.Fa())return void Qo.warn("Remote config is disabled. Falling back to local config.");this.Ra(t=>{if(!t)return Qo.info("No config found after loading remote JS config. Falling back to JSON."),void this.Aa(t=>{this.Pa(t.json,t)});this.Pa(t)})}catch(t){Qo.error("Error loading remote config",t),this.Pa()}}Pa(t,i){!t&&i&&(0===i.statusCode?i.error||Qo.warn("Failed to fetch remote config from PostHog."):Qo.error("Failed to fetch remote config from PostHog."));try{this._instance.Pa(t?{ok:!0,config:t}:{ok:!1})}catch(t){Qo.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){Qo.error("Error loading feature flags",t)}}},ta=Uint8Array,ia=Uint16Array,ea=Uint32Array,ra=new ta([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]),sa=new ta([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]),na=new ta([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),oa=function(t,i){for(var e=new ia(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new ea(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]},aa=oa(ra,2),la=aa[1];aa[0][28]=258,la[258]=28;for(var ha=oa(sa,0)[1],ua=new ia(32768),da=0;32768>da;++da){var va=(43690&da)>>>1|(21845&da)<<1;ua[da]=((65280&(va=(61680&(va=(52428&va)>>>2|(13107&va)<<2))>>>4|(3855&va)<<4))>>>8|(255&va)<<8)>>>1}var ca=function(t,i,e){for(var r=t.length,s=0,n=new ia(i);r>s;++s)++n[t[s]-1];var o,a=new ia(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new ia(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[ua[d]>>>l]=h}else for(o=new ia(r),s=0;r>s;++s)o[s]=ua[a[t[s]-1]++]>>>15-t[s];return o},fa=new ta(288);for(da=0;144>da;++da)fa[da]=8;for(da=144;256>da;++da)fa[da]=9;for(da=256;280>da;++da)fa[da]=7;for(da=280;288>da;++da)fa[da]=8;var pa=new ta(32);for(da=0;32>da;++da)pa[da]=5;var _a=ca(fa,9,0),ga=ca(pa,5,0),ma=function(t){return(t/8|0)+(7&t&&1)},ba=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof ia?ia:t instanceof ea?ea:ta)(e-i);return r.set(t.subarray(i,e)),r},ya=function(t,i,e){var r=i/8|0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},wa=function(t,i,e){var r=i/8|0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},Sa=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 ta(0),0];if(1==s){var o=new ta(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 ia(v+1),f=xa(e[u-1],c,0);if(f>i){r=0;var p=0,_=f-i,g=1<<_;for(n.sort(function(t,i){return c[i.s]-c[t.s]||t.f-i.f});s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=g-(1<<f-c[m]),c[m]=i}for(p>>>=_;p>0;){var b=n[r].s;i>c[b]?p-=1<<i-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new ta(c),f]},xa=function(t,i,e){return-1==t.s?Math.max(xa(t.l,i,e+1),xa(t.r,i,e+1)):i[t.s]=e},Ea=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new ia(++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]},ka=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},$a=function(t,i,e){var r=e.length,s=ma(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)},Ta=function(t,i,e,r,s,n,o,a,l,h,u){ya(i,u++,e),++s[256];for(var d=Sa(s,15),v=d[0],c=d[1],f=Sa(n,15),p=f[0],_=f[1],g=Ea(v),m=g[0],b=g[1],y=Ea(p),w=y[0],S=y[1],x=new ia(19),E=0;m.length>E;++E)x[31&m[E]]++;for(E=0;w.length>E;++E)x[31&w[E]]++;for(var k=Sa(x,7),T=k[0],P=k[1],R=19;R>4&&!T[na[R-1]];--R);var C,O,A,I,F=h+5<<3,M=ka(s,fa)+ka(n,pa)+o,D=ka(s,v)+ka(n,p)+o+14+3*R+ka(x,T)+(2*x[16]+3*x[17]+7*x[18]);if(M>=F&&D>=F)return $a(i,u,t.subarray(l,l+h));if(ya(i,u,1+(M>D)),u+=2,M>D){C=ca(v,c,0),O=v,A=ca(p,_,0),I=p;var N=ca(T,P,0);for(ya(i,u,b-257),ya(i,u+5,S-1),ya(i,u+10,R-4),u+=14,E=0;R>E;++E)ya(i,u+3*E,T[na[E]]);u+=3*R;for(var L=[m,w],j=0;2>j;++j){var B=L[j];for(E=0;B.length>E;++E)ya(i,u,N[U=31&B[E]]),u+=T[U],U>15&&(ya(i,u,B[E]>>>5&127),u+=B[E]>>>12)}}else C=_a,O=fa,A=ga,I=pa;for(E=0;a>E;++E)if(r[E]>255){var U;wa(i,u,C[257+(U=r[E]>>>18&31)]),u+=O[U+257],U>7&&(ya(i,u,r[E]>>>23&31),u+=ra[U]);var z=31&r[E];wa(i,u,A[z]),u+=I[z],z>3&&(wa(i,u,r[E]>>>5&8191),u+=sa[z])}else wa(i,u,C[r[E]]),u+=O[r[E]];return wa(i,u,C[256]),u+O[256]},Pa=new ea([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ra=new ta(0),Ca=function(){for(var t=new ea(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Oa=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function Aa(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=Ca[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 ta(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=$a(l,h,t.subarray(u,d)):(l[u]=n,h=$a(l,h,t.subarray(u,o)))}else{for(var v=Pa[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,_=new ia(32768),g=new ia(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 ea(25e3),S=new ia(288),x=new ia(32),E=0,k=0,T=(u=0,0),P=0,R=0;o>u;++u){var C=y(u),O=32767&u,A=g[C];if(_[O]=A,g[C]=O,u>=P){var I=o-u;if((E>7e3||T>24576)&&I>423){h=Ta(t,l,0,w,S,x,k,T,R,u-R,h),T=E=k=0,R=u;for(var F=0;286>F;++F)S[F]=0;for(F=0;30>F;++F)x[F]=0}var M=2,D=0,N=f,L=O-A&32767;if(I>2&&C==y(u-L))for(var j=Math.min(c,I)-1,B=Math.min(32767,u),U=Math.min(258,I);B>=L&&--N&&O!=A;){if(t[u+M]==t[u+M-L]){for(var z=0;U>z&&t[u+z]==t[u+z-L];++z);if(z>M){if(M=z,D=L,z>j)break;var H=Math.min(L,z-2),q=0;for(F=0;H>F;++F){var V=u-L+F+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,A=V)}}}L+=(O=A)-(A=_[O])+32768&32767}if(D){w[T++]=268435456|la[M]<<18|ha[D];var G=31&la[M],K=31&ha[D];k+=ra[G]+sa[K],++S[257+G],++x[K],P=u+M,++E}else w[T++]=t[u],++S[t[u]]}}h=Ta(t,l,n,w,S,x,k,T,R,u-R,h),n||(h=$a(l,h,Ra))}return ba(a,0,r+ma(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&&Oa(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),Oa(u,d-8,e.d()),Oa(u,d-4,r),u}var Ia=!!ti||!!Zt,Fa="text/plain",Ma=!1,Da=(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:"")},Na=function(t,i,e){var r;void 0===e&&(e=!0);var n=t.split("?"),o=n[0],a=n[1],l=s({},i),h=null!==(r=null==a?void 0:a.split("&").map(t=>{var i,r=t.split("="),s=r[0],n=e&&null!==(i=l[s])&&void 0!==i?i:r[1];return delete l[s],s+"="+n}))&&void 0!==r?r:[],u=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return Ss(t,function(t,i){Ei(t)||Ei(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},La=t=>{if(t.Oa)return t.Oa;var i=t.data,e=t.compression;if(i){if(e===Uo.GZipJS){var r=Aa(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new ta(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 ta(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 ba(e,0,r)}(lo(i)),{mtime:0});return{contentType:Fa,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Uo.Base64){var s=(t=>"data="+encodeURIComponent("string"==typeof t?t:lo(t)))(function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(lo(i)));return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var n=lo(i);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}}},ja=t=>{var i,e,r=()=>"sendBeacon"===t.transport?{url:Na(t.url,{compression:Uo.Base64}),encodedBody:La(s({},t,{compression:Uo.Base64,Oa:void 0}))}:{url:Da(t.url,"compression"),encodedBody:La(s({},t,{compression:void 0,Oa:void 0}))};try{i=La(t)}catch(i){if(Jr(t.compression,uo(t.url,"compression")))return bs.error("Failed to gzip request body, sending uncompressed payload",i),r();throw i}return i&&Jr(t.compression,uo(t.url,"compression"))&&!((e=i.body)instanceof ArrayBuffer?Kr(new Uint8Array(e)):ArrayBuffer.isView(e)&&Kr(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?(Ma=!0,r()):{url:t.url,encodedBody:i}},Ba=t=>{try{return ja(t)}catch(i){return bs.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},Ua=function(){var t=o(function*(t){var i=yield function(t,i,e){return Zr.apply(this,arguments)}(lo(t.data),h.DEBUG,{rethrow:!0});if(!i)return t;var e=yield i.arrayBuffer();return s({},t,{Oa:{contentType:Fa,body:e,estimatedSize:e.byteLength}})});return function(i){return t.apply(this,arguments)}}(),za=/Failed to fetch|NetworkError|Load failed/i,Ha=t=>"TypeError"===(null==t?void 0:t.name)&&za.test((null==t?void 0:t.message)||""),qa=t=>{var i=Ba(t);if(i){var e=new ti,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,o=s.body;Ss(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)}},Va=t=>{var i=Ba(t);if(i){var e=i.url,r=i.encodedBody,n=null!=r?r:{},o=n.contentType,a=n.body,l=n.estimatedSize,h=new Headers;Ss(t.headers,function(t,i){h.append(i,t)}),o&&h.append("Content-Type",o);var u=null,d=!1;if(ii){var v=new ii;u={signal:v.signal,timeout:setTimeout(()=>{var i;d=!0,v.abort(tr("AbortError","PostHog request timed out"+((i=t.timeout)?" after "+i+"ms":"")))},t.timeout)}}var c=i=>{d&&"AbortError"===(null==i?void 0:i.name)||Ha(i)?bs.warn(i):bs.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var f;Zt(e,s({method:(null==t?void 0:t.method)||"GET",headers:h,keepalive:"POST"===t.method&&!t.$a&&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){bs.error(t)}null==t.callback||t.callback(r)})).catch(c).finally(()=>u?clearTimeout(u.timeout):null)}catch(t){u&&clearTimeout(u.timeout),c(t)}}},Wa=t=>{try{var i,e=ja(t),r=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(Yt.sendBeacon(r,h))return;var u=yi(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(yi(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=i=>yi(t.data)?i:s({},t.data,{batch:i});return Wa(s({},t,{data:v(u.slice(0,d))})),void Wa(s({},t,{data:v(u.slice(d))}))}bs.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to "+(Zt?"fetch":"XHR")),Zt?Va(s({},t,{$a:!0})):qa(t)}catch(t){bs.warn("Beacon send failed",t)}},Ga=(t,i,e,r)=>{var n="query"===r?"POST"===i?"sent_at":"_":void 0;return Na(e===Uo.GZipJS?Da(t,"compression"):t,s({},n?{[n]:Date.now().toString()}:{},e===Uo.GZipJS?{}:{compression:e}))},Ka=[];Zt&&Ka.push({transport:"fetch",method:Va}),ti&&Ka.push({transport:"XHR",method:qa}),null!=Yt&&Yt.sendBeacon&&Ka.push({transport:"sendBeacon",method:Wa});var Ja=class{constructor(t,i){this.Da=!0,this.La=[],this.Na=zi((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,bs.createLogger("flush interval"),3e3),this.qa=t}enqueue(t){this.La.push(t),this.ja||this.Ba()}unload(){this.Ha();var t=this.La.length>0?this.za():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.Ua(s({},t,{transport:"sendBeacon"}))})}enable(){this.Da=!1,this.Ba()}Ba(){var t=this;this.Da||(this.ja=setTimeout(()=>{if(this.Ha(),this.La.length>0){var i=this.za(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&yi(e.data)&&Ss(e.data,t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp}),t.Ua(e)};for(var r in i)e()}},this.Na))}Ua(t){try{this.qa(t)}catch(t){bs.error(t)}}Ha(){clearTimeout(this.ja),this.ja=void 0}za(){var t={};return Ss(this.La,i=>{var e,r=i,n=(r?r.batchKey:null)||r.url;Ei(t[n])&&(t[n]=s({},r,{data:[]})),null==(e=t[n].data)||e.push(r.data)}),this.La=[],t}},Ya=class{constructor(t){this._instance=t,this.Wa=!1,this.Va=3e3,this.La=[],this.La=[],this.Ga=!0,this.resume()}resume(){if(!Ei(Kt)&&"onLine"in Kt.navigator){if(this.Ga=Kt.navigator.onLine,this.Za)return;this.Za=()=>{this.Ga=!0,this.Ja()},this.Qa=()=>{this.Ga=!1},Os(Kt,"online",this.Za),Os(Kt,"offline",this.Qa)}}get length(){return this.La.length}retriableRequest(t){var e=t.retriesPerformedSoFar,n=r(t,i);Ci(e)&&(n.url=Na(n.url,{retry_count:e})),this._instance._send_request(s({},n,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.ws(s({retriesPerformedSoFar:e},n));0===t.statusCode&&bs.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=e?e:0)+" retries.")}null==n.callback||n.callback(t)}}))}ws(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.La.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),bs.warn(s),this.Wa||(this.Wa=!0,this.Ka())}Ka(){if(this.Xa&&clearTimeout(this.Xa),0===this.La.length)return this.Wa=!1,void(this.Xa=void 0);this.Xa=setTimeout(()=>{this.Ga&&this.La.length>0&&this.Ja(),this.Ka()},this.Va)}Ja(){var t=Date.now(),i=[],e=this.La.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.La=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var t of(this.Xa&&(clearTimeout(this.Xa),this.Xa=void 0),this.Wa=!1,Ei(Kt)||(this.Za&&(Kt.removeEventListener("online",this.Za),this.Za=void 0),this.Qa&&(Kt.removeEventListener("offline",this.Qa),this.Qa=void 0)),this.La)){var i=t.requestOptions;try{this._instance._send_request(s({},i,{transport:"sendBeacon"}))}catch(t){bs.error(t)}}this.La=[]}},Xa=class{constructor(t){this._instance=t,this.Ya=()=>{var t,i,e,r;this.tl||(this.tl={});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.tl.lastScrollY=Math.ceil(n),this.tl.maxScrollY=Math.max(n,null!==(t=this.tl.maxScrollY)&&void 0!==t?t:0),this.tl.maxScrollHeight=Math.max(o,null!==(i=this.tl.maxScrollHeight)&&void 0!==i?i:0),this.tl.lastContentY=a,this.tl.maxContentY=Math.max(a,null!==(e=this.tl.maxContentY)&&void 0!==e?e:0),this.tl.maxContentHeight=Math.max(l,null!==(r=this.tl.maxContentHeight)&&void 0!==r?r:0)}}get el(){return this._instance.config.scroll_root_selector}getContext(){return this.tl}resetContext(){var t=this.tl;return setTimeout(this.Ya,0),t}startMeasuringScrollPosition(){Os(Kt,"scroll",this.Ya,{capture:!0}),Os(Kt,"scrollend",this.Ya,{capture:!0}),Os(Kt,"resize",this.Ya)}scrollElement(){var t;if(!this.el)return null==Kt||null==(t=Kt.document)?void 0:t.documentElement;for(var i of yi(this.el)?this.el:[this.el]){var e,r=null==Kt||null==(e=Kt.document)?void 0:e.querySelector(i);if(r)return r}}il(t){var i,e,r="y"===t?"scrollTop":"scrollLeft";if(this.el){var s=this.scrollElement();return s&&s[r]||0}return Kt?"y"===t?Kt.scrollY||Kt.pageYOffset||(null==(i=Kt.document)||null==(i=i.documentElement)?void 0:i.scrollTop)||0:Kt.scrollX||Kt.pageXOffset||(null==(e=Kt.document)||null==(e=e.documentElement)?void 0:e.scrollLeft)||0:0}scrollY(){return this.il("y")}scrollX(){return this.il("x")}},Qa=t=>$o(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),Za=class{constructor(t,i,e,r){this.Be=t=>{var i=this.rl();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.nl(this._instance)};this.sl.register({[bt]:e})}},this._instance=t,this.ol=i,this.sl=e,this.nl=r||Qa,this.ol.onSessionId(this.Be)}rl(){return this.sl.props[bt]}getSetOnceProps(){var t,i=null==(t=this.rl())?void 0:t.props;return i?"r"in i?To(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 Ss(Ts(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+di(e)]=i}),t}},tl=class{on(t,i){return this.al[t]||(this.al[t]=[]),this.al[t].push(i),()=>{this.al[t]=this.al[t].filter(t=>t!==i)}}emit(t,i){for(var e of this.al[t]||[])e(i);for(var r of this.al["*"]||[])r(t,i)}constructor(){this.al={}}},il=ys("[SessionId]"),el=864e5,rl=class{on(t,i){return this.ll.on(t,i)}constructor(t,i,e){var r;if(this.ul=null,this.hl=null,this.dl=[],this.vl=void 0,this.cl=!1,this.ll=new tl,this.fl=(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.Rn=t.config,this.sl=t.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.pl=void 0,this._sessionActivityTimestamp=null,this.gl=i||js,this.ml=e||js;var s=this.Rn.persistence_name||this.Rn.token;if(this._sessionTimeoutMs=1e3*zi(this.Rn.session_idle_timeout_seconds||1800,60,36e3,il.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.yl(),this.bl="ph_"+s+"_window_id",this._l="ph_"+s+"_primary_window_exists",this.wl()){var n=an.Nt(this.bl),o=an.Nt(this._l);n&&!o?this.He=n:an.Dt(this.bl),an.Ot(this._l,!0)}null!=(r=this.Rn.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.Rn.bootstrap.sessionID),this.kl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Ei(this.dl)&&(this.dl=[]),this.dl.push(t),this.Xt&&t(this.Xt,this.He),()=>{this.dl=this.dl.filter(i=>i!==t)}}wl(){return"memory"!==this.Rn.persistence&&!this.sl.gi&&an.Et()}Sl(t){t!==this.He&&(this.He=t,this.wl()&&an.Ot(this.bl,t))}xl(){return this.He?this.He:this.wl()?an.Nt(this.bl):null}Cl(t){var i=this.ul;return!Ti(i)&&!Ti(t)&&5e3>Math.abs(t-i)}Tl(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this.Xt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Xt=t,s&&!r||s&&this.Cl(i)||(this.ul=i,this.sl.register({[N]:[i,t,e]}))}Ml(){var t,i=null==(t=this.Rn)?void 0:t.persistence_save_debounce_ms;return Ci(i)&&i>0}Il(){this.Ml()?this.sl.refreshKey(N):(this.sl.flush(),this.sl.load())}El(){var t;if(!Ti(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.ul){this.Il();var i=this.Rl();i[1]===this.Xt&&i[2]===this._sessionStartTimestamp&&(this.ul=this._sessionActivityTimestamp,this.sl.register({[N]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.sl.flush())}}Al(){var t=this.Rl()[0],i=Ci(t)?t:0,e=Ci(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Pl(t){return this.Il(),this.fl(t,this.Al())}Rl(){var t=this.sl.props[N];return yi(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.ul=null,this.pl=void 0,clearTimeout(this.Fl),this.Fl=void 0,this.Tl(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 il.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void il.error("Invalid sessionID in bootstrap",t)}}(t);return!Ei(e)&&(i?this.pl={sessionId:t,sessionStartTimestamp:e}:this.Tl(t,(new Date).getTime(),e),!0)}destroy(){this.cl=!0,this.El(),clearTimeout(this.Fl),this.Fl=void 0,this.vl&&Kt&&(Kt.removeEventListener(Ht,this.vl,{capture:!1}),this.vl=void 0),this.dl=[]}kl(){this.vl=()=>{this.El(),this.wl()&&an.Dt(this._l)},Os(Kt,Ht,this.vl,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),"always"===this.Rn.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this.Xt;if(e)this.hl=r;else if(Ti(this.hl)||this.hl>r||r-this.hl>=1e3){var n,o;null==(n=(o=this.sl).syncCookieProperties)||n.call(o),this.hl=r}var a=this.Rl(),l=a[1],h=a[2],u=!Ei(s)&&l!==s,d=this.Al(),v=this.xl(),c=this.pl,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>el),p=c?f:Ci(h)&&Math.abs(r-h)>el,_=!1,g=u,m=!l||!!c,b=l,y=!m&&!t&&this.fl(r,d);if(y){(y=this.Pl(r))||il.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.Rl();l=w[1],h=w[2]}if(m||y||p){g=!1;var S=c&&!f;l=S?c.sessionId:this.gl(),v=this.ml(),il.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!S,changeReason:{noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p}}),h=S?c.sessionStartTimestamp:r,this.pl=void 0,_=!0}else v||(v=this.ml(),_=!0),(g=g||l!==b)&&(il.info("adopted cross-tab session id",{sessionId:l,windowId:v}),_=!0);var x=Ci(d)&&t&&!p?d:r,E=Ci(h)?h:(new Date).getTime();this.Sl(v),this.Tl(l,x,E),t||this.yl();var k={noSessionId:m,activityTimeout:y,sessionPastMaximumLength:p,crossTabAdoption:g};return _&&this.dl.forEach(t=>t(l,v,k)),{sessionId:l,windowId:v,sessionStartTimestamp:E,changeReason:_?k:void 0,lastActivityTimestamp:d}}yl(){this.cl||(clearTimeout(this.Fl),this.Fl=setTimeout(()=>{if(!this.cl)if(this.Pl((new Date).getTime())){var t=this.Xt;this.resetSessionId(),this.ll.emit("forcedIdleReset",{idleSessionId:t})}else this.yl()},1.1*this.sessionTimeoutMs))}},sl=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&li(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some(t=>li(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function nl(){return(nl=o(function*(){var t=null==Yt?void 0:Yt.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 bs.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function ol(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 al(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var ll=(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}},hl=t=>t.toLowerCase(),ul={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=>ll(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!ll(i,t))),icontains:(t,i)=>i.map(hl).some(i=>t.map(hl).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(hl).every(i=>t.map(hl).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 dl(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=ul[e.operator];return!!s&&s(e.values,[String(r)])})}function vl(t,i,e){return lo({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var cl="custom",fl="i.posthog.com",pl=/^\/static\//,_l=["/s/","/e/","/i/"],gl=class{constructor(t){this.Ol={},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("."+fl,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.Ol[this.apiHost]||(this.Ol[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":cl),this.Ol[this.apiHost]}$l(t){if(pl.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}Dl(t){var i=ho(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}Ll(t,i,e){if("ui"===t)return e;var r=e,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=ho(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&_l.some(t=>0===i.indexOf(t))){var a=this.Dl(r);if(a){var l,h=this.apiHost,u=this.Nl;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(this.Nl=u={apiHost:h,rewriteRequestPath:s,urls:new Set}),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.Nl,e=this.Dl(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.Ll(t,i,this.uiHost+i);if("flags"===t)return this.Ll(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.$l(i);if(e)return this.Ll(t,i,""+e+i)}if(this.region===cl)return this.Ll(t,i,this.apiHost+i);var r=fl+i;switch(t){case"assets":return this.Ll(t,i,"https://"+this.region+"-assets."+r);case"api":return this.Ll(t,i,"https://"+this.region+"."+r)}}},ml=ys("[Surveys]"),bl=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){ml.error("Failed to persist survey seen state",t)}},yl=[Ho.Popover,Ho.Widget,Ho.API],wl={ignoreConditions:!1,ignoreDelay:!1,displayType:Wo.Popover},Sl=ys("[PostHog ExternalIntegrations]"),xl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},El=class{constructor(t){this._instance=t}bo(t,i){var e;null==(e=oi.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,t=>{if(t)return Sl.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=oi.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t.bo(xl[n],()=>{var i;null==(i=oi.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)}),!o&&null!=(r=oi.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=oi.__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()}}},kl=class{constructor(t,i){this.A=t,this.Js=i,this.ql=new Map,this.ro=!1}add(t){var i=this;return o(function*(){if(i.ro)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.ql.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.ql.set(t.name,t);try{var e=t.setup(i.Js);e&&(yield e)}catch(e){var r=i.ql.get(t.name)===t;r&&i.ql.delete(t.name),i.A.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.jl(t)}})()}getExtension(t){return this.ql.get(t)}dispose(){if(!this.ro){this.ro=!0;var t=Array.from(this.ql.values()).reverse();for(var i of(this.ql.clear(),t))this.jl(i)}}jl(t){try{var i=null==t.dispose?void 0:t.dispose();i&&wi(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)}}},$l=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);Ei(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)}},Tl="extensionsRemoteConfig",Pl=class{constructor(t){this.instance=t,this.ro=!1,this.A=bs,this.Bl=t.Hl,this.kv=new $l(t),this.onEvent=t=>Go(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.ro)return Go(()=>{});var i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.zl.on(Tl,i);return this.Bl&&i(this.Bl),Go(e)},this.Ul=new kl(bs.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(v);return"string"==typeof t?t:void 0}get library(){return{name:h.LIB_NAME,version:h.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.Ul.add(t)}getExtension(t){return this.Ul.getExtension(t)}capture(t,i,e){var r=this;return o(function*(){e?r.instance.capture(t,i,{timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce}):r.instance.capture(t,i)})()}registerDynamicEventProperties(t){return Go(this.instance.Wl(t))}handleRemoteConfig(t){this.ro||(this.Bl=t,this.instance.zl.emit(Tl,t))}sendRequest(t,i){var e=this;return o(function*(){var r;void 0===i&&(i={});var s=e.instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",t),n={method:i.method,url:i.query?Na(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?fi.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.ro||(this.ro=!0,this.Ul.dispose())}},Rl={},Cl=0,Ol=()=>{},Al='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Il="Surveys module not available",Fl="sanitize_properties is deprecated. Use before_send instead",Ml="Invalid value for property_denylist config: ",Dl=/^[A-Za-z0-9_-]{1,400}$/,Nl=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Ll=["token","distinct_id",$t],jl="posthog",Bl=!Ia&&-1===(null==ri?void 0:ri.indexOf("MSIE"))&&-1===(null==ri?void 0:ri.indexOf("Mozilla")),Ul=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},zl=t=>{var i;return s({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Cs(null==Xt?void 0:Xt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ol,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:Qt&&ki(null==Qt?void 0:Qt.search)&&-1!==Qt.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==Kt||null==(i=Kt.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){bs.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:Ut,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:Ol},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Tn,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Ul(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))},Hl=[["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"]],ql=t=>{var i={};for(var e of Hl){var r=e[0],s=e[1];Ei(t[r])||(i[s]=t[r])}var n=xs({},i,t),o=t.__preview_external_dependency_versioned_paths;return Ei(o)||(Ei(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),ki(o)&&Ei(t.asset_host)&&(n.asset_host=o)),yi(t.property_blacklist)&&(Ei(t.property_denylist)?n.property_denylist=t.property_blacklist:yi(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:bs.error(Ml+t.property_denylist)),n},Vl=class{constructor(){this.__forceAllowLocalhost=!1}get Vl(){return this.__forceAllowLocalhost}set Vl(t){bs.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Wl=(t=class t{Gl(t){if(t){var i=this.ql.indexOf(t);-1!==i&&this.ql.splice(i,1)}}Zl(t,i){return this.Gl(t),this.ql.push(i),null==i.initialize||i.initialize(),i}Jl(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}Ql(){if(!(this.Kl||this.config.reuseAnonymousId||this.config.segment||this.Jl())){var t,i,e,r="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;(r||this.config.disable_persistence)&&(this.Xl||(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.Kl=!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)))}}Yl(){if(!this.Jl()&&"$posthog_cookieless"===this.get_distinct_id()){var t=this.persistence;if(t){this.tu()||t.load(!0);var i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){var e=this.config.get_device_id(js());this.register({distinct_id:e,$device_id:e}),t.set_property(mt,jt)}this.eu()}}}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.iu=!1,this.ru=!1,this.webPerformance=new Vl,this.nu=!1,this.version=h.LIB_VERSION,this.su=new Set,this.ou="",this.zl=new tl,this.ql=[],this.au=[],this.Xl=!1,this.Kl=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=zl(),this.SentryIntegration=eo,this.sentryIntegration=t=>function(t,i){var e=io(t,i);return{name:to,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.lu=!1,this.uu=null,this.hu=null,this.du=null,this.scrollManager=new Xa(this),this.pageViewManager=new ro(this),this.rateLimiter=new Xo(this),this.requestRouter=new gl(this),this.consent=new ln(this),this.externalIntegrations=new El(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=>bs.info('send "'+(null==t?void 0:t.event)+'"',t))}init(i,e,r){if(r&&r!==jl){var s,n=null!==(s=Rl[r])&&void 0!==s?s:new t;return n._init(i,e,r),Rl[r]=n,Rl[jl][r]=n,n}return this._init(i,e,r)}_init(t,i,e){var r,n,o;void 0===i&&(i={});var a,l=ki(t)?t.trim():"";if(!l)return bs.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 l!==(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('"+l+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=zl(i.defaults),i.debug=this.vu(i.debug),this.cu=i,this.fu=[],i.person_profiles?this.hu=i.person_profiles:i.process_person&&(this.hu=i.process_person);var u=zl(i.defaults),d=ql(i),v=xs({},u,d,{name:e,token:l});Si(u.rageclick)&&Si(d.rageclick)&&(v.rageclick=xs({},u.rageclick,d.rageclick)),Si(u.session_recording)&&Si(d.session_recording)&&(v.session_recording=xs({},u.session_recording,d.session_recording)),this.set_config(v),this.config.on_xhr_error&&bs.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Uo.GZipJS;var f=this.tu();if(this.persistence=new Bo(this.config,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Bo(s({},this.config,{persistence:"sessionStorage"}),f,!1),this.ou="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!f&&an.Et()){var p=an.Nt(this.ou);yi(p)&&p.forEach(t=>{ki(t)&&this.su.add(t)})}else an.Dt(this.ou);var _=s({},this.persistence.props),g=s({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.pu=new Ja(t=>this.gu(t),this.config.request_queue_config),this.mu=new Ya(this),this.__request_queue=[];var m=this.Jl();m||(this.sessionManager=new rl(this),this.sessionPropsManager=new Za(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.yu()})),this.bu(),this.config.__preview_deferred_init_extensions?(bs.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this._u(m)},0)):(bs.info("Initializing extensions synchronously"),this._u(m)),h.DEBUG=h.DEBUG||this.config.debug,h.DEBUG&&bs.info("Starting in debug mode",{this:this,config:i,thisC:s({},this.config),p:_,s:g}),!this.config.identity_distinct_id||null!=(r=i.bootstrap)&&r.distinctID||(i.bootstrap=s({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));var b=null==(n=i.bootstrap)?void 0:n.distinctID;if(this.Xl=!!b&&!$i(b),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var y=i.bootstrap.distinctID,w=this.get_distinct_id(),S=this.persistence.get_property(mt);if(i.bootstrap.isIdentifiedID&&null!=w&&w!==y&&"anonymous"===S)this.identify(y);else if(i.bootstrap.isIdentifiedID&&null!=w&&w!==y&&"identified"===S)bs.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 x=this.config.get_device_id(js()),E=i.bootstrap.isIdentifiedID?x:y;this.persistence.set_property(mt,i.bootstrap.isIdentifiedID?Bt:jt),this.register({distinct_id:y,$device_id:E})}}if(m)this.register_once({distinct_id:kt,$device_id:null},"");else if(!this.get_distinct_id()){var k=this.config.get_device_id(js());this.register_once({distinct_id:k,$device_id:k},""),this.persistence.set_property(mt,jt)}return Os(Kt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Os(Kt,"pageshow",()=>{var t;this.iu=!1,this.ru||null==(t=this.mu)||t.resume()}),i.segment?Zn(this,()=>this.wu()):this.wu(),wi(this.config._onCapture)&&this.config._onCapture!==Ol&&(bs.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&bs.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 nl.apply(this,arguments)}().then(t=>{t&&this.register({[c]:t})}).catch(Ol),this}ku(t){var i=t;return ki(i.name)&&wi(i.setup)}Su(t,i){this.ku(t)?i.push(()=>{this.xu().add(t).catch(()=>null==t.dispose?void 0:t.dispose()).catch(i=>{bs.error('Failed to dispose browser extension "'+t.name+'"',i)})}):this.ql.push(t)}bu(){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.Cu)||o.call(this),this.Cu=void 0,this.featureFlags=new a(this)),wi(this.featureFlags.onReloading)&&wi(this.featureFlags.setup)?this.Cu||(this.Cu=this.featureFlags.onReloading(()=>{this.zl.emit("featureFlagsReloading",!0)}),this.xu().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}_u(i){var e,r,n,o,a,l,h,u=performance.now(),d=s({},t.__defaultExtensionClasses,this.config.__extensionClasses),v=[];d.exceptions&&this.ql.push(this.exceptions=null!==(e=this.exceptions)&&void 0!==e?e:new d.exceptions(this)),d.historyAutocapture&&this.ql.push(this.historyAutocapture=new d.historyAutocapture(this)),d.tracingHeaders&&this.ql.push(this.tracingHeaders=new d.tracingHeaders(this)),d.siteApps&&this.ql.push(this.siteApps=new d.siteApps(this)),d.sessionRecording&&!i&&this.ql.push(this.sessionRecording=new d.sessionRecording(this)),this.config.disable_scroll_properties||v.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),d.autocapture&&this.Su(this.autocapture=new d.autocapture(this),v),d.surveys&&this.Su(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new d.surveys(this),v),d.logs&&this.Su(this.logs=null!==(n=this.logs)&&void 0!==n?n:new d.logs(this),v),d.metrics&&this.ql.push(this.metrics=null!==(o=this.metrics)&&void 0!==o?o:new d.metrics(this)),d.conversations&&this.ql.push(this.conversations=null!==(a=this.conversations)&&void 0!==a?a:new d.conversations(this)),d.productTours&&this.ql.push(this.productTours=new d.productTours(this)),d.heatmaps&&this.ql.push(this.heatmaps=new d.heatmaps(this)),d.webVitalsAutocapture&&this.ql.push(this.webVitalsAutocapture=new d.webVitalsAutocapture(this)),d.exceptionObserver&&this.ql.push(this.exceptionObserver=new d.exceptionObserver(this)),d.deadClicksAutocapture&&this.ql.push(this.deadClicksAutocapture=new d.deadClicksAutocapture(this,Yn)),d.toolbar&&this.ql.push(this.toolbar=null!==(l=this.toolbar)&&void 0!==l?l:new d.toolbar(this)),d.experiments&&this.ql.push(this.experiments=null!==(h=this.experiments)&&void 0!==h?h:new d.experiments(this)),this.ql.forEach(t=>{t.initialize&&v.push(()=>{null==t.initialize||t.initialize()})}),v.push(()=>{if(this.Tu){var t=this.Tu;this.Tu=void 0,this.ql.forEach(i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t))}}),this.Mu(v,u)}Mu(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this.Mu(t,i)},0);var e=t.shift();if(e)try{e()}catch(t){bs.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[Tt]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Pt]:r}),this.config.__preview_deferred_init_extensions&&bs.info("PostHog extensions initialized ("+r+"ms)")}Pa(t){var i;if(!Xt||!Xt.body)return bs.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Pa(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Tu=t),this.Hl=t,this.compression=void 0,t.ok){var e,r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=hi(r.supportedCompression,Uo.GZipJS)?Uo.GZipJS:hi(r.supportedCompression,Uo.Base64)?Uo.Base64:void 0),null!=(e=r.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.hu?this.hu:Ut}),null==(i=this.Iu)||i.handleRemoteConfig(t),this.ql.forEach(i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t))}wu(){try{this.config.loaded(this)}catch(t){bs.critical("`loaded` function failed",t)}if(this.Eu(),this.config.internal_or_test_user_hostname&&null!=Qt&&Qt.hostname){var t=Qt.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.Jl())&&this.Ru()},1),this.Au=new Zo(this),this.Au.load()}Eu(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.pu)||t.enable())}_dom_loaded(){this.is_capturing()&&ws(this.__request_queue,t=>this.gu(t)),this.__request_queue=[],this.Eu()}_handle_unload(){var t,i,e,r,s;this.iu=!0,null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.Pu()&&this.capture(Vt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.pu)||r.unload(),null==(s=this.mu)||s.unload()):this.Pu()&&this.capture(Vt,null,{transport:"sendBeacon"})}_send_request(t){var i;this.__loaded?Bl?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=s({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?null!==(i=this.compression)&&void 0!==i?i:t.compressionFallback:t.compression,(Ei(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var i,e,r,n=s({},t);n.timeout=n.timeout||6e4;var o,a,l,h,u,d=null!==(i=n.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&Ei(n.compression)&&n.data&&(n.compression=Uo.Base64),"POST"===n.method&&n.data&&("capture-body"===n.timestampMode?n.data={api_key:null!==(a=null==(u=(h=(yi(o=n.data)?o:[o]).map(t=>s({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})))[0])||null==(l=u.properties)?void 0:l.token)&&void 0!==a?a:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===n.timestampMode&&(n.data=function(t,i){return void 0===i&&(i=(new Date).toISOString()),yi(t)?t.map(t=>s({},t,{sent_at:i})):s({},t,{sent_at:i})}(n.data))),n.url=Ga(n.url,n.method,n.compression,n.timestampMode);var v=Ka.filter(t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport)),c=null!==(e=null==(r=function(t,i){for(var e=0;t.length>e;e++)if(i(t[e]))return t[e]}(v,t=>t.transport===d))?void 0:r.method)&&void 0!==e?e:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){Ha(t)?bs.warn(t):bs.error(t),null==n.callback||n.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&n.data&&n.compression===Uo.GZipJS&&ei&&"undefined"!=typeof Promise&&!Ma?Ua(n).then(t=>{f(t)}).catch(i=>{if(Yr(i))return Ma=!0,void f(s({},n,{compression:void 0,url:Ga(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 Yr(t)||i===Gr})(i)&&(Ma=!0),f(n)}):c(n)})(s({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}gu(t){this.mu?this.mu.retriableRequest(t):this._send_request(t)}_execute_array(t){Cl++;try{var i,e=[],r=[],s=[];ws(t,t=>{if(t)if(yi(i=t[0]))s.push(t);else if(wi(t))try{t.call(this)}catch(i){bs.error("Error executing queued PostHog call",t,i)}else yi(t)&&"alias"===i?e.push(t):yi(t)&&-1!==i.indexOf("capture")&&wi(this[i])?s.push(t):r.push(t)});var n=function(t,i){ws(t,function(t){try{if(yi(t[0])){var e=i;Ss(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){bs.error("Error executing queued PostHog call",t,i)}})};n(e,this),n(r,this),n(s,this)}finally{Cl--}}push(i){if(Cl>0&&yi(i)&&ki(i[0])){var e=t.prototype[i[0]];wi(e)&&e.apply(this,i.slice(1))}else this._execute_array([i])}Fu(){var t,i=null==(t=this.persistence)?void 0:t.get_property(g);return ki(i)&&Nl.test(i)?{value:i,delivered:!1}:Si(i)&&ki(i.value)&&Nl.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}Ou(t,i,e,r){if(this.persistence){this.persistence.refreshKey(g);var s=this.Fu();if(!r){if(e)return ki(i)&&Nl.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)&&Dl.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)}}$u(t){if(this.persistence){this.persistence.refreshKey(g);var i=this.Fu();(null==i?void 0:i.value)!==t||i.delivered||this.persistence.register({[g]:{value:t,delivered:!0}})}}capture(t,i,e){var r,n,o,a,l,h,u,d,v,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.pu){if(this.is_capturing())if(!Ei(t)&&ki(t)){this.Yl();var f=!this.config.opt_out_useragent_filter&&this._is_bot();if(!f||this.config.__preview_capture_bot_pageviews){var p=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==p||!p.isRateLimited){var g;null!=i&&i.$current_url&&!ki(null==i?void 0:i.$current_url)&&(bs.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.Du||bs.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&&(g=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,js),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"),p&&(w.properties.$lib_rate_limit_remaining_tokens=p.remainingTokens);var S="$feature_flag_called"===t&&!1===w.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");null!=e&&e.$set&&!S&&(w.$set=null==e?void 0:e.$set);var x=Si(null==i?void 0:i.$set)?i.$set:void 0,E=!(null==e||!e.$set)&&"$fbc"in e.$set,k=E||!!x&&"$fbc"in x,T=E?null==e||null==(r=e.$set)?void 0:r[_]:null==x?void 0:x[_],P=yi(null==i?void 0:i.$unset)?i.$unset:[],R=(null==e?void 0:e.$unset)||[],C=-1!==P.indexOf("$fbc")||-1!==R.indexOf("$fbc"),O=this.Ou(null==(n=g)?void 0:n.fbclid,T,k,C);O&&!0===w.properties.$process_person_profile&&O.pending&&!k&&!S&&(w.$set=s({[_]:O.value},w.$set));var A=null==e?void 0:e.$unset;A&&(w.$unset=A);var I=S?void 0:this.Lu(null==e?void 0:e.$set_once,t!==Gt,t===Wt);if(I&&(w.$set_once=I),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),yi(i))r=[],ws(i,i=>{r.push(t(i))});else{var s={};Ss(Di(i)?Ps(i):i,(i,e)=>{c.has(i)||(s[e]=t(i,e))}),r=s}return r}}(d)),w.timestamp=b,Ei(null==e?void 0:e.timestamp)||(w.properties.$event_time_override_provided=!0,w.properties.$event_time_override_system_time=m),S&&(w.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return Wr.forEach(r),i.forEach(r),e}(w.properties,Ll)),t===qo.DISMISSED||t===qo.SENT){var F=null==i?void 0:i[Vo.SURVEY_ID],M=null==i?void 0:i[Vo.SURVEY_ITERATION];bl({id:F,current_iteration:M}),w.$set=s({},w.$set,{[ol({id:F,current_iteration:M},t===qo.SENT?"responded":"dismissed")]:!0})}else t===qo.SHOWN&&(w.$set=s({},w.$set,{[Vo.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Ko.SHOWN){var D=null==i?void 0:i[Jo.TOUR_TYPE];D&&(w.$set=s({},w.$set,{[Jo.TOUR_LAST_SEEN_DATE+"/"+D]:(new Date).toISOString()}))}var N=s({},w.properties.$set,w.$set);if(xi(N)||this.setPersonPropertiesForFlags(N),!Pi(this.config.before_send)){var L=this.bs(w);if(!L)return;(w=L).uuid=Ze(w.uuid,js)}var j=null!==(o=null==(a=w.$set)?void 0:a.$fbc)&&void 0!==o?o:Si(null==(l=w.properties)?void 0:l.$set)?w.properties.$set.$fbc:void 0,B=null!=O&&O.pending&&j===O.value?O.value:void 0;this.zl.emit("eventCaptured",w);var U,z=null!==(h=null==e?void 0:e._url)&&void 0!==h?h:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),H=s({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}:{},B?{fireCallbackOnDrop:!0,callback:t=>{t.statusCode>=200&&300>t.statusCode&&this.$u(B)}}:{});return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly||B?(!H.transport&&!H.callback&&xi(null!==(U=this.config.request_headers)&&void 0!==U?U:{})&&this.iu&&(H.transport="sendBeacon"),this.gu(H)):this.pu.enqueue(H),w}bs.critical("This capture call is ignored due to client rate limiting.")}}else bs.error("No event name provided to posthog.capture")}else bs.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null==(i=this.Iu)?void 0:i.getExtension(t)}xu(){var t;return null!==(t=this.Iu)&&void 0!==t?t:this.Iu=new Pl(this)}Wl(t){this.au.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.au.indexOf(t);-1!==e&&this.au.splice(e,1)}}}Nu(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.du=null,"anonymous"===this.persistence.get_property("$user_state")&&(null==(r=this.sessionPersistence)||r.clear(),this.su.clear(),this.qu()),null==(e=this.featureFlags)||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,e,r,n){if(e=e||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.Nu();var o=n?void 0:this.persistence.remove_event_timer(t),a=s({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.Jl()&&(a[$t]=!0),"$snapshot"===t){var h=s({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=h.distinct_id,(!ki(a.distinct_id)&&!Ri(a.distinct_id)||$i(a.distinct_id))&&bs.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,d=function(t,i,e,r){var s,n,o,a;if(void 0===r&&(r=!1),!ri)return{};var h,u=t?[..._o,...i||[]]:[],d=ze(ri),v=d[0],c=d[1],f=function(t){for(var i=0;Ve.length>i;i++){var e,r=Ve[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["",""]}(ri),p=f[0],_=f[1],g=null!=(h="u">typeof navigator?navigator:void 0)&&h.brave?{brave:!0}:{},m={};Ei(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,S=null==Kt||null==(o=Kt.screen)?void 0:o.width,x=null==Kt||null==(a=Kt.screen)?void 0:a.height,E=null==Kt?void 0:Kt.devicePixelRatio;Ei(y)||(b.userAgentDataPlatform=y),Ei(w)||(b.maxTouchPoints=w),Ei(S)||(b.screenWidth=S),Ei(x)||(b.screenHeight=x),Ei(E)||(b.devicePixelRatio=E);var k,T,P,R,C,O,A,I,F=xs(Ts({$os:v,$os_version:c,$browser:Le(ri,navigator.vendor,g,m),$webview_app:p,$webview_app_version:_,$device:He(ri),$device_type:(T=ri,P=b,I=He(T),I===Ki||I===Gi||"Kobo"===I||"Kindle Fire"===I||I===ge?Wi:I===ae||I===he||I===le||I===pe?"Console":I===Ji?"Wearable":I?qi:"Android"===(null==P?void 0:P.userAgentDataPlatform)&&(null!==(R=null==P?void 0:P.maxTouchPoints)&&void 0!==R?R:0)>0?600>Math.min(null!==(C=null==P?void 0:P.screenWidth)&&void 0!==C?C:0,null!==(O=null==P?void 0:P.screenHeight)&&void 0!==O?O:0)/(null!==(A=null==P?void 0:P.devicePixelRatio)&&void 0!==A?A:1)?qi:Wi:"Desktop"),$timezone:Po(),$timezone_offset:Ro()}),{$current_url:vo(r?ir(null==Qt?void 0:Qt.href):null==Qt?void 0:Qt.href,u,mo),$host:null==Qt?void 0:Qt.host,$pathname:null==Qt?void 0:Qt.pathname,$raw_user_agent:ri.length>1e3?ri.substring(0,997)+"...":ri,$browser_version:Be(ri,navigator.vendor,g,m),$browser_language:xo(),$browser_language_prefix:(k=xo(),"string"==typeof k?k.split("-")[0]:void 0),$screen_height:null==Kt?void 0:Kt.screen.height,$screen_width:null==Kt?void 0:Kt.screen.width,$viewport_height:null==Kt?void 0:Kt.innerHeight,$viewport_width:null==Kt?void 0:Kt.innerWidth,$lib:l.LIB_NAME,$lib_version:l.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return l.SDK_DIST_CHANNEL&&(F.$sdk_dist_channel=l.SDK_DIST_CHANNEL),F}(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;a.$session_id=v.sessionId,a.$window_id=c}this.sessionPropsManager&&xs(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&xs(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(f=this.mu)?void 0:f.length}catch(t){a.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===cl&&(a.$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,r),a=xs(a,u),"$pageview"===t&&Xt&&(a.title=Xt.title),!Ei(o)){var p=e.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}ri&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");var _=this.persistence.properties(),g=this.sessionPersistence.properties(),m=a.$groups,b=_.$groups;Si(m)&&!xi(m)&&(a.$groups=s({},Si(b)?b:{},m)),Ss(["$referrer","$referring_domain"],t=>{t in _&&delete g[t]});var y={};if(this.au.length>0)for(var w of this.au.slice())try{xs(y,w())}catch(t){bs.error("Failed to produce browser extension event properties",t)}(a=xs({},d,_,g,s({},y,a))).$is_identified=this._isIdentified(),yi(this.config.property_denylist)?Ss(this.config.property_denylist,function(t){delete a[t]}):bs.error(Ml+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var S=this.config.sanitize_properties;S&&(bs.error(Fl),a=S(a,t));var x=this.ju();return a.$process_person_profile=x,x&&!n&&this.Bu("_calculate_event_properties"),a}Lu(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.ju())return t;if(this.nu&&!e)return t;var s=xs({},this.persistence.get_initial_props(),(null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps())||{},t||{}),n=this.config.sanitize_properties;return n&&(bs.error(Fl),s=n(s,"$set_once")),i&&(this.nu=!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.Nu(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach(t=>this.su.add(t)),this.qu()}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.su.delete(t),this.qu()}Hu(t,i){this.register({[t]:i})}yu(){this.su.forEach(t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)}),this.su.clear(),this.qu()}qu(){var t;if(this.ou)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.gi||!an.Et())an.Dt(this.ou);else{var i=[];this.su.forEach(t=>i.push(t)),i.length>0?an.Ot(this.ou,i):an.Dt(this.ou)}}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.zl.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:Il}),()=>{})}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:Il})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Il})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=wl),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:Il}}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:Il})}zu(t){return!t||$i(t)?(bs.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(bs.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())||(bs.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 bs.uninitializedWarning("posthog.identify");if(Ri(t)&&(t=t.toString(),bs.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.zu(t)&&this.Bu("posthog.identify")){this.Yl();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.Nu(!1),o=this.persistence.va(),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(f),this.register({distinct_id:t}));var h=(this.persistence.get_property("$user_state")||"anonymous")===jt,u=t!==l,d=!u&&h;if(u&&h){var v,c=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:l};this.persistence.set_property(mt,Bt),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.ca(),this.capture(Wt,c,{$set:i||{},$set_once:e||{}}),this.du=vl(t,i,e),null==(v=this.featureFlags)||v.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:l)}else if(d){this.persistence.set_property(mt,Bt);var p=i||{},_=e||{};this.setPersonPropertiesForFlags({$set:p,$set_once:_},!1),this.config.cookieWinsOnConflict&&this.persistence.ca(),this.capture("$set",{$set:p,$set_once:_}),this.du=vl(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);u||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(ft)):d&&(i||e)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.ga(a)}}}setPersonProperties(t,i){if((t||i)&&this.Bu("posthog.setPersonProperties")){var e=vl(this.get_distinct_id(),t,i);this.du!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.du=e):bs.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(yi(t)?t:[t]).filter(t=>ki(t)&&t.length>0);0!==e.length&&this.Bu("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.du=null)}group(t,i,e){var r;if(t&&i){null==(r=this.persistence)||r.syncCookieProperties(),this.Nu();var n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:s({},n,{[t]:i})}),(o||e)&&this.ju()){var a={$group_type:t,$group_key:i};e&&(a.$group_set=e),this.capture(Gt,a)}e&&this.setGroupPropertiesForFlags({[t]:e}),o&&!e&&this.reloadFeatureFlags()}else bs.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.Bu("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=Oi(t)?t:null==t?void 0:t.resetDeviceID,e=Oi(t)||null==t?void 0:t.bootstrap;this.Uu(i,!1,e)}Uu(t,i,e){var r,n,o,a;if(void 0===i&&(i=!1),bs.info("reset"),!this.__loaded)return bs.uninitializedWarning("posthog.reset");var l=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null==(r=this.cu)?void 0:r.bootstrap)||{},null==(n=this.featureFlags)||null==n.updateConfig||n.updateConfig(this.config,this.Fa());var h=this.get_property(v),u=this.get_property(c),d=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.va?void 0:a.va(),_=!1;try{var g,m,b,y,w,S,x,E,k,T,P,R,O;if(null==(g=this.persistence)||g.clear(),null==(m=this.sessionPersistence)||m.clear(),this.su.clear(),this.qu(),Ei(d)||null==(b=this.persistence)||b.register({[C]:d}),null==(y=this.surveys)||y.reset(),null==(w=this.featureFlags)||w.reset(),null==(S=this.conversations)||S.reset(),null==(x=this.logs)||x.reset(),null==(E=this.metrics)||E.reset(),null==(k=this.persistence)||k.set_property(mt,jt),null==(T=this.sessionManager)||T.resetSessionId(),this.du=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:kt,$device_id:null},"");else{var A=this.config.get_device_id(js());this.register_once({distinct_id:A,$device_id:t?A:h},""),t||Ei(u)||this.register({[c]:u})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(void 0===e.distinctID||this.Jl()||(null==(O=this.persistence)||O.set_property(mt,e.isIdentifiedID?Bt:jt),this.register({distinct_id:e.distinctID})),null==(P=this.featureFlags)||P.initialize(),!(Ei(l)||null!=(R=this.sessionManager)&&R.setBootstrapSessionId(l,!0))){var I=s({},e);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,_=!0}finally{var F;p&&(null==(F=this.persistence)||null==F.ga||F.ga(_))}this.reloadFeatureFlags()}shutdown(t){var i=this;return o(function*(){var t,e,r,s,n,o,a;if(i.__loaded){i.ru=!0,i.xu().dispose(),null==(t=i.sessionRecording)||t.dispose(),null==(e=i.logs)||e.flushLogs("sendBeacon"),null==(r=i.metrics)||r.flush("sendBeacon"),null==(s=i.pu)||s.unload(),null==(n=i.mu)||n.unload();try{var l;null==(l=i.featureFlags)||l.destroy()}catch(t){bs.error("Error while destroying feature flags",t)}null==(o=i.persistence)||o.destroy(),null==(a=i.sessionPersistence)||a.destroy()}else bs.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.Wu()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null==(t=this.conversations)||t.Vu()}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")?(bs.critical("Attempting to create alias for existing People user - aborting."),-2):this.Bu("posthog.alias")?(Ei(i)&&(i=this.get_distinct_id()),t!==i?(this.Hu(f,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(bs.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=s({},this.config);if(Si(t)){var e,r,n,o,a,l,u,d,v,c,f,p,_;xs(this.config,ql(t));var g=this.tu();null==(e=this.persistence)||e.update_config(this.config,i,g),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Bo(s({},this.config,{persistence:"sessionStorage"}),g,!1);var m=this.vu(this.config.debug);Oi(m)&&(this.config.debug=m),Oi(this.config.debug)&&(this.config.debug?(h.DEBUG=!0,Ws.Et()&&Ws.Ot("ph_debug",!0),bs.info("set_config",{config:t,oldConfig:i,newConfig:s({},this.config)})):(h.DEBUG=!1,Ws.Et()&&Ws.Dt("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this.Fa()),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(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.eu(),null==(_=this.externalIntegrations)||_.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&Zn(this,Ol,!1)}}_overrideSDKInfo(t,i){h.LIB_NAME=t,h.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){try{if(!this.exceptions)return;var e=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(s({},e,i))}catch(t){return}}addExceptionStep(t,i){var e;null==(e=this.exceptions)||e.addExceptionStep(t,i)}captureLog(t){var i;null==(i=this.logs)||i.captureLog(t)}get logger(){var i,e;return null!==(i=null==(e=this.logs)?void 0:e.logger)&&void 0!==i?i:t.Gu}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:jl;return i!==jl&&(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"))}ju(){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))}Pu(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.ju()||this.Bu("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Bu("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Bu(t){return"never"===this.config.person_profiles?(bs.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ql(),this.Hu(Et,!0),!0)}tu(){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)}eu(){var t,i,e,r,s,n=this.tu();return this.is_capturing()||null==(t=this.logs)||t.Zu(),(null==(i=this.persistence)?void 0:i.gi)!==n&&(null==(e=this.persistence)||e.set_disabled(n)),(null==(r=this.sessionPersistence)?void 0:r.gi)!==n&&(null==(s=this.sessionPersistence)||s.set_disabled(n)),n&&(this.su.clear(),this.qu()),n}opt_in_capturing(i){var e,r,s;if("always"!==this.config.cookieless_mode){if(this.Jl()){var n,o,a,l,h,u;null==(n=this.sessionRecording)||n.dispose({discardBufferedEvents:!0}),this.Uu(!0,!0),null==(o=this.sessionManager)||o.destroy(),null==(a=this.pageViewManager)||a.destroy(),this.sessionManager=new rl(this),this.pageViewManager=new ro(this),this.persistence&&(this.sessionPropsManager=new Za(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.Zl(this.sessionRecording,new v(this)),this.Hl&&(null==(d=this.sessionRecording)||null==d.onRemoteConfig||d.onRemoteConfig(this.Hl)))}this.consent.optInOut(!0),this.eu(),this.Eu(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null==(r=this.surveys)||r.loadIfEnabled()),(Ei(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.Ru()}else bs.warn(Al)}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.Uu(!0,!0),this.consent.optInOut(!1),this.eu(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:kt,$device_id:null}),this.Gl(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.Ru(),this.Eu())}else bs.warn(Al)}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.eu()}_is_bot(){return Yt?sl(Yt,this.config.custom_blocked_useragents):void 0}Ru(){Xt&&("visible"===Xt.visibilityState?this.lu||(this.lu=!0,this.capture(qt,{title:Xt.title},{send_instantly:!0}),this.uu&&(Xt.removeEventListener(zt,this.uu),this.uu=null)):this.uu||(this.uu=this.Ru.bind(this),Os(Xt,zt,this.uu)))}debug(t){!1===t?(null==Kt||Kt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==Kt||Kt.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}))}Fa(){var t=this.cu||{};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?(bs.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,bs)}bs(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=yi(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)?bs.warn(o+". This can cause unexpected behavior."):bs.info(o),null}s.properties&&!xi(s.properties)||bs.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return bs.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&Pi(s.properties[a]))return bs.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.ko)?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)})}vu(t){var i=Oi(t)&&!t,e=Ws.Et()&&"true"===Ws.Lt("ph_debug");return!i&&(!!e||t)}},t.__defaultExtensionClasses={},t.Gu=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),t);!function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=$s(t.prototype[i[e]])}(Wl,["identify"]);var Gl=class{constructor(t){this.disabled=!1===t;var i=Si(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}},Kl="$copy_autocapture",Jl=ys("[AutoCapture]");function Yl(t,i){return i.length>t?i.slice(0,t)+"...":i}function Xl(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!dn(i));return i}function Ql(t,i){var e,r,n=i.e,o=i.maskAllElementAttributes,a=i.maskAllText,l=i.elementAttributeIgnoreList,h=i.elementsChainAsString,u=i.disableCaptureUrlHashes;if(!dn(t))return{props:{}};for(var d=[t],v=new Set([t]),c=t;c.parentNode&&!vn(c,"body")&&1e3>d.length;)if(fn(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!dn(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=>vn(t,"button")||vn(t,"a")):-1;p>0&&(a=a||d.slice(0,p+1).some(t=>!Fn(t)||Mn(t)));var _,g,m,b=[],y={},w=!1,S=!1;if(Ss(d,t=>{var i=Fn(t);if(vn(t,"a")){var e=t.getAttribute("href");w=!!(i&&e&&Hn(e))&&(u?ir(e):e)}hi(gn(t),"ph-no-capture")&&(S=!0),b.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};wn.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?Yl(1024,qn(t)):Yl(1024,bn(t)));var a=gn(t);a.length>0&&(o.classes=a.filter(function(t){return""!==t})),Ss(t.attributes,function(e){var n;if((!Mn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Hn(e.value)&&(!ki(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=pn(a).join(" ")),o["attr__"+e.name]=Yl(1024,"href"===e.name&&s?ir(a):a)}});for(var l=1,h=1,u=t;u=Xl(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,a,l,u)),Ss(function(t){if(!Fn(t))return{};var i={};return Ss(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&&Hn(r)&&(i[e]=r)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(y,i)||(y[i]=t)})}),S)return{props:{},explicitNoCapture:S};if(p>0&&(t=d[p],b.splice(0,p)),a||(b[0].$el_text=vn(t,"a")||vn(t,"button")?qn(t):bn(t)),w){var x,E;b[0].attr__href=w;var k=null==(x=ho(w))?void 0:x.host,T=null==Kt||null==(E=Kt.location)?void 0:E.host;k&&T&&k!==T&&(_=w)}return{props:xs((g=n.type,{$event_type:g,$ce_version:1}),h?{}:{$elements:b},{$elements_chain:(m=b,yi(m)?function(t){return t.map(t=>{var i,e,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))r+="."+n.replace(/"/g,"");var o=s({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return Es(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[Wn(t[0].toString())]=Wn(i.toString())}),(r+=":")+Es(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:Gn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Es(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==(r=b[0])?void 0:r.$el_text}:{},_&&"click"===n.type?{$external_click_url:_}:{},y),target:t}}var Zl=class{zs(){this.Us=void 0,clearTimeout(this.Ws),this.Ws=void 0}Vs(t){var i;if(!Fn(t))return!0;for(var e,r=null!==(i=this.Gs().css_selector_ignorelist)&&void 0!==i?i:kn,s=new Set,n=t,o=function(){if(s.size>=1e3||s.has(n))return{v:!0};s.add(n);var t=n,i=gn(t);if(hi(i,"ph-no-capture")||hi(i,"ph-sensitive")||Mn(t)||r.some(i=>Sn(t,i)))return{v:!0};var e=n.parentNode;n=fn(e)?e.host:e&&dn(e)?e:null};n;)if(e=o())return e.v;return!1}Zs(t){if(this.isEnabled&&"pointercancel"!==t.type)if("pointerdown"!==t.type){var i=this.Us;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.zs():"pointerup"===t.type&&(i.released=!0,this.Ws=setTimeout(()=>this.zs(),0)))}else{var e;this.zs();var r=yn(t);t.isPrimary&&0===t.button&&!t.ctrlKey&&r&&dn(r)&&(this.Us={target:r,excluded:this.Vs(r),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null==(e=this.Js)?void 0:e.distinctId})}else this.zs()}Qs(t){var i,e=this.Us;this.zs();var r=yn(t);if(null!=e&&e.released&&e.target.isConnected&&e.distinctId===(null==(i=this.Js)?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&&(vn(r,"html")||vn(r,"body"))){var s;if(e.excluded)return null;var n=null!==(s=this.Gs().css_selector_ignorelist)&&void 0!==s?s:kn;return[r,null==Xt?void 0:Xt.documentElement,null==Xt?void 0:Xt.body].some(t=>{if(!t)return!1;var i=gn(t);return hi(i,"ph-no-capture")||hi(i,"ph-sensitive")||!Fn(t)||Mn(t)||n.some(i=>Sn(t,i))})?null:e.target}}constructor(t){this.Ks=t,this.name="autocapture",this.Xs=!1,this.Ys=null,this.eo=!1,this.io=!1,this.Rn={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.ro=!1,this.Ks.refresh(this.Rn),this.rageclicks=new Gl(this.Rn.rageclick),this.no=null}setup(t){this.so(),this.Js=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.ro?i.dispose():(this.oo=i,this.startIfEnabled())}dispose(){var t;this.ro||(this.ro=!0,this.Js=void 0,null==(t=this.oo)||t.dispose(),this.oo=void 0,this.ao())}Gs(){return this.Ks.refresh(this.Rn),this.Rn}so(){var t,i;return this.Gs(),this.Rn.url_allowlist=null==(t=this.Rn.url_allowlist)?void 0:t.map(t=>new RegExp(t)),this.Rn.url_ignorelist=null==(i=this.Rn.url_ignorelist)?void 0:i.map(t=>new RegExp(t)),this.Rn}lo(){if(this.isBrowserSupported()){if(Kt&&Xt){var t=this.uo=t=>{t=t||(null==Kt?void 0:Kt.event);try{if("blur"===t.type)return void this.zs();if(0===t.type.indexOf("pointer"))return void this.Zs(t);var i="click"===t.type?this.Qs(t):void 0;if(Ti(i))return;this.ho(t,"$autocapture",i)}catch(t){Jl.error("Failed to capture event",t)}};if(Os(Kt,"blur",t),Os(Xt,"submit",t,{capture:!0}),Os(Xt,"change",t,{capture:!0}),Os(Xt,"click",t,{capture:!0}),Ss(["pointerdown","pointermove","pointerup","pointercancel"],i=>{Os(Xt,i,t,{capture:!0})}),this.Gs().capture_copied_text){var i=this.do=t=>{t=t||(null==Kt?void 0:Kt.event);try{this.ho(t,Kl)}catch(t){Jl.error("Failed to capture clipboard event",t)}};Os(Xt,"copy",i,{capture:!0}),Os(Xt,"cut",i,{capture:!0}),Os(Xt,"paste",i,{capture:!0})}}}else Jl.info("Disabling Automatic Event Collection because this browser is not supported")}ao(){this.zs(),this.uo&&(null==Kt||Kt.removeEventListener("blur",this.uo),Ss(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==Xt||Xt.removeEventListener(t,this.uo,!0)}),null==Xt||Xt.removeEventListener("submit",this.uo,!0),null==Xt||Xt.removeEventListener("change",this.uo,!0),null==Xt||Xt.removeEventListener("click",this.uo,!0),this.uo=void 0),this.do&&(null==Xt||Xt.removeEventListener("copy",this.do,!0),null==Xt||Xt.removeEventListener("cut",this.do,!0),null==Xt||Xt.removeEventListener("paste",this.do,!0),this.do=void 0),this.Xs=!1}startIfEnabled(){this.isEnabled||this.zs(),!this.ro&&this.Js&&this.isEnabled&&!this.Xs&&(this.lo(),this.Xs=!0)}onRemoteConfig(t){if(!this.ro)if(this.eo=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.io=i.elementsChainAsString);var e,r=i.autocapture_opt_out;Oi(r)&&(null==(e=this.Js)||e.kv.set(b,r),this.Ys=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.no=t}getElementSelectors(t,i){var e,r=[];return null==(e=this.no)||e.forEach(e=>{var s;null==Xt||null==(s=Xt.querySelectorAll(e))||s.forEach(s=>{t!==s&&i!==s||hi(r,e)||r.push(e)})}),r}get isEnabled(){var t,i;if(this.ro)return!1;var e=null==(t=this.Js)?void 0:t.kv.get(b),r=this.Ys,s=this.Gs();if(!s.remoteRequestsDisabled&&!this.eo)return!1;var n=s.remoteRequestsDisabled&&!this.eo;if(Ti(r)&&!Oi(e)&&!n)return!1;var o=null!==(i=this.Ys)&&void 0!==i?i:!!e;return!!s.enabled&&!o}ho(t,i,e){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r=e||yn(t);cn(r)&&(r=r.parentNode||null);var n,o=this.so();"$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())&&On(r,o.rageclick)&&this.ho(t,"$rageclick",e);var a=i===Kl,l=a?s({},o,{dom_event_allowlist:void 0}):o;if(r&&function(t,i,e,r,s,n){var o;if(!Kt||An(t))return!1;if(null!=e&&e.url_allowlist&&!_n(e.url_allowlist,n))return!1;if(null!=e&&e.url_ignorelist&&_n(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=In(t,r),h=l.parentIsUsefulElement,u=l.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(Ei(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(!xn(u,null==e?void 0:e.css_selector_allowlist))return!1;if(xn(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:kn))return!1;try{var d=Kt.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&&(wn.indexOf(v)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:o.getCurrentUrl}})){var h,u=Ql(r,{e:t,maskAllElementAttributes:o.maskAllElementAttributes,maskAllText:o.maskAllText,elementAttributeIgnoreList:o.element_attribute_ignorelist,elementsChainAsString:this.io,disableCaptureUrlHashes:o.disableCaptureUrlHashes}),d=u.props;if(u.explicitNoCapture)return!1;var v=this.getElementSelectors(r,u.target);if(v&&v.length>0&&(d.$element_selectors=v),i===Kl){var c=t.type||"clipboard";if("paste"!==c){var f,p,_=null==Kt||null==(f=Kt.getSelection())?void 0:f.toString(),g=mn(_);if(!g)return!1;d.$selected_content=g,d.$clipboard_text_length=null!==(p=null==_?void 0:_.length)&&void 0!==p?p:0}d.$copy_type=c}return null==(h=this.Js)||h.capture(i,d).catch(t=>Jl.error("Failed to capture event",t)),!0}}else this.zs()}isBrowserSupported(){return wi(null==Xt?void 0:Xt.querySelectorAll)}},th=class{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=Si(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.Fa(),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}},ih=ys("[ExceptionAutocapture]"),eh=()=>{},rh=t=>{var i;if(wi(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function sh(t,i,e){try{if(!(i in t))return eh;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 wi(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=rh(e);n;){if(n.next===s)return void(n.next=r.next);n=rh(e=n.next)}else t[i]=r.next}}catch(t){return eh}}var nh=ys("[TracingHeaders]"),oh=ys("[Web Vitals]"),ah=9e5,lh=["CLS","FCP","INP","LCP"],hh=["INP","LCP"],uh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],dh="disabled",vh="lazy_loading",ch=ys("[SessionRecording]"),fh=ys("[Heatmaps]");function ph(t){return Si(t)&&"clientX"in t&&"clientY"in t&&Ri(t.clientX)&&Ri(t.clientY)}var _h=ys("[Product Tours]"),gh=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(T))},mh=ys("[SiteApps]"),bh="Error while initializing PostHog app with config id ",yh=(t,i)=>null!=t&&t.then?t.then(i):i(t),wh="SDK is not enabled or survey functionality is not yet loaded",Sh="Disabled. Not loading surveys.",xh=class{constructor(t,i){this.Ks=t,this.Ju=i,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Qu=!1,this.Ku=[],this.Xu=null,this.Yu=null,this.ro=!1,this.th=new Set,this.onRemoteConfig=t=>{if(!this.ro&&!this.Rn.disableSurveys){if(!t.ok)return ml.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(Pi(i))return ml.warn("Flags not loaded yet. Not loading surveys.");this.eh=Oi(i)?i:i.length>0,ml.info("flags response received, isSurveysEnabled: "+this.eh),this.loadIfEnabled()}}}setup(t){if(!this.ro)return this.ih=t,yh(t.kv.initialize(),()=>{if(this.ih===t&&!this.ro){this.ih=void 0,this.Js=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.ro?i.dispose():(this.oo=i,this.loadIfEnabled())}})}dispose(){var t,i,e;this.ro||(this.ro=!0,this.ih=void 0,this.Js=void 0,null==(t=this.oo)||t.dispose(),this.oo=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.Ku=[],this.Xu=null,this.th.forEach(t=>clearTimeout(t)),this.th.clear())}get Rn(){return this.Ks.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.ro&&this.Js){var t=this.Rn;if(!this._surveyManager)if(this.Qu)ml.info("Already initializing surveys, skipping...");else if(t.disableSurveys)ml.info(Sh);else if(t.cookielessMode&&this.Ks.isOptedOut())ml.info("Not loading surveys in cookieless mode without consent.");else{var i=this.Ks.getExtensions();if(i){if(!Ei(this.eh)||t.advancedEnableSurveys){var e=this.eh||t.advancedEnableSurveys;this.Qu=!0;try{var r=i.generateSurveys;if(r)return this.rh(r,e),void(this.Qu=!1);var s=i.loadExternalDependency;if(!s)return this.nh(Lt),void(this.Qu=!1);s(t=>{try{if(this.ro)return;var i=this.Ks.getExtensions();t||null==i||!i.generateSurveys?this.nh("Could not load surveys script",t):this.rh(i.generateSurveys,e)}finally{this.Qu=!1}})}catch(t){throw this.Qu=!1,this.nh("Error initializing surveys",t),t}}}else ml.error("PostHog Extensions not found.")}}}rh(t,i){this.ro||(this._surveyManager=t(i),this._surveyEventReceiver=this.Ks.createEventReceiver(),ml.info("Surveys loaded successfully"),this.sh({isLoaded:!0}))}nh(t,i){ml.error(t,i),this.sh({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ku.push(t),this._surveyManager&&this.sh({isLoaded:!0}),()=>{this.Ku=this.Ku.filter(i=>i!==t)}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.Js)&&void 0!==e?e:this.Ju;if(r&&!this.ro){if(this.Rn.disableSurveys)return ml.info(Sh),t([]);var s=r.kv.get(et);if(s&&!i)return t(s,{isLoaded:!0}),void(this.oh()&&this.getSurveys(()=>{},!0));if(this.Xu)this.Xu.then(i=>{this.ro||t(i.surveys,i.context)}).catch(t=>ml.error("Error in survey callback",t));else{var n=this.ah("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.Rn.requestTimeoutMs}).then(t=>{try{return this.uh(r,t)}catch(t){return ml.error("Error processing surveys response",t),this.uh(r,{statusCode:0,error:t})}},t=>this.uh(r,{statusCode:0,error:t}));this.Xu=n;var o=()=>{this.Xu===n&&(this.Xu=null)};n.then(i=>{o(),this.ro||t(i.surveys,i.context)},o).catch(t=>ml.error("Error in survey callback",t))}}}ah(t,i){var e=this.Js;return e?e.sendRequest(t,i):new Promise(t=>t({statusCode:0,error:new Error(wh)}))}uh(t,i){var e;if(this.ro)return{surveys:[],context:{isLoaded:!1,error:wh}};var r=i.statusCode;if(200!==r||!i.json){var s="Surveys API could not be loaded, status: "+r;return 0!==r?ml.error(s):i.error||ml.warn(s),this.Yu=Date.now(),{surveys:[],context:{isLoaded:!1,error:s}}}this.Yu=null;var n=i.json.surveys||[],o=n.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(al(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({[et]:n,[rt]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}oh(){return this.hh()&&!this.Xu&&!this.dh()}hh(){var t,i,e=null==(t=null!==(i=this.Js)&&void 0!==i?i:this.Ju)?void 0:t.kv.get(rt);return Ri(e)&&Date.now()-e>3e5}dh(){return Ri(this.Yu)&&3e5>Date.now()-this.Yu}markSurveyAsSeen(t,i){var e;bl({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){}}sh(t){for(var i of this.Ku)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){ml.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!Pi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);ml.warn("init was not called")}fh(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}ph(t){if(Pi(this._surveyManager))return{eligible:!1,reason:wh};var i="string"==typeof t?this.fh(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}gh(t){if(Pi(this._surveyManager))return{eligible:!1,reason:wh};var i="string"==typeof t?this.fh(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Pi(this._surveyManager))return ml.warn("init was not called"),{visible:!1,disabledReason:wh};var i=this.gh(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return Pi(this._surveyManager)?(ml.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:wh})):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.gh(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))ml.warn("init was not called");else{var s="string"==typeof t?this.fh(t):t;if(null!=s&&s.id)if(yl.includes(s.type)){var n=null==Xt?void 0:Xt.querySelector(i);if(n)if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds){ml.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds");var o=setTimeout(()=>{var t,i;this.th.delete(o),this.ro||(ml.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),ml.info("Survey "+s.id+" rendered"))},1e3*s.appearance.surveyPopupDelaySeconds);this.th.add(o)}else this._surveyManager.renderSurvey(s,n,e);else ml.warn("Survey element not found")}else ml.warn("Surveys of type "+s.type+" cannot be rendered in the app");else ml.warn("Survey not found")}}displaySurvey(t,i){var e;if(Pi(this._surveyManager))ml.warn("init was not called");else{var r=this.fh(t);if(r){var n=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=s({},r,{appearance:s({},r.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==Wo.Popover&&i.initialResponses&&ml.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.ph(r);if(!o.eligible)return void ml.warn("Survey is not eligible to be displayed: ",o.reason)}i.displayType!==Wo.Inline?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else ml.warn("Survey not found")}}cancelPendingSurvey(t){Pi(this._surveyManager)?ml.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}};function Eh(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 kh=class{constructor(t){this._instance=t,this.mh=new Set,this.yh=new Set,this.bh=new tl,this._h=(t,i)=>this.wh(t,i)&&this.kh(t,i)&&this.Sh(t,i)&&this.xh(t,i),this.wh=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;Ei(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Ch=null==(i=this._instance)?void 0:i._addCaptureHook((t,i)=>{this.on(t,i)}))}dispose(){var t;null==(t=this.Ch)||t.call(this),this.Ch=void 0,this.bh=new tl}register(t){var i,e;if(!Ei(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach(t=>{var i;this.mh.add(t),null==(i=t.steps)||i.forEach(t=>{this.yh.add((null==t?void 0:t.event)||"")})}),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.mh.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.mh.clear(),this.yh.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.yh.has(t)||this.yh.has(i.event))&&this.mh.forEach(t=>{this.Th(i,t)&&this.bh.emit("actionCaptured",t.name)})}Mh(t){this.onAction("actionCaptured",i=>t(i))}Th(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this._h(t,e))return!0;return!1}onAction(t,i){return this.bh.on(t,i)}kh(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(!Eh(r,i.url,i.url_matching||"contains"))return!1}return!0}Sh(t,i){return!!this.Ih(t,i)&&!!this.Eh(t,i)&&!!this.Rh(t,i)}Ih(t,i){var e;if(null==i||!i.href)return!0;var r=this.Ah(t);if(r.length>0)return r.some(t=>Eh(t.href,i.href,i.href_matching||"exact"));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&Eh((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}Eh(t,i){var e;if(null==i||!i.text)return!0;var r=this.Ah(t);if(r.length>0)return r.some(t=>Eh(t.text,i.text,i.text_matching||"exact")||Eh(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=>Eh(t,n,o)))}Rh(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}Ah(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}xh(t,i){return null==i||!i.properties||0===i.properties.length||dl(i.properties.reduce((t,i)=>{var e=yi(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)}},$h=class{constructor(t){var i;this.Ph=[],this._instance=t,this.Fh=new Map,this.Oh=new Map,this.$h=new Map,this.Dh=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId(t=>this.Lh(t))}Nh(t){return!1}qh(){return null}jh(t){}Bh(){}Hh(t,i){return!!t&&dl(t.propertyFilters,null==i?void 0:i.properties)}zh(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}Uh(t,i,e){var r=(e===zo.Activation?this.Fh:this.Oh).get(t),s=[];return this.Wh(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.Hh(n,i)})}register(t){this.Vh(t,!1)}replace(t){this.Vh(t,!0)}Vh(t,i){var e;Ei(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Gh(t,i),this.Zh(t,i))}Zh(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.$h.clear(),0!==e.length){this.Jh||(this.Jh=new kh(this._instance),this.Jh.init(),this.Jh.Mh(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.$h.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.$h.set(i.name,s)}})}),i?this.Jh.replace(r):this.Jh.register(r)}else{var s;i&&(null==(s=this.Jh)||s.replace([]))}}Qh(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)})}Gh(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.zh(t,zo.Activation),a=this.zh(t,zo.Cancellation);i?(this.Fh=o,this.Oh=a):(this.Qh(this.Fh,o),this.Qh(this.Oh,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.Ch)&&void 0!==e||(this.Ch=null==(r=this._instance)?void 0:r._addCaptureHook((t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,r,s=this.Kh(),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.Xh(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Yh([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.td(n),void this.ed([n])}if(this.Oh.has(t)){var a=this.Uh(t,i,zo.Cancellation);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map(t=>t.id)}),this.Yh(a.map(t=>t.id)),a.forEach(t=>this.rd(t.id)))}if(this.Fh.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.Fh.get(t)});var l=this.Uh(t,i,zo.Activation);this.nd(l.map(t=>t.id))}}onAction(t){this.$h.has(t)&&this.nd(this.$h.get(t)||[])}nd(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.Nh(s)?this.td(s)&&this.sd(s):r.push(s);r.length>0&&(this.Ph=[...new Set([...this.Ph,...r])]),this.Kh().info("updating activated items",{activatedItems:this.getActivatedIds()})}}td(t){this.Ph=this.Ph.filter(i=>i!==t);var i=this.od();return!i.includes(t)&&(this.ad([...i,t]),this.ld(),!0)}Yh(t){var i=new Set(t);this.Ph=this.Ph.filter(t=>!i.has(t));var e=this.ud(),r=e.filter(t=>!i.has(t));r.length!==e.length&&(this.ad(r),0===r.length&&this.hd()),this.ed(t)}dd(){var t,i=this.qh();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}sd(t){if(this.qh()){var i=this.dd();this.jh(s({},i,{[t]:Date.now()}))}}ed(t){if(this.qh()){var i=this.dd(),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.Bh():this.jh(e))}}vd(){this.qh()&&this.Bh()}getActivationTimestamp(t){if(this.od().includes(t)){var i=this.dd()[t];return Ri(i)?i:void 0}}ud(){var t,i=this.fd();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}od(){var t,i,e=this.ud();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.pd()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}ld(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.gd(i)}hd(){this.md()}Lh(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.pd()];if(e&&e!==t){var r=this.ud(),s=this.dd();r.length>0&&(this.ad([]),r.filter(t=>Ri(s[t])).forEach(t=>this.rd(t))),this.hd(),this.vd()}}getActivatedIds(){return[...new Set([...this.od(),...this.Ph])].filter(t=>!this.yd(t))}dispose(){var t,i,e;null==(t=this.Dh)||t.call(this),this.Dh=void 0,null==(i=this.Ch)||i.call(this),this.Ch=void 0,null==(e=this.Jh)||e.dispose(),this.Jh=void 0}reset(){this.Ph=[],this.ud().length>0&&this.ad([]),this.hd(),this.vd()}getEventToItemsMap(){return this.Fh}bd(){return this.Jh}},Th=class extends $h{constructor(t){super(t)}fd(){return st}pd(){return nt}qh(){return ot}jh(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[ot]:t})}Bh(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(ot)}Nh(t){var i,e;this.Wh(i=>{e=i.find(i=>i.id===t)});var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return Ri(r)&&r>0}_d(){return qo.SHOWN}Wh(t){var i;null==(i=this._instance)||i.getSurveys(t)}rd(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}Kh(){return ml}ad(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[st]:t})}gd(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[nt]:t})}md(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(nt)}yd(){return!1}Xh(t,i){var e;return this.Wh(t=>{e=t.find(t=>t.id===i)}),!e||function(t){var i;return al(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e)?t===qo.SHOWN?"consume":"ignore":t===qo.SHOWN?"persist":t===qo.DISMISSED||t===qo.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Ph=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);Ei(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)}},Rh=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==oi?void 0:oi.__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 Th(this._instance)}},Ch=null!=Kt&&Kt.location?co(Kt.location.hash,"__posthog")||co(location.hash,"state"):null,Oh="_postHogToolbarParams",Ah=ys("[Toolbar]"),Ih=ys("[FeatureFlags]"),Fh=class{constructor(t,i){void 0===i&&(i=!1),this.wd=!1,this.update(t,i)}update(t,i){this.kd=((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:yi(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.wd||(Ih.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.wd=!0),Ei(t.flag_keys)||yi(t.flag_keys)||Ih.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.kd}},Mh=ys("[FeatureFlags]"),Dh=ys("[FeatureFlags]",{debugEnabled:!0}),Nh="\" failed. Feature flags didn't load in time.",Lh="connection_error",jh=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},Bh=t=>{var i={};for(var e of Es(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},Uh=t=>Di(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),zh=ys("[Error tracking]"),Hh="webkit-masked-url:",qh=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Vh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Hh],Wh=["__firefox__","__gCrWeb"],Gh="Refusing to render web experiment since the viewer is a likely bot",Kh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>ll(i,t),not_regex:(t,i)=>!ll(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},Jh=ys("[Conversations]"),Yh="Conversations not available yet.";function Xh(t,i){var e,r,n,o,a,l,h,u=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,d=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,v=null!=i&&i.consoleCapture?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,c=Ei(v)?Math.max(d,2048):Math.max(d,v),f=s({},function(){var t="",i="";try{var e=null==Yt?void 0:Yt.userAgent;if(e){var r=ze(e);t=r[0],i=r[1]}}catch(t){}return function(t,i){var e=function(t){if(t)return{}.hasOwnProperty.call(os,t)?os[t]:t}(t);return s({},e?{"os.name":e}:{},i?{"os.version":i}:{})}(t,i)}(),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==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 Qh=["debug","log","warn","error","info"],Zh="console",tu="__posthogHandledLogsRequestError",iu=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[tu]=!0,e},eu=t=>!!t&&"object"==typeof t&&!0===t[tu],ru={featureFlags:class{constructor(t){this.name="featureFlags",this.Sd=!1,this.featureFlagEventHandlers=[],this.A=Mh,this.xd={},this.Cd={},this.Td=[],this.Md=!1,this.Id=!1,this.Ed=0,this.Rd=!1,this.Ad=!1,this.Pd=!1,this.Fd=!1,this.Od=0,this.nr=()=>{var t=this.$d();this.Od=0,t&&this.reloadFeatureFlags()},this.Dd=()=>{var t,i=this.Ld;Ei(i)||this.Rn.remoteRequestsDisabled||!Xt||"hidden"===Xt.visibilityState||Date.now()-(null!==(t=this.Nd)&&void 0!==t?t:0)<i||(this.reloadFeatureFlags(),this.qd())},this.ar=()=>{"visible"===(null==Xt?void 0:Xt.visibilityState)&&this.Dd()},"get"in t?this.Ks=t:(this._instance=t,this.jd=new Fh(t.config,t.Fa()),this.Ks=this.jd)}updateConfig(t,i){var e;null==(e=this.jd)||e.update(t,i),this.Js&&this.Bd()}setup(t){return this.ih=t,this.A=t.logger.createLogger("[FeatureFlags]"),yh(t.kv.initialize(),()=>{this.ih===t&&(this.ih=void 0,this.Js=t,this.Hd(t))})}Hd(t){var i;if(this.Js===t)return Kt&&Os(Kt,"online",this.nr),this.Bd(),this.zd=t.registerDynamicEventProperties(()=>this.Ud()?this.xd:this.Cd),this.Wd=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.onCrossTabFeatureFlagChange(()=>{this.Vd(),this.Gd(),this.Zd()}),this.Gd(),this.initialize()}Bd(){var t=this.Rn.refreshIntervalMs,i=!this.Rn.remoteRequestsDisabled&&Xt&&!Ei(t)&&t>0?t:void 0;i!==this.Ld&&(this.Jd(),Ei(i)||(this.Ld=i,this.qd(),null!=Xt&&Xt.addEventListener&&Os(Xt,zt,this.ar)))}qd(){Ei(this.Ld)||(Ei(this.Qd)||clearInterval(this.Qd),this.Nd=Date.now(),this.Qd=setInterval(this.Dd,this.Ld))}Jd(){Ei(this.Qd)||(clearInterval(this.Qd),this.Qd=void 0,null==Xt||null==Xt.removeEventListener||Xt.removeEventListener(zt,this.ar)),this.Ld=void 0,this.Nd=void 0}destroy(){this.Kd()}dispose(){this.Kd()}Kd(){var t,i;this.Jd(),this.Ed++,this.Ad=!1,this.ih=void 0,this.Js&&(this.Xd(),null==(t=this.zd)||t.dispose(),this.zd=void 0,null==(i=this.Wd)||i.call(this),this.Wd=void 0,this.Td=[],null==Kt||Kt.removeEventListener("online",this.nr),this.Js=void 0)}get Rn(){return this.Ks.get()}Yd(t){var i;return this.tv&&t in this.tv?this.tv[t]:null==(i=this.Js)?void 0:i.kv.get(t)}Vd(){return!!this.tv&&(this.tv=void 0,!0)}ev(){var t;return!Ei(null==(t=this.Js)?void 0:t.kv.get("$enabled_feature_flags"))&&this.Vd()}Ot(t){this.iv(()=>{var i;return null==(i=this.Js)?void 0:i.kv.set(t)})}rv(t,i,e){var r;if(null!=(r=this._instance)&&r.persistence&&t.$enabled_feature_flags){var s=this.Yd("$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&&!yi(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(n)])),u=this.Yd("$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,_={[V]:f,[q]:f,[K]:p};for(var g of(t.$feature_flag_details&&(_[G]=f),[J,gt,Y]))Ei(t[g])||(_[g]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(_)}}Dt(t){this.iv(()=>{var i;return null==(i=this.Js)?void 0:i.kv.remove(t)})}iv(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}Gd(){var t={};for(var i of[V,K,J,X]){var e=this.Yd(i);Ei(e)||(t[i]=e)}this.xd=t;var r=s({},t),n=this.Yd(q);if(n)for(var o of Object.entries(n))r["$feature/"+o[0]]=o[1];this.Cd=r}Ud(){var t=this.Rn.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Yd(gt);return"number"!=typeof i||Date.now()-i>t}nv(){return!!this.Ud()&&(this.Fd||this.Id||(this.Fd=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}sv(){var t=this.Rn.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}):[]}ov(){var t=this.Rn.flagKeys;if(!Ei(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.Rn,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=>!Ei(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.av({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(t,i,e){var r,n,o=null!=e&&e.merge&&null!==(r=this.Yd("$enabled_feature_flags"))&&void 0!==r?r:{},a=null!=e&&e.merge&&null!==(n=this.Yd("$feature_flag_payloads"))&&void 0!==n?n:{},l=s({},o,t),h=s({},a,i),u={};for(var d of Object.entries(l)){var v=d[0],c=d[1];u[v]={key:v,enabled:Hr(c),variant:qr(c),reason:void 0,metadata:Ei(null==h?void 0:h[v])?void 0:{id:0,version:void 0,description:void 0,payload:h[v]}}}this.av({flags:u})}get hasLoadedFlags(){return this.Md}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Yd(G),i=this.Yd(X),e=this.Yd(Q);if(!e&&!i)return t||{};var r=xs({},t||{});for(var n of[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])]){var o,a,l=r[n],h=null==i?void 0:i[n],u=Ei(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=Ei(h)?null==l?void 0:l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=s({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=s({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.Sd||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.Sd=!0),r}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{var r=t[e];return{key:e,enabled:Hr(r),variant:qr(r),payload:zr(i[e])}})}getFlagVariants(){var t=this.Yd(q),i=this.Yd(X);if(!i)return t||{};for(var e=xs({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.Sd||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.Sd=!0),e}getFlagPayloads(){var t=this.Yd(K),i=this.Yd(Q);if(!i)return t||{};for(var e=xs({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.Sd||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.Sd=!0),e}reloadFeatureFlags(){this.Rd||this.Rn.featureFlagsDisabled||this.$d()||(this.Id&&(this.Ad=!0),this.lv||(this.Td.slice().forEach(t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.lv=setTimeout(()=>{this.uv()},5)))}Xd(){clearTimeout(this.lv),this.lv=void 0}onReloading(t){return this.Td.push(t),()=>{this.Td=this.Td.filter(i=>i!==t)}}ensureFlagsLoaded(){this.Md||this.Id||this.lv||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Rd=t}resetFlagCallReported(){this.Dt(ft)}uv(t){this.Xd();var i=this.Js;if(i&&!this.Rn.remoteRequestsDisabled&&!this.$d())if(this.Id)this.Ad=!0;else{var e={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:s({},i.initialPersonProperties,this.Yd("$stored_person_properties")||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Yd(tt),timezone:Po()};Ei(i.deviceId)||(e.$device_id=i.deviceId),(null!=t&&t.disableFlags||this.Rn.featureFlagsDisabled)&&(e.disable_flags=!0);var r=this.sv();r.length&&(e.evaluation_contexts=r);var n=this.ov();Ei(n)||(e.flag_keys=n);var o=this.Rn.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(o?"&only_evaluate_survey_feature_flags=true":""),l=this.Ed;this.Id=!0;var h=()=>{this.Ad&&(this.Ad=!1,this.uv())},u=t=>{this.Id=!1,l===this.Ed?(this.Ot({[_t]:[Lh]}),this.A.error("Feature flag request failed",t),this.ev()&&this.Zd(!0),h()):h()};try{i.sendRequest(a,{target:"flags",method:"POST",body:e,compression:this.Rn.compression,sentAt:"body",timeoutMs:this.Rn.requestTimeoutMs}).then(t=>{var i,r,s=null!==(i=t.json)&&void 0!==i?i:{},n=200!==t.statusCode;if(this.Id=!1,l===this.Ed){if(this.hv(t.statusCode),n||this.Ad||(this.$anon_distinct_id=void 0),!e.disable_flags||this.Ad){this.Pd=!n;var a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Lh:"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.Ot({[_t]: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.av(s,n,{partialResponse:o}),h()}}else h()}).catch(u)}catch(t){u(t)}}}$d(){return fo(this.Od,3)}hv(t){this.Od=po(t,this.Od,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.Pd)if(this.Md||this.getFlags()&&this.getFlags().length>0){if(!this.nv()){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+Nh)}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.Pd)if(this.Md||this.getFlags()&&this.getFlags().length>0){if(!this.nv()){var e,r=this.getFlagVariants(),n=t in r,o=r[t],a=this.getFlagPayloads()[t],l=String(o),h=this.Yd("$feature_flag_request_id")||void 0,u=this.Yd("$feature_flag_evaluated_at")||void 0,d=this.Yd("$flag_call_reported")||{};if(this.Rn.deduplicateCallsPerSession){var v,c=null==(v=this.Js)?void 0:v.session.sessionId,f=this.Yd(pt);c&&c!==f&&(d={},e=c)}if(i.send_event||!("send_event"in i))if(t in d&&d[t].includes(l))e&&this.Ot({[ft]:d,[pt]:e});else{var p,_,g,m,b,y,w,S,x,E,k,T,P;yi(d[t])?d[t].push(l):d[t]=[l],this.Ot(s({[ft]:d},e?{[pt]:e}:{}));var R=this.getFeatureFlagDetails(t),C=[...null!==(p=this.Yd("$feature_flag_errors"))&&void 0!==p?p:[]];Ei(o)&&C.push("flag_missing");var O={$feature_flag:t,$feature_flag_response:o,$feature_flag_payload:null!=a?a:null,$feature_flag_request_id:h,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:null!==(_=null==(g=this.Rn.bootstrap)||null==(g=g.featureFlags)?void 0:g[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(m=null==(b=this.Rn.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])&&void 0!==m?m:null,$used_bootstrap_value:!this.Pd};Ei(null==R||null==(y=R.metadata)?void 0:y.has_experiment)||(O.$feature_flag_has_experiment=R.metadata.has_experiment),Ei(null==R||null==(w=R.metadata)?void 0:w.version)||(O.$feature_flag_version=R.metadata.version);var A=null!==(S=null==R||null==(x=R.reason)?void 0:x.description)&&void 0!==S?S:null==R||null==(E=R.reason)?void 0:E.code;A&&(O.$feature_flag_reason=A),null!=R&&null!=(k=R.metadata)&&k.id&&(O.$feature_flag_id=R.metadata.id),Ei(null==R?void 0:R.original_variant)&&Ei(null==R?void 0:R.original_enabled)||(O.$feature_flag_original_response=Ei(R.original_variant)?R.original_enabled:R.original_variant),null!=R&&null!=(T=R.metadata)&&T.original_payload&&(O.$feature_flag_original_payload=null==R||null==(P=R.metadata)?void 0:P.original_payload),C.length&&(O.$feature_flag_error=C.join(",")),this.dv(O)}else e&&this.Ot({[ft]:d,[pt]:e});if(n)return{key:t,enabled:!!o,variant:"string"==typeof o?o:void 0,payload:zr(a)}}}else this.A.warn('getFeatureFlagResult for key "'+t+Nh)}dv(t){try{var i;null==(i=this.Js)||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.vv(t,i)}vv(t,i){var e=this;return o(function*(){var r=e.Js;if(r){var s={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},n=e.sv();n.length&&(s.evaluation_contexts=n);var o,a=e.ov();Ei(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.Rn.compression,sentAt:"body",timeoutMs:e.Rn.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.Pd)return i.defaultValue;if(!(this.Md||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+Nh),i.defaultValue;var e=this.getFeatureFlag(t,i);return Ei(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.av(t,i,e)}av(t,i,e){if(this.Js){this.Md=!0;var r=function(t,i,e,r,n,o){void 0===i&&(i={}),void 0===e&&(e={}),void 0===r&&(r={}),void 0===o&&(o=Mh);var a=((t,i)=>{var e=t.flags;return e?s({},t,{featureFlags:Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]})),featureFlagPayloads:Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return!Ei(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(yi(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{[V]:h,[q]:c,[Y]:!1}}var p=h,_=u,g=l;if(null!=n&&n.partialResponse){var m=Object.keys(p),b=_||{};p=s({},i,p),_=s({},e,b),m.forEach(t=>{var i;t in b||null==(i=_)||delete i[t]}),g=s({},r,g)}else if(t.errorsWhileComputingFlags)if(l){var y=new Set(Object.keys(l).filter(t=>{var i;return!(null!=(i=l[t])&&i.failed)}));p=s({},i,Object.fromEntries(Object.entries(p).filter(t=>y.has(t[0]))));var w=Object.fromEntries(Object.entries(_||{}).filter(t=>y.has(t[0])));_=s({},e,w),y.forEach(t=>{var i;t in w||null==(i=_)||delete i[t]}),g=s({},r,Object.fromEntries(Object.entries(g||{}).filter(t=>y.has(t[0]))))}else p=s({},i,p),_=s({},e,_),g=s({},r,g);return s({[V]:Object.keys(Bh(p)),[q]:p||{},[K]:_||{},[G]:g||{},[Y]:!0===t.minimalFlagCalledEvents},d?{[J]:d}:{},v?{[gt]:v}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.A);if(r)if(!1===(null==e?void 0:e.persist)){var n=!Ei(this.Js.kv.get(q));this.tv=r,n||this.Ot(r)}else this.Vd(),this.rv(r,t,!(null==e||!e.partialResponse)),this.Ot(r);else i&&this.ev();i||(this.Fd=!1),this.Zd(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.fv(t)}fv(t){if(this.Js){if(!1===t)return this.Dt([X,Q]),this.Zd(),void Dh.info("All overrides cleared");if(yi(t))return this.Ot({[X]:jh(t)}),this.Zd(),void Dh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.Sd=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[X]=yi(s)?jh(s):s),n&&(r[Q]=n),Object.keys(r).length&&this.Ot(r),!1===s&&!1===n?this.Dt([X,Q]):!1===s?this.Dt(X):!1===n&&this.Dt(Q),this.Zd(),!1===s?Dh.info("Flag overrides cleared"):s&&Dh.info("Flag overrides set",{flags:s}),void(!1===n?Dh.info("Payload overrides cleared"):n&&Dh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.Ot({[X]:t}),this.Zd(),void Dh.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.Md){var i=this.pv(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r,n=(this.Yd("$early_access_features")||[]).find(i=>i.flagKey===t),o={["$feature_enrollment/"+t]:i},a={$feature_flag:t,$feature_enrollment:i,$set:o};n&&(a.$early_access_feature_name=n.name),e&&(a.$feature_enrollment_stage=e);var l=s({},this.getFlagVariants(),{[t]:i});null==(r=this._instance)||null==(r=r.persistence)||r.markCrossTabFeatureFlagChanges({[V]:[t],[q]:[t],[Z]:Object.keys(o)}),this.Ot({[V]:Object.keys(Bh(l)),[q]:l,[Z]:s({},this.Yd("$stored_person_properties")||{},o)}),this.Zd();try{var h;null==(h=this.Js)||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.Yd(W);!r||i?this.gv(t,e):t(r)}gv(t,i){var e=this;return o(function*(){var r=e.Js;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.Ot({[W]: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)}}})()}pv(){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),{})}}Zd(t){this.Gd();var i=this.pv(),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.mv(t,i)}mv(t,i){void 0===i&&(i=!0);var e=this.Yd("$stored_person_properties")||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in e||(o[a]=n[a]));this.Ot({[Z]:s({},e,o,r)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=s({},this.Yd("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.Ot({[Z]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.Dt(Z),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.Yd("$stored_group_properties")||{},r=s({},e);for(var n of Object.keys(t))r[n]=s({},e[n],t[n]);this.Ot({[tt]:r}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Yd("$stored_group_properties")||{};this.Ot({[tt]:s({},i,{[t]:{}})})}else this.Dt(tt)}reset(){this.Ed++,this.Ad=!1,this.xd={},this.Cd={},this.tv=void 0,this.Md=!1,this.Rd=!1,this.Pd=!1,this.$anon_distinct_id=void 0,this.Xd(),this.Sd=!1,this.Od=0}}},su={sessionRecording:class{get Rn(){return this._instance.config}get sl(){return this._instance.persistence}get started(){var t;return!(null==(t=this.yv)||!t.isStarted)}get status(){var t,i;return"awaiting_config"===this.bv||"missing_config"===this.bv?this.bv:null!==(t=null==(i=this.yv)?void 0:i.status)&&void 0!==t?t:this.bv}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this.bv=dh,this._v=void 0,this.wv=!1,this.Ke=(()=>{var t;if(null==Xt||!Xt.visibilityState||"visible"===Xt.visibilityState)return!0;var i=null==Kt||null==(t=Kt.performance)||null==t.getEntriesByType?void 0:t.getEntriesByType("visibility-state");return!(null!=i&&i.length)||i.some(t=>"visible"===t.name)})(),this.ar=()=>{var t;"visible"===(null==Xt?void 0:Xt.visibilityState)&&(this.Ke=!0,null==(t=this.yv)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},!this._instance.sessionManager)throw ch.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Rn.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');null!=Xt&&Xt.addEventListener&&Os(Xt,"visibilitychange",this.ar)}initialize(){this.startIfEnabledOrStop()}dispose(t){var i=(void 0===t?{}:t).discardBufferedEvents,e=void 0!==i&&i;this.wv=!0,null==Xt||null==Xt.removeEventListener||Xt.removeEventListener("visibilitychange",this.ar),e?this.Sv(!0):this.stopRecording()}get xv(){var t,i=!(null==(t=this._instance.get_property(C))||!t.enabled),e=!this.Rn.disable_session_recording,r=this.Rn.disable_session_recording||this._instance.consent.isOptedOut();return Kt&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!(this.wv||this.xv&&null!=(i=this.yv)&&i.isStarted)){var e=!Ei(Object.assign)&&!Ei(Array.from);this.xv&&e?(this.Cv(t),ch.info("starting")):(this.bv=dh,this.stopRecording())}}Cv(t){var i,e;if(this.xv)if("awaiting_config"!==this.bv&&"missing_config"!==this.bv&&(this.bv=vh),null!=oi&&null!=(i=oi.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=oi.__PosthogExtensions__)&&e.initSessionRecording)this.Tv(t);else{var r,s=this._instance.sessionManager;null==(r=oi.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Mv,i=>{if(!this.wv&&this.xv&&this._instance.sessionManager===s)return i?(this._instance.register_for_session({[Rt]:!0}),ch.error("could not load recorder",i)):void this.Tv(t);this.bv=dh})}}stopRecording(){var t,i;null==(t=this._v)||t.call(this),this._v=void 0,null==(i=this.yv)||i.stop()}Sv(t){var i,e;void 0===t&&(t=!1),null==(i=this._v)||i.call(this),this._v=void 0,null==(e=this.yv)||e.discard({discardProducerEvents:t})}Iv(){var t,i;null==(t=this.sl)||t.unregister(L),null==(i=this.sl)||i.unregister(A)}Ev(t,i){if(Pi(t))return null;var e,r=Ri(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(ch.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Rv(t){if(this.sl){var i,e,r=this.sl,n=()=>{var i,e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Ev(null==(i=this.Rn.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this.Ev(null==e?void 0:e.sampleRate,"remote config sampleRate"),a=null!=n?n:o;Pi(a)&&this.Iv();var l=null==e?void 0:e.minimumDurationMilliseconds;r.register({[C]:s({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:s({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:a,minimumDurationMilliseconds:Ei(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._v)||i.call(this),this._v=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.Rv(i),void this.Sv()):(this.Rv(i),void this.startIfEnabledOrStop()):("awaiting_config"===this.bv&&(this.bv="missing_config",ch.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.yv)&&e.log?this.yv.log(t,i):ch.warn("log called before recorder was ready")}get Mv(){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"}Av(){var t,i=this._instance.get_property(C);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return ch.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}Tv(t){var i,e,r;if(!this.wv&&this.xv&&this._instance.sessionManager){if(null==(i=oi.__PosthogExtensions__)||!i.initSessionRecording)return ch.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Rt]:!0});var s;if(this.yv||(this.yv=null==(s=oi.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.Ke),this.yv._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Av()){if("missing_config"===this.bv||"awaiting_config"===this.bv)return;return this.bv="awaiting_config",ch.info("persisted remote config is stale, requesting fresh config before starting"),void new Zo(this._instance).load()}this.bv=vh,null==(e=(r=this.yv).setDocumentWasEverVisible)||e.call(r,this.Ke),this.yv.start(t)}else this.bv=dh}onRRwebEmit(t){var i;null==(i=this.yv)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.yv||null==(t=this.sl)||t.register({[F]:!0}),null==(i=this.yv)||i.overrideLinkedFlag()}overrideSampling(){var t,i;this.yv||null==(t=this.sl)||t.register({[I]:!0}),null==(i=this.yv)||i.overrideSampling()}overrideTrigger(t){var i,e;this.yv||null==(i=this.sl)||i.register({["url"===t?M:D]:!0}),null==(e=this.yv)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.yv)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.yv)||!e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t;null==(t=this.yv)||null==t.flushBeforeIdentityReset||t.flushBeforeIdentityReset()}}},nu={autocapture:class extends Zl{constructor(t){super(new th(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.Pv=this.Fv()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.Ov();return!!(t.path||t.search||this.$v(t))}startIfEnabled(){this.isEnabled&&(bs.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Pv=this.Fv(),this.startIfEnabled()}stop(){this.Dv&&this.Dv(),this.Dv=void 0,this.Lv&&this.Lv(),this.Lv=void 0,bs.info("History API monitoring stopped")}monitorHistoryChanges(){Kt&&Kt.history&&(this.Nv("pushState"),this.Nv("replaceState"),this.qv(),this.$v()&&this.jv())}Nv(t){var i;if(Kt&&(null==(i=Kt.history[t])||!i.__posthog_wrapped__)){var e=this;sh(Kt.history,t,i=>function(r,s,n){i.call(this,r,s,n),e.Bv(t)})}}Fv(){var t=null==Kt?void 0:Kt.location;if(null!=t&&t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Ov(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:Si(t)?t:{}}$v(t){return void 0===t&&(t=this.Ov()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}Hv(t){var i=this.Ov(),e=this.Pv;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.$v(i)&&t.hash!==e.hash))}Bv(t){try{var i=this.Fv();if(!i)return;this.Hv(i)&&this._instance.capture(qt,{navigation_type:t}),this.Pv=i}catch(i){bs.error("Error capturing "+t+" pageview",i)}}qv(){if(!this.Dv){var t=()=>{this.Bv("popstate")};Os(Kt,"popstate",t),this.Dv=()=>{Kt&&Kt.removeEventListener("popstate",t)}}}jv(){if(!this.Lv){var t=()=>{this.Bv("hashchange")};Os(Kt,"hashchange",t),this.Lv=()=>{Kt&&Kt.removeEventListener("hashchange",t)}}}},heatmaps:class{get Rn(){return this.instance.config}constructor(t){var i;this.zv=!1,this.Xs=!1,this.Uv=null,this.instance=t,this.zv=!(null==(i=this.instance.persistence)||!i.props[y]),this.rageclicks=new Gl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Si(this.Rn.capture_heatmaps)&&this.Rn.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rn.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Pi(this.Rn.capture_heatmaps)?Pi(this.Rn.enable_heatmaps)?this.zv:this.Rn.enable_heatmaps:!1!==this.Rn.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Xs)return;fh.info("starting..."),this.Wv(),this.ar()}else{var t;clearInterval(null!==(t=this.Uv)&&void 0!==t?t:void 0),this.Vv(),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({[y]:e}),this.zv=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.Rt;return this.Rt=void 0,t}Gv(t){ph(t.originalEvent)&&this.vn(t.originalEvent,"deadclick")}ar(){this.Uv&&clearInterval(this.Uv),this.Uv="visible"===(null==Xt?void 0:Xt.visibilityState)?setInterval(this.Ja.bind(this),this.flushIntervalMilliseconds):null}Wv(){Kt&&Xt&&(this.Zv=this.Ja.bind(this),Os(Kt,Ht,this.Zv),this.Jv=t=>this.vn(t||(null==Kt?void 0:Kt.event)),Os(Xt,"click",this.Jv,{capture:!0}),this.Qv=t=>this.Kv(t||(null==Kt?void 0:Kt.event)),Os(Xt,"mousemove",this.Qv,{capture:!0}),this.Xv=new Xn(this.instance,Jn,this.Gv.bind(this)),this.Xv.startIfEnabledOrStop(),this.Yv=this.ar.bind(this),Os(Xt,zt,this.Yv),this.Xs=!0)}Vv(){var t;Kt&&Xt&&(this.Zv&&Kt.removeEventListener(Ht,this.Zv),this.Jv&&Xt.removeEventListener("click",this.Jv,{capture:!0}),this.Qv&&Xt.removeEventListener("mousemove",this.Qv,{capture:!0}),this.Yv&&Xt.removeEventListener(zt,this.Yv),clearTimeout(this.tc),null==(t=this.Xv)||t.stop(),this.Xs=!1)}ec(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&&dn(r)&&!vn(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:Kt)?void 0:n.getComputedStyle(r).position}catch(t){return!1}if(hi(i,s))return!0;r=En(r)}return!1}(yn(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:e),target_fixed:n,type:i}}vn(t,i){var e;if(void 0===i&&(i="click"),!un(t.target)&&ph(t)){var r=this.ec(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&On(yn(t),this.instance.config.rageclick)&&this.$s(s({},r,{type:"rageclick"})),this.$s(r)}}Kv(t){!un(t.target)&&ph(t)&&(clearTimeout(this.tc),this.tc=setTimeout(()=>{this.$s(this.ec(t,"mousemove"))},500))}$s(t){if(Kt){var i=this.Rn.disable_capture_url_hashes?ir(Kt.location.href):Kt.location.href,e=this.Rn.custom_personal_data_properties,r=vo(i,this.Rn.mask_personal_data_properties?[..._o,...e||[]]:[],mo);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(t)}}Ja(){this.Rt&&!xi(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Xn,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this.zv=!1,this.Xs=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.rc=()=>{clearTimeout(this.nc),this.nc=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",s({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,i)=>s({},t,{["$web_vitals_"+i.name+"_event"]:s({},i),["$web_vitals_"+i.name+"_value"]:i.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.sc=t=>{var i;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Pi(null==t?void 0:t.name)||Pi(null==t?void 0:t.value))oh.error("Invalid metric received",t);else{var e="string"==typeof t.navigationURL?t.navigationURL:void 0,r=this.oc(e);if(!Ei(r)){var n=Ri(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+r;if(!this.ac||this.ac>t.value){this.Rt.navigationKey!==n&&(this.rc(),this.nc=setTimeout(this.rc,this.flushToCaptureTimeoutMs)),Ei(this.Rt.navigationKey)&&(this.Rt.navigationKey=n,this.Rt.url=r),this.Rt.firstMetricTimestamp=Ei(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;var o=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),a=s({},t,e?{navigationURL:r}:{},{$current_url:r,timestamp:Date.now()});if(delete a.entries,Si(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var l={};for(var h of uh){var u="url"===h&&"string"==typeof t.attribution[h]?this.oc(t.attribution[h]):t.attribution[h];Ei(u)||(l[h]=u)}a.attribution=l}else delete a.attribution;Ei(o)||(a.$session_id=o.sessionId,a.$window_id=o.windowId),this.Rt.metrics.push(a),this.Rt.metrics.length===this.allowedMetrics.length&&this.rc()}else oh.error("Ignoring metric with value >= "+this.ac,t)}}},this.lc=()=>{if(!this.Xs){var t,i,e,r,n=!1,o=oi.__PosthogExtensions__,a=null==o?void 0:o.postHogWebVitalsCallbacksByFlavor,l=(null==a?void 0:a[this.uc])||("web-vitals"===this.uc&&Ei(a)?null==o?void 0:o.postHogWebVitalsCallbacks:void 0);if(!Ei(l)){var h=l.withoutAttribution,u=this.attributionMetrics;n=!Ei(h),t=u.indexOf("LCP")>-1?l.onLCP:(null==h?void 0:h.onLCP)||l.onLCP,i=u.indexOf("CLS")>-1?l.onCLS:(null==h?void 0:h.onCLS)||l.onCLS,e=u.indexOf("FCP")>-1?l.onFCP:(null==h?void 0:h.onFCP)||l.onFCP,r=u.indexOf("INP")>-1?l.onINP:(null==h?void 0:h.onINP)||l.onINP}if(t&&i&&e&&r){var d={reportSoftNavs:this.useSoftNavs},v=n&&this.attributionMetrics.indexOf("INP")>-1?s({},d,{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&t(this.sc.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&i(this.sc.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&e(this.sc.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&r(this.sc.bind(this),v),this.Xs=!0}else oh.error("web vitals callbacks not loaded - not starting")}},this.zv=!(null==(i=this._instance.persistence)||!i.props[E]),this.startIfEnabled()}get hc(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=Si(this.hc)?null==(t=this.hc)?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)||lh:e}get flushToCaptureTimeoutMs(){return(Si(this.hc)?this.hc.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=Si(this.hc)?this.hc.web_vitals_attribution:void 0;return Oi(t)?t?lh:[]:yi(t)?t:hh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t;return null!==(t=Si(this.hc)?this.hc.__preview_web_vitals_soft_navs:void 0)&&void 0!==t&&t}get ac(){var t=Si(this.hc)&&Ri(this.hc.__web_vitals_max_value)?this.hc.__web_vitals_max_value:ah;return t>0&&6e4>=t?ah:t}get isEnabled(){var t=null==Qt?void 0:Qt.protocol;if("http:"!==t&&"https:"!==t)return oh.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=Si(this.hc)?this.hc.web_vitals:Oi(this.hc)?this.hc:void 0;return Oi(i)?i:this.zv}startIfEnabled(){this.isEnabled&&!this.Xs&&(oh.info("enabled, starting..."),this.bo(this.lc))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=Si(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=Si(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[E]:e}),this._instance.persistence.register({[R]:r})),this.zv=e,this.startIfEnabled()}}}get uc(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}bo(t){var i=oi.__PosthogExtensions__,e=this.uc,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&Ei(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,i=>{i?oh.error("failed to load script",i):t()})}oc(t){var i=t||(null==Kt?void 0:Kt.location.href);if(i){var e=this._instance.config.disable_capture_url_hashes?ir(i):i,r=this._instance.config.custom_personal_data_properties;return vo(e,this._instance.config.mask_personal_data_properties?[..._o,...r||[]]:[],mo)}oh.error("Could not determine current URL")}}},ou={exceptionObserver:class{constructor(t){var i;this.lc=()=>{var t;if(Kt&&this.isEnabled&&null!=(t=oi.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=oi.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=oi.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=oi.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.dc&&this.Rn.capture_unhandled_errors&&(this.dc=i(this.captureException.bind(this))),!this.vc&&this.Rn.capture_unhandled_rejections&&(this.vc=e(this.captureException.bind(this))),!this.cc&&this.Rn.capture_console_errors&&(this.cc=r(this.captureException.bind(this)))}catch(t){ih.error("failed to start",t),this.fc()}}},this._instance=t,this.gc=!(null==(i=this._instance.persistence)||!i.props[w]),this.wt=new Hi(s({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,A:ih})),this.Rn=this.mc(),this.startIfEnabledOrStop()}mc(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Si(t)?i=s({},i,t):(Ei(t)?this.gc:t)&&(i=s({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Rn.capture_console_errors||this.Rn.capture_unhandled_errors||this.Rn.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ih.info("enabled"),this.fc(),this.bo(this.lc)):this.fc()}bo(t){var i,e;null!=(i=oi.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=oi.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return ih.error("failed to load script",i);t()})}fc(){var t,i,e;null==(t=this.dc)||t.call(this),this.dc=void 0,null==(i=this.vc)||i.call(this),this.vc=void 0,null==(e=this.cc)||e.call(this),this.cc=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.gc=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[w]:this.gc}),this.Rn=this.mc(),this.startIfEnabledOrStop())}}onConfigChange(){this.Rn=this.mc()}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 ih.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.yc=[],this.bc=new or([new Er,new Fr,new $r,new kr,new Ar,new Or,new Pr,new Ir],function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];return function(i,r){void 0===r&&(r=0);for(var n=[],o=i.split("\n"),a=Math.min(o.length,r+1e3),l=[],h=r;a>h;h++){var u=o[h];if(1024>=u.length){var d=_r.test(u)?u.replace(_r,"$1"):u;if(!d.match(/\S*Error: /)){for(var v of e){var c=v(d,t);if(c){n.push(c);var f=mr(n);if(f){for(var p=l.length-1;p>=0;p--){var _=l[p];if(f.start>=_.start+_.length)break;l.pop()}l.push(f)}break}}if(Sr(n,l)>=50)break}}}var g=[...l].sort((t,i)=>i.start-t.start),m=g[g.length-1];if(m){var b=yr(n,m);for(var y of(n.splice(m.start-b,b),g))y.start-=b}for(var w of g)br(n,w);return l.some(t=>0===t.start&&n.length===t.length)&&function(t){for(var i=t.map(t=>t.function+"|"+t.filename+"|"+t.lineno+"|"+t.colno+"|"+t.module),e=0,r=1;i.length>r;r++)xr(i,r,e)&&(e=r);t.push(...t.splice(0,e))}(n),function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return s({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",vr,pr)),this._instance=t,this.yc=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this._c=jr(this.wc()),this.kc=new Br(this._c)}onConfigChange(){this._c=jr(this.wc()),this.kc.setConfig(this._c)}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.yc=n,this._instance.persistence&&this._instance.persistence.register({[S]:this.yc,[x]:o})}}}get Sc(){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.bc.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this._c.enabled)try{if(!ki(t)||0===t.trim().length)return void zh.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)=>Nr.has(r)?(i.push(r),e):(e[r]=t[r],e),{}),droppedKeys:i}}(this.xc(i)),r=e.sanitizedProperties,n=e.droppedKeys;n.length>0&&zh.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.kc.add(s({[Mr]:t,[Dr]:(new Date).toISOString()},r))}catch(t){zh.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.Cc(i)){if(this.Tc(i))return this.Mc("Exception dropped: matched a suppression rule"),void zh.info("Skipping exception capture because a suppression rule matched");if(!this.Sc&&this.Ic(i))return this.Mc("Exception dropped: thrown by a browser extension"),void zh.info("Skipping exception capture because it was thrown by an extension");if(!this.Sc&&this.Ec(i))return this.Mc("Exception dropped: thrown by an injected browser script"),void zh.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Rc(i))return this.Mc("Exception dropped: thrown by the PostHog SDK"),void zh.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this._c.enabled&&Pi(t.$exception_steps)?this.Ac(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",Du:!0});return s&&this.kc.clear(),s}catch(t){return Uh(t)||zh.error("Failed to capture exception event. Dropping this exception.",t),void this.kc.clear()}}catch(t){return void(Uh(t)||zh.error("Failed to process exception event. Ignoring this exception.",t))}var n}Ac(t){try{var i=this.kc.getAttachable();return 0===i.length?t:s({},t,{$exception_steps:i})}catch(i){return zh.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Mc(t){this._c.enabled&&this.kc.add({[Mr]:t,[Dr]:(new Date).toISOString()})}xc(t){return Si(t)?s({},t):{}}wc(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}Tc(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.yc.some(t=>{var e=t.values.map(t=>{var e=ul[t.operator],r=i[t.key];if(!e||!r)return!1;var s=yi(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 zh.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Ic(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&&Vh.some(t=>i.startsWith(t))});return 0!==e.length&&(!e.every(t=>{var i=t.filename;return!!i&&i.startsWith(Hh)})||t.some(t=>{var i=t.value;return"NoResponse"===t.type||ki(i)&&qh.some(t=>{var e=t.value;return t.exact?i===e:i.includes(e)})})&&!i.some(t=>{var i=t.filename;return t.in_app&&!(null!=i&&i.startsWith(Hh))}))}Ec(t){return t.some(t=>{var i=t.value;return ki(i)&&Wh.some(t=>i.includes(t))})}Rc(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}Cc(t){return!Pi(t)&&yi(t)}}},au=s({productTours:class{get sl(){return this._instance.persistence}constructor(t){this.Pc=null,this.Fc=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.sl&&this.sl.register({[T]:!!i.productTours}),!gh(this._instance))return!this.Pc&&Pi(null==(e=this.sl)?void 0:e.props.ph_product_tours)||_h.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.Pc)||r.stop(),this.Pc=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Pc&&gh(this._instance)&&this.bo(()=>this.Oc())}bo(t){var i,e;null!=(i=oi.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=oi.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",i=>{i?_h.error("Could not load product tours script",i):t()})}Oc(){var t;!this.Pc&&null!=(t=oi.__PosthogExtensions__)&&t.generateProductTours&&(this.Pc=oi.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!yi(this.Fc)||i){var e=this.sl;if(e){var r=e.props[at];if(yi(r)&&!i)return this.Fc=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(gh(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||_h.warn(s):_h.error(s),void t([],{isLoaded:!1,error:s})}var n=yi(i.json.product_tours)?i.json.product_tours:[];this.Fc=n,e&&e.register({[at]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Fc,{isLoaded:!0})}getActiveProductTours(t){Pi(this.Pc)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Pc.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.Pc)||i.showTourById(t)}previewTour(t){this.Pc?this.Pc.previewTour(t):this.bo(()=>{var i;this.Oc(),null==(i=this.Pc)||i.previewTour(t)})}dismissProductTour(){var t;null==(t=this.Pc)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Pc)||t.nextStep()}previousStep(){var t;null==(t=this.Pc)||t.previousStep()}clearCache(){var t;this.Fc=null,null==(t=this.sl)||t.unregister(at)}resetTour(t){var i;null==(i=this.Pc)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.Pc)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.Pc)||i.cancelPendingTour(t)}}},ru),lu={siteApps:class{constructor(t){this._instance=t,this.$c=0,this.Dc=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Lc(t,i){if(i){var e=this.globalsForEvent(i);this.Dc.push(e),this.Dc.length>1e3&&(this.Dc=this.Dc.slice(10))}}get siteAppLoaders(){var t;return null==(t=oi._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Lc.bind(this));this.Nc=()=>{t(),this.Dc=[],this.Nc=void 0}}}globalsForEvent(t){var i,n,o,a,l,h,u;if(!t)throw new Error("Event payload is required");var d={},v=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var f of Object.entries(c)){var p=f[0];d[p]={id:v[p],type:p,properties:f[1]}}var _=t.$set_once,g=t.$set;return{event:s({},r(t,e),{properties:s({},t.properties,g?{$set:s({},null!==(i=null==(n=t.properties)?void 0:n.$set)&&void 0!==i?i:{},g)}:{},_?{$set_once:s({},null!==(o=null==(a=t.properties)?void 0:a.$set_once)&&void 0!==o?o:{},_)}:{}),elements_chain:null!==(l=null==(h=t.properties)?void 0:h.$elements_chain)&&void 0!==l?l:"",distinct_id:null==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:d}}qc(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)||(mh.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)||(mh.error("prepare_external_dependency_script returned null"),null):t}jc(){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==Xt?void 0:Xt.defaultView,h=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!h)return()=>{};if(this.$c++,this.Bc)return this.Hc();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.qc(t);return i&&v.add(i),i},p=t=>t.map(t=>"string"==typeof t?t:f(t)).filter(t=>!Ti(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.Bc=()=>{u.forEach(t=>t()),this.Bc=void 0},this.Hc()}Hc(){var t=!1;return()=>{var i;t||(t=!0,this.$c--,0===this.$c&&(null==(i=this.Bc)||i.call(this)))}}zc(t,i){void 0===i&&(i=!0);var e=this.jc();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.Dc.length&&(mh.info("Processing "+this.Dc.length+" events for site app with id "+t.id),this.Dc.forEach(t=>this.zc(()=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null==(e=this.Nc)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,mh.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.zc(i=>t.init({posthog:this._instance,callback(t){i(),s(t)}}),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){mh.error(bh+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){mh.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}Uc(){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)}Wc(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.zc(()=>null==r.processEvent?void 0:r.processEvent(e))}catch(i){mh.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.Uc(),void this._instance.on("eventCaptured",t=>this.Wc(t))):void mh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.Nc)||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;oi["__$$ph_site_app_"+i]=s._instance,null==(t=oi.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,t=>{if(t)return mh.error(bh+i,t)})};for(var a of n.siteApps)o()}else mh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},hu={tracingHeaders:class{constructor(t){this._instance=t,this.Vc=void 0,this.Gc=void 0,this.Zc=void 0,this.lc=()=>{var t,i,e=this.Jc();e?(Ei(this.Vc)&&(this.Vc=null==(t=oi.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Ei(this.Gc)&&(this.Gc=null==(i=oi.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.fc()}}initialize(){this.startIfEnabledOrStop()}bo(t){var i,e;null!=(i=oi.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=oi.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return nh.error("failed to load script",i);t()})}Qc(){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}Jc(){var t=this.Qc();return yi(t)?(yi(this.Zc)?this.Zc.splice(0,this.Zc.length,...t):this.Zc=[...t],t.length>0?this.Zc:void 0):(yi(this.Zc)&&this.Zc.splice(0),this.Zc=t||void 0,this.Zc)}fc(){var t,i;null==(t=this.Vc)||t.call(this),null==(i=this.Gc)||i.call(this),this.Vc=void 0,this.Gc=void 0}startIfEnabledOrStop(){this.Jc()?this.bo(this.lc):this.fc()}}},uu=s({surveys:class extends xh{constructor(t){var i;super(new Rh(t),(i=t,{get projectToken(){return i.config.token},kv:new Ph(i)})),this._instance=t}ah(t,i){var e=i.query?Na(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})})}}},ru),du={toolbar:class{constructor(t){this.instance=t}Kc(t){oi.ph_toolbar_state=t}Xc(){var t;return null!==(t=oi.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),As(this.instance.config))return!1;if(!Kt||!Xt)return!1;t=null!=t?t:Kt.location,e=null!=e?e:Kt.history;try{if(!i){try{Kt.localStorage.setItem("test","test"),Kt.localStorage.removeItem("test")}catch(t){return!1}i=null==Kt?void 0:Kt.localStorage}var r,s=Ch||co(t.hash,"__posthog")||co(t.hash,"state"),n=s?ks(()=>JSON.parse(atob(decodeURIComponent(s))))||ks(()=>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(Oh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Yc(t){var i=oi.ph_load_toolbar||oi.ph_load_editor;!Pi(i)&&wi(i)?i(t,this.instance):Ah.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==Xt||!Xt.getElementById("__POSTHOG_TOOLBAR__"));if(!Kt||i)return!1;var e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=s({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(Kt.localStorage.setItem(Oh,JSON.stringify(s({},r,{source:void 0}))),2===this.Xc())this.Yc(r);else if(0===this.Xc()){var n;this.Kc(1),null==(n=oi.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",t=>{if(t)return Ah.error("[Toolbar] Failed to load",t),void this.Kc(0);this.Kc(2),this.Yc(r)}),Os(Kt,"turbolinks:load",()=>{this.Kc(0),this.loadToolbar(r)})}return!0}tf(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)}}},vu=s({experiments:class t{get Rn(){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.ef("retrieved web experiments from the server"),e.if=new Map,i.forEach(i=>{if(i.feature_flag_key){var r;e.if&&(t.ef("setting flag key ",i.feature_flag_key," to web experiment ",i),null==(r=e.if)||r.set(i.feature_flag_key,i));var s=e._instance.getFeatureFlag(i.feature_flag_key);ki(s)&&i.variants[s]&&e.rf(i.name,s,i.variants[s].transforms)}else if(i.variants)for(var n in i.variants){var o=i.variants[n];t.nf(o,e._instance)&&e.rf(i.name,n,o.transforms)}})},i)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(i){if(this._is_bot())t.ef(Gh);else if(!this.Rn.disable_web_experiments){if(Pi(this.if))return this.if=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.ef("applying feature flags",i),i.forEach(t=>{var i;if(this.if&&null!=(i=this.if)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.if)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.rf(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var i=t.getWindowLocation();if(null!=i&&i.search){var e=uo(null==i?void 0:i.search,"__experiment_id"),r=uo(null==i?void 0:i.search,"__experiment_variant");e&&r&&(t.ef("previewing web experiments "+e+" && "+r),this.getWebExperiments(t=>{this.sf(parseInt(e),r,t)},!1,!0))}}loadIfEnabled(){this.Rn.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Rn.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.Rn.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}sf(i,e,r){var s=r.filter(t=>t.id===i);s&&s.length>0&&(t.ef("Previewing web experiment ["+s[0].name+"] with variant ["+e+"]"),this.rf(s[0].name,e,s[0].variants[e].transforms))}static nf(i,e){return!Pi(i.conditions)&&t.af(i,e)&&t.lf(i)}static af(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=hn(e,s.href);return null==(n=i.conditions)||!n.url||Kh[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==Kt?void 0:Kt.location}static lf(t){var i;if(Pi(t.conditions)||Pi(null==(i=t.conditions)?void 0:i.utm))return!0;var e=yo();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 ef(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];bs.info("[WebExperiments] "+t,e)}rf(i,e,r){this._is_bot()?t.ef(Gh):"control"!==e?r.forEach(r=>{var s;r.selector&&(t.ef("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.ef("Control variants leave the page unmodified.")}_is_bot(){return Yt&&this._instance?sl(Yt,this.Rn.custom_blocked_useragents):void 0}}},ru),cu=s({},ru,su,nu,ou,au,lu,uu,hu,du,vu,{conversations:class{constructor(t){this._instance=t,this.uf=void 0,this._conversationsManager=null,this.hf=!1,this.re=null,this.df=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.vf=t.ok,t.ok)){var i=t.config.conversations;Pi(i)||(Oi(i)?this.uf=i:(this.uf=i.enabled,this.re=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.uf=void 0,this.re=null,this.vf=void 0,this.df=!1}loadIfEnabled(){if(!(this._conversationsManager||this.hf||this._instance.config.disable_conversations||As(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==oi?void 0:oi.__PosthogExtensions__;if(t&&!Ei(this.uf)&&this.uf)if(this.re&&this.re.token){this.hf=!0;try{var i=t.initConversations;if(i)return this.cf(i),void(this.hf=!1);var e=t.loadExternalDependency;if(!e)return void this.ff(Lt);e(this._instance,"conversations",i=>{i||!t.initConversations?this.ff("Could not load conversations script",i):this.cf(t.initConversations),this.hf=!1})}catch(t){this.ff("Error initializing conversations",t),this.hf=!1}}else Jh.error("Conversations enabled but missing token in remote config.")}}cf(t){if(this.re)try{this._conversationsManager=t(this.re,this._instance),this.df=!1,Jh.info("Conversations loaded successfully")}catch(t){this.ff("Error completing conversations initialization",t)}else Jh.error("Cannot complete initialization: remote config is null")}ff(t,i){Jh.error(t,i),this._conversationsManager=null,this.hf=!1,this.df=!0}show(){this._conversationsManager?this._conversationsManager.show():Jh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.uf&&!Ti(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":As(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.vf?"remote_config_failed":Ei(this.uf)?this.vf?"disabled_in_project":"remote_config_pending":this.uf?Pi(this.re)||!this.re.token?"missing_token":null!=oi&&oi.__PosthogExtensions__?this.hf?"initializing":this.df?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var r=this;return o(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(Jh.warn(Yh),null)})()}getMessages(t,i){var e=this;return o(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(Jh.warn(Yh),null)})()}markAsRead(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Jh.warn(Yh),null)})()}getTickets(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Jh.warn(Yh),null)})()}requestRestoreLink(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Jh.warn(Yh),null)})()}restoreFromToken(t){var i=this;return o(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Jh.warn(Yh),null)})()}restoreFromUrlToken(){var t=this;return o(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Jh.warn(Yh),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}Wu(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Vu(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},{logs:class{constructor(t){var i,e=this;this._instance=t,this.name="logs",this.pf=!1,this.gf=!1,this.mf=!1,this.A=ys("[logs]"),this.yf=s({},this.A,{error(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];i.some(eu)||e.A.error(...i)}}),this.La=[],this.bf=[],this.Od=0,this.ro=!1,this._f=[],this.wf=[],this.kf=!1,this.Sf=!1,this.xf=()=>{var t,i;this.ro||(this.Od=0,null==(t=this.Cf)||t.onReconnect(),null==(i=this.Tf)||i.onReconnect())},this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.pf=!0),Kt&&Os(Kt,"online",this.xf)}Mf(t,i,e,r){var s,n=Xh(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new cs(this.If(t,i),n,this.yf,()=>this.Ef(),t=>t(),void 0,r),n]}Rf(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Cf||this.Af!==i){var e;null==(e=this.Cf)||e.reset(),this.Af=i;var r=this.Mf(()=>this.La,t=>{this.La=t});this.Cf=r[0],this.Pf=r[1]}return this.Cf}Ff(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Tf||this.Of!==i){var e;null==(e=this.Tf)||e.reset(),this.Of=i;var r=this.Mf(()=>this.bf,t=>{this.bf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Zh);this.Tf=r[0],this.$f=r[1]}return this.Tf}setup(t){var i;if(!this.ro){this.Js=t,null!=(i=this._instance)&&null!=(i=i.config)&&null!=(i=i.logs)&&i.captureConsoleLogs&&(this.pf=!0),(this.pf||this.Df()&&this.Lf())&&this.Nf();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.ro?r.dispose():(this.oo=r,e||this.loadIfEnabled())}}dispose(){var t,i,e,r;this.ro||(this.ro=!0,this.qf(),null==(t=this.oo)||t.dispose(),this.oo=void 0,this.Js=void 0,this.mf=!1,null==Kt||Kt.removeEventListener("online",this.xf),null==(i=this.jf)||i.call(this),this.jf=void 0,null==(e=this.Cf)||e.reset(),null==(r=this.Tf)||r.reset())}onRemoteConfig(t){var i,e;if(!this.ro){var r=t.ok?null==(i=t.config.logs)?void 0:i.captureConsoleLogs:void 0;Pi(r)?this.Bf():(null==(e=this._instance)||null==(e=e.persistence)||e.register({[P]:!!r}),r?(this.pf=!0,this.gf||this.Nf(),this.loadIfEnabled()):this.Bf())}}reset(){var t,i,e,r;this.qf(),null==(t=this.Cf)||t.clearQueue(),this.La=[],null==(i=this.Cf)||i.reset(),null==(e=this.Tf)||e.clearQueue(),this.bf=[],null==(r=this.Tf)||r.reset(),this.Od=0}captureLog(t){this.ro||this.Rf().captureLog(t)}captureConsoleLog(t){this.ro||this.Ff().captureLog(t)}captureBufferedConsoleLog(t,i,e){this.ro||this.Ff().captureLog(t,{context:i,occurredAtMs:e})}Lf(){var t;return!(null==(t=this._instance)||null==(t=t.persistence)||null==(t=t.props)||!t[P])}Df(){var t,i;return null==(t=this._instance)||null==t.Fa||!t.Fa()||!(null==(i=oi._POSTHOG_REMOTE_CONFIG)||null==(i=i[this._instance.config.token])||!i.config)}Zu(){var t;this.qf(),null==(t=this.Tf)||t.clearQueue(),this.bf=[]}Bf(){this.pf||this.qf()}Nf(){var t,i=this;if(!this.kf&&null!=oi&&oi.console){var e=Xh(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})(oi.console[t])}catch(t){return 0}if(!r)return 0;i.wf.push(sh(oi.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.Hf(t,n,e)}catch(t){}return s.apply(oi.console,n)};return n.__rrweb_original__=r,n}))};for(var s of Qh)r(s);this.kf=!0,this.zf=setTimeout(()=>{this.qf()},3e4)}}Hf(t,i,e){var r;if(this.kf&&!this.Sf&&0!==i.length)if(null!=(r=this._instance)&&r.is_capturing()){if(e>this._f.length){this.Sf=!0;try{this._f.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Ef()})}finally{this.Sf=!1}}}else this.qf()}qf(){if(this._f=[],this.kf){for(var t of(this.kf=!1,this.zf&&(clearTimeout(this.zf),this.zf=void 0),this.wf))t();this.wf=[]}}Uf(){var t=this._f;return this.qf(),t}get logger(){return this.Wf||(this.Wf={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.Wf}flushLogs(t){t?this.Vf(t):(this.Cf&&this.Cf.flush().catch(t=>this.Gf(t)),this.Tf&&this.Tf.flush().catch(t=>this.Gf(t)))}Gf(t){eu(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(!this.ro&&this.pf&&!this.gf&&!this.mf){var t=null==oi?void 0:oi.__PosthogExtensions__;if(!t)return this.A.error("PostHog Extensions not found."),void this.qf();var i=t.loadExternalDependency;if(!i)return this.A.error(Lt),void this.qf();this.mf=!0;try{i(this._instance,"logs",i=>{if(this.mf=!1,!this.ro&&this.pf){var e=t.logs;if(i||null==e||!e.initializeLogs)this.A.error("Could not load logs script",i),this.qf();else{var r,s,n=this.Uf();this.jf=e.initializeLogs(null!==(r=this.Js)&&void 0!==r?r:this._instance),this.gf=!0,n.length>0&&(null==e.replayConsoleBuffer||e.replayConsoleBuffer(null!==(s=this.Js)&&void 0!==s?s:this._instance,n))}}})}catch(t){throw this.mf=!1,t}}}If(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===ci.LogsQueue?t():void 0,setPersistedProperty(t,e){t===ci.LogsQueue&&i(null!=e?e:[])},xs:t=>this.xs(t),getLibraryId:()=>h.LIB_NAME,getLibraryVersion:()=>h.LIB_VERSION}}xs(t){return new Promise(i=>{if(fo(this.Od,3))i({kind:"fatal",error:iu(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:iu(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Zf(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.Jf(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:iu(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)})}}})}})}Jf(t){(0!==t||this._instance.__loaded)&&(this.Od=po(t,this.Od,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.")))}Vf(t){this.La.length>0&&this.Qf(t,this.La,this.Pf,h.LIB_NAME,t=>{this.La=t}),this.bf.length>0&&this.Qf(t,this.bf,this.$f,Zh,t=>{this.bf=t})}Qf(t,i,e,r,s){if(0!==i.length){var n=i.map(t=>t.record);s([]);var o=vs(n,ds(e,h.LIB_NAME,h.LIB_VERSION),r,h.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Zf(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}Zf(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Ef(){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!=oi&&null!=(t=oi.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?ir(oi.location.href):oi.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=ys("[metrics]")}initialize(){}Rf(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Cf&&this.Af===e||(null==(i=this.Cf)||i.reset(),this.Af=e,this.Cf=new gs(this.If(),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.Cf}count(t,i,e){void 0===i&&(i=1),this.Rf().count(t,i,e)}gauge(t,i,e){this.Rf().gauge(t,i,e)}histogram(t,i,e){this.Rf().histogram(t,i,e)}flush(t){if(!this.Cf)return Promise.resolve();if(t){var i=this.Cf.drainWindow();return i&&this.js(i,t),Promise.resolve()}return this.Cf.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var t;null==(t=this.Cf)||t.reset()}If(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},js:t=>i.js(t),getLibraryId:()=>h.LIB_NAME,getLibraryVersion:()=>h.LIB_VERSION}}js(t,i){return new Promise(e=>{var r=!1,n=t=>{r||(r=!0,clearTimeout(o),e(t))},o=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(s({method:"POST",url:this.Kf(),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)})}}))})}Kf(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}});Wl.__defaultExtensionClasses=s({},cu);var fu=ys("[ExternalScriptsLoader]"),pu=t=>{var i=null==Xt?void 0:Xt.querySelectorAll("script");if(i)for(var e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},_u=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return fu.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var r=pu(i);if(r){if(r.__posthog_loading_callback_fired)return e();var s=r.__posthog_loading_error;return s?e(s):(r.addEventListener("load",t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)}),void r.addEventListener("error",t=>{r.__posthog_loading_error=t,e(t)}))}var n=()=>{if(!Xt)return e("document not found");if(pu(i))return _u(t,i,e);var r=Xt.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=i,r.onload=t=>{r.__posthog_loading_callback_fired=!0,e(void 0,t)},r.onerror=t=>{r.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return e("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)Xt.head.appendChild(r);else{var s,n=Xt.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):Xt.body.appendChild(r)}};null!=Xt&&Xt.body?n():null==Xt||Xt.addEventListener("DOMContentLoaded",n)},gu={},mu=(t,i)=>{var e="/static/"+i+".js?v="+t.version;if("toolbar"===i){var r=3e5;e=e+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",e)};oi.__PosthogExtensions__=oi.__PosthogExtensions__||{},oi.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"!==i){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+i+".js"),n=gu[s];if("fallback"===r&&n){if(pu(n))return void _u(t,n,e);delete gu[s]}_u(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)e(r);else{var o,a=mu(t,i);gu[s]=a;var l=pu(s);null==l||null==(o=l.parentNode)||o.removeChild(l),_u(t,a,e)}else e(void 0,n)}:e)}else _u(t,mu(t,i),e)}else _u(t,t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js"),e)},oi.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{_u(t,t.requestRouter.endpointFor("api",i),e)};var bu=function(){h.SDK_DIST_CHANNEL="npm";var t=Rl[jl]=new Wl;return function(){function t(){t.done||(t.done=!0,Bl=!1,Ss(Rl,function(t){t._dom_loaded()}))}null!=Xt&&Xt.addEventListener?"complete"===Xt.readyState?t():Os(Xt,"DOMContentLoaded",t,{capture:!1}):Kt&&bs.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=Uo,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},exports.DisplaySurveyType=Wo,exports.PostHog=Wl,exports.ProductTourEventName=Ko,exports.ProductTourEventProperties=Jo,exports.SurveyEventName=qo,exports.SurveyEventProperties=Vo,exports.SurveyEventType=zo,exports.SurveyPosition={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},exports.SurveyQuestionBranchingType={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},exports.SurveyQuestionType={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},exports.SurveySchedule={Once:"once",Recurring:"recurring",Always:"always"},exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=Ho,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=bu,exports.posthog=bu,exports.severityLevels=["fatal","error","warning","log","info","debug"];
2
2
  //# sourceMappingURL=main.js.map