posthog-js 1.444.4 → 1.445.0

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 (40) hide show
  1. package/dist/all-external-dependencies.js +1 -1
  2. package/dist/array.full.es5.js +1 -1
  3. package/dist/array.full.js +1 -1
  4. package/dist/array.full.no-external.js +1 -1
  5. package/dist/array.js +1 -1
  6. package/dist/array.no-external.js +1 -1
  7. package/dist/customizations.full.js +1 -1
  8. package/dist/customizations.js +1 -1
  9. package/dist/default-extensions.js +1 -1
  10. package/dist/extension-bundles.js +1 -1
  11. package/dist/integrity.json +52 -0
  12. package/dist/lazy-recorder.js +1 -1
  13. package/dist/loader-bootstrap.js +1 -1
  14. package/dist/loader-bootstrap.js.map +1 -1
  15. package/dist/loader.js +1 -1
  16. package/dist/loader.js.map +1 -1
  17. package/dist/main.js +1 -1
  18. package/dist/module.full.cjs +1 -1
  19. package/dist/module.full.js +1 -1
  20. package/dist/module.full.no-external.cjs +1 -1
  21. package/dist/module.full.no-external.js +1 -1
  22. package/dist/module.js +1 -1
  23. package/dist/module.mjs +1 -1
  24. package/dist/module.no-external.cjs +1 -1
  25. package/dist/module.no-external.js +1 -1
  26. package/dist/module.slim.js +1 -1
  27. package/dist/module.slim.no-external.js +1 -1
  28. package/dist/posthog-recorder.js +1 -1
  29. package/dist/src/utils/loader-script.d.ts +1 -0
  30. package/dist/surveys-preview.js +1 -1
  31. package/dist/surveys.js +1 -1
  32. package/lib/package.json +2 -2
  33. package/lib/src/entrypoints/loader-bootstrap.js +9 -0
  34. package/lib/src/entrypoints/loader-bootstrap.js.map +1 -1
  35. package/lib/src/entrypoints/loader.js +8 -0
  36. package/lib/src/entrypoints/loader.js.map +1 -1
  37. package/lib/src/utils/loader-script.d.ts +1 -0
  38. package/lib/src/utils/loader-script.js +10 -0
  39. package/lib/src/utils/loader-script.js.map +1 -1
  40. package/package.json +6 -6
package/dist/main.js CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="0.10.4",i={DEBUG:(!1,!1),LIB_VERSION:(t,"1.444.4"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:t};var e=i;const s="$early_access_features",n="$active_feature_flags",r="$feature_flag_details",o="$feature_flag_errors",l="$feature_flag_evaluated_at",a="$feature_flag_request_id",u="$minimal_flag_called_events",h="$enabled_feature_flags",c="$stored_group_properties",d="$stored_person_properties",v="$flag_call_reported",f="$flag_call_reported_session_id",p="$feature_flag_payloads",g="$override_feature_flags",_="$override_feature_flag_payloads",m="visibilitychange",y="$autocapture_disabled_server_side",b="$surveys",w="$surveys_loaded_at",x="PostHog loadExternalDependency extension not found.",S="$surveys_activated",E="$surveys_activated_session",k="$surveys_activated_timestamps",T="$people_distinct_id",P="distinct_id",O="$device_id",R="$device_model",A="__alias",C="__cmpns",I="$fbc",M="$fbc_persistence",F="$fbp",D="$fbp_persistence",N="__timers",L="$heatmaps_enabled_server_side",j="$exception_capture_enabled_server_side",U="$error_tracking_suppression_rules",B="$error_tracking_capture_extension_exceptions",z="$web_vitals_enabled_server_side",H="$dead_clicks_enabled_server_side",q="$product_tours_enabled_server_side",W="$logs_capture_enabled_server_side",V="$web_vitals_allowed_metrics",G="$session_recording_remote_config",K="$session_recording_enabled_server_side",Y="$replay_sample_rate",J="$replay_override_sampling",X="$replay_override_linked_flag",Z="$replay_override_url_trigger",Q="$replay_override_event_trigger",tt="$sesid",it="$session_is_sampled",et="$session_past_minimum_duration",st="$session_recording_url_trigger_activated_session",nt="$session_recording_event_trigger_activated_session",rt="$debug_first_full_snapshot_timestamp",ot="$sess_rec_flush_size",lt="$groups",at="ph_product_tours",ut="$product_tours_activated",ht="$product_tours_activated_session",ct="$conversations_widget_session_id",dt="$conversations_ticket_id",vt="$conversations_widget_state",ft="$conversations_user_traits",pt="$user_state",gt="$client_session_props",_t="$capture_rate_limit",mt="$initial_campaign_params",yt="$initial_referrer_info",bt="$initial_person_info",wt="$epp",$t="$posthog_cookieless",xt="$cookieless_mode",St="$sdk_debug_extensions_init_method",Et="$sdk_debug_extensions_init_time_ms",kt="$sdk_debug_recording_script_not_loaded",Tt="$sdk_debug_replay_stale_config",Pt="$sdk_debug_replay_event_trigger_status",Ot="$sdk_debug_replay_linked_flag_trigger_status",Rt="$sdk_debug_replay_matched_recording_trigger_groups",At="$sdk_debug_replay_pending_trigger_conditions",Ct="$sdk_debug_replay_remote_trigger_matching_config",It="$sdk_debug_replay_trigger_groups_count",Mt="$sdk_debug_replay_url_trigger_status",Ft="$session_recording_start_reason",Dt="anonymous",Nt="identified",Lt="identified_only",jt="beforeunload",Ut="$pageview",Bt="$pageleave",zt="$identify",Ht="$groupidentify",qt="u">typeof window?window:void 0,Wt="u">typeof globalThis?globalThis:qt,Vt=null==Wt?void 0:Wt.navigator,Gt=null==Wt?void 0:Wt.document,Kt=null==Wt?void 0:Wt.location,Yt=null==Wt?void 0:Wt.fetch,Jt=(null==Wt?void 0:Wt.XMLHttpRequest)&&"withCredentials"in new Wt.XMLHttpRequest?Wt.XMLHttpRequest:void 0,Xt=null==Wt?void 0:Wt.AbortController,Zt=null==Wt?void 0:Wt.CompressionStream,Qt=null==Vt?void 0:Vt.userAgent,ti="undefined"!=typeof globalThis?globalThis:qt;ti&&"undefined"==typeof self&&(ti.self=ti),ti&&"undefined"==typeof File&&(ti.File=function(){});const ii=null!=qt?qt:{};var ei=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),si=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const ni=["$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"],ri=["token"];function oi(t,i){return-1!==t.indexOf(i)}const li=function(t){return t.trim()},ai=function(t){return t.replace(/^\$/,"")};function ui(t){var i;const e=[];return null!==(i=JSON.stringify(t,function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(e.includes(i))return"[Circular]";e.push(i)}return i}}))&&void 0!==i?i:"null"}const hi=Object.prototype,ci=hi.hasOwnProperty,di=hi.toString,vi=Array.isArray||function(t){return"[object Array]"===di.call(t)},fi=t=>"function"==typeof t,pi=t=>t===Object(t)&&!vi(t),gi=t=>{if(pi(t)){for(const i in t)if(ci.call(t,i))return!1;return!0}return!1},_i=t=>void 0===t,mi=t=>"[object String]"==di.call(t),yi=t=>mi(t)&&0===t.trim().length,bi=t=>null===t,wi=t=>_i(t)||bi(t),$i=t=>"[object Number]"==di.call(t)&&t==t,xi=t=>$i(t)&&t>0,Si=t=>"[object Boolean]"===di.call(t),Ei=t=>oi(ni,t),ki=t=>oi(ri,t);function Ti(t){return null===t||"object"!=typeof t}function Pi(t,i){return{}.toString.call(t)===`[object ${i}]`}function Oi(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 Ai(t,Error)}}function Ri(t){return"u">typeof Event&&Ai(t,Event)}function Ai(t,i){try{return t instanceof i}catch(t){return!1}}const Ci=[!0,"true",1,"1","yes"],Ii=t=>oi(Ci,t),Mi=[!1,"false",0,"0","no"];function Fi(t,i,e,s,n,r,o){try{var l=t[r](o),a=l.value}catch(t){return void e(t)}l.done?i(a):Promise.resolve(a).then(s,n)}function Di(t){return function(){var i=this,e=arguments;return new Promise(function(s,n){var r=t.apply(i,e);function o(t){Fi(r,s,n,o,l,"next",t)}function l(t){Fi(r,s,n,o,l,"throw",t)}o(void 0)})}}const Ni=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","lightpanda","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Li=new Map,ji=function(t,i=[]){if(!t)return!1;const e=function(t,i){let e="";for(let t=0;i.length>t;t++){const s=i[t];e+=s.length+":"+s}return t.length+":"+t+"|"+i.length+":"+e}(t,i),s=Li.get(e);if(void 0!==s)return s;const n=t.toLowerCase(),r=Ni.concat(i).some(t=>-1!==n.indexOf(t.toLowerCase()));return 256>Li.size||Li.clear(),Li.set(e,r),r};function Ui(t,i,e,s,n){return i>e&&(s.warn("min cannot be greater than max."),i=e),$i(t)?t>e?(s.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(s.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(s.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+n),Ui(null!=n?n:e,i,e,s))}var Bi=class{constructor(t){this.C={},this.I=t.I,this.R=Ui(t.bucketSize,0,100,t.A),this.O=Ui(t.refillRate,0,this.R,t.A),this.$=Ui(t.refillInterval,0,864e5,t.A)}F(t,i){const e=Math.floor((i-t.lastAccess)/this.$);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.R),t.lastAccess=t.lastAccess+e*this.$)}consumeRateLimit(t){var i;const e=Date.now(),s=String(t);let n=this.C[s];return n?this.F(n,e):(n={tokens:this.R,lastAccess:e},this.C[s]=n),0===n.tokens||(n.tokens--,0===n.tokens&&(null===(i=this.I)||void 0===i||i.call(this,t)),0===n.tokens)}stop(){this.C={}}};const zi="Mobile",Hi="Android",qi="Tablet",Wi="Android Tablet",Vi="iPad",Gi="Apple Watch",Ki="Safari",Yi="BlackBerry",Ji="Samsung Internet",Xi="Chrome",Zi="Chrome iOS",Qi="Internet Explorer",te="Internet Explorer Mobile",ie="Opera",ee="Microsoft Edge",se="Firefox",ne="Firefox iOS",re="Nintendo",oe="PlayStation",le="Xbox",ae="Android Mobile",ue="Mobile Safari",he="Windows",ce="Windows Phone",de="Nokia",ve="Ouya",fe="Generic "+zi.toLowerCase(),pe="Generic "+qi.toLowerCase(),ge="Konqueror",_e="Oculus Browser",me="Vivaldi",ye="Yandex",be="Whale",we="DuckDuckGo",$e="Pale Moon",xe="Waterfox",Se="Brave",Ee="Claude",ke="Codex",Te="ChatGPT",Pe="Google Search App",Oe=new RegExp("Version/(\\d+(\\.\\d+)?)"),Re=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ae=new RegExp(le,"i"),Ce=new RegExp("PlayStation \\w+","i"),Ie=new RegExp("Nintendo \\w+","i"),Me=new RegExp("BlackBerry|PlayBook|BB10","i"),Fe={"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"},De=function(t,i,e,s){i=i||"";const n=function(t){return(null==t?void 0:t.brave)?Se:null}(e);return n||((null==s?void 0:s.detectGoogleSearchApp)&&oi(t,"GSA/")?Pe:oi(t," OPR/")&&oi(t,"Mini")?"Opera Mini":oi(t," OPR/")?ie:Me.test(t)?Yi:oi(t,"IEMobile")||oi(t,"WPDesktop")?te:oi(t,"OculusBrowser")?_e:oi(t,"SamsungBrowser")?Ji:oi(t,"Edge")||oi(t,"Edg/")?ee:oi(t,"Vivaldi/")?me:oi(t,"YaBrowser/")?ye:oi(t,"Whale/")?be:oi(t,"DuckDuckGo/")||oi(t,"Ddg/")?we:oi(t,"Claude/")?Ee:oi(t,"Codex/")?ke:oi(t,"ChatGPT/")?Te:oi(t,"FBIOS")?"Facebook Mobile":oi(t,"UCWEB")||oi(t,"UCBrowser")?"UC Browser":oi(t,"CriOS")?Zi:oi(t,"CrMo")||oi(t,Xi)?Xi:oi(t,Hi)&&oi(t,Ki)?ae:oi(t,"FxiOS")?ne:oi(t.toLowerCase(),ge.toLowerCase())?ge:oi(t,"Brave/")?Se:((t,i)=>i&&oi(i,"Apple")||function(t){return oi(t,Ki)&&!oi(t,Xi)&&!oi(t,Hi)}(t))(t,i)?oi(t,zi)?ue:Ki:oi(t,"PaleMoon/")?$e:oi(t,"Waterfox/")?xe:oi(t,se)?se:oi(t,"MSIE")||oi(t,"Trident/")?Qi:oi(t,"Gecko")?se:"")},Ne={[te]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[ee]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Xi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Zi]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Ki]:[Oe],[ue]:[Oe],[ie]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[se]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[ne]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[ge]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Yi]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Oe],[ae]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Ji]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[_e]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[me]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[ye]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[be]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Se]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ee]:[Re],[ke]:[Re],[Te]:[Re],[we]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[$e]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[xe]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Pe]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Qi]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Le=function(t,i,e,s){const n=De(t,i,e,s),r=Ne[n];if(_i(r))return null;for(let i=0;r.length>i;i++){const e=t.match(r[i]);if(e)return parseFloat(e[e.length-2])}return null},je=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[le,t&&t[1]||""]],[new RegExp(re,"i"),[re,""]],[new RegExp(oe,"i"),[oe,""]],[Me,[Yi,""]],[new RegExp(he,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[ce,""];if(new RegExp(zi).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];const e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){let t=Fe[e[1]]||"";return/arm/i.test(i)&&(t="RT"),[he,t]}return[he,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let i="";return t&&t.length>=3&&(i=_i(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Hi,[t[2],t[3],t[4]||"0"].join(".")]:[Hi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Ue=function(t){for(let i=0;je.length>i;i++){const[e,s]=je[i],n=e.exec(t),r=n&&(fi(s)?s(n,t):s);if(r)return r}return["",""]},Be=function(t){return Ie.test(t)?re:Ce.test(t)?oe:Ae.test(t)?le:new RegExp(ve,"i").test(t)?ve:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?ce:/iPad/.test(t)?Vi:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Gi:Me.test(t)?Yi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(de,"i").test(t)?de:/(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(zi).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)?Hi:Wi:new RegExp("(pda|Mobile)","i").test(t)?fe:new RegExp(qi,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?pe:""},ze=function(t,i){var e;const s=Be(t);return s===Vi||s===Wi||"Kobo"===s||"Kindle Fire"===s||s===pe?qi:s===re||s===le||s===oe||s===ve?"Console":s===Gi?"Wearable":s?zi:"Android"===(null==i?void 0:i.userAgentDataPlatform)&&(null!==(e=null==i?void 0:i.maxTouchPoints)&&void 0!==e?e:0)>0?600>Math.min(null!==(n=null==i?void 0:i.screenWidth)&&void 0!==n?n:0,null!==(r=null==i?void 0:i.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==i?void 0:i.devicePixelRatio)&&void 0!==o?o:1)?zi:qi:"Desktop";var n,r,o},He=/\bFBAV\/(\d+(?:\.\d+)*)/i,qe=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",He],[/\bFBAN\/EMA\b/i,"Facebook Lite",He],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",He],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],We="[Truncated]",Ve="[Unserializable]";function Ge(t){let i="";for(let e=0;t.length>e;e++){const s=t.charCodeAt(e);if(55296>s||s>56319)i+=56320>s||s>57343?t[e]:"�";else{const s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}function Ke(t,i){if(!i)return t;let e=[];try{e=Object.keys(i)}catch(t){e=[]}for(const s of e){let e;try{e=i[s]}catch(t){e=Ve}Object.defineProperty(t,s,{value:e,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const Ye=3e5;var Je=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const i=this.isOpen(),e=Date.now(),s=Math.min(t.retryAfterMs,Ye);if(!i)return this.ts=e,void(this.es=e+s);this.es=Math.max(this.es,Math.min(e+s,this.ts+Ye))}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const i=Math.min(Ye,Math.max(0,this.es-t));return 0===i&&this.reset(),i}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const Xe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ze(t,i){return"string"==typeof(e=t)&&Xe.test(e)?t:i();var e}function Qe(t,i){const e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function ts(t){return t?t.split("#")[0]:t}function is(t){try{return t()}catch(t){return}}function es(t,i){const e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function ss(t,i,e){return ns.apply(this,arguments)}function ns(){return(ns=Di(function*(t,i,e){let s;try{return yield Promise.race([t,new Promise((t,n)=>{s=es(()=>{try{null==e||e(),t()}catch(t){n(t)}},i)})])}finally{clearTimeout(s)}})).apply(this,arguments)}function rs(t){return rs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rs(t)}function os(t,i,e){return(i=function(t){var i=function(t){if("object"!=rs(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var e=i.call(t,"string");if("object"!=rs(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==rs(i)?i:i+""}(i))in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function ls(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),e.push.apply(e,s)}return e}function as(t){for(var i=1;arguments.length>i;i++){var e=null!=arguments[i]?arguments[i]:{};i%2?ls(Object(e),!0).forEach(function(i){os(t,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ls(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})}return t}let us,hs,cs,ds;function vs(t){var i;const e=globalThis._posthogChunkIds,s=globalThis._debugIds;if(!e&&!s)return;const n=e?Object.keys(e):[],r=s?Object.keys(s):[];if(ds&&fs(e,n,hs)&&fs(s,r,cs))return ds;hs=e?as({},e):void 0,cs=s?as({},s):void 0,ds={},null!==(i=us)&&void 0!==i||(us={});const o=(i,e)=>{for(const n of i){const i=e[n];if(!i)continue;const r=null==us?void 0:us[n];if(r){ds[r]=i;continue}const o=t(n);for(let t=o.length-1;t>=0;t--){var s;const e=null===(s=o[t])||void 0===s?void 0:s.filename;if(e){ds[e]=i,us[n]=e;break}}}};return s&&o(r,s),e&&o(n,e),ds}function fs(t,i,e){return t&&e?i.length===Object.keys(e).length&&i.every(i=>t[i]===e[i]):t===e}var ps=class{constructor(t,i,e=[]){this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i={}){const e=i&&i.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(e,i,0).apply(t),n=this.buildParsingContext(i),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,e),$exception_level:"error"}}modifyFrames(t){var i=this;return Di(function*(){for(const e of t)e.stacktrace&&e.stacktrace.frames&&vi(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t})()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e;let s,n;if(null!=t.cause&&(s=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack)try{n=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)}catch(t){}return as(as({},t),{},{cause:s,stack:n,errors:null===(e=t.errors)||void 0===e?void 0:e.map(t=>this.parseStacktrace(t,i))})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(const e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return Di(function*(){let e=t;for(const t of i.modifiers)e=yield t(e);return e})()}convertToExceptionList(t,i){const e=[],s=(t,n,r)=>{var o;const l=e.length,a=void 0===n?as(as({type:"string"==typeof i.type&&i.type.length>0?i.type:"generic"},"boolean"==typeof i.handled?{handled:i.handled}:void 0===i.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof i.synthetic?i.synthetic:t.synthetic,exception_id:l}):{type:"chained",source:r,synthetic:t.synthetic,exception_id:l,parent_id:n},u={type:t.type,value:t.value,mechanism:a};t.stack&&(u.stacktrace={type:"raw",frames:t.stack}),e.push(u),t.cause&&s(t.cause,l,"cause");for(const i of null!==(o=t.errors)&&void 0!==o?o:[])s(i,l,"member")};return s(t),e}buildParsingContext(t){var i;return{chunkIdMap:vs(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}getAggregateErrors(t){try{if(Oi(t)){let e=Object.getPrototypeOf(t);for(let s=0;e&&100>s;s++){var i;const s=null===(i=Object.getOwnPropertyDescriptor(e,"constructor"))||void 0===i?void 0:i.value;if("function"==typeof s&&"AggregateError"===s.name){const i=t.errors;return vi(i)?i:void 0}e=Object.getPrototypeOf(e)}}}catch(t){}}buildCoercingContext(t,i,e=0){let s=0,n=0,r=!1;const o=new Set,l=[],a={},u=(t,i,e=0)=>{const u=h(i,e),c=u.apply;if(u.apply=i=>{l.push(t);try{return c(i)}finally{l.pop()}},e>4||e>0&&-1!==l.indexOf(t))return this.coerceFallback(u);const d="object"==typeof t&&null!==t||"function"==typeof t;if(0===e&&s>=50||d&&o.has(t))return;d&&o.add(t),0===e&&s++;const v=this.getAggregateErrors(t);let f,p;r||(r=!!v);try{if(f=this.applyCoercers(t,u),!f)throw a}catch(t){if(t===a)return void(0===e&&s--);if(!r)throw t;f=this.coerceFallback(u)}if(!v||s>=50)return f;try{p=v.length}catch(t){return f}if(!Number.isInteger(p)||0>p||p>4294967295)return f;const g=[];for(let t=0;50>s&&1e3>n&&p>t;t++){let e;n++;try{e=u.next(v[t])}catch(t){s++,e=this.coerceFallback(h(i+1))}e&&g.push(e)}return as(as({},f),{},{errors:g})},h=(e,s=0)=>as(as({},i),{},{syntheticException:0==e?i.syntheticException:void 0,mechanism:0==e?t:{},apply(t){const i=u(t,e,s+1);if(!i)throw a;return i},next:t=>u(t,e+1)}),c=h(e);return as(as({},c),{},{apply:t=>{var i;return null!==(i=u(t,e))&&void 0!==i?i:this.coerceFallback(c)}})}};const gs=/^([a-z][a-z0-9.+-]+):/i,_s=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function ms(t){if(!t||"<anonymous>"===t)return!1;const i=gs.exec(t);return!i||_s.includes(i[1].toLowerCase())}function ys(t,i,e,s,n){const r={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:ms(i)};return _i(s)||(r.lineno=s),_i(n)||(r.colno=n),r}const bs=(t,i)=>{const e=-1!==t.indexOf("safari-extension"),s=-1!==t.indexOf("safari-web-extension");return e||s?[-1!==t.indexOf("@")?t.split("@")[0]:"?",e?`safari-extension:${i}`:`safari-web-extension:${i}`]:[t,i]},ws=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,$s=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,xs=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ss=(t,i)=>{const e=ws.exec(t);if(e){const[,t,s,n]=e;return ys(i,t,"?",+s,+n)}const s=$s.exec(t);if(s){if(s[2]&&0===s[2].indexOf("eval")){const t=xs.exec(s[2]);t&&(s[2]=t[1],s[3]=t[2],s[4]=t[3])}const[t,e]=bs(s[1]||"?",s[2]);return ys(i,e,t,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},Es=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ks=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ts=(t,i)=>{const e=Es.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=ks.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}let t=e[3],s=e[1]||"?";return[s,t]=bs(s,t),ys(i,t,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Ps=/\(error: (.*)\)/;function Os(t,i){return t.filename===i.filename&&t.function===i.function&&t.module===i.module&&t.lineno===i.lineno&&t.colno===i.colno}function Rs(t){for(let i=1;10>=i;i++){const e=t.length-2*i;if(0>e)break;let s=!0;for(let n=0;i>n;n++)if(!Os(t[e+n],t[e+i+n])){s=!1;break}if(s){for(let s=0;i>s;s++)t[e+s]=t[e+i+s];return t.length=e+i,{start:e,length:i}}}}function As(t,i){const e=i.start+i.length,s=Is(t,i);s&&t.splice(e+s===t.length?e:i.start,s)}function Cs(t,i){let e=i.start;for(;e>0&&Os(t[e-1],t[e-1+i.length]);)e--;return i.start-e}function Is(t,i){const e=i.start+i.length;let s=e;for(;t.length>s&&Os(t[s],t[s-i.length]);)s++;return s-e}function Ms(t,i){const e=i[0];let s=t.length-(e?Cs(t,e):0);for(const e of i)s-=Is(t,e);return s}function Fs(t,i,e){for(let s=0;t.length>s;s++){const n=t[(i+s)%t.length],r=t[(e+s)%t.length];if(n!==r)return r>n}return!1}var Ds=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){const e=mi(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){const i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${i}: ${t.message}`:i}isDOMException(t){return Pi(t,"DOMException")}isDOMError(t){return Pi(t,"DOMError")}},Ns=class{match(t){return Oi(t)}coerce(t,i){var e;const s=this.getStack(t),n=void 0===s?null===(e=i.syntheticException)||void 0===e?void 0:e.stack:void 0,r=!!n;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=s?s:n,cause:t.cause?i.next(t.cause):void 0,synthetic:r}}getType(t){return t.name||t.constructor.name}getMessage(t,i){const e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){try{const i=t.stacktrace;if("string"==typeof i&&i.length>0)return i;const e=t.stack;return"string"==typeof e&&e.length>0?e:void 0}catch(t){return}}},Ls=class{match(t){return!!Pi(t,"ErrorEvent")&&(null!=t.error||this.mr(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);const s=i.apply(t.message);return as(as({},s),{},{stack:null!==(e=this.gr(t))&&void 0!==e?e:s.stack,synthetic:!0})}mr(t){return mi(t.message)&&t.message.length>0}gr(t){var i,e;const s=t,n=null!==(i=s.lineno)&&void 0!==i?i:0,r=null!==(e=s.colno)&&void 0!==e?e:0;if(mi(s.filename)&&0!==s.filename.length&&0!==n)return`Error\n at ${s.filename}:${n}:${r}`}};const js=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Us=class{match(t){return"string"==typeof t}coerce(t,i){var e;const[s,n]=this.getInfos(t);return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}getInfos(t){let i="Error",e=t;const s=t.match(js);return s&&(i=s[1],e=s[2]),[i,e]}};const Bs=["fatal","error","warning","log","info","debug"];function zs(t,i=40){const e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(let t=e.length;t>0;t--){const s=e.slice(0,t).join(", ");if(i>=s.length)return t===e.length?s:s.length>i?`${s.slice(0,i)}...`:s}return""}var Hs=class{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,s;const n=this.getErrorPropertyFromObject(t);return n?i.apply(n):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null===(s=i.syntheticException)||void 0===s?void 0:s.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Ri(t))return t.constructor.name;const i="name"in t?t.name:void 0;return mi(i)&&!yi(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){let i=`'${t.name}' captured as exception`;return"message"in t&&"string"==typeof t.message&&(i+=` with message: '${t.message}'`),i}if("message"in t&&"string"==typeof t.message)return t.message;const i=this.getObjectClassName(t);return`${i&&"Object"!==i?`'${i}'`:"Object"} captured as exception with keys: ${zs(t)}`}isSeverityLevel(t){return mi(t)&&!yi(t)&&Bs.indexOf(t)>=0}getStack(t){try{return mi(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:mi(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(const i in t)if({}.hasOwnProperty.call(t,i)){const e=t[i];if(Oi(e))return e}}getObjectClassName(t){try{const i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},qs=class{match(t){return Ri(t)}coerce(t,i){var e;const s=t.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${zs(t)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}},Ws=class{match(t){return Ti(t)}coerce(t,i){var e;return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}},Vs=class{match(t){return Pi(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Ri(t))return!1;try{const i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e;const s=this.getUnhandledRejectionReason(t);return Ti(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}:i.apply(s)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}};const Gs="$message",Ks="$timestamp",Ys=new Set([Gs,Ks]),Js={enabled:!0,max_bytes:32768};function Xs(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Js.enabled,max_bytes:Qs(t.max_bytes,Js.max_bytes)}:as({},Js)}var Zs=class{constructor(t){this.ns=[],this.ss=0,this.Dr=Xs(t)}setConfig(t){this.Dr=Xs(t),this.rs()}add(t){const i=function(t){let i;try{i=ui(t)}catch(t){return}try{const t=JSON.parse(i);if(!pi(t))return;const e=t,s=e[Gs],n=e[Ks];if(!mi(s)||0===s.trim().length)return;if(!mi(n)&&!$i(n))return;return{step:e,json:i}}catch(t){return}}(t);if(!i)return;const e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;const i=encodeURIComponent(t);let e=0;for(let t=0;i.length>t;t++)"%"===i[t]?(e+=1,t+=2):e+=1;return e}(i.json);e>this.Dr.max_bytes||(this.ns.push({step:i.step,bytes:e}),this.ss+=e,this.rs())}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Dr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function Qs(t,i){if(!$i(t)||1/0===t||-1/0===t)return i;const e=Math.floor(t);return 0>e?i:e}const tn=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function en(t){return"string"==typeof t||t}function sn(t){return"string"==typeof t?t:void 0}const nn=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],rn="NativeGzipValidationError",on=t=>t.length>=2&&31===t[0]&&139===t[1],ln=(t,i)=>t===si.GZipJS||i===si.GZipJS||"gzip"===i,an=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):"");let un;const hn=t=>{throw Qe(rn,`Native gzip produced invalid output: ${t}`)},cn=function(){var t=Di(function*(t,i){18>t.size&&hn("too-short");const e=new Uint8Array(yield t.slice(0,10).arrayBuffer());on(e)&&8===e[2]||hn("invalid-header");const s=new DataView(yield t.slice(t.size-8).arrayBuffer());s.getUint32(0,!0)!==(t=>{const i=(()=>{if(un)return un;un=[];for(let t=0;256>t;t++){let i=t;for(let t=0;8>t;t++)i=1&i?3988292384^i>>>1:i>>>1;un[t]=i>>>0}return un})();let e=4294967295;for(let s=0;t.length>s;s++)e=i[255&(e^t[s])]^e>>>8;return(4294967295^e)>>>0})(i)&&hn("invalid-crc");const n=i.length>>>0;s.getUint32(4,!0)!==n&&hn("invalid-size")});return function(i,e){return t.apply(this,arguments)}}();function dn(){return dn=Di(function*(t,i=!0,e){try{const i=(new TextEncoder).encode(t),e=new globalThis.CompressionStream("gzip"),n=e.writable.getWriter(),r=n.write(i).then(()=>n.close()).catch((s=Di(function*(t){try{yield n.abort(t)}catch(t){}throw t}),function(t){return s.apply(this,arguments)})),o=new Response(e.readable).blob(),[l]=yield Promise.all([o,r]);return yield cn(l,i),l}catch(t){if(null==e?void 0:e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}var s}),dn.apply(this,arguments)}function vn(t,i){if(null==t)return{};var e,s,n=function(t,i){if(null==t)return{};var e={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(i.includes(s))continue;e[s]=t[s]}return e}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;r.length>s;s++)i.includes(e=r[s])||{}.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}const fn="[redacted]",pn=/^[A-Za-z0-9+/\n\r]+=*$/,gn=/^[A-Za-z0-9_-]+={0,2}$/,_n=/[-_]/,mn=/^data:[^,\s]*;base64,/i,yn=/^[A-Za-z0-9+/_-]+={0,2}$/,bn=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,wn=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,$n=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,xn=/[\s<>"]/,Sn=new RegExp($n.source,"i"),En=/[a-z][a-z0-9+.-]{0,63}:\/\//i,kn=new RegExp(`^${En.source}`,"i"),Tn=new RegExp(En.source,"gi"),Pn=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,On=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,Rn=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,An=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,Cn=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,In=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,Mn=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,Fn=/\b\d(?:[ ./-]?\d){12,}\b/g,Dn=/\d+/g,Nn=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,Ln=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function jn(t){return function(t){return wn.test(t)}(t)||Pn.test(t)||On.test(t)}function Un(t){return t.split("&",129).length>128}function Bn(t,i,e){return jn(t)||i.includes(";")&&function(t){return t.split(";").some(t=>jn(t.split("=",1)[0]))}(i)?fn:Sn.test(i)?e?Gn(i,{allowNestedUrls:!1,stripPunctuation:!0}):fn:i}function zn(t,i){const e=new URLSearchParams;let s=!1,n=!1;for(const[r,o]of new URLSearchParams(t)){const t=Kn(r),l=Kn(o);s||(s=t!==r||l!==o);const a=Bn(t,l,i);s||(s=a!==l),n=jn(t)||a!==l,e.append(t,a)}return{changed:s,lastFieldSensitive:n,serialized:e.toString()}}function Hn(t,i){if(!t.includes("="))return{value:qn(t,i),lastFieldSensitive:!1};const e=zn(t,i);return{value:e.changed?e.serialized:t,lastFieldSensitive:e.lastFieldSensitive}}function qn(t,i){return i?Gn(t,{allowNestedUrls:!1,stripPunctuation:!0}):Sn.test(t)?fn:t}function Wn(t,i,e){return"#"===t?!i.fragment&&(i.fragment=!0):"?"===t&&(i.fragment?"="!==e&&!i.fragmentQuery&&(i.fragmentQuery=!0):!i.query&&(i.query=!0))}function Vn(t,i){var e;if(t.length>8192&&kn.test(t))return fn;const{address:s,suffix:n}=i.stripPunctuation?function(t){let i=t.length;for(;i>0&&".,;:!?)]}'".includes(t[i-1]);)i--;return{address:t.slice(0,i),suffix:t.slice(i)}}(t):{address:t,suffix:""};let r;try{r=new URL(s)}catch(t){return fn+n}const o=r.search.slice(1),l=""!==r.hash,a=function(t){const i=t.slice(1),e=i.indexOf("?");return 0>e?{head:i,tail:null}:{head:i.slice(0,e),tail:i.slice(e+1)}}(r.hash);if(Un(o)||Un(a.head)||Un(null!==(e=a.tail)&&void 0!==e?e:""))return fn+n;let u=!1;(r.username||r.password)&&(r.username=fn,r.password="",u=!0);const h=zn(o,i.allowNestedUrls);h.changed&&(r.search=h.serialized,u=!0);const c=Hn(a.head,i.allowNestedUrls),d=null===a.tail?null:(v=a.tail,c.lastFieldSensitive?{value:""===v?"":fn,lastFieldSensitive:!0}:Hn(v,i.allowNestedUrls));var v;const f=null===d?c.value:`${c.value}?${d.value}`;f!==r.hash.slice(1)&&(r.hash=f,u=!0);const p=l?null!=d?d:c:h;return(u?Kn(r.toString()):s)+(p.lastFieldSensitive?"":n)}function Gn(t,i){return t.replace($n,e=>function(t,i){const e=function(t){if(!t.includes("://"))return[];const i=[...t.matchAll(Tn)].map(t=>t.index),e=[],s={query:!1,fragment:!1,fragmentQuery:!1};let n=0,r=!1,o="";for(let l=0;t.length>l&&i.length>n;l++){i[n]===l&&(l>0&&"="!==o&&e.push(l),n++);const a=t[l];Wn(a,s,o)?(o=a,r=!0):r&&"=&".includes(a)&&(o=a)}return e}(t);if(0===e.length)return Vn(t,i);let s="",n=0;for(const r of e)s+=Vn(t.slice(n,r),as(as({},i),{},{stripPunctuation:!1})),n=r;return s+Vn(t.slice(n),i)}(e,as(as({},i),{},{stripPunctuation:i.stripPunctuation&&e.length!==t.length})))}function Kn(t){return t.replace(bn,fn)}function Yn(t,i){return function(t){return t.length>=10240&&(pn.test(t)||function(t){const i=mn.exec(t);if(!i)return!1;let e;try{e=decodeURIComponent(t.slice(i[0].length))}catch(t){return!1}return yn.test(e.replace(/[\r\n]/g,""))}(t)||_n.test(t)&&gn.test(t))}(t)?"[binary data redacted - not supported by PostHog MCP analytics]":function(t,i,e){const s=4*e.maxStringLength;if(t.length>s){const n=i(t.slice(0,function(t,i){let e=i;for(;e>0&&!xn.test(t[e-1]);)e--;return e}(t,s)));if(n.length>=2*e.maxStringLength)return n+e.truncationSuffix}return i(t)}(t,t=>function(t){return Gn(t,{allowNestedUrls:!0,stripPunctuation:!0})}(function(t){let i=t.replace(Rn," ");return i=i.replace(An,fn),i=i.replace(Cn,fn),i=i.replace(In,`$1${fn}`),i=i.replace(Fn,Xn),i=i.replace(Mn,fn),i=i.replace(Nn,`$1${fn}`),i=i.replace(Ln,`$1${fn}`),i}(Kn(t))),i)}function Jn(t){let i=0,e=!1;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;if(0>n||n>9)return!1;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e}return i%10==0}function Xn(t){const i=[];for(let e=Dn.exec(t);null!==e;e=Dn.exec(t))i.push({digits:e[0],start:e.index,end:e.index+e[0].length});let e="",s=0,n=0;for(;i.length>n;){let r="",o=-1;for(let t=n;i.length>t&&(r+=i[t].digits,19>=r.length);t++)r.length>=13&&Jn(r)&&(o=t);0>o?n++:(e+=t.slice(s,i[n].start)+fn,s=i[o].end,n=o+1)}return e+t.slice(s)}const Zn={}.propertyIsEnumerable;function Qn(t,i){try{return er(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function tr(t,i,e,s){if(0>=e.remainingNodes)return{stringValue:We};if(e.remainingNodes--,Si(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){const e=t.toString(),s=BigInt("9223372036854775808");return t>=s||-s>t?(null==i||i.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}(t,i);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const e=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==i||i.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:Ge(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:We};if(t instanceof Date){const i=t.getTime(),e=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:"string"==typeof e?Ge(e):String(e)}}e.ancestors.add(t);try{try{const n=t.toJSON;if("function"==typeof n)return tr(n.call(t),i,e,s+1)}catch(t){}return vi(t)?{arrayValue:{values:ir(t,i,e,s+1)}}:{kvlistValue:{values:er(t,i,e,s+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:Ge(String(t))}}function ir(t,i,e,s){const n=[],r=Math.min(t.length,1e3);let o=0;for(;r>o&&e.remainingNodes>0;o++)try{const r=o in t?t[o]:void 0;if(wi(r))continue;n.push(tr(r,i,e,s))}catch(t){n.push({stringValue:Ve})}return t.length>o&&n.push({stringValue:We}),n}function er(t,i,e,s){const n=[];for(const r in t)if(Zn.call(t,r)){if(!r){null==i||i.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=t[r];if(bi(o)||_i(o))continue;n.push({key:Ge(r),value:tr(o,i,e,s)})}catch(t){n.push({key:Ge(r),value:{stringValue:Ve}})}}return n}function sr(t,i,e){return as(as(as(as({},Ke({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}const nr=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function rr(t,i){const e=Ke({},t),s={};for(const t of nr)({}).hasOwnProperty.call(e,t)&&(s[t]=e[t],delete e[t]);return[...Qn(e,i),...Qn(s,i)]}const or={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"};const lr={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}},ar=lr.info;function ur(t){try{return Ge(String(t))}catch(t){return Ve}}function hr(t,i,e,s){const n=t.level||"info",{text:r,number:o}=lr[n]||ar,l=function(t=Date.now()){return String(t)+"000000"}($i(s)?s:void 0),a={};i.distinctId&&(a.posthogDistinctId=i.distinctId),i.sessionId&&(a.sessionId=i.sessionId),i.windowId&&(a["window.id"]=i.windowId),wi(i.sessionStartTimestamp)||(a.sessionStartTimestamp=String(i.sessionStartTimestamp)),wi(i.lastActivityTimestamp)||(a.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(a["url.full"]=i.currentUrl),i.screenName&&(a["screen.name"]=i.screenName),i.appState&&(a["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(a.feature_flags=i.activeFeatureFlags);const u=as({},a),h=t.attributes;if(h){let t=[];try{t=Object.keys(h)}catch(i){t=[]}for(const i of t){let t;try{t=h[i]}catch(i){t=Ve}Object.defineProperty(u,i,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const c={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:ur(t.body)},attributes:Qn(u,e)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),_i(t.trace_flags)||(c.flags=t.trace_flags),c}function cr(t,i,e){return sr(t,i,e)}function dr(t,i,e,s){return{resourceLogs:[{resource:{attributes:rr(i)},scopeLogs:[{scope:{name:e,version:s},logRecords:t}]}]}}var vr=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.cs}arm(t){this.clear(),this.us=Date.now()+t,this.cs=es(()=>{this.cs=void 0,this.ls()},t)}armNoEarlierThan(t){this.cs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function fr(){return.75+.5*Math.random()}function pr(t,i,e,s){const n=Math.min(Math.max(0,i-1),6),r=t*Math.pow(2,n);return Math.round((void 0===s?r:Math.min(r,Math.max(s,t)))*e)}var gr=class{constructor(t,i,e,s,n,r=()=>Promise.resolve(),o){var l;this._instance=t,this.Dr=i,this.A=e,this.hs=s,this.ds=n,this.vs=r,this.fs=o,this.ps=new vr(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Je,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=i.maxBufferSize,this.Is=Math.max(null!==(l=i.maxQueueSize)&&void 0!==l?l:i.maxBufferSize,i.maxBufferSize),this.Es=i.flushIntervalMs,this.Ms=i.maxBatchRecordsPerPost,this.As=i.rateCapWindowMs,this.Rs=i.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(ei.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Ms=this.Dr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.Ps()&&this.Os():this.gs()}captureLog(t,i){var e;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const s=this.Fs(t);if(null===s)return;if(!s.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;const n={record:hr(s,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.hs(),this.A,null==i?void 0:i.occurredAtMs)};this.ds(()=>this.Ls(n))}Fs(t){const i=this.Dr.beforeSend;if(!i)return t;const e=vi(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.A.info("Log was rejected in beforeSend function"),null;s=i}catch(t){return this.A.error("Error in beforeSend function for log:",t),null}return s}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),i=t-this.xs;return this.As>i&&i>=0||(this.xs=t,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.As}ms`),this.Cs=!0),!1)}flush(){var t=this;return Di(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return Di(function*(){var i;t.ps.clear();let e=null!==(i=t._instance.getPersistedProperty(ei.LogsQueue))&&void 0!==i?i:[];if(0===e.length)return;const s=e.length;let n=0;for(;e.length>0&&s>n;){var r,o;const i=t._s;t.bs=0;const s=Math.min(e.length,t.Ms),l=e.slice(0,s),a=dr(l.map(t=>t.record),t.js(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.qs(a);if(t._s!==i)return;if("too-large"===u.kind&&l.length>1)t.Ms=Math.max(1,Math.floor(l.length/2)),t.A.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Ms}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Es,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Dr.maxBatchRecordsPerPost>t.Ms&&(t.Ms=Math.min(t.Dr.maxBatchRecordsPerPost,t.Ms+1)),yield t.Bs(l.length),e=null!==(o=t._instance.getPersistedProperty(ei.LogsQueue))&&void 0!==o?o:[],n+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var i=this;return Di(function*(){var e;const s=Math.max(0,t-i.bs),n=null!==(e=i._instance.getPersistedProperty(ei.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(ei.LogsQueue,n.slice(s)),yield i.vs()})()}js(){return cr(this.Dr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var i;if(this._instance.optedOut)return;const e=null!==(i=this._instance.getPersistedProperty(ei.LogsQueue))&&void 0!==i?i:[];this.Is>e.length||(e.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(ei.LogsQueue,e),this.Ts>e.length||this.ws.isOpen()?this.Os():this.gs()}Os(){this.ps.pending||this.ps.arm(Math.max(this.Es,this.ws.remainingMs()))}zs(){return Math.max(pr(this.Es,this.ks,this.Ss,3e4),this.ws.remainingMs())}Ps(){const t=this._instance.getPersistedProperty(ei.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return Di(function*(){i.ps.clear();const e=i.flush().catch(()=>{});void 0!==t?yield ss(e,t):yield e})()}flushWithTimeout(t){var i=this;return Di(function*(){const e=i.flush();yield ss(e,t,()=>{e.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=fr(),this.A.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.Ps()&&this.ps.armNoEarlierThan(this.zs())})}};const _r=/^[0-9a-f]+$/;function mr(t,i,e){return"string"==typeof t&&t.length===i&&t!==e&&_r.test(t)}const yr=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;const br="00",wr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function $r(t){return String(t)+"000000"}function xr(t,i,e,s){let n="";return s&&(n=Object.keys(s).sort().map(t=>`${JSON.stringify(t)}:${JSON.stringify(s[t])}`).join(",")),`${t}\0${i}\0${null!=e?e:""}\0${n}`}var Sr=class{constructor(t,i,e){this._instance=t,this.Dr=i,this.A=e,this.Hs=new Map,this.ps=new vr(()=>this.flush().catch(t=>{this.A.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new Je,this.ks=0,this.Ss=1,this.Gs=0}count(t,i=1,e){this.Qs({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.Qs({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.Qs({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this;const i=this.ys,e=function(){var e=Di(function*(){i&&(yield i.catch(()=>{})),yield t.Js()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.ys===e&&(this.ys=null)});return this.ys=e,e}drainWindow(){if(0===this.Hs.size)return null;const t=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Zs(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const i=this.Fs(t);if(null===i)return;if(!i.name||"string"!=typeof i.name)return void this.A.warn("Dropping metric with empty name");if("number"!=typeof i.value||!Number.isFinite(i.value))return void this.A.warn(`Dropping metric '${i.name}': value must be a finite number`);if("count"===i.type&&0>i.value)return void this.A.warn(`Dropping count '${i.name}': counters are monotonic, value must be >= 0`);let e,s;try{e=i.attributes?as({},i.attributes):void 0,s=xr(i.type,i.name,i.unit,e)}catch(t){return void this.A.warn(`Dropping metric '${i.name}': attributes could not be serialized`,t)}let n=this.Hs.get(s);if(!n){if(!this.Ks())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Hs.set(s,n)}const r=this.Ws.get(i.name);void 0===r?this.Ws.set(i.name,i.type):r===i.type||this.Vs.has(i.name)||(this.Vs.add(i.name),this.A.warn(`Metric name '${i.name}' is already used as a ${r}; recording it as a ${i.type} too will blend both series in charts. Use a distinct name.`)),this.Ys(n,i.value);const o=this.Xs();o&&(n.exemplar=as(as({},o),{},{value:i.value,timeMs:Date.now()})),this.Os()}Xs(){try{var t,i;const e=function(t){const i=function(t){if("string"!=typeof t)return;const i=yr.exec(t.trim());if(!i)return;const[,e,s,n,r,o]=i;return"ff"===e||"00"===e&&o||!function(t){return mr(t,32,"00000000000000000000000000000000")}(s)||!function(t){return mr(t,16,"0000000000000000")}(n)?void 0:{version:e,traceId:s,spanId:n,flags:r}}(t);return i&&{traceId:i.traceId,spanId:i.spanId,flags:(e=i.flags,1&parseInt(e,16)?"01":br)};var e}(null===(t=(i=this._instance).getActiveSpan)||void 0===t||null===(t=t.call(i))||void 0===t?void 0:t.traceparent());if(e&&"01"===e.flags)return{traceId:e.traceId,spanId:e.spanId}}catch(t){}}Ks(){return this.Dr.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Dr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Ys(t,i){switch(t.type){case"count":var e;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(wr.length+1).fill(0)});const e=t.hist;e.count+=1,e.sum+=i,e.min=Math.min(e.min,i),e.max=Math.max(e.max,i),e.bucketCounts[function(t,i){for(let e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,wr)]+=1;break}}}Fs(t){const i=this.Dr.beforeSend;if(!i)return t;const e=vi(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.A.info("Metric was rejected in beforeSend function"),null;s=i}catch(t){return this.A.error("Error in beforeSend function for metric:",t),null}return s}Os(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(pr(this.Dr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Js(){var t=this;return Di(function*(){if(t.ps.clear(),0===t.Hs.size)return;const i=t.Hs;t.Hs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const e=t.Gs,s=yield t._instance.bo(t.Zs(i));if(e===t.Gs)switch(t.ws.record(s),"retry-later"===s.kind?(t.ks++,t.Ss=fr()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.zs()),s.kind){case"ok":return;case"retry-later":return t._o(i),void t.ps.armNoEarlierThan(t.zs());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:",s.error)}})()}Zs(t){return i=this.wo(t),e=function(t,i,e){return sr(t,i,e)}(this.Dr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:rr(e)},scopeMetrics:[{scope:{name:s,version:n},metrics:i}]}]};var i,e,s,n}wo(t){const i=$r(Date.now()),e=new Map;for(const o of t.values()){var s;const t=xr(o.type,o.name,o.unit,void 0);let l=e.get(t);l||(l=as({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},e.set(t,l));const a=Qn(null!==(s=o.attributes)&&void 0!==s?s:{},this.A),u=$r(o.windowStartMs),h=Er(o.exemplar);if("count"===o.type){var n;const t=as({attributes:a,startTimeUnixNano:u,timeUnixNano:i,asDouble:null!==(n=o.total)&&void 0!==n?n:0},h);l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t=as({attributes:a,timeUnixNano:i,asDouble:null!==(r=o.last)&&void 0!==r?r:0},h);l.gauge.dataPoints.push(t)}else if(o.hist){const t=as({attributes:a,startTimeUnixNano:u,timeUnixNano:i,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:wr},h);l.histogram.dataPoints.push(t)}}return Array.from(e.values())}_o(t){for(const[n,r]of t){var i;const t=this.Hs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,r.windowStartMs),t.exemplar=null!==(i=t.exemplar)&&void 0!==i?i:r.exemplar,t.type){case"count":var e,s;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(s=r.total)&&void 0!==s?s:0);break;case"gauge":break;case"histogram":if(r.hist)if(t.hist){t.hist.count+=r.hist.count,t.hist.sum+=r.hist.sum,t.hist.min=Math.min(t.hist.min,r.hist.min),t.hist.max=Math.max(t.hist.max,r.hist.max);for(let i=0;t.hist.bucketCounts.length>i;i++)t.hist.bucketCounts[i]+=r.hist.bucketCounts[i]}else t.hist=r.hist}else this.Ks()&&this.Hs.set(n,r)}}};function Er(t){return t?{exemplars:[{filteredAttributes:[],timeUnixNano:$r(t.timeMs),asDouble:t.value,traceId:t.traceId,spanId:t.spanId}]}:{}}const kr=(t,{debugEnabled:e}={})=>{const s={N(s,...n){let r;try{r=typeof window>"u"?void 0:window}catch(t){return}r&&(i.DEBUG||r.POSTHOG_DEBUG||e)&&!_i(r.console)&&r.console&&("__rrweb_original__"in r.console[s]?r.console[s].__rrweb_original__:r.console[s])(t,...n)},debug(...t){s.N("debug",...t)},info(...t){s.N("log",...t)},warn(...t){s.N("warn",...t)},error(...t){s.N("error",...t)},critical(...i){console.error(t,...i)},uninitializedWarning(t){s.error(`You must initialize PostHog before calling ${t}`)},createLogger:(i,e)=>kr(`${t} ${i}`,e)};return s},Tr=kr("[PostHog.js]"),Pr=Tr.createLogger;function Or(t,i){vi(t)&&t.forEach(i)}function Rr(t,i){if(!wi(t))if(vi(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(const e in t)ci.call(t,e)&&i(t[e],e)}const Ar=function(t,...i){for(const e of i)for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t};function Cr(t){const i=Object.keys(t);let e=i.length;const s=new Array(e);for(;e--;)s[e]=[i[e],t[i[e]]];return s}const Ir=function(t){return function(...i){try{return t.apply(this,i)}catch(t){Tr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Tr.critical(t)}}},Mr=function(t){const i={};return Rr(t,function(t,e){(mi(t)&&t.length>0||$i(t))&&(i[e]=t)}),i};function Fr(t){const i=as({},t);for(const e of["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e])}catch(t){}return i}const Dr=["herokuapp.com","vercel.app","netlify.app"];function Nr(t){const i=null==t?void 0:t.hostname;if(!mi(i))return!1;const e=i.split(".").slice(-2).join(".");for(const t of Dr)if(e===t)return!1;return!0}function Lr(t,i,e,s){const{capture:n=!1,passive:r=!0}=null!=s?s:{};null==t||t.addEventListener(i,e,{capture:n,passive:r})}function jr(t){return"ph_toolbar_internal"===t.name}const Ur=t=>{if(Gt){try{const i=t+"=",e=Gt.cookie.split(";").filter(t=>t.length);for(let t=0;e.length>t;t++){let s=e[t];for(;" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}};var Br=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(i,e,s,n){if(!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(s)||!Number.isInteger(n)||0>i||0>e||0>s||0>n||i>0xffffffffffff||e>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=i/Math.pow(2,40),r[1]=i/Math.pow(2,32),r[2]=i/Math.pow(2,24),r[3]=i/Math.pow(2,16),r[4]=i/256,r[5]=i,r[6]=112|e>>>8,r[7]=e,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new t(r)}toString(){let t="";for(let i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(let i=0;16>i;i++){const e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}},zr=class{generate(){const t=this.generateOrAbort();if(!_i(t))return t;{this.Tt=0;const t=this.generateOrAbort();if(_i(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return $i(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Tt)this.Tt=t,this.It();else{if(this.Tt>=t+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Tt++,this.It())}return Br.fromFieldsV7(this.Tt,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Rt.nextUint32())}It(){this.Mt=1024*this.Rt.nextUint32()+(1023&this.Rt.nextUint32())}constructor(){this.Tt=0,this.Mt=0,this.Rt=new Wr}};const Hr=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};let qr;var Wr=class{nextUint32(){var t;return this.At.length>this.Et||((null!==(t=qr)&&void 0!==t?t:qr="u">typeof window&&!_i(window.crypto)&&crypto.getRandomValues?t=>{try{return crypto.getRandomValues(t)}catch(i){return Hr(t)}}:Hr)(this.At),this.Et=0),this.At[this.Et++]}constructor(){this.At=new Uint32Array(8),this.Et=1/0}};let Vr;const Gr=()=>Kr().toString(),Kr=()=>(Vr||(Vr=new zr)).generate();let Yr="";const Jr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Xr=null;const Zr={Ot(){if(!bi(Xr))return Xr;if(Xr=!1,Gt)try{const t=`__ph_cookie_support_${Gr()}`;Zr.$t(t,"xyz"),Xr='"xyz"'===Ur(t),Zr.Dt(t)}catch(t){Xr=!1}return Xr},Pt(t){Tr.error("cookieStore error: "+t)},Lt:Ur,Ft(t){let i;try{i=JSON.parse(Zr.Lt(t))||{}}catch(t){}return i},$t(t,i,e,s,n){if(!Gt)return!1;try{let r="",o="";const l=function(t,i){if(i){let i=function(t,i=Gt){if(Yr)return Yr;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";const e=t.split(".");let s=Math.min(e.length,8);const n="dmn_chk_"+Gr();for(;!Yr&&s--;){const t=e.slice(s).join("."),r=n+"=1;domain=."+t+";path=/";i.cookie=r+";max-age=3",i.cookie.includes(n)&&(i.cookie=r+";max-age=0",Yr=t)}return Yr}(t);if(!i){const e=(t=>{const i=t.match(Jr);return i?i[0]:""})(t);e!==i&&Tr.info("Warning: cookie subdomain discovery mismatch",e,i),i=e}return i?"; domain=."+i:""}return""}(Gt.location.hostname,s);if(e){const t=new Date;t.setTime(t.getTime()+864e5*e),r="; expires="+t.toUTCString()}n&&(o="; secure");const a=t+"="+encodeURIComponent(JSON.stringify(i))+r+"; SameSite=Lax; path=/"+l+o;return a.length>3686.4&&Tr.warn("cookieStore warning: large cookie, len="+a.length),Gt.cookie=a,!0}catch(t){return!1}},Dt(t,i){if((null==Gt?void 0:Gt.cookie)&&(!i||!bi(Ur(t))))try{Zr.$t(t,"",-1,i)}catch(t){return}}};let Qr=null;const to={Ot(){if(!bi(Qr))return Qr;let t=!0;if(_i(qt))t=!1;else try{const i="__mplssupport__";to.$t(i,"xyz"),'"xyz"'!==to.Lt(i)&&(t=!1),to.Dt(i)}catch(i){t=!1}return t||Tr.error("localStorage unsupported; falling back to cookie store"),Qr=t,t},Pt(t){Tr.error("localStorage error: "+t)},Lt(t){try{return null==qt?void 0:qt.localStorage.getItem(t)}catch(t){to.Pt(t)}return null},Ft(t){try{return JSON.parse(to.Lt(t))||{}}catch(t){}return null},$t(t,i){try{return null==qt||qt.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){to.Pt(t)}return!1},Dt(t){try{null==qt||qt.localStorage.removeItem(t)}catch(t){to.Pt(t)}}},io=[d,n,h,r,p,a,l,o,v],eo=[O,P,tt,it,wt,bt,M,pt],so=t=>t+"_cpm",no=["__proto__","constructor","prototype"],ro=t=>{if(!pi(t))return{};const i={};return Object.keys(t).forEach(e=>{-1===no.indexOf(e)&&(i[e]=t[e])}),i},oo=(t,i=[])=>{const e={};return[...eo,...i].forEach(i=>{const s=t[i];_i(s)||bi(s)||""===s||(e[i]=s)}),e},lo=t=>{let i=5381,e=2166136261;for(let s=0;t.length>s;s++){const n=t.charCodeAt(s);i=33*i^n,e=Math.imul(e^n,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},ao=(t,i)=>({p:i,f:lo(JSON.stringify(t))}),uo=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{const e=Zr.Ft(so(t)),s=(null==e?void 0:e.f)===lo(i)&&vi(e.p);return{properties:s?e.p:[],isValid:s}}catch(t){return{properties:[],isValid:!1}}},ho=(t,i)=>i+"|"+(Zr.Lt(so(t))||""),co={},vo={Ot:()=>!0,Pt(t){Tr.error("memoryStorage error: "+t)},Lt:t=>t in co?co[t]:null,Ft:t=>t in co?co[t]:null,$t:(t,i)=>(co[t]=i,!0),Dt(t){delete co[t]}};let fo=null;const po={Ot(){if(!bi(fo))return fo;if(fo=!0,_i(qt))fo=!1;else try{const t="__support__";po.$t(t,"xyz"),'"xyz"'!==po.Lt(t)&&(fo=!1),po.Dt(t)}catch(t){fo=!1}return fo},Pt(t){Tr.error("sessionStorage error: ",t)},Lt(t){try{return null==qt?void 0:qt.sessionStorage.getItem(t)}catch(t){po.Pt(t)}return null},Ft(t){try{return JSON.parse(po.Lt(t))||null}catch(t){}return null},$t(t,i){try{return null==qt||qt.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){po.Pt(t)}return!1},Dt(t){try{null==qt||qt.sessionStorage.removeItem(t)}catch(t){po.Pt(t)}}};var go=class{constructor(t){this._instance=t}get Dr(){return this._instance.config}get consent(){return this.Tl()?0:this.Il}isOptedOut(){return"always"===this.Dr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Dr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Dr.opt_out_capturing_by_default}optInOut(t){this.El.$t(this.Ml,t?1:0,this.Dr.cookie_expiration,this.Dr.cross_subdomain_cookie,this.Dr.secure_cookie)}reset(){this.El.Dt(this.Ml,this.Dr.cross_subdomain_cookie)}get Ml(){const{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get Il(){const t=this.El.Lt(this.Ml);return Ii(t)?1:oi(Mi,t)?0:-1}get El(){const t=this.Dr.opt_out_capturing_persistence_type,i="localStorage"===t?to:Zr,e=i.Ot()?i:vo;if(!this.Al||this.Al!==e){this.Al=e;const i="localStorage"===t?Zr:to;i.Lt(this.Ml)&&(this.Al.Lt(this.Ml)||this.optInOut(Ii(i.Lt(this.Ml))),i.Dt(this.Ml,this.Dr.cross_subdomain_cookie))}return this.Al}Tl(){return!!this.Dr.respect_dnt&&[null==Vt?void 0:Vt.doNotTrack,null==Vt?void 0:Vt.msDoNotTrack,ii.doNotTrack,null==Vt?void 0:Vt.globalPrivacyControl].some(t=>Ii(t))}};function _o(t,i){var e;const s=null==t||null===(e=t.config)||void 0===e?void 0:e.get_current_url;if(!fi(s))return i;try{const t=s(i);return mi(t)&&t?t:i}catch(t){return Tr.error("Error in get_current_url, falling back to window.location.href",t),i}}function mo(t){var i;return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!!(null===(i=t.closest)||void 0===i?void 0:i.call(t,".toolbar-global-fade-container")))}function yo(t){return!!t&&1===t.nodeType}function bo(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function wo(t){return!!t&&3===t.nodeType}function $o(t){return!!t&&11===t.nodeType&&yo(t.host)}function xo(t){return t?li(t).split(/\s+/):[]}function So(t,i){const e=function(t){var i;const e=typeof window>"u"?void 0:window,s=null==e||null===(i=e.location)||void 0===i?void 0:i.href;return _i(s)?void 0:_o(t,s)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function Eo(t){let i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return xo(i)}function ko(t){return wi(t)?null:li(t).split(/(\s+)/).filter(t=>el(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function To(t){let i="";return Go(t)&&!Ko(t)&&t.childNodes&&t.childNodes.length&&Rr(t.childNodes,function(t){var e;wo(t)&&t.textContent&&(i+=null!==(e=ko(t.textContent))&&void 0!==e?e:"")}),li(i)}function Po(t){var i;return _i(t.target)?t.srcElement||null:(null===(i=t.target)||void 0===i?void 0:i.shadowRoot)?t.composedPath()[0]||null:t.target||null}const Oo=["a","button","form","input","select","textarea","label"];function Ro(t,i){const e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}function Ao(t,i){if(_i(i))return!0;for(const e of t)if(i.some(t=>Ro(e,t)))return!0;return!1}function Co(t){const i=t.parentNode;return!(!i||!yo(i))&&i}const Io=[".ph-no-autocapture","[data-ph-no-autocapture]"],Mo=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Fo=[...Mo,"+","-","−","–"],Do=Fo.length+10,No=["button","a","input","select","textarea","label"],Lo=["button","link","tab","menuitem","option"],jo=(t,i)=>/[a-z0-9]/i.test(i)?oi(Fo,i)?new RegExp(`\\b${i}\\b`).test(t):t.includes(i):t===i,Uo=t=>oi(No,t.tagName.toLowerCase())||oi(Lo,(t.getAttribute("role")||"").toLowerCase());function Bo(t){let i="",e="";const s=t=>{yo(t)&&Go(t)&&!Ko(t)&&(i+=` ${To(t)}`,e=e||t.getAttribute("aria-label")||"",Rr(t.childNodes,s))};s(t),i=li(i.replace(/\s+/g," "));const n=(el(i)?i:"").toLowerCase(),r=t.getAttribute("aria-label")||(n?"":e);return{safeText:n,ariaLabel:li(r).toLowerCase()}}const zo=[".ph-no-rageclick",".ph-no-capture"],Ho=["","text","search","email","password","url","tel","number"];function qo(t,i){if(!(typeof window>"u"?void 0:window)||Wo(t))return!1;let e,s,n;var r,o;if(Si(i)?(e=!!i&&zo,s=void 0,n=!1):(e=null!==(r=null==i?void 0:i.css_selector_ignorelist)&&void 0!==r?r:zo,s=null==i?void 0:i.content_ignorelist,n=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(n&&function(t){return!(!t||!yo(t))&&(!!bo(t,"textarea")||(bo(t,"input")?oi(Ho,(t.getAttribute("type")||"").toLowerCase()):function(t){var i;if(t.isContentEditable)return!0;const e=null===(i=t.getAttribute)||void 0===i?void 0:i.call(t,"contenteditable");return"true"===e||""===e}(t)))}(t))return!1;const{targetElementList:l}=Vo(t,!1);return!(s&&function(t,{safeText:i,ariaLabel:e}){let s;if(!0===t)s=Mo;else{if(!vi(t))return!1;if(t.length>Do)return Tr.error(`[PostHog] content_ignorelist array cannot exceed ${Do} items. Use css_selector_ignorelist for more complex matching.`),!1;s=t.map(t=>t.toLowerCase())}return s.some(t=>jo(i,t)||jo(e,t))}(s,function(t,i){for(const t of i)if(Uo(t))return Bo(t);for(const t of i){try{var e;if("pointer"!==(null===(e=window)||void 0===e?void 0:e.getComputedStyle(t).getPropertyValue("cursor")))break}catch(t){break}const i=Bo(t);if(i.safeText||i.ariaLabel)return i}return Bo(t)}(t,l))||Ao(l,e))}const Wo=t=>!t||bo(t,"html")||!yo(t),Vo=(t,i)=>{const e=typeof window>"u"?void 0:window;if(!e||Wo(t))return{parentIsUsefulElement:!1,targetElementList:[]};let s=!1;const n=[t];let r=t;for(;r.parentNode&&!bo(r,"body");){if($o(r.parentNode)){n.push(r.parentNode.host),r=r.parentNode.host;continue}const t=Co(r);if(!t)break;if(i||Oo.indexOf(t.tagName.toLowerCase())>-1)s=!0;else try{const i=e.getComputedStyle(t);i&&"pointer"===i.getPropertyValue("cursor")&&(s=!0)}catch(t){}n.push(t),r=t}return{parentIsUsefulElement:s,targetElementList:n}};function Go(t){const i=new Set;let e=0;for(let s=t;s.parentNode&&!bo(s,"body");s=s.parentNode){if(e++>=1e3||i.has(s))return!1;i.add(s);const t=Eo(s);if(oi(t,"ph-sensitive")||oi(t,"ph-no-capture"))return!1}if(oi(Eo(t),"ph-include"))return!0;const s=t.type||"";if(mi(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const n=t.name||t.id||"";return!mi(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function Ko(t){return!!(bo(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||bo(t,"select")||bo(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Yo=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}))$"),Jo=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Xo=[16,15,14,13],Zo=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Qo=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),tl=/[0-9A-Za-z_]/;function il(t){let i=0,e=!1;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e}return i%10==0}function el(t,i=!0){if(wi(t))return!1;if(mi(t)){if(t=li(t),i?Yo.test((t||"").replace(/[- ]/g,"")):function(t){let i;for(Jo.lastIndex=0;i=Jo.exec(t);){const t=i[2];if(!t)continue;const e=t.replace(/[- ]/g,"");for(let t=0;e.length>t;t++)for(const i of Xo){const s=t+i;if(e.length>=s){const i=e.slice(t,s);if(Yo.test(i)&&il(i))return!0}}}return!1}(t))return!1;if(i?Zo.test(t):function(t){let i;for(Qo.lastIndex=0;i=Qo.exec(t);){const t=i[1],e=i[3];if(!(t&&e&&tl.test(t)&&tl.test(e)))return!0}return!1}(t))return!1}return!0}function sl(t){let i=To(t);return i=`${i} ${nl(t)}`.trim(),el(i)?i:""}function nl(t){let i="";return t&&t.childNodes&&t.childNodes.length&&Rr(t.childNodes,function(t){var e;if(t&&"span"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase()))try{const e=To(t);i=`${i} ${e}`.trim(),t.childNodes&&t.childNodes.length&&(i=`${i} ${nl(t)}`.trim())}catch(t){Tr.error("[AutoCapture]",t)}}),i}function rl(t){return t.replace(/"|\\"/g,'\\"')}function ol(t){const i=t.attr__class;if(i)return vi(i)?i:xo(i)}const ll=Pr("[Dead Clicks]"),al=()=>!0,ul=t=>{var i;const e=!!(null===(i=t.instance.persistence)||void 0===i?void 0:i.get_property(H)),s=t.instance.config.capture_dead_clicks;return Si(s)?s:!!pi(s)||e};var hl=class{get lazyLoadedDeadClicksAutocapture(){return this.Rl}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[H]:i.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Pl(()=>{this.Ol()}):this.stop()}Pl(t){var i,e,s;(null===(i=ii.__PosthogExtensions__)||void 0===i?void 0:i.initDeadClicksAutocapture)?t():null===(e=ii.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this.instance,"dead-clicks-autocapture",i=>{i?ll.error("failed to load script",i):t()})}Ol(){var t;if(Gt){if(!this.Rl&&(null===(t=ii.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=pi(this.instance.config.capture_dead_clicks)?as({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Rl=ii.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Rl.start(Gt),ll.info("starting...")}}else ll.error("`document` not found. Cannot start.")}stop(){this.Rl&&(this.Rl.stop(),this.Rl=void 0,ll.info("stopping..."))}};const cl=Pr("[SegmentIntegration]");function dl(t,i,e=!0){const s=t.config.segment;if(!s)return i();const{analytics:n,filterProperties:r}=(t=>fi(t.register))(o=s)?{analytics:o}:o;var o;!function(t,i,e,s){const n=i=>{const n=()=>i.anonymousId()||Gr();t.config.get_device_id=n,s&&i.id()&&(t.register({distinct_id:i.id(),$device_id:n()}),t.persistence.set_property(pt,Nt)),e(s?void 0:i.anonymousId()||void 0)},r=i.user();"then"in r&&fi(r.then)?r.then(n):n(r)}(t,n,e=>{n.register(((t,i,{filterProperties:e}={})=>{"undefined"!=typeof Promise&&Promise.resolve||cl.warn("This browser does not have Promise support, and can not use the segment integration");const s=(s,n)=>{if(!n)return s;const r=!!i&&s.event.anonymousId===i&&!s.event.userId;r||s.event.userId||s.event.anonymousId===t.get_distinct_id()||(cl.info("No userId set, resetting PostHog"),t.reset()),r||(i=void 0),s.event.userId&&s.event.userId!==t.get_distinct_id()&&(cl.info("UserId set, identifying with PostHog"),t.identify(s.event.userId));let o=t.calculateEventProperties(n,s.event.properties);if(!wi(e)){const t=s.event.properties||{},i={};for(const e of Object.keys(o))ci.call(t,e)||(i[e]=o[e]);const n=((t,i)=>{const e=vi(t)?t:[t];let s=as({},i);for(const t of e)try{if(s=t(s),wi(s))return null}catch(t){return cl.error("Error in Segment filterProperties:",t),null}return s})(e,i);if(wi(n))return s;o=n}return s.event.properties=Object.assign({},o,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return s(t,t.event.event)},page(t){return s(t,Ut)},identify(t){return s(t,zt)},screen(t){return s(t,"$screen")}}})(t,e,{filterProperties:r})).then(()=>{i()},t=>{cl.error("Failed to register the Segment integration",t),i()})},e)}const vl="posthog-js";function fl(t,{organization:i,projectId:e,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,h,c;if("*"!==n&&!n.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(l=o.exception)||void 0===l?void 0:l.values)||[],f=v.map(t=>as(as({},t),{},{stacktrace:t.stacktrace?as(as({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>as(as({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(a=v[0])||void 0===a?void 0:a.value)||o.message,$exception_type:null===(u=v[0])||void 0===u?void 0:u.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(h=v[0])||void 0===h?void 0:h.value)||o.message,$sentry_exception_type:null===(c=v[0])||void 0===c?void 0:c.type,$sentry_tags:o.tags};var g;return i&&e&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+e+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var pl=class{constructor(t,i,e,s,n,r){this.name=vl,this.setupOnce=function(o){o(fl(t,{organization:i,projectId:e,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}))}}},gl=class{constructor(t){this.Fl=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Tr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Dl=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ll()}Ll(){var t;this.Nl=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.Fl)}destroy(){var t;null===(t=this.Nl)||void 0===t||t.call(this),this.Nl=void 0}doPageView(t,i){var e;const s=this.jl(t,i);return this.Dl={pathname:null!==(e=null==qt?void 0:qt.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.jl(t,null===(i=this.Dl)||void 0===i?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Dl)||void 0===t?void 0:t.pageViewId}}jl(t,i){const e=this.Dl;if(!e)return{$pageview_id:i};let s={$pageview_id:i,$prev_pageview_id:e.pageViewId};const n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:i,maxScrollY:e,maxContentHeight:r,lastContentY:o,maxContentY:l}=n;if(!(_i(t)||_i(i)||_i(e)||_i(r)||_i(o)||_i(l))){t=Math.ceil(t),i=Math.ceil(i),e=Math.ceil(e),r=Math.ceil(r),o=Math.ceil(o),l=Math.ceil(l);const n=t>1?Ui(i/t,0,1,Tr):1,a=t>1?Ui(e/t,0,1,Tr):1,u=r>1?Ui(o/r,0,1,Tr):1,h=r>1?Ui(l/r,0,1,Tr):1;s=Ar(s,{$prev_pageview_last_scroll:i,$prev_pageview_last_scroll_percentage:n,$prev_pageview_max_scroll:e,$prev_pageview_max_scroll_percentage:a,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:l,$prev_pageview_max_content_percentage:h})}}return e.pathname&&(s.$prev_pageview_pathname=e.pathname),e.timestamp&&(s.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),s}};const _l=["flags","surveys"],ml={[T]:{exposure:"hidden"},[A]:{exposure:"hidden"},[C]:{exposure:"hidden"},[N]:{exposure:"hidden"},[M]:{exposure:"hidden"},[D]:{exposure:"hidden"},[y]:{exposure:"event"},[L]:{exposure:"hidden"},[W]:{exposure:"hidden"},[j]:{exposure:"event"},[U]:{exposure:"hidden"},[B]:{exposure:"event"},[z]:{exposure:"event"},[H]:{exposure:"event"},[q]:{exposure:"hidden"},[V]:{exposure:"event"},[G]:{exposure:"hidden"},[K]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[it]:{exposure:"event"},[Y]:{exposure:"event",shouldSkipFromEventProperties:t=>bi(t)},[et]:{exposure:"event"},[st]:{exposure:"event"},[nt]:{exposure:"event"},[rt]:{exposure:"event"},[ot]:{exposure:"hidden"},[h]:{exposure:"hidden",storageGroup:"flags"},[n]:{exposure:"hidden",storageGroup:"flags"},[s]:{exposure:"hidden"},[r]:{exposure:"hidden",storageGroup:"flags"},[p]:{exposure:"hidden",storageGroup:"flags"},[a]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[u]:{exposure:"hidden",storageGroup:"flags"},[g]:{exposure:"hidden"},[_]:{exposure:"hidden"},[d]:{exposure:"hidden"},[c]:{exposure:"hidden"},[b]:{exposure:"hidden",storageGroup:"surveys"},[w]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[S]:{exposure:"event"},[E]:{exposure:"hidden"},[k]:{exposure:"hidden"},[at]:{exposure:"hidden"},[ut]:{exposure:"hidden"},[ht]:{exposure:"hidden"},[ct]:{exposure:"event"},[dt]:{exposure:"event"},[vt]:{exposure:"event"},[ft]:{exposure:"event"},[v]:{exposure:"hidden"},[f]:{exposure:"hidden"},[lt]:{exposure:"event"},[o]:{exposure:"hidden"},[l]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[pt]:{exposure:"hidden"},[gt]:{exposure:"hidden"},[_t]:{exposure:"hidden"},[mt]:{exposure:"hidden"},[yt]:{exposure:"hidden"},[bt]:{exposure:"hidden"},[wt]:{exposure:"hidden"},[J]:{exposure:"event"},[X]:{exposure:"event"},[Z]:{exposure:"event"},[Q]:{exposure:"event"},[St]:{exposure:"event"},[Et]:{exposure:"event"},[kt]:{exposure:"hidden"},[Tt]:{exposure:"hidden"},[Pt]:{exposure:"hidden"},[Ot]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[At]:{exposure:"hidden"},[Ct]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Ft]:{exposure:"event"}},yl=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],bl=t=>{const i=ml[t];if(i)return i;for(const[i,e]of yl)if(0===t.indexOf(i))return e};function wl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}const $l=t=>{const i=typeof document>"u"?void 0:document,e=null==i?void 0:i.createElement("a");return _i(e)?null:(e.href=t,e)},xl=()=>{try{return"u">typeof window&&!1!==window.navigator.onLine}catch(t){return!1}},Sl=(t,i)=>t>=i&&xl(),El=(t,i,e,s)=>{if(0===t){if(xl()){const t=i+1;return t===e&&s(),t}return i}return 0},kl=(t,i)=>{try{let e;return JSON.stringify(t,(t,i)=>{var s;return Oi(i)?(null!==(s=e)&&void 0!==s||(e=new WeakMap),e.has(i)||e.set(i,Fr(i)),e.get(i)):"bigint"==typeof i?i.toString():i},i)}catch(i){return ui(t)}},Tl=function(t,i){const e=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let t=0;e.length>t;t++){const n=e[t].split(/=(.*)/);if(n[0]===i){s=n;break}}if(!vi(s)||2>s.length)return"";{let t=s[1].replace(/\+/g," ");try{t=decodeURIComponent(t)}catch(i){Tr.error("Skipping decoding for malformed query param: "+t)}return t}},Pl=function(t,i,e){if(!t||!i||!i.length)return t;const s=t.split(/#(.*)/),n=s[1],r=(s[0]||"").split(/\?(.*)/),o=r[1],l=r[0],a=(o||"").split("&"),u=[];for(let t=0;a.length>t;t++){const s=a[t].split("?");let n=0;for(;s.length>n&&!i.includes(s[n].split("=")[0]);)n++;u.push(s.length>n?s.slice(0,n).concat(s[n].split("=")[0]+"="+e).join("?"):a[t])}let h=l;return null!=o&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},Ol=function(t,i){const e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Rl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],Al=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Rl],Cl="<masked>",Il=["li_fat_id"];function Ml(t,i,e){if(!Gt)return{};const s=i?[...Rl,...e||[]]:[],n=Fl(Pl(Gt.URL,s,Cl),t),r=function(){const t={};return Rr(Il,function(i){const e=Ur(i);t[i]=e||null}),t}();return Ar(r,n)}function Fl(t,i){const e=Al.concat(i||[]),s={};return Rr(e,function(i){const e=Tl(t,i);s[i]=e||null}),s}function Dl(t){const i=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",s={};if(!bi(i)){s.$search_engine=i;const t=Gt?Tl(Gt.referrer,e):"";t.length&&(s.ph_keyword=t)}return s}function Nl(){return navigator.language||navigator.userLanguage}function Ll(){const t=Nl();return"string"==typeof t?t.split("-")[0]:void 0}const jl="$direct";function Ul(){return(null==Gt?void 0:Gt.referrer)||jl}function Bl(t,i,e=!1){const s=t?[...Rl,...i||[]]:[],n=e?ts(null==Kt?void 0:Kt.href):null==Kt?void 0:Kt.href,r=null==n?void 0:n.substring(0,1e3);return{r:Ul().substring(0,1e3),u:r?Pl(r,s,Cl):void 0}}function zl(t,i=!1){var e;const{r:s,u:n}=t,r=i?ts(n):n,o={$referrer:s,$referring_domain:null==s?void 0:s==jl?jl:null===(e=$l(s))||void 0===e?void 0:e.host};if(r){o.$current_url=r;const t=$l(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const i=Fl(r);Ar(o,i)}if(s){const t=Dl(s);Ar(o,t)}return o}function Hl(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const ql={flags:l,surveys:w},Wl=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Vl=t=>`${t}_cookie_identity_change_pending`,Gl=t=>{let i="",e=0;for(const s of t){const t=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(e+t>1e3)break;i+=s,e+=t}return i},Kl="main",Yl=[h,n,r,p,a,l,u,d],Jl=t=>-1!==Yl.indexOf(t),Xl=[M,D],Zl=t=>-1!==Xl.indexOf(t),Ql=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},ta=t=>{if(!t)return{};const i=JSON.parse(t);return pi(i)?i:{}},ia=(t,i)=>{Rr(t,(e,s)=>{const n=bl(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(i,s)||delete t[s]})};var ea=class{constructor(t,i,e=!0,s=!t.cookieless_mode){if(this.ql={},this.Bl=!1,this.zl=!1,this.Hl=!1,this.Ul=!1,this.Wl=!1,this.Vl=new Map,this.Gl=!1,this.Ql=!1,this.Jl=!1,this.Zl=new Set,this.Kl=new Set,this.Dr=t,this.Yl=e,this.props={},this.Xl=void 0,this.tu=(t=>{let i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.fi=t.disable_persistence||!!i,this.El=this.eu(t),this.Hl=this.iu(t),this.load(s),this.nu(),t.debug&&Tr.info("Persistence loaded",t.persistence,as({},this.props)),this.update_config(t,t,i),this.save(),qt){const t=()=>this.flush();Lr(qt,"beforeunload",t,{capture:!1}),Lr(qt,"pagehide",t,{capture:!1}),this.su=t=>{if(this.Bl&&(!t.storageArea||t.storageArea===(null==qt?void 0:qt.localStorage))&&t.key)if(t.key!==this.tu){if(this.Hl){const i=_l.find(i=>t.key===this.ru(i));i&&this.ou(t.key,i)}}else this.ou(t.key,Kl)},Lr(qt,"storage",this.su)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,i])=>{const e=this.Vl.get(t);if(!Jl(t)||!0===e)return;if(!0===i)return void this.au(t,!0);const s=new Set(e||[]);i.forEach(t=>s.add(t)),s.size&&this.au(t,s)})}onCrossTabFeatureFlagChange(t){return this.Kl.add(t),()=>this.Kl.delete(t)}destroy(){this.su&&qt&&(qt.removeEventListener("storage",this.su),this.su=void 0),this.Kl.clear()}ou(t,i,e=!0){if(this.fi)return!1;let s,n;try{if(n=to.Lt(t),bi(n)){const t=this.lu(i);return t.storageValue=null,i!==Kl&&(t.persisted=!1),!1}s=ta(n)}catch(t){return!1}const r=i===Kl?s:to.Ft(this.tu);if(r&&this.uu(r))return!1;const o=this.cu(s,i,e);return i===Kl&&this.Hl&&!Ql(this.hu().main,s)||this.du(s,i,!0,n),o}uu(t){const i=this.props[P],e=t[P];return!_i(i)&&!_i(e)&&i!==e}du(t,i,e,s){const n=this.lu(i);n.storageValue=s,i!==Kl&&(n.persisted=e);try{n.fingerprint=this.vu(t,i)}catch(t){n.fingerprint=void 0}}cu(t,i,e){let s=!1;return Yl.forEach(e=>{var n;const r=null===(n=bl(e))||void 0===n?void 0:n.storageGroup;if(i===Kl&&this.Hl&&r||i!==Kl&&r!==i)return;const o=e in t,l=this.fu(e,o?t[e]:void 0),a=this.Vl.has(e)?e in this.props:o;a===e in this.props&&Ql(l,this.props[e])||(a?this.pu(e,l,!1):this.gu(e,!1),s=!0)}),s&&e&&this.Kl.forEach(t=>t()),s}mu(){if(!this.Bl)return!1;try{this.Jl=!1;const t=to.Lt(this.tu),i=this.lu(Kl);let e,s=!1,n=!1;if(t!==i.storageValue)if(bi(t))i.storageValue=null;else{if(e=ta(t),this.Jl=!this.Ql&&this.uu(e),this.Jl)return!1;n=this.cu(e,Kl,!1),!this.Hl||Ql(this.hu().main,e)?this.du(e,Kl,!0,t):i.storageValue=t,s=!0}return this.Hl&&_l.forEach(t=>{const i=to.Lt(this.ru(t)),r=this.lu(t),o=e||{},l=s&&Yl.some(i=>{var e;return(null===(e=bl(i))||void 0===e?void 0:e.storageGroup)===t&&i in o});if(i===r.storageValue&&!l)return;if(bi(i))return r.storageValue=null,r.persisted=!1,void(l&&(n=this.cu(o,t,!1)||n));const a=ta(i);n=this.cu(a,t,!1)||n,this.du(a,t,!0,i)}),n}catch(t){return!1}}au(t,i){this.Vl.set(t,i);const e=bl(t);(null==e?void 0:e.volatile)||(this.lu((this.Hl?null==e?void 0:e.storageGroup:void 0)||Kl).fingerprint=void 0,this.yu(t))}bu(){Yl.forEach(t=>this.Vl.set(t,!0))}nu(){if(this.Bl)try{const t=to.Lt(this.tu),i=ta(t);this.lu(Kl).storageValue=t,Yl.forEach(t=>{var e;const s=this.Hl?null===(e=bl(t))||void 0===e?void 0:e.storageGroup:void 0,n=s?to.Lt(this.ru(s)):null;if(s){const t=this.lu(s);t.storageValue=n,t.persisted=!bi(n)}const r=s&&!bi(n)?ta(n):i;t in this.props?this._u(t,r[t],this.props[t]):t in r&&this.au(t,!0)})}catch(t){}}fu(t,i){const e=this.Vl.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){const s=new Set(vi(i)?i:[]),n=new Set(vi(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}const s=pi(i)?as({},i):{},n=pi(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in n?s[t]=n[t]:delete s[t]}),s}_u(t,i,e){if(!Jl(t))return;const s=this.Vl.get(t);if(!0===s)return;let n=i;if(this.Bl)try{var r;const i=this.Hl?null===(r=bl(t))||void 0===r?void 0:r.storageGroup:void 0,e=i?this.ru(i):this.tu;n=ta(to.Lt(e))[t]}catch(t){}const o=new Set(s||[]);if("$active_feature_flags"===t){if(!_i(i)&&!vi(i)||!_i(n)&&!vi(n)||!vi(e))return void this.au(t,!0);const s=new Set(i||[]),r=new Set(n||[]),l=new Set(e);new Set([...s,...l]).forEach(t=>{s.has(t)!==l.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===l.has(t)&&o.delete(t)})}else{if(!pi(e))return void(Ql(n,e)?this.Vl.delete(t):this.au(t,!0));{if(!_i(i)&&!pi(i)||_i(i)&&gi(e)&&_i(n))return void this.au(t,!0);const s=pi(i)?i:{},r=pi(n)?n:{};new Set([...Object.keys(s),...Object.keys(e)]).forEach(t=>{t in s==t in e&&Ql(s[t],e[t])||o.add(t)}),o.forEach(t=>{t in r==t in e&&Ql(r[t],e[t])&&o.delete(t)})}}o.size?this.au(t,o):this.Vl.delete(t)}wu(){var t;const i=null===(t=this.Dr)||void 0===t?void 0:t.persistence_save_debounce_ms;return $i(i)&&i>0?i:0}ku(t){if(this.Dr.cookieWinsOnConflict&&"localstorage+cookie"===this.Dr.persistence.toLowerCase())if(t)try{const i=oo(t,this.Dr.cookie_persisted_properties||[]),e=ao(i,this.Dr.cookie_persisted_properties||[]),s=JSON.stringify(i)+"|"+JSON.stringify(e),n=Zr.Lt(this.tu)||void 0;n&&ho(this.tu,n)===s&&(this.Su=s,this.xu=n)}catch(t){}else try{const t=Zr.Lt(this.tu)||void 0;this.Su=t?ho(this.tu,t):void 0,this.xu=t}catch(t){}}syncCookieProperties(){return this.$u(this.Dr)}$u(t,i=!1){if(this.fi&&!i||this.Wl||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let e;try{e=Zr.Lt(this.tu)||void 0}catch(t){}if(!e||e===this.xu)return!1;const s=ho(this.tu,e);let u;try{u=ro(JSON.parse(e))}catch(t){return!1}if((Zr.Lt(this.tu)||void 0)!==e)return!1;this.Su=s,this.xu=e;const f=uo(this.tu,e),g=[...eo,...f.properties],_={};if(Object.keys(u).forEach(t=>{const i=u[t];(_i(i)||bi(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(_[t]=!0,delete u[t])}),gi(u))return!1;const m="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state,y=this.props,b=y[P],w=y[pt],x=Ar({},y);[...eo,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==g.indexOf(t)&&!(t in u)&&!_[t]&&(m||"distinct_id"!==t&&"$user_state"!==t)){const i=x[t];(f.isValid||-1===eo.indexOf(t)||!1!==i&&0!==i)&&delete x[t]}}),this.props=Ar(x,u),Yl.forEach(t=>{const i=t in this.props;t in y===i&&Ql(y[t],this.props[t])||(i?this._u(t,y[t],this.props[t]):this.au(t,!0))}),!m||"$user_state"in u||"$user_state"in this.props||this.pu(pt,Dt);const S=this.props[P],E=this.props[pt];return!m||S===b&&E===w||(this.Ql=!0,this.Ul=!0,po.$t(Vl(this.tu),!0),this.gu(d),this.gu(n),this.gu(h),this.gu(r),this.gu(p),this.gu(a),this.gu(l),this.gu(o),this.gu(v),"anonymous"!==E||"identified"!==w&&"anonymous"!==u.$user_state&&(_i(b)||S===b)||(ia(this.props,u),this.gu(c)),"identified"===E?this.props.$user_id=S:delete this.props.$user_id,this.gu(A)),!0}consumeCookieIdentityChange(){const t=Vl(this.tu),i=this.Ul||!!po.Lt(t);return this.Ul=!1,i&&po.Dt(t),i}Cu(t=!1){return!(this.Wl||this.fi&&!t||!this.Dr.cookieWinsOnConflict||"localstorage+cookie"!==this.Dr.persistence.toLowerCase()||(this.Wl=!0,0))}Tu(){this.Wl&&(_i(this.Iu)||(clearTimeout(this.Iu),this.Iu=void 0),delete this.ql[Kl],this.Eu(!0))}Mu(t=!0){if(this.Wl)try{t?this.Tu():_i(this.Iu)||(clearTimeout(this.Iu),this.Iu=void 0)}finally{this.Wl=!1}}isDisabled(){return!!this.fi}eu(t){-1===Wl.indexOf(t.persistence.toLowerCase())&&(Tr.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");const i=((t=[],i=!1,e=()=>!1)=>{const s=[...eo,...t];return as(as({},to),{},{Au(t){return[Zr.Lt(t),Zr.Lt(so(t)),to.Lt(t)].join("\0")},Ft(t){try{let r,o={};try{r=Zr.Lt(t)||void 0,o=r?ro(JSON.parse(r)):{}}catch(t){}const l=JSON.parse(to.Lt(t)||"{}");let a;if(i){const i=uo(t,r),e=[...eo,...i.properties],u={};Object.keys(o).forEach(t=>{const i=o[t];bi(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(u[t]=i)});const h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var n;const t=l[P],r=null!==(n=l.$user_state)&&void 0!==n?n:Dt;s.forEach(t=>{if(-1!==e.indexOf(t)&&!(t in o)&&(h||"distinct_id"!==t&&"$user_state"!==t)){const e=l[t];(i.isValid||-1===eo.indexOf(t)||!1!==e&&0!==e)&&delete l[t]}}),!h||"$user_state"in o||"$user_state"in l||(l[pt]=Dt),!h||("distinct_id"in u?u[P]:l[P])===t&&("$user_state"in u?u[pt]:l[pt])===r||(io.forEach(t=>delete l[t]),"identified"===u.$user_state&&"distinct_id"in u?l.$user_id=u[P]:delete l.$user_id,"identified"!==u.$user_state&&(delete l[lt],delete l[c]),delete l.__alias)}a=Ar(l,u)}else a=Ar(o,l);return e()||to.$t(t,a),a}catch(t){}return null},$t(e,s,n,r,o,l){const a=to.$t(e,s,void 0,void 0,l);try{const u=oo(s,t);if(Object.keys(u).length){if(i){const i=so(e),h=ao(u,t);if(Zr.$t(i,h,n,r,o,l),Zr.Lt(i)!==JSON.stringify(h)){Zr.Dt(i,r);const t=oo(s);return Zr.$t(e,t,n,r,o,l),a}}Zr.$t(e,u,n,r,o,l)}}catch(t){to.Pt(t)}return a},Dt(t,i){try{null==qt||qt.localStorage.removeItem(t),Zr.Dt(t,i),Zr.Dt(so(t),i)}catch(t){to.Pt(t)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict,()=>!!this.fi);let e,s=!1,n=!1;const r=t.persistence.toLowerCase();return"localstorage"===r&&to.Ot()?(e=to,n=!0):"localstorage+cookie"===r&&i.Ot()?(e=i,n=!0,s=!0):"sessionstorage"===r&&po.Ot()?e=po:"memory"===r?e=vo:"cookie"===r&&Zr.Ot()?(e=Zr,s=!0):i.Ot()?(e=i,n=!0,s=!0):Zr.Ot()?(e=Zr,s=!0):e=vo,this.Bl=n,this.zl=s,e}ru(t){return`${this.tu}__${t}`}iu(t){return this.Bl&&!!t.split_storage}properties(){const t={};return Rr(this.props,(i,e)=>{const s=bl(e);if(!s||"event"===s.exposure){var n;if(null==s||null===(n=s.shouldSkipFromEventProperties)||void 0===n?void 0:n.call(s,i))return;t[e]=i}}),t}load(t=!1){if(this.fi&&!t)return;const i=this.Dr.cookieWinsOnConflict&&"localstorage+cookie"===this.Dr.persistence.toLowerCase(),e=i?to.Ft(this.tu):null;let s={};if(i)try{s=ro(Zr.Ft(this.tu)),Rr(s,(t,i)=>{(_i(t)||bi(t)||""===t)&&delete s[i]})}catch(t){}const n=this.El.Ft(this.tu);if(n&&(this.props=Ar({},n)),this.Hl&&this.Ru(),i&&n){var r,o;const t=null==e?void 0:e[P],i=null!==(r=null==e?void 0:e.$user_state)&&void 0!==r?r:Dt,l=n[P],a=null!==(o=n.$user_state)&&void 0!==o?o:Dt;if(l!==t||a!==i){this.Ul=!0,this.fi||po.$t(Vl(this.tu),!0);const e=Ar({},this.props);io.forEach(t=>delete e[t]),"anonymous"!==a||"identified"!==i&&"anonymous"!==s.$user_state&&(_i(t)||l===t)||(ia(e,s),delete e[c]),this.props=e;const n=new Set;io.forEach(t=>{var i;const e=null===(i=bl(t))||void 0===i?void 0:i.storageGroup;e&&n.add(e)}),n.forEach(t=>{if(this.fi)return;const i={};Rr(this.props,(e,s)=>{var n;(null===(n=bl(s))||void 0===n?void 0:n.storageGroup)===t&&(i[s]=e)}),gi(i)?(to.Dt(this.ru(t)),this.ql[t]={}):to.$t(this.ru(t),i)&&(this.ql[t]={persisted:!0,fingerprint:this.vu(i,t)})})}}po.Lt(Vl(this.tu))&&(this.Ul=!0)}Ru(){for(const t of _l){const i=to.Ft(this.ru(t));if(i&&!gi(i)){const e=this.lu(t);e.persisted=!0,this.Pu(t)||(e.fingerprint=this.vu(i,t)),this.Ou(t,i)||Ar(this.props,i)}}}Pu(t){return Object.keys(this.props).some(i=>{var e;return(null===(e=bl(i))||void 0===e?void 0:e.storageGroup)===t})}Ou(t,i){const e=ql[t];if(!e)return!1;const s=i[e],n=this.props[e];return $i(s)&&$i(n)&&n>s}refreshKey(t){this.Fu([t])}Fu(t){if(this.fi)return;let i,e=!1;const s=()=>(e||(i=this.El.Ft(this.tu),e=!0),i);t.forEach(t=>{var i;if(this.Zl.has(t))return;const e=this.Hl?null===(i=bl(t))||void 0===i?void 0:i.storageGroup:void 0,n=e?to.Ft(this.ru(e)):s();if(n&&t in n)this.pu(t,n[t],!1);else{if(e){const i=s();if(i&&t in i)return void this.pu(t,i[t],!1)}this.gu(t,!1)}})}refreshMetaIdentifiers(){if(this.fi)return;const t=this.Du();(_i(t)||t!==this.Lu)&&(this.Fu(Xl),this.Nu(t))}Nu(t=this.Du()){this.Lu=0===this.Zl.size?t:void 0}Du(){const t=this.El.Au?this.El.Au(this.tu):this.El.Lt(this.tu);return mi(t)?t:void 0}save(){if(this.fi)return;const t=this.wu();t>0?_i(this.Iu)&&(this.Iu=setTimeout(()=>{this.Iu=void 0,this.Eu()},t)):this.Eu()}flush(){_i(this.Iu)||(clearTimeout(this.Iu),this.Iu=void 0,this.Eu())}Eu(t=!1){if(this.fi||this.Wl&&!t)return;t||(this.syncCookieProperties(),this.Dr.cookieWinsOnConflict&&"localstorage+cookie"===this.Dr.persistence.toLowerCase()||this.refreshMetaIdentifiers());const i=!t&&!this.Gl;i||(this.Jl=!1);const e=!!i&&this.mu();if(this.Jl)return void(this.Dr.debug&&Tr.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Hl)return this.ju(),void(e&&this.Kl.forEach(t=>t()));const s=this.qu(this.El,this.tu,this.props,Kl);"written"===s&&this.ku(this.props),"failed"!==s&&(this.Vl.clear(),this.Ql=!1,this.Zl.clear()),"written"===s&&this.Nu(),e&&this.Kl.forEach(t=>t())}ju(){const{main:t,groups:i}=this.hu(),e=this.qu(this.El,this.tu,t,Kl);"written"===e&&this.ku(t),"failed"!==e&&(this.Ql=!1,this.Zl.clear(),Yl.forEach(t=>{var i;(null===(i=bl(t))||void 0===i?void 0:i.storageGroup)||this.Vl.delete(t)})),"written"===e&&this.Nu();for(const t of _l){var s;const e=i[t];if(gi(e)&&!(null===(s=this.ql[t])||void 0===s?void 0:s.persisted)){Yl.forEach(i=>{var e;(null===(e=bl(i))||void 0===e?void 0:e.storageGroup)===t&&this.Vl.delete(i)});continue}const n=this.qu(to,this.ru(t),e,t);"failed"!==n&&Yl.forEach(i=>{const e=bl(i);(null==e?void 0:e.storageGroup)!==t||"written"!==n&&e.volatile||this.Vl.delete(i)})}}hu(){const t={},i={flags:{},surveys:{}};return Rr(this.props,(e,s)=>{var n;const r=null===(n=bl(s))||void 0===n?void 0:n.storageGroup;r?i[r][s]=e:t[s]=e}),{main:t,groups:i}}vu(t,i){if(i===Kl)return JSON.stringify(t)+"|"+this.Bu+"|"+this.zu+"|"+this.Hu;const e={};return Rr(t,(t,i)=>{var s;e[i]=(null===(s=bl(i))||void 0===s?void 0:s.volatile)?"__volatile__":t}),JSON.stringify(e)}qu(t,i,e,s){const n=this.lu(s);if(s!==Kl&&!n.dirty&&!_i(n.fingerprint))return"skipped";let r;try{if(r=this.vu(e,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){r=void 0}return t.$t(i,e,this.Bu,this.zu,this.Hu,this.Dr.debug)?(n.dirty=!1,s!==Kl&&(n.persisted=!0),_i(r)||(n.fingerprint=r),this.Bl&&(n.storageValue=to.Lt(i)),"written"):(this.Dr.debug&&Tr.warn(`failed to persist storage entry "${i}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.bu(),_i(this.Iu)||(clearTimeout(this.Iu),this.Iu=void 0),this.El.Dt(this.tu,!1),this.El.Dt(this.tu,!0),!t&&this.Yl)for(const t of _l)to.Dt(this.ru(t));t?delete this.ql[Kl]:this.ql={},this.Su=void 0,this.xu=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(pi(t)){this.syncCookieProperties(),_i(i)&&(i="None"),this.Bu=_i(e)?this.Uu:e;let s=!1;if(Rr(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.pu(e,t),s=!0)}),s)return this.save(),!0}return!1}register(t,i){if(pi(t)){this.syncCookieProperties(),this.Bu=_i(i)?this.Uu:i;let e=!1;if(Rr(t,(i,s)=>{t.hasOwnProperty(s)&&(this.props[s]!==i||pi(i)||vi(i))&&(this.pu(s,i),e=!0)}),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const i="string"==typeof t?[t]:t;let e=!1;for(const t of i)t in this.props&&(this.gu(t),e=!0);e&&this.save()}update_campaign_params(){const t=null==Gt?void 0:Gt.URL;if(t===this.Xl)return;const i=Ml(this.Dr.custom_campaign_params,this.Dr.mask_personal_data_properties,this.Dr.custom_personal_data_properties),e=!gi(Mr(i));return e&&this.register(i),this.Xl=t,e?i:void 0}update_search_keyword(){this.register(function(){const t=null==Gt?void 0:Gt.referrer;return t?Dl(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Ul(),$referring_domain:(null==Gt?void 0:Gt.referrer)&&(null===(t=$l(Gt.referrer))||void 0===t?void 0:t.host)||jl},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Bl(this.Dr.mask_personal_data_properties,this.Dr.custom_personal_data_properties,this.Dr.disable_capture_url_hashes);this.register_once({[bt]:this.zl?{r:Gl(t.r),u:t.u?Gl(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Rr([yt,mt],i=>{const e=this.props[i];e&&Rr(e,function(i,e){t["$initial_"+ai(e)]=i})});const i=this.props[bt];if(i){const e=function(t,i=!1){const e=zl(t,i),s={};return Rr(e,function(t,i){s[`$initial_${ai(i)}`]=t}),s}(i,this.Dr.disable_capture_url_hashes);Ar(t,e)}return t}safe_merge(t){return Rr(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){const s=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;const e=[...t].sort(),s=[...i].sort();return e.every((t,i)=>t===s[i])})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),r=s||n,o=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,a=!!this.fi&&!l;l||this.$u(i,a),this.Dr=t,!l&&(s||n||o)&&(this.Su=void 0,this.xu=void 0,this.$u(as(as({},t),{},{cookie_persisted_properties:i.cookie_persisted_properties}),a));const u=r||o?this.eu(t):this.El;this.Wu();const h=this.iu(t),c=r||h!==this.Hl,d=!l&&(c||t.cross_subdomain_cookie!==this.zu||t.secure_cookie!==this.Hu)&&this.Cu(a);this.Gl=c;try{if(this.Uu=this.Bu=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.El=u,this.Hl=h,this.props=t,this.save()}else o&&(this.El=u,l||(delete this.ql[Kl],this.Eu()))}finally{this.Gl=!1,d&&this.Mu()}}Wu(){const t=this.props[bt];if(!this.zl||!pi(t)||"string"!=typeof t.r)return;const i=Gl(t.r),e="string"==typeof t.u?Gl(t.u):t.u;i===t.r&&e===t.u||this.pu(bt,as(as({},t),{},{r:i,u:e}))}set_disabled(t){this.fi=t,this.fi?this.remove():this.save()}set_cross_subdomain(t){t!==this.zu&&(this.zu=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Hu&&(this.Hu=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){const e=this.props.__timers||{};e[t]=i,this.pu(N,e),this.save()}remove_event_timer(t){const i=this.props.__timers||{},e=i[t];return _i(e)||(delete i[t],this.pu(N,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.pu(t,i),this.save()}pu(t,i,e=!0){var s;const n=this.props[t];this.props[t]=i,e&&("distinct_id"!==t&&"$user_state"!==t||n===i||(this.Ql=!0),Zl(t)&&!Ql(n,i)&&this.Zl.add(t),this._u(t,n,i),(null===(s=bl(t))||void 0===s?void 0:s.volatile)||this.yu(t))}gu(t,i=!0){delete this.props[t],i&&(Jl(t)&&this.au(t,!0),Zl(t)&&this.Zl.add(t),this.yu(t))}yu(t){var i;const e=null===(i=bl(t))||void 0===i?void 0:i.storageGroup;e&&(this.lu(e).dirty=!0)}lu(t){return this.ql[t]||(this.ql[t]={})}};const sa={GZipJS:"gzip-js",Base64:"base64"},na={Activation:"events",Cancellation:"cancelEvents"},ra={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},oa={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},la={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"},aa={Popover:"popover",Inline:"inline"};function ua(t){let i=!0;return{dispose(){if(i){i=!1;const e=t();e&&fi(e.then)&&e.then(void 0,()=>{})}}}}const ha={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"},ca={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"},da=Pr("[RateLimiter]");var va=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(t=>{da.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void da.warn(`could not rate limit - continuing. Error: "${null==t?void 0:t.message}"`,{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t=!1){var i,e,s;const{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=(new Date).getTime(),l=null!==(i=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_property("$capture_rate_limit"))&&void 0!==i?i:{tokens:n,last:o};l.tokens+=Math.max(0,o-l.last)/1e3*r,l.last=Math.max(l.last,o),l.tokens>n&&(l.tokens=n);const a=1>l.tokens;if(a||t||(l.tokens=Math.max(0,l.tokens-1)),a&&!t){const t=($i(l.dropped)?l.dropped:0)+1;l.dropped=t,!this.lastEventRateLimited&&this.Vu(t)&&(l.dropped=0)}return this.lastEventRateLimited=a,null===(s=this.instance.persistence)||void 0===s||s.set_property("$capture_rate_limit",l),{isRateLimited:a,remainingTokens:l.tokens}}Gu(t){const i=this.instance.config.property_denylist;return!vi(i)||!i.includes(t)}Qu(){var t;if(this.Gu("$current_url")&&this.Gu("$pathname")&&(null==Kt?void 0:Kt.pathname))return`${null!==(t=Kt.origin)&&void 0!==t?t:""}${Kt.pathname}`}Vu(t){var i,e;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this.Qu(),o=this.Gu("$session_id")?null===(i=(e=this.instance).get_session_id)||void 0===i?void 0:i.call(e):void 0,l=[`${t} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${l}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}};const fa=Pr("[RemoteConfig]");var pa=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=ii._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Ju(t){var i,e,s;(null===(i=ii.__PosthogExtensions__)||void 0===i?void 0:i.loadExternalDependency)?null===(e=ii.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Zu(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 fa.info("Using preloaded remote config",this.remoteConfig),void this.Ku(this.remoteConfig);if(this._instance.Yu())return void fa.warn("Remote config is disabled. Falling back to local config.");this.Ju(t=>{if(!t)return fa.info("No config found after loading remote JS config. Falling back to JSON."),void this.Zu(t=>{this.Ku(t.json,t)});this.Ku(t)})}catch(t){fa.error("Error loading remote config",t),this.Ku()}}Ku(t,i){!t&&i&&(0===i.statusCode?i.error||fa.warn("Failed to fetch remote config from PostHog."):fa.error("Failed to fetch remote config from PostHog."));try{this._instance.Ku(t?{ok:!0,config:t}:{ok:!1})}catch(t){fa.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null===(e=this._instance.featureFlags)||void 0===e||e.ensureFlagsLoaded()}catch(t){fa.error("Error loading feature flags",t)}}},ga=Uint8Array,_a=Uint16Array,ma=Uint32Array,ya=new ga([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]),ba=new ga([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]),wa=new ga([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$a=function(t,i){for(var e=new _a(31),s=0;31>s;++s)e[s]=i+=1<<t[s-1];var n=new ma(e[30]);for(s=1;30>s;++s)for(var r=e[s];e[s+1]>r;++r)n[r]=r-e[s]<<5|s;return[e,n]},xa=$a(ya,2),Sa=xa[1];xa[0][28]=258,Sa[258]=28;for(var Ea=$a(ba,0)[1],ka=new _a(32768),Ta=0;32768>Ta;++Ta){var Pa=(43690&Ta)>>>1|(21845&Ta)<<1;ka[Ta]=((65280&(Pa=(61680&(Pa=(52428&Pa)>>>2|(13107&Pa)<<2))>>>4|(3855&Pa)<<4))>>>8|(255&Pa)<<8)>>>1}var Oa=function(t,i,e){for(var s=t.length,n=0,r=new _a(i);s>n;++n)++r[t[n]-1];var o,l=new _a(i);for(n=0;i>n;++n)l[n]=l[n-1]+r[n-1]<<1;if(e){o=new _a(1<<i);var a=15-i;for(n=0;s>n;++n)if(t[n])for(var u=n<<4|t[n],h=i-t[n],c=l[t[n]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[ka[c]>>>a]=u}else for(o=new _a(s),n=0;s>n;++n)o[n]=ka[l[t[n]-1]++]>>>15-t[n];return o},Ra=new ga(288);for(Ta=0;144>Ta;++Ta)Ra[Ta]=8;for(Ta=144;256>Ta;++Ta)Ra[Ta]=9;for(Ta=256;280>Ta;++Ta)Ra[Ta]=7;for(Ta=280;288>Ta;++Ta)Ra[Ta]=8;var Aa=new ga(32);for(Ta=0;32>Ta;++Ta)Aa[Ta]=5;var Ca=Oa(Ra,9,0),Ia=Oa(Aa,5,0),Ma=function(t){return(t/8|0)+(7&t&&1)},Fa=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var s=new(t instanceof _a?_a:t instanceof ma?ma:ga)(e-i);return s.set(t.subarray(i,e)),s},Da=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8},Na=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8,t[s+2]|=e>>>16},La=function(t,i){for(var e=[],s=0;t.length>s;++s)t[s]&&e.push({s:s,f:t[s]});var n=e.length,r=e.slice();if(!n)return[new ga(0),0];if(1==n){var o=new ga(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort(function(t,i){return t.f-i.f}),e.push({s:-1,f:25001});var l=e[0],a=e[1],u=0,h=1,c=2;for(e[0]={s:-1,f:l.f+a.f,l:l,r:a};h!=n-1;)l=e[e[c].f>e[u].f?u++:c++],a=e[u!=h&&e[c].f>e[u].f?u++:c++],e[h++]={s:-1,f:l.f+a.f,l:l,r:a};var d=r[0].s;for(s=1;n>s;++s)r[s].s>d&&(d=r[s].s);var v=new _a(d+1),f=ja(e[h-1],v,0);if(f>i){s=0;var p=0,g=f-i,_=1<<g;for(r.sort(function(t,i){return v[i.s]-v[t.s]||t.f-i.f});n>s;++s){var m=r[s].s;if(i>=v[m])break;p+=_-(1<<f-v[m]),v[m]=i}for(p>>>=g;p>0;){var y=r[s].s;i>v[y]?p-=1<<i-v[y]++-1:++s}for(;s>=0&&p;--s){var b=r[s].s;v[b]==i&&(--v[b],++p)}f=i}return[new ga(v),f]},ja=function(t,i,e){return-1==t.s?Math.max(ja(t.l,i,e+1),ja(t.r,i,e+1)):i[t.s]=e},Ua=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new _a(++i),s=0,n=t[0],r=1,o=function(t){e[s++]=t},l=1;i>=l;++l)if(t[l]==n&&l!=i)++r;else{if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=t[l]}return[e.subarray(0,s),i]},Ba=function(t,i){for(var e=0,s=0;i.length>s;++s)e+=t[s]*i[s];return e},za=function(t,i,e){var s=e.length,n=Ma(i+2);t[n]=255&s,t[n+1]=s>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var r=0;s>r;++r)t[n+r+4]=e[r];return 8*(n+4+s)},Ha=function(t,i,e,s,n,r,o,l,a,u,h){Da(i,h++,e),++n[256];for(var c=La(n,15),d=c[0],v=c[1],f=La(r,15),p=f[0],g=f[1],_=Ua(d),m=_[0],y=_[1],b=Ua(p),w=b[0],x=b[1],S=new _a(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;w.length>E;++E)S[31&w[E]]++;for(var k=La(S,7),T=k[0],P=k[1],O=19;O>4&&!T[wa[O-1]];--O);var R,A,C,I,M=u+5<<3,F=Ba(n,Ra)+Ba(r,Aa)+o,D=Ba(n,d)+Ba(r,p)+o+14+3*O+Ba(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(F>=M&&D>=M)return za(i,h,t.subarray(a,a+u));if(Da(i,h,1+(F>D)),h+=2,F>D){R=Oa(d,v,0),A=d,C=Oa(p,g,0),I=p;var N=Oa(T,P,0);for(Da(i,h,y-257),Da(i,h+5,x-1),Da(i,h+10,O-4),h+=14,E=0;O>E;++E)Da(i,h+3*E,T[wa[E]]);h+=3*O;for(var L=[m,w],j=0;2>j;++j){var U=L[j];for(E=0;U.length>E;++E)Da(i,h,N[B=31&U[E]]),h+=T[B],B>15&&(Da(i,h,U[E]>>>5&127),h+=U[E]>>>12)}}else R=Ca,A=Ra,C=Ia,I=Aa;for(E=0;l>E;++E)if(s[E]>255){var B;Na(i,h,R[257+(B=s[E]>>>18&31)]),h+=A[B+257],B>7&&(Da(i,h,s[E]>>>23&31),h+=ya[B]);var z=31&s[E];Na(i,h,C[z]),h+=I[z],z>3&&(Na(i,h,s[E]>>>5&8191),h+=ba[z])}else Na(i,h,R[s[E]]),h+=A[s[E]];return Na(i,h,R[256]),h+A[256]},qa=new ma([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Wa=new ga(0),Va=function(){for(var t=new ma(256),i=0;256>i;++i){for(var e=i,s=9;--s;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Ga=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,s=0;i.length>s;++s)e=Va[255&e^i[s]]^e>>>8;t=e},d(){return 4294967295^t}}}(),s=t.length;e.p(t);var n,r,o,l,a,u,h=(l=10+((n=i).filename&&n.filename.length+1||0),a=8,function(t,i,e,s,n,r){var o=t.length,l=new ga(s+o+5*(1+Math.floor(o/7e3))+n),a=l.subarray(s,l.length-n),u=0;if(!i||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=za(a,u,t.subarray(h,c)):(a[h]=r,u=za(a,u,t.subarray(h,o)))}else{for(var d=qa[i-1],v=d>>>13,f=8191&d,p=(1<<e)-1,g=new _a(32768),_=new _a(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new ma(25e3),x=new _a(288),S=new _a(32),E=0,k=0,T=(h=0,0),P=0,O=0;o>h;++h){var R=b(h),A=32767&h,C=_[R];if(g[A]=C,_[R]=A,h>=P){var I=o-h;if((E>7e3||T>24576)&&I>423){u=Ha(t,a,0,w,x,S,k,T,O,h-O,u),T=E=k=0,O=h;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var F=2,D=0,N=f,L=A-C&32767;if(I>2&&R==b(h-L))for(var j=Math.min(v,I)-1,U=Math.min(32767,h),B=Math.min(258,I);U>=L&&--N&&A!=C;){if(t[h+F]==t[h+F-L]){for(var z=0;B>z&&t[h+z]==t[h+z-L];++z);if(z>F){if(F=z,D=L,z>j)break;var H=Math.min(L,z-2),q=0;for(M=0;H>M;++M){var W=h-L+M+32768&32767,V=W-g[W]+32768&32767;V>q&&(q=V,C=W)}}}L+=(A=C)-(C=g[A])+32768&32767}if(D){w[T++]=268435456|Sa[F]<<18|Ea[D];var G=31&Sa[F],K=31&Ea[D];k+=ya[G]+ba[K],++x[257+G],++S[K],P=h+F,++E}else w[T++]=t[h],++x[t[h]]}}u=Ha(t,a,r,w,x,S,k,T,O,h-O,u),r||(u=za(a,u,Wa))}return Fa(l,0,s+Ma(u)+n)}(r=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+o.mem,l,a,!u)),c=h.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&Ga(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var s=0;e.length>=s;++s)t[s+10]=e.charCodeAt(s)}}(h,i),Ga(h,c-8,e.d()),Ga(h,c-4,s),h}const Ya=!!Jt||!!Yt,Ja=new WeakMap,Xa="text/plain";let Za=0,Qa=!1;const tu=(t,i)=>{const[e,s]=t.split("#"),[n,r]=e.split("?");if(!r)return t;const o=r.split("&").filter(t=>t.split("=")[0]!==i).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},iu=(t,i,e=!0)=>{var s;const[n,r]=t.split("?"),o=as({},i),l=null!==(s=null==r?void 0:r.split("&").map(t=>{var i;const[s,n]=t.split("="),r=e&&null!==(i=o[s])&&void 0!==i?i:n;return delete o[s],`${s}=${r}`}))&&void 0!==s?s:[],a=function(t,i="&"){let e,s;const n=[];return Rr(t,function(t,i){_i(t)||_i(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),s=encodeURIComponent(i),n[n.length]=s+"="+e)}),n.join(i)}(o);return a&&l.push(a),l.length>0?`${n}?${l.join("&")}`:n},eu=t=>{if(t.cr)return t.cr;const{data:i,compression:e}=t;if(!i)return;if(e===sa.GZipJS){const t=Ka(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new ga(t.length+(t.length>>>1)),s=0,n=function(t){e[s++]=t},r=0;i>r;++r){if(s+5>e.length){var o=new ga(s+8+(i-r<<1));o.set(e),e=o}var l=t.charCodeAt(r);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++r))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Fa(e,0,s)}(kl(i)),{mtime:0});return{contentType:Xa,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(e===sa.Base64){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(kl(i)),e=(t=>"data="+encodeURIComponent("string"==typeof t?t:kl(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:e,estimatedSize:new Blob([e]).size}}const s=kl(i);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},su=t=>{const i=()=>"sendBeacon"===t.transport?{url:iu(t.url,{compression:sa.Base64}),encodedBody:eu(as(as({},t),{},{compression:sa.Base64,cr:void 0}))}:{url:tu(t.url,"compression"),encodedBody:eu(as(as({},t),{},{compression:void 0,cr:void 0}))};let e;try{e=eu(t)}catch(e){if(ln(t.compression,Tl(t.url,"compression")))return Tr.error("Failed to gzip request body, sending uncompressed payload",e),i();throw e}return e&&ln(t.compression,Tl(t.url,"compression"))&&!((s=e.body)instanceof ArrayBuffer?on(new Uint8Array(s)):ArrayBuffer.isView(s)&&on(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Qa=!0,i()):{url:t.url,encodedBody:e};var s},nu=t=>{try{return su(t)}catch(e){var i;return Tr.error(e),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))}},ru=function(){var t=Di(function*(t){const i=yield function(t){return dn.apply(this,arguments)}(kl(t.data),e.DEBUG,{rethrow:!0});if(!i)return t;const s=yield i.arrayBuffer();return as(as({},t),{},{cr:{contentType:Xa,body:s,estimatedSize:s.byteLength}})});return function(i){return t.apply(this,arguments)}}(),ou=/Failed to fetch|NetworkError|Load failed/i,lu=t=>"TypeError"===(null==t?void 0:t.name)&&ou.test((null==t?void 0:t.message)||""),au=t=>{try{const i=function(t,i=Date.now(),e=3e5){if("string"!=typeof t||!t)return;const s=t.trim(),n=/^\d+\s*,/.test(s)?s.slice(0,s.indexOf(",")).trim():s;if(/^\d+$/.test(n)){const t=1e3*Math.min(Number(n),e/1e3);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const r=/^\w{3} \w{3} /.test(n)?n+" GMT":n,o=Date.parse(r)-i;return Number.isFinite(o)&&o>0?Math.min(o,e):void 0}(t());return _i(i)?void 0:Math.min(i,3e4)}catch(t){return}},uu=t=>{const i=nu(t);if(!i)return;const e=new Jt;Ja.set(e,!0);const{url:s,encodedBody:n}=i;e.open(t.method||"GET",s,!0);const{contentType:r,body:o}=null!=n?n:{};Rr(t.headers,function(t,i){e.setRequestHeader(i,t)}),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i;const s={statusCode:e.status,text:e.responseText};if(200===e.status)try{s.json=JSON.parse(e.responseText)}catch(t){}null===(i=t.callback)||void 0===i||i.call(t,s,au(()=>e.getResponseHeader("Retry-After")))}},e.send(o)},hu=t=>{const i=nu(t);if(!i)return;const{url:e,encodedBody:s}=i,{contentType:n,body:r,estimatedSize:o}=null!=s?s:{},l=new Headers;Rr(t.headers,function(t,i){l.append(i,t)}),n&&l.append("Content-Type",n);let a=null,u=!1;if(Xt){const i=new Xt;a={signal:i.signal,timeout:setTimeout(()=>{u=!0;try{i.abort(Qe("AbortError","PostHog request timed out"+((e=t.timeout)?` after ${e}ms`:"")))}catch(t){c(t)}var e},t.timeout)}}let h=!1;const c=i=>{var e;h||(h=!0,u&&"AbortError"===(null==i?void 0:i.name)||lu(i)?Tr.warn(i):Tr.error(i),null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))};let d=0;const v=()=>{Za-=d,d=0,a&&clearTimeout(a.timeout)};try{const i=as({method:(null==t?void 0:t.method)||"GET",headers:l,referrerPolicy:"strict-origin",body:r,signal:null==a?void 0:a.signal},t.fetchOptions),s=null!=o?o:_i(r)?0:void 0;i.keepalive="POST"===i.method&&!t.Cl&&!1!==i.keepalive&&i.body===r&&!_i(s)&&s>=0&&52428.8>Za+s,i.keepalive&&(d=s,Za+=d),Yt(e,i).then(i=>i.text().then(e=>{var s;if(h)return;const n={statusCode:i.status,text:e};if(200===i.status)try{n.json=JSON.parse(e)}catch(t){Tr.error(t)}h=!0,v(),null===(s=t.callback)||void 0===s||s.call(t,n,au(()=>i.headers.get("Retry-After")))})).catch(t=>{v(),c(t)}).finally(v)}catch(t){v(),c(t)}},cu=t=>{try{var i;const{url:e,encodedBody:s}=su(t),{contentType:n,body:r,estimatedSize:o}=null!=s?s:{};if(!r)return;const l=r instanceof Blob?r:new Blob([r],{type:n});if(Vt.sendBeacon(e,l))return;const a=vi(t.data)?t.data:null===(i=t.data)||void 0===i?void 0:i.batch;if(vi(a)&&a.length>1&&(null!=o?o:0)>16384){const i=Math.ceil(a.length/2),e=i=>vi(t.data)?i:as(as({},t.data),{},{batch:i});return cu(as(as({},t),{},{data:e(a.slice(0,i))})),void cu(as(as({},t),{},{data:e(a.slice(i))}))}Tr.warn(`Beacon of ~${null!=o?o:0} bytes was rejected by the browser, falling back to ${Yt?"fetch":"XHR"}`),Yt?hu(as(as({},t),{},{Cl:!0})):uu(t)}catch(t){Tr.warn("Beacon send failed",t)}},du=(t,i,e,s)=>{const n="query"===s?"POST"===i?"sent_at":"_":void 0;return iu(e===sa.GZipJS?tu(t,"compression"):t,as(as({},n?{[n]:Date.now().toString()}:{}),e===sa.GZipJS?{}:{compression:e}))},vu=(()=>{const t=[];return Yt&&t.push({transport:"fetch",method:hu}),Jt&&t.push({transport:"XHR",method:uu}),(null==Vt?void 0:Vt.sendBeacon)&&t.push({transport:"sendBeacon",method:cu}),t})();let fu=!Ya&&-1===(null==Qt?void 0:Qt.indexOf("MSIE"))&&-1===(null==Qt?void 0:Qt.indexOf("Mozilla"));function pu(t,i,e){var s,n,r;e&&(i=as(as({},i),{},{callback:t=>e(t)})),t.__loaded?fu?t.__request_queue.push(i):t.rateLimiter.isServerRateLimited(i.batchKey)?i.fireCallbackOnDrop&&(null===(n=i.callback)||void 0===n||n.call(i,{statusCode:429})):(i.transport=i.transport||t.config.api_transport,i.headers=as(as({},t.config.request_headers),i.headers),i.compression="best-available"===i.compression?null!==(s=t.compression)&&void 0!==s?s:i.compressionFallback:i.compression,(_i(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(i.disableTransport=["sendBeacon"]),i.fetchOptions=i.fetchOptions||t.config.fetch_options,((t,i)=>{var e,s,n;const r=as(as({},t),{},{callback:null!=i?i:i=>{var e;return null===(e=t.callback)||void 0===e?void 0:e.call(t,i)}});r.timeout=r.timeout||6e4;const o=null!==(e=r.transport)&&void 0!==e?e:"fetch";"sendBeacon"===o&&_i(r.compression)&&r.data&&(r.compression=sa.Base64),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(t=>{var i,e;const s=(vi(t)?t:[t]).map(t=>as(as({},t),t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})),n=s[0];return{api_key:null!==(i=null==n||null===(e=n.properties)||void 0===e?void 0:e.token)&&void 0!==i?i:null==n?void 0:n.token,batch:s,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((t,i=(new Date).toISOString())=>vi(t)?t.map(t=>as(as({},t),{},{sent_at:i})):as(as({},t),{},{sent_at:i}))(r.data))),r.url=du(r.url,r.method,r.compression,r.timestampMode);const l=vu.filter(t=>!r.disableTransport||!t.transport||!r.disableTransport.includes(t.transport)),a=null!==(s=null===(n=function(t,i){for(let e=0;t.length>e;e++)if(i(t[e]))return t[e]}(l,t=>t.transport===o))||void 0===n?void 0:n.method)&&void 0!==s?s:l[0].method;if(!a)throw new Error("No available transport method");const u=t=>{try{a(t)}catch(t){var i;lu(t)?Tr.warn(t):Tr.error(t),null===(i=r.callback)||void 0===i||i.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===sa.GZipJS&&Zt&&"undefined"!=typeof Promise&&!Qa?ru(r).then(t=>{u(t)}).catch(i=>{if(an(i))return Qa=!0,void u(as(as({},r),{},{compression:void 0,url:du(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;const i="name"in t?String(t.name):"";return an(t)||i===rn})(i)&&(Qa=!0),u(r)}):u(r)})(i,(s,n)=>{var r,o,l;t.rateLimiter.checkForLimiting(s),400>s.statusCode||null===(r=(o=t.config).on_request_error)||void 0===r||r.call(o,s),e?e(s,n):null===(l=i.callback)||void 0===l||l.call(i,s)})):i.fireCallbackOnDrop&&(null===(r=i.callback)||void 0===r||r.call(i,{statusCode:0}))}var gu=class{constructor(t,i){this.Xu=!0,this.tc=[],this.ec=Ui((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,Tr.createLogger("flush interval"),3e3),this.nc=t}enqueue(t){this.tc.push(t),this.sc||this.rc()}unload(){this.oc();const t=this.tc.length>0?this.ac():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.lc(as(as({},t),{},{callback:void 0}),"sendBeacon")})}enable(){this.Xu=!1,this.rc()}rc(){this.Xu||(this.sc=setTimeout(()=>{this.oc(),this.uc()},this.ec))}uc(){if(this.tc.length>0){const t=this.ac();for(const i in t)this.lc(t[i])}}lc(t,i){try{this.nc(t,i)}catch(t){Tr.error(t)}}oc(){clearTimeout(this.sc),this.sc=void 0}ac(){const t={},i={};Rr(this.tc,e=>{var s;const n=e,r=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");_i(t[r])&&(t[r]=as(as({},n),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),i[r]=[]),null===(s=t[r].data)||void 0===s||s.push(n.data),n.callback&&i[r].push(n.callback)});for(const e in i){const s=i[e];s.length&&(t[e].callback=t=>{for(const i of s)i(t)})}return this.tc=[],t}};const _u=["retriesPerformedSoFar"];var mu=class{constructor(t){this._instance=t,this.cc=!1,this.hc=3e3,this.tc=[],this.tc=[],this.dc=!0,this.resume()}resume(){if(!_i(qt)&&"onLine"in qt.navigator){if(this.dc=qt.navigator.onLine,this.vc)return;this.vc=()=>{this.dc=!0,this.uc()},this.fc=()=>{this.dc=!1},Lr(qt,"online",this.vc),Lr(qt,"offline",this.fc)}}get length(){return this.tc.length}retriableRequest(t,i){let{retriesPerformedSoFar:e}=t,s=vn(t,_u);xi(e)&&(s.url=iu(s.url,{retry_count:e})),pu(this._instance,i?as(as({},s),{},{transport:i}):s,(t,i)=>{var n;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.Ls(as({retriesPerformedSoFar:e},s),i);0===t.statusCode&&Tr.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=e?e:0} retries.`)}null===(n=s.callback)||void 0===n||n.call(s,t)})}Ls(t,i){const e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;const s=Math.max(function(t){const i=3e3*Math.pow(2,t),e=i/2,s=Math.min(18e5,i),n=(Math.random()-.5)*(s-e);return Math.ceil(s+n)}(e),null!=i?i:0),n=Date.now()+s;this.tc.push({retryAt:n,requestOptions:t});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),Tr.warn(r),this.cc||(this.cc=!0,this.gc())}gc(){if(this.mc&&clearTimeout(this.mc),0===this.tc.length)return this.cc=!1,void(this.mc=void 0);this.mc=setTimeout(()=>{this.dc&&this.tc.length>0&&this.uc(),this.gc()},this.hc)}uc(){const t=Date.now(),i=[],e=this.tc.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.tc=i,e.length>0)for(const{requestOptions:t}of e)this.retriableRequest(t)}unload(){this.mc&&(clearTimeout(this.mc),this.mc=void 0),this.cc=!1,_i(qt)||(this.vc&&(qt.removeEventListener("online",this.vc),this.vc=void 0),this.fc&&(qt.removeEventListener("offline",this.fc),this.fc=void 0));for(const{requestOptions:t}of this.tc)try{this._instance._send_request(as(as({},t),{},{callback:vi(t.data)?void 0:t.callback,transport:"sendBeacon"}))}catch(t){Tr.error(t)}this.tc=[]}},yu=class{constructor(t){this._instance=t,this.yc=()=>{var t,i,e,s;this.bc||(this.bc={});const n=this.scrollElement(),r=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=r+((null==n?void 0:n.clientHeight)||0),a=(null==n?void 0:n.scrollHeight)||0;this.bc.lastScrollY=Math.ceil(r),this.bc.maxScrollY=Math.max(r,null!==(t=this.bc.maxScrollY)&&void 0!==t?t:0),this.bc.maxScrollHeight=Math.max(o,null!==(i=this.bc.maxScrollHeight)&&void 0!==i?i:0),this.bc.lastContentY=l,this.bc.maxContentY=Math.max(l,null!==(e=this.bc.maxContentY)&&void 0!==e?e:0),this.bc.maxContentHeight=Math.max(a,null!==(s=this.bc.maxContentHeight)&&void 0!==s?s:0)}}get _c(){return this._instance.config.scroll_root_selector}getContext(){return this.bc}resetContext(){const t=this.bc;return this.bc=void 0,setTimeout(this.yc,0),t}startMeasuringScrollPosition(){Lr(qt,"scroll",this.yc,{capture:!0}),Lr(qt,"scrollend",this.yc,{capture:!0}),Lr(qt,"resize",this.yc)}scrollElement(){if(this._c){const i=vi(this._c)?this._c:[this._c];for(const e of i){var t;const i=null==qt||null===(t=qt.document)||void 0===t?void 0:t.querySelector(e);if(i)return i}return}var i;return null==qt||null===(i=qt.document)||void 0===i?void 0:i.documentElement}wc(t){var i,e;const s="y"===t?"scrollTop":"scrollLeft";if(this._c){const t=this.scrollElement();return t&&t[s]||0}return qt?"y"===t?qt.scrollY||qt.pageYOffset||(null===(i=qt.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:qt.scrollX||qt.pageXOffset||(null===(e=qt.document)||void 0===e||null===(e=e.documentElement)||void 0===e?void 0:e.scrollLeft)||0:0}scrollY(){return this.wc("y")}scrollX(){return this.wc("x")}};const bu=t=>Bl(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);var wu=class{constructor(t,i,e,s){this.je=t=>{const i=this.kc();if(i&&i.sessionId===t)return;const e={sessionId:t,props:this.Sc(this._instance)};this.xc.register({[gt]:e})},this._instance=t,this.$c=i,this.xc=e,this.Sc=s||bu,this.$c.onSessionId(this.je)}kc(){return this.xc.props[gt]}getSetOnceProps(){var t;const i=null===(t=this.kc())||void 0===t?void 0:t.props;return i?"r"in i?zl(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){const t={};return Rr(Mr(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t[`$session_entry_${ai(e)}`]=i}),t}},$u=class{on(t,i){return this.ko[t]||(this.ko[t]=[]),this.ko[t].push(i),()=>{this.ko[t]=this.ko[t].filter(t=>t!==i)}}emit(t,i){for(const e of this.ko[t]||[])e(i);for(const e of this.ko["*"]||[])e(t,i)}constructor(){this.ko={}}};const xu=Pr("[SessionId]"),Su=864e5;var Eu=class{on(t,i){return this.Cc.on(t,i)}constructor(t,i,e){var s;if(this.Tc=null,this.Ic=null,this.Ec=[],this.Mc=void 0,this.Ac=!1,this.Cc=new $u,this.Rc=(t,i)=>!(!xi(t)||!xi(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.Dr=t.config,this.xc=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Pc=void 0,this._sessionActivityTimestamp=null,this.Oc=i||Gr,this.Fc=e||Gr;const n=this.Dr.persistence_name||this.Dr.token;if(this._sessionTimeoutMs=1e3*Ui(this.Dr.session_idle_timeout_seconds||1800,60,36e3,xu.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Dc(),this.Lc="ph_"+n+"_window_id",this.Nc="ph_"+n+"_primary_window_exists",this.jc()){const t=po.Ft(this.Lc),i=po.Ft(this.Nc);t&&!i?this.Be=t:po.Dt(this.Lc),po.$t(this.Nc,!0)}(null===(s=this.Dr.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this.Dr.bootstrap.sessionID),this.qc()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return _i(this.Ec)&&(this.Ec=[]),this.Ec.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Ec=this.Ec.filter(i=>i!==t)}}jc(){return"memory"!==this.Dr.persistence&&!this.xc.fi&&po.Ot()}Bc(t){t!==this.Be&&(this.Be=t,this.jc()&&po.$t(this.Lc,t))}zc(){return this.Be?this.Be:this.jc()?po.Ft(this.Lc):null}Hc(t){const i=this.Tc;return!bi(i)&&!bi(t)&&5e3>Math.abs(t-i)}Uc(t,i,e){const s=i!==this._sessionActivityTimestamp,n=!(t!==this.Xt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Xt=t,n&&!s||n&&this.Hc(i)||(this.Tc=i,this.xc.register({[tt]:[i,t,e]}))}Wc(){var t;const i=null===(t=this.Dr)||void 0===t?void 0:t.persistence_save_debounce_ms;return xi(i)&&i>0}Vc(){this.Wc()?this.xc.refreshKey(tt):(this.xc.flush(),this.xc.load())}Gc(){var t;if(bi(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Tc)return;this.Vc();const[,i,e]=this.Qc();i===this.Xt&&e===this._sessionStartTimestamp&&(this.Tc=this._sessionActivityTimestamp,this.xc.register({[tt]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.xc.flush())}Jc(){const[t]=this.Qc(),i=xi(t)?t:0,e=xi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Zc(t){return this.Vc(),this.Rc(t,this.Jc())}Qc(){const t=this.xc.props[tt];return vi(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Tc=null,this.Pc=void 0,clearTimeout(this.Kc),this.Kc=void 0,this.Uc(null,null,null)}setBootstrapSessionId(t,i=!1){const e=((t,i=(new Date).getTime())=>{try{const e=(t=>{const i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(t);return e>i+6e4?void xu.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void xu.error("Invalid sessionID in bootstrap",t)}})(t);return!_i(e)&&(i?this.Pc={sessionId:t,sessionStartTimestamp:e}:this.Uc(t,(new Date).getTime(),e),!0)}destroy(){this.Ac=!0,this.Gc(),clearTimeout(this.Kc),this.Kc=void 0,this.Mc&&qt&&(qt.removeEventListener(jt,this.Mc,{capture:!1}),this.Mc=void 0),this.Ec=[]}qc(){this.Mc=()=>{this.Gc(),this.jc()&&po.Dt(this.Nc)},Lr(qt,jt,this.Mc,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,i=null,e=!1){if("always"===this.Dr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=i||(new Date).getTime(),n=this.Xt;if(e)this.Ic=s;else if(bi(this.Ic)||this.Ic>s||s-this.Ic>=1e3){var r,o;null===(r=(o=this.xc).syncCookieProperties)||void 0===r||r.call(o),this.Ic=s}let[,l,a]=this.Qc();const u=!_i(n)&&l!==n,h=this.Jc();let c=this.zc();const d=this.Pc,v=!!d&&(d.sessionStartTimestamp>s+6e4||s-d.sessionStartTimestamp>Su),f=d?v:xi(a)&&Math.abs(s-a)>Su;let p=!1,g=u,_=!l||!!d;const m=l;let y=!_&&!t&&this.Rc(s,h);if(y&&(y=this.Zc(s),y||xu.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Qc(),y||(_=!l||!!d)),_||y||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.Oc(),c=this.Fc(),xu.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:s,this.Pc=void 0,p=!0}else c||(c=this.Fc(),p=!0),g=g||l!==m,g&&(xu.info("adopted cross-tab session id",{sessionId:l,windowId:c}),p=!0);const b=xi(h)&&t&&!f?h:s,w=xi(a)?a:(new Date).getTime();this.Bc(c),this.Uc(l,b,w),t||this.Dc();const x={noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.Ec.forEach(t=>t(l,c,x)),{sessionId:l,windowId:c,sessionStartTimestamp:w,changeReason:p?x:void 0,lastActivityTimestamp:h}}Dc(){this.Ac||(clearTimeout(this.Kc),this.Kc=setTimeout(()=>{if(!this.Ac)if(this.Zc((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Cc.emit("forcedIdleReset",{idleSessionId:t})}else this.Dc()},1.1*this.sessionTimeoutMs))}};const ku=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]),Tu=function(t,i){if(!t)return!1;const e=t.userAgent;if(e&&ji(e,i))return!0;try{const e=null==t?void 0:t.userAgentData;if((null==e?void 0:e.brands)&&e.brands.some(t=>ji(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function Pu(){return(Pu=Di(function*(){const t=null==Vt?void 0:Vt.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return mi(e)&&e.length>0?e:void 0}catch(t){return void Tr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Ou(t,i){let e=`$survey_${i}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(e=`$survey_${i}/${t.id}/${t.current_iteration}`),e}function Ru(t){var i;return!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}const Au=(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}},Cu=t=>t.toLowerCase(),Iu={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=>Au(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!Au(i,t))),icontains:(t,i)=>i.map(Cu).some(i=>t.map(Cu).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(Cu).every(i=>t.map(Cu).every(t=>!i.includes(t))),gt:(t,i)=>i.some(i=>{const e=parseFloat(i);return!isNaN(e)&&t.some(t=>e>parseFloat(t))}),lt:(t,i)=>i.some(i=>{const e=parseFloat(i);return!isNaN(e)&&t.some(t=>e<parseFloat(t))})};function Mu(t,i){return!t||Object.entries(t).every(([t,e])=>{const s=null==i?void 0:i[t];if(null==s)return!1;const n=Iu[e.operator];return!!n&&n(e.values.map(String),[String(s)])})}function Fu(t,i,e){return kl({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}const Du="custom",Nu="i.posthog.com",Lu=/^\/static\//,ju=["/s/","/e/","/i/"];var Uu=class{constructor(t){this.Yc={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let i=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace(`.${Nu}`,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.Yc[this.apiHost]||(this.Yc[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":Du),this.Yc[this.apiHost]}Xc(t){if(!Lu.test(t))return;const i=this.instance.config.asset_host;return"string"==typeof i&&i.trim().replace(/\/$/,"")||void 0}eh(t){const i=$l(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}ih(t,i,e){if("ui"===t)return e;let s=e;const n=this.instance.config.rewriteRequestPath;if(n){var r;const t=(null===(r=$l(e))||void 0===r?void 0:r.href)||e;s=n(new URL(t)).toString()}if(n&&"api"===t&&ju.some(t=>0===i.indexOf(t))){const t=this.eh(s);if(t){const i=this.apiHost;let e=this.nh;(null==e?void 0:e.apiHost)===i&&e.rewriteRequestPath===n||(e={apiHost:i,rewriteRequestPath:n,urls:new Set},this.nh=e),e.urls.add(t)}}return s}isIngestionEndpoint(t){const i=this.nh,e=this.eh(t);return(null==i?void 0:i.apiHost)===this.apiHost&&i.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&i.urls.has(e)}endpointFor(t,i=""){if(i&&(i="/"===i[0]?i:`/${i}`),"ui"===t)return this.ih(t,i,this.uiHost+i);if("flags"===t)return this.ih(t,i,this.flagsApiHost+i);if("assets"===t){const e=this.Xc(i);if(e)return this.ih(t,i,`${e}${i}`)}if(this.region===Du)return this.ih(t,i,this.apiHost+i);const e=Nu+i;switch(t){case"assets":return this.ih(t,i,`https://${this.region}-assets.${e}`);case"api":return this.ih(t,i,`https://${this.region}.${e}`)}}};const Bu=Pr("[Surveys]"),zu=t=>{try{const i=(t=>((t,i)=>`seenSurvey_${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(i)}`)(0,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){Bu.error("Failed to persist survey seen state",t)}},Hu=[ra.Popover,ra.Widget,ra.API],qu={ignoreConditions:!1,ignoreDelay:!1,displayType:aa.Popover},Wu=Pr("[PostHog ExternalIntegrations]"),Vu={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var Gu=class{constructor(t){this._instance=t}Pl(t,i){var e,s;null===(e=ii.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,t,t=>{if(t)return Wu.error("failed to load script",t);i()})}startIfEnabledOrStop(){var t;for(const[n,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var i,e,s;r&&!(null===(i=ii.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&this.Pl(Vu[n],()=>{var t;null===(t=ii.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[n])||void 0===t||t.start(this._instance)}),!r&&(null===(e=ii.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[n])&&(null===(s=ii.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop())}}},Ku=class{constructor(t){this.disabled=!1===t;const i=pi(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(t-s.x)+Math.abs(i-s.y)<this.thresholdPx&&this.timeoutMs>e-s.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}};const Yu=()=>typeof window>"u"?void 0:window,Ju=()=>typeof document>"u"?void 0:document,Xu="$copy_autocapture",Zu=["password","hidden","file","checkbox","button","submit","reset","image"],Qu=Pr("[AutoCapture]");function th(t,i){return i.length>t?i.slice(0,t)+"...":i}function ih(t){if(t.previousElementSibling)return t.previousElementSibling;let i=t;do{i=i.previousSibling}while(i&&!yo(i));return i}function eh(t,{e:i,maskAllElementAttributes:e,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:r,disableCaptureUrlHashes:o}){var l,a;if(!yo(t))return{props:{}};const u=[t],h=new Set([t]);let c=t;for(;c.parentNode&&!bo(c,"body")&&1e3>u.length;){if($o(c.parentNode)){const t=c.parentNode.host;if(h.has(t))break;h.add(t),u.push(t),c=t;continue}if(!yo(c.parentNode))break;if(h.has(c.parentNode))break;h.add(c.parentNode),u.push(c.parentNode),c=c.parentNode}const d="click"===i.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(t=>bo(t,"button")||bo(t,"a")):-1;d>0&&(s=s||u.slice(0,d+1).some(t=>!Go(t)||Ko(t)));const v=[],f={};let p,g=!1,_=!1;if(Rr(u,t=>{const i=Go(t);if(bo(t,"a")&&!e&&!(null==n?void 0:n.includes("href"))){const e=t.getAttribute("href");g=!!(i&&e&&el(e))&&(o?ts(e):e)}oi(Eo(t),"ph-no-capture")&&(_=!0),v.push(function(t,i,e,s,n=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};Oo.indexOf(r)>-1&&!e&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?th(1024,sl(t)):th(1024,To(t)));const l=Eo(t);i||(null==s?void 0:s.includes("class"))||0>=l.length||(o.classes=l.filter(function(t){return""!==t})),Rr(t.attributes,function(e){var r;if((!Ko(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&!(null==s?void 0:s.includes(e.name))&&!i&&el(e.value)&&(!mi(r=e.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=e.value;"class"===e.name&&(t=xo(t).join(" ")),o["attr__"+e.name]=th(1024,"href"===e.name&&n?ts(t):t)}});let a=1,u=1,h=t;for(;h=ih(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,e,s,n,o)),Rr(function(t){if(!Go(t))return{};const i={};return Rr(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const e=t.name.replace("data-ph-capture-attribute-",""),s=t.value;e&&s&&el(s)&&(i[e]=s)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(f,i)||(f[i]=t)})}),_)return{props:{},explicitNoCapture:_};if(d>0&&(t=u[d],v.splice(0,d)),s||(v[0].$el_text=bo(t,"a")||bo(t,"button")?sl(t):To(t)),g){var m,y;v[0].attr__href=g;const t=null===(m=$l(g))||void 0===m?void 0:m.host,i=null===(y=Yu())||void 0===y||null===(y=y.location)||void 0===y?void 0:y.host;t&&i&&t!==i&&(p=g)}return{props:Ar((w=i.type,{$event_type:w,$ce_version:1}),r?{}:{$elements:v},{$elements_chain:(b=v,vi(b)?function(t){return t.map(t=>{var i,e;let s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class){t.attr_class.sort();for(const i of t.attr_class)s+=`.${i.replace(/"/g,"")}`}const n=as(as(as(as({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return Cr(n).sort(([t],[i])=>function(t,i){return i>t?-1:t>i?1:0}(t,i)).forEach(([t,i])=>r[rl(t.toString())]=rl(i.toString())),s+=":",s+=Cr(r).map(([t,i])=>`${t}="${i}"`).join(""),s}).join(";")}(function(t){return t.map(t=>{var i,e;const s={text:null===(i=t.$el_text)||void 0===i?void 0:i.slice(0,400),tag_name:t.tag_name,href:null===(e=t.attr__href)||void 0===e?void 0:e.slice(0,2048),attr_class:ol(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Cr(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,i])=>s.attributes[t]=i),s})}(b)):"")},(null===(l=v[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(a=v[0])||void 0===a?void 0:a.$el_text}:{},p&&"click"===i.type?{$external_click_url:p}:{},f),target:t};var b,w}const sh="autocapture";var nh=class{sl(){this.rl=void 0,clearTimeout(this.al),this.al=void 0}ll(t){var i;if(!Go(t))return!0;const e=null!==(i=this.ul().css_selector_ignorelist)&&void 0!==i?i:Io,s=new Set;let n=t;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const t=n,i=Eo(t);if(oi(i,"ph-no-capture")||oi(i,"ph-sensitive")||Ko(t)||e.some(i=>Ro(t,i)))return!0;const r=n.parentNode;n=$o(r)?r.host:r&&yo(r)?r:null}return!1}cl(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.sl();if("pointerdown"===t.type){var i;this.sl();const e=Po(t);return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&e&&yo(e)&&(this.rl={target:e,excluded:this.ll(e),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(i=this.Ta)||void 0===i?void 0:i.distinctId}))}const e=this.rl;e&&(t.pointerId!==e.id||Math.abs(t.clientX-e.x)>5||Math.abs(t.clientY-e.y)>5?this.sl():"pointerup"===t.type&&(e.released=!0,this.al=setTimeout(()=>this.sl(),0)))}hl(t){var i;const e=this.rl;this.sl();const s=Po(t);if((null==e?void 0:e.released)&&e.target.isConnected&&e.distinctId===(null===(i=this.Ta)||void 0===i?void 0:i.distinctId)&&t.pointerId===e.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-e.x)&&5>=Math.abs(t.clientY-e.y)&&s&&(bo(s,"html")||bo(s,"body"))){var n,r,o;if(e.excluded)return null;const t=null!==(n=this.ul().css_selector_ignorelist)&&void 0!==n?n:Io;return[s,null===(r=Ju())||void 0===r?void 0:r.documentElement,null===(o=Ju())||void 0===o?void 0:o.body].some(i=>{if(!i)return!1;const e=Eo(i);return oi(e,"ph-no-capture")||oi(e,"ph-sensitive")||!Go(i)||Ko(i)||t.some(t=>Ro(i,t))})?null:e.target}}constructor(t){this.Ma=t,this.name=sh,this.dl=!1,this.vl=null,this.fl=!1,this.pl=new Map,this.gl=!1,this.Dr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Ti=!1,this.Ma.refresh(this.Dr),this.rageclicks=new Ku(this.Dr.rageclick),this.ml=null}setup(t){this.yl(),this.Ta=t;const i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Ti?i.dispose():(this.za=i,this.startIfEnabled())}dispose(){var t;this.Ti||(this.Ti=!0,this.Ta=void 0,null===(t=this.za)||void 0===t||t.dispose(),this.za=void 0,this.pl.clear(),this.ml=null,this.bl())}ul(){return this.Ma.refresh(this.Dr),this.Dr}yl(){var t,i;return this.ul(),this.Dr.url_allowlist=null===(t=this.Dr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Dr.url_ignorelist=null===(i=this.Dr.url_ignorelist)||void 0===i?void 0:i.map(t=>new RegExp(t)),this.Dr}_l(){const t=Yu(),i=Ju();if(!this.isBrowserSupported())return void Qu.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!i)return;this.wl=t,this.kl=i;const e=this.Sl=i=>{i=i||(null==t?void 0:t.event);try{if("blur"===i.type)return void this.sl();if(0===i.type.indexOf("pointer"))return void this.cl(i);const t="click"===i.type?this.hl(i):void 0;if(bi(t))return;this.xl(i,"$autocapture",t)}catch(t){Qu.error("Failed to capture event",t)}};if(Lr(t,"blur",e),Lr(i,"submit",e,{capture:!0}),Lr(i,"change",e,{capture:!0}),Lr(i,"click",e,{capture:!0}),Rr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Lr(i,t,e,{capture:!0})}),this.ul().capture_copied_text){const e=this.$l=i=>{i=i||(null==t?void 0:t.event);try{this.xl(i,Xu)}catch(t){Qu.error("Failed to capture clipboard event",t)}};Lr(i,"copy",e,{capture:!0}),Lr(i,"cut",e,{capture:!0}),Lr(i,"paste",e,{capture:!0})}}bl(){const t=this.wl,i=this.kl;this.sl(),this.Sl&&(null==t||t.removeEventListener("blur",this.Sl),Rr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==i||i.removeEventListener(t,this.Sl,!0)}),null==i||i.removeEventListener("submit",this.Sl,!0),null==i||i.removeEventListener("change",this.Sl,!0),null==i||i.removeEventListener("click",this.Sl,!0),this.Sl=void 0),this.$l&&(null==i||i.removeEventListener("copy",this.$l,!0),null==i||i.removeEventListener("cut",this.$l,!0),null==i||i.removeEventListener("paste",this.$l,!0),this.$l=void 0),this.wl=void 0,this.kl=void 0,this.dl=!1}startIfEnabled(){this.isEnabled||this.sl(),!this.Ti&&this.Ta&&this.isEnabled&&!this.dl&&(this._l(),this.dl=!0)}onRemoteConfig(t){if(this.Ti)return;if(this.fl=!0,!t.ok)return void this.startIfEnabled();const i=t.config;i.elementsChainAsString&&(this.gl=i.elementsChainAsString);const e=i.autocapture_opt_out;var s;Si(e)&&(null===(s=this.Ta)||void 0===s||s.kv.set("$autocapture_disabled_server_side",e),this.vl=e),this.startIfEnabled()}setElementSelectors(t,i=this){if(this.Ti)return;t.size?this.pl.set(i,new Set(t)):this.pl.delete(i);const e=new Set;this.pl.forEach(t=>{t.forEach(t=>e.add(t))}),this.ml=e}getElementSelectors(t,i){var e;const s=[];return null===(e=this.ml)||void 0===e||e.forEach(e=>{var n;const r=null===(n=Ju())||void 0===n?void 0:n.querySelectorAll(e);null==r||r.forEach(n=>{t!==n&&i!==n||oi(s,e)||s.push(e)})}),s}get isEnabled(){var t,i;if(this.Ti)return!1;const e=null===(t=this.Ta)||void 0===t?void 0:t.kv.get(y),s=this.vl,n=this.ul();if(!n.remoteRequestsDisabled&&!this.fl)return!1;const r=n.remoteRequestsDisabled&&!this.fl;if(bi(s)&&!Si(e)&&!r)return!1;const o=null!==(i=this.vl)&&void 0!==i?i:!!e;return!!n.enabled&&!o}xl(t,i="$autocapture",e){if(!this.isEnabled)return void this.sl();let s=e||Po(t);wo(s)&&(s=s.parentNode||null);const n=this.yl();var r;"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&(null===(r=this.rageclicks)||void 0===r?void 0:r.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime()))&&qo(s,n.rageclick)&&this.xl(t,"$rageclick",e);const o=i===Xu,l=o?as(as({},n),{},{dom_event_allowlist:void 0}):n;if(s&&function(t,i,e,s,n,r){var o;const l=typeof window>"u"?void 0:window;if(!l||Wo(t))return!1;if((null==e?void 0:e.url_allowlist)&&!So(e.url_allowlist,r))return!1;if((null==e?void 0:e.url_ignorelist)&&So(e.url_ignorelist,r))return!1;if(null==e?void 0:e.dom_event_allowlist){const t=e.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:a,targetElementList:u}=Vo(t,s);if(!function(t,i){const e=null==i?void 0:i.element_allowlist;if(_i(e))return!0;for(const i of t)if(e.some(t=>i.tagName.toLowerCase()===t))return!0;return!1}(u,e))return!1;if(!Ao(u,null==e?void 0:e.css_selector_allowlist))return!1;if(Ao(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:Io))return!1;try{const e=l.getComputedStyle(t);if(e&&"pointer"===e.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const h=t.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return a?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(Oo.indexOf(h)>-1||"true"===t.getAttribute("contenteditable"))}}(s,t,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var a;const{props:e,explicitNoCapture:r,target:o}=eh(s,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.gl,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(r)return!1;const l=this.getElementSelectors(s,o);if(l&&l.length>0&&(e.$element_selectors=l),i===Xu){const i=t.type||"clipboard";if("paste"!==i){var u,h;const t=null===(u=Yu())||void 0===u||null===(u=u.getSelection())||void 0===u?void 0:u.toString(),i=ko(t);if(!i)return!1;e.$selected_content=i,e.$clipboard_text_length=null!==(h=null==t?void 0:t.length)&&void 0!==h?h:0}e.$copy_type=i}if("$autocapture"===i&&"change"===t.type&&n.capture_value_css_selector_allowlist&&!n.maskAllText&&(bo(c=s,"input")?!oi(Zu,c.type):bo(c,"textarea")||bo(c,"select")&&!c.multiple)&&function(t,i){var e;if(!Go(t))return!1;const s=null!==(e=i.css_selector_ignorelist)&&void 0!==e?e:Io,n=new Set;let r=t;for(bo(t,"select")&&(r=t.options[t.selectedIndex]||t);r;){const t=r,i=Eo(t);if(n.size>=1e3||n.has(r)||oi(i,"ph-sensitive")||oi(i,"ph-no-capture")||s.some(i=>Ro(t,i)))return!1;n.add(r);const e=r.assignedSlot||r.parentNode;r=$o(e)?e.host:e&&yo(e)?e:null}return!0}(s,n)&&!s.querySelector(".ph-no-capture, .ph-sensitive")){const t=n.capture_value_css_selector_allowlist;let i=!1;try{i=fi(t)?!!t(s):vi(t)&&t.some(t=>Ro(s,t))}catch(t){Qu.error("capture_value_css_selector_allowlist threw",t)}i&&(e.$input_value=s.value)}return null===(a=this.Ta)||void 0===a||a.capture(i,e),!0}var c}isBrowserSupported(){var t;return fi(null===(t=Ju())||void 0===t?void 0:t.querySelectorAll)}};const rh="featureFlags",oh="logs";var lh=class{constructor(t){this._instance=t}initialize(){}get(t){const i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);const e={};for(const s of t){const t=null==i?void 0:i.get_property(s);_i(t)||(e[s]=t)}return e}set(t,i){var e;null===(e=this._instance.persistence)||void 0===e||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null===(i=this._instance.persistence)||void 0===i||i.unregister(t)}},ah=class{constructor(t){this.instance=t,this.A=Tr,this.kv=new lh(t),this.onSession=t=>ua(this.instance.onSessionId(i=>{try{t(i)}catch(t){this.A.error("Browser extension session listener failed",t)}})),this.onEvent=t=>ua(this.instance._addCaptureHook((i,e)=>{if(e)try{t({event:i,properties:e.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{const i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.dr.on("extensionsRemoteConfig",i);return this.instance.vr&&i(this.instance.vr),ua(e)}}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(){const t=this.instance.get_property(O);return"string"==typeof t?t:void 0}get library(){return{name:e.LIB_NAME,version:e.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,s,n;const r=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==r?void 0:r.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==r?void 0:r.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(s=null==r?void 0:r.sessionStartTimestamp)&&void 0!==s?s:0,lastActivityTimestamp:null!==(n=null==r?void 0:r.lastActivityTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return fi(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(t){let i;switch(t){case rh:case"featureFlagsCommon":i=this.instance.featureFlags;break;case oh:i=this.instance.logs;break;case"surveys":i=this.instance.surveys;break;case sh:i=this.instance.autocapture}return i}capture(t,i,e){if(!e)return void this.instance.capture(t,i);const s=as({timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce},"unload"===e.delivery?{transport:"sendBeacon",send_instantly:!0}:{});this.instance.capture(t,i,s)}registerDynamicEventProperties(t){return ua(this.instance.pr(t))}sendRequest(t){var i=this;return Di(function*(t,e={}){var s;const n=null!==(s=e.target)&&void 0!==s?s:"api",r=e.query?iu(t,e.query):t,o=i.instance.requestRouter.endpointFor(n,r),l={method:e.method,url:o,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?si.Base64:void 0,timestampMode:e.sentAt};return"api"===n&&"/i/v1/logs"===t&&(l.batchKey="logs"),"sendBeacon"===e.transport?(i.instance._send_request(l),{statusCode:202}):new Promise(t=>{l.callback=t,i.instance._send_request(l)})}).apply(this,arguments)}};const uh={};let hh=0;const ch=()=>{},dh='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',vh="Surveys module not available",fh="sanitize_properties is deprecated. Use before_send instead",ph="Invalid value for property_denylist config: ",gh=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],_h=["$feature_flag_called","$$heatmap","$snapshot"],mh=t=>"$"===t.charAt(0)&&!oi(_h,t),yh=/^[A-Za-z0-9_-]{1,400}$/,bh=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,wh=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,$h=["token","distinct_id",xt],xh="posthog",Sh=[...ku].sort()[ku.length-1],Eh=t=>{const i={};return t&&"unset"!==t?("2025-11-30">t||(i.strictMinimumDuration=!0),"2026-05-30">t||(i.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(i.streamNetworkBody=!0),"2026-08-30">t||(i.captureJsonLd=!0),i):i},kh=t=>{var i;return as({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Nr(null==Gt?void 0:Gt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ch,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_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Kt&&mi(null==Kt?void 0:Kt.search)&&-1!==Kt.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==qt||null===(i=qt.location)||void 0===i?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,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(t){Tr.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:Lt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:ch},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Fo,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Eh(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))},Th=[["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"]],Ph=t=>{const i={};for(const[e,s]of Th)_i(t[e])||(i[s]=t[e]);const e=Ar({},i,t),s=t.__preview_external_dependency_versioned_paths;return _i(s)||(_i(t.strict_script_versioning)&&(e.strict_script_versioning=!!s),mi(s)&&_i(t.asset_host)&&(e.asset_host=s)),vi(t.property_blacklist)&&(_i(t.property_denylist)?e.property_denylist=t.property_blacklist:vi(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Tr.error(ph+t.property_denylist)),e};var Oh=class{constructor(){this.__forceAllowLocalhost=!1}get sh(){return this.__forceAllowLocalhost}set sh(t){Tr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Rh=class t{rh(t){if(!t)return;const i=this.oh.indexOf(t);-1!==i&&this.oh.splice(i,1)}ah(t,i){var e;return this.rh(t),this.oh.push(i),null===(e=i.initialize)||void 0===e||e.call(i),i}uh(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}hh(){if(this.dh)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.uh())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.fh)return;let i,e,s;t?(i=`persistence is set to '${this.config.persistence}'`,e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",s="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(i="persistence is disabled (disable_persistence is true)",e="on every page load",s="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.dh=!0,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${e}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${s}`)}ph(){const t=this.persistence;if(!t||this.gh)return;if(this.uh())return void("on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this.mh(),this.yh()));if("$posthog_cookieless"!==this.get_distinct_id())return;this.bh()||t.load(!0);const i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){const i=this.config.get_device_id(Gr());this.register({distinct_id:i,$device_id:i}),t.set_property(pt,Dt)}this.mh()}get decideEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var i;this._h=!1,this.wh=!1,this.webPerformance=new Oh,this.kh=!1,this.version=e.LIB_VERSION,this.Sh=new Set,this.xh="",this.dr=new $u,this.oh=[],this.$h=[],this.Ch=!1,this.fh=!1,this.dh=!1,this.gh=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=kh(),this.SentryIntegration=pl,this.sentryIntegration=t=>function(t,i){const e=fl(t,i);return{name:vl,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Th=!1,this.Ih=null,this.Eh=null,this.Mh=null,this.scrollManager=new yu(this),this.pageViewManager=new gl(this),this.rateLimiter=new va(this),this.requestRouter=new Uu(this),this.consent=new go(this),this.externalIntegrations=new Gu(this);const s=null!==(i=t.__defaultExtensionClasses)&&void 0!==i?i:{};this.featureFlags=s.featureFlags&&new s.featureFlags(this),this.toolbar=s.toolbar&&new s.toolbar(this),this.surveys=s.surveys&&new s.surveys(this),this.conversations=s.conversations&&new s.conversations(this),this.logs=s.logs&&new s.logs(this),this.metrics=s.metrics&&new s.metrics(this),this.experiments=s.experiments&&new s.experiments(this),this.exceptions=s.exceptions&&new s.exceptions(this),this.people={set:(t,i,e)=>{const s=mi(t)?{[t]:i}:t;this.setPersonProperties(s),null==e||e({})},set_once:(t,i,e)=>{const s=mi(t)?{[t]:i}:t;this.setPersonProperties(void 0,s),null==e||e({})}},this.on("eventCaptured",t=>Tr.info(`send "${null==t?void 0:t.event}"`,t))}init(i,e,s){if(s&&s!==xh){var n;const r=null!==(n=uh[s])&&void 0!==n?n:new t;return r._init(i,e,s),uh[s]=r,uh[xh][s]=r,r}return this._init(i,e,s)}_init(t,i={},s){var n,r,o;const l=mi(t)?t.trim():"";if(!l)return Tr.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var a;if(this.__loaded)return l!==(null===(a=this.config)||void 0===a?void 0:a.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${l}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=kh(i.defaults),i.debug=this.Ah(i.debug),this.Rh=i,this.Ph=[],i.person_profiles?this.Eh=i.person_profiles:i.process_person&&(this.Eh=i.process_person);const u=kh(i.defaults),h=Ph(i),c=Ar({},u,h,{name:s,token:l});pi(u.rageclick)&&pi(h.rageclick)&&(c.rageclick=Ar({},u.rageclick,h.rageclick)),pi(u.session_recording)&&pi(h.session_recording)&&(c.session_recording=Ar({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&Tr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:sa.GZipJS;const d=this.bh(),v=!this.uh();if(this.persistence=new ea(this.config,d,!0,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ea(as(as({},this.config),{},{persistence:"sessionStorage"}),d,!1,v),this.xh="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&po.Ot()){const t=po.Ft(this.xh);vi(t)&&t.forEach(t=>{mi(t)&&this.Sh.add(t)})}else po.Dt(this.xh);const f=as({},this.persistence.props),p=as({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Oh=new gu((t,i)=>this.Fh(t,i),this.config.request_queue_config),this.Dh=new mu(this),this.__request_queue=[];const g=this.uh();g||(this.sessionManager=new Eu(this),this.sessionPropsManager=new wu(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,i,e)=>{((null==e?void 0:e.activityTimeout)||(null==e?void 0:e.sessionPastMaximumLength)||(null==e?void 0:e.crossTabAdoption))&&this.Lh()})),this.Nh(),this.config.__preview_deferred_init_extensions?(Tr.info("Deferring extension initialization to improve startup performance"),this.jh=setTimeout(()=>{this.jh=void 0,this.qh(g)},0)):(Tr.info("Initializing extensions synchronously"),this.qh(g)),e.DEBUG=e.DEBUG||this.config.debug,e.DEBUG&&Tr.info("Starting in debug mode",{this:this,config:i,thisC:as({},this.config),p:f,s:p}),this.config.identity_distinct_id&&!(null===(n=i.bootstrap)||void 0===n?void 0:n.distinctID)&&(i.bootstrap=as(as({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const _=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this.fh=!!_&&!yi(_),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const t=i.bootstrap.distinctID,e=this.get_distinct_id(),s=this.persistence.get_property(pt);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===s)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===s)Tr.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const e=this.config.get_device_id(Gr()),s=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property(pt,i.bootstrap.isIdentifiedID?Nt:Dt),this.register({distinct_id:t,$device_id:s})}}if(g)this.register_once({distinct_id:$t,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(Gr());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(pt,Dt)}return Lr(qt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Lr(qt,"pageshow",t=>{if(this._h=!1,!this.wh){var i;if(t.persisted&&this.persistence){const t=this.persistence.get_property(P),i=this.persistence.get_property(pt);this.persistence.load(),this.Bh()||t===this.persistence.get_property("distinct_id")&&i===this.persistence.get_property("$user_state")||this.zh()}null===(i=this.Dh)||void 0===i||i.resume()}}),i.segment?dl(this,()=>this.Hh()):this.Hh(),fi(this.config._onCapture)&&this.config._onCapture!==ch&&(Tr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Tr.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 Pu.apply(this,arguments)}().then(t=>{t&&this.register({[R]:t})}).catch(ch),this}Uh(t){const i=t;return mi(i.name)&&fi(i.setup)}Wh(t,i){var e=this;this.Uh(t)?i.push(Di(function*(){try{yield t.setup(e.Vh())}catch(e){Tr.error(`Failed to set up extension "${t.name}"`,e);try{var i;yield null===(i=t.dispose)||void 0===i?void 0:i.call(t)}catch(i){Tr.error(`Failed to dispose extension "${t.name}"`,i)}}})):this.oh.push(t)}Nh(){var i,e,s,n=this;const r=null!==(i=null===(e=this.config.__extensionClasses)||void 0===e?void 0:e.featureFlags)&&void 0!==i?i:null===(s=t.__defaultExtensionClasses)||void 0===s?void 0:s.featureFlags;var o,l,a;if(r)if(this.featureFlags&&this.featureFlags instanceof r||(null===(o=this.Gh)||void 0===o||o.call(this),this.Gh=void 0,this.featureFlags=new r(this)),fi(this.featureFlags.onReloading)&&fi(this.featureFlags.setup)){if(!this.Gh){this.Gh=this.featureFlags.onReloading(()=>{this.dr.emit("featureFlagsReloading",!0)});const t=this.featureFlags;Di(function*(){try{yield t.setup(n.Vh())}catch(i){Tr.error("Failed to set up feature flags",i);const e=n.Gh;n.Gh=void 0;try{null==e||e()}catch(t){Tr.error("Failed to unsubscribe feature flag reloading",t)}try{yield t.dispose()}catch(t){Tr.error("Failed to dispose feature flags",t)}}})()}}else null===(l=(a=this.featureFlags).initialize)||void 0===l||l.call(a)}qh(i){const e=performance.now(),s=as(as({},t.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,l,a,u,h,c,d;s.exceptions&&this.oh.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this.oh.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.oh.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.oh.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!i&&this.oh.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.Wh(this.autocapture=new s.autocapture(this),n),s.surveys&&this.Wh(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this.Wh(this.logs=null!==(l=this.logs)&&void 0!==l?l:new s.logs(this),n),s.metrics&&this.oh.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new s.metrics(this)),s.conversations&&this.oh.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new s.conversations(this)),s.productTours&&this.oh.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.oh.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.oh.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.oh.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.oh.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,ul)),s.toolbar&&this.oh.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new s.toolbar(this)),s.experiments&&this.oh.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new s.experiments(this)),s.webMCP&&this.oh.push(this.webMCP=null!==(d=this.webMCP)&&void 0!==d?d:new s.webMCP(this)),this.oh.forEach(t=>{t.initialize&&n.push(()=>{var i;null===(i=t.initialize)||void 0===i||i.call(t)})}),n.push(()=>{if(this.Qh){const t=this.Qh;this.Qh=void 0,this.oh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}}),this.Jh(n,e)}Jh(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void(this.jh=setTimeout(()=>{this.jh=void 0,this.Jh(t,i)},0));const e=t.shift();if(e)try{e()}catch(t){Tr.error("Error initializing extension:",t)}}const e=Math.round(performance.now()-i);this.register_for_session({[St]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Et]:e}),this.config.__preview_deferred_init_extensions&&Tr.info(`PostHog extensions initialized (${e}ms)`)}Ku(t){if(!Gt||!Gt.body)return Tr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Ku(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Qh=t),this.vr=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=oi(e.supportedCompression,sa.GZipJS)?sa.GZipJS:oi(e.supportedCompression,sa.Base64)?sa.Base64:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.Eh?this.Eh:Lt}),this.dr.emit("extensionsRemoteConfig",t),this.oh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}Hh(){try{this.config.loaded(this)}catch(t){Tr.critical("`loaded` function failed",t)}if(this.Zh(),this.config.internal_or_test_user_hostname&&(null==Kt?void 0:Kt.hostname)){const t=Kt.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.uh())&&this.Kh()},1),this.Yh=new pa(this),this.Yh.load()}Zh(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Oh)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Or(this.__request_queue,t=>this.Fh(t)),this.__request_queue=[],this.Zh()}_handle_unload(){var t,i,e,s,n,r;this._h=!0,null===(t=this.surveys)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t),null===(e=this.metrics)||void 0===e||e.flush("sendBeacon"),this.config.request_batching?(this.Xh()&&this.capture(Bt),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this.Oh)||void 0===n||n.unload(),null===(r=this.Dh)||void 0===r||r.unload()):this.Xh()&&this.capture(Bt,null,{transport:"sendBeacon"})}_send_request(t){pu(this,t)}Fh(t,i){this.Dh?this.Dh.retriableRequest(t,i):this._send_request(i?as(as({},t),{},{transport:i}):t)}_execute_array(t){hh++;try{let i;const e=[],s=[],n=[];Or(t,t=>{if(t)if(i=t[0],vi(i))n.push(t);else if(fi(t))try{t.call(this)}catch(i){Tr.error("Error executing queued PostHog call",t,i)}else vi(t)&&"alias"===i?e.push(t):vi(t)&&-1!==i.indexOf("capture")&&fi(this[i])?n.push(t):s.push(t)});const r=function(t,i){Or(t,function(t){try{if(vi(t[0])){let e=i;Rr(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){Tr.error("Error executing queued PostHog call",t,i)}})};r(e,this),r(s,this),r(n,this)}finally{hh--}}push(i){if(hh>0&&vi(i)&&mi(i[0])){const e=t.prototype[i[0]];return void(fi(e)&&e.apply(this,i.slice(1)))}this._execute_array([i])}get ed(){return{property:I,persistenceKey:M,cookieName:"_fbc",pattern:bh,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[M]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(M)}}}get nd(){return{property:F,persistenceKey:D,cookieName:"_fbp",pattern:wh,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[D]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(D)}}}sd(t){var i;const e=null===(i=this.persistence)||void 0===i?void 0:i.get_property(t.persistenceKey);return mi(e)&&t.pattern.test(e)?{value:e,delivered:!1}:pi(e)&&mi(e.value)&&t.pattern.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}rd(t,i,e){return i===(null==e?void 0:e.value)?{value:i,pending:!e.delivered}:(t.register(i,!1),{value:i,pending:!0})}od(t){if(!this.config.save_campaign_params||this.uh())return;const i=Ur(t.cookieName);return mi(i)&&t.pattern.test(i)?i:void 0}ad(t,i,e,s){if(!this.persistence)return;const n=this.ed;this.persistence.refreshMetaIdentifiers();const r=this.sd(n);if(s)return void n.unregister();if(e)return mi(i)&&bh.test(i)?this.rd(n,i,r):void n.unregister();const o=mi(t)&&yh.test(t)?t:void 0,l=this.od(n);return l&&((t,i,e)=>{const s=t.split(".");if(i)return s[3]===i;if(!e)return!0;const n=e.value.split(".");return s[3]===n[3]||Number(s[2])>Number(n[2])})(l,o,r)?this.rd(n,l,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.rd(n,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}ld(t,i,e){if(!this.persistence)return;const s=this.nd;this.persistence.refreshMetaIdentifiers();const n=this.sd(s);if(e)return void s.unregister();if(i)return mi(t)&&wh.test(t)?this.rd(s,t,n):void s.unregister();const r=this.od(s);return r?this.rd(s,r,n):n?{value:n.value,pending:!n.delivered}:void 0}ud(t,i){if(!this.persistence)return;this.persistence.refreshMetaIdentifiers();const e=this.sd(t);(null==e?void 0:e.value)!==i||e.delivered||t.register(i,!0)}capture(t,i,e){var s,n;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Oh))return void Tr.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void Tr.info(`Event "${t}" was not captured because capturing is disabled (opted out or consent pending).`);if(_i(t)||!mi(t))return void Tr.error("No event name provided to posthog.capture");if(this.ph(),"$snapshot"===t&&this.uh())return;const r=!this.config.opt_out_useragent_filter&&this._is_bot();if(r&&!this.config.__preview_capture_bot_pageviews)return void Tr.info(`Event "${t}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);const o=(null==e?void 0:e.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==o?void 0:o.isRateLimited)return void Tr.critical("This capture call is ignored due to client rate limiting.");let l;(null==i?void 0:i.$current_url)&&!mi(null==i?void 0:i.$current_url)&&(Tr.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||(null==e?void 0:e.hd)||Tr.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&&(l=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const a=new Date,u=(null==e?void 0:e.timestamp)||a,h=Ze(null==e?void 0:e.uuid,Gr);let c={uuid:h,event:t,properties:this.calculateEventProperties(t,i||{},u,h)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&r&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),o&&(c.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens);const d="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==e?void 0:e.$set)&&!d&&(c.$set=null==e?void 0:e.$set);const v=pi(null==i?void 0:i.$set)?i.$set:void 0,f=vi(null==i?void 0:i.$unset)?i.$unset:[],p=(null==e?void 0:e.$unset)||[],g=t=>{var i;const s=!!(null==e?void 0:e.$set)&&t in e.$set;return{hasProvided:s||!!v&&t in v,provided:s?null==e||null===(i=e.$set)||void 0===i?void 0:i[t]:null==v?void 0:v[t],unset:-1!==f.indexOf(t)||-1!==p.indexOf(t)}},_=g(I),m=g(F),y=[{channel:this.ed,hasProvided:_.hasProvided,update:this.ad(null==l?void 0:l.fbclid,_.provided,_.hasProvided,_.unset)},{channel:this.nd,hasProvided:m.hasProvided,update:this.ld(m.provided,m.hasProvided,m.unset)}];for(const{channel:t,hasProvided:i,update:e}of y)e&&!0===c.properties.$process_person_profile&&e.pending&&!i&&!d&&(c.$set=as({[t.property]:e.value},c.$set));const b=null==e?void 0:e.$unset;b&&(c.$unset=b);const w=d?void 0:this.dd(null==e?void 0:e.$set_once,t!==Ht,t===zt);if(w&&(c.$set_once=w),(null==e?void 0:e._noTruncate)||(x=this.config.properties_string_max_length,c=function(t,i){const e=new Set;return function t(s,n){if(s!==Object(s))return i?i(s):s;if(e.has(s))return;let r;if(e.add(s),vi(s))r=[],Or(s,i=>{r.push(t(i))});else{const i={};Rr(Oi(s)?Fr(s):s,(s,n)=>{e.has(s)||(i[n]=t(s,n))}),r=i}return r}(t)}(c,t=>mi(t)?t.slice(0,x):t)),c.timestamp=u,_i(null==e?void 0:e.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a),d&&(c.properties=((t,i=[])=>{const e={},s=i=>{void 0!==t[i]&&(e[i]=t[i])};return nn.forEach(s),i.forEach(s),e})(c.properties,$h)),t===oa.DISMISSED||t===oa.SENT){const e=null==i?void 0:i[la.SURVEY_ID],s=null==i?void 0:i[la.SURVEY_ITERATION];zu({id:e,current_iteration:s}),c.$set=as(as({},c.$set),{},{[Ou({id:e,current_iteration:s},t===oa.SENT?"responded":"dismissed")]:!0})}else t===oa.SHOWN&&(c.$set=as(as({},c.$set),{},{[la.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var x;if(t===ha.SHOWN){const t=null==i?void 0:i[ca.TOUR_TYPE];t&&(c.$set=as(as({},c.$set),{},{[`${ca.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const S=as(as({},c.properties.$set),c.$set);if(gi(S)||this.setPersonPropertiesForFlags(S),!wi(this.config.before_send)){const t=this.Fs(c);if(!t)return;c=t,c.uuid=Ze(c.uuid,Gr)}this.sessionRecording&&!this.Ch&&mh(t)&&(this.Ch=!0,setTimeout(()=>this.Ch=!1,3e4));const E=y.filter(({channel:t,update:i})=>{var e,s,n;const r=null!==(e=null===(s=c.$set)||void 0===s?void 0:s[t.property])&&void 0!==e?e:pi(null===(n=c.properties)||void 0===n?void 0:n.$set)?c.properties.$set[t.property]:void 0;return(null==i?void 0:i.pending)&&r===i.value});this.dr.emit("eventCaptured",c);const k=null!==(s=null==e?void 0:e._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),T="recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(k),P=as(as(as({method:"POST",url:k,data:c,compression:"best-available",preferSyncCompression:null==e?void 0:e.send_instantly,timestampMode:T?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},T&&(null===(n=c.properties)||void 0===n?void 0:n.$session_id)?{batchGroup:c.properties.$session_id+(c.properties.$window_id?`-${c.properties.$window_id}`:"")}:{}),(null==e?void 0:e.transport)?{transport:e.transport}:{}),E.length?{fireCallbackOnDrop:!0,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(const{channel:t,update:i}of E)this.ud(t,i.value)}}:{});if(!this.config.request_batching||e&&!(null==e?void 0:e._batchKey)||(null==e?void 0:e.send_instantly)){var O;let t;!P.transport&&!P.callback&&gi(null!==(O=this.config.request_headers)&&void 0!==O?O:{})&&this._h&&(t="sendBeacon"),this.Fh(P,t)}else this.Oh.enqueue(P);return c}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null===(i=this.vd)||void 0===i?void 0:i.getExtension(t)}Vh(){var t;return null!==(t=this.vd)&&void 0!==t?t:this.vd=new ah(this)}pr(t){this.$h.push(t);let i=!0;return()=>{if(!i)return;i=!1;const e=this.$h.indexOf(t);-1!==e&&this.$h.splice(e,1)}}Bh(t=!0){var i;return!!(null===(i=this.persistence)||void 0===i?void 0:i.consumeCookieIdentityChange())&&(this.zh(t),!0)}zh(t=!0){var i,e,s;this.Mh=null,"anonymous"===(null===(i=this.persistence)||void 0===i?void 0:i.get_property("$user_state"))&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this.Sh.clear(),this.fd()),null===(e=this.featureFlags)||void 0===e||e.reset(),t&&this.reloadFeatureFlags()}calculateEventProperties(t,e,s,n,r){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return e;this.ph(),this.persistence.syncCookieProperties(),this.Bh();const o=r?void 0:this.persistence.remove_event_timer(t);let l=as({},e);if(l.token=this.config.token,l.$config_defaults="latest"===this.config.defaults?Sh:this.config.defaults,this.uh()&&(l[xt]=!0),"$snapshot"===t){const t=as(as({},this.persistence.properties()),this.sessionPersistence.properties());return l.distinct_id=t.distinct_id,(!mi(l.distinct_id)&&!$i(l.distinct_id)||yi(l.distinct_id))&&Tr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}const a=function(t,e,s,n=!1){var r,o,l,a;if(!Qt)return{};const u=t?[...Rl,...e||[]]:[],[h,c]=Ue(Qt),[d,v]=function(t){for(let i=0;qe.length>i;i++){const[e,s,n]=qe[i],r=t.match(e);if(r){const i=n&&t.match(n)||r;return[s,(null==i?void 0:i[1])||""]}}return["",""]}(Qt),f=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),p={};_i(s)||(p.detectGoogleSearchApp=s);const g={},_=null===(r=navigator)||void 0===r||null===(r=r.userAgentData)||void 0===r?void 0:r.platform,m=null===(o=navigator)||void 0===o?void 0:o.maxTouchPoints,y=null==qt||null===(l=qt.screen)||void 0===l?void 0:l.width,b=null==qt||null===(a=qt.screen)||void 0===a?void 0:a.height,w=null==qt?void 0:qt.devicePixelRatio;_i(_)||(g.userAgentDataPlatform=_),_i(m)||(g.maxTouchPoints=m),_i(y)||(g.screenWidth=y),_i(b)||(g.screenHeight=b),_i(w)||(g.devicePixelRatio=w);const x=Ar(Mr({$os:h,$os_version:c,$browser:De(Qt,navigator.vendor,f,p),$webview_app:d,$webview_app_version:v,$device:Be(Qt),$device_type:ze(Qt,g),$timezone:wl(),$timezone_offset:Hl()}),{$current_url:Pl(n?ts(null==Kt?void 0:Kt.href):null==Kt?void 0:Kt.href,u,Cl),$host:null==Kt?void 0:Kt.host,$pathname:null==Kt?void 0:Kt.pathname,$raw_user_agent:Qt.length>1e3?Qt.substring(0,997)+"...":Qt,$browser_version:Le(Qt,navigator.vendor,f,p),$browser_language:Nl(),$browser_language_prefix:Ll(),$screen_height:null==qt?void 0:qt.screen.height,$screen_width:null==qt?void 0:qt.screen.width,$viewport_height:null==qt?void 0:qt.innerHeight,$viewport_width:null==qt?void 0:qt.innerWidth,$lib:i.LIB_NAME,$lib_version:i.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return i.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=i.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:t,windowId:i}=this.sessionManager.checkAndGetSessionAndWindowId(r,s.getTime(),!0);l.$session_id=t,l.$window_id=i}this.sessionPropsManager&&Ar(l,this.sessionPropsManager.getSessionProps());try{var u;if(this.sessionRecording){const i=this.sessionRecording.sdkDebugProperties,e=!this.Ch&&mh(t);for(const t in i)(e||oi(gh,t))&&(l[t]=i[t])}l.$sdk_debug_retry_queue_size=null===(u=this.Dh)||void 0===u?void 0:u.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}let h;if(this.requestRouter.region===Du&&(l.$lib_custom_api_host=this.config.api_host),h="$pageview"!==t||r?"$pageleave"!==t||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,n),l=Ar(l,h),"$pageview"===t&&Gt&&(l.title=Gt.title),!_i(o)){const t=s.getTime()-o;l.$duration=parseFloat((t/1e3).toFixed(3))}Qt&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");const c=this.persistence.properties(),d=this.sessionPersistence.properties(),v=l.$groups,f=c.$groups;pi(v)&&!gi(v)&&(l.$groups=as(as({},pi(f)?f:{}),v)),Rr(["$referrer","$referring_domain"],t=>{t in c&&delete d[t]});const p={};if(this.$h.length>0)for(const t of this.$h.slice())try{Ar(p,t())}catch(t){Tr.error("Failed to produce browser extension event properties",t)}l=Ar({},a,c,d,as(as({},p),l)),l.$is_identified=this._isIdentified(),vi(this.config.property_denylist)?Rr(this.config.property_denylist,function(t){delete l[t]}):Tr.error(ph+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const g=this.config.sanitize_properties;g&&(Tr.error(fh),l=g(l,t));const _=this.pd();return l.$process_person_profile=_,_&&!r&&this.gd("_calculate_event_properties"),l}dd(t,i=!0,e=!1){var s;if(!this.persistence||!this.pd())return t;if(this.kh&&!e)return t;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=Ar({},n,r||{},t||{});const l=this.config.sanitize_properties;return l&&(Tr.error(fh),o=l(o,"$set_once")),i&&(this.kh=!0),gi(o)?void 0:o}register(t,i){var e;null===(e=this.persistence)||void 0===e||e.register(t,i)}register_once(t,i,e){var s;null===(s=this.persistence)||void 0===s||s.register_once(t,i,e)}register_for_session(t){var i,e;null===(i=this.persistence)||void 0===i||i.syncCookieProperties(),this.Bh(),null===(e=this.sessionPersistence)||void 0===e||e.register(t),Object.keys(t).forEach(t=>this.Sh.add(t)),this.fd()}unregister(t){var i;null===(i=this.persistence)||void 0===i||i.unregister(t)}unregister_for_session(t){var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t),this.Sh.delete(t),this.fd()}md(t,i){this.register({[t]:i})}Lh(){this.Sh.forEach(t=>{var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t)}),this.Sh.clear(),this.fd()}fd(){var t;if(!this.xh)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.fi)||!po.Ot())return void po.Dt(this.xh);const i=[];this.Sh.forEach(t=>i.push(t)),i.length>0?po.$t(this.xh,i):po.Dt(this.xh)}getFeatureFlag(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,s;return null!==(e=null===(s=this.featureFlags)||void 0===s?void 0:s.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i=!1,e){var s;return null===(s=this.featureFlags)||void 0===s?void 0:s.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.dr.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:vh}),()=>{})}onSessionId(t){var i,e;return null!==(i=null===(e=this.sessionManager)||void 0===e?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i=!1){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:vh})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:vh})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:vh}),()=>{})}renderSurvey(t,i){var e;null===(e=this.surveys)||void 0===e||e.renderSurvey(t,i)}displaySurvey(t,i=qu){var e;null===(e=this.surveys)||void 0===e||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null===(i=this.surveys)||void 0===i||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null===(e=this.surveys)||void 0===e?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:vh}}canRenderSurveyAsync(t,i=!1){var e,s;return null!==(e=null===(s=this.surveys)||void 0===s?void 0:s.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:vh})}yd(t){return!t||yi(t)?(Tr.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Tr.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())||(Tr.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 Tr.uninitializedWarning("posthog.identify");if($i(t)&&(t=t.toString(),Tr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.yd(t))return;if(!this.gd("posthog.identify"))return;this.ph();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this.Bh(!1),o=this.persistence.Cu();let l=!1;try{const s=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),t!==s&&t!==this.get_property("__alias")&&(this.unregister(A),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Dt,u=t!==s,h=!u&&o;if(u&&o){var a;const n=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:s};this.persistence.set_property(pt,Nt),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Tu(),this.capture("$identify",n,{$set:i||{},$set_once:e||{}})&&(this.Mh=Fu(t,i,e)),null===(a=this.featureFlags)||void 0===a||a.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(h){this.persistence.set_property(pt,Nt);const s=i||{},n=e||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence.Tu(),this.capture("$set",{$set:s,$set_once:n})&&(this.Mh=Fu(t,i,e))}else(i||e)&&this.setPersonProperties(i,e);u||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(v)):h&&(i||e)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Mu(l)}}setPersonProperties(t,i){if(!t&&!i)return;if(!this.gd("posthog.setPersonProperties"))return;const e=Fu(this.get_distinct_id(),t,i);this.Mh!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this.Mh=e)):Tr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;const e=(vi(t)?t:[t]).filter(t=>mi(t)&&t.length>0);0!==e.length&&this.gd("posthog.unsetPersonProperties")&&(null===(i=this.featureFlags)||void 0===i||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Mh=null)}group(t,i,e){var s;if(!t||!i)return void Tr.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.Bh();const n=this.getGroups(),r=n[t]!==i;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:as(as({},n),{},{[t]:i})}),(r||e)&&this.pd()){const s={$group_type:t,$group_key:i};e&&(s.$group_set=e),this.capture(Ht,s)}e&&this.setGroupPropertiesForFlags({[t]:e}),r&&!e&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i=!0){var e;null===(e=this.featureFlags)||void 0===e||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i=!0){var e;this.gd("posthog.setGroupPropertiesForFlags")&&(null===(e=this.featureFlags)||void 0===e||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null===(i=this.featureFlags)||void 0===i||i.resetGroupPropertiesForFlags(t)}reset(t){const i=Si(t)?t:null==t?void 0:t.resetDeviceID,e=Si(t)||null==t?void 0:t.bootstrap;this.bd(i,!1,e)}bd(t,i=!1,e){var s,n,r,o,l,a;if(Tr.info("reset"),!this.__loaded)return Tr.uninitializedWarning("posthog.reset");const u=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null===(s=this.Rh)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this.Yu());const h=this.get_property(O),c=this.get_property(R),d=this.get_property(G);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();i||this.consent.reset(),i||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.Cu)||void 0===a?void 0:a.call(l),p=this.gh;this.gh=p||i;let g=!1;try{var _,m,y,b,w,x,S,E,k,T,P,A,C;if(null===(_=this.persistence)||void 0===_||_.clear(),null===(m=this.sessionPersistence)||void 0===m||m.clear(),this.Sh.clear(),this.fd(),_i(d)||null===(T=this.persistence)||void 0===T||T.register({$session_recording_remote_config:d}),null===(y=this.surveys)||void 0===y||y.reset(),null===(b=this.featureFlags)||void 0===b||b.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(x=this.logs)||void 0===x||x.reset(),null===(S=this.metrics)||void 0===S||S.reset(),null===(E=this.persistence)||void 0===E||E.set_property("$user_state","anonymous"),null===(k=this.sessionManager)||void 0===k||k.resetSessionId(),this.Mh=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:$t,$device_id:null},"");else{const i=this.config.get_device_id(Gr());this.register_once({distinct_id:i,$device_id:t?i:h},""),t||_i(c)||this.register({[R]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(e.distinctID&&!this.uh()&&(null===(C=this.persistence)||void 0===C||C.set_property("$user_state",e.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.distinctID})),null===(P=this.featureFlags)||void 0===P||P.initialize(),!wi(u)&&!(null===(A=this.sessionManager)||void 0===A?void 0:A.setBootstrapSessionId(u,!0))){const t=as({},e);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,g=!0}finally{var I,M;this.gh=p,f&&(null===(I=this.persistence)||void 0===I||null===(M=I.Mu)||void 0===M||M.call(I,g))}var F;this.vr&&(null===(F=this.conversations)||void 0===F||F.onRemoteConfig(this.vr)),this.reloadFeatureFlags()}shutdown(t){var i=this;return Di(function*(){if(!i.__loaded)return void Tr.uninitializedWarning("posthog.shutdown");i.wh=!0,clearTimeout(i.jh),i.jh=void 0;const t=i.Gh;i.Gh=void 0;for(const e of[()=>{var t;return null===(t=i.sessionRecording)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.flushLogs("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.flush("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.surveys)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.autocapture)||void 0===t?void 0:t.dispose()},()=>null==t?void 0:t(),()=>{var t;return null===(t=i.Oh)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.Dh)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.featureFlags)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.persistence)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.sessionPersistence)||void 0===t?void 0:t.destroy()}])try{const t=e();t&&fi(t.then)&&t.then(void 0,t=>{Tr.error("Error during shutdown",t)})}catch(t){Tr.error("Error during shutdown",t)}})()}setIdentity(t,i){var e;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null===(e=this.conversations)||void 0===e||e._d()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(t=this.conversations)||void 0===t||t.wd()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if((null==t?void 0:t.withTimestamp)&&e){var n;const i=null!==(n=t.timestampLookBack)&&void 0!==n?n:10;if(!e)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-e)/1e3)-i,0)}`}return s}alias(t,i){return t===this.get_property("$people_distinct_id")?(Tr.critical("Attempting to create alias for existing People user - aborting."),-2):this.gd("posthog.alias")?(_i(i)&&(i=this.get_distinct_id()),t!==i?(this.md(A,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Tr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const i=as({},this.config);if(pi(t)){var s,n,r,o,l,a,u,h,c,d,v,f,p,g;Ar(this.config,Ph(t));const w=this.bh();if(this.persistence){const t="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;var _,m;if(t&&this.sessionPersistence!==this.persistence&&(null===(_=this.sessionPersistence)||void 0===_||_.remove(),null===(m=this.sessionPersistence)||void 0===m||m.destroy()),this.persistence.update_config(this.config,i,w),t)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new ea(as(as({},this.config),{},{persistence:"sessionStorage"}),w,!1);else{var y;null===(y=this.sessionPersistence)||void 0===y||y.update_config(as(as({},this.config),{},{persistence:"sessionStorage"}),as(as({},i),{},{persistence:"sessionStorage"}),w)}}const x=this.Ah(this.config.debug);var b;Si(x)&&(this.config.debug=x),Si(this.config.debug)&&(this.config.debug?(e.DEBUG=!0,to.Ot()&&to.$t("ph_debug",!0),Tr.info("set_config",{config:t,oldConfig:i,newConfig:as({},this.config)})):(e.DEBUG=!1,to.Ot()&&to.Dt("ph_debug"))),null===(s=this.featureFlags)||void 0===s||null===(n=s.updateConfig)||void 0===n||n.call(s,this.config,this.Yu()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(l=this.metrics)||void 0===l||l.onConfigChange(),null===(a=this.webMCP)||void 0===a||a.startIfEnabled(),null===(u=this.sessionRecording)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.tracingHeaders)||void 0===h||h.startIfEnabledOrStop(),null===(c=this.autocapture)||void 0===c||c.startIfEnabled(),null===(d=this.heatmaps)||void 0===d||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(b=this.historyAutocapture)||void 0===b||b.startIfEnabledOrStop()),null===(v=this.exceptionObserver)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.deadClicksAutocapture)||void 0===f||f.startIfEnabledOrStop(),null===(p=this.surveys)||void 0===p||p.loadIfEnabled(),this.mh(),null===(g=this.externalIntegrations)||void 0===g||g.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&dl(this,ch,!1)}}_overrideSDKInfo(t,i){e.LIB_NAME=t,e.LIB_VERSION=i}startSessionRecording(t){const i=!0===t,e={sampling:i||!!(null==t?void 0:t.sampling),linked_flag:i||!!(null==t?void 0:t.linked_flag),url_trigger:i||!!(null==t?void 0:t.url_trigger),event_trigger:i||!!(null==t?void 0:t.event_trigger)};var s,n,r,o,l;Object.values(e).some(Boolean)&&(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),e.sampling&&(null===(n=this.sessionRecording)||void 0===n||n.overrideSampling()),e.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),e.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),e.event_trigger&&(null===(l=this.sessionRecording)||void 0===l||l.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(null===(t=this.sessionRecording)||void 0===t?void 0:t.started)}captureException(t,i){try{if(!this.exceptions)return;const e=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(as(as({},e),i))}catch(t){return}}addExceptionStep(t,i){var e;null===(e=this.exceptions)||void 0===e||e.addExceptionStep(t,i)}captureLog(t){var i;null===(i=this.logs)||void 0===i||i.captureLog(t)}get logger(){var i,e;return null!==(i=null===(e=this.logs)||void 0===e?void 0:e.logger)&&void 0!==i?i:t.kd}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null===(e=this.toolbar)||void 0===e?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null===(i=this.persistence)||void 0===i?void 0:i.props[t]}getSessionProperty(t){var i;return null===(i=this.sessionPersistence)||void 0===i?void 0:i.props[t]}toString(){var t;let i=null!==(t=this.config.name)&&void 0!==t?t:xh;return i!==xh&&(i="posthog."+i),i}_isIdentified(){var t,i;return"identified"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))||"identified"===(null===(i=this.sessionPersistence)||void 0===i?void 0:i.get_property("$user_state"))}pd(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&gi(this.getGroups())&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.__alias)&&!(null===(i=this.persistence)||void 0===i||null===(i=i.props)||void 0===i?void 0:i.$epp))}Xh(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.pd()||this.gd("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.gd("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}gd(t){return"never"===this.config.person_profiles?(Tr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.hh(),this.md(wt,!0),!0)}bh(){if("always"===this.config.cookieless_mode)return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}mh(){var t,i;const e=this.bh();var s,n,r;return this.is_capturing()||null===(s=this.logs)||void 0===s||s.Sd(),(null===(t=this.persistence)||void 0===t?void 0:t.fi)!==e&&(null===(n=this.persistence)||void 0===n||n.set_disabled(e)),(null===(i=this.sessionPersistence)||void 0===i?void 0:i.fi)!==e&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(e)),this.fd(),e}opt_in_capturing(i){var e;if("always"!==this.config.cookieless_mode){if(this.uh()){var s,n,r,o,l,a;null===(s=this.sessionRecording)||void 0===s||s.dispose({discardBufferedEvents:!0}),this.bd(!0,!0),null===(n=this.sessionManager)||void 0===n||n.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new Eu(this),this.pageViewManager=new gl(this),this.persistence&&(this.sessionPropsManager=new wu(this,this.sessionManager,this.persistence));const i=null!==(o=null===(l=this.config.__extensionClasses)||void 0===l?void 0:l.sessionRecording)&&void 0!==o?o:null===(a=t.__defaultExtensionClasses)||void 0===a?void 0:a.sessionRecording;var u,h;i&&(this.sessionRecording=this.ah(this.sessionRecording,new i(this)),this.vr&&(null===(u=this.sessionRecording)||void 0===u||null===(h=u.onRemoteConfig)||void 0===h||h.call(u,this.vr)))}var c,d,v;this.consent.optInOut(!0),this.mh(),this.Zh(),null===(e=this.sessionRecording)||void 0===e||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(c=this.surveys)||void 0===c||c.loadIfEnabled(),null===(d=this.conversations)||void 0===d||d.loadIfEnabled()),(_i(null==i?void 0:i.captureEventName)||(null==i?void 0:i.captureEventName))&&this.capture(null!==(v=null==i?void 0:i.captureEventName)&&void 0!==v?v:"$opt_in",null==i?void 0:i.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Kh()}else Tr.warn(dh)}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this.mh(),"on_reject"===this.config.cookieless_mode&&this.yh()):Tr.warn(dh)}yh(){var t,i;const e=this.sessionRecording;null==e||e.dispose({discardBufferedEvents:!0}),"$posthog_cookieless"!==this.get_distinct_id()&&this.bd(!0,!0),this.register({distinct_id:$t,$device_id:null}),this.rh(e),this.sessionRecording=void 0,null===(t=this.sessionManager)||void 0===t||t.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Kh(),this.Zh()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return!this.gh&&("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.mh()}_is_bot(){return Vt?Tu(Vt,this.config.custom_blocked_useragents):void 0}Kh(){Gt&&("visible"===Gt.visibilityState?this.Th||(this.Th=!0,this.capture(Ut,{title:Gt.title},{send_instantly:!0}),this.Ih&&(Gt.removeEventListener(m,this.Ih),this.Ih=null)):this.Ih||(this.Ih=this.Kh.bind(this),Lr(Gt,m,this.Ih)))}debug(t){!1===t?(null==qt||qt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==qt||qt.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}))}Yu(){const t=this.Rh||{};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?(Tr.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,i,e,s,n){const r=i in t&&!wi(t[i]),o=e in t&&!wi(t[e]);return r?t[i]:!!o&&(n&&n.warn(`Config field '${e}' is deprecated. Please use '${i}' instead. The old field will be removed in a future major version.`),t[e])}(t,"advanced_disable_flags","advanced_disable_decide",0,Tr)}Fs(t){var i;if(wi(this.config.before_send))return t;const e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(ki),s=vi(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=t;for(const i of s)try{if(n=i(n),wi(n)){const i=`Event '${t.event}' was rejected in beforeSend function`;return Ei(t.event)?Tr.warn(`${i}. This can cause unexpected behavior.`):Tr.info(i),null}n.properties&&!gi(n.properties)||Tr.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(i){return Tr.error(`Error in beforeSend function for event '${t.event}':`,i),null}for(const i of e)if(n.properties&&wi(n.properties[i]))return Tr.warn(`Event '${t.event}' had its '${i}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return n}getPageViewId(){var t;return null===(t=this.pageViewManager.Dl)||void 0===t?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Ah(t){const i=Si(t)&&!t,e=to.Ot()&&"true"===to.Lt("ph_debug");return!i&&(!!e||t)}};Rh.__defaultExtensionClasses={},Rh.kd=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(let e=0;i.length>e;e++)t.prototype[i[e]]=Ir(t.prototype[i[e]])}(Rh,["identify"]);const Ah=["[data-ph-capture-value]"];var Ch=class{constructor(t){this._instance=t}refresh(t){var i;const e=this._instance.config,s=pi(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.Yu(),t.url_allowlist=null==s?void 0:s.url_allowlist,t.url_ignorelist=null==s?void 0:s.url_ignorelist,t.dom_event_allowlist=null==s?void 0:s.dom_event_allowlist,t.element_allowlist=null==s?void 0:s.element_allowlist,t.css_selector_allowlist=null==s?void 0:s.css_selector_allowlist,t.css_selector_ignorelist=null==s?void 0:s.css_selector_ignorelist,t.element_attribute_ignorelist=null==s?void 0:s.element_attribute_ignorelist,t.capture_copied_text=null==s?void 0:s.capture_copied_text,t.capture_value_css_selector_allowlist=null!==(i=null==s?void 0:s.capture_value_css_selector_allowlist)&&void 0!==i?i:Ah}};const Ih=Pr("[ExceptionAutocapture]"),Mh=()=>{},Fh=t=>{var i;if(fi(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Dh(t,i,e){try{if(!(i in t))return Mh;const s={next:t[i]},n=e(function(...t){return s.next.apply(this,t)});return fi(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),t[i]=n,()=>{if(t[i]===n)return void(t[i]=s.next);let e=t[i],r=Fh(e);for(;r;){if(r.next===n)return void(r.next=s.next);e=r.next,r=Fh(e)}}}catch(t){return Mh}}const Nh=Pr("[TracingHeaders]"),Lh=Pr("[Web Vitals]"),jh=9e5,Uh=["CLS","FCP","INP","LCP"],Bh=["INP","LCP"],zh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Hh="disabled",qh="lazy_loading",Wh=Pr("[SessionRecording]"),Vh=[kt,Tt,Pt,Ot,Rt,At,Ct,It,Mt],Gh=Pr("[Heatmaps]");function Kh(t){return pi(t)&&"clientX"in t&&"clientY"in t&&$i(t.clientX)&&$i(t.clientY)}const Yh=Pr("[Product Tours]"),Jh=t=>{var i;return!t.config.disable_product_tours&&!!(null===(i=t.persistence)||void 0===i?void 0:i.get_property(q))},Xh=["$set_once","$set"],Zh=Pr("[SiteApps]"),Qh="Error while initializing PostHog app with config id ";function tc(t,i,e){if(wi(t))return!1;switch(e){case"exact":return t===i;case"contains":{const e=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(e,"i").test(t)}case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}var ic=class{constructor(t){this.$i=t,this.So=new Set,this.xo=new Set,this.$o=new $u,this.Co=(t,i)=>this.To(t,i)&&this.Io(t,i)&&this.Eo(t,i)&&this.Mo(t,i),this.To=(t,i)=>!(null==i?void 0:i.event)||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;_i(null===(t=this.$i)||void 0===t?void 0:t.subscribeCapture)||(this.Ao=null===(i=this.$i)||void 0===i?void 0:i.subscribeCapture((t,i)=>{this.on(t,i)}))}dispose(){var t,i,e;null===(t=this.Ao)||void 0===t||t.call(this),this.Ao=void 0,null===(i=this.$i)||void 0===i||null===(e=i.setElementSelectors)||void 0===e||e.call(i,new Set,this),this.$o=new $u}register(t){var i,e;if(!_i(null===(i=this.$i)||void 0===i?void 0:i.subscribeCapture)&&(t.forEach(t=>{var i;this.So.add(t),null===(i=t.steps)||void 0===i||i.forEach(t=>{this.xo.add((null==t?void 0:t.event)||"")})}),null===(e=this.$i)||void 0===e?void 0:e.setElementSelectors)){const t=new Set;this.So.forEach(i=>{var e;null===(e=i.steps)||void 0===e||e.forEach(i=>{(null==i?void 0:i.selector)&&t.add(i.selector)})}),this.$i.setElementSelectors(t,this)}}replace(t){this.So.clear(),this.xo.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.xo.has(t)||this.xo.has(i.event))&&this.So.forEach(t=>{this.Ro(i,t)&&this.$o.emit("actionCaptured",t.name)})}Po(t){this.onAction("actionCaptured",i=>t(i))}Ro(t,i){if(null==(null==i?void 0:i.steps))return!1;for(const e of i.steps)if(this.Co(t,e))return!0;return!1}onAction(t,i){return this.$o.on(t,i)}Io(t,i){if(null==i?void 0:i.url){var e;let r=null==t||null===(e=t.properties)||void 0===e?void 0:e.$current_url;if(!(null==t?void 0:t.properties)||!("$current_url"in t.properties))try{var s,n;r=null===(s=this.$i)||void 0===s||null===(n=s.getActionUrl)||void 0===n?void 0:n.call(s)}catch(t){return!1}if(!r||"string"!=typeof r)return!1;if(!tc(r,i.url,i.url_matching||"contains"))return!1}return!0}Eo(t,i){return!!this.Oo(t,i)&&!!this.Fo(t,i)&&!!this.Do(t,i)}Oo(t,i){var e;if(!(null==i?void 0:i.href))return!0;const s=this.Lo(t);if(s.length>0)return s.some(t=>tc(t.href,i.href,i.href_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return!!n&&tc(function(t){const i=t.match(/(?::|")href="(.*?)"/);return i?i[1]:""}(n),i.href,i.href_matching||"exact")}Fo(t,i){var e;if(!(null==i?void 0:i.text))return!0;const s=this.Lo(t);if(s.length>0)return s.some(t=>tc(t.text,i.text,i.text_matching||"exact")||tc(t.$el_text,i.text,i.text_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return!!n&&(r=function(t){const i=[],e=/(?::|")text="(.*?)"/g;let s;for(;!wi(s=e.exec(t));)i.includes(s[1])||i.push(s[1]);return i}(n),o=i.text,l=i.text_matching||"exact",r.some(t=>tc(t,o,l)));var r,o,l}Do(t,i){var e,s;if(!(null==i?void 0:i.selector))return!0;const n=null==t||null===(e=t.properties)||void 0===e?void 0:e.$element_selectors;if(null==n?void 0:n.includes(i.selector))return!0;const r=(null==t||null===(s=t.properties)||void 0===s?void 0:s.$elements_chain)||"";if(i.selector_regex&&r)try{return new RegExp(i.selector_regex).test(r)}catch(t){}return!1}Lo(t){var i;return null==(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Mo(t,i){return!(null==i?void 0:i.properties)||0===i.properties.length||Mu(i.properties.reduce((t,i)=>{const e=vi(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)}},ec=class{constructor(t,i){this.No=i,this.jo=[],this.$i=t,this.qo=new Map,this.Bo=new Map,this.zo=new Map}Ho(){var t,i;this.Uo=null===(t=(i=this.$i).subscribeSession)||void 0===t?void 0:t.call(i,t=>this.Wo(t))}Vo(t){return!1}Go(){return null}Qo(t){}Jo(){}Zo(t,i){return!!t&&Mu(t.propertyFilters,null==i?void 0:i.properties)}Ko(t,i){const e=new Map;return t.forEach(t=>{var s;null===(s=t.conditions)||void 0===s||null===(s=s[i])||void 0===s||null===(s=s.values)||void 0===s||s.forEach(i=>{if(null==i?void 0:i.name){const s=e.get(i.name)||[];s.push(t.id),e.set(i.name,s)}})}),e}Yo(t,i,e){const s=(e===na.Activation?this.qo:this.Bo).get(t);let n=[];return this.Xo(t=>{n=t.filter(t=>null==s?void 0:s.includes(t.id))}),n.filter(s=>{var n;const r=null===(n=s.conditions)||void 0===n||null===(n=n[e])||void 0===n||null===(n=n.values)||void 0===n?void 0:n.find(i=>i.name===t);return this.Zo(r,i)})}register(t){this.ta(t,!1)}replace(t){this.ta(t,!0)}ta(t,i){_i(this.$i.subscribeCapture)||(this.ea(t,i),this.ia(t,i))}ia(t,i){const e=t.filter(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length});var s;if(i&&this.zo.clear(),0===e.length)return void(i&&(null===(s=this.na)||void 0===s||s.replace([])));this.na||(this.na=new ic(this.$i),this.na.init(),this.na.Po(t=>this.onAction(t)));const n=[];e.forEach(t=>{var i;null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||i.values.forEach(i=>{if(n.push(i),i.name){var e;const s=null!==(e=this.zo.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.zo.set(i.name,s)}})}),i?this.na.replace(n):this.na.register(n)}sa(t,i){i.forEach((i,e)=>{var s;const n=null!==(s=t.get(e))&&void 0!==s?s:[];i.forEach(t=>{n.includes(t)||n.push(t)}),t.set(e,n)})}ea(t,i){var e,s,n;const r=t.filter(t=>{var i,e;return(null===(i=t.conditions)||void 0===i?void 0:i.events)&&(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),o=t.filter(t=>{var i,e;return(null===(i=t.conditions)||void 0===i?void 0:i.cancelEvents)&&(null===(e=t.conditions)||void 0===e||null===(e=e.cancelEvents)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),l=this.Ko(t,na.Activation),a=this.Ko(t,na.Cancellation);i?(this.qo=l,this.Bo=a):(this.sa(this.qo,l),this.sa(this.Bo,a)),(0!==r.length||0!==o.length||t.some(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length}))&&(null!==(e=this.Ao)&&void 0!==e||(this.Ao=null===(s=(n=this.$i).subscribeCapture)||void 0===s?void 0:s.call(n,(t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,s;const n=this.ra(),r=(null==i||null===(e=i.properties)||void 0===e?void 0:e.$survey_id)||(null==i||null===(s=i.properties)||void 0===s?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const e=this.oa(t,r,i);if("consume"===e)return n.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.aa([r]);if("persist"===e)return n.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.la(r),void this.ua([r])}if(this.Bo.has(t)){const e=this.Yo(t,i,na.Cancellation);e.length>0&&(n.info("cancel event matched, cancelling items",{event:t,itemsToCancel:e.map(t=>t.id)}),this.aa(e.map(t=>t.id)),e.forEach(t=>this.ca(t.id)))}if(!this.qo.has(t))return;n.info("event name matched",{event:t,eventPayload:i,items:this.qo.get(t)});const o=this.Yo(t,i,na.Activation);this.ha(o.map(t=>t.id))}onAction(t){this.zo.has(t)&&this.ha(this.zo.get(t)||[])}ha(t){if(0===t.length)return;const i=!!this.$i.getSessionId(),e=[];for(const s of t)i&&this.Vo(s)?this.la(s)&&this.da(s):e.push(s);e.length>0&&(this.jo=[...new Set([...this.jo,...e])]),this.ra().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.va()}la(t){this.jo=this.jo.filter(i=>i!==t);const i=this.fa();return!i.includes(t)&&(this.pa([...i,t]),this.ga(),!0)}aa(t){const i=new Set(t);this.jo=this.jo.filter(t=>!i.has(t));const e=this.ma(),s=e.filter(t=>!i.has(t));s.length!==e.length&&(this.pa(s),0===s.length&&this.ya()),this.ua(t),this.va()}va(){try{var t;null===(t=this.No)||void 0===t||t.call(this)}catch(t){this.ra().error("Error while handling activated items change",t)}}ba(){const t=this.Go();if(!t)return{};const i=this.$i.getProperty(t);return i&&"object"==typeof i?i:{}}da(t){if(!this.Go())return;const i=this.ba();this.Qo(as(as({},i),{},{[t]:Date.now()}))}ua(t){if(!this.Go())return;const i=this.ba(),e={};let s=!1;for(const[n,r]of Object.entries(i))t.includes(n)?s=!0:e[n]=r;s&&(gi(e)?this.Jo():this.Qo(e))}_a(){this.Go()&&this.Jo()}getActivationTimestamp(t){if(!this.fa().includes(t))return;const i=this.ba()[t];return $i(i)?i:void 0}ma(){const t=this.wa();return this.$i.getProperty(t)||[]}fa(){const t=this.ma();if(0===t.length)return[];const i=this.$i.getProperty(this.ka()),e=this.$i.getSessionId();return e&&i===e?t:[]}ga(){const t=this.$i.getSessionId();t&&this.Sa(t)}ya(){this.xa()}Wo(t){const i=this.$i.getProperty(this.ka());if(i&&i!==t){const t=this.ma(),i=this.ba();t.length>0&&(this.pa([]),t.filter(t=>$i(i[t])).forEach(t=>this.ca(t))),this.ya(),this._a(),t.length>0&&this.va()}}getActivatedIds(){return[...new Set([...this.fa(),...this.jo])].filter(t=>!this.$a(t))}dispose(){var t,i,e;null===(t=this.Uo)||void 0===t||t.call(this),this.Uo=void 0,null===(i=this.Ao)||void 0===i||i.call(this),this.Ao=void 0,null===(e=this.na)||void 0===e||e.dispose(),this.na=void 0}reset(){this.jo=[],this.ma().length>0&&this.pa([]),this.ya(),this._a(),this.va()}getEventToItemsMap(){return this.qo}Ca(){return this.na}},sc=class extends ec{constructor(t,i,e,s){var n;super({subscribeCapture(i){const e=t.onEvent(t=>i(t.event,t));return()=>e.dispose()},subscribeSession(i){const e=t.onSession(i);return()=>e.dispose()},getSessionId(){var i;return null===(i=t.session)||void 0===i?void 0:i.sessionId},getProperty:i=>t.kv.get(i),getActionUrl:null==e?void 0:e.getActionUrl,setElementSelectors:null!==(n=null==e?void 0:e.setElementSelectors)&&void 0!==n?n:(i,e)=>{var s;return null===(s=t.getExtension("autocapture"))||void 0===s?void 0:s.setElementSelectors(i,e)}},s),this.Ta=t,this.Ia=i,this.Ho()}wa(){return S}ka(){return E}Go(){return k}Qo(t){this.Ta.kv.set({[k]:t})}Jo(){this.Ta.kv.remove(k)}Vo(t){var i;let e;this.Xo(i=>{e=i.find(i=>i.id===t)});const s=null==e||null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds;return $i(s)&&s>0}Ea(){return oa.SHOWN}Xo(t){this.Ia.getSurveys(t)}ca(t){this.Ia.cancelPendingSurvey(t)}ra(){return Bu}pa(t){this.Ta.kv.set({[S]:t})}Sa(t){this.Ta.kv.set({[E]:t})}xa(){this.Ta.kv.remove(E)}$a(){return!1}oa(t,i,e){var s;if(t===oa.SENT&&!1===(null==e||null===(s=e.properties)||void 0===s?void 0:s.$survey_completed))return"ignore";let n;return this.Xo(t=>{n=t.find(t=>t.id===i)}),!n||function(t){var i;return Ru(t)&&!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i?void 0:i.repeatedActivation)||"always"===t.schedule}(n)?t===oa.SHOWN?"consume":"ignore":t===oa.SHOWN?"persist":t===oa.DISMISSED||t===oa.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};const nc=(t,i)=>(null==t?void 0:t.then)?t.then(i):i(t),rc="SDK is not enabled or survey functionality is not yet loaded",oc="Disabled. Not loading surveys.";var lc=class{constructor(t){this.Ma=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Aa=!1,this.Ra=!1,this.Pa=[],this.Oa=[],this.Fa=null,this.Da=null,this.Ti=!1,this.La=new Set,this.onRemoteConfig=t=>{if(this.Ti)return;if(this.Dr.disableSurveys)return;if(!t.ok)return this.Ra=!0,this.Na({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),Bu.warn("Remote config unavailable. Not loading surveys.");const i=t.config.surveys;if(wi(i))return Bu.warn("Flags not loaded yet. Not loading surveys.");this.ja=Si(i)?i:i.length>0,Bu.info(`flags response received, isSurveysEnabled: ${this.ja}`),this.loadIfEnabled()},this.Na=t=>{this.Oa.slice().forEach(i=>this.qa(i,t))}}setup(t){if(!this.Ti)return this.Ba=t,nc(t.kv.initialize(),()=>{if(this.Ba!==t||this.Ti)return;this.Ba=void 0,this.Ta=t;const i=t.onRemoteConfig(this.onRemoteConfig);this.Ti?i.dispose():(this.za=i,this.loadIfEnabled())})}dispose(){var t,i,e,s,n;this.Ti||(this.Ti=!0,this.Ba=void 0,this.Ta=void 0,null===(t=this.za)||void 0===t||t.dispose(),this.za=void 0,null===(i=this._surveyEventReceiver)||void 0===i||i.dispose(),this._surveyEventReceiver=null,null===(e=this._surveyManager)||void 0===e||null===(s=e.dispose)||void 0===s||s.call(e),this._surveyManager=null,this.Pa=[],this.Oa.forEach(t=>{t.active=!1}),this.Oa=[],null===(n=this.Ha)||void 0===n||n.call(this),this.Ha=void 0,this.Fa=null,this.La.forEach(t=>clearTimeout(t)),this.La.clear())}get Dr(){return this.Ma.get()}getRenderContext(){if(!this.Ta)return;const t=this;return{client:this.Ta,get config(){return t.Dr},surveys:t}}initialize(){this.loadIfEnabled()}reset(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.clearInMemoryInProgressSurveyState)||void 0===i||i.call(t);try{var e;null===(e=this._surveyEventReceiver)||void 0===e||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let i=0;i<localStorage.length;i++){const e=localStorage.key(i);((null==e?void 0:e.startsWith("seenSurvey_"))||(null==e?void 0:e.startsWith("inProgressSurvey_")))&&t.push(e)}t.forEach(t=>localStorage.removeItem(t))}catch(t){}this.Na()}loadIfEnabled(){if(this.Ti||!this.Ta)return;const t=this.Dr;if(this._surveyManager)return;if(this.Aa)return void Bu.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Bu.info(oc);if(t.cookielessMode&&this.Ta.isOptedOut)return void Bu.info("Not loading surveys in cookieless mode without consent.");const i=this.Ma.getExtensions();if(!i)return void this.Ua("PostHog Extensions not found.");if(_i(this.ja)&&!t.advancedEnableSurveys)return;const e=this.ja||t.advancedEnableSurveys;this.Aa=!0,this.Ra=!1;try{const t=i.generateSurveys;if(t)return this.Wa(t,e),void(this.Aa=!1);const s=i.loadExternalDependency;if(!s)return this.Ua(x),void(this.Aa=!1);s(t=>{try{if(this.Ti)return;const i=this.Ma.getExtensions();t||!(null==i?void 0:i.generateSurveys)?this.Ua("Could not load surveys script",t):this.Wa(i.generateSurveys,e)}finally{this.Aa=!1}})}catch(t){throw this.Aa=!1,this.Ua("Error initializing surveys",t),t}}Wa(t,i){var e;if(this.Ti)return;this._surveyManager=t(i),this._surveyEventReceiver=this.Va(this.Ta,this.Na);const s=null===(e=this.Ta)||void 0===e?void 0:e.kv.get(b);s&&this.Ga(s),Bu.info("Surveys loaded successfully"),this.Qa(),this.Na(),this.Ja({isLoaded:!0})}Va(t,i){return new sc(t,this,void 0,i)}Ua(t,i){this.Ra=!0,Bu.error(t,i),this.Na({isLoaded:!1,error:t}),this.Ja({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Pa.push(t),this._surveyManager&&this.Ja({isLoaded:!0}),()=>{this.Pa=this.Pa.filter(i=>i!==t)}}getSurveys(t,i=!1){if(this.Ti)return;const e=this.Ta;if(!e)return t([],{isLoaded:!1,error:rc});if(this.Dr.disableSurveys)return Bu.info(oc),t([]);const s=e.kv.get(b);if(s&&!i)return t(s,{isLoaded:!0}),void(this.Za()&&this.getSurveys(()=>{},!0));if(this.Fa)return void this.Fa.then(({surveys:i,context:e})=>{this.Ti||t(i,e)}).catch(t=>Bu.error("Error in survey callback",t));const n=e.sendRequest("/api/surveys/",{method:"GET",query:{token:e.projectToken},sentAt:"query",timeoutMs:this.Dr.requestTimeoutMs}).then(t=>{try{return this.Ka(e,t)}catch(t){return Bu.error("Error processing surveys response",t),this.Ka(e,{statusCode:0,error:t})}},t=>this.Ka(e,{statusCode:0,error:t}));this.Fa=n;const r=()=>{this.Fa===n&&(this.Fa=null)};n.then(i=>{r(),this.Ti||(this.Na(i.context),t(i.surveys,i.context))},r).catch(t=>Bu.error("Error in survey callback",t))}Ka(t,i){if(this.Ti)return{surveys:[],context:{isLoaded:!1,error:rc}};const e=i.statusCode;if(200!==e||!i.json){const t=`Surveys API could not be loaded, status: ${e}`;return 0!==e?Bu.error(t):i.error||Bu.warn(t),this.Da=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.Da=null;const s=i.json.surveys||[];return t.kv.set({[b]:s,[w]:Date.now()}),this.Ga(s),{surveys:s,context:{isLoaded:!0}}}Ga(t){const i=t.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Ru(t)||function(t){var i;return!!(null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}(t)));this.Ya(i)}Ya(t){var i;null===(i=this._surveyEventReceiver)||void 0===i||i.replace(t)}Za(){return this.Xa()&&!this.Fa&&!this.tl()}Xa(){var t;const i=null===(t=this.Ta)||void 0===t?void 0:t.kv.get(w);return $i(i)&&Date.now()-i>3e5}tl(){return $i(this.Da)&&3e5>Date.now()-this.Da}markSurveyAsSeen(t,i){var e;const s={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};zu(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}this.Na()}Ja(t){for(const i of this.Pa){if(this.Ti)return;try{t.isLoaded?this.getSurveys(i):i([],t)}catch(t){Bu.error("Error in survey callback",t)}}}getActiveMatchingSurveys(t,i=!1){if(!wi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Bu.warn("init was not called")}onActiveMatchingSurveysChanged(t){var i;if(this.Ti)return()=>{};const e={callback:t,active:!0,revision:0};this.Oa.push(e),this.Qa();const s=null===(i=this.Ta)||void 0===i?void 0:i.kv.get(b);return this.Dr.disableSurveys||!this._surveyManager&&this.Ra&&!this.Aa||!s&&!wi(this.Da)&&!this.Fa?this.qa(e,{isLoaded:!1}):this._surveyManager&&this.qa(e),()=>{var t;e.active=!1,this.Oa=this.Oa.filter(t=>t!==e),0===this.Oa.length&&(null===(t=this.Ha)||void 0===t||t.call(this),this.Ha=void 0)}}Qa(){var t,i,e;this._surveyManager&&this.Oa.length>0&&(null!==(t=this.Ha)&&void 0!==t||(this.Ha=null===(i=(e=this.Ma).onMatchingConditionsChanged)||void 0===i?void 0:i.call(e,this.Na)))}qa(t,i){if(this.Ti||!t.active)return;const e=++t.revision,s=s=>{if(!this.Ti&&t.active&&e===t.revision)try{const e=null!=i?i:{isLoaded:!0},n=JSON.stringify([s,e]);if(n===t.lastResult)return;t.lastResult=n,t.callback(s,e)}catch(t){Bu.error("Error in active matching surveys callback",t)}};try{i&&!i.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(t){Bu.error("Error in active matching surveys callback",t)}}el(t){let i=null;return this.getSurveys(e=>{var s;i=null!==(s=e.find(i=>i.id===t))&&void 0!==s?s:null}),i}il(t){if(wi(this._surveyManager))return{eligible:!1,reason:rc};const i="string"==typeof t?this.el(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}nl(t){var i;if(!(null===(i=this.Ta)||void 0===i?void 0:i.canCapture))return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(wi(this._surveyManager))return{eligible:!1,reason:rc};const e="string"==typeof t?this.el(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(wi(this._surveyManager))return Bu.warn("init was not called"),{visible:!1,disabledReason:rc};const i=this.nl(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return wi(this._surveyManager)?(Bu.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:rc})):new Promise(e=>{this.getSurveys(i=>{var s;const n=null!==(s=i.find(i=>i.id===t))&&void 0!==s?s:null;if(n){const t=this.nl(n);e({visible:t.eligible,disabledReason:t.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var s,n,r;if(!(null===(s=this.Ta)||void 0===s?void 0:s.canCapture))return;if(wi(this._surveyManager))return void Bu.warn("init was not called");const o="string"==typeof t?this.el(t):t;if(!(null==o?void 0:o.id))return void Bu.warn("Survey not found");if(!Hu.includes(o.type))return void Bu.warn(`Surveys of type ${o.type} cannot be rendered in the app`);const l=null===(n=typeof document>"u"?void 0:document)||void 0===n?void 0:n.querySelector(i);if(l){if(null===(r=o.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds){Bu.info(`Rendering survey ${o.id} with delay of ${o.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var i,s,n;this.La.delete(t),!this.Ti&&(null===(i=this.Ta)||void 0===i?void 0:i.canCapture)&&(Bu.info(`Rendering survey ${o.id} with delay of ${null===(s=o.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(o,l,e),Bu.info(`Survey ${o.id} rendered`))},1e3*o.appearance.surveyPopupDelaySeconds);return void this.La.add(t)}this._surveyManager.renderSurvey(o,l,e)}else Bu.warn("Survey element not found")}displaySurvey(t,i){var e,s;if(!(null===(e=this.Ta)||void 0===e?void 0:e.canCapture))return;if(wi(this._surveyManager))return void Bu.warn("init was not called");const n=this.el(t);if(!n)return void Bu.warn("Survey not found");let r=n;if((null===(s=n.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds)&&i.ignoreDelay&&(r=as(as({},n),{},{appearance:as(as({},n.appearance),{},{surveyPopupDelaySeconds:0})})),i.displayType!==aa.Popover&&i.initialResponses&&Bu.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){const t=this.il(n);if(!t.eligible)return void Bu.warn("Survey is not eligible to be displayed: ",t.reason)}i.displayType!==aa.Inline?this._surveyManager.handlePopoverSurvey(r,i):this.renderSurvey(r,i.selector,i.properties)}cancelPendingSurvey(t){wi(this._surveyManager)?Bu.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t)}},ac=class{constructor(t){this._instance=t}get(){var t,i,e,s;const n=null===(t=this._instance)||void 0===t?void 0:t.config;return{disableSurveys:!!(null==n?void 0:n.disable_surveys),cookielessMode:!!(null==n?void 0:n.cookieless_mode),advancedEnableSurveys:!!(null==n?void 0:n.advanced_enable_surveys),requestTimeoutMs:null!==(i=null==n?void 0:n.surveys_request_timeout_ms)&&void 0!==i?i:1e4,prefillFromUrl:!!(null==n||null===(e=n.surveys)||void 0===e?void 0:e.prefillFromUrl),automaticDisplay:!(null==n?void 0:n.disable_surveys_automatic_display),featureFlagEvaluation:!(null==n?void 0:n.advanced_disable_feature_flags),overrideLanguage:null==n?void 0:n.override_display_language,prepareStylesheet:null==n?void 0:n.prepare_external_dependency_stylesheet,get_current_url:null==n?void 0:n.get_current_url,uiHost:null===(s=this._instance)||void 0===s||null===(s=s.requestRouter)||void 0===s?void 0:s.endpointFor("ui","")}}getExtensions(){const t=null==ii?void 0:ii.__PosthogExtensions__;if(!t||!this._instance)return;const i=this._instance,{generateSurveys:e,loadExternalDependency:s}=t;return{generateSurveys:e?t=>e(i,t):void 0,loadExternalDependency:s?t=>s(i,"surveys",t):void 0}}onMatchingConditionsChanged(t){var i,e;const s=null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook(i=>{"$pageview"!==i&&i!==oa.SHOWN&&i!==oa.DISMISSED&&i!==oa.SENT||t()}),n=()=>t();Lr(qt,"PHSurveyShown",n);let r=!1;const o=null===(e=this._instance)||void 0===e?void 0:e.onFeatureFlags(()=>{r&&t()});return r=!0,()=>{r=!1,null==s||s(),null==o||o(),null==qt||qt.removeEventListener("PHSurveyShown",n)}}};const uc=(null==qt?void 0:qt.location)?Ol(qt.location.hash,"__posthog")||Ol(location.hash,"state"):null,hc="_postHogToolbarParams",cc=Pr("[Toolbar]"),dc=Pr("[FeatureFlags]"),vc=Pr("[FeatureFlags]",{debugEnabled:!0}),fc="\" failed. Feature flags didn't load in time.",pc=[502,504],gc=["click","keydown","wheel","touchstart","pointerdown"],_c="connection_error",mc=t=>{const i={};for(let e=0;t.length>e;e++)i[t[e]]=!0;return i},yc=t=>{const i={};for(const[e,s]of Cr(t||{}))s&&(i[e]=s);return i};var bc=class{constructor(t){this.name="featureFlags",this.xd=!1,this.featureFlagEventHandlers=[],this.A=dc,this.$d={},this.Cd={},this.Td=[],this.Id=new Set,this.Ed=new Set,this.Md=!1,this.Ad=!1,this.Rd=0,this.Pd=!1,this.Od=!1,this.Fd=!1,this.Dd=!1,this.Ld=!1,this.Nd=0,this.jd=!1,this.sn=()=>{const t=this.qd();this.Nd=0,t&&this.reloadFeatureFlags()},this.Bd=()=>{var t,i;const e=this.zd,s=null!==(t=this.Hd)&&void 0!==t?t:e;_i(e)||_i(s)||this.Dr.remoteRequestsDisabled||!this.Ud||"hidden"===this.Ud.visibilityState||Date.now()-(null!==(i=this.Wd)&&void 0!==i?i:0)<s||(this.Hd=this.jd||!this.Dr.idleRefreshBackoff?e:Math.min(2*s,36e5),this.jd=!1,this.reloadFeatureFlags(),this.Vd())},this.Gd=()=>{this.jd&&this.Hd===this.zd||this.Qd()},this.an=()=>{var t;"visible"===(null===(t=this.Ud)||void 0===t?void 0:t.visibilityState)&&this.Qd()},this.Ma=t}get Jd(){}Zd(){this.Ta&&this.Kd()}setup(t){try{this.Yd=typeof window>"u"?void 0:window,this.Ud=typeof document>"u"?void 0:document}catch(t){this.Yd=void 0,this.Ud=void 0}return this.Ba=t,this.A=t.logger.createLogger("[FeatureFlags]"),nc(t.kv.initialize(),()=>{this.Ba===t&&(this.Ba=void 0,this.Ta=t,this.Xd(t))})}Xd(t){var i;if(this.Ta===t)return this.Yd&&Lr(this.Yd,"online",this.sn),this.Kd(),this.tv=t.registerDynamicEventProperties(()=>this.ev()?this.$d:this.Cd),this.iv=null===(i=this.Jd)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.nv(),this.sv(),this.rv()}),this.sv(),this.initialize()}Qd(){this.jd=!0,this.Hd=this.zd,this.Bd()}Kd(){var t;const i=this.Dr.refreshIntervalMs,e=!this.Dr.remoteRequestsDisabled&&this.Ud&&!_i(i)&&i>0?i:void 0;this.Dr.idleRefreshBackoff||(this.Hd=e),e!==this.zd&&(this.ov(),_i(e)||(this.zd=e,this.Hd=e,this.Vd(),(null===(t=this.Ud)||void 0===t?void 0:t.addEventListener)&&(Lr(this.Ud,m,this.an),Or(gc,t=>{Lr(this.Ud,t,this.Gd,{capture:!0})}))))}Vd(){_i(this.zd)||(_i(this.av)||clearInterval(this.av),this.Wd=Date.now(),this.av=setInterval(this.Bd,this.zd))}ov(){var t,i;_i(this.av)||(clearInterval(this.av),this.av=void 0,null===(t=this.Ud)||void 0===t||null===(i=t.removeEventListener)||void 0===i||i.call(t,"visibilitychange",this.an),Or(gc,t=>{var i,e;null===(i=this.Ud)||void 0===i||null===(e=i.removeEventListener)||void 0===e||e.call(i,t,this.Gd,{capture:!0})})),this.zd=void 0,this.Hd=void 0,this.jd=!1,this.Wd=void 0}destroy(){this.lv()}dispose(){this.lv()}lv(){var t,i,e;this.ov(),this.Rd++,this.Od=!1,this.Ba=void 0,this.uv(this.Id,"cancelled"),this.uv(this.Ed,"cancelled"),this.Ta&&(this.hv(),null===(t=this.tv)||void 0===t||t.dispose(),this.tv=void 0,null===(i=this.iv)||void 0===i||i.call(this),this.iv=void 0,this.Td=[],null===(e=this.Yd)||void 0===e||e.removeEventListener("online",this.sn),this.Ta=void 0)}get Dr(){return this.Ma.get()}dv(t){var i;return this.vv&&t in this.vv?this.vv[t]:null===(i=this.Ta)||void 0===i?void 0:i.kv.get(t)}nv(){return!!this.vv&&(this.vv=void 0,!0)}fv(){var t;return!_i(null===(t=this.Ta)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.nv()}$t(t){this.pv(()=>{var i;return null===(i=this.Ta)||void 0===i?void 0:i.kv.set(t)})}gv(t,i,e){if(!this.Jd||!t.$enabled_feature_flags)return;const s=this.dv("$enabled_feature_flags")||{},o=t.$enabled_feature_flags||{},c=i.flags||i.featureFlags,d=i.flags?Object.entries(i.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],v=!!i.errorsWhileComputingFlags&&!!i.flags,f=v?d:e&&!vi(c)?Object.keys(c||{}):Array.from(new Set([...Object.keys(s),...Object.keys(o)])),g=this.dv("$feature_flag_payloads")||{},_=t.$feature_flag_payloads||{},m=v||e?f:Array.from(new Set([...Object.keys(g),...Object.keys(_)])),y=!v&&!e,b=!!y||f,w=!!y||m,x={[n]:b,[h]:b,[p]:w};t.$feature_flag_details&&(x[r]=b);for(const i of[a,l,u])_i(t[i])||(x[i]=!0);this.Jd.markCrossTabFeatureFlagChanges(x)}Dt(t){this.pv(()=>{var i;return null===(i=this.Ta)||void 0===i?void 0:i.kv.remove(t)})}pv(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}sv(){const t={};for(const i of[n,p,a,g]){const e=this.dv(i);_i(e)||(t[i]=e)}this.$d=t;const i=as({},t),e=this.dv(h);if(e)for(const[t,s]of Object.entries(e))i[`$feature/${t}`]=s;this.Cd=i}ev(){const t=this.Dr.cacheTtlMs;if(!t||0>=t)return!1;const i=this.dv(l);return"number"!=typeof i||Date.now()-i>t}mv(){return!!this.ev()&&(this.Ld||this.Ad||(this.Ld=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}yv(){const t=this.Dr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}bv(){const t=this.Dr.flagKeys;if(!_i(t))return t.filter(t=>{const 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;const e=this.Dr,s=null!==(t=null===(i=e.bootstrap)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(s).length){var n,r;const t=null!==(n=null===(r=e.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:{},i=Object.keys(s).filter(t=>!_i(s[t])).reduce((t,i)=>(t[i]=s[i],t),{}),o=Object.keys(t).filter(t=>i[t]).reduce((i,e)=>(i[e]=t[e],i),{});return this._v({featureFlags:i,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,i,e){var s,n;const r=(null==e?void 0:e.merge)&&null!==(s=this.dv("$enabled_feature_flags"))&&void 0!==s?s:{},o=(null==e?void 0:e.merge)&&null!==(n=this.dv("$feature_flag_payloads"))&&void 0!==n?n:{},l=as(as({},r),t),a=as(as({},o),i),u={};for(const[t,i]of Object.entries(l))u[t]={key:t,enabled:en(i),variant:sn(i),reason:void 0,metadata:_i(null==a?void 0:a[t])?void 0:{id:0,version:void 0,description:void 0,payload:a[t]}};this._v({flags:u})}get hasLoadedFlags(){return this.Md}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.dv(r),i=this.dv(g),e=this.dv(_);if(!e&&!i)return t||{};const s=Ar({},t||{}),n=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(const t of n){var o,l;const n=s[t],r=null==i?void 0:i[t],a=_i(r)?null!==(o=null==n?void 0:n.enabled)&&void 0!==o&&o:!!r,u=_i(r)?null==n?void 0:n.variant:"string"==typeof r?r:void 0,h=null==e?void 0:e[t],c=as(as({},n),{},{enabled:a,variant:a?null!=u?u:null==n?void 0:n.variant:void 0});a!==(null==n?void 0:n.enabled)&&(c.original_enabled=null==n?void 0:n.enabled),u!==(null==n?void 0:n.variant)&&(c.original_variant=null==n?void 0:n.variant),h&&(c.metadata=as(as({},null==n?void 0:n.metadata),{},{payload:h,original_payload:null==n||null===(l=n.metadata)||void 0===l?void 0:l.payload})),s[t]=c}return this.xd||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:s}),this.xd=!0),s}getAllFeatureFlags(){const t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{const s=t[e];return{key:e,enabled:en(s),variant:sn(s),payload:tn(i[e])}})}getFlagVariants(){const t=this.dv(h),i=this.dv(g);if(!i)return t||{};const e=Ar({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.xd||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.xd=!0),e}getFlagPayloads(){const t=this.dv(p),i=this.dv(_);if(!i)return t||{};const e=Ar({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.xd||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.xd=!0),e}reloadFeatureFlags(){this.Pd||this.Dr.featureFlagsDisabled||this.qd()||(this.Fd&&this.A.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this.Ad&&(this.Od=!0),this.wv||(this.Td.slice().forEach(t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.wv=setTimeout(()=>{this.Sv()},5)))}reloadFeatureFlagsAsync(){return!this.Ta||this.Pd||this.Dr.featureFlagsDisabled||this.Dr.remoteRequestsDisabled||this.qd()?Promise.resolve({status:"skipped"}):new Promise(t=>{this.Id.add(t),this.reloadFeatureFlags()})}uv(t,i){t.forEach(t=>t({status:i})),t.clear()}hv(){clearTimeout(this.wv),this.wv=void 0}onReloading(t){return this.Td.push(t),()=>{this.Td=this.Td.filter(i=>i!==t)}}ensureFlagsLoaded(){this.Md||this.Ad||this.wv||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Pd=t}resetFlagCallReported(){this.Dt(v)}Sv(t){var i;this.hv();const e=this.Ta;if(!e||this.Dr.remoteRequestsDisabled||this.qd())return void this.uv(this.Id,"skipped");if(this.Ad)return void(this.Od=!0);const s={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:as(as(as({},e.initialPersonProperties),this.dv("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.dv(c),timezone:wl()};_i(e.deviceId)||(s.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Dr.featureFlagsDisabled)&&(s.disable_flags=!0);const n=this.yv();n.length&&(s.evaluation_contexts=n);const r=this.bv();_i(r)||(s.flag_keys=r);const l=this.Dr.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(l?"&only_evaluate_survey_feature_flags=true":""),u=this.Rd,h=this.Id;this.Id=new Set,this.Ed=h,this.Ad=!0;const d=()=>{this.Od&&(this.Od=!1,this.Sv())},v=t=>{var i,e;const n=null!==(i=t.json)&&void 0!==i?i:{},r=200!==t.statusCode;if(this.Ad=!1,u!==this.Rd)return void d();if(this.xv(t.statusCode),r||this.Od||(this.$anon_distinct_id=void 0),s.disable_flags&&!this.Od)return void this.uv(h,"skipped");this.Dd=!r;const a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?_c:"unknown_error"):200!==t.statusCode&&a.push(`api_error_${t.statusCode}`),n.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");const c=!!(null===(e=n.quotaLimited)||void 0===e?void 0:e.includes("feature_flags"));c&&a.push("quota_limited"),this.$t({[o]:a}),c?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."):s.disable_flags||this._v(n,r,{partialResponse:l}),this.uv(h,s.disable_flags?"skipped":a.length||!n.flags&&!n.featureFlags?"error":"loaded"),d()},f=t=>{this.Ad=!1,u===this.Rd?(this.$t({[o]:[_c]}),this.A.error("Feature flag request failed",t),this.fv()&&this.rv(!0),this.uv(h,"error"),d()):d()};let p=null!==(i=this.Dr.requestMaxRetries)&&void 0!==i?i:1;const g=()=>p>0&&u===this.Rd,_=()=>{if(u!==this.Rd||!this.Ta||this.Dr.remoteRequestsDisabled)return this.Ad=!1,this.uv(h,"skipped"),void d();try{e.sendRequest(a,{target:"flags",method:"POST",body:s,compression:this.Dr.compression,sentAt:"body",timeoutMs:this.Dr.requestTimeoutMs}).then(t=>{if((t=>pc.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&g())return p--,void setTimeout(_,500);v(t)}).catch(f)}catch(t){f(t)}};_()}qd(){return Sl(this.Nd,3)}xv(t){this.Nd=El(t,this.Nd,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(i.fresh&&!this.Dd)return;if(!(this.Md||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+t+fc);if(this.mv())return;const s=this.getFeatureFlagResult(t,i);return null!==(e=null==s?void 0:s.variant)&&void 0!==e?e:null==s?void 0:s.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i={}){if(i.fresh&&!this.Dd)return;if(!(this.Md||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+t+fc);if(this.mv())return;const e=this.getFlagVariants(),s=t in e,n=e[t],r=this.getFlagPayloads()[t],o=String(n),l=this.dv("$feature_flag_request_id")||void 0,a=this.dv("$feature_flag_evaluated_at")||void 0;let u,h=this.dv("$flag_call_reported")||{};if(this.Dr.deduplicateCallsPerSession){var c;const t=null===(c=this.Ta)||void 0===c||null===(c=c.session)||void 0===c?void 0:c.sessionId,i=this.dv(f);t&&t!==i&&(h={},u=t)}if(!i.send_event&&"send_event"in i)u&&this.$t({[v]:h,[f]:u});else{var d,p;const i=null===(d=this.Ta)||void 0===d?void 0:d.canCapture;if(!i&&Object.keys(h).length>0&&(h={},this.$t({[v]:h})),i&&!(null===(p=h[t])||void 0===p?void 0:p.includes(o))){var g,_,m,y,b,w,x,S,E,k,T,P,O;vi(h[t])?h[t].push(o):h[t]=[o],this.$t(as({[v]:h},u?{[f]:u}:{}));const i=this.getFeatureFlagDetails(t),e=[...null!==(g=this.dv("$feature_flag_errors"))&&void 0!==g?g:[]];_i(n)&&e.push("flag_missing");const s={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:null!==(_=null===(m=this.Dr.bootstrap)||void 0===m||null===(m=m.featureFlags)||void 0===m?void 0:m[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(y=null===(b=this.Dr.bootstrap)||void 0===b||null===(b=b.featureFlagPayloads)||void 0===b?void 0:b[t])&&void 0!==y?y:null,$used_bootstrap_value:!this.Dd};_i(null==i||null===(w=i.metadata)||void 0===w?void 0:w.has_experiment)||(s.$feature_flag_has_experiment=i.metadata.has_experiment),_i(null==i||null===(x=i.metadata)||void 0===x?void 0:x.version)||(s.$feature_flag_version=i.metadata.version);const c=null!==(S=null==i||null===(E=i.reason)||void 0===E?void 0:E.description)&&void 0!==S?S:null==i||null===(k=i.reason)||void 0===k?void 0:k.code;c&&(s.$feature_flag_reason=c),(null==i||null===(T=i.metadata)||void 0===T?void 0:T.id)&&(s.$feature_flag_id=i.metadata.id),_i(null==i?void 0:i.original_variant)&&_i(null==i?void 0:i.original_enabled)||(s.$feature_flag_original_response=_i(i.original_variant)?i.original_enabled:i.original_variant),(null==i||null===(P=i.metadata)||void 0===P?void 0:P.original_payload)&&(s.$feature_flag_original_payload=null==i||null===(O=i.metadata)||void 0===O?void 0:O.original_payload),e.length&&(s.$feature_flag_error=e.join(",")),this.$v(s)}else u&&this.$t({[v]:h,[f]:u})}return s?{key:t,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:tn(r)}:void 0}$v(t){try{var i;null===(i=this.Ta)||void 0===i||i.capture("$feature_flag_called",t)}catch(t){this.A.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Cv(t,i)}Cv(t,i){var e=this;return Di(function*(){const s=e.Ta;if(!s)return;const n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=e.yv();r.length&&(n.evaluation_contexts=r);const o=e.bv();let l;_i(o)||(n.flag_keys=o);try{var a;const i=null===(a=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:e.Dr.compression,sentAt:"body",timeoutMs:e.Dr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==i?void 0:i[t])||void 0}catch(t){return void e.A.error("Remote config feature flag request failed",t)}try{i(l)}catch(t){e.A.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,i={}){if(i.fresh&&!this.Dd)return i.defaultValue;if(!(this.Md||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+fc),i.defaultValue;const e=this.getFeatureFlag(t,i);return _i(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._v(t,i,e)}_v(t,i,e){if(!this.Ta)return;this.Md=!0;const s=((t,i={},e={},s={},o,c=dc)=>{const d=((t,i)=>{const e=t.flags;if(e){const i=Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]})),s=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return!_i(null===(i=e[t].metadata)||void 0===i?void 0:i.payload)}).map(t=>{var i;return[t,null===(i=e[t].metadata)||void 0===i?void 0:i.payload]}));return as(as({},t),{},{featureFlags:i,featureFlagPayloads:s})}return t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,c),v=d.flags,f=d.featureFlags,g=d.featureFlagPayloads;if(!f)return;const _=t.requestId,m=t.evaluatedAt;if(vi(f)){c.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const t={};if(f)for(let i=0;f.length>i;i++)t[f[i]]=!0;return{[n]:f,[h]:t,[u]:!1}}let y=f,b=g,w=v;if(null==o?void 0:o.partialResponse){const t=Object.keys(y),n=b||{};y=as(as({},i),y),b=as(as({},e),n),t.forEach(t=>{t in n||null==b||delete b[t]}),w=as(as({},s),w)}else if(t.errorsWhileComputingFlags)if(v){const t=new Set(Object.keys(v).filter(t=>{var i;return!(null===(i=v[t])||void 0===i?void 0:i.failed)}));y=as(as({},i),Object.fromEntries(Object.entries(y).filter(([i])=>t.has(i))));const n=Object.fromEntries(Object.entries(b||{}).filter(([i])=>t.has(i)));b=as(as({},e),n),t.forEach(t=>{t in n||null==b||delete b[t]}),w=as(as({},s),Object.fromEntries(Object.entries(w||{}).filter(([i])=>t.has(i))))}else y=as(as({},i),y),b=as(as({},e),b),w=as(as({},s),w);return as(as({[n]:Object.keys(yc(y)),[h]:y||{},[p]:b||{},[r]:w||{},[u]:!0===t.minimalFlagCalledEvents},_?{[a]:_}:{}),m?{[l]:m}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.A);if(s)if(!1===(null==e?void 0:e.persist)){const t=!_i(this.Ta.kv.get(h));this.vv=s,t||this.$t(s)}else this.nv(),this.gv(s,t,!!(null==e?void 0:e.partialResponse)),this.$t(s);else i&&this.fv();i||(this.Ld=!1),this.rv(i)}override(t,i=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Tv(t)}Tv(t){if(this.Ta){if(!1===t)return this.Dt([g,_]),this.rv(),void vc.info("All overrides cleared");if(vi(t))return this.$t({[g]:mc(t)}),this.rv(),void vc.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i;const e=t;this.xd=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);const s={},n=e.flags,r=e.payloads;return n&&(s[g]=vi(n)?mc(n):n),r&&(s[_]=r),Object.keys(s).length&&this.$t(s),!1===n&&!1===r?this.Dt([g,_]):!1===n?this.Dt(g):!1===r&&this.Dt(_),this.rv(),!1===n?vc.info("Flag overrides cleared"):n&&vc.info("Flag overrides set",{flags:n}),void(!1===r?vc.info("Payload overrides cleared"):r&&vc.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.$t({[g]:t}),this.rv(),void vc.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){const{flags:i,flagVariants:e}=this.Iv();try{t(i,e)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var s;const r=(this.dv("$early_access_features")||[]).find(i=>i.flagKey===t),o={[`$feature_enrollment/${t}`]:i},l={$feature_flag:t,$feature_enrollment:i,$set:o};r&&(l.$early_access_feature_name=r.name),e&&(l.$feature_enrollment_stage=e);const a=as(as({},this.getFlagVariants()),{},{[t]:i});null===(s=this.Jd)||void 0===s||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(o)}),this.$t({[n]:Object.keys(yc(a)),[h]:a,[d]:as(as({},this.dv("$stored_person_properties")||{}),o)}),this.rv();try{var u;null===(u=this.Ta)||void 0===u||u.capture("$feature_enrollment_update",l)}catch(t){this.A.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i=!1,e){const n=this.dv(s);!n||i?this.Ev(t,e):t(n)}Ev(t,i){var e=this;return Di(function*(){const n=e.Ta;if(!n)return;const r=i?`&${i.map(t=>`stage=${t}`).join("&")}`:"";let o;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${r}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;o=t.json.earlyAccessFeatures,e.$t({[s]:o})}catch(t){return void e.A.error("Early access feature request failed",t)}try{t(o)}catch(t){e.A.error("Early access feature callback failed",t)}})()}Iv(){const t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter(t=>i[t]),flagVariants:Object.keys(i).filter(t=>i[t]).reduce((t,e)=>(t[e]=i[e],t),{})}}rv(t){this.sv();const{flags:i,flagVariants:e}=this.Iv(),s=this.Fd;this.Fd=!0,this.featureFlagEventHandlers.forEach(s=>{try{s(i,e,{errorsLoading:t})}catch(t){this.A.error("Error while running feature flags callback",t)}}),this.Fd=s}setPersonPropertiesForFlags(t,i=!0){this.Mv(t,i)}Mv(t,i=!0){const e=this.dv("$stored_person_properties")||{},s=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),n=null==t?void 0:t.$set_once,r={};if(n)for(const t in n)({}).hasOwnProperty.call(n,t)&&(t in e||(r[t]=n[t]));this.$t({[d]:as(as(as({},e),r),s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i=!0){const e=as({},this.dv("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.$t({[d]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Dt(d),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i=!0){const e=this.dv("$stored_group_properties")||{},s=as({},e);for(const i of Object.keys(t))s[i]=as(as({},e[i]),t[i]);this.$t({[c]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const i=this.dv("$stored_group_properties")||{};this.$t({[c]:as(as({},i),{},{[t]:{}})})}else this.Dt(c)}reset(){this.Rd++,this.uv(this.Id,"cancelled"),this.uv(this.Ed,"cancelled"),this.Od=!1,this.$d={},this.Cd={},this.vv=void 0,this.Md=!1,this.Pd=!1,this.Dd=!1,this.$anon_distinct_id=void 0,this.hv(),this.xd=!1,this.Nd=0}};const wc=Pr("[FeatureFlags]");var $c=class{constructor(t,i=!1){this.Av=!1,this.update(t,i)}update(t,i){this.Rv=((t,i)=>{var e,s,n,r,o,l,a,u;return{bootstrap:{featureFlags:null!==(e=null===(s=t.bootstrap)||void 0===s?void 0:s.featureFlags)&&void 0!==e?e:void 0,featureFlagPayloads:null!==(n=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:_i(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(l=t.feature_flag_request_max_retries)&&void 0!==l?l:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(a=null!==(u=t.evaluation_contexts)&&void 0!==u?u:t.evaluation_environments)&&void 0!==a?a:[],flagKeys:vi(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.Av||(wc.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Av=!0),_i(t.flag_keys)||vi(t.flag_keys)||wc.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Rv}};const xc=t=>Oi(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Sc=Pr("[Error tracking]"),Ec="webkit-masked-url:",kc=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Tc=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Ec],Pc=["__firefox__","__gCrWeb"];function Oc(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);i>e;e++)s[e]=t[e];return s}function Rc(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,i){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var s,n,r,o,l=[],a=!0,u=!1;try{if(r=(e=e.call(t)).next,0===i);else for(;!(a=(s=r.call(e)).done)&&(l.push(s.value),l.length!==i);a=!0);}catch(t){u=!0,n=t}finally{try{if(!a&&null!=e.return&&(o=e.return(),Object(o)!==o))return}finally{if(u)throw n}}return l}}(t,i)||function(t,i){if(t){if("string"==typeof t)return Oc(t,i);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Oc(t,i):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Ac=Object.entries,Cc=Object.setPrototypeOf,Ic=Object.isFrozen,Mc=Object.getPrototypeOf,Fc=Object.getOwnPropertyDescriptor;let Dc=Object.freeze,Nc=Object.seal,Lc=Object.create,jc="undefined"!=typeof Reflect&&Reflect,Uc=jc.apply,Bc=jc.construct;Dc||(Dc=function(t){return t}),Nc||(Nc=function(t){return t}),Uc||(Uc=function(t,i){for(var e=arguments.length,s=new Array(e>2?e-2:0),n=2;e>n;n++)s[n-2]=arguments[n];return t.apply(i,s)}),Bc||(Bc=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),s=1;i>s;s++)e[s-1]=arguments[s];return new t(...e)});const zc=ud([].forEach),Hc=ud([].lastIndexOf),qc=ud([].pop),Wc=ud([].push),Vc=ud([].splice),Gc=Array.isArray,Kc=ud("".toLowerCase),Yc=ud("".toString),Jc=ud("".match),Xc=ud("".replace),Zc=ud("".indexOf),Qc=ud("".trim),td=ud((0).toString),id=ud(Boolean.prototype.toString),ed="undefined"==typeof BigInt?null:ud(BigInt.prototype.toString),sd="undefined"==typeof Symbol?null:ud(Symbol.prototype.toString),nd=ud({}.hasOwnProperty),rd=ud({}.toString),od=ud(/t/.test),ld=(ad=TypeError,function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return Bc(ad,i)});var ad;function ud(t){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;e>n;n++)s[n-1]=arguments[n];return Uc(t,i,s)}}function hd(t,i){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Kc;if(Cc&&Cc(t,null),!Gc(i))return t;let s=i.length;for(;s--;){let n=i[s];if("string"==typeof n){const t=e(n);t!==n&&(Ic(i)||(i[s]=t),n=t)}t[n]=!0}return t}function cd(t){for(let i=0;t.length>i;i++)nd(t,i)||(t[i]=null);return t}function dd(t){const i=Lc(null);for(const s of Ac(t)){var e=Rc(s,2);const n=e[0],r=e[1];nd(t,n)&&(i[n]=Gc(r)?cd(r):r&&"object"==typeof r&&r.constructor===Object?dd(r):r)}return i}function vd(t,i){for(;null!==t;){const e=Fc(t,i);if(e){if(e.get)return ud(e.get);if("function"==typeof e.value)return ud(e.value)}t=Mc(t)}return function(){return null}}const fd=Dc(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),pd=Dc(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),gd=Dc(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),_d=Dc(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),md=Dc(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),yd=Dc(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bd=Dc(["#text"]),wd=Dc(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),$d=Dc(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),xd=Dc(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Sd=Dc(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ed=Nc(/{{[\w\W]*|^[\w\W]*}}/g),kd=Nc(/<%[\w\W]*|^[\w\W]*%>/g),Td=Nc(/\${[\w\W]*/g),Pd=Nc(/^data-[\-\w.\u00B7-\uFFFF]+$/),Od=Nc(/^aria-[\-\w]+$/),Rd=Nc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ad=Nc(/^(?:\w+script|data):/i),Cd=Nc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Id=Nc(/^html$/i),Md=Nc(/^[a-z][.\w]*(-[.\w]+)+$/i),Fd=Nc(/<[/\w!]/g),Dd=Nc(/<[/\w]/g),Nd=Nc(/<\/no(script|embed|frames)/i),Ld=Nc(/\/>/i),jd=function(){return"undefined"==typeof window?null:window},Ud=function(t,i,e,s){return nd(t,i)&&Gc(t[i])?hd(s.base?dd(s.base):{},t[i],s.transform):e};var Bd=function t(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:jd();const e=i=>t(i);if(e.version="3.4.13",e.removed=[],!i||!i.document||9!==i.document.nodeType||!i.Element)return e.isSupported=!1,e;let s=i.document;const n=s,r=n.currentScript,o=i.HTMLTemplateElement,l=i.Node,a=i.NodeFilter,u=i.DOMParser,h=i.trustedTypes,c=i.Element.prototype,d=vd(c,"cloneNode"),v=vd(c,"remove"),f=vd(c,"nextSibling"),p=vd(c,"childNodes"),g=vd(c,"parentNode"),_=vd(c,"shadowRoot"),m=vd(c,"attributes"),y=l&&l.prototype?vd(l.prototype,"nodeType"):null,b=l&&l.prototype?vd(l.prototype,"nodeName"):null,w=l&&l.prototype?vd(l.prototype,"ownerDocument"):null;if("function"==typeof o){const t=s.createElement("template");t.content&&t.content.ownerDocument&&(s=t.content.ownerDocument)}let x,S,E="",k=!1,T=0;const P=function(){if(T>0)throw ld('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},O=function(t){P(),T++;try{return x.createHTML(t)}finally{T--}},R=s.implementation,A=s.createNodeIterator,C=s.createDocumentFragment,I=s.getElementsByTagName,M=n.importNode;let F={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};e.isSupported="function"==typeof Ac&&"function"==typeof g&&R&&void 0!==R.createHTMLDocument;const D=Ed,N=kd,L=Td,j=Pd,U=Od,B=Ad,z=Cd,H=Md;let q=Rd,W=null;const V=hd({},[...fd,...pd,...gd,...md,...bd]);let G=null;const K=hd({},[...wd,...$d,...xd,...Sd]);let Y=Object.seal(Lc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),J=null,X=null;const Z=Object.seal(Lc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Q=!0,tt=!0,it=!1,et=!0,st=!1,nt=!0,rt=!1,ot=!1,lt=null,at=null,ut=!1,ht=!1,ct=!1,dt=!1,vt=!0,ft=!1;const pt="user-content-";let gt=!0,_t=!1,mt={},yt=null;const bt=hd({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let wt=null;const $t=hd({},["audio","video","img","source","image","track"]);let xt=null;const St=hd({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Et="http://www.w3.org/1998/Math/MathML",kt="http://www.w3.org/2000/svg",Tt="http://www.w3.org/1999/xhtml";let Pt=Tt,Ot=!1,Rt=null;const At=hd({},[Et,kt,Tt],Yc),Ct=Dc(["mi","mo","mn","ms","mtext"]);let It=hd({},Ct);const Mt=Dc(["annotation-xml"]);let Ft=hd({},Mt);const Dt=hd({},["title","style","font","a","script"]);let Nt=null;const Lt=["application/xhtml+xml","text/html"];let jt=null,Ut=null;const Bt=s.createElement("form"),zt=function(t){return t instanceof RegExp||t instanceof Function},Ht=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Ut&&Ut===t)return;t&&"object"==typeof t||(t={}),t=dd(t),Nt=-1===Lt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,jt="application/xhtml+xml"===Nt?Yc:Kc,W=Ud(t,"ALLOWED_TAGS",V,{transform:jt}),G=Ud(t,"ALLOWED_ATTR",K,{transform:jt}),Rt=Ud(t,"ALLOWED_NAMESPACES",At,{transform:Yc}),xt=Ud(t,"ADD_URI_SAFE_ATTR",St,{transform:jt,base:St}),wt=Ud(t,"ADD_DATA_URI_TAGS",$t,{transform:jt,base:$t}),yt=Ud(t,"FORBID_CONTENTS",bt,{transform:jt}),J=Ud(t,"FORBID_TAGS",dd({}),{transform:jt}),X=Ud(t,"FORBID_ATTR",dd({}),{transform:jt}),mt=!!nd(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?dd(t.USE_PROFILES):t.USE_PROFILES),Q=!1!==t.ALLOW_ARIA_ATTR,tt=!1!==t.ALLOW_DATA_ATTR,it=t.ALLOW_UNKNOWN_PROTOCOLS||!1,et=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,st=t.SAFE_FOR_TEMPLATES||!1,nt=!1!==t.SAFE_FOR_XML,rt=t.WHOLE_DOCUMENT||!1,ht=t.RETURN_DOM||!1,ct=t.RETURN_DOM_FRAGMENT||!1,dt=t.RETURN_TRUSTED_TYPE||!1,ut=t.FORCE_BODY||!1,vt=!1!==t.SANITIZE_DOM,ft=t.SANITIZE_NAMED_PROPS||!1,gt=!1!==t.KEEP_CONTENT,_t=t.IN_PLACE||!1,q=function(t){try{return od(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:Rd,Pt="string"==typeof t.NAMESPACE?t.NAMESPACE:Tt,It=nd(t,"MATHML_TEXT_INTEGRATION_POINTS")&&t.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof t.MATHML_TEXT_INTEGRATION_POINTS?dd(t.MATHML_TEXT_INTEGRATION_POINTS):hd({},Ct),Ft=nd(t,"HTML_INTEGRATION_POINTS")&&t.HTML_INTEGRATION_POINTS&&"object"==typeof t.HTML_INTEGRATION_POINTS?dd(t.HTML_INTEGRATION_POINTS):hd({},Mt);const i=nd(t,"CUSTOM_ELEMENT_HANDLING")&&t.CUSTOM_ELEMENT_HANDLING&&"object"==typeof t.CUSTOM_ELEMENT_HANDLING?dd(t.CUSTOM_ELEMENT_HANDLING):Lc(null);if(Y=Lc(null),nd(i,"tagNameCheck")&&zt(i.tagNameCheck)&&(Y.tagNameCheck=i.tagNameCheck),nd(i,"attributeNameCheck")&&zt(i.attributeNameCheck)&&(Y.attributeNameCheck=i.attributeNameCheck),nd(i,"allowCustomizedBuiltInElements")&&"boolean"==typeof i.allowCustomizedBuiltInElements&&(Y.allowCustomizedBuiltInElements=i.allowCustomizedBuiltInElements),Nc(Y),st&&(tt=!1),ct&&(ht=!0),mt&&(W=hd({},bd),G=Lc(null),!0===mt.html&&(hd(W,fd),hd(G,wd)),!0===mt.svg&&(hd(W,pd),hd(G,$d),hd(G,Sd)),!0===mt.svgFilters&&(hd(W,gd),hd(G,$d),hd(G,Sd)),!0===mt.mathMl&&(hd(W,md),hd(G,xd),hd(G,Sd))),Z.tagCheck=null,Z.attributeCheck=null,nd(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?Z.tagCheck=t.ADD_TAGS:Gc(t.ADD_TAGS)&&(W===V&&(W=dd(W)),hd(W,t.ADD_TAGS,jt))),nd(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?Z.attributeCheck=t.ADD_ATTR:Gc(t.ADD_ATTR)&&(G===K&&(G=dd(G)),hd(G,t.ADD_ATTR,jt))),nd(t,"ADD_URI_SAFE_ATTR")&&Gc(t.ADD_URI_SAFE_ATTR)&&hd(xt,t.ADD_URI_SAFE_ATTR,jt),nd(t,"FORBID_CONTENTS")&&Gc(t.FORBID_CONTENTS)&&(yt===bt&&(yt=dd(yt)),hd(yt,t.FORBID_CONTENTS,jt)),nd(t,"ADD_FORBID_CONTENTS")&&Gc(t.ADD_FORBID_CONTENTS)&&(yt===bt&&(yt=dd(yt)),hd(yt,t.ADD_FORBID_CONTENTS,jt)),gt&&(W["#text"]=!0),rt&&hd(W,["html","head","body"]),W.table&&(hd(W,["tbody"]),delete J.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw ld('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw ld('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const i=x;x=t.TRUSTED_TYPES_POLICY;try{E=O("")}catch(t){throw x=i,t}}else null===t.TRUSTED_TYPES_POLICY?(x=void 0,E=""):(void 0===x&&(k||(S=function(t,i){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let e=null;const s="data-tt-policy-suffix";i&&i.hasAttribute(s)&&(e=i.getAttribute(s));const n="dompurify"+(e?"#"+e:"");try{return t.createPolicy(n,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+n+" could not be created."),null}}(h,r),k=!0),x=S),x&&"string"==typeof E&&(E=O("")));Dc&&Dc(t),Ut=t},qt=hd({},[...pd,...gd,..._d]),Wt=hd({},[...md,...yd]),Vt=function(t){Wc(e.removed,{element:t});try{g(t).removeChild(t)}catch(i){if(v(t),!g(t))throw ld("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Gt=function(t){Jt(t);const i=p(t);if(i){const t=[];zc(i,i=>{Wc(t,i)}),zc(t,t=>{try{v(t)}catch(t){}})}const e=m(t);if(e)for(let i=e.length-1;i>=0;--i){const s=e[i],n=s&&s.name;if("string"==typeof n)try{t.removeAttribute(n)}catch(t){}}},Kt=function(t,i){try{Wc(e.removed,{attribute:i.getAttributeNode(t),from:i})}catch(t){Wc(e.removed,{attribute:null,from:i})}if(i.removeAttribute(t),"is"===t)if(ht||ct)try{Vt(i)}catch(t){}else try{i.setAttribute(t,"")}catch(t){}},Yt=function(t){const i=m(t);if(i)for(let e=i.length-1;e>=0;--e){const s=i[e],n=s&&s.name;if("string"==typeof n&&!G[jt(n)])try{t.removeAttribute(n)}catch(t){}}},Jt=function(t){const i=[t];for(;i.length>0;){const t=i.pop();1===(y?y(t):t.nodeType)&&Yt(t);const e=p(t);if(e)for(let t=e.length-1;t>=0;--t)i.push(e[t])}},Xt=function(t){let i=null,e=null;if(ut)t="<remove></remove>"+t;else{const i=Jc(t,/^[\r\n\t ]+/);e=i&&i[0]}"application/xhtml+xml"===Nt&&Pt===Tt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const n=x?O(t):t;if(Pt===Tt)try{i=(new u).parseFromString(n,Nt)}catch(t){}if(!i||!i.documentElement){i=R.createDocument(Pt,"template",null);try{i.documentElement.innerHTML=Ot?E:n}catch(t){}}const r=i.body||i.documentElement;return t&&e&&r.insertBefore(s.createTextNode(e),r.childNodes[0]||null),Pt===Tt?I.call(i,rt?"html":"body")[0]:rt?i.documentElement:r},Zt=function(t){const i=w?w(t):t.ownerDocument;return A.call(i||t,t,a.SHOW_ELEMENT|a.SHOW_COMMENT|a.SHOW_TEXT|a.SHOW_PROCESSING_INSTRUCTION|a.SHOW_CDATA_SECTION,null)},Qt=function(t){return t=Xc(t,D," "),t=Xc(t,N," "),Xc(t,L," ")},ti=function(t){var i;t.normalize();const e=w?w(t):t.ownerDocument,s=A.call(e||t,t,a.SHOW_TEXT|a.SHOW_COMMENT|a.SHOW_CDATA_SECTION|a.SHOW_PROCESSING_INSTRUCTION,null);let n=s.nextNode();for(;n;)n.data=Qt(n.data),n=s.nextNode();const r=null===(i=t.querySelectorAll)||void 0===i?void 0:i.call(t,"template");r&&zc(r,t=>{ei(t.content)&&ti(t.content)})},ii=function(t){const i=b?b(t):null;return"string"==typeof i&&"form"===jt(i)&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||t.attributes!==m(t)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes||t.nodeType!==y(t)||t.childNodes!==p(t))},ei=function(t){if(!y||"object"!=typeof t||null===t)return!1;try{return 11===y(t)}catch(t){return!1}},si=function(t){if(!y||"object"!=typeof t||null===t)return!1;try{return"number"==typeof y(t)}catch(t){return!1}};function ni(t,i,s){0!==t.length&&zc(t,t=>{t.call(e,i,s,Ut)})}const ri=function(t,i,e,s){return 0===t.length?i:i===e||i===s?dd(i):i},oi=function(t,i){if(ni(F.beforeSanitizeElements,t,null),t!==i&&null===g(t))return _t&&Jt(t),!0;if(ii(t))return Vt(t),!0;const s=jt(b?b(t):t.nodeName);if(W=ri(F.uponSanitizeElement,W,V,lt),ni(F.uponSanitizeElement,t,{tagName:s,allowedTags:W}),t!==i&&null===g(t))return _t&&Jt(t),!0;if(function(t,i){return!!(nt&&t.hasChildNodes()&&!si(t.firstElementChild)&&od(Fd,t.textContent)&&od(Fd,t.innerHTML))||!(!nt||t.namespaceURI!==Tt||"style"!==i||!si(t.firstElementChild))||7===t.nodeType||!(!nt||8!==t.nodeType||!od(Dd,t.data))}(t,s))return Vt(t),!0;if(J[s]||!(Z.tagCheck instanceof Function&&Z.tagCheck(s))&&!W[s]){const e=function(t,i,e){if(!J[i]&&ui(i)){if(Y.tagNameCheck instanceof RegExp&&od(Y.tagNameCheck,i))return!1;if(Y.tagNameCheck instanceof Function&&Y.tagNameCheck(i))return!1}if(gt&&!yt[i]){const i=g(t),s=p(t);if(s&&i)for(let n=s.length-1;n>=0;--n){const r=t===e?d(s[n],!0):s[n];i.insertBefore(r,f(t))}}return Vt(t),!0}(t,s,i);return!1===e&&ni(F.afterSanitizeElements,t,null),e}if(1===(y?y(t):t.nodeType)&&!function(t){let i=g(t);i&&i.tagName||(i={namespaceURI:Pt,tagName:"template"});const e=Kc(t.tagName),s=Kc(i.tagName);return!!Rt[t.namespaceURI]&&(t.namespaceURI===kt?function(t,i,e){return i.namespaceURI===Tt?"svg"===t:i.namespaceURI===Et?"svg"===t&&("annotation-xml"===e||It[e]):Boolean(qt[t])}(e,i,s):t.namespaceURI===Et?function(t,i,e){return i.namespaceURI===Tt?"math"===t:i.namespaceURI===kt?"math"===t&&Ft[e]:Boolean(Wt[t])}(e,i,s):t.namespaceURI===Tt?function(t,i,e){return!(i.namespaceURI===kt&&!Ft[e])&&!(i.namespaceURI===Et&&!It[e])&&!Wt[t]&&(Dt[t]||!qt[t])}(e,i,s):!("application/xhtml+xml"!==Nt||!Rt[t.namespaceURI]))}(t))return Vt(t),!0;if(("noscript"===s||"noembed"===s||"noframes"===s)&&od(Nd,t.innerHTML))return Vt(t),!0;if(st&&3===t.nodeType){const i=Qt(t.textContent);t.textContent!==i&&(Wc(e.removed,{element:t.cloneNode()}),t.textContent=i)}return ni(F.afterSanitizeElements,t,null),!1},li=function(t,i,e){if(X[i])return!1;if(nt&&"patchsrc"===i)return!1;if(nt&&"for"===i&&"label"!==t&&"output"!==t)return!1;if(vt&&("id"===i||"name"===i)&&(e in s||e in Bt))return!1;const n=G[i]||Z.attributeCheck instanceof Function&&Z.attributeCheck(i,t);if(tt&&od(j,i));else if(Q&&od(U,i));else if(n){if(xt[i]);else if(od(q,Xc(e,z,"")));else if("src"!==i&&"xlink:href"!==i&&"href"!==i||"script"===t||0!==Zc(e,"data:")||!wt[t])if(it&&!od(B,Xc(e,z,"")));else if(e)return!1}else if(!(ui(t)&&(Y.tagNameCheck instanceof RegExp&&od(Y.tagNameCheck,t)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(t))&&(Y.attributeNameCheck instanceof RegExp&&od(Y.attributeNameCheck,i)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(i,t))||"is"===i&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&od(Y.tagNameCheck,e)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(e))))return!1;return!0},ai=hd({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ui=function(t){return!ai[Kc(t)]&&od(H,t)},hi=function(t,i,e,s){if(x&&"object"==typeof h&&"function"==typeof h.getAttributeType&&!e)switch(h.getAttributeType(t,i)){case"TrustedHTML":return O(s);case"TrustedScriptURL":return function(t){P(),T++;try{return x.createScriptURL(t)}finally{T--}}(s)}return s},ci=function(t,i,s,n){try{s?t.setAttributeNS(s,i,n):t.setAttribute(i,n),ii(t)?Vt(t):qc(e.removed)}catch(e){Kt(i,t)}},di=function(t){ni(F.beforeSanitizeAttributes,t,null);const i=t.attributes;if(!i||ii(t))return;G=ri(F.uponSanitizeAttribute,G,K,at);const e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:G,forceKeepAttr:void 0};let s=i.length;const n=jt(t.nodeName);for(;s--;){const r=i[s],o=r.name,l=r.namespaceURI,a=r.value,u=jt(o),h=a;let c="value"===o?h:Qc(h);e.attrName=u,e.attrValue=c,e.keepAttr=!0,e.forceKeepAttr=void 0,ni(F.uponSanitizeAttribute,t,e),c=e.attrValue,!ft||"id"!==u&&"name"!==u||0===Zc(c,pt)||(Kt(o,t),c=pt+c),nt&&od(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,c)||"attributename"===u&&Jc(c,"href")?Kt(o,t):e.forceKeepAttr||(!e.keepAttr||!et&&od(Ld,c)?Kt(o,t):(st&&(c=Qt(c)),li(n,u,c)?(c=hi(n,u,l,c),c!==h&&ci(t,o,l,c)):Kt(o,t)))}ni(F.afterSanitizeAttributes,t,null)},vi=function(t){let i=null;const e=Zt(t);for(ni(F.beforeSanitizeShadowDOM,t,null);i=e.nextNode();)if(ni(F.uponSanitizeShadowNode,i,null),oi(i,t),di(i),ei(i.content)&&vi(i.content),1===(y?y(i):i.nodeType)){const t=_(i);ei(t)&&(fi(t),vi(t))}ni(F.afterSanitizeShadowDOM,t,null)},fi=function(t){const i=[{node:t,shadow:null}];for(;i.length>0;){const t=i.pop();if(t.shadow){vi(t.shadow);continue}const e=t.node,s=1===(y?y(e):e.nodeType),n=p(e);if(n)for(let t=n.length-1;t>=0;--t)i.push({node:n[t],shadow:null});if(s){const t=b?b(e):null;if("string"==typeof t&&"template"===jt(t)){const t=e.content;ei(t)&&i.push({node:t,shadow:null})}}if(s){const t=_(e);ei(t)&&i.push({node:null,shadow:t},{node:t,shadow:null})}}};return e.sanitize=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=null,r=null,o=null,l=null;if(Ot=!t,Ot&&(t="\x3c!--\x3e"),"string"!=typeof t&&!si(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return td(t);case"boolean":return id(t);case"bigint":return ed?ed(t):"0";case"symbol":return sd?sd(t):"Symbol()";case"undefined":default:return rd(t);case"function":case"object":{if(null===t)return rd(t);const i=t,e=vd(i,"toString");if("function"==typeof e){const t=e(i);return"string"==typeof t?t:rd(t)}return rd(t)}}}(t)))throw ld("dirty is not a string, aborting");if(!e.isSupported)return t;ot?(W=lt,G=at):Ht(i),(F.uponSanitizeElement.length>0||F.uponSanitizeAttribute.length>0)&&(W=dd(W)),F.uponSanitizeAttribute.length>0&&(G=dd(G)),e.removed=[];const a=_t&&"string"!=typeof t&&si(t);if(a){!function(t){if(!nt)return;const i=[t];for(;i.length>0;){const t=i.pop(),e=y?y(t):t.nodeType;if(7===e||8===e&&od(Dd,t.data)){try{v(t)}catch(t){}continue}if(1===e){const i=t,e=jt(b?b(t):t.nodeName);try{i.hasAttribute&&i.hasAttribute("patchsrc")&&i.removeAttribute("patchsrc"),i.hasAttribute&&i.hasAttribute("for")&&"label"!==e&&"output"!==e&&i.removeAttribute("for")}catch(t){}}const s=p(t);if(s)for(let t=s.length-1;t>=0;--t)i.push(s[t])}}(t);const i=b?b(t):t.nodeName;if("string"==typeof i){const e=jt(i);if(!W[e]||J[e])throw Gt(t),ld("root node is forbidden and cannot be sanitized in-place")}if(ii(t))throw Gt(t),ld("root node is clobbered and cannot be sanitized in-place");try{fi(t)}catch(i){throw Gt(t),i}}else if(si(t))s=Xt("\x3c!----\x3e"),r=s.ownerDocument.importNode(t,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?s=r:s.appendChild(r),fi(r);else{if(!ht&&!st&&!rt&&-1===t.indexOf("<"))return x&&dt?O(t):t;if(s=Xt(t),!s)return ht?null:dt?E:""}s&&ut&&Vt(s.firstChild);const u=a?t:s;try{const t=Zt(u);for(;o=t.nextNode();)oi(o,u),di(o),ei(o.content)&&vi(o.content)}catch(i){throw a&&(Gt(t),zc(e.removed,t=>{t.element&&Jt(t.element)})),i}if(a)return zc(e.removed,t=>{t.element&&Jt(t.element)}),st&&ti(t),t;if(ht){if(st&&ti(s),ct)for(l=C.call(s.ownerDocument);s.firstChild;)l.appendChild(s.firstChild);else l=s;return(G.shadowroot||G.shadowrootmode)&&(l=M.call(n,l,!0)),l}let h=rt?s.outerHTML:s.innerHTML;return rt&&W["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&od(Id,s.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+s.ownerDocument.doctype.name+">\n"+h),st&&(h=Qt(h)),x&&dt?O(h):h},e.setConfig=function(){Ht(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ot=!0,lt=W,at=G},e.clearConfig=function(){Ut=null,ot=!1,lt=null,at=null,x=S,E=""},e.isValidAttribute=function(t,i,e){Ut||Ht({});const s=jt(t),n=jt(i);return li(s,n,e)},e.addHook=function(t,i){"function"==typeof i&&nd(F,t)&&Wc(F[t],i)},e.removeHook=function(t,i){if(nd(F,t)){if(void 0!==i){const e=Hc(F[t],i);return-1===e?void 0:Vc(F[t],e,1)[0]}return qc(F[t])}},e.removeHooks=function(t){nd(F,t)&&(F[t]=[])},e.removeAllHooks=function(){F={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},e}();const zd="Refusing to render web experiment since the viewer is a likely bot",Hd={ADD_ATTR:(t,i)=>"target"===t&&"a"===i||"form"===t&&/^(button|fieldset|input|output|select|textarea)$/.test(i),ADD_URI_SAFE_ATTR:["form"]};let qd;const Wd={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Au(i,t),not_regex:(t,i)=>!Au(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},Vd=Pr("[Conversations]"),Gd="Conversations not available yet.";function Kd(t,i){var e,s,n,r,o,l,a;const u=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,h=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,c=(null==i?void 0:i.consoleCapture)?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,d=_i(c)?Math.max(h,2048):Math.max(h,c),v=as(as({},function(){let t="",i="";try{var e;const s="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,n=null==s||null===(e=s.navigator)||void 0===e?void 0:e.userAgent;n&&([t,i]=Ue(n))}catch(t){}return function(t,i){const e=function(t){if(t)return{}.hasOwnProperty.call(or,t)?or[t]:t}(t);return as(as({},e?{"os.name":e}:{}),i?{"os.version":i}:{})}(t,i)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(r=null!==(o=null==v?void 0:v["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==r?r:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==v?void 0:v["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(a=null==v?void 0:v["deployment.environment"])&&void 0!==a?a:null==t?void 0:t.environment,resourceAttributes:v,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const Yd=["debug","log","warn","error","info"],Jd=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},Xd="console",Zd="__posthogHandledLogsRequestError",Qd=(t,i)=>{const e=t instanceof Error?t:new Error(i);return e[Zd]=!0,e},tv=t=>!!t&&"object"==typeof t&&!0===t[Zd];var iv=class{get Pv(){return as(as({},this.A),{},{error:(...t)=>{t.some(tv)||this.A.error(...t)}})}constructor(t,i){var e;this.Ma=t,this.Ov=i,this.name="logs",this.Fv=!1,this.Dv=!1,this.Lv=!1,this.A=Pr("[logs]"),this.tc=[],this.Nv=[],this.Nd=0,this.jv=!1,this.Ti=!1,this.qv=[],this.Bv=[],this.zv=!1,this.Hv=!1,this.Uv=!1,this.Wv=()=>{var t,i;this.Ti||(this.Nd=0,null===(t=this.Vv)||void 0===t||t.onReconnect(),null===(i=this.Gv)||void 0===i||i.onReconnect())},this.Fv=!!(null===(e=t.get())||void 0===e?void 0:e.captureConsoleLogs)}get Qv(){return!0}Jv(){}Zv(){if(!this.Uv){try{this.Yd=typeof window>"u"?void 0:window}catch(t){this.Yd=void 0}this.Yd&&(Lr(this.Yd,"online",this.Wv),this.Uv=!0)}}Kv(t,i,e,s){this.Zv();const n=Kd(this.Ma.get(),e);return[new gr(this.Yv(t,i),n,this.Pv,()=>this.Ov(),t=>t(),void 0,s),n]}Xv(){const t=this.Ma.get();var i;return this.Vv&&this.tf===t||(null===(i=this.Vv)||void 0===i||i.reset(),this.tf=t,[this.Vv,this.ef]=this.Kv(()=>this.tc,t=>{this.tc=t})),this.Vv}if(){const t=this.Ma.get();var i;return this.Gv&&this.nf===t||(null===(i=this.Gv)||void 0===i||i.reset(),this.nf=t,[this.Gv,this.sf]=this.Kv(()=>this.Nv,t=>{this.Nv=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Xd)),this.Gv}setup(t){if(!this.Ti&&!this.jv)return this.jv=!0,this.Ta=t,this.A=t.logger.createLogger("[logs]"),nc(t.kv.initialize(),()=>{this.Ti||this.Xd(t)})}Xd(t){var i;this.Zv(),(null===(i=this.Ma.get())||void 0===i?void 0:i.captureConsoleLogs)&&(this.Fv=!0),(this.Fv||this.Ma.remoteConfigWillArrive&&t.kv.get(this.Ma.captureHintKey))&&this.rf();let e=!1;const s=t.onRemoteConfig(t=>{var i;e=t.ok&&!0===(null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)});this.Ti?s.dispose():(this.za=s,e||this.loadIfEnabled())}dispose(){var t,i,e,s,n,r,o;this.Ti||(this.Ti=!0,this.af(),null===(t=this.za)||void 0===t||t.dispose(),this.za=void 0,this.Ta=void 0,this.Lv=!1,null===(i=this.Yd)||void 0===i||i.removeEventListener("online",this.Wv),null===(e=this.lf)||void 0===e||e.call(this),this.lf=void 0,null===(s=this.Vv)||void 0===s||s.clearQueue(),null===(n=this.Gv)||void 0===n||n.clearQueue(),null===(r=this.Vv)||void 0===r||r.reset(),null===(o=this.Gv)||void 0===o||o.reset())}onRemoteConfig(t){var i,e;if(this.Ti)return;const s=t.ok?null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs:void 0;wi(s)?this.uf():(null===(e=this.Ta)||void 0===e||e.kv.set(this.Ma.captureHintKey,!!s),s?(this.Fv=!0,this.Dv||this.rf(),this.loadIfEnabled()):this.uf())}reset(){var t,i,e,s;this.af(),null===(t=this.Vv)||void 0===t||t.clearQueue(),this.tc=[],null===(i=this.Vv)||void 0===i||i.reset(),null===(e=this.Gv)||void 0===e||e.clearQueue(),this.Nv=[],null===(s=this.Gv)||void 0===s||s.reset(),this.Nd=0}captureLog(t){!this.Ti&&this.Ta&&this.Xv().captureLog(t)}captureConsoleLog(t){!this.Ti&&this.Ta&&this.if().captureLog(t)}captureBufferedConsoleLog(t,i,e){!this.Ti&&this.Ta&&this.if().captureLog(t,{context:i,occurredAtMs:e})}Sd(){var t;this.af(),null===(t=this.Gv)||void 0===t||t.clearQueue(),this.Nv=[]}uf(){this.Fv||this.af()}rf(){var t;if(this.zv||!(null===(t=this.Yd)||void 0===t?void 0:t.console))return;const i=Kd(this.Ma.get()).maxBufferSize;let e=!0;this.Bv.push(()=>{e=!1});for(const t of Yd){let s;try{s=Jd(this.Yd.console[t])}catch(t){continue}s&&this.Bv.push(Dh(this.Yd.console,t,n=>{const r=(...s)=>{try{e&&this.cf(t,s,i)}catch(t){}return n.apply(this.Yd.console,s)};return r.__rrweb_original__=s,r}))}this.zv=!0,this.hf=setTimeout(()=>{this.af()},3e4)}cf(t,i,e){var s;if(this.zv&&!this.Hv&&0!==i.length)if(null===(s=this.Ta)||void 0===s?void 0:s.canCapture){if(e>this.qv.length){this.Hv=!0;try{this.qv.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Ov()})}finally{this.Hv=!1}}}else this.af()}af(){if(this.qv=[],this.zv){this.zv=!1,this.hf&&(clearTimeout(this.hf),this.hf=void 0);for(const t of this.Bv)t();this.Bv=[]}}df(){const t=this.qv;return this.af(),t}get logger(){return this.vf||(this.vf={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.vf}flushLogs(t){this.Ta&&(t?this.ff(t):(this.Vv&&this.Vv.flush().catch(t=>this.pf(t)),this.Gv&&this.Gv.flush().catch(t=>this.pf(t))))}flush(){var t=this;return Di(function*(){var i,e;const s=null===(i=t.Vv)||void 0===i?void 0:i.flush().catch(i=>t.pf(i)),n=null===(e=t.Gv)||void 0===e?void 0:e.flush().catch(i=>t.pf(i));yield s,yield n})()}pf(t){tv(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Ti||!this.Fv||this.Dv||this.Lv)return;const t=this.Jv();if(t){this.Lv=!0;try{t((t,i)=>{if(this.Lv=!1,!this.Ti&&this.Fv)if(t||!i)this.A.error("Could not load logs script",t),this.af();else{const t=this.df();this.lf=i.initialize(this.Ta),this.Dv=!0,t.length>0&&i.replay(this.Ta,t)}})}catch(t){throw this.Lv=!1,t}}else this.af()}Yv(t,i){const e=this.Ta;return{get isDisabled(){return!1},get optedOut(){return!e.canCapture},getPersistedProperty:i=>i===ei.LogsQueue?t():void 0,setPersistedProperty(t,e){t===ei.LogsQueue&&i(null!=e?e:[])},qs:t=>this.qs(t),getLibraryId:()=>e.library.name,getLibraryVersion:()=>e.library.version}}qs(t){return new Promise(i=>{if(Sl(this.Nd,3))return void i({kind:"fatal",error:Qd(void 0,"logs endpoint is unreachable, dropping batch")});let e=!1;const s=t=>{e||(e=!0,clearTimeout(n),i(t))},n=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:Qd(void 0,"logs request timed out")})},9e4),r=this.Qv;this.Ta.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.Ta.projectToken},body:t,compression:"best-available",timeoutMs:6e4}).then(t=>{var i;const e=t.statusCode;this.gf(e,r),e>=200&&300>e?s({kind:"ok"}):413===e?s({kind:"too-large"}):0!==e&&408!==e&&429!==e&&500>e?s({kind:"fatal",error:new Error(`logs request failed with status ${e}`)}):0===e?(t.error||this.A.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:Qd(t.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`logs request failed with status ${e}`)})},t=>{s({kind:"retry-later",error:t})})})}gf(t,i){(0!==t||i)&&(this.Nd=El(t,this.Nd,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.")))}ff(t){this.tc.length>0&&this.mf(t,this.tc,this.ef,this.Ta.library.name,t=>{this.tc=t}),this.Nv.length>0&&this.mf(t,this.Nv,this.sf,Xd,t=>{this.Nv=t})}mf(t,i,e,s,n){if(0===i.length)return;const r=i.map(t=>t.record);n([]);const o=dr(r,cr(e,this.Ta.library.name,this.Ta.library.version),s,this.Ta.library.version);this.Ta.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.Ta.projectToken},body:o,compression:"best-available",transport:t,timeoutMs:6e4}).catch(t=>this.pf(t))}};const ev=Pr("[NetworkMetrics]"),sv=()=>{var t;return(null==qt||null===(t=qt.performance)||void 0===t?void 0:t.now)?qt.performance.now():Date.now()},nv={"http:":80,"https:":443},rv=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),ov=(t,i)=>{var e;const s=String(i);return{method:String(t).toUpperCase(),url:(null===(e=$l(s))||void 0===e?void 0:e.href)||s}},lv=(t,i,e,s,n,r,o=!1)=>{try{var l,a;const u=n();if(!u)return;const h=e||void 0,c=sv()-s,d=$l(i.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||i.url,method:i.method},f=fi(u.name)?u.name(v):mi(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=o&&!h?void 0:((t,i)=>t?400>t?void 0:String(t):(null==i?void 0:i.name)||"_OTHER")(h,r),g=as(as(as(as(as({},(t=>{const i=rv.has(t)?t:"_OTHER";return as({"http.request.method":i},"_OTHER"===i&&t!==i?{"http.request.method_original":t}:{})})(v.method)),d?(t=>{return{"server.address":t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,"server.port":Number(t.port)||nv[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(i=t.pathname,i.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/"))};var i})(d):{}),h?{"http.response.status_code":h}:{}),p?{"error.type":p}:{}),null===(l=u.attributes)||void 0===l?void 0:l.call(u,v,{status:h,durationMs:c}));null===(a=t.metrics)||void 0===a||a.histogram(f,c,{unit:"ms",attributes:g})}catch(t){ev.error("Failed to record network metric",t)}},av=()=>{},uv=(t,i)=>fi(null==qt?void 0:qt.fetch)?Dh(qt,"fetch",e=>function(...s){const n=sv(),r=e.apply(this,s);if(!i())return r;try{var o,l,a;const[e,u]=s,h=ov(null!==(o=null!==(l=null==u?void 0:u.method)&&void 0!==l?l:null==e?void 0:e.method)&&void 0!==o?o:"GET",null!==(a=null==e?void 0:e.url)&&void 0!==a?a:e);return r.then(e=>(lv(t,h,null==e?void 0:e.status,n,i,void 0,!0),e),e=>{throw lv(t,h,void 0,n,i,e),e})}catch(t){return ev.error("Failed to observe fetch",t),r}}):av,hv=(t,i)=>{var e;const s=null==qt||null===(e=qt.XMLHttpRequest)||void 0===e?void 0:e.prototype;if(!s)return av;const n=new WeakMap,r=Dh(s,"open",t=>function(...i){try{(()=>Ja.has(this))()||n.set(this,ov(i[0],i[1]))}catch(t){ev.error("Failed to observe XHR open",t)}return t.apply(this,i)}),o=Dh(s,"send",e=>function(...s){let r;try{const e=n.get(this);if(e&&i()){const s=sv();r=()=>{this.removeEventListener("loadend",r),lv(t,e,this.status,s,i)},Lr(this,"loadend",r)}}catch(t){ev.error("Failed to observe XHR send",t)}try{return e.apply(this,s)}catch(t){throw r&&this.removeEventListener("loadend",r),t}});return()=>{r(),o()}},cv=new WeakMap,dv=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),vv={maxStringLength:2048,truncationSuffix:"..."},fv={maxStringLength:2048,truncationSuffix:"..."};function pv(t){if(t)return!0===t?{intent:!0,model:!0}:{intent:!1!==t.intent,model:!1!==t.model}}function gv(t,i){return{}.hasOwnProperty.call(t,i)}function _v(t,i){const e=Object.create(t);return i&&Object.defineProperty(e,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:i}),e}function mv(t,i,e=!1){if(!mi(t))return;const s=t.trim();return s?(e?Yn(s,vv):s).slice(0,i):void 0}function yv(t){try{return pi(t)&&!0===t.isError}catch(t){return!1}}function bv(t){return Yn(t||"Unknown error",fv).slice(0,2048)}function wv(t,i){try{return bv(i?function(t){try{if(!pi(t)||!vi(t.content))return;return t.content.filter(t=>pi(t)&&"text"===t.type&&mi(t.text)).map(t=>t.text).join(" ").trim()||void 0}catch(t){return}}(t):pi(t)&&mi(t.message)?t.message:mi(t)?t:String(t))}catch(t){return"Unknown error"}}function $v(t,i,e){return i.errorResult?[{type:"Error",value:e,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:t.buildProperties(i.error,{handled:!0}).$exception_list.map(t=>as(as({},t),{},{value:bv(t.value)}))}function xv(t,i){if(i)return"Error";try{if(!pi(t))return"Error";let i=mi(t.name)?t.name.trim():"";const e=t.constructor;return i&&"Error"!==i||!fi(e)||"Error"===e.name||(i=e.name),(i||"Error").slice(0,256)}catch(t){return"Error"}}function Sv(t,i){return{message:wv(t,i),type:xv(t,i)}}const Ev={featureFlags:class extends bc{constructor(t){const i=new $c(t.config,t.Yu());super(i),this.name=rh,this._instance=t,this.yf=i}get Jd(){return this._instance.persistence}updateConfig(t,i){this.yf.update(t,i),this.Zd()}}},kv={sessionRecording:class{get Dr(){return this._instance.config}get xc(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.bf)||void 0===t?void 0:t.isStarted)}get status(){var t,i;return"awaiting_config"===this._f||"missing_config"===this._f?this._f:null!==(t=null===(i=this.bf)||void 0===i?void 0:i.status)&&void 0!==t?t:this._f}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this._f=Hh,this.wf=void 0,this.kf=!1,this.Ye=(()=>{var t,i;if(!(null==Gt?void 0:Gt.visibilityState)||"visible"===Gt.visibilityState)return!0;const e=null==qt||null===(t=qt.performance)||void 0===t||null===(i=t.getEntriesByType)||void 0===i?void 0:i.call(t,"visibility-state");return!(null==e?void 0:e.length)||e.some(t=>"visible"===t.name)})(),this.an=()=>{var t,i;"visible"===(null==Gt?void 0:Gt.visibilityState)&&(this.Ye=!0,null===(t=this.bf)||void 0===t||null===(i=t.setDocumentWasEverVisible)||void 0===i||i.call(t,!0))},!this._instance.sessionManager)throw Wh.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Dr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==Gt?void 0:Gt.addEventListener)&&Lr(Gt,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var i;this.kf=!0,null==Gt||null===(i=Gt.removeEventListener)||void 0===i||i.call(Gt,"visibilitychange",this.an),t?this.Sf(!0):this.stopRecording()}get xf(){var t;const i=!!(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled),e=!this.Dr.disable_session_recording,s=this.Dr.disable_session_recording||this._instance.consent.isOptedOut();return qt&&i&&e&&!s}startIfEnabledOrStop(t){var i;if(this.kf)return;if(this.xf&&(null===(i=this.bf)||void 0===i?void 0:i.isStarted))return;const e=!_i(Object.assign)&&!_i(Array.from);this.xf&&e?(this.$f(t),Wh.info("starting")):(this._f=Hh,this.stopRecording())}$f(t){var i,e;if(this.xf)if("awaiting_config"!==this._f&&"missing_config"!==this._f&&(this._f=qh),(null==ii||null===(i=ii.__PosthogExtensions__)||void 0===i||null===(i=i.rrweb)||void 0===i?void 0:i.record)&&(null===(e=ii.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))this.Cf(t);else{var s,n;const i=this._instance.sessionManager;null===(s=ii.__PosthogExtensions__)||void 0===s||null===(n=s.loadExternalDependency)||void 0===n||n.call(s,this._instance,this.Tf,e=>{if(!this.kf&&this.xf&&this._instance.sessionManager===i)return e?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Wh.error("could not load recorder",e)):void this.Cf(t);this._f="disabled"})}}stopRecording(){var t,i;null===(t=this.wf)||void 0===t||t.call(this),this.wf=void 0,null===(i=this.bf)||void 0===i||i.stop()}Sf(t=!1){var i,e;null===(i=this.wf)||void 0===i||i.call(this),this.wf=void 0,null===(e=this.bf)||void 0===e||e.discard({discardProducerEvents:t})}If(){var t,i;null===(t=this.xc)||void 0===t||t.unregister("$session_is_sampled"),null===(i=this.xc)||void 0===i||i.unregister("$replay_sample_rate")}Ef(t,i){if(wi(t))return null;const e=$i(t)?t:parseFloat(t);return"number"!=typeof(s=e)||!Number.isFinite(s)||0>s||s>1?(Wh.warn(`${i} must be between 0 and 1. Ignoring invalid value:`,t),null):e;var s}Mf(t){if(this.xc){var i,e;const s=this.xc,n=()=>{var i;const e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Ef(null===(i=this.Dr.session_recording)||void 0===i?void 0:i.sampleRate,"session_recording.sampleRate"),r=this.Ef(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=n?n:r;wi(o)&&this.If();const l=null==e?void 0:e.minimumDurationMilliseconds;s.register({[G]:as(as({cache_timestamp:Date.now(),enabled:!!e},e),{},{networkPayloadCapture:as({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:o,minimumDurationMilliseconds:_i(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.wf)||void 0===i||i.call(this),this.wf=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.onSessionId(n)}}onRemoteConfig(t){const i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.Mf(i),void this.Sf()):(this.Mf(i),void this.startIfEnabledOrStop()):("awaiting_config"===this._f&&(this._f="missing_config",this._instance.register_for_session({[Tt]:!0}),Wh.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i="log"){var e;(null===(e=this.bf)||void 0===e?void 0:e.log)?this.bf.log(t,i):Wh.warn("log called before recorder was ready")}get Tf(){var t,i;const e=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(G);return(null==e||null===(i=e.scriptConfig)||void 0===i?void 0:i.script)||"lazy-recorder"}Af(){const t=this._instance.get_property(G);if(!t)return!1;let i;try{i="object"==typeof t?t:JSON.parse(t)}catch(t){return Wh.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!wi(i.cache_timestamp)&&36e5>=Date.now()-i.cache_timestamp}Cf(t){var i,e,s;if(!this.kf&&this.xf&&this._instance.sessionManager){if(!(null===(i=ii.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))return Wh.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[kt]:!0});var n;if(this.bf||(this.bf=null===(n=ii.__PosthogExtensions__)||void 0===n?void 0:n.initSessionRecording(this._instance,this.Ye),this.bf._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Af()){if("missing_config"===this._f||"awaiting_config"===this._f)return;return this._f="awaiting_config",Wh.info("persisted remote config is stale, requesting fresh config before starting"),void new pa(this._instance).load()}this._f=qh,null===(e=(s=this.bf).setDocumentWasEverVisible)||void 0===e||e.call(s,this.Ye),this.bf.start(t)}else this._f=Hh}onRRwebEmit(t){var i,e;null===(i=this.bf)||void 0===i||null===(e=i.onRRwebEmit)||void 0===e||e.call(i,t)}overrideLinkedFlag(){var t,i;this.bf||null===(i=this.xc)||void 0===i||i.register({$replay_override_linked_flag:!0}),null===(t=this.bf)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.bf||null===(i=this.xc)||void 0===i||i.register({$replay_override_sampling:!0}),null===(t=this.bf)||void 0===t||t.overrideSampling()}overrideTrigger(t){var i,e;this.bf||null===(e=this.xc)||void 0===e||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(i=this.bf)||void 0===i||i.overrideTrigger(t)}get sdkDebugProperties(){var t;const i={};for(const t of Vh){var e;const s=null===(e=this._instance.sessionPersistence)||void 0===e?void 0:e.get_property(t);_i(s)||(i[t]=s)}return as(as({},i),(null===(t=this.bf)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,i){var e;return!!(null===(e=this.bf)||void 0===e?void 0:e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t,i;null===(t=this.bf)||void 0===t||null===(i=t.flushBeforeIdentityReset)||void 0===i||i.call(t)}}},Tv={autocapture:class extends nh{constructor(t){super(new Ch(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.Rf=!1,this._instance=t,this.Pf=this.Of()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Ff();return!!(t.path||t.search||this.Df(t))}startIfEnabled(){this.isEnabled&&(Tr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Pf=this.Of(),this.startIfEnabled()}stop(){this.Lf&&this.Lf(),this.Lf=void 0,this.Nf&&this.Nf(),this.Nf=void 0,Tr.info("History API monitoring stopped")}monitorHistoryChanges(){qt&&qt.history&&(this.jf("pushState"),this.jf("replaceState"),this.qf(),this.Df()&&this.Bf())}jf(t){var i;if(!qt||(null===(i=qt.history[t])||void 0===i?void 0:i.__posthog_wrapped__))return;const e=this;Dh(qt.history,t,i=>function(s,n,r){var o;e.zf(r)&&e.Hf(),i.call(this,s,n,r),e.Uf(t,!e.Rf&&"popstate"!==(null==qt||null===(o=qt.event)||void 0===o?void 0:o.type))})}Of(){const t=null==qt?void 0:qt.location;if(null==t?void 0:t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Ff(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:pi(t)?t:{}}Df(t=this.Ff()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Wf(t){const i=this.Ff(),e=this.Pf;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.Df(i)&&t.hash!==e.hash))}Uf(t,i=!1){try{i||this.Hf();const e=this.Of();if(!e)return;if(this.Wf(e)){const e=()=>this._instance.capture(Ut,{navigation_type:t});i?(this.Vf=e,Promise.resolve().then(()=>this.Hf())):e()}this.Pf=e}catch(i){Tr.error(`Error capturing ${t} pageview`,i)}}zf(t){var i,e;return!(wi(t)||!qt)&&(null===(i=$l(String(t)))||void 0===i?void 0:i.href)!==(null===(e=qt.location)||void 0===e?void 0:e.href)}Hf(){const t=this.Vf;if(t){this.Vf=void 0,this.Rf=!0;try{t()}catch(t){Tr.error("Error capturing deferred pageview",t)}finally{this.Rf=!1}this.Pf=this.Of()}}qf(){if(this.Lf)return;const t=()=>{this.Uf("popstate")};Lr(qt,"popstate",t),this.Lf=()=>{qt&&qt.removeEventListener("popstate",t)}}Bf(){if(this.Nf)return;const t=()=>{this.Uf("hashchange")};Lr(qt,"hashchange",t),this.Nf=()=>{qt&&qt.removeEventListener("hashchange",t)}}},heatmaps:class{get Dr(){return this.instance.config}constructor(t){var i;this.Gf=!1,this.dl=!1,this.Qf=null,this.instance=t,this.Gf=!!(null===(i=this.instance.persistence)||void 0===i?void 0:i.props[L]),this.rageclicks=new Ku(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return pi(this.Dr.capture_heatmaps)&&this.Dr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Dr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return wi(this.Dr.capture_heatmaps)?wi(this.Dr.enable_heatmaps)?this.Gf:this.Dr.enable_heatmaps:!1!==this.Dr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.dl)return;Gh.info("starting..."),this.Jf(),this.an()}else{var t;clearInterval(null!==(t=this.Qf)&&void 0!==t?t:void 0),this.Zf(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("heatmaps"in i))return;const e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[L]:e}),this.Gf=e,this.startIfEnabled()}getAndClearBuffer(){const t=this.At;return this.At=void 0,t}Kf(t){Kh(t.originalEvent)&&this.Lr(t.originalEvent,"deadclick")}an(){this.Qf&&clearInterval(this.Qf),this.Qf="visible"===(null==Gt?void 0:Gt.visibilityState)?setInterval(this.uc.bind(this),this.flushIntervalMilliseconds):null}Jf(){qt&&Gt&&(this.Yf=this.uc.bind(this),Lr(qt,jt,this.Yf),this.Xf=t=>this.Lr(t||(null==qt?void 0:qt.event)),Lr(Gt,"click",this.Xf,{capture:!0}),this.tp=t=>this.ep(t||(null==qt?void 0:qt.event)),Lr(Gt,"mousemove",this.tp,{capture:!0}),this.np=new hl(this.instance,al,this.Kf.bind(this)),this.np.startIfEnabledOrStop(),this.sp=this.an.bind(this),Lr(Gt,m,this.sp),this.dl=!0)}Zf(){var t;qt&&Gt&&(this.Yf&&qt.removeEventListener(jt,this.Yf),this.Xf&&Gt.removeEventListener("click",this.Xf,{capture:!0}),this.tp&&Gt.removeEventListener("mousemove",this.tp,{capture:!0}),this.sp&&Gt.removeEventListener(m,this.sp),clearTimeout(this.rp),null===(t=this.np)||void 0===t||t.stop(),this.dl=!1)}op(t,i){const e=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),r=function(t,i,e){let s=t;for(;s&&yo(s)&&!bo(s,"body");){if(s===e)return!1;let t;try{var n,r,o;t=null===(n=null!==(r=null===(o=s.ownerDocument)||void 0===o?void 0:o.defaultView)&&void 0!==r?r:qt)||void 0===n?void 0:n.getComputedStyle(s).position}catch(t){return!1}if(oi(i,t))return!0;s=Co(s)}return!1}(Po(t),["fixed","sticky"],n);return{x:t.clientX+(r?0:s),y:t.clientY+(r?0:e),target_fixed:r,type:i}}Lr(t,i="click"){var e;if(mo(t.target)||!Kh(t))return;const s=this.op(t,i);(null===(e=this.rageclicks)||void 0===e?void 0:e.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&qo(Po(t),this.instance.config.rageclick)&&this.Qs(as(as({},s),{},{type:"rageclick"})),this.Qs(s)}ep(t){!mo(t.target)&&Kh(t)&&(clearTimeout(this.rp),this.rp=setTimeout(()=>{this.Qs(this.op(t,"mousemove"))},500))}Qs(t){if(!qt)return;const i=this.Dr.disable_capture_url_hashes?ts(qt.location.href):qt.location.href,e=this.Dr.custom_personal_data_properties,s=this.Dr.mask_personal_data_properties?[...Rl,...e||[]]:[],n=Pl(i,s,Cl);this.At=this.At||{},this.At[n]||(this.At[n]=[]),this.At[n].push(t)}uc(){this.At&&!gi(this.At)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:hl,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this.Gf=!1,this.dl=!1,this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.ap=(t=!1)=>{clearTimeout(this.lp),this.lp=void 0,0!==this.At.metrics.length&&(this._instance.capture("$web_vitals",as({$current_url:this.At.url},this.At.metrics.reduce((t,i)=>as(as({},t),{},{[`$web_vitals_${i.name}_event`]:as({},i),[`$web_vitals_${i.name}_value`]:i.value}),{})),t?{transport:"sendBeacon",send_instantly:!0}:void 0),this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.up=t=>{var i;if(this.At=this.At||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},wi(null==t?void 0:t.name)||wi(null==t?void 0:t.value))return void Lh.error("Invalid metric received",t);const e="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.cp(e);if(_i(s))return;const n=$i(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${s}`;if(this.hp&&t.value>=this.hp)return void Lh.error("Ignoring metric with value >= "+this.hp,t);this.At.navigationKey!==n&&(this.ap(),this.lp=setTimeout(this.ap,this.flushToCaptureTimeoutMs)),_i(this.At.navigationKey)&&(this.At.navigationKey=n,this.At.url=s),this.At.firstMetricTimestamp=_i(this.At.firstMetricTimestamp)?Date.now():this.At.firstMetricTimestamp;const r=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.checkAndGetSessionAndWindowId(!0),o=as(as(as({},t),e?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,pi(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const i={};for(const e of zh){const s="url"===e&&"string"==typeof t.attribution[e]?this.cp(t.attribution[e]):t.attribution[e];_i(s)||(i[e]=s)}o.attribution=i}else delete o.attribution;_i(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.At.metrics.push(o),this.At.metrics.length===this.allowedMetrics.length&&this.ap()},this.dp=()=>{if(this.dl)return;let t,i,e,s,n=!1;const r=ii.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,l=(null==o?void 0:o[this.vp])||("web-vitals"===this.vp&&_i(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!_i(l)){const r=l.withoutAttribution,o=this.attributionMetrics;n=!_i(r),t=o.indexOf("LCP")>-1?l.onLCP:(null==r?void 0:r.onLCP)||l.onLCP,i=o.indexOf("CLS")>-1?l.onCLS:(null==r?void 0:r.onCLS)||l.onCLS,e=o.indexOf("FCP")>-1?l.onFCP:(null==r?void 0:r.onFCP)||l.onFCP,s=o.indexOf("INP")>-1?l.onINP:(null==r?void 0:r.onINP)||l.onINP}if(!(t&&i&&e&&s))return void Lh.error("web vitals callbacks not loaded - not starting");const a={reportSoftNavs:this.useSoftNavs},u=n&&this.attributionMetrics.indexOf("INP")>-1?as(as({},a),{},{includeProcessedEventEntries:!1}):a;this.allowedMetrics.indexOf("LCP")>-1&&t(this.up.bind(this),a),this.allowedMetrics.indexOf("CLS")>-1&&i(this.up.bind(this),a),this.allowedMetrics.indexOf("FCP")>-1&&e(this.up.bind(this),a),this.allowedMetrics.indexOf("INP")>-1&&s(this.up.bind(this),u);const h=null==qt?void 0:qt.document;Lr(h,m,()=>{"hidden"===(null==h?void 0:h.visibilityState)&&this.ap(!0)}),Lr(qt,"pagehide",()=>this.ap(!0)),this.dl=!0},this.Gf=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[z]),this.startIfEnabled()}get fp(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i;const e=pi(this.fp)?null===(t=this.fp)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return wi(e)?(null===(i=this._instance.persistence)||void 0===i?void 0:i.props.$web_vitals_allowed_metrics)||Uh:e}get flushToCaptureTimeoutMs(){return(pi(this.fp)?this.fp.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=pi(this.fp)?this.fp.web_vitals_attribution:void 0;return Si(t)?t?Uh:[]:vi(t)?t:Bh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=pi(this.fp)?this.fp.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get hp(){const t=pi(this.fp)&&$i(this.fp.__web_vitals_max_value)?this.fp.__web_vitals_max_value:jh;return t>0&&6e4>=t?jh:t}get isEnabled(){const t=null==Kt?void 0:Kt.protocol;if("http:"!==t&&"https:"!==t)return Lh.info("Web Vitals are disabled on non-http/https protocols"),!1;const i=pi(this.fp)?this.fp.web_vitals:Si(this.fp)?this.fp:void 0;return Si(i)?i:this.Gf}startIfEnabled(){this.isEnabled&&!this.dl&&(Lh.info("enabled, starting..."),this.Pl(this.dp))}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("capturePerformance"in i))return;const e=pi(i.capturePerformance)&&!!i.capturePerformance.web_vitals,s=pi(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[z]:e}),this._instance.persistence.register({[V]:s})),this.Gf=e,this.startIfEnabled()}get vp(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Pl(t){var i;const e=ii.__PosthogExtensions__,s=this.vp,n=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&_i(n)&&(null==e?void 0:e.postHogWebVitalsCallbacks)?t():null==e||null===(i=e.loadExternalDependency)||void 0===i||i.call(e,this._instance,s,i=>{i?Lh.error("failed to load script",i):t()})}cp(t){const i=t||(null==qt?void 0:qt.location.href);if(!i)return void Lh.error("Could not determine current URL");const e=this._instance.config.disable_capture_url_hashes?ts(i):i,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Rl,...s||[]]:[];return Pl(e,n,Cl)}}},Pv={exceptionObserver:class{constructor(t){var i;this.dp=()=>{var t;if(!qt||!this.isEnabled||!(null===(t=ii.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions))return;const i=ii.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=ii.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=ii.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.pp&&this.Dr.capture_unhandled_errors&&(this.pp=i(this.captureException.bind(this))),!this.gp&&this.Dr.capture_unhandled_rejections&&(this.gp=e(this.captureException.bind(this))),!this.mp&&this.Dr.capture_console_errors&&(this.mp=s(this.captureException.bind(this)))}catch(t){Ih.error("failed to start",t),this.yp()}},this._instance=t,this.bp=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[j]),this.kt=new Bi(as(as({},function(t={}){var i,e,s,n;return{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=null!==(n=t.exceptionRateLimiterBucketSize)&&void 0!==n?n:t.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:Ih})),this.Dr=this._p(),this.startIfEnabledOrStop()}_p(){const t=this._instance.config.capture_exceptions;let i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return pi(t)?i=as(as({},i),t):(_i(t)?this.bp:t)&&(i=as(as({},i),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Dr.capture_console_errors||this.Dr.capture_unhandled_errors||this.Dr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ih.info("enabled"),this.yp(),this.Pl(this.dp)):this.yp()}Pl(t){var i,e,s;(null===(i=ii.__PosthogExtensions__)||void 0===i?void 0:i.errorWrappingFunctions)?t():null===(e=ii.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"exception-autocapture",i=>{if(i)return Ih.error("failed to load script",i);t()})}yp(){var t,i,e;null===(t=this.pp)||void 0===t||t.call(this),this.pp=void 0,null===(i=this.gp)||void 0===i||i.call(this),this.gp=void 0,null===(e=this.mp)||void 0===e||e.call(this),this.mp=void 0}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"autocaptureExceptions"in i&&(this.bp=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[j]:this.bp}),this.Dr=this._p(),this.startIfEnabledOrStop())}onConfigChange(){this.Dr=this._p()}captureException(t){try{var i,e,s;const n=null!==(i=null==t||null===(e=t.$exception_list)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.type)&&void 0!==i?i:"Exception";if(this.kt.consumeRateLimit(n))return void Ih.info("Skipping exception capture because of client rate limiting.",{exception:n});null===(s=this._instance.exceptions)||void 0===s||s.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var i,e;this.wp=[],this.kp=new ps([new Ds,new Vs,new Ls,new Ns,new qs,new Hs,new Us,new Ws],function(t,...i){return(e,s=0)=>{const n=[],r=e.split("\n"),o=Math.min(r.length,s+1e3),l=[];for(let e=s;o>e;e++){const s=r[e];if(s.length>1024)continue;const o=Ps.test(s)?s.replace(Ps,"$1"):s;if(!o.match(/\S*Error: /)){for(const e of i){const i=e(o,t);if(i){n.push(i);const t=Rs(n);if(t){for(let i=l.length-1;i>=0;i--){const e=l[i];if(t.start>=e.start+e.length)break;l.pop()}l.push(t)}break}}if(Ms(n,l)>=50)break}}const a=[...l].sort((t,i)=>i.start-t.start),u=a[a.length-1];if(u){const t=Cs(n,u);n.splice(u.start-t,t);for(const i of a)i.start-=t}for(const t of a)As(n,t);return l.some(t=>0===t.start&&n.length===t.length)&&function(t){const i=t.map(t=>`${t.function}|${t.filename}|${t.lineno}|${t.colno}|${t.module}`);let e=0;for(let t=1;i.length>t;t++)Fs(i,t,e)&&(e=t);t.push(...t.splice(0,e))}(n),function(t){if(!t.length)return[];const i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return as(as({},t),{},{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",Ss,Ts)),this._instance=t,this.wp=null!==(i=null===(e=this._instance.persistence)||void 0===e?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this.Sp=Xs(this.xp()),this.$p=new Zs(this.Sp)}onConfigChange(){this.Sp=Xs(this.xp()),this.$p.setConfig(this.Sp)}onRemoteConfig(t){var i,e,s;if(!t.ok)return;const n=t.config;if(!("errorTracking"in n))return;const r=null!==(i=null===(e=n.errorTracking)||void 0===e?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null===(s=n.errorTracking)||void 0===s?void 0:s.captureExtensionExceptions;this.wp=r,this._instance.persistence&&this._instance.persistence.register({[U]:this.wp,[B]:o})}get Cp(){var t;const i=!!this._instance.get_property(B),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.kp.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.Sp.enabled)try{if(!mi(t)||0===t.trim().length)return void Sc.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:e,droppedKeys:s}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};const i=[];return{sanitizedProperties:Object.keys(t).reduce((e,s)=>Ys.has(s)?(i.push(s),e):(e[s]=t[s],e),{}),droppedKeys:i}}(this.Tp(i));s.length>0&&Sc.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.$p.add(as({[Gs]:t,[Ks]:(new Date).toISOString()},e))}catch(t){Sc.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const i=t.$exception_list;if(this.Ip(i)){if(this.Ep(i))return this.Mp("Exception dropped: matched a suppression rule"),void Sc.info("Skipping exception capture because a suppression rule matched");if(!this.Cp&&this.Ap(i))return this.Mp("Exception dropped: thrown by a browser extension"),void Sc.info("Skipping exception capture because it was thrown by an extension");if(!this.Cp&&this.Rp(i))return this.Mp("Exception dropped: thrown by an injected browser script"),void Sc.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Pp(i))return this.Mp("Exception dropped: thrown by the PostHog SDK"),void Sc.info("Skipping exception capture because it was thrown by the PostHog SDK")}const e=this.Sp.enabled&&wi(t.$exception_steps)?this.Op(t):t,s=function(){if("u">typeof process){var t;const i=null===(t=process.env.POSTHOG_RELEASE_ID)||void 0===t?void 0:t.trim();if(i)return i}const i=globalThis._posthogReleaseId;return"string"==typeof i&&i.length>0?i:void 0}();s&&(e.$release_id=s);try{const t=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",hd:!0});return t&&this.$p.clear(),t}catch(t){return xc(t)||Sc.error("Failed to capture exception event. Dropping this exception.",t),void this.$p.clear()}}catch(t){return void(xc(t)||Sc.error("Failed to process exception event. Ignoring this exception.",t))}}Op(t){try{const i=this.$p.getAttachable();return 0===i.length?t:as(as({},t),{},{$exception_steps:i})}catch(i){return Sc.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Mp(t){this.Sp.enabled&&this.$p.add({[Gs]:t,[Ks]:(new Date).toISOString()})}Tp(t){return pi(t)?as({},t):{}}xp(){var t,i;return null!==(t=null===(i=this._instance.config.error_tracking)||void 0===i?void 0:i.exception_steps)&&void 0!==t?t:{}}Ep(t){if(0===t.length)return!1;try{const i=t.reduce((t,{type:i,value:e})=>(mi(i)&&i.length>0&&t.$exception_types.push(i),mi(e)&&e.length>0&&t.$exception_values.push(e),t),{$exception_types:[],$exception_values:[]});return this.wp.some(t=>{const e=t.values.map(t=>{const e=Iu[t.operator],s=i[t.key];if(!e||!s)return!1;const n=vi(t.value)?t.value:[t.value];return n.length>0&&e(n,s)});return"OR"===t.type?e.some(Boolean):e.every(Boolean)})}catch(t){return Sc.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Ap(t){const i=t.flatMap(t=>{var i,e;return null!==(i=null===(e=t.stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[]}),e=i.filter(({filename:t})=>!!t&&Tc.some(i=>t.startsWith(i)));return 0!==e.length&&(!e.every(({filename:t})=>!!t&&t.startsWith(Ec))||t.some(({type:t,value:i})=>"NoResponse"===t||mi(i)&&kc.some(({value:t,exact:e})=>e?i===t:i.includes(t)))&&!i.some(({in_app:t,filename:i})=>t&&!(null==i?void 0:i.startsWith(Ec))))}Rp(t){return t.some(({value:t})=>mi(t)&&Pc.some(i=>t.includes(i)))}Pp(t){if(t.length>0){var i,e,s,n;const r=null!==(i=null===(e=t[0].stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[],o=r[r.length-1];return null!==(s=null==o||null===(n=o.filename)||void 0===n?void 0:n.includes("posthog.com/static"))&&void 0!==s&&s}return!1}Ip(t){return!wi(t)&&vi(t)}}},Ov=as({productTours:class{get xc(){return this._instance.persistence}constructor(t){this.Fp=null,this.Dp=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if("productTours"in i){var e,s;if(this.xc&&this.xc.register({[q]:!!i.productTours}),!Jh(this._instance))return!this.Fp&&wi(null===(e=this.xc)||void 0===e?void 0:e.props.ph_product_tours)||Yh.info("product tours disabled; stopping and clearing cached tours"),null===(s=this.Fp)||void 0===s||s.stop(),this.Fp=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Fp&&Jh(this._instance)&&this.Pl(()=>this.Lp())}Pl(t){var i,e,s;(null===(i=ii.__PosthogExtensions__)||void 0===i?void 0:i.generateProductTours)?t():null===(e=ii.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"product-tours",i=>{i?Yh.error("Could not load product tours script",i):t()})}Lp(){var t;!this.Fp&&(null===(t=ii.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.Fp=ii.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i=!1){if(vi(this.Dp)&&!i)return void t(this.Dp,{isLoaded:!0});const e=this.xc;if(e){const s=e.props[at];if(vi(s)&&!i)return this.Dp=s,void t(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:i=>{if(!Jh(this._instance))return void t([],{isLoaded:!0});const s=i.statusCode;if(200!==s||!i.json){const e=`Product Tours API could not be loaded, status: ${s}`;return 0===s?i.error||Yh.warn(e):Yh.error(e),void t([],{isLoaded:!1,error:e})}const n=vi(i.json.product_tours)?i.json.product_tours:[];this.Dp=n,e&&e.register({[at]:n}),t(n,{isLoaded:!0})}})}getActiveProductTours(t){wi(this.Fp)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Fp.getActiveProductTours(t)}showProductTour(t){var i;null===(i=this.Fp)||void 0===i||i.showTourById(t)}previewTour(t){this.Fp?this.Fp.previewTour(t):this.Pl(()=>{var i;this.Lp(),null===(i=this.Fp)||void 0===i||i.previewTour(t)})}dismissProductTour(){var t;null===(t=this.Fp)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.Fp)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.Fp)||void 0===t||t.previousStep()}clearCache(){var t;this.Dp=null,null===(t=this.xc)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var i;null===(i=this.Fp)||void 0===i||i.resetTour(t)}resetAllTours(){var t;null===(t=this.Fp)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var i;null===(i=this.Fp)||void 0===i||i.cancelPendingTour(t)}}},Ev),Rv={siteApps:class{constructor(t){this._instance=t,this.Np=0,this.jp=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}qp(t,i){if(!i)return;const e=this.globalsForEvent(i);this.jp.push(e),this.jp.length>1e3&&(this.jp=this.jp.slice(10))}get siteAppLoaders(){var t;return null===(t=ii._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.qp.bind(this));this.Bp=()=>{t(),this.jp=[],this.Bp=void 0}}}globalsForEvent(t){var i,e,s,n,r,o,l;if(!t)throw new Error("Event payload is required");const a={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(const[t,i]of Object.entries(h))a[t]={id:u[t],type:t,properties:i};const{$set_once:c,$set:d}=t;return{event:as(as({},vn(t,Xh)),{},{properties:as(as(as({},t.properties),d?{$set:as(as({},null!==(i=null===(e=t.properties)||void 0===e?void 0:e.$set)&&void 0!==i?i:{}),d)}:{}),c?{$set_once:as(as({},null!==(s=null===(n=t.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),c)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(l=t.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:a}}zp(t){var i;const e=null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase();if("style"===e&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(t)||(Zh.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===e&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(t)||(Zh.error("prepare_external_dependency_script returned null"),null)}return t}Hp(){var t,i,e,s,n,r,o,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const a=null==Gt?void 0:Gt.defaultView,u=null==a||null===(t=a.Node)||void 0===t?void 0:t.prototype;if(!a||!u)return()=>{};if(this.Np++,this.Up)return this.Wp();const h=[],c=this,d=new WeakSet,v=(t,i,e)=>{if(!(null==t?void 0:t[i]))return;const s=t[i];t[i]=e(s),h.push(()=>{t[i]=s})},f=t=>{if(d.has(t))return t;const i=c.zp(t);return i&&d.add(i),i},p=t=>t.map(t=>"string"==typeof t?t:f(t)).filter(t=>!bi(t));return v(u,"appendChild",t=>function(i){const e=f(i);return e?t.call(this,e):i}),v(u,"insertBefore",t=>function(i,e){const s=f(i);return s?t.call(this,s,e):i}),v(u,"replaceChild",t=>function(i,e){const s=f(i);return s?t.call(this,s,e):e}),[null===(i=a.Element)||void 0===i?void 0:i.prototype,null===(e=a.Document)||void 0===e?void 0:e.prototype,null===(s=a.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{v(t,"append",t=>function(...i){return t.apply(this,p(i))}),v(t,"prepend",t=>function(...i){return t.apply(this,p(i))})}),[null===(n=a.Element)||void 0===n?void 0:n.prototype,null===(r=a.CharacterData)||void 0===r?void 0:r.prototype,null===(o=a.DocumentType)||void 0===o?void 0:o.prototype].forEach(t=>{v(t,"before",t=>function(...i){return t.apply(this,p(i))}),v(t,"after",t=>function(...i){return t.apply(this,p(i))}),v(t,"replaceWith",t=>function(...i){const e=p(i);return i.length&&!e.length?void 0:t.apply(this,e)})}),v(null===(l=a.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",t=>function(i,e){const s=f(e);return s?t.call(this,i,s):null}),this.Up=()=>{h.forEach(t=>t()),this.Up=void 0},this.Wp()}Wp(){let t=!1;return()=>{var i;t||(t=!0,this.Np--,0===this.Np&&(null===(i=this.Up)||void 0===i||i.call(this)))}}Vp(t,i=!0){const e=this.Hp();try{const s=t(e);return i&&e(),s}catch(t){throw e(),t}}setupSiteApp(t){const i=this.apps[t.id],e=()=>{var e;!i.errored&&this.jp.length&&(Zh.info(`Processing ${this.jp.length} events for site app with id ${t.id}`),this.jp.forEach(t=>this.Vp(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null===(e=this.Bp)||void 0===e||e.call(this))};let s=!1;const n=n=>{i.errored=!n,i.loaded=!0,Zh.info(`Site app with id ${t.id} ${n?"loaded":"errored"}`),s&&e()};try{const{processEvent:e}=this.Vp(i=>t.init({posthog:this._instance,callback(t){i(),n(t)}}),!1);e&&(i.processEvent=e),s=!0}catch(i){Zh.error(Qh+t.id,i),n(!1)}if(s&&i.loaded)try{e()}catch(e){Zh.error(`Error while processing buffered events PostHog app with config id ${t.id}`,e),i.errored=!0}}Gp(){const t=this.siteAppLoaders||[];for(const i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(const i of t)this.setupSiteApp(i)}Qp(t){if(0===Object.keys(this.apps).length)return;const i=this.globalsForEvent(t);for(const e of Object.values(this.apps))try{this.Vp(()=>{var t;return null===(t=e.processEvent)||void 0===t?void 0:t.call(e,i)})}catch(i){Zh.error(`Error while processing event ${t.event} for site app ${e.id}`,i)}}onRemoteConfig(t){var i,e,s;if(null===(i=this.siteAppLoaders)||void 0===i?void 0:i.length)return this.isEnabled?(this.Gp(),void this._instance.on("eventCaptured",t=>this.Qp(t))):void Zh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(e=this.Bp)||void 0===e||e.call(this),!t.ok)return;const n=t.config;if(null===(s=n.siteApps)||void 0===s?void 0:s.length)if(this.isEnabled)for(const{id:t,url:i}of n.siteApps){var r,o;ii[`__$$ph_site_app_${t}`]=this._instance,null===(r=ii.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,i,i=>{if(i)return Zh.error(Qh+t,i)})}else Zh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Av={tracingHeaders:class{constructor(t){this._instance=t,this.Jp=void 0,this.Zp=void 0,this.Kp=void 0,this.dp=()=>{const t=this.Yp();var i,e;t?(_i(this.Jp)&&(this.Jp=null===(i=ii.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),_i(this.Zp)&&(this.Zp=null===(e=ii.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.yp()}}initialize(){this.startIfEnabledOrStop()}Pl(t){var i,e,s;(null===(i=ii.__PosthogExtensions__)||void 0===i?void 0:i.tracingHeadersPatchFns)?t():null===(e=ii.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"tracing-headers",i=>{if(i)return Nh.error("failed to load script",i);t()})}Xp(){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}Yp(){const t=this.Xp();return vi(t)?(vi(this.Kp)?this.Kp.splice(0,this.Kp.length,...t):this.Kp=[...t],t.length>0?this.Kp:void 0):(vi(this.Kp)&&this.Kp.splice(0),this.Kp=t||void 0,this.Kp)}yp(){var t,i;null===(t=this.Jp)||void 0===t||t.call(this),null===(i=this.Zp)||void 0===i||i.call(this),this.Jp=void 0,this.Zp=void 0}startIfEnabledOrStop(){this.Yp()?this.Pl(this.dp):this.yp()}}},Cv=as({surveys:class extends lc{constructor(t){super(new ac(t))}}},Ev),Iv={toolbar:class{constructor(t){this.instance=t}tg(t){ii.ph_toolbar_state=t}eg(){var t;return null!==(t=ii.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,i=void 0,e=void 0){var s,n;if(jr(this.instance.config))return!1;if(!qt||!Gt)return!1;t=null!==(s=t)&&void 0!==s?s:qt.location,e=null!==(n=e)&&void 0!==n?n:qt.history;try{if(!i){try{qt.localStorage.setItem("test","test"),qt.localStorage.removeItem("test")}catch(t){return!1}i=null==qt?void 0:qt.localStorage}const s=uc||Ol(t.hash,"__posthog")||Ol(t.hash,"state");let n;const r=s?is(()=>JSON.parse(atob(decodeURIComponent(s))))||is(()=>JSON.parse(decodeURIComponent(s))):null;return r&&"ph_authorize"===r.action?(n=r,n.source="url",n&&Object.keys(n).length>0&&(r.desiredHash?t.hash=r.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):(n=JSON.parse(i.getItem(hc)||"{}"),n.source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}ig(t){const i=ii.ph_load_toolbar||ii.ph_load_editor;!wi(i)&&fi(i)?i(t,this.instance):cc.warn("No toolbar load function found")}loadToolbar(t){const i=!!(null==Gt?void 0:Gt.getElementById("__POSTHOG_TOOLBAR__"));if(!qt||i)return!1;const e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=as(as({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(qt.localStorage.setItem(hc,JSON.stringify(as(as({},s),{},{source:void 0}))),2===this.eg())this.ig(s);else if(0===this.eg()){var n,r;this.tg(1),null===(n=ii.__PosthogExtensions__)||void 0===n||null===(r=n.loadExternalDependency)||void 0===r||r.call(n,this.instance,"toolbar",t=>{if(t)return cc.error("[Toolbar] Failed to load",t),void this.tg(0);this.tg(2),this.ig(s)}),Lr(qt,"turbolinks:load",()=>{this.tg(0),this.loadToolbar(s)})}return!0}ng(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,i=void 0,e=void 0){return this.maybeLoadToolbar(t,i,e)}}},Mv=as({experiments:class t{get Dr(){return this._instance.config}constructor(i){this._instance=i,this.getWebExperimentsAndEvaluateDisplayLogic=(i=!1)=>{this.getWebExperiments(i=>{t.sg("retrieved web experiments from the server"),this.rg=new Map,i.forEach(i=>{if(i.feature_flag_key){var e;this.rg&&(t.sg("setting flag key ",i.feature_flag_key," to web experiment ",i),null===(e=this.rg)||void 0===e||e.set(i.feature_flag_key,i));const s=this._instance.getFeatureFlag(i.feature_flag_key);mi(s)&&i.variants[s]&&this.og(i.name,s,i.variants[s].transforms)}else if(i.variants)for(const e in i.variants){const s=i.variants[e];t.ag(s,this._instance)&&this.og(i.name,e,s.transforms)}})},i)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(i){if(this._is_bot())t.sg(zd);else if(!this.Dr.disable_web_experiments){if(wi(this.rg))return this.rg=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.sg("applying feature flags",i),i.forEach(t=>{var i;if(this.rg&&(null===(i=this.rg)||void 0===i?void 0:i.has(t))){var e;const i=this._instance.getFeatureFlag(t),s=null===(e=this.rg)||void 0===e?void 0:e.get(t);i&&(null==s?void 0:s.variants[i])&&this.og(s.name,i,s.variants[i].transforms)}})}}previewWebExperiment(){const i=t.getWindowLocation();if(null==i?void 0:i.search){const e=Tl(null==i?void 0:i.search,"__experiment_id"),s=Tl(null==i?void 0:i.search,"__experiment_variant");e&&s&&(t.sg(`previewing web experiments ${e} && ${s}`),this.getWebExperiments(t=>{this.lg(parseInt(e),s,t)},!1,!0))}}loadIfEnabled(){this.Dr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Dr.disable_web_experiments&&!e)return t([]);const s=this._instance.get_property("$web_experiments");if(s&&!i)return t(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Dr.token}`),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}lg(i,e,s){const n=s.filter(t=>t.id===i);n&&n.length>0&&(t.sg(`Previewing web experiment [${n[0].name}] with variant [${e}]`),this.og(n[0].name,e,n[0].variants[e].transforms))}static ag(i,e){return!wi(i.conditions)&&t.ug(i,e)&&t.cg(i)}static ug(i,e){var s;if(wi(i.conditions)||wi(null===(s=i.conditions)||void 0===s?void 0:s.url))return!0;const n=t.getWindowLocation();if(n){var r,o,l;const t=_o(e,n.href);return!(null===(r=i.conditions)||void 0===r?void 0:r.url)||Wd[null!==(o=null===(l=i.conditions)||void 0===l?void 0:l.urlMatchType)&&void 0!==o?o:"icontains"](i.conditions.url,t)}return!1}static getWindowLocation(){return null==qt?void 0:qt.location}static cg(t){var i;if(wi(t.conditions)||wi(null===(i=t.conditions)||void 0===i?void 0:i.utm))return!0;const e=Ml();if(e.utm_source){var s,n,r,o,l,a,u,h;const i=!(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)||(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)==e.utm_campaign,c=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==e.utm_source,d=!(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)||(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)==e.utm_medium,v=!(null===(u=t.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)||(null===(h=t.conditions)||void 0===h||null===(h=h.utm)||void 0===h?void 0:h.utm_term)==e.utm_term;return i&&d&&v&&c}return!1}static sg(t,...i){Tr.info(`[WebExperiments] ${t}`,i)}static hg(i){("http://www.w3.org/1999/xhtml"===i.namespaceURI&&"template"===i.localName?i.content:i).querySelectorAll("a[target], template").forEach(i=>{var e;if("template"===i.localName)return void("http://www.w3.org/1999/xhtml"===i.namespaceURI&&t.hg(i));if("http://www.w3.org/1999/xhtml"!==i.namespaceURI||"_blank"!==(null===(e=i.getAttribute("target"))||void 0===e?void 0:e.toLowerCase()))return void i.removeAttribute("target");const s=(i.getAttribute("rel")||"").split(/\s+/).filter(t=>t&&!/^(opener|noopener)$/i.test(t));s.push("noopener"),i.setAttribute("rel",s.join(" "))})}og(i,e,s){this._is_bot()?t.sg(zd):"control"!==e?s.forEach(s=>{if(s.selector){var n;t.sg(`applying transform of variant ${e} for experiment ${i} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector),o=new Map;null==r||r.forEach(i=>{if("script"===i.localName.toLowerCase())return;const e=i;if(s.html){var n;const l="http://www.w3.org/1998/Math/MathML"===i.namespaceURI&&"annotation-xml"===i.localName&&(null===(n=i.getAttribute("encoding"))||void 0===n?void 0:n.toLowerCase())||"",a=JSON.stringify([i.namespaceURI,i.localName,l]);let u=o.get(a);if(wi(u)){var r;const e=null!==(r=qd)&&void 0!==r?r:qd=Bd(),n=i.ownerDocument.implementation.createHTMLDocument(""),h=n.createElementNS(i.namespaceURI,i.localName);l&&h.setAttribute("encoding",l);const c=n.createRange();c.selectNodeContents(h);const d="http://www.w3.org/2000/svg"===i.namespaceURI&&/^(foreignObject|desc|title)$/.test(i.localName)||/^(text\/html|application\/xhtml\+xml)$/.test(l)?"http://www.w3.org/1999/xhtml":i.namespaceURI,v=c.createContextualFragment(s.html);"http://www.w3.org/1998/Math/MathML"===i.namespaceURI&&/^(mi|mo|mn|ms|mtext)$/.test(i.localName)?(h.appendChild(v),e.sanitize(h,as(as({},Hd),{},{NAMESPACE:d||void 0,IN_PLACE:!0}))):("http://www.w3.org/1999/xhtml"===h.namespaceURI&&"template"===h.localName?h.content:h).appendChild(e.sanitize(v,as(as({},Hd),{},{NAMESPACE:d||void 0,RETURN_DOM_FRAGMENT:!0}))),t.hg(h),u=h.innerHTML,o.set(a,u)}e.innerHTML=u}s.css&&e.setAttribute("style",s.css)})}}):t.sg("Control variants leave the page unmodified.")}_is_bot(){return Vt&&this._instance?Tu(Vt,this.Dr.custom_blocked_useragents):void 0}}},Ev),Fv={conversations:class{constructor(t){this._instance=t,this.dg=void 0,this._conversationsManager=null,this.vg=!1,this.ie=null,this.fg=!1,this.pg=0,this.gg=null,this.mg=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return void(this.gg=null);if(this.yg=t.ok,!t.ok)return;const i=t.config.conversations;wi(i)?this.gg=null:(Si(i)?this.dg=i:(this.dg=i.enabled,this.ie=i),this.dg||(this.gg=null),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.pg++,this.dg=void 0,this.ie=null,this.yg=void 0,this.fg=!1,this.gg=null}loadIfEnabled(){if(this._conversationsManager)return;if(this.vg)return;if(this._instance.config.disable_conversations)return;if(jr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==ii?void 0:ii.__PosthogExtensions__;if(t&&!_i(this.dg)&&this.dg)if(this.ie&&this.ie.token){this.vg=!0;try{const i=t.initConversations;if(i)return this.bg(i),void(this.vg=!1);const e=t.loadExternalDependency;if(!e)return void this._g(x);const s=this.pg;e(this._instance,"conversations",i=>{if(s!==this.pg)return this.vg=!1,void this.loadIfEnabled();i||!t.initConversations?this._g("Could not load conversations script",i):this.bg(t.initConversations),this.vg=!1})}catch(t){this._g("Error initializing conversations",t),this.vg=!1}}else Vd.error("Conversations enabled but missing token in remote config.")}bg(t){if(this.ie){try{this._conversationsManager=t(this.ie,this._instance),this.fg=!1,Vd.info("Conversations loaded successfully")}catch(t){return void this._g("Error completing conversations initialization",t)}this.mg&&this._conversationsManager.setTheme(this.mg),this.wg()}else Vd.error("Cannot complete initialization: remote config is null")}wg(){const t=this.gg;this.gg=null,this._conversationsManager&&t&&("open"===t?this._conversationsManager.open():this._conversationsManager.close())}_g(t,i){Vd.error(t,i),this._conversationsManager=null,this.vg=!1,this.fg=!0}show(){this._conversationsManager?this._conversationsManager.show():Vd.warn("Conversations not loaded yet.")}hide(){"open"===this.gg&&(this.gg=null),this._conversationsManager&&this._conversationsManager.hide()}open(){this._conversationsManager?(this.gg=null,this._conversationsManager.open()):this.gg="open"}close(){this._conversationsManager?(this.gg=null,this._conversationsManager.close()):this.gg="close"}setTheme(t){var i,e;this.mg=as(as(as({},this.mg),t),{},{dark:as(as({},null===(i=this.mg)||void 0===i?void 0:i.dark),null==t?void 0:t.dark)}),null===(e=this._conversationsManager)||void 0===e||e.setTheme(t)}isAvailable(){return!0===this.dg&&!bi(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":jr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.yg?"remote_config_failed":_i(this.dg)?this.yg?"disabled_in_project":"remote_config_pending":this.dg?wi(this.ie)||!this.ie.token?"missing_token":(null==ii?void 0:ii.__PosthogExtensions__)?this.vg?"initializing":this.fg?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var s=this;return Di(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,e):(Vd.warn(Gd),null)})()}getMessages(t,i){var e=this;return Di(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(Vd.warn(Gd),null)})()}markAsRead(t){var i=this;return Di(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Vd.warn(Gd),null)})()}getTickets(t){var i=this;return Di(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Vd.warn(Gd),null)})()}requestRestoreLink(t){var i=this;return Di(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Vd.warn(Gd),null)})()}restoreFromToken(t){var i=this;return Di(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Vd.warn(Gd),null)})()}restoreFromUrlToken(){var t=this;return Di(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Vd.warn(Gd),null)})()}getCurrentTicketId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}_d(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}wd(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},Dv={logs:class extends iv{constructor(t){super({get(){var i;return null==t||null===(i=t.config)||void 0===i?void 0:i.logs},captureHintKey:W,get remoteConfigWillArrive(){var i,e;return!(null===(i=t.Yu)||void 0===i?void 0:i.call(t))||!!(null===(e=ii._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[t.config.token])||void 0===e?void 0:e.config)}},()=>function(t){var i;const e={};if(e.distinctId=t.get_distinct_id(),t.sessionManager){const{sessionId:i,windowId:s,sessionStartTimestamp:n,lastActivityTimestamp:r}=t.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i,e.windowId=s,wi(n)||(e.sessionStartTimestamp=n),wi(r)||(e.lastActivityTimestamp=r)}if((null==ii||null===(i=ii.location)||void 0===i?void 0:i.href)&&(e.currentUrl=t.config.disable_capture_url_hashes?ts(ii.location.href):ii.location.href),t.featureFlags){const i=t.featureFlags.getFlags();i&&i.length>0&&(e.activeFeatureFlags=i)}return e}(t)),this._instance=t,this.name=oh,this.Zv()}get Qv(){return this._instance.__loaded}Jv(){const t=Pr("[logs]"),i=null==ii?void 0:ii.__PosthogExtensions__;if(!i)return void t.error("PostHog Extensions not found.");const e=i.loadExternalDependency;if(e)return t=>{e(this._instance,"logs",e=>{const s=i.logs;t(e,(null==s?void 0:s.initializeLogs)?{initialize:t=>s.initializeLogs(t),replay(t,i){var e;return null===(e=s.replayConsoleBuffer)||void 0===e?void 0:e.call(s,t,i)}}:void 0)})};t.error(x)}}},Nv={metrics:class{constructor(t){this._instance=t,this.A=Pr("[metrics]"),this.Ti=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.Ti)return;const i=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);i&&!this.kg?this.kg=(t=>{let i=!0;const e=()=>i?(t=>{var i;const e=null===(i=t.config.metrics)||void 0===i?void 0:i.network;return!0===e?{}:e||void 0})(t):void 0,s=uv(t,e),n=hv(t,e);return()=>{i=!1,s(),n()}})(this._instance):!i&&this.kg&&(this.kg(),this.kg=void 0)}Xv(){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var e;return this.Vv&&this.tf===i||(null===(e=this.Vv)||void 0===e||e.reset(),this.tf=i,this.Vv=new Sr(this.Yv(),function(t){var i,e,s,n,r;const o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==o?void 0:o["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==o?void 0:o["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(s=null==o?void 0:o["deployment.environment"])&&void 0!==s?s:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(n=null==t?void 0:t.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(i),this.A)),this.Vv}count(t,i=1,e){this.Xv().count(t,i,e)}gauge(t,i,e){this.Xv().gauge(t,i,e)}histogram(t,i,e){this.Xv().histogram(t,i,e)}flush(t){if(!this.Vv)return Promise.resolve();if(t){const i=this.Vv.drainWindow();return i&&this.bo(i,t),Promise.resolve()}return this.Vv.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Vv)||void 0===t||t.reset()}dispose(){var t,i;this.Ti=!0,null===(t=this.kg)||void 0===t||t.call(this),this.kg=void 0,null===(i=this.Vv)||void 0===i||i.reset()}Yv(){const t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},bo:t=>i.bo(t),getLibraryId:()=>e.LIB_NAME,getLibraryVersion:()=>e.LIB_VERSION}}bo(t,i){return new Promise(e=>{let s=!1;const n=t=>{s||(s=!0,clearTimeout(r),e(t))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(as(as({method:"POST",url:this.Sg(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i}),{},{fireCallbackOnDrop:!0,callback(t){const i=t.statusCode;if(i>=200&&300>i)n({kind:"ok"});else if(413===i)n({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)n({kind:"fatal",error:new Error(`metrics request failed with status ${i}`)});else{var e;n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error(`metrics request failed with status ${i}`)})}}}))})}Sg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Lv={webMCP:class{constructor(t){this._instance=t,this.xg=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.xg)return;const t=null==Gt?void 0:Gt.modelContext;if(!t||!fi(t.registerTool))return;const i=cv.get(t);if(i)return i.instances.add(this._instance),void(this.xg=!0);const e={instances:new Set([this._instance])},s=t.registerTool,n=this;Dh(t,"registerTool",t=>{const i=t;return function(t,...s){let r=t;try{r=n.$g(t,e)}catch(e){return i.call(this,t,...s)}return i.call(this,r,...s)}}),t.registerTool!==s&&(cv.set(t,e),this.xg=!0)}$g(t,i){if(!t||!fi(t.execute))return t;const e=t.execute,s=this,{tool:n,injected:r}=function(t,i){const e={intent:!1,model:!1},s=t.inputSchema;if(!function(t){return!!_i(t)||pi(t)&&Object.keys(t).every(t=>dv.has(t)||t.startsWith("x-"))&&!0!==t.additionalProperties&&!pi(t.additionalProperties)&&(!t.type||"object"===t.type)&&(!t.properties||pi(t.properties))&&(!t.required||vi(t.required))}(s))return{tool:_v(t),injected:e};const n=(null==s?void 0:s.properties)||{},r=t=>gv(n,t)||vi(null==s?void 0:s.required)&&s.required.includes(t);if(e.intent=i.intent&&!r("context"),e.model=i.model&&!r("llm_model"),!e.intent&&!e.model)return{tool:_v(t),injected:e};const o=as({},n),l=vi(null==s?void 0:s.required)?[...s.required]:[];return e.intent&&(o.context={type:"string",description:'Explain why this tool is called and how it supports the user\'s goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".'},l.includes("context")||l.push("context")),e.model&&(o.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},l.includes("llm_model")||l.push("llm_model")),{tool:_v(t,as(as({},s),{},{type:(null==s?void 0:s.type)||"object",properties:o,required:l})),injected:e}}(t,function(t){const i={intent:!1,model:!1};for(const e of t.instances){const t=pv(e.config.capture_webmcp);i.intent||(i.intent=!0===(null==t?void 0:t.intent)),i.model||(i.model=!0===(null==t?void 0:t.model))}return i}(i));return Object.defineProperty(n,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){const l=new Date,a=function(t,i){if(!pi(t))return{};try{const e=i.intent?mv(t.context,2048,!0):void 0,s=i.model?mv(t.llm_model,256):void 0;return as(as({},e&&"{}"!==e?{intent:e}:{}),s&&"unknown"!==s.toLowerCase()?{model:s}:{})}catch(t){return{}}}(o[0],r),u=function(t,i){const e=t[0];if(!pi(e))return t;try{const s=i.intent&&gv(e,"context"),n=i.model&&gv(e,"llm_model");if(!s&&!n)return t;const r=as({},e);return s&&delete r.context,n&&delete r.llm_model,[r,...t.slice(1)]}catch(i){return t}}(o,r);let h;try{h=e.apply(this===n?t:this,u)}catch(t){throw s.Cg(i,n,l,{error:t,errorResult:!1},a),t}if((c=h)&&"function"==typeof c.then)return Promise.resolve(h).then(t=>{const e=yv(t)?{error:t,errorResult:!0}:void 0;return s.Cg(i,n,l,e,a),t},t=>{throw s.Cg(i,n,l,{error:t,errorResult:!1},a),t});var c;const d=yv(h)?{error:h,errorResult:!0}:void 0;return s.Cg(i,n,l,d,a),h}}),n}Cg(t,i,e,s,n){const r=Date.now()-e.getTime();let o;for(const a of t.instances){var l;const t=pv(a.config.capture_webmcp);if(t){s&&!o&&(o=Sv(s.error,s.errorResult));try{a.capture("$mcp_tool_call",as(as(as({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==Kt?void 0:Kt.hostname,$mcp_duration_ms:r,$mcp_is_error:!!s},o?{$mcp_error_type:o.type,$mcp_error_message:o.message}:{}),t.intent&&n.intent?{$mcp_intent:n.intent,$mcp_intent_source:"context_parameter"}:{}),t.model&&n.model?{$mcp_llm_model:n.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:e})}catch(t){continue}if(s&&o&&a.exceptions&&(null===(l=a.exceptionObserver)||void 0===l?void 0:l.isEnabled))try{const t={$exception_list:$v(a.exceptions,s,o.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==Kt?void 0:Kt.hostname};a.exceptionObserver.captureException(t)}catch(t){}}}}}};Rh.__defaultExtensionClasses=as({},as(as(as(as(as(as(as(as(as(as(as(as(as(as({},Ev),kv),Tv),Pv),Ov),Rv),Cv),Av),Iv),Mv),Fv),Dv),Nv),Lv));const jv=Pr("[ExternalScriptsLoader]"),Uv=t=>{const i=null==Gt?void 0:Gt.querySelectorAll("script");if(i)for(let e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},Bv=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return jv.warn(`${i} was requested but loading of external scripts is disabled.`),e("Loading of external scripts is disabled");const s=()=>{if(null==Gt||Gt.removeEventListener("DOMContentLoaded",s),t.config.disable_external_dependency_loading)return e("Loading of external scripts is disabled");if(!Gt)return e("document not found");let r=Gt.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(t.config.disable_external_dependency_loading)return e("Loading of external scripts is disabled");const o=Uv(r.src);if(o){if(o.integrity!==r.integrity||o.crossOrigin!==r.crossOrigin||o.nonce!==r.nonce)return e("Existing script conflicts with prepared script policy");if(o.__posthog_loading_callback_fired)return e();const t=o.__posthog_loading_error;return t?e(t):(o.addEventListener("load",t=>{o.__posthog_loading_callback_fired=!0,e(void 0,t)}),void o.addEventListener("error",t=>{o.__posthog_loading_error=t,e(t)}))}if(!Gt.body)return n();if("head"===t.config.external_scripts_inject_target)Gt.head.appendChild(r);else{const t=Gt.querySelectorAll("body > script");var l;t.length>0?null===(l=t[0].parentNode)||void 0===l||l.insertBefore(r,t[0]):Gt.body.appendChild(r)}},n=()=>{null==Gt||Gt.addEventListener("DOMContentLoaded",s)};(null==Gt?void 0:Gt.body)||Uv(i)?s():n()},zv={},Hv=(t,i)=>{let e=`/static/${i}.js?v=${t.version}`;if("toolbar"===i){const t=3e5;e=`${e}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",e)};ii.__PosthogExtensions__=ii.__PosthogExtensions__||{},ii.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"===i){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void Bv(t,i,e)}const s=t.config.strict_script_versioning;if(s){const n=t.requestRouter.endpointFor("assets",`/static/${t.version}/${i}.js`),r=zv[n];if("fallback"===s&&r){if(Uv(r))return void Bv(t,r,e);delete zv[n]}return void Bv(t,n,"fallback"===s?(s,r)=>{if(s)if("string"==typeof s)e(s);else{var o;const s=Hv(t,i);zv[n]=s;const r=Uv(n);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),Bv(t,s,e)}else e(void 0,r)}:e)}Bv(t,Hv(t,i),e)},ii.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{const s=t.requestRouter.endpointFor("api",i);Bv(t,s,e)};const qv=function(){e.SDK_DIST_CHANNEL="npm";const t=uh[xh]=new Rh;return function(){function t(){t.done||(t.done=!0,fu=!1,Rr(uh,function(t){t._dom_loaded()}))}(null==Gt?void 0:Gt.addEventListener)?"complete"===Gt.readyState?t():Lr(Gt,"DOMContentLoaded",t,{capture:!1}):qt&&Tr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=sa,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=aa,exports.PostHog=Rh,exports.ProductTourEventName=ha,exports.ProductTourEventProperties=ca,exports.SurveyEventName=oa,exports.SurveyEventProperties=la,exports.SurveyEventType=na,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=ra,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=qv,exports.posthog=qv,exports.severityLevels=["fatal","error","warning","log","info","debug"];
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t="0.10.4",i={DEBUG:(!1,!1),LIB_VERSION:(t,"1.445.0"),LIB_NAME:("browser-common","web"),JS_SDK_VERSION:t};var e=i;const s="$early_access_features",n="$active_feature_flags",r="$feature_flag_details",o="$feature_flag_errors",l="$feature_flag_evaluated_at",a="$feature_flag_request_id",u="$minimal_flag_called_events",h="$enabled_feature_flags",c="$stored_group_properties",d="$stored_person_properties",v="$flag_call_reported",f="$flag_call_reported_session_id",p="$feature_flag_payloads",g="$override_feature_flags",_="$override_feature_flag_payloads",m="visibilitychange",y="$autocapture_disabled_server_side",b="$surveys",w="$surveys_loaded_at",x="PostHog loadExternalDependency extension not found.",S="$surveys_activated",E="$surveys_activated_session",k="$surveys_activated_timestamps",T="$people_distinct_id",P="distinct_id",O="$device_id",R="$device_model",A="__alias",C="__cmpns",I="$fbc",M="$fbc_persistence",F="$fbp",D="$fbp_persistence",N="__timers",L="$heatmaps_enabled_server_side",j="$exception_capture_enabled_server_side",U="$error_tracking_suppression_rules",B="$error_tracking_capture_extension_exceptions",z="$web_vitals_enabled_server_side",H="$dead_clicks_enabled_server_side",q="$product_tours_enabled_server_side",W="$logs_capture_enabled_server_side",V="$web_vitals_allowed_metrics",G="$session_recording_remote_config",K="$session_recording_enabled_server_side",Y="$replay_sample_rate",J="$replay_override_sampling",X="$replay_override_linked_flag",Z="$replay_override_url_trigger",Q="$replay_override_event_trigger",tt="$sesid",it="$session_is_sampled",et="$session_past_minimum_duration",st="$session_recording_url_trigger_activated_session",nt="$session_recording_event_trigger_activated_session",rt="$debug_first_full_snapshot_timestamp",ot="$sess_rec_flush_size",lt="$groups",at="ph_product_tours",ut="$product_tours_activated",ht="$product_tours_activated_session",ct="$conversations_widget_session_id",dt="$conversations_ticket_id",vt="$conversations_widget_state",ft="$conversations_user_traits",pt="$user_state",gt="$client_session_props",_t="$capture_rate_limit",mt="$initial_campaign_params",yt="$initial_referrer_info",bt="$initial_person_info",wt="$epp",$t="$posthog_cookieless",xt="$cookieless_mode",St="$sdk_debug_extensions_init_method",Et="$sdk_debug_extensions_init_time_ms",kt="$sdk_debug_recording_script_not_loaded",Tt="$sdk_debug_replay_stale_config",Pt="$sdk_debug_replay_event_trigger_status",Ot="$sdk_debug_replay_linked_flag_trigger_status",Rt="$sdk_debug_replay_matched_recording_trigger_groups",At="$sdk_debug_replay_pending_trigger_conditions",Ct="$sdk_debug_replay_remote_trigger_matching_config",It="$sdk_debug_replay_trigger_groups_count",Mt="$sdk_debug_replay_url_trigger_status",Ft="$session_recording_start_reason",Dt="anonymous",Nt="identified",Lt="identified_only",jt="beforeunload",Ut="$pageview",Bt="$pageleave",zt="$identify",Ht="$groupidentify",qt="u">typeof window?window:void 0,Wt="u">typeof globalThis?globalThis:qt,Vt=null==Wt?void 0:Wt.navigator,Gt=null==Wt?void 0:Wt.document,Kt=null==Wt?void 0:Wt.location,Yt=null==Wt?void 0:Wt.fetch,Jt=(null==Wt?void 0:Wt.XMLHttpRequest)&&"withCredentials"in new Wt.XMLHttpRequest?Wt.XMLHttpRequest:void 0,Xt=null==Wt?void 0:Wt.AbortController,Zt=null==Wt?void 0:Wt.CompressionStream,Qt=null==Vt?void 0:Vt.userAgent,ti="undefined"!=typeof globalThis?globalThis:qt;ti&&"undefined"==typeof self&&(ti.self=ti),ti&&"undefined"==typeof File&&(ti.File=function(){});const ii=null!=qt?qt:{};var ei=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.PushRegistered="push_registered",t.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysInProgress="surveys_in_progress",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),si=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const ni=["$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"],ri=["token"];function oi(t,i){return-1!==t.indexOf(i)}const li=function(t){return t.trim()},ai=function(t){return t.replace(/^\$/,"")};function ui(t){var i;const e=[];return null!==(i=JSON.stringify(t,function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(e.includes(i))return"[Circular]";e.push(i)}return i}}))&&void 0!==i?i:"null"}const hi=Object.prototype,ci=hi.hasOwnProperty,di=hi.toString,vi=Array.isArray||function(t){return"[object Array]"===di.call(t)},fi=t=>"function"==typeof t,pi=t=>t===Object(t)&&!vi(t),gi=t=>{if(pi(t)){for(const i in t)if(ci.call(t,i))return!1;return!0}return!1},_i=t=>void 0===t,mi=t=>"[object String]"==di.call(t),yi=t=>mi(t)&&0===t.trim().length,bi=t=>null===t,wi=t=>_i(t)||bi(t),$i=t=>"[object Number]"==di.call(t)&&t==t,xi=t=>$i(t)&&t>0,Si=t=>"[object Boolean]"===di.call(t),Ei=t=>oi(ni,t),ki=t=>oi(ri,t);function Ti(t){return null===t||"object"!=typeof t}function Pi(t,i){return{}.toString.call(t)===`[object ${i}]`}function Oi(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 Ai(t,Error)}}function Ri(t){return"u">typeof Event&&Ai(t,Event)}function Ai(t,i){try{return t instanceof i}catch(t){return!1}}const Ci=[!0,"true",1,"1","yes"],Ii=t=>oi(Ci,t),Mi=[!1,"false",0,"0","no"];function Fi(t,i,e,s,n,r,o){try{var l=t[r](o),a=l.value}catch(t){return void e(t)}l.done?i(a):Promise.resolve(a).then(s,n)}function Di(t){return function(){var i=this,e=arguments;return new Promise(function(s,n){var r=t.apply(i,e);function o(t){Fi(r,s,n,o,l,"next",t)}function l(t){Fi(r,s,n,o,l,"throw",t)}o(void 0)})}}const Ni=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","lightpanda","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Li=new Map,ji=function(t,i=[]){if(!t)return!1;const e=function(t,i){let e="";for(let t=0;i.length>t;t++){const s=i[t];e+=s.length+":"+s}return t.length+":"+t+"|"+i.length+":"+e}(t,i),s=Li.get(e);if(void 0!==s)return s;const n=t.toLowerCase(),r=Ni.concat(i).some(t=>-1!==n.indexOf(t.toLowerCase()));return 256>Li.size||Li.clear(),Li.set(e,r),r};function Ui(t,i,e,s,n){return i>e&&(s.warn("min cannot be greater than max."),i=e),$i(t)?t>e?(s.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(s.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(s.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+n),Ui(null!=n?n:e,i,e,s))}var Bi=class{constructor(t){this.C={},this.I=t.I,this.R=Ui(t.bucketSize,0,100,t.A),this.O=Ui(t.refillRate,0,this.R,t.A),this.$=Ui(t.refillInterval,0,864e5,t.A)}F(t,i){const e=Math.floor((i-t.lastAccess)/this.$);e>0&&(t.tokens=Math.min(t.tokens+e*this.O,this.R),t.lastAccess=t.lastAccess+e*this.$)}consumeRateLimit(t){var i;const e=Date.now(),s=String(t);let n=this.C[s];return n?this.F(n,e):(n={tokens:this.R,lastAccess:e},this.C[s]=n),0===n.tokens||(n.tokens--,0===n.tokens&&(null===(i=this.I)||void 0===i||i.call(this,t)),0===n.tokens)}stop(){this.C={}}};const zi="Mobile",Hi="Android",qi="Tablet",Wi="Android Tablet",Vi="iPad",Gi="Apple Watch",Ki="Safari",Yi="BlackBerry",Ji="Samsung Internet",Xi="Chrome",Zi="Chrome iOS",Qi="Internet Explorer",te="Internet Explorer Mobile",ie="Opera",ee="Microsoft Edge",se="Firefox",ne="Firefox iOS",re="Nintendo",oe="PlayStation",le="Xbox",ae="Android Mobile",ue="Mobile Safari",he="Windows",ce="Windows Phone",de="Nokia",ve="Ouya",fe="Generic "+zi.toLowerCase(),pe="Generic "+qi.toLowerCase(),ge="Konqueror",_e="Oculus Browser",me="Vivaldi",ye="Yandex",be="Whale",we="DuckDuckGo",$e="Pale Moon",xe="Waterfox",Se="Brave",Ee="Claude",ke="Codex",Te="ChatGPT",Pe="Google Search App",Oe=new RegExp("Version/(\\d+(\\.\\d+)?)"),Re=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Ae=new RegExp(le,"i"),Ce=new RegExp("PlayStation \\w+","i"),Ie=new RegExp("Nintendo \\w+","i"),Me=new RegExp("BlackBerry|PlayBook|BB10","i"),Fe={"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"},De=function(t,i,e,s){i=i||"";const n=function(t){return(null==t?void 0:t.brave)?Se:null}(e);return n||((null==s?void 0:s.detectGoogleSearchApp)&&oi(t,"GSA/")?Pe:oi(t," OPR/")&&oi(t,"Mini")?"Opera Mini":oi(t," OPR/")?ie:Me.test(t)?Yi:oi(t,"IEMobile")||oi(t,"WPDesktop")?te:oi(t,"OculusBrowser")?_e:oi(t,"SamsungBrowser")?Ji:oi(t,"Edge")||oi(t,"Edg/")?ee:oi(t,"Vivaldi/")?me:oi(t,"YaBrowser/")?ye:oi(t,"Whale/")?be:oi(t,"DuckDuckGo/")||oi(t,"Ddg/")?we:oi(t,"Claude/")?Ee:oi(t,"Codex/")?ke:oi(t,"ChatGPT/")?Te:oi(t,"FBIOS")?"Facebook Mobile":oi(t,"UCWEB")||oi(t,"UCBrowser")?"UC Browser":oi(t,"CriOS")?Zi:oi(t,"CrMo")||oi(t,Xi)?Xi:oi(t,Hi)&&oi(t,Ki)?ae:oi(t,"FxiOS")?ne:oi(t.toLowerCase(),ge.toLowerCase())?ge:oi(t,"Brave/")?Se:((t,i)=>i&&oi(i,"Apple")||function(t){return oi(t,Ki)&&!oi(t,Xi)&&!oi(t,Hi)}(t))(t,i)?oi(t,zi)?ue:Ki:oi(t,"PaleMoon/")?$e:oi(t,"Waterfox/")?xe:oi(t,se)?se:oi(t,"MSIE")||oi(t,"Trident/")?Qi:oi(t,"Gecko")?se:"")},Ne={[te]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[ee]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Xi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Zi]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Ki]:[Oe],[ue]:[Oe],[ie]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[se]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[ne]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[ge]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Yi]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Oe],[ae]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Ji]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[_e]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[me]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[ye]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[be]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Se]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ee]:[Re],[ke]:[Re],[Te]:[Re],[we]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[$e]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[xe]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Pe]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Qi]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Le=function(t,i,e,s){const n=De(t,i,e,s),r=Ne[n];if(_i(r))return null;for(let i=0;r.length>i;i++){const e=t.match(r[i]);if(e)return parseFloat(e[e.length-2])}return null},je=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[le,t&&t[1]||""]],[new RegExp(re,"i"),[re,""]],[new RegExp(oe,"i"),[oe,""]],[Me,[Yi,""]],[new RegExp(he,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[ce,""];if(new RegExp(zi).test(i)&&!/IEMobile\b/.test(i))return["Windows Mobile",""];const e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){let t=Fe[e[1]]||"";return/arm/i.test(i)&&(t="RT"),[he,t]}return[he,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?["iOS",[t[3],t[4],t[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{let i="";return t&&t.length>=3&&(i=_i(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Hi,[t[2],t[3],t[4]||"0"].join(".")]:[Hi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Ue=function(t){for(let i=0;je.length>i;i++){const[e,s]=je[i],n=e.exec(t),r=n&&(fi(s)?s(n,t):s);if(r)return r}return["",""]},Be=function(t){return Ie.test(t)?re:Ce.test(t)?oe:Ae.test(t)?le:new RegExp(ve,"i").test(t)?ve:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?ce:/iPad/.test(t)?Vi:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Gi:Me.test(t)?Yi:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(de,"i").test(t)?de:/(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(zi).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)?Hi:Wi:new RegExp("(pda|Mobile)","i").test(t)?fe:new RegExp(qi,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?pe:""},ze=function(t,i){var e;const s=Be(t);return s===Vi||s===Wi||"Kobo"===s||"Kindle Fire"===s||s===pe?qi:s===re||s===le||s===oe||s===ve?"Console":s===Gi?"Wearable":s?zi:"Android"===(null==i?void 0:i.userAgentDataPlatform)&&(null!==(e=null==i?void 0:i.maxTouchPoints)&&void 0!==e?e:0)>0?600>Math.min(null!==(n=null==i?void 0:i.screenWidth)&&void 0!==n?n:0,null!==(r=null==i?void 0:i.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==i?void 0:i.devicePixelRatio)&&void 0!==o?o:1)?zi:qi:"Desktop";var n,r,o},He=/\bFBAV\/(\d+(?:\.\d+)*)/i,qe=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",He],[/\bFBAN\/EMA\b/i,"Facebook Lite",He],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",He],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],We="[Truncated]",Ve="[Unserializable]";function Ge(t){let i="";for(let e=0;t.length>e;e++){const s=t.charCodeAt(e);if(55296>s||s>56319)i+=56320>s||s>57343?t[e]:"�";else{const s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}function Ke(t,i){if(!i)return t;let e=[];try{e=Object.keys(i)}catch(t){e=[]}for(const s of e){let e;try{e=i[s]}catch(t){e=Ve}Object.defineProperty(t,s,{value:e,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const Ye=3e5;var Je=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const i=this.isOpen(),e=Date.now(),s=Math.min(t.retryAfterMs,Ye);if(!i)return this.ts=e,void(this.es=e+s);this.es=Math.max(this.es,Math.min(e+s,this.ts+Ye))}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const i=Math.min(Ye,Math.max(0,this.es-t));return 0===i&&this.reset(),i}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const Xe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ze(t,i){return"string"==typeof(e=t)&&Xe.test(e)?t:i();var e}function Qe(t,i){const e=new Error(i);try{Object.defineProperty(e,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return e}function ts(t){return t?t.split("#")[0]:t}function is(t){try{return t()}catch(t){return}}function es(t,i){const e=setTimeout(t,i);return null!=e&&e.unref&&(null==e||e.unref()),e}function ss(t,i,e){return ns.apply(this,arguments)}function ns(){return(ns=Di(function*(t,i,e){let s;try{return yield Promise.race([t,new Promise((t,n)=>{s=es(()=>{try{null==e||e(),t()}catch(t){n(t)}},i)})])}finally{clearTimeout(s)}})).apply(this,arguments)}function rs(t){return rs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rs(t)}function os(t,i,e){return(i=function(t){var i=function(t){if("object"!=rs(t)||!t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var e=i.call(t,"string");if("object"!=rs(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==rs(i)?i:i+""}(i))in t?Object.defineProperty(t,i,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[i]=e,t}function ls(t,i){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);i&&(s=s.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),e.push.apply(e,s)}return e}function as(t){for(var i=1;arguments.length>i;i++){var e=null!=arguments[i]?arguments[i]:{};i%2?ls(Object(e),!0).forEach(function(i){os(t,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ls(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})}return t}let us,hs,cs,ds;function vs(t){var i;const e=globalThis._posthogChunkIds,s=globalThis._debugIds;if(!e&&!s)return;const n=e?Object.keys(e):[],r=s?Object.keys(s):[];if(ds&&fs(e,n,hs)&&fs(s,r,cs))return ds;hs=e?as({},e):void 0,cs=s?as({},s):void 0,ds={},null!==(i=us)&&void 0!==i||(us={});const o=(i,e)=>{for(const n of i){const i=e[n];if(!i)continue;const r=null==us?void 0:us[n];if(r){ds[r]=i;continue}const o=t(n);for(let t=o.length-1;t>=0;t--){var s;const e=null===(s=o[t])||void 0===s?void 0:s.filename;if(e){ds[e]=i,us[n]=e;break}}}};return s&&o(r,s),e&&o(n,e),ds}function fs(t,i,e){return t&&e?i.length===Object.keys(e).length&&i.every(i=>t[i]===e[i]):t===e}var ps=class{constructor(t,i,e=[]){this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i={}){const e=i&&i.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(e,i,0).apply(t),n=this.buildParsingContext(i),r=this.parseStacktrace(s,n);return{$exception_list:this.convertToExceptionList(r,e),$exception_level:"error"}}modifyFrames(t){var i=this;return Di(function*(){for(const e of t)e.stacktrace&&e.stacktrace.frames&&vi(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t})()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null===(i=t.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e;let s,n;if(null!=t.cause&&(s=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack)try{n=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)}catch(t){}return as(as({},t),{},{cause:s,stack:n,errors:null===(e=t.errors)||void 0===e?void 0:e.map(t=>this.parseStacktrace(t,i))})}applyChunkIds(t,i){return t.map(t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t))}applyCoercers(t,i){for(const e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return Di(function*(){let e=t;for(const t of i.modifiers)e=yield t(e);return e})()}convertToExceptionList(t,i){const e=[],s=(t,n,r)=>{var o;const l=e.length,a=void 0===n?as(as({type:"string"==typeof i.type&&i.type.length>0?i.type:"generic"},"boolean"==typeof i.handled?{handled:i.handled}:void 0===i.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof i.synthetic?i.synthetic:t.synthetic,exception_id:l}):{type:"chained",source:r,synthetic:t.synthetic,exception_id:l,parent_id:n},u={type:t.type,value:t.value,mechanism:a};t.stack&&(u.stacktrace={type:"raw",frames:t.stack}),e.push(u),t.cause&&s(t.cause,l,"cause");for(const i of null!==(o=t.errors)&&void 0!==o?o:[])s(i,l,"member")};return s(t),e}buildParsingContext(t){var i;return{chunkIdMap:vs(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}getAggregateErrors(t){try{if(Oi(t)){let e=Object.getPrototypeOf(t);for(let s=0;e&&100>s;s++){var i;const s=null===(i=Object.getOwnPropertyDescriptor(e,"constructor"))||void 0===i?void 0:i.value;if("function"==typeof s&&"AggregateError"===s.name){const i=t.errors;return vi(i)?i:void 0}e=Object.getPrototypeOf(e)}}}catch(t){}}buildCoercingContext(t,i,e=0){let s=0,n=0,r=!1;const o=new Set,l=[],a={},u=(t,i,e=0)=>{const u=h(i,e),c=u.apply;if(u.apply=i=>{l.push(t);try{return c(i)}finally{l.pop()}},e>4||e>0&&-1!==l.indexOf(t))return this.coerceFallback(u);const d="object"==typeof t&&null!==t||"function"==typeof t;if(0===e&&s>=50||d&&o.has(t))return;d&&o.add(t),0===e&&s++;const v=this.getAggregateErrors(t);let f,p;r||(r=!!v);try{if(f=this.applyCoercers(t,u),!f)throw a}catch(t){if(t===a)return void(0===e&&s--);if(!r)throw t;f=this.coerceFallback(u)}if(!v||s>=50)return f;try{p=v.length}catch(t){return f}if(!Number.isInteger(p)||0>p||p>4294967295)return f;const g=[];for(let t=0;50>s&&1e3>n&&p>t;t++){let e;n++;try{e=u.next(v[t])}catch(t){s++,e=this.coerceFallback(h(i+1))}e&&g.push(e)}return as(as({},f),{},{errors:g})},h=(e,s=0)=>as(as({},i),{},{syntheticException:0==e?i.syntheticException:void 0,mechanism:0==e?t:{},apply(t){const i=u(t,e,s+1);if(!i)throw a;return i},next:t=>u(t,e+1)}),c=h(e);return as(as({},c),{},{apply:t=>{var i;return null!==(i=u(t,e))&&void 0!==i?i:this.coerceFallback(c)}})}};const gs=/^([a-z][a-z0-9.+-]+):/i,_s=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function ms(t){if(!t||"<anonymous>"===t)return!1;const i=gs.exec(t);return!i||_s.includes(i[1].toLowerCase())}function ys(t,i,e,s,n){const r={platform:t,filename:i,function:"<anonymous>"===e?"?":e,in_app:ms(i)};return _i(s)||(r.lineno=s),_i(n)||(r.colno=n),r}const bs=(t,i)=>{const e=-1!==t.indexOf("safari-extension"),s=-1!==t.indexOf("safari-web-extension");return e||s?[-1!==t.indexOf("@")?t.split("@")[0]:"?",e?`safari-extension:${i}`:`safari-web-extension:${i}`]:[t,i]},ws=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,$s=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,xs=/\((\S*)(?::(\d+))(?::(\d+))\)/,Ss=(t,i)=>{const e=ws.exec(t);if(e){const[,t,s,n]=e;return ys(i,t,"?",+s,+n)}const s=$s.exec(t);if(s){if(s[2]&&0===s[2].indexOf("eval")){const t=xs.exec(s[2]);t&&(s[2]=t[1],s[3]=t[2],s[4]=t[3])}const[t,e]=bs(s[1]||"?",s[2]);return ys(i,e,t,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},Es=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ks=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ts=(t,i)=>{const e=Es.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const t=ks.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}let t=e[3],s=e[1]||"?";return[s,t]=bs(s,t),ys(i,t,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},Ps=/\(error: (.*)\)/;function Os(t,i){return t.filename===i.filename&&t.function===i.function&&t.module===i.module&&t.lineno===i.lineno&&t.colno===i.colno}function Rs(t){for(let i=1;10>=i;i++){const e=t.length-2*i;if(0>e)break;let s=!0;for(let n=0;i>n;n++)if(!Os(t[e+n],t[e+i+n])){s=!1;break}if(s){for(let s=0;i>s;s++)t[e+s]=t[e+i+s];return t.length=e+i,{start:e,length:i}}}}function As(t,i){const e=i.start+i.length,s=Is(t,i);s&&t.splice(e+s===t.length?e:i.start,s)}function Cs(t,i){let e=i.start;for(;e>0&&Os(t[e-1],t[e-1+i.length]);)e--;return i.start-e}function Is(t,i){const e=i.start+i.length;let s=e;for(;t.length>s&&Os(t[s],t[s-i.length]);)s++;return s-e}function Ms(t,i){const e=i[0];let s=t.length-(e?Cs(t,e):0);for(const e of i)s-=Is(t,e);return s}function Fs(t,i,e){for(let s=0;t.length>s;s++){const n=t[(i+s)%t.length],r=t[(e+s)%t.length];if(n!==r)return r>n}return!1}var Ds=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){const e=mi(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){const i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${i}: ${t.message}`:i}isDOMException(t){return Pi(t,"DOMException")}isDOMError(t){return Pi(t,"DOMError")}},Ns=class{match(t){return Oi(t)}coerce(t,i){var e;const s=this.getStack(t),n=void 0===s?null===(e=i.syntheticException)||void 0===e?void 0:e.stack:void 0,r=!!n;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=s?s:n,cause:t.cause?i.next(t.cause):void 0,synthetic:r}}getType(t){return t.name||t.constructor.name}getMessage(t,i){const e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){try{const i=t.stacktrace;if("string"==typeof i&&i.length>0)return i;const e=t.stack;return"string"==typeof e&&e.length>0?e:void 0}catch(t){return}}},Ls=class{match(t){return!!Pi(t,"ErrorEvent")&&(null!=t.error||this.mr(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);const s=i.apply(t.message);return as(as({},s),{},{stack:null!==(e=this.gr(t))&&void 0!==e?e:s.stack,synthetic:!0})}mr(t){return mi(t.message)&&t.message.length>0}gr(t){var i,e;const s=t,n=null!==(i=s.lineno)&&void 0!==i?i:0,r=null!==(e=s.colno)&&void 0!==e?e:0;if(mi(s.filename)&&0!==s.filename.length&&0!==n)return`Error\n at ${s.filename}:${n}:${r}`}};const js=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Us=class{match(t){return"string"==typeof t}coerce(t,i){var e;const[s,n]=this.getInfos(t);return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}getInfos(t){let i="Error",e=t;const s=t.match(js);return s&&(i=s[1],e=s[2]),[i,e]}};const Bs=["fatal","error","warning","log","info","debug"];function zs(t,i=40){const e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(let t=e.length;t>0;t--){const s=e.slice(0,t).join(", ");if(i>=s.length)return t===e.length?s:s.length>i?`${s.slice(0,i)}...`:s}return""}var Hs=class{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,s;const n=this.getErrorPropertyFromObject(t);return n?i.apply(n):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null===(s=i.syntheticException)||void 0===s?void 0:s.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(Ri(t))return t.constructor.name;const i="name"in t?t.name:void 0;return mi(i)&&!yi(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){let i=`'${t.name}' captured as exception`;return"message"in t&&"string"==typeof t.message&&(i+=` with message: '${t.message}'`),i}if("message"in t&&"string"==typeof t.message)return t.message;const i=this.getObjectClassName(t);return`${i&&"Object"!==i?`'${i}'`:"Object"} captured as exception with keys: ${zs(t)}`}isSeverityLevel(t){return mi(t)&&!yi(t)&&Bs.indexOf(t)>=0}getStack(t){try{return mi(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:mi(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(const i in t)if({}.hasOwnProperty.call(t,i)){const e=t[i];if(Oi(e))return e}}getObjectClassName(t){try{const i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}},qs=class{match(t){return Ri(t)}coerce(t,i){var e;const s=t.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${zs(t)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}},Ws=class{match(t){return Ti(t)}coerce(t,i){var e;return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}},Vs=class{match(t){return Pi(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Ri(t))return!1;try{const i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e;const s=this.getUnhandledRejectionReason(t);return Ti(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:null===(e=i.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}:i.apply(s)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}};const Gs="$message",Ks="$timestamp",Ys=new Set([Gs,Ks]),Js={enabled:!0,max_bytes:32768};function Xs(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:Js.enabled,max_bytes:Qs(t.max_bytes,Js.max_bytes)}:as({},Js)}var Zs=class{constructor(t){this.ns=[],this.ss=0,this.Dr=Xs(t)}setConfig(t){this.Dr=Xs(t),this.rs()}add(t){const i=function(t){let i;try{i=ui(t)}catch(t){return}try{const t=JSON.parse(i);if(!pi(t))return;const e=t,s=e[Gs],n=e[Ks];if(!mi(s)||0===s.trim().length)return;if(!mi(n)&&!$i(n))return;return{step:e,json:i}}catch(t){return}}(t);if(!i)return;const e=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;const i=encodeURIComponent(t);let e=0;for(let t=0;i.length>t;t++)"%"===i[t]?(e+=1,t+=2):e+=1;return e}(i.json);e>this.Dr.max_bytes||(this.ns.push({step:i.step,bytes:e}),this.ss+=e,this.rs())}getAttachable(){return this.ns.map(t=>t.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Dr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function Qs(t,i){if(!$i(t)||1/0===t||-1/0===t)return i;const e=Math.floor(t);return 0>e?i:e}const tn=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function en(t){return"string"==typeof t||t}function sn(t){return"string"==typeof t?t:void 0}const nn=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],rn="NativeGzipValidationError",on=t=>t.length>=2&&31===t[0]&&139===t[1],ln=(t,i)=>t===si.GZipJS||i===si.GZipJS||"gzip"===i,an=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):"");let un;const hn=t=>{throw Qe(rn,`Native gzip produced invalid output: ${t}`)},cn=function(){var t=Di(function*(t,i){18>t.size&&hn("too-short");const e=new Uint8Array(yield t.slice(0,10).arrayBuffer());on(e)&&8===e[2]||hn("invalid-header");const s=new DataView(yield t.slice(t.size-8).arrayBuffer());s.getUint32(0,!0)!==(t=>{const i=(()=>{if(un)return un;un=[];for(let t=0;256>t;t++){let i=t;for(let t=0;8>t;t++)i=1&i?3988292384^i>>>1:i>>>1;un[t]=i>>>0}return un})();let e=4294967295;for(let s=0;t.length>s;s++)e=i[255&(e^t[s])]^e>>>8;return(4294967295^e)>>>0})(i)&&hn("invalid-crc");const n=i.length>>>0;s.getUint32(4,!0)!==n&&hn("invalid-size")});return function(i,e){return t.apply(this,arguments)}}();function dn(){return dn=Di(function*(t,i=!0,e){try{const i=(new TextEncoder).encode(t),e=new globalThis.CompressionStream("gzip"),n=e.writable.getWriter(),r=n.write(i).then(()=>n.close()).catch((s=Di(function*(t){try{yield n.abort(t)}catch(t){}throw t}),function(t){return s.apply(this,arguments)})),o=new Response(e.readable).blob(),[l]=yield Promise.all([o,r]);return yield cn(l,i),l}catch(t){if(null==e?void 0:e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}var s}),dn.apply(this,arguments)}function vn(t,i){if(null==t)return{};var e,s,n=function(t,i){if(null==t)return{};var e={};for(var s in t)if({}.hasOwnProperty.call(t,s)){if(i.includes(s))continue;e[s]=t[s]}return e}(t,i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(s=0;r.length>s;s++)i.includes(e=r[s])||{}.propertyIsEnumerable.call(t,e)&&(n[e]=t[e])}return n}const fn="[redacted]",pn=/^[A-Za-z0-9+/\n\r]+=*$/,gn=/^[A-Za-z0-9_-]+={0,2}$/,_n=/[-_]/,mn=/^data:[^,\s]*;base64,/i,yn=/^[A-Za-z0-9+/_-]+={0,2}$/,bn=/\bph[a-z]_[A-Za-z0-9_-]{20,}\b/g,wn=/^(authorization|cookie|set-cookie|x-api-key|api[-_]?key|api[-_]?token|access[-_]?token|refresh[-_]?token|token|password|secret|client[-_]?secret|private[-_]?key)$/i,$n=/[a-z][a-z0-9+.-]{0,63}:[^\s<>"]+/gi,xn=/[\s<>"]/,Sn=new RegExp($n.source,"i"),En=/[a-z][a-z0-9+.-]{0,63}:\/\//i,kn=new RegExp(`^${En.source}`,"i"),Tn=new RegExp(En.source,"gi"),Pn=/(^|[-_./;])(auth|token|secret|password|passwd|pwd|credential|signature|sig|key|hmac|sas|bearer|jwt|session|sessionid)([-_./;]|$)/i,On=/^(code|AWSAccessKeyId|GoogleAccessId|Policy)$/i,Rn=/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g,An=/[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9.-]{1,255}\.[A-Za-z]{2,24}/g,Cn=/\b(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\b/g,In=/(^|[^\w:])((?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}|(?:[0-9A-Fa-f]{1,4}:){1,7}:|(?:[0-9A-Fa-f]{1,4}:){1,6}:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,5}|::(?:[0-9A-Fa-f]{1,4}(?::[0-9A-Fa-f]{1,4}){0,6})))(?=$|[^\w:])/g,Mn=/\b\d{3}[ .-]\d{2}[ .-]\d{4}\b/g,Fn=/\b\d(?:[ ./-]?\d){12,}\b/g,Dn=/\d+/g,Nn=/(^|[^\w+])((?:\+?1[ ./-]?)?(?:\(\d{3}\)[ ./-]?|\d{3}[ ./-])\d{3}[ ./-]\d{4})(?![\w])/g,Ln=/(^|[^\w])(\+\d{1,3}(?:[ ./()-]{0,2}\d){7,13})(?![\w])/g;function jn(t){return function(t){return wn.test(t)}(t)||Pn.test(t)||On.test(t)}function Un(t){return t.split("&",129).length>128}function Bn(t,i,e){return jn(t)||i.includes(";")&&function(t){return t.split(";").some(t=>jn(t.split("=",1)[0]))}(i)?fn:Sn.test(i)?e?Gn(i,{allowNestedUrls:!1,stripPunctuation:!0}):fn:i}function zn(t,i){const e=new URLSearchParams;let s=!1,n=!1;for(const[r,o]of new URLSearchParams(t)){const t=Kn(r),l=Kn(o);s||(s=t!==r||l!==o);const a=Bn(t,l,i);s||(s=a!==l),n=jn(t)||a!==l,e.append(t,a)}return{changed:s,lastFieldSensitive:n,serialized:e.toString()}}function Hn(t,i){if(!t.includes("="))return{value:qn(t,i),lastFieldSensitive:!1};const e=zn(t,i);return{value:e.changed?e.serialized:t,lastFieldSensitive:e.lastFieldSensitive}}function qn(t,i){return i?Gn(t,{allowNestedUrls:!1,stripPunctuation:!0}):Sn.test(t)?fn:t}function Wn(t,i,e){return"#"===t?!i.fragment&&(i.fragment=!0):"?"===t&&(i.fragment?"="!==e&&!i.fragmentQuery&&(i.fragmentQuery=!0):!i.query&&(i.query=!0))}function Vn(t,i){var e;if(t.length>8192&&kn.test(t))return fn;const{address:s,suffix:n}=i.stripPunctuation?function(t){let i=t.length;for(;i>0&&".,;:!?)]}'".includes(t[i-1]);)i--;return{address:t.slice(0,i),suffix:t.slice(i)}}(t):{address:t,suffix:""};let r;try{r=new URL(s)}catch(t){return fn+n}const o=r.search.slice(1),l=""!==r.hash,a=function(t){const i=t.slice(1),e=i.indexOf("?");return 0>e?{head:i,tail:null}:{head:i.slice(0,e),tail:i.slice(e+1)}}(r.hash);if(Un(o)||Un(a.head)||Un(null!==(e=a.tail)&&void 0!==e?e:""))return fn+n;let u=!1;(r.username||r.password)&&(r.username=fn,r.password="",u=!0);const h=zn(o,i.allowNestedUrls);h.changed&&(r.search=h.serialized,u=!0);const c=Hn(a.head,i.allowNestedUrls),d=null===a.tail?null:(v=a.tail,c.lastFieldSensitive?{value:""===v?"":fn,lastFieldSensitive:!0}:Hn(v,i.allowNestedUrls));var v;const f=null===d?c.value:`${c.value}?${d.value}`;f!==r.hash.slice(1)&&(r.hash=f,u=!0);const p=l?null!=d?d:c:h;return(u?Kn(r.toString()):s)+(p.lastFieldSensitive?"":n)}function Gn(t,i){return t.replace($n,e=>function(t,i){const e=function(t){if(!t.includes("://"))return[];const i=[...t.matchAll(Tn)].map(t=>t.index),e=[],s={query:!1,fragment:!1,fragmentQuery:!1};let n=0,r=!1,o="";for(let l=0;t.length>l&&i.length>n;l++){i[n]===l&&(l>0&&"="!==o&&e.push(l),n++);const a=t[l];Wn(a,s,o)?(o=a,r=!0):r&&"=&".includes(a)&&(o=a)}return e}(t);if(0===e.length)return Vn(t,i);let s="",n=0;for(const r of e)s+=Vn(t.slice(n,r),as(as({},i),{},{stripPunctuation:!1})),n=r;return s+Vn(t.slice(n),i)}(e,as(as({},i),{},{stripPunctuation:i.stripPunctuation&&e.length!==t.length})))}function Kn(t){return t.replace(bn,fn)}function Yn(t,i){return function(t){return t.length>=10240&&(pn.test(t)||function(t){const i=mn.exec(t);if(!i)return!1;let e;try{e=decodeURIComponent(t.slice(i[0].length))}catch(t){return!1}return yn.test(e.replace(/[\r\n]/g,""))}(t)||_n.test(t)&&gn.test(t))}(t)?"[binary data redacted - not supported by PostHog MCP analytics]":function(t,i,e){const s=4*e.maxStringLength;if(t.length>s){const n=i(t.slice(0,function(t,i){let e=i;for(;e>0&&!xn.test(t[e-1]);)e--;return e}(t,s)));if(n.length>=2*e.maxStringLength)return n+e.truncationSuffix}return i(t)}(t,t=>function(t){return Gn(t,{allowNestedUrls:!0,stripPunctuation:!0})}(function(t){let i=t.replace(Rn," ");return i=i.replace(An,fn),i=i.replace(Cn,fn),i=i.replace(In,`$1${fn}`),i=i.replace(Fn,Xn),i=i.replace(Mn,fn),i=i.replace(Nn,`$1${fn}`),i=i.replace(Ln,`$1${fn}`),i}(Kn(t))),i)}function Jn(t){let i=0,e=!1;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;if(0>n||n>9)return!1;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e}return i%10==0}function Xn(t){const i=[];for(let e=Dn.exec(t);null!==e;e=Dn.exec(t))i.push({digits:e[0],start:e.index,end:e.index+e[0].length});let e="",s=0,n=0;for(;i.length>n;){let r="",o=-1;for(let t=n;i.length>t&&(r+=i[t].digits,19>=r.length);t++)r.length>=13&&Jn(r)&&(o=t);0>o?n++:(e+=t.slice(s,i[n].start)+fn,s=i[o].end,n=o+1)}return e+t.slice(s)}const Zn={}.propertyIsEnumerable;function Qn(t,i){try{return er(t,i,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function tr(t,i,e,s){if(0>=e.remainingNodes)return{stringValue:We};if(e.remainingNodes--,Si(t))return{boolValue:t};if("bigint"==typeof t)return function(t,i){const e=t.toString(),s=BigInt("9223372036854775808");return t>=s||-s>t?(null==i||i.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}(t,i);if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if(typeof BigInt>"u")return{stringValue:String(t)};const e=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==i||i.debug(`Attribute ${e} is outside the int64 range; encoding it as a string`),{stringValue:e}):{intValue:e}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:Ge(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:We};if(t instanceof Date){const i=t.getTime(),e=Number.isFinite(i)?t.toISOString():String(t);return{stringValue:"string"==typeof e?Ge(e):String(e)}}e.ancestors.add(t);try{try{const n=t.toJSON;if("function"==typeof n)return tr(n.call(t),i,e,s+1)}catch(t){}return vi(t)?{arrayValue:{values:ir(t,i,e,s+1)}}:{kvlistValue:{values:er(t,i,e,s+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:Ge(String(t))}}function ir(t,i,e,s){const n=[],r=Math.min(t.length,1e3);let o=0;for(;r>o&&e.remainingNodes>0;o++)try{const r=o in t?t[o]:void 0;if(wi(r))continue;n.push(tr(r,i,e,s))}catch(t){n.push({stringValue:Ve})}return t.length>o&&n.push({stringValue:We}),n}function er(t,i,e,s){const n=[];for(const r in t)if(Zn.call(t,r)){if(!r){null==i||i.debug("Dropping an attribute with an empty key");continue}if(n.length>=1e3||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=t[r];if(bi(o)||_i(o))continue;n.push({key:Ge(r),value:tr(o,i,e,s)})}catch(t){n.push({key:Ge(r),value:{stringValue:Ve}})}}return n}function sr(t,i,e){return as(as(as(as({},Ke({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}const nr=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function rr(t,i){const e=Ke({},t),s={};for(const t of nr)({}).hasOwnProperty.call(e,t)&&(s[t]=e[t],delete e[t]);return[...Qn(e,i),...Qn(s,i)]}const or={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"};const lr={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}},ar=lr.info;function ur(t){try{return Ge(String(t))}catch(t){return Ve}}function hr(t,i,e,s){const n=t.level||"info",{text:r,number:o}=lr[n]||ar,l=function(t=Date.now()){return String(t)+"000000"}($i(s)?s:void 0),a={};i.distinctId&&(a.posthogDistinctId=i.distinctId),i.sessionId&&(a.sessionId=i.sessionId),i.windowId&&(a["window.id"]=i.windowId),wi(i.sessionStartTimestamp)||(a.sessionStartTimestamp=String(i.sessionStartTimestamp)),wi(i.lastActivityTimestamp)||(a.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(a["url.full"]=i.currentUrl),i.screenName&&(a["screen.name"]=i.screenName),i.appState&&(a["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(a.feature_flags=i.activeFeatureFlags);const u=as({},a),h=t.attributes;if(h){let t=[];try{t=Object.keys(h)}catch(i){t=[]}for(const i of t){let t;try{t=h[i]}catch(i){t=Ve}Object.defineProperty(u,i,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const c={timeUnixNano:l,observedTimeUnixNano:l,severityNumber:o,severityText:r,body:{stringValue:ur(t.body)},attributes:Qn(u,e)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),_i(t.trace_flags)||(c.flags=t.trace_flags),c}function cr(t,i,e){return sr(t,i,e)}function dr(t,i,e,s){return{resourceLogs:[{resource:{attributes:rr(i)},scopeLogs:[{scope:{name:e,version:s},logRecords:t}]}]}}var vr=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.cs}arm(t){this.clear(),this.us=Date.now()+t,this.cs=es(()=>{this.cs=void 0,this.ls()},t)}armNoEarlierThan(t){this.cs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.cs&&(clearTimeout(this.cs),this.cs=void 0)}};function fr(){return.75+.5*Math.random()}function pr(t,i,e,s){const n=Math.min(Math.max(0,i-1),6),r=t*Math.pow(2,n);return Math.round((void 0===s?r:Math.min(r,Math.max(s,t)))*e)}var gr=class{constructor(t,i,e,s,n,r=()=>Promise.resolve(),o){var l;this._instance=t,this.Dr=i,this.A=e,this.hs=s,this.ds=n,this.vs=r,this.fs=o,this.ps=new vr(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Je,this.ks=0,this.Ss=1,this.xs=0,this.$s=0,this.Cs=!1,this.Ts=i.maxBufferSize,this.Is=Math.max(null!==(l=i.maxQueueSize)&&void 0!==l?l:i.maxBufferSize,i.maxBufferSize),this.Es=i.flushIntervalMs,this.Ms=i.maxBatchRecordsPerPost,this.As=i.rateCapWindowMs,this.Rs=i.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(ei.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.$s=0,this.Cs=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Ms=this.Dr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.Ps()&&this.Os():this.gs()}captureLog(t,i){var e;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const s=this.Fs(t);if(null===s)return;if(!s.body)return void this.A.info("Log was rejected in beforeSend function");if(!this.Ds())return;const n={record:hr(s,null!==(e=null==i?void 0:i.context)&&void 0!==e?e:this.hs(),this.A,null==i?void 0:i.occurredAtMs)};this.ds(()=>this.Ls(n))}Fs(t){const i=this.Dr.beforeSend;if(!i)return t;const e=vi(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.A.info("Log was rejected in beforeSend function"),null;s=i}catch(t){return this.A.error("Error in beforeSend function for log:",t),null}return s}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),i=t-this.xs;return this.As>i&&i>=0||(this.xs=t,this.$s=0,this.Cs=!1),this.Rs>this.$s?(this.$s++,!0):(this.Cs||(this.A.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.As}ms`),this.Cs=!0),!1)}flush(){var t=this;return Di(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return Di(function*(){var i;t.ps.clear();let e=null!==(i=t._instance.getPersistedProperty(ei.LogsQueue))&&void 0!==i?i:[];if(0===e.length)return;const s=e.length;let n=0;for(;e.length>0&&s>n;){var r,o;const i=t._s;t.bs=0;const s=Math.min(e.length,t.Ms),l=e.slice(0,s),a=dr(l.map(t=>t.record),t.js(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.qs(a);if(t._s!==i)return;if("too-large"===u.kind&&l.length>1)t.Ms=Math.max(1,Math.floor(l.length/2)),t.A.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${t.Ms}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Es,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.A.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Dr.maxBatchRecordsPerPost>t.Ms&&(t.Ms=Math.min(t.Dr.maxBatchRecordsPerPost,t.Ms+1)),yield t.Bs(l.length),e=null!==(o=t._instance.getPersistedProperty(ei.LogsQueue))&&void 0!==o?o:[],n+=l.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var i=this;return Di(function*(){var e;const s=Math.max(0,t-i.bs),n=null!==(e=i._instance.getPersistedProperty(ei.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(ei.LogsQueue,n.slice(s)),yield i.vs()})()}js(){return cr(this.Dr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var i;if(this._instance.optedOut)return;const e=null!==(i=this._instance.getPersistedProperty(ei.LogsQueue))&&void 0!==i?i:[];this.Is>e.length||(e.shift(),this.bs++,this.A.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(ei.LogsQueue,e),this.Ts>e.length||this.ws.isOpen()?this.Os():this.gs()}Os(){this.ps.pending||this.ps.arm(Math.max(this.Es,this.ws.remainingMs()))}zs(){return Math.max(pr(this.Es,this.ks,this.Ss,3e4),this.ws.remainingMs())}Ps(){const t=this._instance.getPersistedProperty(ei.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return Di(function*(){i.ps.clear();const e=i.flush().catch(()=>{});void 0!==t?yield ss(e,t):yield e})()}flushWithTimeout(t){var i=this;return Di(function*(){const e=i.flush();yield ss(e,t,()=>{e.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=fr(),this.A.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.Ps()&&this.ps.armNoEarlierThan(this.zs())})}};const _r=/^[0-9a-f]+$/;function mr(t,i,e){return"string"==typeof t&&t.length===i&&t!==e&&_r.test(t)}const yr=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})(-.*)?$/;const br="00",wr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function $r(t){return String(t)+"000000"}function xr(t,i,e,s){let n="";return s&&(n=Object.keys(s).sort().map(t=>`${JSON.stringify(t)}:${JSON.stringify(s[t])}`).join(",")),`${t}\0${i}\0${null!=e?e:""}\0${n}`}var Sr=class{constructor(t,i,e){this._instance=t,this.Dr=i,this.A=e,this.Hs=new Map,this.ps=new vr(()=>this.flush().catch(t=>{this.A.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new Je,this.ks=0,this.Ss=1,this.Gs=0}count(t,i=1,e){this.Qs({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.Qs({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.Qs({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this;const i=this.ys,e=function(){var e=Di(function*(){i&&(yield i.catch(()=>{})),yield t.Js()});return function(){return e.apply(this,arguments)}}()().finally(()=>{this.ys===e&&(this.ys=null)});return this.ys=e,e}drainWindow(){if(0===this.Hs.size)return null;const t=this.Hs;return this.Hs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Zs(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.Hs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Qs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const i=this.Fs(t);if(null===i)return;if(!i.name||"string"!=typeof i.name)return void this.A.warn("Dropping metric with empty name");if("number"!=typeof i.value||!Number.isFinite(i.value))return void this.A.warn(`Dropping metric '${i.name}': value must be a finite number`);if("count"===i.type&&0>i.value)return void this.A.warn(`Dropping count '${i.name}': counters are monotonic, value must be >= 0`);let e,s;try{e=i.attributes?as({},i.attributes):void 0,s=xr(i.type,i.name,i.unit,e)}catch(t){return void this.A.warn(`Dropping metric '${i.name}': attributes could not be serialized`,t)}let n=this.Hs.get(s);if(!n){if(!this.Ks())return;n={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Hs.set(s,n)}const r=this.Ws.get(i.name);void 0===r?this.Ws.set(i.name,i.type):r===i.type||this.Vs.has(i.name)||(this.Vs.add(i.name),this.A.warn(`Metric name '${i.name}' is already used as a ${r}; recording it as a ${i.type} too will blend both series in charts. Use a distinct name.`)),this.Ys(n,i.value);const o=this.Xs();o&&(n.exemplar=as(as({},o),{},{value:i.value,timeMs:Date.now()})),this.Os()}Xs(){try{var t,i;const e=function(t){const i=function(t){if("string"!=typeof t)return;const i=yr.exec(t.trim());if(!i)return;const[,e,s,n,r,o]=i;return"ff"===e||"00"===e&&o||!function(t){return mr(t,32,"00000000000000000000000000000000")}(s)||!function(t){return mr(t,16,"0000000000000000")}(n)?void 0:{version:e,traceId:s,spanId:n,flags:r}}(t);return i&&{traceId:i.traceId,spanId:i.spanId,flags:(e=i.flags,1&parseInt(e,16)?"01":br)};var e}(null===(t=(i=this._instance).getActiveSpan)||void 0===t||null===(t=t.call(i))||void 0===t?void 0:t.traceparent());if(e&&"01"===e.flags)return{traceId:e.traceId,spanId:e.spanId}}catch(t){}}Ks(){return this.Dr.maxSeriesPerFlush>this.Hs.size||(this.Us||(this.Us=!0,this.A.warn(`Metric series cap reached (${this.Dr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Ys(t,i){switch(t.type){case"count":var e;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(wr.length+1).fill(0)});const e=t.hist;e.count+=1,e.sum+=i,e.min=Math.min(e.min,i),e.max=Math.max(e.max,i),e.bucketCounts[function(t,i){for(let e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,wr)]+=1;break}}}Fs(t){const i=this.Dr.beforeSend;if(!i)return t;const e=vi(i)?i:[i];let s=t;for(const t of e)try{const i=t(s);if(!i)return this.A.info("Metric was rejected in beforeSend function"),null;s=i}catch(t){return this.A.error("Error in beforeSend function for metric:",t),null}return s}Os(){this.ps.pending||this.ps.arm(this.zs())}zs(){return Math.max(pr(this.Dr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Js(){var t=this;return Di(function*(){if(t.ps.clear(),0===t.Hs.size)return;const i=t.Hs;t.Hs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const e=t.Gs,s=yield t._instance.bo(t.Zs(i));if(e===t.Gs)switch(t.ws.record(s),"retry-later"===s.kind?(t.ks++,t.Ss=fr()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.zs()),s.kind){case"ok":return;case"retry-later":return t._o(i),void t.ps.armNoEarlierThan(t.zs());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:",s.error)}})()}Zs(t){return i=this.wo(t),e=function(t,i,e){return sr(t,i,e)}(this.Dr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),n=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:rr(e)},scopeMetrics:[{scope:{name:s,version:n},metrics:i}]}]};var i,e,s,n}wo(t){const i=$r(Date.now()),e=new Map;for(const o of t.values()){var s;const t=xr(o.type,o.name,o.unit,void 0);let l=e.get(t);l||(l=as({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},e.set(t,l));const a=Qn(null!==(s=o.attributes)&&void 0!==s?s:{},this.A),u=$r(o.windowStartMs),h=Er(o.exemplar);if("count"===o.type){var n;const t=as({attributes:a,startTimeUnixNano:u,timeUnixNano:i,asDouble:null!==(n=o.total)&&void 0!==n?n:0},h);l.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t=as({attributes:a,timeUnixNano:i,asDouble:null!==(r=o.last)&&void 0!==r?r:0},h);l.gauge.dataPoints.push(t)}else if(o.hist){const t=as({attributes:a,startTimeUnixNano:u,timeUnixNano:i,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:wr},h);l.histogram.dataPoints.push(t)}}return Array.from(e.values())}_o(t){for(const[n,r]of t){var i;const t=this.Hs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,r.windowStartMs),t.exemplar=null!==(i=t.exemplar)&&void 0!==i?i:r.exemplar,t.type){case"count":var e,s;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(s=r.total)&&void 0!==s?s:0);break;case"gauge":break;case"histogram":if(r.hist)if(t.hist){t.hist.count+=r.hist.count,t.hist.sum+=r.hist.sum,t.hist.min=Math.min(t.hist.min,r.hist.min),t.hist.max=Math.max(t.hist.max,r.hist.max);for(let i=0;t.hist.bucketCounts.length>i;i++)t.hist.bucketCounts[i]+=r.hist.bucketCounts[i]}else t.hist=r.hist}else this.Ks()&&this.Hs.set(n,r)}}};function Er(t){return t?{exemplars:[{filteredAttributes:[],timeUnixNano:$r(t.timeMs),asDouble:t.value,traceId:t.traceId,spanId:t.spanId}]}:{}}const kr=(t,{debugEnabled:e}={})=>{const s={N(s,...n){let r;try{r=typeof window>"u"?void 0:window}catch(t){return}r&&(i.DEBUG||r.POSTHOG_DEBUG||e)&&!_i(r.console)&&r.console&&("__rrweb_original__"in r.console[s]?r.console[s].__rrweb_original__:r.console[s])(t,...n)},debug(...t){s.N("debug",...t)},info(...t){s.N("log",...t)},warn(...t){s.N("warn",...t)},error(...t){s.N("error",...t)},critical(...i){console.error(t,...i)},uninitializedWarning(t){s.error(`You must initialize PostHog before calling ${t}`)},createLogger:(i,e)=>kr(`${t} ${i}`,e)};return s},Tr=kr("[PostHog.js]"),Pr=Tr.createLogger;function Or(t,i){vi(t)&&t.forEach(i)}function Rr(t,i){if(!wi(t))if(vi(t))t.forEach(i);else if((t=>t instanceof FormData)(t))t.forEach((t,e)=>i(t,e));else for(const e in t)ci.call(t,e)&&i(t[e],e)}const Ar=function(t,...i){for(const e of i)for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t};function Cr(t){const i=Object.keys(t);let e=i.length;const s=new Array(e);for(;e--;)s[e]=[i[e],t[i[e]]];return s}const Ir=function(t){return function(...i){try{return t.apply(this,i)}catch(t){Tr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Tr.critical(t)}}},Mr=function(t){const i={};return Rr(t,function(t,e){(mi(t)&&t.length>0||$i(t))&&(i[e]=t)}),i};function Fr(t){const i=as({},t);for(const e of["name","message","stack","cause","errors"])try{e in t&&(i[e]=t[e])}catch(t){}return i}const Dr=["herokuapp.com","vercel.app","netlify.app"];function Nr(t){const i=null==t?void 0:t.hostname;if(!mi(i))return!1;const e=i.split(".").slice(-2).join(".");for(const t of Dr)if(e===t)return!1;return!0}function Lr(t,i,e,s){const{capture:n=!1,passive:r=!0}=null!=s?s:{};null==t||t.addEventListener(i,e,{capture:n,passive:r})}function jr(t){return"ph_toolbar_internal"===t.name}const Ur=t=>{if(Gt){try{const i=t+"=",e=Gt.cookie.split(";").filter(t=>t.length);for(let t=0;e.length>t;t++){let s=e[t];for(;" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}};var Br=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(i,e,s,n){if(!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(s)||!Number.isInteger(n)||0>i||0>e||0>s||0>n||i>0xffffffffffff||e>4095||s>1073741823||n>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=i/Math.pow(2,40),r[1]=i/Math.pow(2,32),r[2]=i/Math.pow(2,24),r[3]=i/Math.pow(2,16),r[4]=i/256,r[5]=i,r[6]=112|e>>>8,r[7]=e,r[8]=128|s>>>24,r[9]=s>>>16,r[10]=s>>>8,r[11]=s,r[12]=n>>>24,r[13]=n>>>16,r[14]=n>>>8,r[15]=n,new t(r)}toString(){let t="";for(let i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new t(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(let i=0;16>i;i++){const e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}},zr=class{generate(){const t=this.generateOrAbort();if(!_i(t))return t;{this.Tt=0;const t=this.generateOrAbort();if(_i(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return $i(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Tt)this.Tt=t,this.It();else{if(this.Tt>=t+1e4)return;this.Mt++,this.Mt>4398046511103&&(this.Tt++,this.It())}return Br.fromFieldsV7(this.Tt,Math.trunc(this.Mt/Math.pow(2,30)),this.Mt&Math.pow(2,30)-1,this.Rt.nextUint32())}It(){this.Mt=1024*this.Rt.nextUint32()+(1023&this.Rt.nextUint32())}constructor(){this.Tt=0,this.Mt=0,this.Rt=new Wr}};const Hr=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};let qr;var Wr=class{nextUint32(){var t;return this.At.length>this.Et||((null!==(t=qr)&&void 0!==t?t:qr="u">typeof window&&!_i(window.crypto)&&crypto.getRandomValues?t=>{try{return crypto.getRandomValues(t)}catch(i){return Hr(t)}}:Hr)(this.At),this.Et=0),this.At[this.Et++]}constructor(){this.At=new Uint32Array(8),this.Et=1/0}};let Vr;const Gr=()=>Kr().toString(),Kr=()=>(Vr||(Vr=new zr)).generate();let Yr="";const Jr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Xr=null;const Zr={Ot(){if(!bi(Xr))return Xr;if(Xr=!1,Gt)try{const t=`__ph_cookie_support_${Gr()}`;Zr.$t(t,"xyz"),Xr='"xyz"'===Ur(t),Zr.Dt(t)}catch(t){Xr=!1}return Xr},Pt(t){Tr.error("cookieStore error: "+t)},Lt:Ur,Ft(t){let i;try{i=JSON.parse(Zr.Lt(t))||{}}catch(t){}return i},$t(t,i,e,s,n){if(!Gt)return!1;try{let r="",o="";const l=function(t,i){if(i){let i=function(t,i=Gt){if(Yr)return Yr;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";const e=t.split(".");let s=Math.min(e.length,8);const n="dmn_chk_"+Gr();for(;!Yr&&s--;){const t=e.slice(s).join("."),r=n+"=1;domain=."+t+";path=/";i.cookie=r+";max-age=3",i.cookie.includes(n)&&(i.cookie=r+";max-age=0",Yr=t)}return Yr}(t);if(!i){const e=(t=>{const i=t.match(Jr);return i?i[0]:""})(t);e!==i&&Tr.info("Warning: cookie subdomain discovery mismatch",e,i),i=e}return i?"; domain=."+i:""}return""}(Gt.location.hostname,s);if(e){const t=new Date;t.setTime(t.getTime()+864e5*e),r="; expires="+t.toUTCString()}n&&(o="; secure");const a=t+"="+encodeURIComponent(JSON.stringify(i))+r+"; SameSite=Lax; path=/"+l+o;return a.length>3686.4&&Tr.warn("cookieStore warning: large cookie, len="+a.length),Gt.cookie=a,!0}catch(t){return!1}},Dt(t,i){if((null==Gt?void 0:Gt.cookie)&&(!i||!bi(Ur(t))))try{Zr.$t(t,"",-1,i)}catch(t){return}}};let Qr=null;const to={Ot(){if(!bi(Qr))return Qr;let t=!0;if(_i(qt))t=!1;else try{const i="__mplssupport__";to.$t(i,"xyz"),'"xyz"'!==to.Lt(i)&&(t=!1),to.Dt(i)}catch(i){t=!1}return t||Tr.error("localStorage unsupported; falling back to cookie store"),Qr=t,t},Pt(t){Tr.error("localStorage error: "+t)},Lt(t){try{return null==qt?void 0:qt.localStorage.getItem(t)}catch(t){to.Pt(t)}return null},Ft(t){try{return JSON.parse(to.Lt(t))||{}}catch(t){}return null},$t(t,i){try{return null==qt||qt.localStorage.setItem(t,JSON.stringify(i)),!0}catch(t){to.Pt(t)}return!1},Dt(t){try{null==qt||qt.localStorage.removeItem(t)}catch(t){to.Pt(t)}}},io=[d,n,h,r,p,a,l,o,v],eo=[O,P,tt,it,wt,bt,M,pt],so=t=>t+"_cpm",no=["__proto__","constructor","prototype"],ro=t=>{if(!pi(t))return{};const i={};return Object.keys(t).forEach(e=>{-1===no.indexOf(e)&&(i[e]=t[e])}),i},oo=(t,i=[])=>{const e={};return[...eo,...i].forEach(i=>{const s=t[i];_i(s)||bi(s)||""===s||(e[i]=s)}),e},lo=t=>{let i=5381,e=2166136261;for(let s=0;t.length>s;s++){const n=t.charCodeAt(s);i=33*i^n,e=Math.imul(e^n,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},ao=(t,i)=>({p:i,f:lo(JSON.stringify(t))}),uo=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{const e=Zr.Ft(so(t)),s=(null==e?void 0:e.f)===lo(i)&&vi(e.p);return{properties:s?e.p:[],isValid:s}}catch(t){return{properties:[],isValid:!1}}},ho=(t,i)=>i+"|"+(Zr.Lt(so(t))||""),co={},vo={Ot:()=>!0,Pt(t){Tr.error("memoryStorage error: "+t)},Lt:t=>t in co?co[t]:null,Ft:t=>t in co?co[t]:null,$t:(t,i)=>(co[t]=i,!0),Dt(t){delete co[t]}};let fo=null;const po={Ot(){if(!bi(fo))return fo;if(fo=!0,_i(qt))fo=!1;else try{const t="__support__";po.$t(t,"xyz"),'"xyz"'!==po.Lt(t)&&(fo=!1),po.Dt(t)}catch(t){fo=!1}return fo},Pt(t){Tr.error("sessionStorage error: ",t)},Lt(t){try{return null==qt?void 0:qt.sessionStorage.getItem(t)}catch(t){po.Pt(t)}return null},Ft(t){try{return JSON.parse(po.Lt(t))||null}catch(t){}return null},$t(t,i){try{return null==qt||qt.sessionStorage.setItem(t,JSON.stringify(i)),!0}catch(t){po.Pt(t)}return!1},Dt(t){try{null==qt||qt.sessionStorage.removeItem(t)}catch(t){po.Pt(t)}}};var go=class{constructor(t){this._instance=t}get Dr(){return this._instance.config}get consent(){return this.Tl()?0:this.Il}isOptedOut(){return"always"===this.Dr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Dr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Dr.opt_out_capturing_by_default}optInOut(t){this.El.$t(this.Ml,t?1:0,this.Dr.cookie_expiration,this.Dr.cross_subdomain_cookie,this.Dr.secure_cookie)}reset(){this.El.Dt(this.Ml,this.Dr.cross_subdomain_cookie)}get Ml(){const{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get Il(){const t=this.El.Lt(this.Ml);return Ii(t)?1:oi(Mi,t)?0:-1}get El(){const t=this.Dr.opt_out_capturing_persistence_type,i="localStorage"===t?to:Zr,e=i.Ot()?i:vo;if(!this.Al||this.Al!==e){this.Al=e;const i="localStorage"===t?Zr:to;i.Lt(this.Ml)&&(this.Al.Lt(this.Ml)||this.optInOut(Ii(i.Lt(this.Ml))),i.Dt(this.Ml,this.Dr.cross_subdomain_cookie))}return this.Al}Tl(){return!!this.Dr.respect_dnt&&[null==Vt?void 0:Vt.doNotTrack,null==Vt?void 0:Vt.msDoNotTrack,ii.doNotTrack,null==Vt?void 0:Vt.globalPrivacyControl].some(t=>Ii(t))}};function _o(t,i){var e;const s=null==t||null===(e=t.config)||void 0===e?void 0:e.get_current_url;if(!fi(s))return i;try{const t=s(i);return mi(t)&&t?t:i}catch(t){return Tr.error("Error in get_current_url, falling back to window.location.href",t),i}}function mo(t){var i;return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!!(null===(i=t.closest)||void 0===i?void 0:i.call(t,".toolbar-global-fade-container")))}function yo(t){return!!t&&1===t.nodeType}function bo(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function wo(t){return!!t&&3===t.nodeType}function $o(t){return!!t&&11===t.nodeType&&yo(t.host)}function xo(t){return t?li(t).split(/\s+/):[]}function So(t,i){const e=function(t){var i;const e=typeof window>"u"?void 0:window,s=null==e||null===(i=e.location)||void 0===i?void 0:i.href;return _i(s)?void 0:_o(t,s)}(i);return!!(e&&t&&t.some(t=>e.match(t)))}function Eo(t){let i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return xo(i)}function ko(t){return wi(t)?null:li(t).split(/(\s+)/).filter(t=>el(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function To(t){let i="";return Go(t)&&!Ko(t)&&t.childNodes&&t.childNodes.length&&Rr(t.childNodes,function(t){var e;wo(t)&&t.textContent&&(i+=null!==(e=ko(t.textContent))&&void 0!==e?e:"")}),li(i)}function Po(t){var i;return _i(t.target)?t.srcElement||null:(null===(i=t.target)||void 0===i?void 0:i.shadowRoot)?t.composedPath()[0]||null:t.target||null}const Oo=["a","button","form","input","select","textarea","label"];function Ro(t,i){const e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}function Ao(t,i){if(_i(i))return!0;for(const e of t)if(i.some(t=>Ro(e,t)))return!0;return!1}function Co(t){const i=t.parentNode;return!(!i||!yo(i))&&i}const Io=[".ph-no-autocapture","[data-ph-no-autocapture]"],Mo=["next","previous","prev",">","<","→","←","›","‹","»","«","▶","◀","❯","❮"],Fo=[...Mo,"+","-","−","–"],Do=Fo.length+10,No=["button","a","input","select","textarea","label"],Lo=["button","link","tab","menuitem","option"],jo=(t,i)=>/[a-z0-9]/i.test(i)?oi(Fo,i)?new RegExp(`\\b${i}\\b`).test(t):t.includes(i):t===i,Uo=t=>oi(No,t.tagName.toLowerCase())||oi(Lo,(t.getAttribute("role")||"").toLowerCase());function Bo(t){let i="",e="";const s=t=>{yo(t)&&Go(t)&&!Ko(t)&&(i+=` ${To(t)}`,e=e||t.getAttribute("aria-label")||"",Rr(t.childNodes,s))};s(t),i=li(i.replace(/\s+/g," "));const n=(el(i)?i:"").toLowerCase(),r=t.getAttribute("aria-label")||(n?"":e);return{safeText:n,ariaLabel:li(r).toLowerCase()}}const zo=[".ph-no-rageclick",".ph-no-capture"],Ho=["","text","search","email","password","url","tel","number"];function qo(t,i){if(!(typeof window>"u"?void 0:window)||Wo(t))return!1;let e,s,n;var r,o;if(Si(i)?(e=!!i&&zo,s=void 0,n=!1):(e=null!==(r=null==i?void 0:i.css_selector_ignorelist)&&void 0!==r?r:zo,s=null==i?void 0:i.content_ignorelist,n=null!==(o=null==i?void 0:i.ignore_text_selection)&&void 0!==o&&o),!1===e)return!1;if(n&&function(t){return!(!t||!yo(t))&&(!!bo(t,"textarea")||(bo(t,"input")?oi(Ho,(t.getAttribute("type")||"").toLowerCase()):function(t){var i;if(t.isContentEditable)return!0;const e=null===(i=t.getAttribute)||void 0===i?void 0:i.call(t,"contenteditable");return"true"===e||""===e}(t)))}(t))return!1;const{targetElementList:l}=Vo(t,!1);return!(s&&function(t,{safeText:i,ariaLabel:e}){let s;if(!0===t)s=Mo;else{if(!vi(t))return!1;if(t.length>Do)return Tr.error(`[PostHog] content_ignorelist array cannot exceed ${Do} items. Use css_selector_ignorelist for more complex matching.`),!1;s=t.map(t=>t.toLowerCase())}return s.some(t=>jo(i,t)||jo(e,t))}(s,function(t,i){for(const t of i)if(Uo(t))return Bo(t);for(const t of i){try{var e;if("pointer"!==(null===(e=window)||void 0===e?void 0:e.getComputedStyle(t).getPropertyValue("cursor")))break}catch(t){break}const i=Bo(t);if(i.safeText||i.ariaLabel)return i}return Bo(t)}(t,l))||Ao(l,e))}const Wo=t=>!t||bo(t,"html")||!yo(t),Vo=(t,i)=>{const e=typeof window>"u"?void 0:window;if(!e||Wo(t))return{parentIsUsefulElement:!1,targetElementList:[]};let s=!1;const n=[t];let r=t;for(;r.parentNode&&!bo(r,"body");){if($o(r.parentNode)){n.push(r.parentNode.host),r=r.parentNode.host;continue}const t=Co(r);if(!t)break;if(i||Oo.indexOf(t.tagName.toLowerCase())>-1)s=!0;else try{const i=e.getComputedStyle(t);i&&"pointer"===i.getPropertyValue("cursor")&&(s=!0)}catch(t){}n.push(t),r=t}return{parentIsUsefulElement:s,targetElementList:n}};function Go(t){const i=new Set;let e=0;for(let s=t;s.parentNode&&!bo(s,"body");s=s.parentNode){if(e++>=1e3||i.has(s))return!1;i.add(s);const t=Eo(s);if(oi(t,"ph-sensitive")||oi(t,"ph-no-capture"))return!1}if(oi(Eo(t),"ph-include"))return!0;const s=t.type||"";if(mi(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}const n=t.name||t.id||"";return!mi(n)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,""))}function Ko(t){return!!(bo(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||bo(t,"select")||bo(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Yo=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}))$"),Jo=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Xo=[16,15,14,13],Zo=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Qo=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),tl=/[0-9A-Za-z_]/;function il(t){let i=0,e=!1;for(let s=t.length-1;s>=0;s--){let n=t.charCodeAt(s)-48;e&&(n*=2,n>9&&(n-=9)),i+=n,e=!e}return i%10==0}function el(t,i=!0){if(wi(t))return!1;if(mi(t)){if(t=li(t),i?Yo.test((t||"").replace(/[- ]/g,"")):function(t){let i;for(Jo.lastIndex=0;i=Jo.exec(t);){const t=i[2];if(!t)continue;const e=t.replace(/[- ]/g,"");for(let t=0;e.length>t;t++)for(const i of Xo){const s=t+i;if(e.length>=s){const i=e.slice(t,s);if(Yo.test(i)&&il(i))return!0}}}return!1}(t))return!1;if(i?Zo.test(t):function(t){let i;for(Qo.lastIndex=0;i=Qo.exec(t);){const t=i[1],e=i[3];if(!(t&&e&&tl.test(t)&&tl.test(e)))return!0}return!1}(t))return!1}return!0}function sl(t){let i=To(t);return i=`${i} ${nl(t)}`.trim(),el(i)?i:""}function nl(t){let i="";return t&&t.childNodes&&t.childNodes.length&&Rr(t.childNodes,function(t){var e;if(t&&"span"===(null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase()))try{const e=To(t);i=`${i} ${e}`.trim(),t.childNodes&&t.childNodes.length&&(i=`${i} ${nl(t)}`.trim())}catch(t){Tr.error("[AutoCapture]",t)}}),i}function rl(t){return t.replace(/"|\\"/g,'\\"')}function ol(t){const i=t.attr__class;if(i)return vi(i)?i:xo(i)}const ll=Pr("[Dead Clicks]"),al=()=>!0,ul=t=>{var i;const e=!!(null===(i=t.instance.persistence)||void 0===i?void 0:i.get_property(H)),s=t.instance.config.capture_dead_clicks;return Si(s)?s:!!pi(s)||e};var hl=class{get lazyLoadedDeadClicksAutocapture(){return this.Rl}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[H]:i.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Pl(()=>{this.Ol()}):this.stop()}Pl(t){var i,e,s;(null===(i=ii.__PosthogExtensions__)||void 0===i?void 0:i.initDeadClicksAutocapture)?t():null===(e=ii.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this.instance,"dead-clicks-autocapture",i=>{i?ll.error("failed to load script",i):t()})}Ol(){var t;if(Gt){if(!this.Rl&&(null===(t=ii.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=pi(this.instance.config.capture_dead_clicks)?as({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Rl=ii.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Rl.start(Gt),ll.info("starting...")}}else ll.error("`document` not found. Cannot start.")}stop(){this.Rl&&(this.Rl.stop(),this.Rl=void 0,ll.info("stopping..."))}};const cl=Pr("[SegmentIntegration]");function dl(t,i,e=!0){const s=t.config.segment;if(!s)return i();const{analytics:n,filterProperties:r}=(t=>fi(t.register))(o=s)?{analytics:o}:o;var o;!function(t,i,e,s){const n=i=>{const n=()=>i.anonymousId()||Gr();t.config.get_device_id=n,s&&i.id()&&(t.register({distinct_id:i.id(),$device_id:n()}),t.persistence.set_property(pt,Nt)),e(s?void 0:i.anonymousId()||void 0)},r=i.user();"then"in r&&fi(r.then)?r.then(n):n(r)}(t,n,e=>{n.register(((t,i,{filterProperties:e}={})=>{"undefined"!=typeof Promise&&Promise.resolve||cl.warn("This browser does not have Promise support, and can not use the segment integration");const s=(s,n)=>{if(!n)return s;const r=!!i&&s.event.anonymousId===i&&!s.event.userId;r||s.event.userId||s.event.anonymousId===t.get_distinct_id()||(cl.info("No userId set, resetting PostHog"),t.reset()),r||(i=void 0),s.event.userId&&s.event.userId!==t.get_distinct_id()&&(cl.info("UserId set, identifying with PostHog"),t.identify(s.event.userId));let o=t.calculateEventProperties(n,s.event.properties);if(!wi(e)){const t=s.event.properties||{},i={};for(const e of Object.keys(o))ci.call(t,e)||(i[e]=o[e]);const n=((t,i)=>{const e=vi(t)?t:[t];let s=as({},i);for(const t of e)try{if(s=t(s),wi(s))return null}catch(t){return cl.error("Error in Segment filterProperties:",t),null}return s})(e,i);if(wi(n))return s;o=n}return s.event.properties=Object.assign({},o,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return s(t,t.event.event)},page(t){return s(t,Ut)},identify(t){return s(t,zt)},screen(t){return s(t,"$screen")}}})(t,e,{filterProperties:r})).then(()=>{i()},t=>{cl.error("Failed to register the Segment integration",t),i()})},e)}const vl="posthog-js";function fl(t,{organization:i,projectId:e,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var l,a,u,h,c;if("*"!==n&&!n.includes(o.level)||!t.__loaded)return o;o.tags||(o.tags={});const d=t.requestRouter.endpointFor("ui",`/project/${t.config.token}/person/${t.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,t.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));const v=(null===(l=o.exception)||void 0===l?void 0:l.values)||[],f=v.map(t=>as(as({},t),{},{stacktrace:t.stacktrace?as(as({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>as(as({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(a=v[0])||void 0===a?void 0:a.value)||o.message,$exception_type:null===(u=v[0])||void 0===u?void 0:u.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:(null===(h=v[0])||void 0===h?void 0:h.value)||o.message,$sentry_exception_type:null===(c=v[0])||void 0===c?void 0:c.type,$sentry_tags:o.tags};var g;return i&&e&&(p.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+e+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var pl=class{constructor(t,i,e,s,n,r){this.name=vl,this.setupOnce=function(o){o(fl(t,{organization:i,projectId:e,prefix:s,severityAllowList:n,sendExceptionsToPostHog:null==r||r}))}}},gl=class{constructor(t){this.Fl=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Tr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Dl=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ll()}Ll(){var t;this.Nl=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.Fl)}destroy(){var t;null===(t=this.Nl)||void 0===t||t.call(this),this.Nl=void 0}doPageView(t,i){var e;const s=this.jl(t,i);return this.Dl={pathname:null!==(e=null==qt?void 0:qt.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.jl(t,null===(i=this.Dl)||void 0===i?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Dl)||void 0===t?void 0:t.pageViewId}}jl(t,i){const e=this.Dl;if(!e)return{$pageview_id:i};let s={$pageview_id:i,$prev_pageview_id:e.pageViewId};const n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:i,maxScrollY:e,maxContentHeight:r,lastContentY:o,maxContentY:l}=n;if(!(_i(t)||_i(i)||_i(e)||_i(r)||_i(o)||_i(l))){t=Math.ceil(t),i=Math.ceil(i),e=Math.ceil(e),r=Math.ceil(r),o=Math.ceil(o),l=Math.ceil(l);const n=t>1?Ui(i/t,0,1,Tr):1,a=t>1?Ui(e/t,0,1,Tr):1,u=r>1?Ui(o/r,0,1,Tr):1,h=r>1?Ui(l/r,0,1,Tr):1;s=Ar(s,{$prev_pageview_last_scroll:i,$prev_pageview_last_scroll_percentage:n,$prev_pageview_max_scroll:e,$prev_pageview_max_scroll_percentage:a,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:l,$prev_pageview_max_content_percentage:h})}}return e.pathname&&(s.$prev_pageview_pathname=e.pathname),e.timestamp&&(s.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),s}};const _l=["flags","surveys"],ml={[T]:{exposure:"hidden"},[A]:{exposure:"hidden"},[C]:{exposure:"hidden"},[N]:{exposure:"hidden"},[M]:{exposure:"hidden"},[D]:{exposure:"hidden"},[y]:{exposure:"event"},[L]:{exposure:"hidden"},[W]:{exposure:"hidden"},[j]:{exposure:"event"},[U]:{exposure:"hidden"},[B]:{exposure:"event"},[z]:{exposure:"event"},[H]:{exposure:"event"},[q]:{exposure:"hidden"},[V]:{exposure:"event"},[G]:{exposure:"hidden"},[K]:{exposure:"hidden"},[tt]:{exposure:"hidden"},[it]:{exposure:"event"},[Y]:{exposure:"event",shouldSkipFromEventProperties:t=>bi(t)},[et]:{exposure:"event"},[st]:{exposure:"event"},[nt]:{exposure:"event"},[rt]:{exposure:"event"},[ot]:{exposure:"hidden"},[h]:{exposure:"hidden",storageGroup:"flags"},[n]:{exposure:"hidden",storageGroup:"flags"},[s]:{exposure:"hidden"},[r]:{exposure:"hidden",storageGroup:"flags"},[p]:{exposure:"hidden",storageGroup:"flags"},[a]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[u]:{exposure:"hidden",storageGroup:"flags"},[g]:{exposure:"hidden"},[_]:{exposure:"hidden"},[d]:{exposure:"hidden"},[c]:{exposure:"hidden"},[b]:{exposure:"hidden",storageGroup:"surveys"},[w]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[S]:{exposure:"event"},[E]:{exposure:"hidden"},[k]:{exposure:"hidden"},[at]:{exposure:"hidden"},[ut]:{exposure:"hidden"},[ht]:{exposure:"hidden"},[ct]:{exposure:"event"},[dt]:{exposure:"event"},[vt]:{exposure:"event"},[ft]:{exposure:"event"},[v]:{exposure:"hidden"},[f]:{exposure:"hidden"},[lt]:{exposure:"event"},[o]:{exposure:"hidden"},[l]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[pt]:{exposure:"hidden"},[gt]:{exposure:"hidden"},[_t]:{exposure:"hidden"},[mt]:{exposure:"hidden"},[yt]:{exposure:"hidden"},[bt]:{exposure:"hidden"},[wt]:{exposure:"hidden"},[J]:{exposure:"event"},[X]:{exposure:"event"},[Z]:{exposure:"event"},[Q]:{exposure:"event"},[St]:{exposure:"event"},[Et]:{exposure:"event"},[kt]:{exposure:"hidden"},[Tt]:{exposure:"hidden"},[Pt]:{exposure:"hidden"},[Ot]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[At]:{exposure:"hidden"},[Ct]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Ft]:{exposure:"event"}},yl=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],bl=t=>{const i=ml[t];if(i)return i;for(const[i,e]of yl)if(0===t.indexOf(i))return e};function wl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}const $l=t=>{const i=typeof document>"u"?void 0:document,e=null==i?void 0:i.createElement("a");return _i(e)?null:(e.href=t,e)},xl=()=>{try{return"u">typeof window&&!1!==window.navigator.onLine}catch(t){return!1}},Sl=(t,i)=>t>=i&&xl(),El=(t,i,e,s)=>{if(0===t){if(xl()){const t=i+1;return t===e&&s(),t}return i}return 0},kl=(t,i)=>{try{let e;return JSON.stringify(t,(t,i)=>{var s;return Oi(i)?(null!==(s=e)&&void 0!==s||(e=new WeakMap),e.has(i)||e.set(i,Fr(i)),e.get(i)):"bigint"==typeof i?i.toString():i},i)}catch(i){return ui(t)}},Tl=function(t,i){const e=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let t=0;e.length>t;t++){const n=e[t].split(/=(.*)/);if(n[0]===i){s=n;break}}if(!vi(s)||2>s.length)return"";{let t=s[1].replace(/\+/g," ");try{t=decodeURIComponent(t)}catch(i){Tr.error("Skipping decoding for malformed query param: "+t)}return t}},Pl=function(t,i,e){if(!t||!i||!i.length)return t;const s=t.split(/#(.*)/),n=s[1],r=(s[0]||"").split(/\?(.*)/),o=r[1],l=r[0],a=(o||"").split("&"),u=[];for(let t=0;a.length>t;t++){const s=a[t].split("?");let n=0;for(;s.length>n&&!i.includes(s[n].split("=")[0]);)n++;u.push(s.length>n?s.slice(0,n).concat(s[n].split("=")[0]+"="+e).join("?"):a[t])}let h=l;return null!=o&&(h+="?"+u.join("&")),null!=n&&(h+="#"+n),h},Ol=function(t,i){const e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Rl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","oppref","bfcid","irclid","_kx"],Al=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Rl],Cl="<masked>",Il=["li_fat_id"];function Ml(t,i,e){if(!Gt)return{};const s=i?[...Rl,...e||[]]:[],n=Fl(Pl(Gt.URL,s,Cl),t),r=function(){const t={};return Rr(Il,function(i){const e=Ur(i);t[i]=e||null}),t}();return Ar(r,n)}function Fl(t,i){const e=Al.concat(i||[]),s={};return Rr(e,function(i){const e=Tl(t,i);s[i]=e||null}),s}function Dl(t){const i=function(t){return t?0===t.search("https?://(.*)google.([^/?]*)")?"google":0===t.search("https?://(.*)bing.com")?"bing":0===t.search("https?://(.*)yahoo.com")?"yahoo":0===t.search("https?://(.*)duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",s={};if(!bi(i)){s.$search_engine=i;const t=Gt?Tl(Gt.referrer,e):"";t.length&&(s.ph_keyword=t)}return s}function Nl(){return navigator.language||navigator.userLanguage}function Ll(){const t=Nl();return"string"==typeof t?t.split("-")[0]:void 0}const jl="$direct";function Ul(){return(null==Gt?void 0:Gt.referrer)||jl}function Bl(t,i,e=!1){const s=t?[...Rl,...i||[]]:[],n=e?ts(null==Kt?void 0:Kt.href):null==Kt?void 0:Kt.href,r=null==n?void 0:n.substring(0,1e3);return{r:Ul().substring(0,1e3),u:r?Pl(r,s,Cl):void 0}}function zl(t,i=!1){var e;const{r:s,u:n}=t,r=i?ts(n):n,o={$referrer:s,$referring_domain:null==s?void 0:s==jl?jl:null===(e=$l(s))||void 0===e?void 0:e.host};if(r){o.$current_url=r;const t=$l(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const i=Fl(r);Ar(o,i)}if(s){const t=Dl(s);Ar(o,t)}return o}function Hl(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const ql={flags:l,surveys:w},Wl=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Vl=t=>`${t}_cookie_identity_change_pending`,Gl=t=>{let i="",e=0;for(const s of t){const t=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(e+t>1e3)break;i+=s,e+=t}return i},Kl="main",Yl=[h,n,r,p,a,l,u,d],Jl=t=>-1!==Yl.indexOf(t),Xl=[M,D],Zl=t=>-1!==Xl.indexOf(t),Ql=(t,i)=>{try{return JSON.stringify(t)===JSON.stringify(i)}catch(e){return t===i}},ta=t=>{if(!t)return{};const i=JSON.parse(t);return pi(i)?i:{}},ia=(t,i)=>{Rr(t,(e,s)=>{const n=bl(s);n&&"event"!==n.exposure||{}.hasOwnProperty.call(i,s)||delete t[s]})};var ea=class{constructor(t,i,e=!0,s=!t.cookieless_mode){if(this.ql={},this.Bl=!1,this.zl=!1,this.Hl=!1,this.Ul=!1,this.Wl=!1,this.Vl=new Map,this.Gl=!1,this.Ql=!1,this.Jl=!1,this.Zl=new Set,this.Kl=new Set,this.Dr=t,this.Yl=e,this.props={},this.Xl=void 0,this.tu=(t=>{let i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.fi=t.disable_persistence||!!i,this.El=this.eu(t),this.Hl=this.iu(t),this.load(s),this.nu(),t.debug&&Tr.info("Persistence loaded",t.persistence,as({},this.props)),this.update_config(t,t,i),this.save(),qt){const t=()=>this.flush();Lr(qt,"beforeunload",t,{capture:!1}),Lr(qt,"pagehide",t,{capture:!1}),this.su=t=>{if(this.Bl&&(!t.storageArea||t.storageArea===(null==qt?void 0:qt.localStorage))&&t.key)if(t.key!==this.tu){if(this.Hl){const i=_l.find(i=>t.key===this.ru(i));i&&this.ou(t.key,i)}}else this.ou(t.key,Kl)},Lr(qt,"storage",this.su)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,i])=>{const e=this.Vl.get(t);if(!Jl(t)||!0===e)return;if(!0===i)return void this.au(t,!0);const s=new Set(e||[]);i.forEach(t=>s.add(t)),s.size&&this.au(t,s)})}onCrossTabFeatureFlagChange(t){return this.Kl.add(t),()=>this.Kl.delete(t)}destroy(){this.su&&qt&&(qt.removeEventListener("storage",this.su),this.su=void 0),this.Kl.clear()}ou(t,i,e=!0){if(this.fi)return!1;let s,n;try{if(n=to.Lt(t),bi(n)){const t=this.lu(i);return t.storageValue=null,i!==Kl&&(t.persisted=!1),!1}s=ta(n)}catch(t){return!1}const r=i===Kl?s:to.Ft(this.tu);if(r&&this.uu(r))return!1;const o=this.cu(s,i,e);return i===Kl&&this.Hl&&!Ql(this.hu().main,s)||this.du(s,i,!0,n),o}uu(t){const i=this.props[P],e=t[P];return!_i(i)&&!_i(e)&&i!==e}du(t,i,e,s){const n=this.lu(i);n.storageValue=s,i!==Kl&&(n.persisted=e);try{n.fingerprint=this.vu(t,i)}catch(t){n.fingerprint=void 0}}cu(t,i,e){let s=!1;return Yl.forEach(e=>{var n;const r=null===(n=bl(e))||void 0===n?void 0:n.storageGroup;if(i===Kl&&this.Hl&&r||i!==Kl&&r!==i)return;const o=e in t,l=this.fu(e,o?t[e]:void 0),a=this.Vl.has(e)?e in this.props:o;a===e in this.props&&Ql(l,this.props[e])||(a?this.pu(e,l,!1):this.gu(e,!1),s=!0)}),s&&e&&this.Kl.forEach(t=>t()),s}mu(){if(!this.Bl)return!1;try{this.Jl=!1;const t=to.Lt(this.tu),i=this.lu(Kl);let e,s=!1,n=!1;if(t!==i.storageValue)if(bi(t))i.storageValue=null;else{if(e=ta(t),this.Jl=!this.Ql&&this.uu(e),this.Jl)return!1;n=this.cu(e,Kl,!1),!this.Hl||Ql(this.hu().main,e)?this.du(e,Kl,!0,t):i.storageValue=t,s=!0}return this.Hl&&_l.forEach(t=>{const i=to.Lt(this.ru(t)),r=this.lu(t),o=e||{},l=s&&Yl.some(i=>{var e;return(null===(e=bl(i))||void 0===e?void 0:e.storageGroup)===t&&i in o});if(i===r.storageValue&&!l)return;if(bi(i))return r.storageValue=null,r.persisted=!1,void(l&&(n=this.cu(o,t,!1)||n));const a=ta(i);n=this.cu(a,t,!1)||n,this.du(a,t,!0,i)}),n}catch(t){return!1}}au(t,i){this.Vl.set(t,i);const e=bl(t);(null==e?void 0:e.volatile)||(this.lu((this.Hl?null==e?void 0:e.storageGroup:void 0)||Kl).fingerprint=void 0,this.yu(t))}bu(){Yl.forEach(t=>this.Vl.set(t,!0))}nu(){if(this.Bl)try{const t=to.Lt(this.tu),i=ta(t);this.lu(Kl).storageValue=t,Yl.forEach(t=>{var e;const s=this.Hl?null===(e=bl(t))||void 0===e?void 0:e.storageGroup:void 0,n=s?to.Lt(this.ru(s)):null;if(s){const t=this.lu(s);t.storageValue=n,t.persisted=!bi(n)}const r=s&&!bi(n)?ta(n):i;t in this.props?this._u(t,r[t],this.props[t]):t in r&&this.au(t,!0)})}catch(t){}}fu(t,i){const e=this.Vl.get(t);if(!e)return i;if(!0===e)return this.props[t];if("$active_feature_flags"===t){const s=new Set(vi(i)?i:[]),n=new Set(vi(this.props[t])?this.props[t]:[]);return e.forEach(t=>n.has(t)?s.add(t):s.delete(t)),Array.from(s)}const s=pi(i)?as({},i):{},n=pi(this.props[t])?this.props[t]:{};return e.forEach(t=>{t in n?s[t]=n[t]:delete s[t]}),s}_u(t,i,e){if(!Jl(t))return;const s=this.Vl.get(t);if(!0===s)return;let n=i;if(this.Bl)try{var r;const i=this.Hl?null===(r=bl(t))||void 0===r?void 0:r.storageGroup:void 0,e=i?this.ru(i):this.tu;n=ta(to.Lt(e))[t]}catch(t){}const o=new Set(s||[]);if("$active_feature_flags"===t){if(!_i(i)&&!vi(i)||!_i(n)&&!vi(n)||!vi(e))return void this.au(t,!0);const s=new Set(i||[]),r=new Set(n||[]),l=new Set(e);new Set([...s,...l]).forEach(t=>{s.has(t)!==l.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===l.has(t)&&o.delete(t)})}else{if(!pi(e))return void(Ql(n,e)?this.Vl.delete(t):this.au(t,!0));{if(!_i(i)&&!pi(i)||_i(i)&&gi(e)&&_i(n))return void this.au(t,!0);const s=pi(i)?i:{},r=pi(n)?n:{};new Set([...Object.keys(s),...Object.keys(e)]).forEach(t=>{t in s==t in e&&Ql(s[t],e[t])||o.add(t)}),o.forEach(t=>{t in r==t in e&&Ql(r[t],e[t])&&o.delete(t)})}}o.size?this.au(t,o):this.Vl.delete(t)}wu(){var t;const i=null===(t=this.Dr)||void 0===t?void 0:t.persistence_save_debounce_ms;return $i(i)&&i>0?i:0}ku(t){if(this.Dr.cookieWinsOnConflict&&"localstorage+cookie"===this.Dr.persistence.toLowerCase())if(t)try{const i=oo(t,this.Dr.cookie_persisted_properties||[]),e=ao(i,this.Dr.cookie_persisted_properties||[]),s=JSON.stringify(i)+"|"+JSON.stringify(e),n=Zr.Lt(this.tu)||void 0;n&&ho(this.tu,n)===s&&(this.Su=s,this.xu=n)}catch(t){}else try{const t=Zr.Lt(this.tu)||void 0;this.Su=t?ho(this.tu,t):void 0,this.xu=t}catch(t){}}syncCookieProperties(){return this.$u(this.Dr)}$u(t,i=!1){if(this.fi&&!i||this.Wl||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let e;try{e=Zr.Lt(this.tu)||void 0}catch(t){}if(!e||e===this.xu)return!1;const s=ho(this.tu,e);let u;try{u=ro(JSON.parse(e))}catch(t){return!1}if((Zr.Lt(this.tu)||void 0)!==e)return!1;this.Su=s,this.xu=e;const f=uo(this.tu,e),g=[...eo,...f.properties],_={};if(Object.keys(u).forEach(t=>{const i=u[t];(_i(i)||bi(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i)&&(_[t]=!0,delete u[t])}),gi(u))return!1;const m="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state,y=this.props,b=y[P],w=y[pt],x=Ar({},y);[...eo,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==g.indexOf(t)&&!(t in u)&&!_[t]&&(m||"distinct_id"!==t&&"$user_state"!==t)){const i=x[t];(f.isValid||-1===eo.indexOf(t)||!1!==i&&0!==i)&&delete x[t]}}),this.props=Ar(x,u),Yl.forEach(t=>{const i=t in this.props;t in y===i&&Ql(y[t],this.props[t])||(i?this._u(t,y[t],this.props[t]):this.au(t,!0))}),!m||"$user_state"in u||"$user_state"in this.props||this.pu(pt,Dt);const S=this.props[P],E=this.props[pt];return!m||S===b&&E===w||(this.Ql=!0,this.Ul=!0,po.$t(Vl(this.tu),!0),this.gu(d),this.gu(n),this.gu(h),this.gu(r),this.gu(p),this.gu(a),this.gu(l),this.gu(o),this.gu(v),"anonymous"!==E||"identified"!==w&&"anonymous"!==u.$user_state&&(_i(b)||S===b)||(ia(this.props,u),this.gu(c)),"identified"===E?this.props.$user_id=S:delete this.props.$user_id,this.gu(A)),!0}consumeCookieIdentityChange(){const t=Vl(this.tu),i=this.Ul||!!po.Lt(t);return this.Ul=!1,i&&po.Dt(t),i}Cu(t=!1){return!(this.Wl||this.fi&&!t||!this.Dr.cookieWinsOnConflict||"localstorage+cookie"!==this.Dr.persistence.toLowerCase()||(this.Wl=!0,0))}Tu(){this.Wl&&(_i(this.Iu)||(clearTimeout(this.Iu),this.Iu=void 0),delete this.ql[Kl],this.Eu(!0))}Mu(t=!0){if(this.Wl)try{t?this.Tu():_i(this.Iu)||(clearTimeout(this.Iu),this.Iu=void 0)}finally{this.Wl=!1}}isDisabled(){return!!this.fi}eu(t){-1===Wl.indexOf(t.persistence.toLowerCase())&&(Tr.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");const i=((t=[],i=!1,e=()=>!1)=>{const s=[...eo,...t];return as(as({},to),{},{Au(t){return[Zr.Lt(t),Zr.Lt(so(t)),to.Lt(t)].join("\0")},Ft(t){try{let r,o={};try{r=Zr.Lt(t)||void 0,o=r?ro(JSON.parse(r)):{}}catch(t){}const l=JSON.parse(to.Lt(t)||"{}");let a;if(i){const i=uo(t,r),e=[...eo,...i.properties],u={};Object.keys(o).forEach(t=>{const i=o[t];bi(i)||""===i||"$user_state"===t&&"anonymous"!==i&&"identified"!==i||(u[t]=i)});const h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var n;const t=l[P],r=null!==(n=l.$user_state)&&void 0!==n?n:Dt;s.forEach(t=>{if(-1!==e.indexOf(t)&&!(t in o)&&(h||"distinct_id"!==t&&"$user_state"!==t)){const e=l[t];(i.isValid||-1===eo.indexOf(t)||!1!==e&&0!==e)&&delete l[t]}}),!h||"$user_state"in o||"$user_state"in l||(l[pt]=Dt),!h||("distinct_id"in u?u[P]:l[P])===t&&("$user_state"in u?u[pt]:l[pt])===r||(io.forEach(t=>delete l[t]),"identified"===u.$user_state&&"distinct_id"in u?l.$user_id=u[P]:delete l.$user_id,"identified"!==u.$user_state&&(delete l[lt],delete l[c]),delete l.__alias)}a=Ar(l,u)}else a=Ar(o,l);return e()||to.$t(t,a),a}catch(t){}return null},$t(e,s,n,r,o,l){const a=to.$t(e,s,void 0,void 0,l);try{const u=oo(s,t);if(Object.keys(u).length){if(i){const i=so(e),h=ao(u,t);if(Zr.$t(i,h,n,r,o,l),Zr.Lt(i)!==JSON.stringify(h)){Zr.Dt(i,r);const t=oo(s);return Zr.$t(e,t,n,r,o,l),a}}Zr.$t(e,u,n,r,o,l)}}catch(t){to.Pt(t)}return a},Dt(t,i){try{null==qt||qt.localStorage.removeItem(t),Zr.Dt(t,i),Zr.Dt(so(t),i)}catch(t){to.Pt(t)}}})})(t.cookie_persisted_properties||[],t.cookieWinsOnConflict,()=>!!this.fi);let e,s=!1,n=!1;const r=t.persistence.toLowerCase();return"localstorage"===r&&to.Ot()?(e=to,n=!0):"localstorage+cookie"===r&&i.Ot()?(e=i,n=!0,s=!0):"sessionstorage"===r&&po.Ot()?e=po:"memory"===r?e=vo:"cookie"===r&&Zr.Ot()?(e=Zr,s=!0):i.Ot()?(e=i,n=!0,s=!0):Zr.Ot()?(e=Zr,s=!0):e=vo,this.Bl=n,this.zl=s,e}ru(t){return`${this.tu}__${t}`}iu(t){return this.Bl&&!!t.split_storage}properties(){const t={};return Rr(this.props,(i,e)=>{const s=bl(e);if(!s||"event"===s.exposure){var n;if(null==s||null===(n=s.shouldSkipFromEventProperties)||void 0===n?void 0:n.call(s,i))return;t[e]=i}}),t}load(t=!1){if(this.fi&&!t)return;const i=this.Dr.cookieWinsOnConflict&&"localstorage+cookie"===this.Dr.persistence.toLowerCase(),e=i?to.Ft(this.tu):null;let s={};if(i)try{s=ro(Zr.Ft(this.tu)),Rr(s,(t,i)=>{(_i(t)||bi(t)||""===t)&&delete s[i]})}catch(t){}const n=this.El.Ft(this.tu);if(n&&(this.props=Ar({},n)),this.Hl&&this.Ru(),i&&n){var r,o;const t=null==e?void 0:e[P],i=null!==(r=null==e?void 0:e.$user_state)&&void 0!==r?r:Dt,l=n[P],a=null!==(o=n.$user_state)&&void 0!==o?o:Dt;if(l!==t||a!==i){this.Ul=!0,this.fi||po.$t(Vl(this.tu),!0);const e=Ar({},this.props);io.forEach(t=>delete e[t]),"anonymous"!==a||"identified"!==i&&"anonymous"!==s.$user_state&&(_i(t)||l===t)||(ia(e,s),delete e[c]),this.props=e;const n=new Set;io.forEach(t=>{var i;const e=null===(i=bl(t))||void 0===i?void 0:i.storageGroup;e&&n.add(e)}),n.forEach(t=>{if(this.fi)return;const i={};Rr(this.props,(e,s)=>{var n;(null===(n=bl(s))||void 0===n?void 0:n.storageGroup)===t&&(i[s]=e)}),gi(i)?(to.Dt(this.ru(t)),this.ql[t]={}):to.$t(this.ru(t),i)&&(this.ql[t]={persisted:!0,fingerprint:this.vu(i,t)})})}}po.Lt(Vl(this.tu))&&(this.Ul=!0)}Ru(){for(const t of _l){const i=to.Ft(this.ru(t));if(i&&!gi(i)){const e=this.lu(t);e.persisted=!0,this.Pu(t)||(e.fingerprint=this.vu(i,t)),this.Ou(t,i)||Ar(this.props,i)}}}Pu(t){return Object.keys(this.props).some(i=>{var e;return(null===(e=bl(i))||void 0===e?void 0:e.storageGroup)===t})}Ou(t,i){const e=ql[t];if(!e)return!1;const s=i[e],n=this.props[e];return $i(s)&&$i(n)&&n>s}refreshKey(t){this.Fu([t])}Fu(t){if(this.fi)return;let i,e=!1;const s=()=>(e||(i=this.El.Ft(this.tu),e=!0),i);t.forEach(t=>{var i;if(this.Zl.has(t))return;const e=this.Hl?null===(i=bl(t))||void 0===i?void 0:i.storageGroup:void 0,n=e?to.Ft(this.ru(e)):s();if(n&&t in n)this.pu(t,n[t],!1);else{if(e){const i=s();if(i&&t in i)return void this.pu(t,i[t],!1)}this.gu(t,!1)}})}refreshMetaIdentifiers(){if(this.fi)return;const t=this.Du();(_i(t)||t!==this.Lu)&&(this.Fu(Xl),this.Nu(t))}Nu(t=this.Du()){this.Lu=0===this.Zl.size?t:void 0}Du(){const t=this.El.Au?this.El.Au(this.tu):this.El.Lt(this.tu);return mi(t)?t:void 0}save(){if(this.fi)return;const t=this.wu();t>0?_i(this.Iu)&&(this.Iu=setTimeout(()=>{this.Iu=void 0,this.Eu()},t)):this.Eu()}flush(){_i(this.Iu)||(clearTimeout(this.Iu),this.Iu=void 0,this.Eu())}Eu(t=!1){if(this.fi||this.Wl&&!t)return;t||(this.syncCookieProperties(),this.Dr.cookieWinsOnConflict&&"localstorage+cookie"===this.Dr.persistence.toLowerCase()||this.refreshMetaIdentifiers());const i=!t&&!this.Gl;i||(this.Jl=!1);const e=!!i&&this.mu();if(this.Jl)return void(this.Dr.debug&&Tr.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Hl)return this.ju(),void(e&&this.Kl.forEach(t=>t()));const s=this.qu(this.El,this.tu,this.props,Kl);"written"===s&&this.ku(this.props),"failed"!==s&&(this.Vl.clear(),this.Ql=!1,this.Zl.clear()),"written"===s&&this.Nu(),e&&this.Kl.forEach(t=>t())}ju(){const{main:t,groups:i}=this.hu(),e=this.qu(this.El,this.tu,t,Kl);"written"===e&&this.ku(t),"failed"!==e&&(this.Ql=!1,this.Zl.clear(),Yl.forEach(t=>{var i;(null===(i=bl(t))||void 0===i?void 0:i.storageGroup)||this.Vl.delete(t)})),"written"===e&&this.Nu();for(const t of _l){var s;const e=i[t];if(gi(e)&&!(null===(s=this.ql[t])||void 0===s?void 0:s.persisted)){Yl.forEach(i=>{var e;(null===(e=bl(i))||void 0===e?void 0:e.storageGroup)===t&&this.Vl.delete(i)});continue}const n=this.qu(to,this.ru(t),e,t);"failed"!==n&&Yl.forEach(i=>{const e=bl(i);(null==e?void 0:e.storageGroup)!==t||"written"!==n&&e.volatile||this.Vl.delete(i)})}}hu(){const t={},i={flags:{},surveys:{}};return Rr(this.props,(e,s)=>{var n;const r=null===(n=bl(s))||void 0===n?void 0:n.storageGroup;r?i[r][s]=e:t[s]=e}),{main:t,groups:i}}vu(t,i){if(i===Kl)return JSON.stringify(t)+"|"+this.Bu+"|"+this.zu+"|"+this.Hu;const e={};return Rr(t,(t,i)=>{var s;e[i]=(null===(s=bl(i))||void 0===s?void 0:s.volatile)?"__volatile__":t}),JSON.stringify(e)}qu(t,i,e,s){const n=this.lu(s);if(s!==Kl&&!n.dirty&&!_i(n.fingerprint))return"skipped";let r;try{if(r=this.vu(e,s),r===n.fingerprint)return n.dirty=!1,"skipped"}catch(t){r=void 0}return t.$t(i,e,this.Bu,this.zu,this.Hu,this.Dr.debug)?(n.dirty=!1,s!==Kl&&(n.persisted=!0),_i(r)||(n.fingerprint=r),this.Bl&&(n.storageValue=to.Lt(i)),"written"):(this.Dr.debug&&Tr.warn(`failed to persist storage entry "${i}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.bu(),_i(this.Iu)||(clearTimeout(this.Iu),this.Iu=void 0),this.El.Dt(this.tu,!1),this.El.Dt(this.tu,!0),!t&&this.Yl)for(const t of _l)to.Dt(this.ru(t));t?delete this.ql[Kl]:this.ql={},this.Su=void 0,this.xu=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(pi(t)){this.syncCookieProperties(),_i(i)&&(i="None"),this.Bu=_i(e)?this.Uu:e;let s=!1;if(Rr(t,(t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.pu(e,t),s=!0)}),s)return this.save(),!0}return!1}register(t,i){if(pi(t)){this.syncCookieProperties(),this.Bu=_i(i)?this.Uu:i;let e=!1;if(Rr(t,(i,s)=>{t.hasOwnProperty(s)&&(this.props[s]!==i||pi(i)||vi(i))&&(this.pu(s,i),e=!0)}),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const i="string"==typeof t?[t]:t;let e=!1;for(const t of i)t in this.props&&(this.gu(t),e=!0);e&&this.save()}update_campaign_params(){const t=null==Gt?void 0:Gt.URL;if(t===this.Xl)return;const i=Ml(this.Dr.custom_campaign_params,this.Dr.mask_personal_data_properties,this.Dr.custom_personal_data_properties),e=!gi(Mr(i));return e&&this.register(i),this.Xl=t,e?i:void 0}update_search_keyword(){this.register(function(){const t=null==Gt?void 0:Gt.referrer;return t?Dl(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Ul(),$referring_domain:(null==Gt?void 0:Gt.referrer)&&(null===(t=$l(Gt.referrer))||void 0===t?void 0:t.host)||jl},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Bl(this.Dr.mask_personal_data_properties,this.Dr.custom_personal_data_properties,this.Dr.disable_capture_url_hashes);this.register_once({[bt]:this.zl?{r:Gl(t.r),u:t.u?Gl(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Rr([yt,mt],i=>{const e=this.props[i];e&&Rr(e,function(i,e){t["$initial_"+ai(e)]=i})});const i=this.props[bt];if(i){const e=function(t,i=!1){const e=zl(t,i),s={};return Rr(e,function(t,i){s[`$initial_${ai(i)}`]=t}),s}(i,this.Dr.disable_capture_url_hashes);Ar(t,e)}return t}safe_merge(t){return Rr(this.props,function(i,e){e in t||(t[e]=i)}),t}update_config(t,i,e){const s=t.persistence!==i.persistence,n=!((t,i)=>{if(t.length!==i.length)return!1;const e=[...t].sort(),s=[...i].sort();return e.every((t,i)=>t===s[i])})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),r=s||n,o=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,l=t.disable_persistence||!!e,a=!!this.fi&&!l;l||this.$u(i,a),this.Dr=t,!l&&(s||n||o)&&(this.Su=void 0,this.xu=void 0,this.$u(as(as({},t),{},{cookie_persisted_properties:i.cookie_persisted_properties}),a));const u=r||o?this.eu(t):this.El;this.Wu();const h=this.iu(t),c=r||h!==this.Hl,d=!l&&(c||t.cross_subdomain_cookie!==this.zu||t.secure_cookie!==this.Hu)&&this.Cu(a);this.Gl=c;try{if(this.Uu=this.Bu=t.cookie_expiration,this.set_disabled(l),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.El=u,this.Hl=h,this.props=t,this.save()}else o&&(this.El=u,l||(delete this.ql[Kl],this.Eu()))}finally{this.Gl=!1,d&&this.Mu()}}Wu(){const t=this.props[bt];if(!this.zl||!pi(t)||"string"!=typeof t.r)return;const i=Gl(t.r),e="string"==typeof t.u?Gl(t.u):t.u;i===t.r&&e===t.u||this.pu(bt,as(as({},t),{},{r:i,u:e}))}set_disabled(t){this.fi=t,this.fi?this.remove():this.save()}set_cross_subdomain(t){t!==this.zu&&(this.zu=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Hu&&(this.Hu=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){const e=this.props.__timers||{};e[t]=i,this.pu(N,e),this.save()}remove_event_timer(t){const i=this.props.__timers||{},e=i[t];return _i(e)||(delete i[t],this.pu(N,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.pu(t,i),this.save()}pu(t,i,e=!0){var s;const n=this.props[t];this.props[t]=i,e&&("distinct_id"!==t&&"$user_state"!==t||n===i||(this.Ql=!0),Zl(t)&&!Ql(n,i)&&this.Zl.add(t),this._u(t,n,i),(null===(s=bl(t))||void 0===s?void 0:s.volatile)||this.yu(t))}gu(t,i=!0){delete this.props[t],i&&(Jl(t)&&this.au(t,!0),Zl(t)&&this.Zl.add(t),this.yu(t))}yu(t){var i;const e=null===(i=bl(t))||void 0===i?void 0:i.storageGroup;e&&(this.lu(e).dirty=!0)}lu(t){return this.ql[t]||(this.ql[t]={})}};const sa={GZipJS:"gzip-js",Base64:"base64"},na={Activation:"events",Cancellation:"cancelEvents"},ra={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},oa={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},la={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"},aa={Popover:"popover",Inline:"inline"};function ua(t){let i=!0;return{dispose(){if(i){i=!1;const e=t();e&&fi(e.then)&&e.then(void 0,()=>{})}}}}const ha={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"},ca={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"},da=Pr("[RateLimiter]");var va=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(t=>{da.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void da.warn(`could not rate limit - continuing. Error: "${null==t?void 0:t.message}"`,{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null===(t=this.instance.config.rate_limiting)||void 0===t?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t=!1){var i,e,s;const{captureEventsBurstLimit:n,captureEventsPerSecond:r}=this,o=(new Date).getTime(),l=null!==(i=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_property("$capture_rate_limit"))&&void 0!==i?i:{tokens:n,last:o};l.tokens+=Math.max(0,o-l.last)/1e3*r,l.last=Math.max(l.last,o),l.tokens>n&&(l.tokens=n);const a=1>l.tokens;if(a||t||(l.tokens=Math.max(0,l.tokens-1)),a&&!t){const t=($i(l.dropped)?l.dropped:0)+1;l.dropped=t,!this.lastEventRateLimited&&this.Vu(t)&&(l.dropped=0)}return this.lastEventRateLimited=a,null===(s=this.instance.persistence)||void 0===s||s.set_property("$capture_rate_limit",l),{isRateLimited:a,remainingTokens:l.tokens}}Gu(t){const i=this.instance.config.property_denylist;return!vi(i)||!i.includes(t)}Qu(){var t;if(this.Gu("$current_url")&&this.Gu("$pathname")&&(null==Kt?void 0:Kt.pathname))return`${null!==(t=Kt.origin)&&void 0!==t?t:""}${Kt.pathname}`}Vu(t){var i,e;const{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,r=this.Qu(),o=this.Gu("$session_id")?null===(i=(e=this.instance).get_session_id)||void 0===i?void 0:i.call(e):void 0,l=[`${t} event(s) dropped since the last warning`,r?`triggered on ${r}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${l}. Config is set to ${n} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}};const fa=Pr("[RemoteConfig]");var pa=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=ii._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}Ju(t){var i,e,s;(null===(i=ii.__PosthogExtensions__)||void 0===i?void 0:i.loadExternalDependency)?null===(e=ii.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}Zu(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 fa.info("Using preloaded remote config",this.remoteConfig),void this.Ku(this.remoteConfig);if(this._instance.Yu())return void fa.warn("Remote config is disabled. Falling back to local config.");this.Ju(t=>{if(!t)return fa.info("No config found after loading remote JS config. Falling back to JSON."),void this.Zu(t=>{this.Ku(t.json,t)});this.Ku(t)})}catch(t){fa.error("Error loading remote config",t),this.Ku()}}Ku(t,i){!t&&i&&(0===i.statusCode?i.error||fa.warn("Failed to fetch remote config from PostHog."):fa.error("Failed to fetch remote config from PostHog."));try{this._instance.Ku(t?{ok:!0,config:t}:{ok:!1})}catch(t){fa.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null===(e=this._instance.featureFlags)||void 0===e||e.ensureFlagsLoaded()}catch(t){fa.error("Error loading feature flags",t)}}},ga=Uint8Array,_a=Uint16Array,ma=Uint32Array,ya=new ga([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]),ba=new ga([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]),wa=new ga([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$a=function(t,i){for(var e=new _a(31),s=0;31>s;++s)e[s]=i+=1<<t[s-1];var n=new ma(e[30]);for(s=1;30>s;++s)for(var r=e[s];e[s+1]>r;++r)n[r]=r-e[s]<<5|s;return[e,n]},xa=$a(ya,2),Sa=xa[1];xa[0][28]=258,Sa[258]=28;for(var Ea=$a(ba,0)[1],ka=new _a(32768),Ta=0;32768>Ta;++Ta){var Pa=(43690&Ta)>>>1|(21845&Ta)<<1;ka[Ta]=((65280&(Pa=(61680&(Pa=(52428&Pa)>>>2|(13107&Pa)<<2))>>>4|(3855&Pa)<<4))>>>8|(255&Pa)<<8)>>>1}var Oa=function(t,i,e){for(var s=t.length,n=0,r=new _a(i);s>n;++n)++r[t[n]-1];var o,l=new _a(i);for(n=0;i>n;++n)l[n]=l[n-1]+r[n-1]<<1;if(e){o=new _a(1<<i);var a=15-i;for(n=0;s>n;++n)if(t[n])for(var u=n<<4|t[n],h=i-t[n],c=l[t[n]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[ka[c]>>>a]=u}else for(o=new _a(s),n=0;s>n;++n)o[n]=ka[l[t[n]-1]++]>>>15-t[n];return o},Ra=new ga(288);for(Ta=0;144>Ta;++Ta)Ra[Ta]=8;for(Ta=144;256>Ta;++Ta)Ra[Ta]=9;for(Ta=256;280>Ta;++Ta)Ra[Ta]=7;for(Ta=280;288>Ta;++Ta)Ra[Ta]=8;var Aa=new ga(32);for(Ta=0;32>Ta;++Ta)Aa[Ta]=5;var Ca=Oa(Ra,9,0),Ia=Oa(Aa,5,0),Ma=function(t){return(t/8|0)+(7&t&&1)},Fa=function(t,i,e){(null==i||0>i)&&(i=0),(null==e||e>t.length)&&(e=t.length);var s=new(t instanceof _a?_a:t instanceof ma?ma:ga)(e-i);return s.set(t.subarray(i,e)),s},Da=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8},Na=function(t,i,e){var s=i/8|0;t[s]|=e<<=7&i,t[s+1]|=e>>>8,t[s+2]|=e>>>16},La=function(t,i){for(var e=[],s=0;t.length>s;++s)t[s]&&e.push({s:s,f:t[s]});var n=e.length,r=e.slice();if(!n)return[new ga(0),0];if(1==n){var o=new ga(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort(function(t,i){return t.f-i.f}),e.push({s:-1,f:25001});var l=e[0],a=e[1],u=0,h=1,c=2;for(e[0]={s:-1,f:l.f+a.f,l:l,r:a};h!=n-1;)l=e[e[c].f>e[u].f?u++:c++],a=e[u!=h&&e[c].f>e[u].f?u++:c++],e[h++]={s:-1,f:l.f+a.f,l:l,r:a};var d=r[0].s;for(s=1;n>s;++s)r[s].s>d&&(d=r[s].s);var v=new _a(d+1),f=ja(e[h-1],v,0);if(f>i){s=0;var p=0,g=f-i,_=1<<g;for(r.sort(function(t,i){return v[i.s]-v[t.s]||t.f-i.f});n>s;++s){var m=r[s].s;if(i>=v[m])break;p+=_-(1<<f-v[m]),v[m]=i}for(p>>>=g;p>0;){var y=r[s].s;i>v[y]?p-=1<<i-v[y]++-1:++s}for(;s>=0&&p;--s){var b=r[s].s;v[b]==i&&(--v[b],++p)}f=i}return[new ga(v),f]},ja=function(t,i,e){return-1==t.s?Math.max(ja(t.l,i,e+1),ja(t.r,i,e+1)):i[t.s]=e},Ua=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new _a(++i),s=0,n=t[0],r=1,o=function(t){e[s++]=t},l=1;i>=l;++l)if(t[l]==n&&l!=i)++r;else{if(!n&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(n),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(n);r=1,n=t[l]}return[e.subarray(0,s),i]},Ba=function(t,i){for(var e=0,s=0;i.length>s;++s)e+=t[s]*i[s];return e},za=function(t,i,e){var s=e.length,n=Ma(i+2);t[n]=255&s,t[n+1]=s>>>8,t[n+2]=255^t[n],t[n+3]=255^t[n+1];for(var r=0;s>r;++r)t[n+r+4]=e[r];return 8*(n+4+s)},Ha=function(t,i,e,s,n,r,o,l,a,u,h){Da(i,h++,e),++n[256];for(var c=La(n,15),d=c[0],v=c[1],f=La(r,15),p=f[0],g=f[1],_=Ua(d),m=_[0],y=_[1],b=Ua(p),w=b[0],x=b[1],S=new _a(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;w.length>E;++E)S[31&w[E]]++;for(var k=La(S,7),T=k[0],P=k[1],O=19;O>4&&!T[wa[O-1]];--O);var R,A,C,I,M=u+5<<3,F=Ba(n,Ra)+Ba(r,Aa)+o,D=Ba(n,d)+Ba(r,p)+o+14+3*O+Ba(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(F>=M&&D>=M)return za(i,h,t.subarray(a,a+u));if(Da(i,h,1+(F>D)),h+=2,F>D){R=Oa(d,v,0),A=d,C=Oa(p,g,0),I=p;var N=Oa(T,P,0);for(Da(i,h,y-257),Da(i,h+5,x-1),Da(i,h+10,O-4),h+=14,E=0;O>E;++E)Da(i,h+3*E,T[wa[E]]);h+=3*O;for(var L=[m,w],j=0;2>j;++j){var U=L[j];for(E=0;U.length>E;++E)Da(i,h,N[B=31&U[E]]),h+=T[B],B>15&&(Da(i,h,U[E]>>>5&127),h+=U[E]>>>12)}}else R=Ca,A=Ra,C=Ia,I=Aa;for(E=0;l>E;++E)if(s[E]>255){var B;Na(i,h,R[257+(B=s[E]>>>18&31)]),h+=A[B+257],B>7&&(Da(i,h,s[E]>>>23&31),h+=ya[B]);var z=31&s[E];Na(i,h,C[z]),h+=I[z],z>3&&(Na(i,h,s[E]>>>5&8191),h+=ba[z])}else Na(i,h,R[s[E]]),h+=A[s[E]];return Na(i,h,R[256]),h+A[256]},qa=new ma([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Wa=new ga(0),Va=function(){for(var t=new ma(256),i=0;256>i;++i){for(var e=i,s=9;--s;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),Ga=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,s=0;i.length>s;++s)e=Va[255&e^i[s]]^e>>>8;t=e},d(){return 4294967295^t}}}(),s=t.length;e.p(t);var n,r,o,l,a,u,h=(l=10+((n=i).filename&&n.filename.length+1||0),a=8,function(t,i,e,s,n,r){var o=t.length,l=new ga(s+o+5*(1+Math.floor(o/7e3))+n),a=l.subarray(s,l.length-n),u=0;if(!i||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=za(a,u,t.subarray(h,c)):(a[h]=r,u=za(a,u,t.subarray(h,o)))}else{for(var d=qa[i-1],v=d>>>13,f=8191&d,p=(1<<e)-1,g=new _a(32768),_=new _a(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new ma(25e3),x=new _a(288),S=new _a(32),E=0,k=0,T=(h=0,0),P=0,O=0;o>h;++h){var R=b(h),A=32767&h,C=_[R];if(g[A]=C,_[R]=A,h>=P){var I=o-h;if((E>7e3||T>24576)&&I>423){u=Ha(t,a,0,w,x,S,k,T,O,h-O,u),T=E=k=0,O=h;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var F=2,D=0,N=f,L=A-C&32767;if(I>2&&R==b(h-L))for(var j=Math.min(v,I)-1,U=Math.min(32767,h),B=Math.min(258,I);U>=L&&--N&&A!=C;){if(t[h+F]==t[h+F-L]){for(var z=0;B>z&&t[h+z]==t[h+z-L];++z);if(z>F){if(F=z,D=L,z>j)break;var H=Math.min(L,z-2),q=0;for(M=0;H>M;++M){var W=h-L+M+32768&32767,V=W-g[W]+32768&32767;V>q&&(q=V,C=W)}}}L+=(A=C)-(C=g[A])+32768&32767}if(D){w[T++]=268435456|Sa[F]<<18|Ea[D];var G=31&Sa[F],K=31&Ea[D];k+=ya[G]+ba[K],++x[257+G],++S[K],P=h+F,++E}else w[T++]=t[h],++x[t[h]]}}u=Ha(t,a,r,w,x,S,k,T,O,h-O,u),r||(u=za(a,u,Wa))}return Fa(l,0,s+Ma(u)+n)}(r=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(r.length)))):12+o.mem,l,a,!u)),c=h.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&Ga(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var s=0;e.length>=s;++s)t[s+10]=e.charCodeAt(s)}}(h,i),Ga(h,c-8,e.d()),Ga(h,c-4,s),h}const Ya=!!Jt||!!Yt,Ja=new WeakMap,Xa="text/plain";let Za=0,Qa=!1;const tu=(t,i)=>{const[e,s]=t.split("#"),[n,r]=e.split("?");if(!r)return t;const o=r.split("&").filter(t=>t.split("=")[0]!==i).join("&");return`${n}${o?`?${o}`:""}${s?`#${s}`:""}`},iu=(t,i,e=!0)=>{var s;const[n,r]=t.split("?"),o=as({},i),l=null!==(s=null==r?void 0:r.split("&").map(t=>{var i;const[s,n]=t.split("="),r=e&&null!==(i=o[s])&&void 0!==i?i:n;return delete o[s],`${s}=${r}`}))&&void 0!==s?s:[],a=function(t,i="&"){let e,s;const n=[];return Rr(t,function(t,i){_i(t)||_i(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),s=encodeURIComponent(i),n[n.length]=s+"="+e)}),n.join(i)}(o);return a&&l.push(a),l.length>0?`${n}?${l.join("&")}`:n},eu=t=>{if(t.cr)return t.cr;const{data:i,compression:e}=t;if(!i)return;if(e===sa.GZipJS){const t=Ka(function(t){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var e=new ga(t.length+(t.length>>>1)),s=0,n=function(t){e[s++]=t},r=0;i>r;++r){if(s+5>e.length){var o=new ga(s+8+(i-r<<1));o.set(e),e=o}var l=t.charCodeAt(r);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++r))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Fa(e,0,s)}(kl(i)),{mtime:0});return{contentType:Xa,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(e===sa.Base64){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,i)=>String.fromCharCode(parseInt(i,16)))):t}(kl(i)),e=(t=>"data="+encodeURIComponent("string"==typeof t?t:kl(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:e,estimatedSize:new Blob([e]).size}}const s=kl(i);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},su=t=>{const i=()=>"sendBeacon"===t.transport?{url:iu(t.url,{compression:sa.Base64}),encodedBody:eu(as(as({},t),{},{compression:sa.Base64,cr:void 0}))}:{url:tu(t.url,"compression"),encodedBody:eu(as(as({},t),{},{compression:void 0,cr:void 0}))};let e;try{e=eu(t)}catch(e){if(ln(t.compression,Tl(t.url,"compression")))return Tr.error("Failed to gzip request body, sending uncompressed payload",e),i();throw e}return e&&ln(t.compression,Tl(t.url,"compression"))&&!((s=e.body)instanceof ArrayBuffer?on(new Uint8Array(s)):ArrayBuffer.isView(s)&&on(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(Qa=!0,i()):{url:t.url,encodedBody:e};var s},nu=t=>{try{return su(t)}catch(e){var i;return Tr.error(e),void(null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))}},ru=function(){var t=Di(function*(t){const i=yield function(t){return dn.apply(this,arguments)}(kl(t.data),e.DEBUG,{rethrow:!0});if(!i)return t;const s=yield i.arrayBuffer();return as(as({},t),{},{cr:{contentType:Xa,body:s,estimatedSize:s.byteLength}})});return function(i){return t.apply(this,arguments)}}(),ou=/Failed to fetch|NetworkError|Load failed/i,lu=t=>"TypeError"===(null==t?void 0:t.name)&&ou.test((null==t?void 0:t.message)||""),au=t=>{try{const i=function(t,i=Date.now(),e=3e5){if("string"!=typeof t||!t)return;const s=t.trim(),n=/^\d+\s*,/.test(s)?s.slice(0,s.indexOf(",")).trim():s;if(/^\d+$/.test(n)){const t=1e3*Math.min(Number(n),e/1e3);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const r=/^\w{3} \w{3} /.test(n)?n+" GMT":n,o=Date.parse(r)-i;return Number.isFinite(o)&&o>0?Math.min(o,e):void 0}(t());return _i(i)?void 0:Math.min(i,3e4)}catch(t){return}},uu=t=>{const i=nu(t);if(!i)return;const e=new Jt;Ja.set(e,!0);const{url:s,encodedBody:n}=i;e.open(t.method||"GET",s,!0);const{contentType:r,body:o}=null!=n?n:{};Rr(t.headers,function(t,i){e.setRequestHeader(i,t)}),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i;const s={statusCode:e.status,text:e.responseText};if(200===e.status)try{s.json=JSON.parse(e.responseText)}catch(t){}null===(i=t.callback)||void 0===i||i.call(t,s,au(()=>e.getResponseHeader("Retry-After")))}},e.send(o)},hu=t=>{const i=nu(t);if(!i)return;const{url:e,encodedBody:s}=i,{contentType:n,body:r,estimatedSize:o}=null!=s?s:{},l=new Headers;Rr(t.headers,function(t,i){l.append(i,t)}),n&&l.append("Content-Type",n);let a=null,u=!1;if(Xt){const i=new Xt;a={signal:i.signal,timeout:setTimeout(()=>{u=!0;try{i.abort(Qe("AbortError","PostHog request timed out"+((e=t.timeout)?` after ${e}ms`:"")))}catch(t){c(t)}var e},t.timeout)}}let h=!1;const c=i=>{var e;h||(h=!0,u&&"AbortError"===(null==i?void 0:i.name)||lu(i)?Tr.warn(i):Tr.error(i),null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))};let d=0;const v=()=>{Za-=d,d=0,a&&clearTimeout(a.timeout)};try{const i=as({method:(null==t?void 0:t.method)||"GET",headers:l,referrerPolicy:"strict-origin",body:r,signal:null==a?void 0:a.signal},t.fetchOptions),s=null!=o?o:_i(r)?0:void 0;i.keepalive="POST"===i.method&&!t.Cl&&!1!==i.keepalive&&i.body===r&&!_i(s)&&s>=0&&52428.8>Za+s,i.keepalive&&(d=s,Za+=d),Yt(e,i).then(i=>i.text().then(e=>{var s;if(h)return;const n={statusCode:i.status,text:e};if(200===i.status)try{n.json=JSON.parse(e)}catch(t){Tr.error(t)}h=!0,v(),null===(s=t.callback)||void 0===s||s.call(t,n,au(()=>i.headers.get("Retry-After")))})).catch(t=>{v(),c(t)}).finally(v)}catch(t){v(),c(t)}},cu=t=>{try{var i;const{url:e,encodedBody:s}=su(t),{contentType:n,body:r,estimatedSize:o}=null!=s?s:{};if(!r)return;const l=r instanceof Blob?r:new Blob([r],{type:n});if(Vt.sendBeacon(e,l))return;const a=vi(t.data)?t.data:null===(i=t.data)||void 0===i?void 0:i.batch;if(vi(a)&&a.length>1&&(null!=o?o:0)>16384){const i=Math.ceil(a.length/2),e=i=>vi(t.data)?i:as(as({},t.data),{},{batch:i});return cu(as(as({},t),{},{data:e(a.slice(0,i))})),void cu(as(as({},t),{},{data:e(a.slice(i))}))}Tr.warn(`Beacon of ~${null!=o?o:0} bytes was rejected by the browser, falling back to ${Yt?"fetch":"XHR"}`),Yt?hu(as(as({},t),{},{Cl:!0})):uu(t)}catch(t){Tr.warn("Beacon send failed",t)}},du=(t,i,e,s)=>{const n="query"===s?"POST"===i?"sent_at":"_":void 0;return iu(e===sa.GZipJS?tu(t,"compression"):t,as(as({},n?{[n]:Date.now().toString()}:{}),e===sa.GZipJS?{}:{compression:e}))},vu=(()=>{const t=[];return Yt&&t.push({transport:"fetch",method:hu}),Jt&&t.push({transport:"XHR",method:uu}),(null==Vt?void 0:Vt.sendBeacon)&&t.push({transport:"sendBeacon",method:cu}),t})();let fu=!Ya&&-1===(null==Qt?void 0:Qt.indexOf("MSIE"))&&-1===(null==Qt?void 0:Qt.indexOf("Mozilla"));function pu(t,i,e){var s,n,r;e&&(i=as(as({},i),{},{callback:t=>e(t)})),t.__loaded?fu?t.__request_queue.push(i):t.rateLimiter.isServerRateLimited(i.batchKey)?i.fireCallbackOnDrop&&(null===(n=i.callback)||void 0===n||n.call(i,{statusCode:429})):(i.transport=i.transport||t.config.api_transport,i.headers=as(as({},t.config.request_headers),i.headers),i.compression="best-available"===i.compression?null!==(s=t.compression)&&void 0!==s?s:i.compressionFallback:i.compression,(_i(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(i.disableTransport=["sendBeacon"]),i.fetchOptions=i.fetchOptions||t.config.fetch_options,((t,i)=>{var e,s,n;const r=as(as({},t),{},{callback:null!=i?i:i=>{var e;return null===(e=t.callback)||void 0===e?void 0:e.call(t,i)}});r.timeout=r.timeout||6e4;const o=null!==(e=r.transport)&&void 0!==e?e:"fetch";"sendBeacon"===o&&_i(r.compression)&&r.data&&(r.compression=sa.Base64),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(t=>{var i,e;const s=(vi(t)?t:[t]).map(t=>as(as({},t),t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})),n=s[0];return{api_key:null!==(i=null==n||null===(e=n.properties)||void 0===e?void 0:e.token)&&void 0!==i?i:null==n?void 0:n.token,batch:s,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((t,i=(new Date).toISOString())=>vi(t)?t.map(t=>as(as({},t),{},{sent_at:i})):as(as({},t),{},{sent_at:i}))(r.data))),r.url=du(r.url,r.method,r.compression,r.timestampMode);const l=vu.filter(t=>!r.disableTransport||!t.transport||!r.disableTransport.includes(t.transport)),a=null!==(s=null===(n=function(t,i){for(let e=0;t.length>e;e++)if(i(t[e]))return t[e]}(l,t=>t.transport===o))||void 0===n?void 0:n.method)&&void 0!==s?s:l[0].method;if(!a)throw new Error("No available transport method");const u=t=>{try{a(t)}catch(t){var i;lu(t)?Tr.warn(t):Tr.error(t),null===(i=r.callback)||void 0===i||i.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===sa.GZipJS&&Zt&&"undefined"!=typeof Promise&&!Qa?ru(r).then(t=>{u(t)}).catch(i=>{if(an(i))return Qa=!0,void u(as(as({},r),{},{compression:void 0,url:du(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;const i="name"in t?String(t.name):"";return an(t)||i===rn})(i)&&(Qa=!0),u(r)}):u(r)})(i,(s,n)=>{var r,o,l;t.rateLimiter.checkForLimiting(s),400>s.statusCode||null===(r=(o=t.config).on_request_error)||void 0===r||r.call(o,s),e?e(s,n):null===(l=i.callback)||void 0===l||l.call(i,s)})):i.fireCallbackOnDrop&&(null===(r=i.callback)||void 0===r||r.call(i,{statusCode:0}))}var gu=class{constructor(t,i){this.Xu=!0,this.tc=[],this.ec=Ui((null==i?void 0:i.flush_interval_ms)||3e3,250,5e3,Tr.createLogger("flush interval"),3e3),this.nc=t}enqueue(t){this.tc.push(t),this.sc||this.rc()}unload(){this.oc();const t=this.tc.length>0?this.ac():{},i=Object.values(t);[...i.filter(t=>0===t.url.indexOf("/e")),...i.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.lc(as(as({},t),{},{callback:void 0}),"sendBeacon")})}enable(){this.Xu=!1,this.rc()}rc(){this.Xu||(this.sc=setTimeout(()=>{this.oc(),this.uc()},this.ec))}uc(){if(this.tc.length>0){const t=this.ac();for(const i in t)this.lc(t[i])}}lc(t,i){try{this.nc(t,i)}catch(t){Tr.error(t)}}oc(){clearTimeout(this.sc),this.sc=void 0}ac(){const t={},i={};Rr(this.tc,e=>{var s;const n=e,r=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");_i(t[r])&&(t[r]=as(as({},n),{},{data:[],callback:void 0,fireCallbackOnDrop:void 0}),i[r]=[]),null===(s=t[r].data)||void 0===s||s.push(n.data),n.callback&&i[r].push(n.callback)});for(const e in i){const s=i[e];s.length&&(t[e].callback=t=>{for(const i of s)i(t)})}return this.tc=[],t}};const _u=["retriesPerformedSoFar"];var mu=class{constructor(t){this._instance=t,this.cc=!1,this.hc=3e3,this.tc=[],this.tc=[],this.dc=!0,this.resume()}resume(){if(!_i(qt)&&"onLine"in qt.navigator){if(this.dc=qt.navigator.onLine,this.vc)return;this.vc=()=>{this.dc=!0,this.uc()},this.fc=()=>{this.dc=!1},Lr(qt,"online",this.vc),Lr(qt,"offline",this.fc)}}get length(){return this.tc.length}retriableRequest(t,i){let{retriesPerformedSoFar:e}=t,s=vn(t,_u);xi(e)&&(s.url=iu(s.url,{retry_count:e})),pu(this._instance,i?as(as({},s),{},{transport:i}):s,(t,i)=>{var n;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.Ls(as({retriesPerformedSoFar:e},s),i);0===t.statusCode&&Tr.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${null!=e?e:0} retries.`)}null===(n=s.callback)||void 0===n||n.call(s,t)})}Ls(t,i){const e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;const s=Math.max(function(t){const i=3e3*Math.pow(2,t),e=i/2,s=Math.min(18e5,i),n=(Math.random()-.5)*(s-e);return Math.ceil(s+n)}(e),null!=i?i:0),n=Date.now()+s;this.tc.push({retryAt:n,requestOptions:t});let r=`Enqueued failed request for retry in ${s}`;navigator.onLine||(r+=" (Browser is offline)"),Tr.warn(r),this.cc||(this.cc=!0,this.gc())}gc(){if(this.mc&&clearTimeout(this.mc),0===this.tc.length)return this.cc=!1,void(this.mc=void 0);this.mc=setTimeout(()=>{this.dc&&this.tc.length>0&&this.uc(),this.gc()},this.hc)}uc(){const t=Date.now(),i=[],e=this.tc.filter(e=>t>e.retryAt||(i.push(e),!1));if(this.tc=i,e.length>0)for(const{requestOptions:t}of e)this.retriableRequest(t)}unload(){this.mc&&(clearTimeout(this.mc),this.mc=void 0),this.cc=!1,_i(qt)||(this.vc&&(qt.removeEventListener("online",this.vc),this.vc=void 0),this.fc&&(qt.removeEventListener("offline",this.fc),this.fc=void 0));for(const{requestOptions:t}of this.tc)try{this._instance._send_request(as(as({},t),{},{callback:vi(t.data)?void 0:t.callback,transport:"sendBeacon"}))}catch(t){Tr.error(t)}this.tc=[]}},yu=class{constructor(t){this._instance=t,this.yc=()=>{var t,i,e,s;this.bc||(this.bc={});const n=this.scrollElement(),r=this.scrollY(),o=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=r+((null==n?void 0:n.clientHeight)||0),a=(null==n?void 0:n.scrollHeight)||0;this.bc.lastScrollY=Math.ceil(r),this.bc.maxScrollY=Math.max(r,null!==(t=this.bc.maxScrollY)&&void 0!==t?t:0),this.bc.maxScrollHeight=Math.max(o,null!==(i=this.bc.maxScrollHeight)&&void 0!==i?i:0),this.bc.lastContentY=l,this.bc.maxContentY=Math.max(l,null!==(e=this.bc.maxContentY)&&void 0!==e?e:0),this.bc.maxContentHeight=Math.max(a,null!==(s=this.bc.maxContentHeight)&&void 0!==s?s:0)}}get _c(){return this._instance.config.scroll_root_selector}getContext(){return this.bc}resetContext(){const t=this.bc;return this.bc=void 0,setTimeout(this.yc,0),t}startMeasuringScrollPosition(){Lr(qt,"scroll",this.yc,{capture:!0}),Lr(qt,"scrollend",this.yc,{capture:!0}),Lr(qt,"resize",this.yc)}scrollElement(){if(this._c){const i=vi(this._c)?this._c:[this._c];for(const e of i){var t;const i=null==qt||null===(t=qt.document)||void 0===t?void 0:t.querySelector(e);if(i)return i}return}var i;return null==qt||null===(i=qt.document)||void 0===i?void 0:i.documentElement}wc(t){var i,e;const s="y"===t?"scrollTop":"scrollLeft";if(this._c){const t=this.scrollElement();return t&&t[s]||0}return qt?"y"===t?qt.scrollY||qt.pageYOffset||(null===(i=qt.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:qt.scrollX||qt.pageXOffset||(null===(e=qt.document)||void 0===e||null===(e=e.documentElement)||void 0===e?void 0:e.scrollLeft)||0:0}scrollY(){return this.wc("y")}scrollX(){return this.wc("x")}};const bu=t=>Bl(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);var wu=class{constructor(t,i,e,s){this.je=t=>{const i=this.kc();if(i&&i.sessionId===t)return;const e={sessionId:t,props:this.Sc(this._instance)};this.xc.register({[gt]:e})},this._instance=t,this.$c=i,this.xc=e,this.Sc=s||bu,this.$c.onSessionId(this.je)}kc(){return this.xc.props[gt]}getSetOnceProps(){var t;const i=null===(t=this.kc())||void 0===t?void 0:t.props;return i?"r"in i?zl(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){const t={};return Rr(Mr(this.getSetOnceProps()),(i,e)=>{"$current_url"===e&&(e="url"),t[`$session_entry_${ai(e)}`]=i}),t}},$u=class{on(t,i){return this.ko[t]||(this.ko[t]=[]),this.ko[t].push(i),()=>{this.ko[t]=this.ko[t].filter(t=>t!==i)}}emit(t,i){for(const e of this.ko[t]||[])e(i);for(const e of this.ko["*"]||[])e(t,i)}constructor(){this.ko={}}};const xu=Pr("[SessionId]"),Su=864e5;var Eu=class{on(t,i){return this.Cc.on(t,i)}constructor(t,i,e){var s;if(this.Tc=null,this.Ic=null,this.Ec=[],this.Mc=void 0,this.Ac=!1,this.Cc=new $u,this.Rc=(t,i)=>!(!xi(t)||!xi(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.Dr=t.config,this.xc=t.persistence,this.Be=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Pc=void 0,this._sessionActivityTimestamp=null,this.Oc=i||Gr,this.Fc=e||Gr;const n=this.Dr.persistence_name||this.Dr.token;if(this._sessionTimeoutMs=1e3*Ui(this.Dr.session_idle_timeout_seconds||1800,60,36e3,xu.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Dc(),this.Lc="ph_"+n+"_window_id",this.Nc="ph_"+n+"_primary_window_exists",this.jc()){const t=po.Ft(this.Lc),i=po.Ft(this.Nc);t&&!i?this.Be=t:po.Dt(this.Lc),po.$t(this.Nc,!0)}(null===(s=this.Dr.bootstrap)||void 0===s?void 0:s.sessionID)&&this.setBootstrapSessionId(this.Dr.bootstrap.sessionID),this.qc()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return _i(this.Ec)&&(this.Ec=[]),this.Ec.push(t),this.Xt&&t(this.Xt,this.Be),()=>{this.Ec=this.Ec.filter(i=>i!==t)}}jc(){return"memory"!==this.Dr.persistence&&!this.xc.fi&&po.Ot()}Bc(t){t!==this.Be&&(this.Be=t,this.jc()&&po.$t(this.Lc,t))}zc(){return this.Be?this.Be:this.jc()?po.Ft(this.Lc):null}Hc(t){const i=this.Tc;return!bi(i)&&!bi(t)&&5e3>Math.abs(t-i)}Uc(t,i,e){const s=i!==this._sessionActivityTimestamp,n=!(t!==this.Xt||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.Xt=t,n&&!s||n&&this.Hc(i)||(this.Tc=i,this.xc.register({[tt]:[i,t,e]}))}Wc(){var t;const i=null===(t=this.Dr)||void 0===t?void 0:t.persistence_save_debounce_ms;return xi(i)&&i>0}Vc(){this.Wc()?this.xc.refreshKey(tt):(this.xc.flush(),this.xc.load())}Gc(){var t;if(bi(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Tc)return;this.Vc();const[,i,e]=this.Qc();i===this.Xt&&e===this._sessionStartTimestamp&&(this.Tc=this._sessionActivityTimestamp,this.xc.register({[tt]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.xc.flush())}Jc(){const[t]=this.Qc(),i=xi(t)?t:0,e=xi(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}Zc(t){return this.Vc(),this.Rc(t,this.Jc())}Qc(){const t=this.xc.props[tt];return vi(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Tc=null,this.Pc=void 0,clearTimeout(this.Kc),this.Kc=void 0,this.Uc(null,null,null)}setBootstrapSessionId(t,i=!1){const e=((t,i=(new Date).getTime())=>{try{const e=(t=>{const i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(t);return e>i+6e4?void xu.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void xu.error("Invalid sessionID in bootstrap",t)}})(t);return!_i(e)&&(i?this.Pc={sessionId:t,sessionStartTimestamp:e}:this.Uc(t,(new Date).getTime(),e),!0)}destroy(){this.Ac=!0,this.Gc(),clearTimeout(this.Kc),this.Kc=void 0,this.Mc&&qt&&(qt.removeEventListener(jt,this.Mc,{capture:!1}),this.Mc=void 0),this.Ec=[]}qc(){this.Mc=()=>{this.Gc(),this.jc()&&po.Dt(this.Nc)},Lr(qt,jt,this.Mc,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,i=null,e=!1){if("always"===this.Dr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=i||(new Date).getTime(),n=this.Xt;if(e)this.Ic=s;else if(bi(this.Ic)||this.Ic>s||s-this.Ic>=1e3){var r,o;null===(r=(o=this.xc).syncCookieProperties)||void 0===r||r.call(o),this.Ic=s}let[,l,a]=this.Qc();const u=!_i(n)&&l!==n,h=this.Jc();let c=this.zc();const d=this.Pc,v=!!d&&(d.sessionStartTimestamp>s+6e4||s-d.sessionStartTimestamp>Su),f=d?v:xi(a)&&Math.abs(s-a)>Su;let p=!1,g=u,_=!l||!!d;const m=l;let y=!_&&!t&&this.Rc(s,h);if(y&&(y=this.Zc(s),y||xu.info("cross-tab refresh kept the session alive",{sessionId:l}),[,l,a]=this.Qc(),y||(_=!l||!!d)),_||y||f){g=!1;const t=d&&!v;l=t?d.sessionId:this.Oc(),c=this.Fc(),xu.info("new session ID assigned",{sessionId:l,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f}}),a=t?d.sessionStartTimestamp:s,this.Pc=void 0,p=!0}else c||(c=this.Fc(),p=!0),g=g||l!==m,g&&(xu.info("adopted cross-tab session id",{sessionId:l,windowId:c}),p=!0);const b=xi(h)&&t&&!f?h:s,w=xi(a)?a:(new Date).getTime();this.Bc(c),this.Uc(l,b,w),t||this.Dc();const x={noSessionId:_,activityTimeout:y,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.Ec.forEach(t=>t(l,c,x)),{sessionId:l,windowId:c,sessionStartTimestamp:w,changeReason:p?x:void 0,lastActivityTimestamp:h}}Dc(){this.Ac||(clearTimeout(this.Kc),this.Kc=setTimeout(()=>{if(!this.Ac)if(this.Zc((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Cc.emit("forcedIdleReset",{idleSessionId:t})}else this.Dc()},1.1*this.sessionTimeoutMs))}};const ku=Object.freeze(["2026-08-30","2026-08-29","2026-06-25","2026-05-30","2026-01-30","2025-11-30","2025-05-24"]),Tu=function(t,i){if(!t)return!1;const e=t.userAgent;if(e&&ji(e,i))return!0;try{const e=null==t?void 0:t.userAgentData;if((null==e?void 0:e.brands)&&e.brands.some(t=>ji(null==t?void 0:t.brand,i)))return!0}catch(t){}return!!t.webdriver};function Pu(){return(Pu=Di(function*(){const t=null==Vt?void 0:Vt.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const i=yield t.getHighEntropyValues(["model"]),e=null==i?void 0:i.model;return mi(e)&&e.length>0?e:void 0}catch(t){return void Tr.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function Ou(t,i){let e=`$survey_${i}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(e=`$survey_${i}/${t.id}/${t.current_iteration}`),e}function Ru(t){var i;return!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}const Au=(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}},Cu=t=>t.toLowerCase(),Iu={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=>Au(i,t))),not_regex:(t,i)=>i.every(i=>t.every(t=>!Au(i,t))),icontains:(t,i)=>i.map(Cu).some(i=>t.map(Cu).some(t=>i.includes(t))),not_icontains:(t,i)=>i.map(Cu).every(i=>t.map(Cu).every(t=>!i.includes(t))),gt:(t,i)=>i.some(i=>{const e=parseFloat(i);return!isNaN(e)&&t.some(t=>e>parseFloat(t))}),lt:(t,i)=>i.some(i=>{const e=parseFloat(i);return!isNaN(e)&&t.some(t=>e<parseFloat(t))})};function Mu(t,i){return!t||Object.entries(t).every(([t,e])=>{const s=null==i?void 0:i[t];if(null==s)return!1;const n=Iu[e.operator];return!!n&&n(e.values.map(String),[String(s)])})}function Fu(t,i,e){return kl({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}const Du="custom",Nu="i.posthog.com",Lu=/^\/static\//,ju=["/s/","/e/","/i/"];var Uu=class{constructor(t){this.Yc={},this.instance=t}get apiHost(){const t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){const t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t;let i=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace(`.${Nu}`,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.Yc[this.apiHost]||(this.Yc[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":Du),this.Yc[this.apiHost]}Xc(t){if(!Lu.test(t))return;const i=this.instance.config.asset_host;return"string"==typeof i&&i.trim().replace(/\/$/,"")||void 0}eh(t){const i=$l(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}ih(t,i,e){if("ui"===t)return e;let s=e;const n=this.instance.config.rewriteRequestPath;if(n){var r;const t=(null===(r=$l(e))||void 0===r?void 0:r.href)||e;s=n(new URL(t)).toString()}if(n&&"api"===t&&ju.some(t=>0===i.indexOf(t))){const t=this.eh(s);if(t){const i=this.apiHost;let e=this.nh;(null==e?void 0:e.apiHost)===i&&e.rewriteRequestPath===n||(e={apiHost:i,rewriteRequestPath:n,urls:new Set},this.nh=e),e.urls.add(t)}}return s}isIngestionEndpoint(t){const i=this.nh,e=this.eh(t);return(null==i?void 0:i.apiHost)===this.apiHost&&i.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&i.urls.has(e)}endpointFor(t,i=""){if(i&&(i="/"===i[0]?i:`/${i}`),"ui"===t)return this.ih(t,i,this.uiHost+i);if("flags"===t)return this.ih(t,i,this.flagsApiHost+i);if("assets"===t){const e=this.Xc(i);if(e)return this.ih(t,i,`${e}${i}`)}if(this.region===Du)return this.ih(t,i,this.apiHost+i);const e=Nu+i;switch(t){case"assets":return this.ih(t,i,`https://${this.region}-assets.${e}`);case"api":return this.ih(t,i,`https://${this.region}.${e}`)}}};const Bu=Pr("[Surveys]"),zu=t=>{try{const i=(t=>((t,i)=>`seenSurvey_${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(i)}`)(0,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){Bu.error("Failed to persist survey seen state",t)}},Hu=[ra.Popover,ra.Widget,ra.API],qu={ignoreConditions:!1,ignoreDelay:!1,displayType:aa.Popover},Wu=Pr("[PostHog ExternalIntegrations]"),Vu={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var Gu=class{constructor(t){this._instance=t}Pl(t,i){var e,s;null===(e=ii.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,t,t=>{if(t)return Wu.error("failed to load script",t);i()})}startIfEnabledOrStop(){var t;for(const[n,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var i,e,s;r&&!(null===(i=ii.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[n])&&this.Pl(Vu[n],()=>{var t;null===(t=ii.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[n])||void 0===t||t.start(this._instance)}),!r&&(null===(e=ii.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[n])&&(null===(s=ii.__PosthogExtensions__)||void 0===s||null===(s=s.integrations)||void 0===s||null===(s=s[n])||void 0===s||s.stop())}}},Ku=class{constructor(t){this.disabled=!1===t;const i=pi(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(t-s.x)+Math.abs(i-s.y)<this.thresholdPx&&this.timeoutMs>e-s.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}};const Yu=()=>typeof window>"u"?void 0:window,Ju=()=>typeof document>"u"?void 0:document,Xu="$copy_autocapture",Zu=["password","hidden","file","checkbox","button","submit","reset","image"],Qu=Pr("[AutoCapture]");function th(t,i){return i.length>t?i.slice(0,t)+"...":i}function ih(t){if(t.previousElementSibling)return t.previousElementSibling;let i=t;do{i=i.previousSibling}while(i&&!yo(i));return i}function eh(t,{e:i,maskAllElementAttributes:e,maskAllText:s,elementAttributeIgnoreList:n,elementsChainAsString:r,disableCaptureUrlHashes:o}){var l,a;if(!yo(t))return{props:{}};const u=[t],h=new Set([t]);let c=t;for(;c.parentNode&&!bo(c,"body")&&1e3>u.length;){if($o(c.parentNode)){const t=c.parentNode.host;if(h.has(t))break;h.add(t),u.push(t),c=t;continue}if(!yo(c.parentNode))break;if(h.has(c.parentNode))break;h.add(c.parentNode),u.push(c.parentNode),c=c.parentNode}const d="click"===i.type&&"http://www.w3.org/2000/svg"===t.namespaceURI?u.findIndex(t=>bo(t,"button")||bo(t,"a")):-1;d>0&&(s=s||u.slice(0,d+1).some(t=>!Go(t)||Ko(t)));const v=[],f={};let p,g=!1,_=!1;if(Rr(u,t=>{const i=Go(t);if(bo(t,"a")&&!e&&!(null==n?void 0:n.includes("href"))){const e=t.getAttribute("href");g=!!(i&&e&&el(e))&&(o?ts(e):e)}oi(Eo(t),"ph-no-capture")&&(_=!0),v.push(function(t,i,e,s,n=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};Oo.indexOf(r)>-1&&!e&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?th(1024,sl(t)):th(1024,To(t)));const l=Eo(t);i||(null==s?void 0:s.includes("class"))||0>=l.length||(o.classes=l.filter(function(t){return""!==t})),Rr(t.attributes,function(e){var r;if((!Ko(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&!(null==s?void 0:s.includes(e.name))&&!i&&el(e.value)&&(!mi(r=e.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=e.value;"class"===e.name&&(t=xo(t).join(" ")),o["attr__"+e.name]=th(1024,"href"===e.name&&n?ts(t):t)}});let a=1,u=1,h=t;for(;h=ih(h);)a++,h.tagName===t.tagName&&u++;return o.nth_child=a,o.nth_of_type=u,o}(t,e,s,n,o)),Rr(function(t){if(!Go(t))return{};const i={};return Rr(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const e=t.name.replace("data-ph-capture-attribute-",""),s=t.value;e&&s&&el(s)&&(i[e]=s)}}),i}(t),(t,i)=>{({}).hasOwnProperty.call(f,i)||(f[i]=t)})}),_)return{props:{},explicitNoCapture:_};if(d>0&&(t=u[d],v.splice(0,d)),s||(v[0].$el_text=bo(t,"a")||bo(t,"button")?sl(t):To(t)),g){var m,y;v[0].attr__href=g;const t=null===(m=$l(g))||void 0===m?void 0:m.host,i=null===(y=Yu())||void 0===y||null===(y=y.location)||void 0===y?void 0:y.host;t&&i&&t!==i&&(p=g)}return{props:Ar((w=i.type,{$event_type:w,$ce_version:1}),r?{}:{$elements:v},{$elements_chain:(b=v,vi(b)?function(t){return t.map(t=>{var i,e;let s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class){t.attr_class.sort();for(const i of t.attr_class)s+=`.${i.replace(/"/g,"")}`}const n=as(as(as(as({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return Cr(n).sort(([t],[i])=>function(t,i){return i>t?-1:t>i?1:0}(t,i)).forEach(([t,i])=>r[rl(t.toString())]=rl(i.toString())),s+=":",s+=Cr(r).map(([t,i])=>`${t}="${i}"`).join(""),s}).join(";")}(function(t){return t.map(t=>{var i,e;const s={text:null===(i=t.$el_text)||void 0===i?void 0:i.slice(0,400),tag_name:t.tag_name,href:null===(e=t.attr__href)||void 0===e?void 0:e.slice(0,2048),attr_class:ol(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Cr(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,i])=>s.attributes[t]=i),s})}(b)):"")},(null===(l=v[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(a=v[0])||void 0===a?void 0:a.$el_text}:{},p&&"click"===i.type?{$external_click_url:p}:{},f),target:t};var b,w}const sh="autocapture";var nh=class{sl(){this.rl=void 0,clearTimeout(this.al),this.al=void 0}ll(t){var i;if(!Go(t))return!0;const e=null!==(i=this.ul().css_selector_ignorelist)&&void 0!==i?i:Io,s=new Set;let n=t;for(;n;){if(s.size>=1e3||s.has(n))return!0;s.add(n);const t=n,i=Eo(t);if(oi(i,"ph-no-capture")||oi(i,"ph-sensitive")||Ko(t)||e.some(i=>Ro(t,i)))return!0;const r=n.parentNode;n=$o(r)?r.host:r&&yo(r)?r:null}return!1}cl(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.sl();if("pointerdown"===t.type){var i;this.sl();const e=Po(t);return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&e&&yo(e)&&(this.rl={target:e,excluded:this.ll(e),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(i=this.Ta)||void 0===i?void 0:i.distinctId}))}const e=this.rl;e&&(t.pointerId!==e.id||Math.abs(t.clientX-e.x)>5||Math.abs(t.clientY-e.y)>5?this.sl():"pointerup"===t.type&&(e.released=!0,this.al=setTimeout(()=>this.sl(),0)))}hl(t){var i;const e=this.rl;this.sl();const s=Po(t);if((null==e?void 0:e.released)&&e.target.isConnected&&e.distinctId===(null===(i=this.Ta)||void 0===i?void 0:i.distinctId)&&t.pointerId===e.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-e.x)&&5>=Math.abs(t.clientY-e.y)&&s&&(bo(s,"html")||bo(s,"body"))){var n,r,o;if(e.excluded)return null;const t=null!==(n=this.ul().css_selector_ignorelist)&&void 0!==n?n:Io;return[s,null===(r=Ju())||void 0===r?void 0:r.documentElement,null===(o=Ju())||void 0===o?void 0:o.body].some(i=>{if(!i)return!1;const e=Eo(i);return oi(e,"ph-no-capture")||oi(e,"ph-sensitive")||!Go(i)||Ko(i)||t.some(t=>Ro(i,t))})?null:e.target}}constructor(t){this.Ma=t,this.name=sh,this.dl=!1,this.vl=null,this.fl=!1,this.pl=new Map,this.gl=!1,this.Dr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Ti=!1,this.Ma.refresh(this.Dr),this.rageclicks=new Ku(this.Dr.rageclick),this.ml=null}setup(t){this.yl(),this.Ta=t;const i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Ti?i.dispose():(this.za=i,this.startIfEnabled())}dispose(){var t;this.Ti||(this.Ti=!0,this.Ta=void 0,null===(t=this.za)||void 0===t||t.dispose(),this.za=void 0,this.pl.clear(),this.ml=null,this.bl())}ul(){return this.Ma.refresh(this.Dr),this.Dr}yl(){var t,i;return this.ul(),this.Dr.url_allowlist=null===(t=this.Dr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Dr.url_ignorelist=null===(i=this.Dr.url_ignorelist)||void 0===i?void 0:i.map(t=>new RegExp(t)),this.Dr}_l(){const t=Yu(),i=Ju();if(!this.isBrowserSupported())return void Qu.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!i)return;this.wl=t,this.kl=i;const e=this.Sl=i=>{i=i||(null==t?void 0:t.event);try{if("blur"===i.type)return void this.sl();if(0===i.type.indexOf("pointer"))return void this.cl(i);const t="click"===i.type?this.hl(i):void 0;if(bi(t))return;this.xl(i,"$autocapture",t)}catch(t){Qu.error("Failed to capture event",t)}};if(Lr(t,"blur",e),Lr(i,"submit",e,{capture:!0}),Lr(i,"change",e,{capture:!0}),Lr(i,"click",e,{capture:!0}),Rr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Lr(i,t,e,{capture:!0})}),this.ul().capture_copied_text){const e=this.$l=i=>{i=i||(null==t?void 0:t.event);try{this.xl(i,Xu)}catch(t){Qu.error("Failed to capture clipboard event",t)}};Lr(i,"copy",e,{capture:!0}),Lr(i,"cut",e,{capture:!0}),Lr(i,"paste",e,{capture:!0})}}bl(){const t=this.wl,i=this.kl;this.sl(),this.Sl&&(null==t||t.removeEventListener("blur",this.Sl),Rr(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==i||i.removeEventListener(t,this.Sl,!0)}),null==i||i.removeEventListener("submit",this.Sl,!0),null==i||i.removeEventListener("change",this.Sl,!0),null==i||i.removeEventListener("click",this.Sl,!0),this.Sl=void 0),this.$l&&(null==i||i.removeEventListener("copy",this.$l,!0),null==i||i.removeEventListener("cut",this.$l,!0),null==i||i.removeEventListener("paste",this.$l,!0),this.$l=void 0),this.wl=void 0,this.kl=void 0,this.dl=!1}startIfEnabled(){this.isEnabled||this.sl(),!this.Ti&&this.Ta&&this.isEnabled&&!this.dl&&(this._l(),this.dl=!0)}onRemoteConfig(t){if(this.Ti)return;if(this.fl=!0,!t.ok)return void this.startIfEnabled();const i=t.config;i.elementsChainAsString&&(this.gl=i.elementsChainAsString);const e=i.autocapture_opt_out;var s;Si(e)&&(null===(s=this.Ta)||void 0===s||s.kv.set("$autocapture_disabled_server_side",e),this.vl=e),this.startIfEnabled()}setElementSelectors(t,i=this){if(this.Ti)return;t.size?this.pl.set(i,new Set(t)):this.pl.delete(i);const e=new Set;this.pl.forEach(t=>{t.forEach(t=>e.add(t))}),this.ml=e}getElementSelectors(t,i){var e;const s=[];return null===(e=this.ml)||void 0===e||e.forEach(e=>{var n;const r=null===(n=Ju())||void 0===n?void 0:n.querySelectorAll(e);null==r||r.forEach(n=>{t!==n&&i!==n||oi(s,e)||s.push(e)})}),s}get isEnabled(){var t,i;if(this.Ti)return!1;const e=null===(t=this.Ta)||void 0===t?void 0:t.kv.get(y),s=this.vl,n=this.ul();if(!n.remoteRequestsDisabled&&!this.fl)return!1;const r=n.remoteRequestsDisabled&&!this.fl;if(bi(s)&&!Si(e)&&!r)return!1;const o=null!==(i=this.vl)&&void 0!==i?i:!!e;return!!n.enabled&&!o}xl(t,i="$autocapture",e){if(!this.isEnabled)return void this.sl();let s=e||Po(t);wo(s)&&(s=s.parentNode||null);const n=this.yl();var r;"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&n.rageclick&&(null===(r=this.rageclicks)||void 0===r?void 0:r.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime()))&&qo(s,n.rageclick)&&this.xl(t,"$rageclick",e);const o=i===Xu,l=o?as(as({},n),{},{dom_event_allowlist:void 0}):n;if(s&&function(t,i,e,s,n,r){var o;const l=typeof window>"u"?void 0:window;if(!l||Wo(t))return!1;if((null==e?void 0:e.url_allowlist)&&!So(e.url_allowlist,r))return!1;if((null==e?void 0:e.url_ignorelist)&&So(e.url_ignorelist,r))return!1;if(null==e?void 0:e.dom_event_allowlist){const t=e.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:a,targetElementList:u}=Vo(t,s);if(!function(t,i){const e=null==i?void 0:i.element_allowlist;if(_i(e))return!0;for(const i of t)if(e.some(t=>i.tagName.toLowerCase()===t))return!0;return!1}(u,e))return!1;if(!Ao(u,null==e?void 0:e.css_selector_allowlist))return!1;if(Ao(u,null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:Io))return!1;try{const e=l.getComputedStyle(t);if(e&&"pointer"===e.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const h=t.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return a?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(Oo.indexOf(h)>-1||"true"===t.getAttribute("contenteditable"))}}(s,t,l,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var a;const{props:e,explicitNoCapture:r,target:o}=eh(s,{e:t,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.gl,disableCaptureUrlHashes:n.disableCaptureUrlHashes});if(r)return!1;const l=this.getElementSelectors(s,o);if(l&&l.length>0&&(e.$element_selectors=l),i===Xu){const i=t.type||"clipboard";if("paste"!==i){var u,h;const t=null===(u=Yu())||void 0===u||null===(u=u.getSelection())||void 0===u?void 0:u.toString(),i=ko(t);if(!i)return!1;e.$selected_content=i,e.$clipboard_text_length=null!==(h=null==t?void 0:t.length)&&void 0!==h?h:0}e.$copy_type=i}if("$autocapture"===i&&"change"===t.type&&n.capture_value_css_selector_allowlist&&!n.maskAllText&&(bo(c=s,"input")?!oi(Zu,c.type):bo(c,"textarea")||bo(c,"select")&&!c.multiple)&&function(t,i){var e;if(!Go(t))return!1;const s=null!==(e=i.css_selector_ignorelist)&&void 0!==e?e:Io,n=new Set;let r=t;for(bo(t,"select")&&(r=t.options[t.selectedIndex]||t);r;){const t=r,i=Eo(t);if(n.size>=1e3||n.has(r)||oi(i,"ph-sensitive")||oi(i,"ph-no-capture")||s.some(i=>Ro(t,i)))return!1;n.add(r);const e=r.assignedSlot||r.parentNode;r=$o(e)?e.host:e&&yo(e)?e:null}return!0}(s,n)&&!s.querySelector(".ph-no-capture, .ph-sensitive")){const t=n.capture_value_css_selector_allowlist;let i=!1;try{i=fi(t)?!!t(s):vi(t)&&t.some(t=>Ro(s,t))}catch(t){Qu.error("capture_value_css_selector_allowlist threw",t)}i&&(e.$input_value=s.value)}return null===(a=this.Ta)||void 0===a||a.capture(i,e),!0}var c}isBrowserSupported(){var t;return fi(null===(t=Ju())||void 0===t?void 0:t.querySelectorAll)}};const rh="featureFlags",oh="logs";var lh=class{constructor(t){this._instance=t}initialize(){}get(t){const i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);const e={};for(const s of t){const t=null==i?void 0:i.get_property(s);_i(t)||(e[s]=t)}return e}set(t,i){var e;null===(e=this._instance.persistence)||void 0===e||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null===(i=this._instance.persistence)||void 0===i||i.unregister(t)}},ah=class{constructor(t){this.instance=t,this.A=Tr,this.kv=new lh(t),this.onSession=t=>ua(this.instance.onSessionId(i=>{try{t(i)}catch(t){this.A.error("Browser extension session listener failed",t)}})),this.onEvent=t=>ua(this.instance._addCaptureHook((i,e)=>{if(e)try{t({event:i,properties:e.properties})}catch(t){this.A.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{const i=i=>{try{t(i)}catch(t){this.A.error("Browser extension remote config listener failed",t)}},e=this.instance.dr.on("extensionsRemoteConfig",i);return this.instance.vr&&i(this.instance.vr),ua(e)}}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(){const t=this.instance.get_property(O);return"string"==typeof t?t:void 0}get library(){return{name:e.LIB_NAME,version:e.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,s,n;const r=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==r?void 0:r.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==r?void 0:r.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(s=null==r?void 0:r.sessionStartTimestamp)&&void 0!==s?s:0,lastActivityTimestamp:null!==(n=null==r?void 0:r.lastActivityTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0,lastActivityTimestamp:0}}}get isOptedOut(){return this.instance.has_opted_out_capturing()}get canCapture(){return fi(this.instance.is_capturing)?this.instance.is_capturing():!this.isOptedOut}get projectToken(){return this.instance.config.token}getExtension(t){let i;switch(t){case rh:case"featureFlagsCommon":i=this.instance.featureFlags;break;case oh:i=this.instance.logs;break;case"surveys":i=this.instance.surveys;break;case sh:i=this.instance.autocapture}return i}capture(t,i,e){if(!e)return void this.instance.capture(t,i);const s=as({timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce},"unload"===e.delivery?{transport:"sendBeacon",send_instantly:!0}:{});this.instance.capture(t,i,s)}registerDynamicEventProperties(t){return ua(this.instance.pr(t))}sendRequest(t){var i=this;return Di(function*(t,e={}){var s;const n=null!==(s=e.target)&&void 0!==s?s:"api",r=e.query?iu(t,e.query):t,o=i.instance.requestRouter.endpointFor(n,r),l={method:e.method,url:o,data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,compressionFallback:"flags"===e.target&&"best-available"===e.compression?si.Base64:void 0,timestampMode:e.sentAt};return"api"===n&&"/i/v1/logs"===t&&(l.batchKey="logs"),"sendBeacon"===e.transport?(i.instance._send_request(l),{statusCode:202}):new Promise(t=>{l.callback=t,i.instance._send_request(l)})}).apply(this,arguments)}};const uh={};let hh=0;const ch=()=>{},dh='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',vh="Surveys module not available",fh="sanitize_properties is deprecated. Use before_send instead",ph="Invalid value for property_denylist config: ",gh=["$recording_status","$sdk_debug_recording_script_not_loaded","$sdk_debug_replay_url_trigger_status","$sdk_debug_replay_event_trigger_status","$sdk_debug_replay_linked_flag_trigger_status","$sdk_debug_replay_rrweb_error","$sdk_debug_replay_internal_buffer_length","$sdk_debug_replay_flushed_size"],_h=["$feature_flag_called","$$heatmap","$snapshot"],mh=t=>"$"===t.charAt(0)&&!oi(_h,t),yh=/^[A-Za-z0-9_-]{1,400}$/,bh=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,wh=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,$h=["token","distinct_id",xt],xh="posthog",Sh=[...ku].sort()[ku.length-1],Eh=t=>{const i={};return t&&"unset"!==t?("2025-11-30">t||(i.strictMinimumDuration=!0),"2026-05-30">t||(i.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(i.streamNetworkBody=!0),"2026-08-30">t||(i.captureJsonLd=!0),i):i},kh=t=>{var i;return as({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Nr(null==Gt?void 0:Gt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ch,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_replay_sync_fetch:!0,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:Kt&&mi(null==Kt?void 0:Kt.search)&&-1!==Kt.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==qt||null===(i=qt.location)||void 0===i?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,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(t){Tr.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:Lt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:ch},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Fo,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Eh(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))},Th=[["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"]],Ph=t=>{const i={};for(const[e,s]of Th)_i(t[e])||(i[s]=t[e]);const e=Ar({},i,t),s=t.__preview_external_dependency_versioned_paths;return _i(s)||(_i(t.strict_script_versioning)&&(e.strict_script_versioning=!!s),mi(s)&&_i(t.asset_host)&&(e.asset_host=s)),vi(t.property_blacklist)&&(_i(t.property_denylist)?e.property_denylist=t.property_blacklist:vi(t.property_denylist)?e.property_denylist=[...t.property_blacklist,...t.property_denylist]:Tr.error(ph+t.property_denylist)),e};var Oh=class{constructor(){this.__forceAllowLocalhost=!1}get sh(){return this.__forceAllowLocalhost}set sh(t){Tr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},Rh=class t{rh(t){if(!t)return;const i=this.oh.indexOf(t);-1!==i&&this.oh.splice(i,1)}ah(t,i){var e;return this.rh(t),this.oh.push(i),null===(e=i.initialize)||void 0===e||e.call(i),i}uh(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}hh(){if(this.dh)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.uh())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.fh)return;let i,e,s;t?(i=`persistence is set to '${this.config.persistence}'`,e="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",s="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(i="persistence is disabled (disable_persistence is true)",e="on every page load",s="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.dh=!0,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${e}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${s}`)}ph(){const t=this.persistence;if(!t||this.gh)return;if(this.uh())return void("on_reject"===this.config.cookieless_mode&&"$posthog_cookieless"!==this.get_distinct_id()&&(this.mh(),this.yh()));if("$posthog_cookieless"!==this.get_distinct_id())return;this.bh()||t.load(!0);const i=this.get_distinct_id();if(!i||"$posthog_cookieless"===i){const i=this.config.get_device_id(Gr());this.register({distinct_id:i,$device_id:i}),t.set_property(pt,Dt)}this.mh()}get decideEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var i;this._h=!1,this.wh=!1,this.webPerformance=new Oh,this.kh=!1,this.version=e.LIB_VERSION,this.Sh=new Set,this.xh="",this.dr=new $u,this.oh=[],this.$h=[],this.Ch=!1,this.fh=!1,this.dh=!1,this.gh=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=kh(),this.SentryIntegration=pl,this.sentryIntegration=t=>function(t,i){const e=fl(t,i);return{name:vl,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Th=!1,this.Ih=null,this.Eh=null,this.Mh=null,this.scrollManager=new yu(this),this.pageViewManager=new gl(this),this.rateLimiter=new va(this),this.requestRouter=new Uu(this),this.consent=new go(this),this.externalIntegrations=new Gu(this);const s=null!==(i=t.__defaultExtensionClasses)&&void 0!==i?i:{};this.featureFlags=s.featureFlags&&new s.featureFlags(this),this.toolbar=s.toolbar&&new s.toolbar(this),this.surveys=s.surveys&&new s.surveys(this),this.conversations=s.conversations&&new s.conversations(this),this.logs=s.logs&&new s.logs(this),this.metrics=s.metrics&&new s.metrics(this),this.experiments=s.experiments&&new s.experiments(this),this.exceptions=s.exceptions&&new s.exceptions(this),this.people={set:(t,i,e)=>{const s=mi(t)?{[t]:i}:t;this.setPersonProperties(s),null==e||e({})},set_once:(t,i,e)=>{const s=mi(t)?{[t]:i}:t;this.setPersonProperties(void 0,s),null==e||e({})}},this.on("eventCaptured",t=>Tr.info(`send "${null==t?void 0:t.event}"`,t))}init(i,e,s){if(s&&s!==xh){var n;const r=null!==(n=uh[s])&&void 0!==n?n:new t;return r._init(i,e,s),uh[s]=r,uh[xh][s]=r,r}return this._init(i,e,s)}_init(t,i={},s){var n,r,o;const l=mi(t)?t.trim():"";if(!l)return Tr.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var a;if(this.__loaded)return l!==(null===(a=this.config)||void 0===a?void 0:a.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${l}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=kh(i.defaults),i.debug=this.Ah(i.debug),this.Rh=i,this.Ph=[],i.person_profiles?this.Eh=i.person_profiles:i.process_person&&(this.Eh=i.process_person);const u=kh(i.defaults),h=Ph(i),c=Ar({},u,h,{name:s,token:l});pi(u.rageclick)&&pi(h.rageclick)&&(c.rageclick=Ar({},u.rageclick,h.rageclick)),pi(u.session_recording)&&pi(h.session_recording)&&(c.session_recording=Ar({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&Tr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:sa.GZipJS;const d=this.bh(),v=!this.uh();if(this.persistence=new ea(this.config,d,!0,v),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new ea(as(as({},this.config),{},{persistence:"sessionStorage"}),d,!1,v),this.xh="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&po.Ot()){const t=po.Ft(this.xh);vi(t)&&t.forEach(t=>{mi(t)&&this.Sh.add(t)})}else po.Dt(this.xh);const f=as({},this.persistence.props),p=as({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Oh=new gu((t,i)=>this.Fh(t,i),this.config.request_queue_config),this.Dh=new mu(this),this.__request_queue=[];const g=this.uh();g||(this.sessionManager=new Eu(this),this.sessionPropsManager=new wu(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,i,e)=>{((null==e?void 0:e.activityTimeout)||(null==e?void 0:e.sessionPastMaximumLength)||(null==e?void 0:e.crossTabAdoption))&&this.Lh()})),this.Nh(),this.config.__preview_deferred_init_extensions?(Tr.info("Deferring extension initialization to improve startup performance"),this.jh=setTimeout(()=>{this.jh=void 0,this.qh(g)},0)):(Tr.info("Initializing extensions synchronously"),this.qh(g)),e.DEBUG=e.DEBUG||this.config.debug,e.DEBUG&&Tr.info("Starting in debug mode",{this:this,config:i,thisC:as({},this.config),p:f,s:p}),this.config.identity_distinct_id&&!(null===(n=i.bootstrap)||void 0===n?void 0:n.distinctID)&&(i.bootstrap=as(as({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const _=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this.fh=!!_&&!yi(_),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const t=i.bootstrap.distinctID,e=this.get_distinct_id(),s=this.persistence.get_property(pt);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===s)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===s)Tr.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const e=this.config.get_device_id(Gr()),s=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property(pt,i.bootstrap.isIdentifiedID?Nt:Dt),this.register({distinct_id:t,$device_id:s})}}if(g)this.register_once({distinct_id:$t,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(Gr());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property(pt,Dt)}return Lr(qt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Lr(qt,"pageshow",t=>{if(this._h=!1,!this.wh){var i;if(t.persisted&&this.persistence){const t=this.persistence.get_property(P),i=this.persistence.get_property(pt);this.persistence.load(),this.Bh()||t===this.persistence.get_property("distinct_id")&&i===this.persistence.get_property("$user_state")||this.zh()}null===(i=this.Dh)||void 0===i||i.resume()}}),i.segment?dl(this,()=>this.Hh()):this.Hh(),fi(this.config._onCapture)&&this.config._onCapture!==ch&&(Tr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Tr.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 Pu.apply(this,arguments)}().then(t=>{t&&this.register({[R]:t})}).catch(ch),this}Uh(t){const i=t;return mi(i.name)&&fi(i.setup)}Wh(t,i){var e=this;this.Uh(t)?i.push(Di(function*(){try{yield t.setup(e.Vh())}catch(e){Tr.error(`Failed to set up extension "${t.name}"`,e);try{var i;yield null===(i=t.dispose)||void 0===i?void 0:i.call(t)}catch(i){Tr.error(`Failed to dispose extension "${t.name}"`,i)}}})):this.oh.push(t)}Nh(){var i,e,s,n=this;const r=null!==(i=null===(e=this.config.__extensionClasses)||void 0===e?void 0:e.featureFlags)&&void 0!==i?i:null===(s=t.__defaultExtensionClasses)||void 0===s?void 0:s.featureFlags;var o,l,a;if(r)if(this.featureFlags&&this.featureFlags instanceof r||(null===(o=this.Gh)||void 0===o||o.call(this),this.Gh=void 0,this.featureFlags=new r(this)),fi(this.featureFlags.onReloading)&&fi(this.featureFlags.setup)){if(!this.Gh){this.Gh=this.featureFlags.onReloading(()=>{this.dr.emit("featureFlagsReloading",!0)});const t=this.featureFlags;Di(function*(){try{yield t.setup(n.Vh())}catch(i){Tr.error("Failed to set up feature flags",i);const e=n.Gh;n.Gh=void 0;try{null==e||e()}catch(t){Tr.error("Failed to unsubscribe feature flag reloading",t)}try{yield t.dispose()}catch(t){Tr.error("Failed to dispose feature flags",t)}}})()}}else null===(l=(a=this.featureFlags).initialize)||void 0===l||l.call(a)}qh(i){const e=performance.now(),s=as(as({},t.__defaultExtensionClasses),this.config.__extensionClasses),n=[];var r,o,l,a,u,h,c,d;s.exceptions&&this.oh.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new s.exceptions(this)),s.historyAutocapture&&this.oh.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.oh.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.oh.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!i&&this.oh.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||n.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.Wh(this.autocapture=new s.autocapture(this),n),s.surveys&&this.Wh(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new s.surveys(this),n),s.logs&&this.Wh(this.logs=null!==(l=this.logs)&&void 0!==l?l:new s.logs(this),n),s.metrics&&this.oh.push(this.metrics=null!==(a=this.metrics)&&void 0!==a?a:new s.metrics(this)),s.conversations&&this.oh.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new s.conversations(this)),s.productTours&&this.oh.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.oh.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.oh.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.oh.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.oh.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,ul)),s.toolbar&&this.oh.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new s.toolbar(this)),s.experiments&&this.oh.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new s.experiments(this)),s.webMCP&&this.oh.push(this.webMCP=null!==(d=this.webMCP)&&void 0!==d?d:new s.webMCP(this)),this.oh.forEach(t=>{t.initialize&&n.push(()=>{var i;null===(i=t.initialize)||void 0===i||i.call(t)})}),n.push(()=>{if(this.Qh){const t=this.Qh;this.Qh=void 0,this.oh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}}),this.Jh(n,e)}Jh(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void(this.jh=setTimeout(()=>{this.jh=void 0,this.Jh(t,i)},0));const e=t.shift();if(e)try{e()}catch(t){Tr.error("Error initializing extension:",t)}}const e=Math.round(performance.now()-i);this.register_for_session({[St]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Et]:e}),this.config.__preview_deferred_init_extensions&&Tr.info(`PostHog extensions initialized (${e}ms)`)}Ku(t){if(!Gt||!Gt.body)return Tr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Ku(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Qh=t),this.vr=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=oi(e.supportedCompression,sa.GZipJS)?sa.GZipJS:oi(e.supportedCompression,sa.Base64)?sa.Base64:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.Eh?this.Eh:Lt}),this.dr.emit("extensionsRemoteConfig",t),this.oh.forEach(i=>{var e;return null===(e=i.onRemoteConfig)||void 0===e?void 0:e.call(i,t)})}Hh(){try{this.config.loaded(this)}catch(t){Tr.critical("`loaded` function failed",t)}if(this.Zh(),this.config.internal_or_test_user_hostname&&(null==Kt?void 0:Kt.hostname)){const t=Kt.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.uh())&&this.Kh()},1),this.Yh=new pa(this),this.Yh.load()}Zh(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.Oh)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Or(this.__request_queue,t=>this.Fh(t)),this.__request_queue=[],this.Zh()}_handle_unload(){var t,i,e,s,n,r;this._h=!0,null===(t=this.surveys)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t),null===(e=this.metrics)||void 0===e||e.flush("sendBeacon"),this.config.request_batching?(this.Xh()&&this.capture(Bt),null===(s=this.logs)||void 0===s||s.flushLogs("sendBeacon"),null===(n=this.Oh)||void 0===n||n.unload(),null===(r=this.Dh)||void 0===r||r.unload()):this.Xh()&&this.capture(Bt,null,{transport:"sendBeacon"})}_send_request(t){pu(this,t)}Fh(t,i){this.Dh?this.Dh.retriableRequest(t,i):this._send_request(i?as(as({},t),{},{transport:i}):t)}_execute_array(t){hh++;try{let i;const e=[],s=[],n=[];Or(t,t=>{if(t)if(i=t[0],vi(i))n.push(t);else if(fi(t))try{t.call(this)}catch(i){Tr.error("Error executing queued PostHog call",t,i)}else vi(t)&&"alias"===i?e.push(t):vi(t)&&-1!==i.indexOf("capture")&&fi(this[i])?n.push(t):s.push(t)});const r=function(t,i){Or(t,function(t){try{if(vi(t[0])){let e=i;Rr(t,function(t){e=e[t[0]].apply(e,t.slice(1))})}else i[t[0]].apply(i,t.slice(1))}catch(i){Tr.error("Error executing queued PostHog call",t,i)}})};r(e,this),r(s,this),r(n,this)}finally{hh--}}push(i){if(hh>0&&vi(i)&&mi(i[0])){const e=t.prototype[i[0]];return void(fi(e)&&e.apply(this,i.slice(1)))}this._execute_array([i])}get ed(){return{property:I,persistenceKey:M,cookieName:"_fbc",pattern:bh,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[M]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(M)}}}get nd(){return{property:F,persistenceKey:D,cookieName:"_fbp",pattern:wh,register:(t,i)=>{var e;return null===(e=this.persistence)||void 0===e?void 0:e.register({[D]:{value:t,delivered:i}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(D)}}}sd(t){var i;const e=null===(i=this.persistence)||void 0===i?void 0:i.get_property(t.persistenceKey);return mi(e)&&t.pattern.test(e)?{value:e,delivered:!1}:pi(e)&&mi(e.value)&&t.pattern.test(e.value)?{value:e.value,delivered:!0===e.delivered}:void 0}rd(t,i,e){return i===(null==e?void 0:e.value)?{value:i,pending:!e.delivered}:(t.register(i,!1),{value:i,pending:!0})}od(t){if(!this.config.save_campaign_params||this.uh())return;const i=Ur(t.cookieName);return mi(i)&&t.pattern.test(i)?i:void 0}ad(t,i,e,s){if(!this.persistence)return;const n=this.ed;this.persistence.refreshMetaIdentifiers();const r=this.sd(n);if(s)return void n.unregister();if(e)return mi(i)&&bh.test(i)?this.rd(n,i,r):void n.unregister();const o=mi(t)&&yh.test(t)?t:void 0,l=this.od(n);return l&&((t,i,e)=>{const s=t.split(".");if(i)return s[3]===i;if(!e)return!0;const n=e.value.split(".");return s[3]===n[3]||Number(s[2])>Number(n[2])})(l,o,r)?this.rd(n,l,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.rd(n,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}ld(t,i,e){if(!this.persistence)return;const s=this.nd;this.persistence.refreshMetaIdentifiers();const n=this.sd(s);if(e)return void s.unregister();if(i)return mi(t)&&wh.test(t)?this.rd(s,t,n):void s.unregister();const r=this.od(s);return r?this.rd(s,r,n):n?{value:n.value,pending:!n.delivered}:void 0}ud(t,i){if(!this.persistence)return;this.persistence.refreshMetaIdentifiers();const e=this.sd(t);(null==e?void 0:e.value)!==i||e.delivered||t.register(i,!0)}capture(t,i,e){var s,n;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Oh))return void Tr.uninitializedWarning("posthog.capture");if(!this.is_capturing())return void Tr.info(`Event "${t}" was not captured because capturing is disabled (opted out or consent pending).`);if(_i(t)||!mi(t))return void Tr.error("No event name provided to posthog.capture");if(this.ph(),"$snapshot"===t&&this.uh())return;const r=!this.config.opt_out_useragent_filter&&this._is_bot();if(r&&!this.config.__preview_capture_bot_pageviews)return void Tr.info(`Event "${t}" was not captured because the user agent looks like a bot. Set \`opt_out_useragent_filter: true\` to capture it.`);const o=(null==e?void 0:e.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==o?void 0:o.isRateLimited)return void Tr.critical("This capture call is ignored due to client rate limiting.");let l;(null==i?void 0:i.$current_url)&&!mi(null==i?void 0:i.$current_url)&&(Tr.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||(null==e?void 0:e.hd)||Tr.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&&(l=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const a=new Date,u=(null==e?void 0:e.timestamp)||a,h=Ze(null==e?void 0:e.uuid,Gr);let c={uuid:h,event:t,properties:this.calculateEventProperties(t,i||{},u,h)};"$pageview"===t&&this.config.__preview_capture_bot_pageviews&&r&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),o&&(c.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens);const d="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property("$minimal_flag_called_events");(null==e?void 0:e.$set)&&!d&&(c.$set=null==e?void 0:e.$set);const v=pi(null==i?void 0:i.$set)?i.$set:void 0,f=vi(null==i?void 0:i.$unset)?i.$unset:[],p=(null==e?void 0:e.$unset)||[],g=t=>{var i;const s=!!(null==e?void 0:e.$set)&&t in e.$set;return{hasProvided:s||!!v&&t in v,provided:s?null==e||null===(i=e.$set)||void 0===i?void 0:i[t]:null==v?void 0:v[t],unset:-1!==f.indexOf(t)||-1!==p.indexOf(t)}},_=g(I),m=g(F),y=[{channel:this.ed,hasProvided:_.hasProvided,update:this.ad(null==l?void 0:l.fbclid,_.provided,_.hasProvided,_.unset)},{channel:this.nd,hasProvided:m.hasProvided,update:this.ld(m.provided,m.hasProvided,m.unset)}];for(const{channel:t,hasProvided:i,update:e}of y)e&&!0===c.properties.$process_person_profile&&e.pending&&!i&&!d&&(c.$set=as({[t.property]:e.value},c.$set));const b=null==e?void 0:e.$unset;b&&(c.$unset=b);const w=d?void 0:this.dd(null==e?void 0:e.$set_once,t!==Ht,t===zt);if(w&&(c.$set_once=w),(null==e?void 0:e._noTruncate)||(x=this.config.properties_string_max_length,c=function(t,i){const e=new Set;return function t(s,n){if(s!==Object(s))return i?i(s):s;if(e.has(s))return;let r;if(e.add(s),vi(s))r=[],Or(s,i=>{r.push(t(i))});else{const i={};Rr(Oi(s)?Fr(s):s,(s,n)=>{e.has(s)||(i[n]=t(s,n))}),r=i}return r}(t)}(c,t=>mi(t)?t.slice(0,x):t)),c.timestamp=u,_i(null==e?void 0:e.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a),d&&(c.properties=((t,i=[])=>{const e={},s=i=>{void 0!==t[i]&&(e[i]=t[i])};return nn.forEach(s),i.forEach(s),e})(c.properties,$h)),t===oa.DISMISSED||t===oa.SENT){const e=null==i?void 0:i[la.SURVEY_ID],s=null==i?void 0:i[la.SURVEY_ITERATION];zu({id:e,current_iteration:s}),c.$set=as(as({},c.$set),{},{[Ou({id:e,current_iteration:s},t===oa.SENT?"responded":"dismissed")]:!0})}else t===oa.SHOWN&&(c.$set=as(as({},c.$set),{},{[la.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));var x;if(t===ha.SHOWN){const t=null==i?void 0:i[ca.TOUR_TYPE];t&&(c.$set=as(as({},c.$set),{},{[`${ca.TOUR_LAST_SEEN_DATE}/${t}`]:(new Date).toISOString()}))}const S=as(as({},c.properties.$set),c.$set);if(gi(S)||this.setPersonPropertiesForFlags(S),!wi(this.config.before_send)){const t=this.Fs(c);if(!t)return;c=t,c.uuid=Ze(c.uuid,Gr)}this.sessionRecording&&!this.Ch&&mh(t)&&(this.Ch=!0,setTimeout(()=>this.Ch=!1,3e4));const E=y.filter(({channel:t,update:i})=>{var e,s,n;const r=null!==(e=null===(s=c.$set)||void 0===s?void 0:s[t.property])&&void 0!==e?e:pi(null===(n=c.properties)||void 0===n?void 0:n.$set)?c.properties.$set[t.property]:void 0;return(null==i?void 0:i.pending)&&r===i.value});this.dr.emit("eventCaptured",c);const k=null!==(s=null==e?void 0:e._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),T="recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(k),P=as(as(as({method:"POST",url:k,data:c,compression:"best-available",preferSyncCompression:null==e?void 0:e.send_instantly,timestampMode:T?"body":"capture-body",batchKey:null==e?void 0:e._batchKey},T&&(null===(n=c.properties)||void 0===n?void 0:n.$session_id)?{batchGroup:c.properties.$session_id+(c.properties.$window_id?`-${c.properties.$window_id}`:"")}:{}),(null==e?void 0:e.transport)?{transport:e.transport}:{}),E.length?{fireCallbackOnDrop:!0,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(const{channel:t,update:i}of E)this.ud(t,i.value)}}:{});if(!this.config.request_batching||e&&!(null==e?void 0:e._batchKey)||(null==e?void 0:e.send_instantly)){var O;let t;!P.transport&&!P.callback&&gi(null!==(O=this.config.request_headers)&&void 0!==O?O:{})&&this._h&&(t="sendBeacon"),this.Fh(P,t)}else this.Oh.enqueue(P);return c}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return null===(i=this.vd)||void 0===i?void 0:i.getExtension(t)}Vh(){var t;return null!==(t=this.vd)&&void 0!==t?t:this.vd=new ah(this)}pr(t){this.$h.push(t);let i=!0;return()=>{if(!i)return;i=!1;const e=this.$h.indexOf(t);-1!==e&&this.$h.splice(e,1)}}Bh(t=!0){var i;return!!(null===(i=this.persistence)||void 0===i?void 0:i.consumeCookieIdentityChange())&&(this.zh(t),!0)}zh(t=!0){var i,e,s;this.Mh=null,"anonymous"===(null===(i=this.persistence)||void 0===i?void 0:i.get_property("$user_state"))&&(null===(s=this.sessionPersistence)||void 0===s||s.clear(),this.Sh.clear(),this.fd()),null===(e=this.featureFlags)||void 0===e||e.reset(),t&&this.reloadFeatureFlags()}calculateEventProperties(t,e,s,n,r){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return e;this.ph(),this.persistence.syncCookieProperties(),this.Bh();const o=r?void 0:this.persistence.remove_event_timer(t);let l=as({},e);if(l.token=this.config.token,l.$config_defaults="latest"===this.config.defaults?Sh:this.config.defaults,this.uh()&&(l[xt]=!0),"$snapshot"===t){const t=as(as({},this.persistence.properties()),this.sessionPersistence.properties());return l.distinct_id=t.distinct_id,(!mi(l.distinct_id)&&!$i(l.distinct_id)||yi(l.distinct_id))&&Tr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}const a=function(t,e,s,n=!1){var r,o,l,a;if(!Qt)return{};const u=t?[...Rl,...e||[]]:[],[h,c]=Ue(Qt),[d,v]=function(t){for(let i=0;qe.length>i;i++){const[e,s,n]=qe[i],r=t.match(e);if(r){const i=n&&t.match(n)||r;return[s,(null==i?void 0:i[1])||""]}}return["",""]}(Qt),f=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),p={};_i(s)||(p.detectGoogleSearchApp=s);const g={},_=null===(r=navigator)||void 0===r||null===(r=r.userAgentData)||void 0===r?void 0:r.platform,m=null===(o=navigator)||void 0===o?void 0:o.maxTouchPoints,y=null==qt||null===(l=qt.screen)||void 0===l?void 0:l.width,b=null==qt||null===(a=qt.screen)||void 0===a?void 0:a.height,w=null==qt?void 0:qt.devicePixelRatio;_i(_)||(g.userAgentDataPlatform=_),_i(m)||(g.maxTouchPoints=m),_i(y)||(g.screenWidth=y),_i(b)||(g.screenHeight=b),_i(w)||(g.devicePixelRatio=w);const x=Ar(Mr({$os:h,$os_version:c,$browser:De(Qt,navigator.vendor,f,p),$webview_app:d,$webview_app_version:v,$device:Be(Qt),$device_type:ze(Qt,g),$timezone:wl(),$timezone_offset:Hl()}),{$current_url:Pl(n?ts(null==Kt?void 0:Kt.href):null==Kt?void 0:Kt.href,u,Cl),$host:null==Kt?void 0:Kt.host,$pathname:null==Kt?void 0:Kt.pathname,$raw_user_agent:Qt.length>1e3?Qt.substring(0,997)+"...":Qt,$browser_version:Le(Qt,navigator.vendor,f,p),$browser_language:Nl(),$browser_language_prefix:Ll(),$screen_height:null==qt?void 0:qt.screen.height,$screen_width:null==qt?void 0:qt.screen.width,$viewport_height:null==qt?void 0:qt.innerHeight,$viewport_width:null==qt?void 0:qt.innerWidth,$lib:i.LIB_NAME,$lib_version:i.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return i.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=i.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:t,windowId:i}=this.sessionManager.checkAndGetSessionAndWindowId(r,s.getTime(),!0);l.$session_id=t,l.$window_id=i}this.sessionPropsManager&&Ar(l,this.sessionPropsManager.getSessionProps());try{var u;if(this.sessionRecording){const i=this.sessionRecording.sdkDebugProperties,e=!this.Ch&&mh(t);for(const t in i)(e||oi(gh,t))&&(l[t]=i[t])}l.$sdk_debug_retry_queue_size=null===(u=this.Dh)||void 0===u?void 0:u.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}let h;if(this.requestRouter.region===Du&&(l.$lib_custom_api_host=this.config.api_host),h="$pageview"!==t||r?"$pageleave"!==t||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,n),l=Ar(l,h),"$pageview"===t&&Gt&&(l.title=Gt.title),!_i(o)){const t=s.getTime()-o;l.$duration=parseFloat((t/1e3).toFixed(3))}Qt&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");const c=this.persistence.properties(),d=this.sessionPersistence.properties(),v=l.$groups,f=c.$groups;pi(v)&&!gi(v)&&(l.$groups=as(as({},pi(f)?f:{}),v)),Rr(["$referrer","$referring_domain"],t=>{t in c&&delete d[t]});const p={};if(this.$h.length>0)for(const t of this.$h.slice())try{Ar(p,t())}catch(t){Tr.error("Failed to produce browser extension event properties",t)}l=Ar({},a,c,d,as(as({},p),l)),l.$is_identified=this._isIdentified(),vi(this.config.property_denylist)?Rr(this.config.property_denylist,function(t){delete l[t]}):Tr.error(ph+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const g=this.config.sanitize_properties;g&&(Tr.error(fh),l=g(l,t));const _=this.pd();return l.$process_person_profile=_,_&&!r&&this.gd("_calculate_event_properties"),l}dd(t,i=!0,e=!1){var s;if(!this.persistence||!this.pd())return t;if(this.kh&&!e)return t;const n=this.persistence.get_initial_props(),r=null===(s=this.sessionPropsManager)||void 0===s?void 0:s.getSetOnceProps();let o=Ar({},n,r||{},t||{});const l=this.config.sanitize_properties;return l&&(Tr.error(fh),o=l(o,"$set_once")),i&&(this.kh=!0),gi(o)?void 0:o}register(t,i){var e;null===(e=this.persistence)||void 0===e||e.register(t,i)}register_once(t,i,e){var s;null===(s=this.persistence)||void 0===s||s.register_once(t,i,e)}register_for_session(t){var i,e;null===(i=this.persistence)||void 0===i||i.syncCookieProperties(),this.Bh(),null===(e=this.sessionPersistence)||void 0===e||e.register(t),Object.keys(t).forEach(t=>this.Sh.add(t)),this.fd()}unregister(t){var i;null===(i=this.persistence)||void 0===i||i.unregister(t)}unregister_for_session(t){var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t),this.Sh.delete(t),this.fd()}md(t,i){this.register({[t]:i})}Lh(){this.Sh.forEach(t=>{var i;null===(i=this.sessionPersistence)||void 0===i||i.unregister(t)}),this.Sh.clear(),this.fd()}fd(){var t;if(!this.xh)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.fi)||!po.Ot())return void po.Dt(this.xh);const i=[];this.Sh.forEach(t=>i.push(t)),i.length>0?po.$t(this.xh,i):po.Dt(this.xh)}getFeatureFlag(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null===(i=this.featureFlags)||void 0===i?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,s;return null!==(e=null===(s=this.featureFlags)||void 0===s?void 0:s.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var s;null===(s=this.featureFlags)||void 0===s||s.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i=!1,e){var s;return null===(s=this.featureFlags)||void 0===s?void 0:s.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.dr.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:vh}),()=>{})}onSessionId(t){var i,e;return null!==(i=null===(e=this.sessionManager)||void 0===e?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i=!1){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:vh})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:vh})}onActiveMatchingSurveysChanged(t){return this.surveys?this.surveys.onActiveMatchingSurveysChanged(t):(t([],{isLoaded:!1,error:vh}),()=>{})}renderSurvey(t,i){var e;null===(e=this.surveys)||void 0===e||e.renderSurvey(t,i)}displaySurvey(t,i=qu){var e;null===(e=this.surveys)||void 0===e||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null===(i=this.surveys)||void 0===i||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null===(e=this.surveys)||void 0===e?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:vh}}canRenderSurveyAsync(t,i=!1){var e,s;return null!==(e=null===(s=this.surveys)||void 0===s?void 0:s.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:vh})}yd(t){return!t||yi(t)?(Tr.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Tr.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())||(Tr.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 Tr.uninitializedWarning("posthog.identify");if($i(t)&&(t=t.toString(),Tr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.yd(t))return;if(!this.gd("posthog.identify"))return;this.ph();const s=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==s,r=this.Bh(!1),o=this.persistence.Cu();let l=!1;try{const s=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),t!==s&&t!==this.get_property("__alias")&&(this.unregister(A),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Dt,u=t!==s,h=!u&&o;if(u&&o){var a;const n=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:s};this.persistence.set_property(pt,Nt),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Tu(),this.capture("$identify",n,{$set:i||{},$set_once:e||{}})&&(this.Mh=Fu(t,i,e)),null===(a=this.featureFlags)||void 0===a||a.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:s)}else if(h){this.persistence.set_property(pt,Nt);const s=i||{},n=e||{};this.setPersonPropertiesForFlags({$set:s,$set_once:n},!1),this.config.cookieWinsOnConflict&&this.persistence.Tu(),this.capture("$set",{$set:s,$set_once:n})&&(this.Mh=Fu(t,i,e))}else(i||e)&&this.setPersonProperties(i,e);u||n||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(v)):h&&(i||e)&&this.reloadFeatureFlags(),l=!0}finally{o&&this.persistence.Mu(l)}}setPersonProperties(t,i){if(!t&&!i)return;if(!this.gd("posthog.setPersonProperties"))return;const e=Fu(this.get_distinct_id(),t,i);this.Mh!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this.Mh=e)):Tr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;const e=(vi(t)?t:[t]).filter(t=>mi(t)&&t.length>0);0!==e.length&&this.gd("posthog.unsetPersonProperties")&&(null===(i=this.featureFlags)||void 0===i||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Mh=null)}group(t,i,e){var s;if(!t||!i)return void Tr.error("posthog.group requires a group type and group key");null===(s=this.persistence)||void 0===s||s.syncCookieProperties(),this.Bh();const n=this.getGroups(),r=n[t]!==i;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:as(as({},n),{},{[t]:i})}),(r||e)&&this.pd()){const s={$group_type:t,$group_key:i};e&&(s.$group_set=e),this.capture(Ht,s)}e&&this.setGroupPropertiesForFlags({[t]:e}),r&&!e&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i=!0){var e;null===(e=this.featureFlags)||void 0===e||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t=!0){var i;null===(i=this.featureFlags)||void 0===i||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i=!0){var e;this.gd("posthog.setGroupPropertiesForFlags")&&(null===(e=this.featureFlags)||void 0===e||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null===(i=this.featureFlags)||void 0===i||i.resetGroupPropertiesForFlags(t)}reset(t){const i=Si(t)?t:null==t?void 0:t.resetDeviceID,e=Si(t)||null==t?void 0:t.bootstrap;this.bd(i,!1,e)}bd(t,i=!1,e){var s,n,r,o,l,a;if(Tr.info("reset"),!this.__loaded)return Tr.uninitializedWarning("posthog.reset");const u=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null===(s=this.Rh)||void 0===s?void 0:s.bootstrap)||{},null===(n=this.featureFlags)||void 0===n||null===(r=n.updateConfig)||void 0===r||r.call(n,this.config,this.Yu());const h=this.get_property(O),c=this.get_property(R),d=this.get_property(G);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();i||this.consent.reset(),i||!v||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const f=null===(l=this.persistence)||void 0===l||null===(a=l.Cu)||void 0===a?void 0:a.call(l),p=this.gh;this.gh=p||i;let g=!1;try{var _,m,y,b,w,x,S,E,k,T,P,A,C;if(null===(_=this.persistence)||void 0===_||_.clear(),null===(m=this.sessionPersistence)||void 0===m||m.clear(),this.Sh.clear(),this.fd(),_i(d)||null===(T=this.persistence)||void 0===T||T.register({$session_recording_remote_config:d}),null===(y=this.surveys)||void 0===y||y.reset(),null===(b=this.featureFlags)||void 0===b||b.reset(),null===(w=this.conversations)||void 0===w||w.reset(),null===(x=this.logs)||void 0===x||x.reset(),null===(S=this.metrics)||void 0===S||S.reset(),null===(E=this.persistence)||void 0===E||E.set_property("$user_state","anonymous"),null===(k=this.sessionManager)||void 0===k||k.resetSessionId(),this.Mh=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:$t,$device_id:null},"");else{const i=this.config.get_device_id(Gr());this.register_once({distinct_id:i,$device_id:t?i:h},""),t||_i(c)||this.register({[R]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(e.distinctID&&!this.uh()&&(null===(C=this.persistence)||void 0===C||C.set_property("$user_state",e.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:e.distinctID})),null===(P=this.featureFlags)||void 0===P||P.initialize(),!wi(u)&&!(null===(A=this.sessionManager)||void 0===A?void 0:A.setBootstrapSessionId(u,!0))){const t=as({},e);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,g=!0}finally{var I,M;this.gh=p,f&&(null===(I=this.persistence)||void 0===I||null===(M=I.Mu)||void 0===M||M.call(I,g))}var F;this.vr&&(null===(F=this.conversations)||void 0===F||F.onRemoteConfig(this.vr)),this.reloadFeatureFlags()}shutdown(t){var i=this;return Di(function*(){if(!i.__loaded)return void Tr.uninitializedWarning("posthog.shutdown");i.wh=!0,clearTimeout(i.jh),i.jh=void 0;const t=i.Gh;i.Gh=void 0;for(const e of[()=>{var t;return null===(t=i.sessionRecording)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.flushLogs("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.flush("sendBeacon")},()=>{var t;return null===(t=i.metrics)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.logs)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.surveys)||void 0===t?void 0:t.dispose()},()=>{var t;return null===(t=i.autocapture)||void 0===t?void 0:t.dispose()},()=>null==t?void 0:t(),()=>{var t;return null===(t=i.Oh)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.Dh)||void 0===t?void 0:t.unload()},()=>{var t;return null===(t=i.featureFlags)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.persistence)||void 0===t?void 0:t.destroy()},()=>{var t;return null===(t=i.sessionPersistence)||void 0===t?void 0:t.destroy()}])try{const t=e();t&&fi(t.then)&&t.then(void 0,t=>{Tr.error("Error during shutdown",t)})}catch(t){Tr.error("Error during shutdown",t)}})()}setIdentity(t,i){var e;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null===(e=this.conversations)||void 0===e||e._d()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,null===(t=this.conversations)||void 0===t||t.wd()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null===(i=this.sessionManager)||void 0===i?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let s=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if((null==t?void 0:t.withTimestamp)&&e){var n;const i=null!==(n=t.timestampLookBack)&&void 0!==n?n:10;if(!e)return s;s+=`?t=${Math.max(Math.floor(((new Date).getTime()-e)/1e3)-i,0)}`}return s}alias(t,i){return t===this.get_property("$people_distinct_id")?(Tr.critical("Attempting to create alias for existing People user - aborting."),-2):this.gd("posthog.alias")?(_i(i)&&(i=this.get_distinct_id()),t!==i?(this.md(A,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Tr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const i=as({},this.config);if(pi(t)){var s,n,r,o,l,a,u,h,c,d,v,f,p,g;Ar(this.config,Ph(t));const w=this.bh();if(this.persistence){const t="sessionStorage"===this.config.persistence||"memory"===this.config.persistence;var _,m;if(t&&this.sessionPersistence!==this.persistence&&(null===(_=this.sessionPersistence)||void 0===_||_.remove(),null===(m=this.sessionPersistence)||void 0===m||m.destroy()),this.persistence.update_config(this.config,i,w),t)this.sessionPersistence=this.persistence;else if(this.sessionPersistence===this.persistence)this.sessionPersistence=new ea(as(as({},this.config),{},{persistence:"sessionStorage"}),w,!1);else{var y;null===(y=this.sessionPersistence)||void 0===y||y.update_config(as(as({},this.config),{},{persistence:"sessionStorage"}),as(as({},i),{},{persistence:"sessionStorage"}),w)}}const x=this.Ah(this.config.debug);var b;Si(x)&&(this.config.debug=x),Si(this.config.debug)&&(this.config.debug?(e.DEBUG=!0,to.Ot()&&to.$t("ph_debug",!0),Tr.info("set_config",{config:t,oldConfig:i,newConfig:as({},this.config)})):(e.DEBUG=!1,to.Ot()&&to.Dt("ph_debug"))),null===(s=this.featureFlags)||void 0===s||null===(n=s.updateConfig)||void 0===n||n.call(s,this.config,this.Yu()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(l=this.metrics)||void 0===l||l.onConfigChange(),null===(a=this.webMCP)||void 0===a||a.startIfEnabled(),null===(u=this.sessionRecording)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.tracingHeaders)||void 0===h||h.startIfEnabledOrStop(),null===(c=this.autocapture)||void 0===c||c.startIfEnabled(),null===(d=this.heatmaps)||void 0===d||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(b=this.historyAutocapture)||void 0===b||b.startIfEnabledOrStop()),null===(v=this.exceptionObserver)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.deadClicksAutocapture)||void 0===f||f.startIfEnabledOrStop(),null===(p=this.surveys)||void 0===p||p.loadIfEnabled(),this.mh(),null===(g=this.externalIntegrations)||void 0===g||g.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&dl(this,ch,!1)}}_overrideSDKInfo(t,i){e.LIB_NAME=t,e.LIB_VERSION=i}startSessionRecording(t){const i=!0===t,e={sampling:i||!!(null==t?void 0:t.sampling),linked_flag:i||!!(null==t?void 0:t.linked_flag),url_trigger:i||!!(null==t?void 0:t.url_trigger),event_trigger:i||!!(null==t?void 0:t.event_trigger)};var s,n,r,o,l;Object.values(e).some(Boolean)&&(null===(s=this.sessionManager)||void 0===s||s.checkAndGetSessionAndWindowId(),e.sampling&&(null===(n=this.sessionRecording)||void 0===n||n.overrideSampling()),e.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),e.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),e.event_trigger&&(null===(l=this.sessionRecording)||void 0===l||l.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(null===(t=this.sessionRecording)||void 0===t?void 0:t.started)}captureException(t,i){try{if(!this.exceptions)return;const e=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(as(as({},e),i))}catch(t){return}}addExceptionStep(t,i){var e;null===(e=this.exceptions)||void 0===e||e.addExceptionStep(t,i)}captureLog(t){var i;null===(i=this.logs)||void 0===i||i.captureLog(t)}get logger(){var i,e;return null!==(i=null===(e=this.logs)||void 0===e?void 0:e.logger)&&void 0!==i?i:t.kd}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null===(e=this.toolbar)||void 0===e?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null===(i=this.persistence)||void 0===i?void 0:i.props[t]}getSessionProperty(t){var i;return null===(i=this.sessionPersistence)||void 0===i?void 0:i.props[t]}toString(){var t;let i=null!==(t=this.config.name)&&void 0!==t?t:xh;return i!==xh&&(i="posthog."+i),i}_isIdentified(){var t,i;return"identified"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))||"identified"===(null===(i=this.sessionPersistence)||void 0===i?void 0:i.get_property("$user_state"))}pd(){var t,i;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&gi(this.getGroups())&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.__alias)&&!(null===(i=this.persistence)||void 0===i||null===(i=i.props)||void 0===i?void 0:i.$epp))}Xh(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.pd()||this.gd("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.gd("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}gd(t){return"never"===this.config.person_profiles?(Tr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.hh(),this.md(wt,!0),!0)}bh(){if("always"===this.config.cookieless_mode)return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&"on_reject"!==this.config.cookieless_mode)}mh(){var t,i;const e=this.bh();var s,n,r;return this.is_capturing()||null===(s=this.logs)||void 0===s||s.Sd(),(null===(t=this.persistence)||void 0===t?void 0:t.fi)!==e&&(null===(n=this.persistence)||void 0===n||n.set_disabled(e)),(null===(i=this.sessionPersistence)||void 0===i?void 0:i.fi)!==e&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(e)),this.fd(),e}opt_in_capturing(i){var e;if("always"!==this.config.cookieless_mode){if(this.uh()){var s,n,r,o,l,a;null===(s=this.sessionRecording)||void 0===s||s.dispose({discardBufferedEvents:!0}),this.bd(!0,!0),null===(n=this.sessionManager)||void 0===n||n.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new Eu(this),this.pageViewManager=new gl(this),this.persistence&&(this.sessionPropsManager=new wu(this,this.sessionManager,this.persistence));const i=null!==(o=null===(l=this.config.__extensionClasses)||void 0===l?void 0:l.sessionRecording)&&void 0!==o?o:null===(a=t.__defaultExtensionClasses)||void 0===a?void 0:a.sessionRecording;var u,h;i&&(this.sessionRecording=this.ah(this.sessionRecording,new i(this)),this.vr&&(null===(u=this.sessionRecording)||void 0===u||null===(h=u.onRemoteConfig)||void 0===h||h.call(u,this.vr)))}var c,d,v;this.consent.optInOut(!0),this.mh(),this.Zh(),null===(e=this.sessionRecording)||void 0===e||e.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(c=this.surveys)||void 0===c||c.loadIfEnabled(),null===(d=this.conversations)||void 0===d||d.loadIfEnabled()),(_i(null==i?void 0:i.captureEventName)||(null==i?void 0:i.captureEventName))&&this.capture(null!==(v=null==i?void 0:i.captureEventName)&&void 0!==v?v:"$opt_in",null==i?void 0:i.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Kh()}else Tr.warn(dh)}opt_out_capturing(){"always"!==this.config.cookieless_mode?(this.consent.optInOut(!1),this.mh(),"on_reject"===this.config.cookieless_mode&&this.yh()):Tr.warn(dh)}yh(){var t,i;const e=this.sessionRecording;null==e||e.dispose({discardBufferedEvents:!0}),"$posthog_cookieless"!==this.get_distinct_id()&&this.bd(!0,!0),this.register({distinct_id:$t,$device_id:null}),this.rh(e),this.sessionRecording=void 0,null===(t=this.sessionManager)||void 0===t||t.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Kh(),this.Zh()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return!this.gh&&("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.mh()}_is_bot(){return Vt?Tu(Vt,this.config.custom_blocked_useragents):void 0}Kh(){Gt&&("visible"===Gt.visibilityState?this.Th||(this.Th=!0,this.capture(Ut,{title:Gt.title},{send_instantly:!0}),this.Ih&&(Gt.removeEventListener(m,this.Ih),this.Ih=null)):this.Ih||(this.Ih=this.Kh.bind(this),Lr(Gt,m,this.Ih)))}debug(t){!1===t?(null==qt||qt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==qt||qt.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}))}Yu(){const t=this.Rh||{};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?(Tr.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):function(t,i,e,s,n){const r=i in t&&!wi(t[i]),o=e in t&&!wi(t[e]);return r?t[i]:!!o&&(n&&n.warn(`Config field '${e}' is deprecated. Please use '${i}' instead. The old field will be removed in a future major version.`),t[e])}(t,"advanced_disable_flags","advanced_disable_decide",0,Tr)}Fs(t){var i;if(wi(this.config.before_send))return t;const e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(ki),s=vi(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=t;for(const i of s)try{if(n=i(n),wi(n)){const i=`Event '${t.event}' was rejected in beforeSend function`;return Ei(t.event)?Tr.warn(`${i}. This can cause unexpected behavior.`):Tr.info(i),null}n.properties&&!gi(n.properties)||Tr.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(i){return Tr.error(`Error in beforeSend function for event '${t.event}':`,i),null}for(const i of e)if(n.properties&&wi(n.properties[i]))return Tr.warn(`Event '${t.event}' had its '${i}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return n}getPageViewId(){var t;return null===(t=this.pageViewManager.Dl)||void 0===t?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Ah(t){const i=Si(t)&&!t,e=to.Ot()&&"true"===to.Lt("ph_debug");return!i&&(!!e||t)}};Rh.__defaultExtensionClasses={},Rh.kd=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(let e=0;i.length>e;e++)t.prototype[i[e]]=Ir(t.prototype[i[e]])}(Rh,["identify"]);const Ah=["[data-ph-capture-value]"];var Ch=class{constructor(t){this._instance=t}refresh(t){var i;const e=this._instance.config,s=pi(e.autocapture)?e.autocapture:void 0;t.enabled=!!e.autocapture,t.rageclick=e.rageclick,t.maskAllElementAttributes=e.mask_all_element_attributes,t.maskAllText=e.mask_all_text,t.disableCaptureUrlHashes=e.disable_capture_url_hashes,t.getCurrentUrl=e.get_current_url,t.remoteRequestsDisabled=this._instance.Yu(),t.url_allowlist=null==s?void 0:s.url_allowlist,t.url_ignorelist=null==s?void 0:s.url_ignorelist,t.dom_event_allowlist=null==s?void 0:s.dom_event_allowlist,t.element_allowlist=null==s?void 0:s.element_allowlist,t.css_selector_allowlist=null==s?void 0:s.css_selector_allowlist,t.css_selector_ignorelist=null==s?void 0:s.css_selector_ignorelist,t.element_attribute_ignorelist=null==s?void 0:s.element_attribute_ignorelist,t.capture_copied_text=null==s?void 0:s.capture_copied_text,t.capture_value_css_selector_allowlist=null!==(i=null==s?void 0:s.capture_value_css_selector_allowlist)&&void 0!==i?i:Ah}};const Ih=Pr("[ExceptionAutocapture]"),Mh=()=>{},Fh=t=>{var i;if(fi(t))return null!==(i=t.__posthog_layer__)&&void 0!==i?i:t.__rrweb_layer__};function Dh(t,i,e){try{if(!(i in t))return Mh;const s={next:t[i]},n=e(function(...t){return s.next.apply(this,t)});return fi(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),t[i]=n,()=>{if(t[i]===n)return void(t[i]=s.next);let e=t[i],r=Fh(e);for(;r;){if(r.next===n)return void(r.next=s.next);e=r.next,r=Fh(e)}}}catch(t){return Mh}}const Nh=Pr("[TracingHeaders]"),Lh=Pr("[Web Vitals]"),jh=9e5,Uh=["CLS","FCP","INP","LCP"],Bh=["INP","LCP"],zh=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Hh="disabled",qh="lazy_loading",Wh=Pr("[SessionRecording]"),Vh=[kt,Tt,Pt,Ot,Rt,At,Ct,It,Mt],Gh=Pr("[Heatmaps]");function Kh(t){return pi(t)&&"clientX"in t&&"clientY"in t&&$i(t.clientX)&&$i(t.clientY)}const Yh=Pr("[Product Tours]"),Jh=t=>{var i;return!t.config.disable_product_tours&&!!(null===(i=t.persistence)||void 0===i?void 0:i.get_property(q))},Xh=["$set_once","$set"],Zh=Pr("[SiteApps]"),Qh="Error while initializing PostHog app with config id ";function tc(t,i,e){if(wi(t))return!1;switch(e){case"exact":return t===i;case"contains":{const e=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(e,"i").test(t)}case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}var ic=class{constructor(t){this.$i=t,this.So=new Set,this.xo=new Set,this.$o=new $u,this.Co=(t,i)=>this.To(t,i)&&this.Io(t,i)&&this.Eo(t,i)&&this.Mo(t,i),this.To=(t,i)=>!(null==i?void 0:i.event)||(null==t?void 0:t.event)===(null==i?void 0:i.event)}init(){var t,i;_i(null===(t=this.$i)||void 0===t?void 0:t.subscribeCapture)||(this.Ao=null===(i=this.$i)||void 0===i?void 0:i.subscribeCapture((t,i)=>{this.on(t,i)}))}dispose(){var t,i,e;null===(t=this.Ao)||void 0===t||t.call(this),this.Ao=void 0,null===(i=this.$i)||void 0===i||null===(e=i.setElementSelectors)||void 0===e||e.call(i,new Set,this),this.$o=new $u}register(t){var i,e;if(!_i(null===(i=this.$i)||void 0===i?void 0:i.subscribeCapture)&&(t.forEach(t=>{var i;this.So.add(t),null===(i=t.steps)||void 0===i||i.forEach(t=>{this.xo.add((null==t?void 0:t.event)||"")})}),null===(e=this.$i)||void 0===e?void 0:e.setElementSelectors)){const t=new Set;this.So.forEach(i=>{var e;null===(e=i.steps)||void 0===e||e.forEach(i=>{(null==i?void 0:i.selector)&&t.add(i.selector)})}),this.$i.setElementSelectors(t,this)}}replace(t){this.So.clear(),this.xo.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.xo.has(t)||this.xo.has(i.event))&&this.So.forEach(t=>{this.Ro(i,t)&&this.$o.emit("actionCaptured",t.name)})}Po(t){this.onAction("actionCaptured",i=>t(i))}Ro(t,i){if(null==(null==i?void 0:i.steps))return!1;for(const e of i.steps)if(this.Co(t,e))return!0;return!1}onAction(t,i){return this.$o.on(t,i)}Io(t,i){if(null==i?void 0:i.url){var e;let r=null==t||null===(e=t.properties)||void 0===e?void 0:e.$current_url;if(!(null==t?void 0:t.properties)||!("$current_url"in t.properties))try{var s,n;r=null===(s=this.$i)||void 0===s||null===(n=s.getActionUrl)||void 0===n?void 0:n.call(s)}catch(t){return!1}if(!r||"string"!=typeof r)return!1;if(!tc(r,i.url,i.url_matching||"contains"))return!1}return!0}Eo(t,i){return!!this.Oo(t,i)&&!!this.Fo(t,i)&&!!this.Do(t,i)}Oo(t,i){var e;if(!(null==i?void 0:i.href))return!0;const s=this.Lo(t);if(s.length>0)return s.some(t=>tc(t.href,i.href,i.href_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return!!n&&tc(function(t){const i=t.match(/(?::|")href="(.*?)"/);return i?i[1]:""}(n),i.href,i.href_matching||"exact")}Fo(t,i){var e;if(!(null==i?void 0:i.text))return!0;const s=this.Lo(t);if(s.length>0)return s.some(t=>tc(t.text,i.text,i.text_matching||"exact")||tc(t.$el_text,i.text,i.text_matching||"exact"));const n=(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements_chain)||"";return!!n&&(r=function(t){const i=[],e=/(?::|")text="(.*?)"/g;let s;for(;!wi(s=e.exec(t));)i.includes(s[1])||i.push(s[1]);return i}(n),o=i.text,l=i.text_matching||"exact",r.some(t=>tc(t,o,l)));var r,o,l}Do(t,i){var e,s;if(!(null==i?void 0:i.selector))return!0;const n=null==t||null===(e=t.properties)||void 0===e?void 0:e.$element_selectors;if(null==n?void 0:n.includes(i.selector))return!0;const r=(null==t||null===(s=t.properties)||void 0===s?void 0:s.$elements_chain)||"";if(i.selector_regex&&r)try{return new RegExp(i.selector_regex).test(r)}catch(t){}return!1}Lo(t){var i;return null==(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Mo(t,i){return!(null==i?void 0:i.properties)||0===i.properties.length||Mu(i.properties.reduce((t,i)=>{const e=vi(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)}},ec=class{constructor(t,i){this.No=i,this.jo=[],this.$i=t,this.qo=new Map,this.Bo=new Map,this.zo=new Map}Ho(){var t,i;this.Uo=null===(t=(i=this.$i).subscribeSession)||void 0===t?void 0:t.call(i,t=>this.Wo(t))}Vo(t){return!1}Go(){return null}Qo(t){}Jo(){}Zo(t,i){return!!t&&Mu(t.propertyFilters,null==i?void 0:i.properties)}Ko(t,i){const e=new Map;return t.forEach(t=>{var s;null===(s=t.conditions)||void 0===s||null===(s=s[i])||void 0===s||null===(s=s.values)||void 0===s||s.forEach(i=>{if(null==i?void 0:i.name){const s=e.get(i.name)||[];s.push(t.id),e.set(i.name,s)}})}),e}Yo(t,i,e){const s=(e===na.Activation?this.qo:this.Bo).get(t);let n=[];return this.Xo(t=>{n=t.filter(t=>null==s?void 0:s.includes(t.id))}),n.filter(s=>{var n;const r=null===(n=s.conditions)||void 0===n||null===(n=n[e])||void 0===n||null===(n=n.values)||void 0===n?void 0:n.find(i=>i.name===t);return this.Zo(r,i)})}register(t){this.ta(t,!1)}replace(t){this.ta(t,!0)}ta(t,i){_i(this.$i.subscribeCapture)||(this.ea(t,i),this.ia(t,i))}ia(t,i){const e=t.filter(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length});var s;if(i&&this.zo.clear(),0===e.length)return void(i&&(null===(s=this.na)||void 0===s||s.replace([])));this.na||(this.na=new ic(this.$i),this.na.init(),this.na.Po(t=>this.onAction(t)));const n=[];e.forEach(t=>{var i;null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||i.values.forEach(i=>{if(n.push(i),i.name){var e;const s=null!==(e=this.zo.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.zo.set(i.name,s)}})}),i?this.na.replace(n):this.na.register(n)}sa(t,i){i.forEach((i,e)=>{var s;const n=null!==(s=t.get(e))&&void 0!==s?s:[];i.forEach(t=>{n.includes(t)||n.push(t)}),t.set(e,n)})}ea(t,i){var e,s,n;const r=t.filter(t=>{var i,e;return(null===(i=t.conditions)||void 0===i?void 0:i.events)&&(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),o=t.filter(t=>{var i,e;return(null===(i=t.conditions)||void 0===i?void 0:i.cancelEvents)&&(null===(e=t.conditions)||void 0===e||null===(e=e.cancelEvents)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)>0}),l=this.Ko(t,na.Activation),a=this.Ko(t,na.Cancellation);i?(this.qo=l,this.Bo=a):(this.sa(this.qo,l),this.sa(this.Bo,a)),(0!==r.length||0!==o.length||t.some(t=>{var i;return null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length}))&&(null!==(e=this.Ao)&&void 0!==e||(this.Ao=null===(s=(n=this.$i).subscribeCapture)||void 0===s?void 0:s.call(n,(t,i)=>{this.onEvent(t,i)})))}onEvent(t,i){var e,s;const n=this.ra(),r=(null==i||null===(e=i.properties)||void 0===e?void 0:e.$survey_id)||(null==i||null===(s=i.properties)||void 0===s?void 0:s.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const e=this.oa(t,r,i);if("consume"===e)return n.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.aa([r]);if("persist"===e)return n.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.la(r),void this.ua([r])}if(this.Bo.has(t)){const e=this.Yo(t,i,na.Cancellation);e.length>0&&(n.info("cancel event matched, cancelling items",{event:t,itemsToCancel:e.map(t=>t.id)}),this.aa(e.map(t=>t.id)),e.forEach(t=>this.ca(t.id)))}if(!this.qo.has(t))return;n.info("event name matched",{event:t,eventPayload:i,items:this.qo.get(t)});const o=this.Yo(t,i,na.Activation);this.ha(o.map(t=>t.id))}onAction(t){this.zo.has(t)&&this.ha(this.zo.get(t)||[])}ha(t){if(0===t.length)return;const i=!!this.$i.getSessionId(),e=[];for(const s of t)i&&this.Vo(s)?this.la(s)&&this.da(s):e.push(s);e.length>0&&(this.jo=[...new Set([...this.jo,...e])]),this.ra().info("updating activated items",{activatedItems:this.getActivatedIds()}),this.va()}la(t){this.jo=this.jo.filter(i=>i!==t);const i=this.fa();return!i.includes(t)&&(this.pa([...i,t]),this.ga(),!0)}aa(t){const i=new Set(t);this.jo=this.jo.filter(t=>!i.has(t));const e=this.ma(),s=e.filter(t=>!i.has(t));s.length!==e.length&&(this.pa(s),0===s.length&&this.ya()),this.ua(t),this.va()}va(){try{var t;null===(t=this.No)||void 0===t||t.call(this)}catch(t){this.ra().error("Error while handling activated items change",t)}}ba(){const t=this.Go();if(!t)return{};const i=this.$i.getProperty(t);return i&&"object"==typeof i?i:{}}da(t){if(!this.Go())return;const i=this.ba();this.Qo(as(as({},i),{},{[t]:Date.now()}))}ua(t){if(!this.Go())return;const i=this.ba(),e={};let s=!1;for(const[n,r]of Object.entries(i))t.includes(n)?s=!0:e[n]=r;s&&(gi(e)?this.Jo():this.Qo(e))}_a(){this.Go()&&this.Jo()}getActivationTimestamp(t){if(!this.fa().includes(t))return;const i=this.ba()[t];return $i(i)?i:void 0}ma(){const t=this.wa();return this.$i.getProperty(t)||[]}fa(){const t=this.ma();if(0===t.length)return[];const i=this.$i.getProperty(this.ka()),e=this.$i.getSessionId();return e&&i===e?t:[]}ga(){const t=this.$i.getSessionId();t&&this.Sa(t)}ya(){this.xa()}Wo(t){const i=this.$i.getProperty(this.ka());if(i&&i!==t){const t=this.ma(),i=this.ba();t.length>0&&(this.pa([]),t.filter(t=>$i(i[t])).forEach(t=>this.ca(t))),this.ya(),this._a(),t.length>0&&this.va()}}getActivatedIds(){return[...new Set([...this.fa(),...this.jo])].filter(t=>!this.$a(t))}dispose(){var t,i,e;null===(t=this.Uo)||void 0===t||t.call(this),this.Uo=void 0,null===(i=this.Ao)||void 0===i||i.call(this),this.Ao=void 0,null===(e=this.na)||void 0===e||e.dispose(),this.na=void 0}reset(){this.jo=[],this.ma().length>0&&this.pa([]),this.ya(),this._a(),this.va()}getEventToItemsMap(){return this.qo}Ca(){return this.na}},sc=class extends ec{constructor(t,i,e,s){var n;super({subscribeCapture(i){const e=t.onEvent(t=>i(t.event,t));return()=>e.dispose()},subscribeSession(i){const e=t.onSession(i);return()=>e.dispose()},getSessionId(){var i;return null===(i=t.session)||void 0===i?void 0:i.sessionId},getProperty:i=>t.kv.get(i),getActionUrl:null==e?void 0:e.getActionUrl,setElementSelectors:null!==(n=null==e?void 0:e.setElementSelectors)&&void 0!==n?n:(i,e)=>{var s;return null===(s=t.getExtension("autocapture"))||void 0===s?void 0:s.setElementSelectors(i,e)}},s),this.Ta=t,this.Ia=i,this.Ho()}wa(){return S}ka(){return E}Go(){return k}Qo(t){this.Ta.kv.set({[k]:t})}Jo(){this.Ta.kv.remove(k)}Vo(t){var i;let e;this.Xo(i=>{e=i.find(i=>i.id===t)});const s=null==e||null===(i=e.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds;return $i(s)&&s>0}Ea(){return oa.SHOWN}Xo(t){this.Ia.getSurveys(t)}ca(t){this.Ia.cancelPendingSurvey(t)}ra(){return Bu}pa(t){this.Ta.kv.set({[S]:t})}Sa(t){this.Ta.kv.set({[E]:t})}xa(){this.Ta.kv.remove(E)}$a(){return!1}oa(t,i,e){var s;if(t===oa.SENT&&!1===(null==e||null===(s=e.properties)||void 0===s?void 0:s.$survey_completed))return"ignore";let n;return this.Xo(t=>{n=t.find(t=>t.id===i)}),!n||function(t){var i;return Ru(t)&&!!(null===(i=t.conditions)||void 0===i||null===(i=i.events)||void 0===i?void 0:i.repeatedActivation)||"always"===t.schedule}(n)?t===oa.SHOWN?"consume":"ignore":t===oa.SHOWN?"persist":t===oa.DISMISSED||t===oa.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}};const nc=(t,i)=>(null==t?void 0:t.then)?t.then(i):i(t),rc="SDK is not enabled or survey functionality is not yet loaded",oc="Disabled. Not loading surveys.";var lc=class{constructor(t){this.Ma=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Aa=!1,this.Ra=!1,this.Pa=[],this.Oa=[],this.Fa=null,this.Da=null,this.Ti=!1,this.La=new Set,this.onRemoteConfig=t=>{if(this.Ti)return;if(this.Dr.disableSurveys)return;if(!t.ok)return this.Ra=!0,this.Na({isLoaded:!1,error:"Remote config unavailable. Not loading surveys."}),Bu.warn("Remote config unavailable. Not loading surveys.");const i=t.config.surveys;if(wi(i))return Bu.warn("Flags not loaded yet. Not loading surveys.");this.ja=Si(i)?i:i.length>0,Bu.info(`flags response received, isSurveysEnabled: ${this.ja}`),this.loadIfEnabled()},this.Na=t=>{this.Oa.slice().forEach(i=>this.qa(i,t))}}setup(t){if(!this.Ti)return this.Ba=t,nc(t.kv.initialize(),()=>{if(this.Ba!==t||this.Ti)return;this.Ba=void 0,this.Ta=t;const i=t.onRemoteConfig(this.onRemoteConfig);this.Ti?i.dispose():(this.za=i,this.loadIfEnabled())})}dispose(){var t,i,e,s,n;this.Ti||(this.Ti=!0,this.Ba=void 0,this.Ta=void 0,null===(t=this.za)||void 0===t||t.dispose(),this.za=void 0,null===(i=this._surveyEventReceiver)||void 0===i||i.dispose(),this._surveyEventReceiver=null,null===(e=this._surveyManager)||void 0===e||null===(s=e.dispose)||void 0===s||s.call(e),this._surveyManager=null,this.Pa=[],this.Oa.forEach(t=>{t.active=!1}),this.Oa=[],null===(n=this.Ha)||void 0===n||n.call(this),this.Ha=void 0,this.Fa=null,this.La.forEach(t=>clearTimeout(t)),this.La.clear())}get Dr(){return this.Ma.get()}getRenderContext(){if(!this.Ta)return;const t=this;return{client:this.Ta,get config(){return t.Dr},surveys:t}}initialize(){this.loadIfEnabled()}reset(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.clearInMemoryInProgressSurveyState)||void 0===i||i.call(t);try{var e;null===(e=this._surveyEventReceiver)||void 0===e||e.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let i=0;i<localStorage.length;i++){const e=localStorage.key(i);((null==e?void 0:e.startsWith("seenSurvey_"))||(null==e?void 0:e.startsWith("inProgressSurvey_")))&&t.push(e)}t.forEach(t=>localStorage.removeItem(t))}catch(t){}this.Na()}loadIfEnabled(){if(this.Ti||!this.Ta)return;const t=this.Dr;if(this._surveyManager)return;if(this.Aa)return void Bu.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Bu.info(oc);if(t.cookielessMode&&this.Ta.isOptedOut)return void Bu.info("Not loading surveys in cookieless mode without consent.");const i=this.Ma.getExtensions();if(!i)return void this.Ua("PostHog Extensions not found.");if(_i(this.ja)&&!t.advancedEnableSurveys)return;const e=this.ja||t.advancedEnableSurveys;this.Aa=!0,this.Ra=!1;try{const t=i.generateSurveys;if(t)return this.Wa(t,e),void(this.Aa=!1);const s=i.loadExternalDependency;if(!s)return this.Ua(x),void(this.Aa=!1);s(t=>{try{if(this.Ti)return;const i=this.Ma.getExtensions();t||!(null==i?void 0:i.generateSurveys)?this.Ua("Could not load surveys script",t):this.Wa(i.generateSurveys,e)}finally{this.Aa=!1}})}catch(t){throw this.Aa=!1,this.Ua("Error initializing surveys",t),t}}Wa(t,i){var e;if(this.Ti)return;this._surveyManager=t(i),this._surveyEventReceiver=this.Va(this.Ta,this.Na);const s=null===(e=this.Ta)||void 0===e?void 0:e.kv.get(b);s&&this.Ga(s),Bu.info("Surveys loaded successfully"),this.Qa(),this.Na(),this.Ja({isLoaded:!0})}Va(t,i){return new sc(t,this,void 0,i)}Ua(t,i){this.Ra=!0,Bu.error(t,i),this.Na({isLoaded:!1,error:t}),this.Ja({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Pa.push(t),this._surveyManager&&this.Ja({isLoaded:!0}),()=>{this.Pa=this.Pa.filter(i=>i!==t)}}getSurveys(t,i=!1){if(this.Ti)return;const e=this.Ta;if(!e)return t([],{isLoaded:!1,error:rc});if(this.Dr.disableSurveys)return Bu.info(oc),t([]);const s=e.kv.get(b);if(s&&!i)return t(s,{isLoaded:!0}),void(this.Za()&&this.getSurveys(()=>{},!0));if(this.Fa)return void this.Fa.then(({surveys:i,context:e})=>{this.Ti||t(i,e)}).catch(t=>Bu.error("Error in survey callback",t));const n=e.sendRequest("/api/surveys/",{method:"GET",query:{token:e.projectToken},sentAt:"query",timeoutMs:this.Dr.requestTimeoutMs}).then(t=>{try{return this.Ka(e,t)}catch(t){return Bu.error("Error processing surveys response",t),this.Ka(e,{statusCode:0,error:t})}},t=>this.Ka(e,{statusCode:0,error:t}));this.Fa=n;const r=()=>{this.Fa===n&&(this.Fa=null)};n.then(i=>{r(),this.Ti||(this.Na(i.context),t(i.surveys,i.context))},r).catch(t=>Bu.error("Error in survey callback",t))}Ka(t,i){if(this.Ti)return{surveys:[],context:{isLoaded:!1,error:rc}};const e=i.statusCode;if(200!==e||!i.json){const t=`Surveys API could not be loaded, status: ${e}`;return 0!==e?Bu.error(t):i.error||Bu.warn(t),this.Da=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.Da=null;const s=i.json.surveys||[];return t.kv.set({[b]:s,[w]:Date.now()}),this.Ga(s),{surveys:s,context:{isLoaded:!0}}}Ga(t){const i=t.filter(t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Ru(t)||function(t){var i;return!!(null===(i=t.conditions)||void 0===i||null===(i=i.actions)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)}(t)));this.Ya(i)}Ya(t){var i;null===(i=this._surveyEventReceiver)||void 0===i||i.replace(t)}Za(){return this.Xa()&&!this.Fa&&!this.tl()}Xa(){var t;const i=null===(t=this.Ta)||void 0===t?void 0:t.kv.get(w);return $i(i)&&Date.now()-i>3e5}tl(){return $i(this.Da)&&3e5>Date.now()-this.Da}markSurveyAsSeen(t,i){var e;const s={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};zu(s);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}this.Na()}Ja(t){for(const i of this.Pa){if(this.Ti)return;try{t.isLoaded?this.getSurveys(i):i([],t)}catch(t){Bu.error("Error in survey callback",t)}}}getActiveMatchingSurveys(t,i=!1){if(!wi(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Bu.warn("init was not called")}onActiveMatchingSurveysChanged(t){var i;if(this.Ti)return()=>{};const e={callback:t,active:!0,revision:0};this.Oa.push(e),this.Qa();const s=null===(i=this.Ta)||void 0===i?void 0:i.kv.get(b);return this.Dr.disableSurveys||!this._surveyManager&&this.Ra&&!this.Aa||!s&&!wi(this.Da)&&!this.Fa?this.qa(e,{isLoaded:!1}):this._surveyManager&&this.qa(e),()=>{var t;e.active=!1,this.Oa=this.Oa.filter(t=>t!==e),0===this.Oa.length&&(null===(t=this.Ha)||void 0===t||t.call(this),this.Ha=void 0)}}Qa(){var t,i,e;this._surveyManager&&this.Oa.length>0&&(null!==(t=this.Ha)&&void 0!==t||(this.Ha=null===(i=(e=this.Ma).onMatchingConditionsChanged)||void 0===i?void 0:i.call(e,this.Na)))}qa(t,i){if(this.Ti||!t.active)return;const e=++t.revision,s=s=>{if(!this.Ti&&t.active&&e===t.revision)try{const e=null!=i?i:{isLoaded:!0},n=JSON.stringify([s,e]);if(n===t.lastResult)return;t.lastResult=n,t.callback(s,e)}catch(t){Bu.error("Error in active matching surveys callback",t)}};try{i&&!i.isLoaded?s([]):this.getActiveMatchingSurveys(s)}catch(t){Bu.error("Error in active matching surveys callback",t)}}el(t){let i=null;return this.getSurveys(e=>{var s;i=null!==(s=e.find(i=>i.id===t))&&void 0!==s?s:null}),i}il(t){if(wi(this._surveyManager))return{eligible:!1,reason:rc};const i="string"==typeof t?this.el(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}nl(t){var i;if(!(null===(i=this.Ta)||void 0===i?void 0:i.canCapture))return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(wi(this._surveyManager))return{eligible:!1,reason:rc};const e="string"==typeof t?this.el(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(wi(this._surveyManager))return Bu.warn("init was not called"),{visible:!1,disabledReason:rc};const i=this.nl(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return wi(this._surveyManager)?(Bu.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:rc})):new Promise(e=>{this.getSurveys(i=>{var s;const n=null!==(s=i.find(i=>i.id===t))&&void 0!==s?s:null;if(n){const t=this.nl(n);e({visible:t.eligible,disabledReason:t.reason})}else e({visible:!1,disabledReason:"Survey not found"})},i)})}renderSurvey(t,i,e){var s,n,r;if(!(null===(s=this.Ta)||void 0===s?void 0:s.canCapture))return;if(wi(this._surveyManager))return void Bu.warn("init was not called");const o="string"==typeof t?this.el(t):t;if(!(null==o?void 0:o.id))return void Bu.warn("Survey not found");if(!Hu.includes(o.type))return void Bu.warn(`Surveys of type ${o.type} cannot be rendered in the app`);const l=null===(n=typeof document>"u"?void 0:document)||void 0===n?void 0:n.querySelector(i);if(l){if(null===(r=o.appearance)||void 0===r?void 0:r.surveyPopupDelaySeconds){Bu.info(`Rendering survey ${o.id} with delay of ${o.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var i,s,n;this.La.delete(t),!this.Ti&&(null===(i=this.Ta)||void 0===i?void 0:i.canCapture)&&(Bu.info(`Rendering survey ${o.id} with delay of ${null===(s=o.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(o,l,e),Bu.info(`Survey ${o.id} rendered`))},1e3*o.appearance.surveyPopupDelaySeconds);return void this.La.add(t)}this._surveyManager.renderSurvey(o,l,e)}else Bu.warn("Survey element not found")}displaySurvey(t,i){var e,s;if(!(null===(e=this.Ta)||void 0===e?void 0:e.canCapture))return;if(wi(this._surveyManager))return void Bu.warn("init was not called");const n=this.el(t);if(!n)return void Bu.warn("Survey not found");let r=n;if((null===(s=n.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds)&&i.ignoreDelay&&(r=as(as({},n),{},{appearance:as(as({},n.appearance),{},{surveyPopupDelaySeconds:0})})),i.displayType!==aa.Popover&&i.initialResponses&&Bu.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){const t=this.il(n);if(!t.eligible)return void Bu.warn("Survey is not eligible to be displayed: ",t.reason)}i.displayType!==aa.Inline?this._surveyManager.handlePopoverSurvey(r,i):this.renderSurvey(r,i.selector,i.properties)}cancelPendingSurvey(t){wi(this._surveyManager)?Bu.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,i;null===(t=this._surveyManager)||void 0===t||null===(i=t.handlePageUnload)||void 0===i||i.call(t)}},ac=class{constructor(t){this._instance=t}get(){var t,i,e,s;const n=null===(t=this._instance)||void 0===t?void 0:t.config;return{disableSurveys:!!(null==n?void 0:n.disable_surveys),cookielessMode:!!(null==n?void 0:n.cookieless_mode),advancedEnableSurveys:!!(null==n?void 0:n.advanced_enable_surveys),requestTimeoutMs:null!==(i=null==n?void 0:n.surveys_request_timeout_ms)&&void 0!==i?i:1e4,prefillFromUrl:!!(null==n||null===(e=n.surveys)||void 0===e?void 0:e.prefillFromUrl),automaticDisplay:!(null==n?void 0:n.disable_surveys_automatic_display),featureFlagEvaluation:!(null==n?void 0:n.advanced_disable_feature_flags),overrideLanguage:null==n?void 0:n.override_display_language,prepareStylesheet:null==n?void 0:n.prepare_external_dependency_stylesheet,get_current_url:null==n?void 0:n.get_current_url,uiHost:null===(s=this._instance)||void 0===s||null===(s=s.requestRouter)||void 0===s?void 0:s.endpointFor("ui","")}}getExtensions(){const t=null==ii?void 0:ii.__PosthogExtensions__;if(!t||!this._instance)return;const i=this._instance,{generateSurveys:e,loadExternalDependency:s}=t;return{generateSurveys:e?t=>e(i,t):void 0,loadExternalDependency:s?t=>s(i,"surveys",t):void 0}}onMatchingConditionsChanged(t){var i,e;const s=null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook(i=>{"$pageview"!==i&&i!==oa.SHOWN&&i!==oa.DISMISSED&&i!==oa.SENT||t()}),n=()=>t();Lr(qt,"PHSurveyShown",n);let r=!1;const o=null===(e=this._instance)||void 0===e?void 0:e.onFeatureFlags(()=>{r&&t()});return r=!0,()=>{r=!1,null==s||s(),null==o||o(),null==qt||qt.removeEventListener("PHSurveyShown",n)}}};const uc=(null==qt?void 0:qt.location)?Ol(qt.location.hash,"__posthog")||Ol(location.hash,"state"):null,hc="_postHogToolbarParams",cc=Pr("[Toolbar]"),dc=Pr("[FeatureFlags]"),vc=Pr("[FeatureFlags]",{debugEnabled:!0}),fc="\" failed. Feature flags didn't load in time.",pc=[502,504],gc=["click","keydown","wheel","touchstart","pointerdown"],_c="connection_error",mc=t=>{const i={};for(let e=0;t.length>e;e++)i[t[e]]=!0;return i},yc=t=>{const i={};for(const[e,s]of Cr(t||{}))s&&(i[e]=s);return i};var bc=class{constructor(t){this.name="featureFlags",this.xd=!1,this.featureFlagEventHandlers=[],this.A=dc,this.$d={},this.Cd={},this.Td=[],this.Id=new Set,this.Ed=new Set,this.Md=!1,this.Ad=!1,this.Rd=0,this.Pd=!1,this.Od=!1,this.Fd=!1,this.Dd=!1,this.Ld=!1,this.Nd=0,this.jd=!1,this.sn=()=>{const t=this.qd();this.Nd=0,t&&this.reloadFeatureFlags()},this.Bd=()=>{var t,i;const e=this.zd,s=null!==(t=this.Hd)&&void 0!==t?t:e;_i(e)||_i(s)||this.Dr.remoteRequestsDisabled||!this.Ud||"hidden"===this.Ud.visibilityState||Date.now()-(null!==(i=this.Wd)&&void 0!==i?i:0)<s||(this.Hd=this.jd||!this.Dr.idleRefreshBackoff?e:Math.min(2*s,36e5),this.jd=!1,this.reloadFeatureFlags(),this.Vd())},this.Gd=()=>{this.jd&&this.Hd===this.zd||this.Qd()},this.an=()=>{var t;"visible"===(null===(t=this.Ud)||void 0===t?void 0:t.visibilityState)&&this.Qd()},this.Ma=t}get Jd(){}Zd(){this.Ta&&this.Kd()}setup(t){try{this.Yd=typeof window>"u"?void 0:window,this.Ud=typeof document>"u"?void 0:document}catch(t){this.Yd=void 0,this.Ud=void 0}return this.Ba=t,this.A=t.logger.createLogger("[FeatureFlags]"),nc(t.kv.initialize(),()=>{this.Ba===t&&(this.Ba=void 0,this.Ta=t,this.Xd(t))})}Xd(t){var i;if(this.Ta===t)return this.Yd&&Lr(this.Yd,"online",this.sn),this.Kd(),this.tv=t.registerDynamicEventProperties(()=>this.ev()?this.$d:this.Cd),this.iv=null===(i=this.Jd)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.nv(),this.sv(),this.rv()}),this.sv(),this.initialize()}Qd(){this.jd=!0,this.Hd=this.zd,this.Bd()}Kd(){var t;const i=this.Dr.refreshIntervalMs,e=!this.Dr.remoteRequestsDisabled&&this.Ud&&!_i(i)&&i>0?i:void 0;this.Dr.idleRefreshBackoff||(this.Hd=e),e!==this.zd&&(this.ov(),_i(e)||(this.zd=e,this.Hd=e,this.Vd(),(null===(t=this.Ud)||void 0===t?void 0:t.addEventListener)&&(Lr(this.Ud,m,this.an),Or(gc,t=>{Lr(this.Ud,t,this.Gd,{capture:!0})}))))}Vd(){_i(this.zd)||(_i(this.av)||clearInterval(this.av),this.Wd=Date.now(),this.av=setInterval(this.Bd,this.zd))}ov(){var t,i;_i(this.av)||(clearInterval(this.av),this.av=void 0,null===(t=this.Ud)||void 0===t||null===(i=t.removeEventListener)||void 0===i||i.call(t,"visibilitychange",this.an),Or(gc,t=>{var i,e;null===(i=this.Ud)||void 0===i||null===(e=i.removeEventListener)||void 0===e||e.call(i,t,this.Gd,{capture:!0})})),this.zd=void 0,this.Hd=void 0,this.jd=!1,this.Wd=void 0}destroy(){this.lv()}dispose(){this.lv()}lv(){var t,i,e;this.ov(),this.Rd++,this.Od=!1,this.Ba=void 0,this.uv(this.Id,"cancelled"),this.uv(this.Ed,"cancelled"),this.Ta&&(this.hv(),null===(t=this.tv)||void 0===t||t.dispose(),this.tv=void 0,null===(i=this.iv)||void 0===i||i.call(this),this.iv=void 0,this.Td=[],null===(e=this.Yd)||void 0===e||e.removeEventListener("online",this.sn),this.Ta=void 0)}get Dr(){return this.Ma.get()}dv(t){var i;return this.vv&&t in this.vv?this.vv[t]:null===(i=this.Ta)||void 0===i?void 0:i.kv.get(t)}nv(){return!!this.vv&&(this.vv=void 0,!0)}fv(){var t;return!_i(null===(t=this.Ta)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.nv()}$t(t){this.pv(()=>{var i;return null===(i=this.Ta)||void 0===i?void 0:i.kv.set(t)})}gv(t,i,e){if(!this.Jd||!t.$enabled_feature_flags)return;const s=this.dv("$enabled_feature_flags")||{},o=t.$enabled_feature_flags||{},c=i.flags||i.featureFlags,d=i.flags?Object.entries(i.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],v=!!i.errorsWhileComputingFlags&&!!i.flags,f=v?d:e&&!vi(c)?Object.keys(c||{}):Array.from(new Set([...Object.keys(s),...Object.keys(o)])),g=this.dv("$feature_flag_payloads")||{},_=t.$feature_flag_payloads||{},m=v||e?f:Array.from(new Set([...Object.keys(g),...Object.keys(_)])),y=!v&&!e,b=!!y||f,w=!!y||m,x={[n]:b,[h]:b,[p]:w};t.$feature_flag_details&&(x[r]=b);for(const i of[a,l,u])_i(t[i])||(x[i]=!0);this.Jd.markCrossTabFeatureFlagChanges(x)}Dt(t){this.pv(()=>{var i;return null===(i=this.Ta)||void 0===i?void 0:i.kv.remove(t)})}pv(t){try{t()}catch(t){this.A.error("Failed to update feature flag persistence",t)}}sv(){const t={};for(const i of[n,p,a,g]){const e=this.dv(i);_i(e)||(t[i]=e)}this.$d=t;const i=as({},t),e=this.dv(h);if(e)for(const[t,s]of Object.entries(e))i[`$feature/${t}`]=s;this.Cd=i}ev(){const t=this.Dr.cacheTtlMs;if(!t||0>=t)return!1;const i=this.dv(l);return"number"!=typeof i||Date.now()-i>t}mv(){return!!this.ev()&&(this.Ld||this.Ad||(this.Ld=!0,this.A.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}yv(){const t=this.Dr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const i=t&&"string"==typeof t&&t.trim().length>0;return i||this.A.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}bv(){const t=this.Dr.flagKeys;if(!_i(t))return t.filter(t=>{const 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;const e=this.Dr,s=null!==(t=null===(i=e.bootstrap)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(s).length){var n,r;const t=null!==(n=null===(r=e.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:{},i=Object.keys(s).filter(t=>!_i(s[t])).reduce((t,i)=>(t[i]=s[i],t),{}),o=Object.keys(t).filter(t=>i[t]).reduce((i,e)=>(i[e]=t[e],i),{});return this._v({featureFlags:i,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,i,e){var s,n;const r=(null==e?void 0:e.merge)&&null!==(s=this.dv("$enabled_feature_flags"))&&void 0!==s?s:{},o=(null==e?void 0:e.merge)&&null!==(n=this.dv("$feature_flag_payloads"))&&void 0!==n?n:{},l=as(as({},r),t),a=as(as({},o),i),u={};for(const[t,i]of Object.entries(l))u[t]={key:t,enabled:en(i),variant:sn(i),reason:void 0,metadata:_i(null==a?void 0:a[t])?void 0:{id:0,version:void 0,description:void 0,payload:a[t]}};this._v({flags:u})}get hasLoadedFlags(){return this.Md}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.dv(r),i=this.dv(g),e=this.dv(_);if(!e&&!i)return t||{};const s=Ar({},t||{}),n=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(const t of n){var o,l;const n=s[t],r=null==i?void 0:i[t],a=_i(r)?null!==(o=null==n?void 0:n.enabled)&&void 0!==o&&o:!!r,u=_i(r)?null==n?void 0:n.variant:"string"==typeof r?r:void 0,h=null==e?void 0:e[t],c=as(as({},n),{},{enabled:a,variant:a?null!=u?u:null==n?void 0:n.variant:void 0});a!==(null==n?void 0:n.enabled)&&(c.original_enabled=null==n?void 0:n.enabled),u!==(null==n?void 0:n.variant)&&(c.original_variant=null==n?void 0:n.variant),h&&(c.metadata=as(as({},null==n?void 0:n.metadata),{},{payload:h,original_payload:null==n||null===(l=n.metadata)||void 0===l?void 0:l.payload})),s[t]=c}return this.xd||(this.A.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:s}),this.xd=!0),s}getAllFeatureFlags(){const t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map(e=>{const s=t[e];return{key:e,enabled:en(s),variant:sn(s),payload:tn(i[e])}})}getFlagVariants(){const t=this.dv(h),i=this.dv(g);if(!i)return t||{};const e=Ar({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.xd||(this.A.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.xd=!0),e}getFlagPayloads(){const t=this.dv(p),i=this.dv(_);if(!i)return t||{};const e=Ar({},t||{}),s=Object.keys(i);for(let t=0;s.length>t;t++)e[s[t]]=i[s[t]];return this.xd||(this.A.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.xd=!0),e}reloadFeatureFlags(){this.Pd||this.Dr.featureFlagsDisabled||this.qd()||(this.Fd&&this.A.warn("reloadFeatureFlags() was called inside an onFeatureFlags callback. This callback also runs when flags change in other tabs, so this can cause a request loop."),this.Ad&&(this.Od=!0),this.wv||(this.Td.slice().forEach(t=>{try{t()}catch(t){this.A.error("Error while running feature flags reloading callback",t)}}),this.wv=setTimeout(()=>{this.Sv()},5)))}reloadFeatureFlagsAsync(){return!this.Ta||this.Pd||this.Dr.featureFlagsDisabled||this.Dr.remoteRequestsDisabled||this.qd()?Promise.resolve({status:"skipped"}):new Promise(t=>{this.Id.add(t),this.reloadFeatureFlags()})}uv(t,i){t.forEach(t=>t({status:i})),t.clear()}hv(){clearTimeout(this.wv),this.wv=void 0}onReloading(t){return this.Td.push(t),()=>{this.Td=this.Td.filter(i=>i!==t)}}ensureFlagsLoaded(){this.Md||this.Ad||this.wv||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Pd=t}resetFlagCallReported(){this.Dt(v)}Sv(t){var i;this.hv();const e=this.Ta;if(!e||this.Dr.remoteRequestsDisabled||this.qd())return void this.uv(this.Id,"skipped");if(this.Ad)return void(this.Od=!0);const s={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:as(as(as({},e.initialPersonProperties),this.dv("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.dv(c),timezone:wl()};_i(e.deviceId)||(s.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Dr.featureFlagsDisabled)&&(s.disable_flags=!0);const n=this.yv();n.length&&(s.evaluation_contexts=n);const r=this.bv();_i(r)||(s.flag_keys=r);const l=this.Dr.onlyEvaluateSurveyFeatureFlags,a="/flags/?v=2"+(l?"&only_evaluate_survey_feature_flags=true":""),u=this.Rd,h=this.Id;this.Id=new Set,this.Ed=h,this.Ad=!0;const d=()=>{this.Od&&(this.Od=!1,this.Sv())},v=t=>{var i,e;const n=null!==(i=t.json)&&void 0!==i?i:{},r=200!==t.statusCode;if(this.Ad=!1,u!==this.Rd)return void d();if(this.xv(t.statusCode),r||this.Od||(this.$anon_distinct_id=void 0),s.disable_flags&&!this.Od)return void this.uv(h,"skipped");this.Dd=!r;const a=[];t.error?a.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?_c:"unknown_error"):200!==t.statusCode&&a.push(`api_error_${t.statusCode}`),n.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");const c=!!(null===(e=n.quotaLimited)||void 0===e?void 0:e.includes("feature_flags"));c&&a.push("quota_limited"),this.$t({[o]:a}),c?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."):s.disable_flags||this._v(n,r,{partialResponse:l}),this.uv(h,s.disable_flags?"skipped":a.length||!n.flags&&!n.featureFlags?"error":"loaded"),d()},f=t=>{this.Ad=!1,u===this.Rd?(this.$t({[o]:[_c]}),this.A.error("Feature flag request failed",t),this.fv()&&this.rv(!0),this.uv(h,"error"),d()):d()};let p=null!==(i=this.Dr.requestMaxRetries)&&void 0!==i?i:1;const g=()=>p>0&&u===this.Rd,_=()=>{if(u!==this.Rd||!this.Ta||this.Dr.remoteRequestsDisabled)return this.Ad=!1,this.uv(h,"skipped"),void d();try{e.sendRequest(a,{target:"flags",method:"POST",body:s,compression:this.Dr.compression,sentAt:"body",timeoutMs:this.Dr.requestTimeoutMs}).then(t=>{if((t=>pc.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&g())return p--,void setTimeout(_,500);v(t)}).catch(f)}catch(t){f(t)}};_()}qd(){return Sl(this.Nd,3)}xv(t){this.Nd=El(t,this.Nd,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(i.fresh&&!this.Dd)return;if(!(this.Md||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlag for key "'+t+fc);if(this.mv())return;const s=this.getFeatureFlagResult(t,i);return null!==(e=null==s?void 0:s.variant)&&void 0!==e?e:null==s?void 0:s.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i={}){if(i.fresh&&!this.Dd)return;if(!(this.Md||this.getFlags()&&this.getFlags().length>0))return void this.A.warn('getFeatureFlagResult for key "'+t+fc);if(this.mv())return;const e=this.getFlagVariants(),s=t in e,n=e[t],r=this.getFlagPayloads()[t],o=String(n),l=this.dv("$feature_flag_request_id")||void 0,a=this.dv("$feature_flag_evaluated_at")||void 0;let u,h=this.dv("$flag_call_reported")||{};if(this.Dr.deduplicateCallsPerSession){var c;const t=null===(c=this.Ta)||void 0===c||null===(c=c.session)||void 0===c?void 0:c.sessionId,i=this.dv(f);t&&t!==i&&(h={},u=t)}if(!i.send_event&&"send_event"in i)u&&this.$t({[v]:h,[f]:u});else{var d,p;const i=null===(d=this.Ta)||void 0===d?void 0:d.canCapture;if(!i&&Object.keys(h).length>0&&(h={},this.$t({[v]:h})),i&&!(null===(p=h[t])||void 0===p?void 0:p.includes(o))){var g,_,m,y,b,w,x,S,E,k,T,P,O;vi(h[t])?h[t].push(o):h[t]=[o],this.$t(as({[v]:h},u?{[f]:u}:{}));const i=this.getFeatureFlagDetails(t),e=[...null!==(g=this.dv("$feature_flag_errors"))&&void 0!==g?g:[]];_i(n)&&e.push("flag_missing");const s={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:a,$feature_flag_bootstrapped_response:null!==(_=null===(m=this.Dr.bootstrap)||void 0===m||null===(m=m.featureFlags)||void 0===m?void 0:m[t])&&void 0!==_?_:null,$feature_flag_bootstrapped_payload:null!==(y=null===(b=this.Dr.bootstrap)||void 0===b||null===(b=b.featureFlagPayloads)||void 0===b?void 0:b[t])&&void 0!==y?y:null,$used_bootstrap_value:!this.Dd};_i(null==i||null===(w=i.metadata)||void 0===w?void 0:w.has_experiment)||(s.$feature_flag_has_experiment=i.metadata.has_experiment),_i(null==i||null===(x=i.metadata)||void 0===x?void 0:x.version)||(s.$feature_flag_version=i.metadata.version);const c=null!==(S=null==i||null===(E=i.reason)||void 0===E?void 0:E.description)&&void 0!==S?S:null==i||null===(k=i.reason)||void 0===k?void 0:k.code;c&&(s.$feature_flag_reason=c),(null==i||null===(T=i.metadata)||void 0===T?void 0:T.id)&&(s.$feature_flag_id=i.metadata.id),_i(null==i?void 0:i.original_variant)&&_i(null==i?void 0:i.original_enabled)||(s.$feature_flag_original_response=_i(i.original_variant)?i.original_enabled:i.original_variant),(null==i||null===(P=i.metadata)||void 0===P?void 0:P.original_payload)&&(s.$feature_flag_original_payload=null==i||null===(O=i.metadata)||void 0===O?void 0:O.original_payload),e.length&&(s.$feature_flag_error=e.join(",")),this.$v(s)}else u&&this.$t({[v]:h,[f]:u})}return s?{key:t,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:tn(r)}:void 0}$v(t){try{var i;null===(i=this.Ta)||void 0===i||i.capture("$feature_flag_called",t)}catch(t){this.A.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Cv(t,i)}Cv(t,i){var e=this;return Di(function*(){const s=e.Ta;if(!s)return;const n={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},r=e.yv();r.length&&(n.evaluation_contexts=r);const o=e.bv();let l;_i(o)||(n.flag_keys=o);try{var a;const i=null===(a=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:n,compression:e.Dr.compression,sentAt:"body",timeoutMs:e.Dr.requestTimeoutMs})).json)||void 0===a?void 0:a.featureFlagPayloads;l=(null==i?void 0:i[t])||void 0}catch(t){return void e.A.error("Remote config feature flag request failed",t)}try{i(l)}catch(t){e.A.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,i={}){if(i.fresh&&!this.Dd)return i.defaultValue;if(!(this.Md||this.getFlags()&&this.getFlags().length>0))return this.A.warn('isFeatureEnabled for key "'+t+fc),i.defaultValue;const e=this.getFeatureFlag(t,i);return _i(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._v(t,i,e)}_v(t,i,e){if(!this.Ta)return;this.Md=!0;const s=((t,i={},e={},s={},o,c=dc)=>{const d=((t,i)=>{const e=t.flags;if(e){const i=Object.fromEntries(Object.keys(e).map(t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]})),s=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var i;return!_i(null===(i=e[t].metadata)||void 0===i?void 0:i.payload)}).map(t=>{var i;return[t,null===(i=e[t].metadata)||void 0===i?void 0:i.payload]}));return as(as({},t),{},{featureFlags:i,featureFlagPayloads:s})}return t.featureFlags&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,c),v=d.flags,f=d.featureFlags,g=d.featureFlagPayloads;if(!f)return;const _=t.requestId,m=t.evaluatedAt;if(vi(f)){c.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const t={};if(f)for(let i=0;f.length>i;i++)t[f[i]]=!0;return{[n]:f,[h]:t,[u]:!1}}let y=f,b=g,w=v;if(null==o?void 0:o.partialResponse){const t=Object.keys(y),n=b||{};y=as(as({},i),y),b=as(as({},e),n),t.forEach(t=>{t in n||null==b||delete b[t]}),w=as(as({},s),w)}else if(t.errorsWhileComputingFlags)if(v){const t=new Set(Object.keys(v).filter(t=>{var i;return!(null===(i=v[t])||void 0===i?void 0:i.failed)}));y=as(as({},i),Object.fromEntries(Object.entries(y).filter(([i])=>t.has(i))));const n=Object.fromEntries(Object.entries(b||{}).filter(([i])=>t.has(i)));b=as(as({},e),n),t.forEach(t=>{t in n||null==b||delete b[t]}),w=as(as({},s),Object.fromEntries(Object.entries(w||{}).filter(([i])=>t.has(i))))}else y=as(as({},i),y),b=as(as({},e),b),w=as(as({},s),w);return as(as({[n]:Object.keys(yc(y)),[h]:y||{},[p]:b||{},[r]:w||{},[u]:!0===t.minimalFlagCalledEvents},_?{[a]:_}:{}),m?{[l]:m}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.A);if(s)if(!1===(null==e?void 0:e.persist)){const t=!_i(this.Ta.kv.get(h));this.vv=s,t||this.$t(s)}else this.nv(),this.gv(s,t,!!(null==e?void 0:e.partialResponse)),this.$t(s);else i&&this.fv();i||(this.Ld=!1),this.rv(i)}override(t,i=!1){this.A.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Tv(t)}Tv(t){if(this.Ta){if(!1===t)return this.Dt([g,_]),this.rv(),void vc.info("All overrides cleared");if(vi(t))return this.$t({[g]:mc(t)}),this.rv(),void vc.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i;const e=t;this.xd=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);const s={},n=e.flags,r=e.payloads;return n&&(s[g]=vi(n)?mc(n):n),r&&(s[_]=r),Object.keys(s).length&&this.$t(s),!1===n&&!1===r?this.Dt([g,_]):!1===n?this.Dt(g):!1===r&&this.Dt(_),this.rv(),!1===n?vc.info("Flag overrides cleared"):n&&vc.info("Flag overrides set",{flags:n}),void(!1===r?vc.info("Payload overrides cleared"):r&&vc.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.$t({[g]:t}),this.rv(),void vc.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){const{flags:i,flagVariants:e}=this.Iv();try{t(i,e)}catch(t){this.A.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var s;const r=(this.dv("$early_access_features")||[]).find(i=>i.flagKey===t),o={[`$feature_enrollment/${t}`]:i},l={$feature_flag:t,$feature_enrollment:i,$set:o};r&&(l.$early_access_feature_name=r.name),e&&(l.$feature_enrollment_stage=e);const a=as(as({},this.getFlagVariants()),{},{[t]:i});null===(s=this.Jd)||void 0===s||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(o)}),this.$t({[n]:Object.keys(yc(a)),[h]:a,[d]:as(as({},this.dv("$stored_person_properties")||{}),o)}),this.rv();try{var u;null===(u=this.Ta)||void 0===u||u.capture("$feature_enrollment_update",l)}catch(t){this.A.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i=!1,e){const n=this.dv(s);!n||i?this.Ev(t,e):t(n)}Ev(t,i){var e=this;return Di(function*(){const n=e.Ta;if(!n)return;const r=i?`&${i.map(t=>`stage=${t}`).join("&")}`:"";let o;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${r}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;o=t.json.earlyAccessFeatures,e.$t({[s]:o})}catch(t){return void e.A.error("Early access feature request failed",t)}try{t(o)}catch(t){e.A.error("Early access feature callback failed",t)}})()}Iv(){const t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter(t=>i[t]),flagVariants:Object.keys(i).filter(t=>i[t]).reduce((t,e)=>(t[e]=i[e],t),{})}}rv(t){this.sv();const{flags:i,flagVariants:e}=this.Iv(),s=this.Fd;this.Fd=!0,this.featureFlagEventHandlers.forEach(s=>{try{s(i,e,{errorsLoading:t})}catch(t){this.A.error("Error while running feature flags callback",t)}}),this.Fd=s}setPersonPropertiesForFlags(t,i=!0){this.Mv(t,i)}Mv(t,i=!0){const e=this.dv("$stored_person_properties")||{},s=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),n=null==t?void 0:t.$set_once,r={};if(n)for(const t in n)({}).hasOwnProperty.call(n,t)&&(t in e||(r[t]=n[t]));this.$t({[d]:as(as(as({},e),r),s)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i=!0){const e=as({},this.dv("$stored_person_properties")||{});t.forEach(t=>{delete e[t]}),this.$t({[d]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Dt(d),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i=!0){const e=this.dv("$stored_group_properties")||{},s=as({},e);for(const i of Object.keys(t))s[i]=as(as({},e[i]),t[i]);this.$t({[c]:s}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const i=this.dv("$stored_group_properties")||{};this.$t({[c]:as(as({},i),{},{[t]:{}})})}else this.Dt(c)}reset(){this.Rd++,this.uv(this.Id,"cancelled"),this.uv(this.Ed,"cancelled"),this.Od=!1,this.$d={},this.Cd={},this.vv=void 0,this.Md=!1,this.Pd=!1,this.Dd=!1,this.$anon_distinct_id=void 0,this.hv(),this.xd=!1,this.Nd=0}};const wc=Pr("[FeatureFlags]");var $c=class{constructor(t,i=!1){this.Av=!1,this.update(t,i)}update(t,i){this.Rv=((t,i)=>{var e,s,n,r,o,l,a,u;return{bootstrap:{featureFlags:null!==(e=null===(s=t.bootstrap)||void 0===s?void 0:s.featureFlags)&&void 0!==e?e:void 0,featureFlagPayloads:null!==(n=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==n?n:void 0},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,refreshIntervalMs:null!==(o=t.remote_config_refresh_interval_ms)&&void 0!==o?o:3e5,idleRefreshBackoff:_i(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(l=t.feature_flag_request_max_retries)&&void 0!==l?l:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(a=null!==(u=t.evaluation_contexts)&&void 0!==u?u:t.evaluation_environments)&&void 0!==a?a:[],flagKeys:vi(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.Av||(wc.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Av=!0),_i(t.flag_keys)||vi(t.flag_keys)||wc.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Rv}};const xc=t=>Oi(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Sc=Pr("[Error tracking]"),Ec="webkit-masked-url:",kc=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Tc=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",Ec],Pc=["__firefox__","__gCrWeb"];function Oc(t,i){(null==i||i>t.length)&&(i=t.length);for(var e=0,s=Array(i);i>e;e++)s[e]=t[e];return s}function Rc(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,i){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var s,n,r,o,l=[],a=!0,u=!1;try{if(r=(e=e.call(t)).next,0===i);else for(;!(a=(s=r.call(e)).done)&&(l.push(s.value),l.length!==i);a=!0);}catch(t){u=!0,n=t}finally{try{if(!a&&null!=e.return&&(o=e.return(),Object(o)!==o))return}finally{if(u)throw n}}return l}}(t,i)||function(t,i){if(t){if("string"==typeof t)return Oc(t,i);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?Oc(t,i):void 0}}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const Ac=Object.entries,Cc=Object.setPrototypeOf,Ic=Object.isFrozen,Mc=Object.getPrototypeOf,Fc=Object.getOwnPropertyDescriptor;let Dc=Object.freeze,Nc=Object.seal,Lc=Object.create,jc="undefined"!=typeof Reflect&&Reflect,Uc=jc.apply,Bc=jc.construct;Dc||(Dc=function(t){return t}),Nc||(Nc=function(t){return t}),Uc||(Uc=function(t,i){for(var e=arguments.length,s=new Array(e>2?e-2:0),n=2;e>n;n++)s[n-2]=arguments[n];return t.apply(i,s)}),Bc||(Bc=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),s=1;i>s;s++)e[s-1]=arguments[s];return new t(...e)});const zc=ud([].forEach),Hc=ud([].lastIndexOf),qc=ud([].pop),Wc=ud([].push),Vc=ud([].splice),Gc=Array.isArray,Kc=ud("".toLowerCase),Yc=ud("".toString),Jc=ud("".match),Xc=ud("".replace),Zc=ud("".indexOf),Qc=ud("".trim),td=ud((0).toString),id=ud(Boolean.prototype.toString),ed="undefined"==typeof BigInt?null:ud(BigInt.prototype.toString),sd="undefined"==typeof Symbol?null:ud(Symbol.prototype.toString),nd=ud({}.hasOwnProperty),rd=ud({}.toString),od=ud(/t/.test),ld=(ad=TypeError,function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return Bc(ad,i)});var ad;function ud(t){return function(i){i instanceof RegExp&&(i.lastIndex=0);for(var e=arguments.length,s=new Array(e>1?e-1:0),n=1;e>n;n++)s[n-1]=arguments[n];return Uc(t,i,s)}}function hd(t,i){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Kc;if(Cc&&Cc(t,null),!Gc(i))return t;let s=i.length;for(;s--;){let n=i[s];if("string"==typeof n){const t=e(n);t!==n&&(Ic(i)||(i[s]=t),n=t)}t[n]=!0}return t}function cd(t){for(let i=0;t.length>i;i++)nd(t,i)||(t[i]=null);return t}function dd(t){const i=Lc(null);for(const s of Ac(t)){var e=Rc(s,2);const n=e[0],r=e[1];nd(t,n)&&(i[n]=Gc(r)?cd(r):r&&"object"==typeof r&&r.constructor===Object?dd(r):r)}return i}function vd(t,i){for(;null!==t;){const e=Fc(t,i);if(e){if(e.get)return ud(e.get);if("function"==typeof e.value)return ud(e.value)}t=Mc(t)}return function(){return null}}const fd=Dc(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),pd=Dc(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),gd=Dc(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),_d=Dc(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),md=Dc(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),yd=Dc(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),bd=Dc(["#text"]),wd=Dc(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),$d=Dc(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),xd=Dc(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Sd=Dc(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ed=Nc(/{{[\w\W]*|^[\w\W]*}}/g),kd=Nc(/<%[\w\W]*|^[\w\W]*%>/g),Td=Nc(/\${[\w\W]*/g),Pd=Nc(/^data-[\-\w.\u00B7-\uFFFF]+$/),Od=Nc(/^aria-[\-\w]+$/),Rd=Nc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ad=Nc(/^(?:\w+script|data):/i),Cd=Nc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Id=Nc(/^html$/i),Md=Nc(/^[a-z][.\w]*(-[.\w]+)+$/i),Fd=Nc(/<[/\w!]/g),Dd=Nc(/<[/\w]/g),Nd=Nc(/<\/no(script|embed|frames)/i),Ld=Nc(/\/>/i),jd=function(){return"undefined"==typeof window?null:window},Ud=function(t,i,e,s){return nd(t,i)&&Gc(t[i])?hd(s.base?dd(s.base):{},t[i],s.transform):e};var Bd=function t(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:jd();const e=i=>t(i);if(e.version="3.4.13",e.removed=[],!i||!i.document||9!==i.document.nodeType||!i.Element)return e.isSupported=!1,e;let s=i.document;const n=s,r=n.currentScript,o=i.HTMLTemplateElement,l=i.Node,a=i.NodeFilter,u=i.DOMParser,h=i.trustedTypes,c=i.Element.prototype,d=vd(c,"cloneNode"),v=vd(c,"remove"),f=vd(c,"nextSibling"),p=vd(c,"childNodes"),g=vd(c,"parentNode"),_=vd(c,"shadowRoot"),m=vd(c,"attributes"),y=l&&l.prototype?vd(l.prototype,"nodeType"):null,b=l&&l.prototype?vd(l.prototype,"nodeName"):null,w=l&&l.prototype?vd(l.prototype,"ownerDocument"):null;if("function"==typeof o){const t=s.createElement("template");t.content&&t.content.ownerDocument&&(s=t.content.ownerDocument)}let x,S,E="",k=!1,T=0;const P=function(){if(T>0)throw ld('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},O=function(t){P(),T++;try{return x.createHTML(t)}finally{T--}},R=s.implementation,A=s.createNodeIterator,C=s.createDocumentFragment,I=s.getElementsByTagName,M=n.importNode;let F={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};e.isSupported="function"==typeof Ac&&"function"==typeof g&&R&&void 0!==R.createHTMLDocument;const D=Ed,N=kd,L=Td,j=Pd,U=Od,B=Ad,z=Cd,H=Md;let q=Rd,W=null;const V=hd({},[...fd,...pd,...gd,...md,...bd]);let G=null;const K=hd({},[...wd,...$d,...xd,...Sd]);let Y=Object.seal(Lc(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),J=null,X=null;const Z=Object.seal(Lc(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Q=!0,tt=!0,it=!1,et=!0,st=!1,nt=!0,rt=!1,ot=!1,lt=null,at=null,ut=!1,ht=!1,ct=!1,dt=!1,vt=!0,ft=!1;const pt="user-content-";let gt=!0,_t=!1,mt={},yt=null;const bt=hd({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let wt=null;const $t=hd({},["audio","video","img","source","image","track"]);let xt=null;const St=hd({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Et="http://www.w3.org/1998/Math/MathML",kt="http://www.w3.org/2000/svg",Tt="http://www.w3.org/1999/xhtml";let Pt=Tt,Ot=!1,Rt=null;const At=hd({},[Et,kt,Tt],Yc),Ct=Dc(["mi","mo","mn","ms","mtext"]);let It=hd({},Ct);const Mt=Dc(["annotation-xml"]);let Ft=hd({},Mt);const Dt=hd({},["title","style","font","a","script"]);let Nt=null;const Lt=["application/xhtml+xml","text/html"];let jt=null,Ut=null;const Bt=s.createElement("form"),zt=function(t){return t instanceof RegExp||t instanceof Function},Ht=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Ut&&Ut===t)return;t&&"object"==typeof t||(t={}),t=dd(t),Nt=-1===Lt.indexOf(t.PARSER_MEDIA_TYPE)?"text/html":t.PARSER_MEDIA_TYPE,jt="application/xhtml+xml"===Nt?Yc:Kc,W=Ud(t,"ALLOWED_TAGS",V,{transform:jt}),G=Ud(t,"ALLOWED_ATTR",K,{transform:jt}),Rt=Ud(t,"ALLOWED_NAMESPACES",At,{transform:Yc}),xt=Ud(t,"ADD_URI_SAFE_ATTR",St,{transform:jt,base:St}),wt=Ud(t,"ADD_DATA_URI_TAGS",$t,{transform:jt,base:$t}),yt=Ud(t,"FORBID_CONTENTS",bt,{transform:jt}),J=Ud(t,"FORBID_TAGS",dd({}),{transform:jt}),X=Ud(t,"FORBID_ATTR",dd({}),{transform:jt}),mt=!!nd(t,"USE_PROFILES")&&(t.USE_PROFILES&&"object"==typeof t.USE_PROFILES?dd(t.USE_PROFILES):t.USE_PROFILES),Q=!1!==t.ALLOW_ARIA_ATTR,tt=!1!==t.ALLOW_DATA_ATTR,it=t.ALLOW_UNKNOWN_PROTOCOLS||!1,et=!1!==t.ALLOW_SELF_CLOSE_IN_ATTR,st=t.SAFE_FOR_TEMPLATES||!1,nt=!1!==t.SAFE_FOR_XML,rt=t.WHOLE_DOCUMENT||!1,ht=t.RETURN_DOM||!1,ct=t.RETURN_DOM_FRAGMENT||!1,dt=t.RETURN_TRUSTED_TYPE||!1,ut=t.FORCE_BODY||!1,vt=!1!==t.SANITIZE_DOM,ft=t.SANITIZE_NAMED_PROPS||!1,gt=!1!==t.KEEP_CONTENT,_t=t.IN_PLACE||!1,q=function(t){try{return od(t,""),!0}catch(t){return!1}}(t.ALLOWED_URI_REGEXP)?t.ALLOWED_URI_REGEXP:Rd,Pt="string"==typeof t.NAMESPACE?t.NAMESPACE:Tt,It=nd(t,"MATHML_TEXT_INTEGRATION_POINTS")&&t.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof t.MATHML_TEXT_INTEGRATION_POINTS?dd(t.MATHML_TEXT_INTEGRATION_POINTS):hd({},Ct),Ft=nd(t,"HTML_INTEGRATION_POINTS")&&t.HTML_INTEGRATION_POINTS&&"object"==typeof t.HTML_INTEGRATION_POINTS?dd(t.HTML_INTEGRATION_POINTS):hd({},Mt);const i=nd(t,"CUSTOM_ELEMENT_HANDLING")&&t.CUSTOM_ELEMENT_HANDLING&&"object"==typeof t.CUSTOM_ELEMENT_HANDLING?dd(t.CUSTOM_ELEMENT_HANDLING):Lc(null);if(Y=Lc(null),nd(i,"tagNameCheck")&&zt(i.tagNameCheck)&&(Y.tagNameCheck=i.tagNameCheck),nd(i,"attributeNameCheck")&&zt(i.attributeNameCheck)&&(Y.attributeNameCheck=i.attributeNameCheck),nd(i,"allowCustomizedBuiltInElements")&&"boolean"==typeof i.allowCustomizedBuiltInElements&&(Y.allowCustomizedBuiltInElements=i.allowCustomizedBuiltInElements),Nc(Y),st&&(tt=!1),ct&&(ht=!0),mt&&(W=hd({},bd),G=Lc(null),!0===mt.html&&(hd(W,fd),hd(G,wd)),!0===mt.svg&&(hd(W,pd),hd(G,$d),hd(G,Sd)),!0===mt.svgFilters&&(hd(W,gd),hd(G,$d),hd(G,Sd)),!0===mt.mathMl&&(hd(W,md),hd(G,xd),hd(G,Sd))),Z.tagCheck=null,Z.attributeCheck=null,nd(t,"ADD_TAGS")&&("function"==typeof t.ADD_TAGS?Z.tagCheck=t.ADD_TAGS:Gc(t.ADD_TAGS)&&(W===V&&(W=dd(W)),hd(W,t.ADD_TAGS,jt))),nd(t,"ADD_ATTR")&&("function"==typeof t.ADD_ATTR?Z.attributeCheck=t.ADD_ATTR:Gc(t.ADD_ATTR)&&(G===K&&(G=dd(G)),hd(G,t.ADD_ATTR,jt))),nd(t,"ADD_URI_SAFE_ATTR")&&Gc(t.ADD_URI_SAFE_ATTR)&&hd(xt,t.ADD_URI_SAFE_ATTR,jt),nd(t,"FORBID_CONTENTS")&&Gc(t.FORBID_CONTENTS)&&(yt===bt&&(yt=dd(yt)),hd(yt,t.FORBID_CONTENTS,jt)),nd(t,"ADD_FORBID_CONTENTS")&&Gc(t.ADD_FORBID_CONTENTS)&&(yt===bt&&(yt=dd(yt)),hd(yt,t.ADD_FORBID_CONTENTS,jt)),gt&&(W["#text"]=!0),rt&&hd(W,["html","head","body"]),W.table&&(hd(W,["tbody"]),delete J.tbody),t.TRUSTED_TYPES_POLICY){if("function"!=typeof t.TRUSTED_TYPES_POLICY.createHTML)throw ld('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof t.TRUSTED_TYPES_POLICY.createScriptURL)throw ld('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const i=x;x=t.TRUSTED_TYPES_POLICY;try{E=O("")}catch(t){throw x=i,t}}else null===t.TRUSTED_TYPES_POLICY?(x=void 0,E=""):(void 0===x&&(k||(S=function(t,i){if("object"!=typeof t||"function"!=typeof t.createPolicy)return null;let e=null;const s="data-tt-policy-suffix";i&&i.hasAttribute(s)&&(e=i.getAttribute(s));const n="dompurify"+(e?"#"+e:"");try{return t.createPolicy(n,{createHTML:t=>t,createScriptURL:t=>t})}catch(t){return console.warn("TrustedTypes policy "+n+" could not be created."),null}}(h,r),k=!0),x=S),x&&"string"==typeof E&&(E=O("")));Dc&&Dc(t),Ut=t},qt=hd({},[...pd,...gd,..._d]),Wt=hd({},[...md,...yd]),Vt=function(t){Wc(e.removed,{element:t});try{g(t).removeChild(t)}catch(i){if(v(t),!g(t))throw ld("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Gt=function(t){Jt(t);const i=p(t);if(i){const t=[];zc(i,i=>{Wc(t,i)}),zc(t,t=>{try{v(t)}catch(t){}})}const e=m(t);if(e)for(let i=e.length-1;i>=0;--i){const s=e[i],n=s&&s.name;if("string"==typeof n)try{t.removeAttribute(n)}catch(t){}}},Kt=function(t,i){try{Wc(e.removed,{attribute:i.getAttributeNode(t),from:i})}catch(t){Wc(e.removed,{attribute:null,from:i})}if(i.removeAttribute(t),"is"===t)if(ht||ct)try{Vt(i)}catch(t){}else try{i.setAttribute(t,"")}catch(t){}},Yt=function(t){const i=m(t);if(i)for(let e=i.length-1;e>=0;--e){const s=i[e],n=s&&s.name;if("string"==typeof n&&!G[jt(n)])try{t.removeAttribute(n)}catch(t){}}},Jt=function(t){const i=[t];for(;i.length>0;){const t=i.pop();1===(y?y(t):t.nodeType)&&Yt(t);const e=p(t);if(e)for(let t=e.length-1;t>=0;--t)i.push(e[t])}},Xt=function(t){let i=null,e=null;if(ut)t="<remove></remove>"+t;else{const i=Jc(t,/^[\r\n\t ]+/);e=i&&i[0]}"application/xhtml+xml"===Nt&&Pt===Tt&&(t='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+t+"</body></html>");const n=x?O(t):t;if(Pt===Tt)try{i=(new u).parseFromString(n,Nt)}catch(t){}if(!i||!i.documentElement){i=R.createDocument(Pt,"template",null);try{i.documentElement.innerHTML=Ot?E:n}catch(t){}}const r=i.body||i.documentElement;return t&&e&&r.insertBefore(s.createTextNode(e),r.childNodes[0]||null),Pt===Tt?I.call(i,rt?"html":"body")[0]:rt?i.documentElement:r},Zt=function(t){const i=w?w(t):t.ownerDocument;return A.call(i||t,t,a.SHOW_ELEMENT|a.SHOW_COMMENT|a.SHOW_TEXT|a.SHOW_PROCESSING_INSTRUCTION|a.SHOW_CDATA_SECTION,null)},Qt=function(t){return t=Xc(t,D," "),t=Xc(t,N," "),Xc(t,L," ")},ti=function(t){var i;t.normalize();const e=w?w(t):t.ownerDocument,s=A.call(e||t,t,a.SHOW_TEXT|a.SHOW_COMMENT|a.SHOW_CDATA_SECTION|a.SHOW_PROCESSING_INSTRUCTION,null);let n=s.nextNode();for(;n;)n.data=Qt(n.data),n=s.nextNode();const r=null===(i=t.querySelectorAll)||void 0===i?void 0:i.call(t,"template");r&&zc(r,t=>{ei(t.content)&&ti(t.content)})},ii=function(t){const i=b?b(t):null;return"string"==typeof i&&"form"===jt(i)&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||t.attributes!==m(t)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore||"function"!=typeof t.hasChildNodes||t.nodeType!==y(t)||t.childNodes!==p(t))},ei=function(t){if(!y||"object"!=typeof t||null===t)return!1;try{return 11===y(t)}catch(t){return!1}},si=function(t){if(!y||"object"!=typeof t||null===t)return!1;try{return"number"==typeof y(t)}catch(t){return!1}};function ni(t,i,s){0!==t.length&&zc(t,t=>{t.call(e,i,s,Ut)})}const ri=function(t,i,e,s){return 0===t.length?i:i===e||i===s?dd(i):i},oi=function(t,i){if(ni(F.beforeSanitizeElements,t,null),t!==i&&null===g(t))return _t&&Jt(t),!0;if(ii(t))return Vt(t),!0;const s=jt(b?b(t):t.nodeName);if(W=ri(F.uponSanitizeElement,W,V,lt),ni(F.uponSanitizeElement,t,{tagName:s,allowedTags:W}),t!==i&&null===g(t))return _t&&Jt(t),!0;if(function(t,i){return!!(nt&&t.hasChildNodes()&&!si(t.firstElementChild)&&od(Fd,t.textContent)&&od(Fd,t.innerHTML))||!(!nt||t.namespaceURI!==Tt||"style"!==i||!si(t.firstElementChild))||7===t.nodeType||!(!nt||8!==t.nodeType||!od(Dd,t.data))}(t,s))return Vt(t),!0;if(J[s]||!(Z.tagCheck instanceof Function&&Z.tagCheck(s))&&!W[s]){const e=function(t,i,e){if(!J[i]&&ui(i)){if(Y.tagNameCheck instanceof RegExp&&od(Y.tagNameCheck,i))return!1;if(Y.tagNameCheck instanceof Function&&Y.tagNameCheck(i))return!1}if(gt&&!yt[i]){const i=g(t),s=p(t);if(s&&i)for(let n=s.length-1;n>=0;--n){const r=t===e?d(s[n],!0):s[n];i.insertBefore(r,f(t))}}return Vt(t),!0}(t,s,i);return!1===e&&ni(F.afterSanitizeElements,t,null),e}if(1===(y?y(t):t.nodeType)&&!function(t){let i=g(t);i&&i.tagName||(i={namespaceURI:Pt,tagName:"template"});const e=Kc(t.tagName),s=Kc(i.tagName);return!!Rt[t.namespaceURI]&&(t.namespaceURI===kt?function(t,i,e){return i.namespaceURI===Tt?"svg"===t:i.namespaceURI===Et?"svg"===t&&("annotation-xml"===e||It[e]):Boolean(qt[t])}(e,i,s):t.namespaceURI===Et?function(t,i,e){return i.namespaceURI===Tt?"math"===t:i.namespaceURI===kt?"math"===t&&Ft[e]:Boolean(Wt[t])}(e,i,s):t.namespaceURI===Tt?function(t,i,e){return!(i.namespaceURI===kt&&!Ft[e])&&!(i.namespaceURI===Et&&!It[e])&&!Wt[t]&&(Dt[t]||!qt[t])}(e,i,s):!("application/xhtml+xml"!==Nt||!Rt[t.namespaceURI]))}(t))return Vt(t),!0;if(("noscript"===s||"noembed"===s||"noframes"===s)&&od(Nd,t.innerHTML))return Vt(t),!0;if(st&&3===t.nodeType){const i=Qt(t.textContent);t.textContent!==i&&(Wc(e.removed,{element:t.cloneNode()}),t.textContent=i)}return ni(F.afterSanitizeElements,t,null),!1},li=function(t,i,e){if(X[i])return!1;if(nt&&"patchsrc"===i)return!1;if(nt&&"for"===i&&"label"!==t&&"output"!==t)return!1;if(vt&&("id"===i||"name"===i)&&(e in s||e in Bt))return!1;const n=G[i]||Z.attributeCheck instanceof Function&&Z.attributeCheck(i,t);if(tt&&od(j,i));else if(Q&&od(U,i));else if(n){if(xt[i]);else if(od(q,Xc(e,z,"")));else if("src"!==i&&"xlink:href"!==i&&"href"!==i||"script"===t||0!==Zc(e,"data:")||!wt[t])if(it&&!od(B,Xc(e,z,"")));else if(e)return!1}else if(!(ui(t)&&(Y.tagNameCheck instanceof RegExp&&od(Y.tagNameCheck,t)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(t))&&(Y.attributeNameCheck instanceof RegExp&&od(Y.attributeNameCheck,i)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(i,t))||"is"===i&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&od(Y.tagNameCheck,e)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(e))))return!1;return!0},ai=hd({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ui=function(t){return!ai[Kc(t)]&&od(H,t)},hi=function(t,i,e,s){if(x&&"object"==typeof h&&"function"==typeof h.getAttributeType&&!e)switch(h.getAttributeType(t,i)){case"TrustedHTML":return O(s);case"TrustedScriptURL":return function(t){P(),T++;try{return x.createScriptURL(t)}finally{T--}}(s)}return s},ci=function(t,i,s,n){try{s?t.setAttributeNS(s,i,n):t.setAttribute(i,n),ii(t)?Vt(t):qc(e.removed)}catch(e){Kt(i,t)}},di=function(t){ni(F.beforeSanitizeAttributes,t,null);const i=t.attributes;if(!i||ii(t))return;G=ri(F.uponSanitizeAttribute,G,K,at);const e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:G,forceKeepAttr:void 0};let s=i.length;const n=jt(t.nodeName);for(;s--;){const r=i[s],o=r.name,l=r.namespaceURI,a=r.value,u=jt(o),h=a;let c="value"===o?h:Qc(h);e.attrName=u,e.attrValue=c,e.keepAttr=!0,e.forceKeepAttr=void 0,ni(F.uponSanitizeAttribute,t,e),c=e.attrValue,!ft||"id"!==u&&"name"!==u||0===Zc(c,pt)||(Kt(o,t),c=pt+c),nt&&od(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,c)||"attributename"===u&&Jc(c,"href")?Kt(o,t):e.forceKeepAttr||(!e.keepAttr||!et&&od(Ld,c)?Kt(o,t):(st&&(c=Qt(c)),li(n,u,c)?(c=hi(n,u,l,c),c!==h&&ci(t,o,l,c)):Kt(o,t)))}ni(F.afterSanitizeAttributes,t,null)},vi=function(t){let i=null;const e=Zt(t);for(ni(F.beforeSanitizeShadowDOM,t,null);i=e.nextNode();)if(ni(F.uponSanitizeShadowNode,i,null),oi(i,t),di(i),ei(i.content)&&vi(i.content),1===(y?y(i):i.nodeType)){const t=_(i);ei(t)&&(fi(t),vi(t))}ni(F.afterSanitizeShadowDOM,t,null)},fi=function(t){const i=[{node:t,shadow:null}];for(;i.length>0;){const t=i.pop();if(t.shadow){vi(t.shadow);continue}const e=t.node,s=1===(y?y(e):e.nodeType),n=p(e);if(n)for(let t=n.length-1;t>=0;--t)i.push({node:n[t],shadow:null});if(s){const t=b?b(e):null;if("string"==typeof t&&"template"===jt(t)){const t=e.content;ei(t)&&i.push({node:t,shadow:null})}}if(s){const t=_(e);ei(t)&&i.push({node:null,shadow:t},{node:t,shadow:null})}}};return e.sanitize=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=null,r=null,o=null,l=null;if(Ot=!t,Ot&&(t="\x3c!--\x3e"),"string"!=typeof t&&!si(t)&&"string"!=typeof(t=function(t){switch(typeof t){case"string":return t;case"number":return td(t);case"boolean":return id(t);case"bigint":return ed?ed(t):"0";case"symbol":return sd?sd(t):"Symbol()";case"undefined":default:return rd(t);case"function":case"object":{if(null===t)return rd(t);const i=t,e=vd(i,"toString");if("function"==typeof e){const t=e(i);return"string"==typeof t?t:rd(t)}return rd(t)}}}(t)))throw ld("dirty is not a string, aborting");if(!e.isSupported)return t;ot?(W=lt,G=at):Ht(i),(F.uponSanitizeElement.length>0||F.uponSanitizeAttribute.length>0)&&(W=dd(W)),F.uponSanitizeAttribute.length>0&&(G=dd(G)),e.removed=[];const a=_t&&"string"!=typeof t&&si(t);if(a){!function(t){if(!nt)return;const i=[t];for(;i.length>0;){const t=i.pop(),e=y?y(t):t.nodeType;if(7===e||8===e&&od(Dd,t.data)){try{v(t)}catch(t){}continue}if(1===e){const i=t,e=jt(b?b(t):t.nodeName);try{i.hasAttribute&&i.hasAttribute("patchsrc")&&i.removeAttribute("patchsrc"),i.hasAttribute&&i.hasAttribute("for")&&"label"!==e&&"output"!==e&&i.removeAttribute("for")}catch(t){}}const s=p(t);if(s)for(let t=s.length-1;t>=0;--t)i.push(s[t])}}(t);const i=b?b(t):t.nodeName;if("string"==typeof i){const e=jt(i);if(!W[e]||J[e])throw Gt(t),ld("root node is forbidden and cannot be sanitized in-place")}if(ii(t))throw Gt(t),ld("root node is clobbered and cannot be sanitized in-place");try{fi(t)}catch(i){throw Gt(t),i}}else if(si(t))s=Xt("\x3c!----\x3e"),r=s.ownerDocument.importNode(t,!0),1===r.nodeType&&"BODY"===r.nodeName||"HTML"===r.nodeName?s=r:s.appendChild(r),fi(r);else{if(!ht&&!st&&!rt&&-1===t.indexOf("<"))return x&&dt?O(t):t;if(s=Xt(t),!s)return ht?null:dt?E:""}s&&ut&&Vt(s.firstChild);const u=a?t:s;try{const t=Zt(u);for(;o=t.nextNode();)oi(o,u),di(o),ei(o.content)&&vi(o.content)}catch(i){throw a&&(Gt(t),zc(e.removed,t=>{t.element&&Jt(t.element)})),i}if(a)return zc(e.removed,t=>{t.element&&Jt(t.element)}),st&&ti(t),t;if(ht){if(st&&ti(s),ct)for(l=C.call(s.ownerDocument);s.firstChild;)l.appendChild(s.firstChild);else l=s;return(G.shadowroot||G.shadowrootmode)&&(l=M.call(n,l,!0)),l}let h=rt?s.outerHTML:s.innerHTML;return rt&&W["!doctype"]&&s.ownerDocument&&s.ownerDocument.doctype&&s.ownerDocument.doctype.name&&od(Id,s.ownerDocument.doctype.name)&&(h="<!DOCTYPE "+s.ownerDocument.doctype.name+">\n"+h),st&&(h=Qt(h)),x&&dt?O(h):h},e.setConfig=function(){Ht(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ot=!0,lt=W,at=G},e.clearConfig=function(){Ut=null,ot=!1,lt=null,at=null,x=S,E=""},e.isValidAttribute=function(t,i,e){Ut||Ht({});const s=jt(t),n=jt(i);return li(s,n,e)},e.addHook=function(t,i){"function"==typeof i&&nd(F,t)&&Wc(F[t],i)},e.removeHook=function(t,i){if(nd(F,t)){if(void 0!==i){const e=Hc(F[t],i);return-1===e?void 0:Vc(F[t],e,1)[0]}return qc(F[t])}},e.removeHooks=function(t){nd(F,t)&&(F[t]=[])},e.removeAllHooks=function(){F={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},e}();const zd="Refusing to render web experiment since the viewer is a likely bot",Hd={ADD_ATTR:(t,i)=>"target"===t&&"a"===i||"form"===t&&/^(button|fieldset|input|output|select|textarea)$/.test(i),ADD_URI_SAFE_ATTR:["form"]};let qd;const Wd={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Au(i,t),not_regex:(t,i)=>!Au(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t},Vd=Pr("[Conversations]"),Gd="Conversations not available yet.";function Kd(t,i){var e,s,n,r,o,l,a;const u=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,h=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,c=(null==i?void 0:i.consoleCapture)?void 0:null!==(n=null==t?void 0:t.maxLogsPerInterval)&&void 0!==n?n:1e3,d=_i(c)?Math.max(h,2048):Math.max(h,c),v=as(as({},function(){let t="",i="";try{var e;const s="u">typeof globalThis?globalThis:"u">typeof window?window:void 0,n=null==s||null===(e=s.navigator)||void 0===e?void 0:e.userAgent;n&&([t,i]=Ue(n))}catch(t){}return function(t,i){const e=function(t){if(t)return{}.hasOwnProperty.call(or,t)?or[t]:t}(t);return as(as({},e?{"os.name":e}:{}),i?{"os.version":i}:{})}(t,i)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(r=null!==(o=null==v?void 0:v["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==r?r:null==i?void 0:i.serviceNameDefault,serviceVersion:null!==(l=null==v?void 0:v["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(a=null==v?void 0:v["deployment.environment"])&&void 0!==a?a:null==t?void 0:t.environment,resourceAttributes:v,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const Yd=["debug","log","warn","error","info"],Jd=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},Xd="console",Zd="__posthogHandledLogsRequestError",Qd=(t,i)=>{const e=t instanceof Error?t:new Error(i);return e[Zd]=!0,e},tv=t=>!!t&&"object"==typeof t&&!0===t[Zd];var iv=class{get Pv(){return as(as({},this.A),{},{error:(...t)=>{t.some(tv)||this.A.error(...t)}})}constructor(t,i){var e;this.Ma=t,this.Ov=i,this.name="logs",this.Fv=!1,this.Dv=!1,this.Lv=!1,this.A=Pr("[logs]"),this.tc=[],this.Nv=[],this.Nd=0,this.jv=!1,this.Ti=!1,this.qv=[],this.Bv=[],this.zv=!1,this.Hv=!1,this.Uv=!1,this.Wv=()=>{var t,i;this.Ti||(this.Nd=0,null===(t=this.Vv)||void 0===t||t.onReconnect(),null===(i=this.Gv)||void 0===i||i.onReconnect())},this.Fv=!!(null===(e=t.get())||void 0===e?void 0:e.captureConsoleLogs)}get Qv(){return!0}Jv(){}Zv(){if(!this.Uv){try{this.Yd=typeof window>"u"?void 0:window}catch(t){this.Yd=void 0}this.Yd&&(Lr(this.Yd,"online",this.Wv),this.Uv=!0)}}Kv(t,i,e,s){this.Zv();const n=Kd(this.Ma.get(),e);return[new gr(this.Yv(t,i),n,this.Pv,()=>this.Ov(),t=>t(),void 0,s),n]}Xv(){const t=this.Ma.get();var i;return this.Vv&&this.tf===t||(null===(i=this.Vv)||void 0===i||i.reset(),this.tf=t,[this.Vv,this.ef]=this.Kv(()=>this.tc,t=>{this.tc=t})),this.Vv}if(){const t=this.Ma.get();var i;return this.Gv&&this.nf===t||(null===(i=this.Gv)||void 0===i||i.reset(),this.nf=t,[this.Gv,this.sf]=this.Kv(()=>this.Nv,t=>{this.Nv=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Xd)),this.Gv}setup(t){if(!this.Ti&&!this.jv)return this.jv=!0,this.Ta=t,this.A=t.logger.createLogger("[logs]"),nc(t.kv.initialize(),()=>{this.Ti||this.Xd(t)})}Xd(t){var i;this.Zv(),(null===(i=this.Ma.get())||void 0===i?void 0:i.captureConsoleLogs)&&(this.Fv=!0),(this.Fv||this.Ma.remoteConfigWillArrive&&t.kv.get(this.Ma.captureHintKey))&&this.rf();let e=!1;const s=t.onRemoteConfig(t=>{var i;e=t.ok&&!0===(null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs),this.onRemoteConfig(t)});this.Ti?s.dispose():(this.za=s,e||this.loadIfEnabled())}dispose(){var t,i,e,s,n,r,o;this.Ti||(this.Ti=!0,this.af(),null===(t=this.za)||void 0===t||t.dispose(),this.za=void 0,this.Ta=void 0,this.Lv=!1,null===(i=this.Yd)||void 0===i||i.removeEventListener("online",this.Wv),null===(e=this.lf)||void 0===e||e.call(this),this.lf=void 0,null===(s=this.Vv)||void 0===s||s.clearQueue(),null===(n=this.Gv)||void 0===n||n.clearQueue(),null===(r=this.Vv)||void 0===r||r.reset(),null===(o=this.Gv)||void 0===o||o.reset())}onRemoteConfig(t){var i,e;if(this.Ti)return;const s=t.ok?null===(i=t.config.logs)||void 0===i?void 0:i.captureConsoleLogs:void 0;wi(s)?this.uf():(null===(e=this.Ta)||void 0===e||e.kv.set(this.Ma.captureHintKey,!!s),s?(this.Fv=!0,this.Dv||this.rf(),this.loadIfEnabled()):this.uf())}reset(){var t,i,e,s;this.af(),null===(t=this.Vv)||void 0===t||t.clearQueue(),this.tc=[],null===(i=this.Vv)||void 0===i||i.reset(),null===(e=this.Gv)||void 0===e||e.clearQueue(),this.Nv=[],null===(s=this.Gv)||void 0===s||s.reset(),this.Nd=0}captureLog(t){!this.Ti&&this.Ta&&this.Xv().captureLog(t)}captureConsoleLog(t){!this.Ti&&this.Ta&&this.if().captureLog(t)}captureBufferedConsoleLog(t,i,e){!this.Ti&&this.Ta&&this.if().captureLog(t,{context:i,occurredAtMs:e})}Sd(){var t;this.af(),null===(t=this.Gv)||void 0===t||t.clearQueue(),this.Nv=[]}uf(){this.Fv||this.af()}rf(){var t;if(this.zv||!(null===(t=this.Yd)||void 0===t?void 0:t.console))return;const i=Kd(this.Ma.get()).maxBufferSize;let e=!0;this.Bv.push(()=>{e=!1});for(const t of Yd){let s;try{s=Jd(this.Yd.console[t])}catch(t){continue}s&&this.Bv.push(Dh(this.Yd.console,t,n=>{const r=(...s)=>{try{e&&this.cf(t,s,i)}catch(t){}return n.apply(this.Yd.console,s)};return r.__rrweb_original__=s,r}))}this.zv=!0,this.hf=setTimeout(()=>{this.af()},3e4)}cf(t,i,e){var s;if(this.zv&&!this.Hv&&0!==i.length)if(null===(s=this.Ta)||void 0===s?void 0:s.canCapture){if(e>this.qv.length){this.Hv=!0;try{this.qv.push({level:t,args:i,occurredAtMs:Date.now(),context:this.Ov()})}finally{this.Hv=!1}}}else this.af()}af(){if(this.qv=[],this.zv){this.zv=!1,this.hf&&(clearTimeout(this.hf),this.hf=void 0);for(const t of this.Bv)t();this.Bv=[]}}df(){const t=this.qv;return this.af(),t}get logger(){return this.vf||(this.vf={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.vf}flushLogs(t){this.Ta&&(t?this.ff(t):(this.Vv&&this.Vv.flush().catch(t=>this.pf(t)),this.Gv&&this.Gv.flush().catch(t=>this.pf(t))))}flush(){var t=this;return Di(function*(){var i,e;const s=null===(i=t.Vv)||void 0===i?void 0:i.flush().catch(i=>t.pf(i)),n=null===(e=t.Gv)||void 0===e?void 0:e.flush().catch(i=>t.pf(i));yield s,yield n})()}pf(t){tv(t)||this.A.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Ti||!this.Fv||this.Dv||this.Lv)return;const t=this.Jv();if(t){this.Lv=!0;try{t((t,i)=>{if(this.Lv=!1,!this.Ti&&this.Fv)if(t||!i)this.A.error("Could not load logs script",t),this.af();else{const t=this.df();this.lf=i.initialize(this.Ta),this.Dv=!0,t.length>0&&i.replay(this.Ta,t)}})}catch(t){throw this.Lv=!1,t}}else this.af()}Yv(t,i){const e=this.Ta;return{get isDisabled(){return!1},get optedOut(){return!e.canCapture},getPersistedProperty:i=>i===ei.LogsQueue?t():void 0,setPersistedProperty(t,e){t===ei.LogsQueue&&i(null!=e?e:[])},qs:t=>this.qs(t),getLibraryId:()=>e.library.name,getLibraryVersion:()=>e.library.version}}qs(t){return new Promise(i=>{if(Sl(this.Nd,3))return void i({kind:"fatal",error:Qd(void 0,"logs endpoint is unreachable, dropping batch")});let e=!1;const s=t=>{e||(e=!0,clearTimeout(n),i(t))},n=setTimeout(()=>{this.A.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:Qd(void 0,"logs request timed out")})},9e4),r=this.Qv;this.Ta.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.Ta.projectToken},body:t,compression:"best-available",timeoutMs:6e4}).then(t=>{var i;const e=t.statusCode;this.gf(e,r),e>=200&&300>e?s({kind:"ok"}):413===e?s({kind:"too-large"}):0!==e&&408!==e&&429!==e&&500>e?s({kind:"fatal",error:new Error(`logs request failed with status ${e}`)}):0===e?(t.error||this.A.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:Qd(t.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`logs request failed with status ${e}`)})},t=>{s({kind:"retry-later",error:t})})})}gf(t,i){(0!==t||i)&&(this.Nd=El(t,this.Nd,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.")))}ff(t){this.tc.length>0&&this.mf(t,this.tc,this.ef,this.Ta.library.name,t=>{this.tc=t}),this.Nv.length>0&&this.mf(t,this.Nv,this.sf,Xd,t=>{this.Nv=t})}mf(t,i,e,s,n){if(0===i.length)return;const r=i.map(t=>t.record);n([]);const o=dr(r,cr(e,this.Ta.library.name,this.Ta.library.version),s,this.Ta.library.version);this.Ta.sendRequest("/i/v1/logs",{method:"POST",query:{token:this.Ta.projectToken},body:o,compression:"best-available",transport:t,timeoutMs:6e4}).catch(t=>this.pf(t))}};const ev=Pr("[NetworkMetrics]"),sv=()=>{var t;return(null==qt||null===(t=qt.performance)||void 0===t?void 0:t.now)?qt.performance.now():Date.now()},nv={"http:":80,"https:":443},rv=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),ov=(t,i)=>{var e;const s=String(i);return{method:String(t).toUpperCase(),url:(null===(e=$l(s))||void 0===e?void 0:e.href)||s}},lv=(t,i,e,s,n,r,o=!1)=>{try{var l,a;const u=n();if(!u)return;const h=e||void 0,c=sv()-s,d=$l(i.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||i.url,method:i.method},f=fi(u.name)?u.name(v):mi(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=o&&!h?void 0:((t,i)=>t?400>t?void 0:String(t):(null==i?void 0:i.name)||"_OTHER")(h,r),g=as(as(as(as(as({},(t=>{const i=rv.has(t)?t:"_OTHER";return as({"http.request.method":i},"_OTHER"===i&&t!==i?{"http.request.method_original":t}:{})})(v.method)),d?(t=>{return{"server.address":t.hostname.startsWith("[")&&t.hostname.endsWith("]")?t.hostname.slice(1,-1):t.hostname,"server.port":Number(t.port)||nv[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(i=t.pathname,i.split("/").map(t=>(t=>/^\d+$/.test(t)||t.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(t))(t)?":id":t).join("/"))};var i})(d):{}),h?{"http.response.status_code":h}:{}),p?{"error.type":p}:{}),null===(l=u.attributes)||void 0===l?void 0:l.call(u,v,{status:h,durationMs:c}));null===(a=t.metrics)||void 0===a||a.histogram(f,c,{unit:"ms",attributes:g})}catch(t){ev.error("Failed to record network metric",t)}},av=()=>{},uv=(t,i)=>fi(null==qt?void 0:qt.fetch)?Dh(qt,"fetch",e=>function(...s){const n=sv(),r=e.apply(this,s);if(!i())return r;try{var o,l,a;const[e,u]=s,h=ov(null!==(o=null!==(l=null==u?void 0:u.method)&&void 0!==l?l:null==e?void 0:e.method)&&void 0!==o?o:"GET",null!==(a=null==e?void 0:e.url)&&void 0!==a?a:e);return r.then(e=>(lv(t,h,null==e?void 0:e.status,n,i,void 0,!0),e),e=>{throw lv(t,h,void 0,n,i,e),e})}catch(t){return ev.error("Failed to observe fetch",t),r}}):av,hv=(t,i)=>{var e;const s=null==qt||null===(e=qt.XMLHttpRequest)||void 0===e?void 0:e.prototype;if(!s)return av;const n=new WeakMap,r=Dh(s,"open",t=>function(...i){try{(()=>Ja.has(this))()||n.set(this,ov(i[0],i[1]))}catch(t){ev.error("Failed to observe XHR open",t)}return t.apply(this,i)}),o=Dh(s,"send",e=>function(...s){let r;try{const e=n.get(this);if(e&&i()){const s=sv();r=()=>{this.removeEventListener("loadend",r),lv(t,e,this.status,s,i)},Lr(this,"loadend",r)}}catch(t){ev.error("Failed to observe XHR send",t)}try{return e.apply(this,s)}catch(t){throw r&&this.removeEventListener("loadend",r),t}});return()=>{r(),o()}},cv=new WeakMap,dv=new Set(["$comment","$defs","$id","$schema","additionalProperties","default","definitions","deprecated","description","examples","minProperties","properties","readOnly","required","title","type","writeOnly"]),vv={maxStringLength:2048,truncationSuffix:"..."},fv={maxStringLength:2048,truncationSuffix:"..."};function pv(t){if(t)return!0===t?{intent:!0,model:!0}:{intent:!1!==t.intent,model:!1!==t.model}}function gv(t,i){return{}.hasOwnProperty.call(t,i)}function _v(t,i){const e=Object.create(t);return i&&Object.defineProperty(e,"inputSchema",{configurable:!0,enumerable:!0,writable:!0,value:i}),e}function mv(t,i,e=!1){if(!mi(t))return;const s=t.trim();return s?(e?Yn(s,vv):s).slice(0,i):void 0}function yv(t){try{return pi(t)&&!0===t.isError}catch(t){return!1}}function bv(t){return Yn(t||"Unknown error",fv).slice(0,2048)}function wv(t,i){try{return bv(i?function(t){try{if(!pi(t)||!vi(t.content))return;return t.content.filter(t=>pi(t)&&"text"===t.type&&mi(t.text)).map(t=>t.text).join(" ").trim()||void 0}catch(t){return}}(t):pi(t)&&mi(t.message)?t.message:mi(t)?t:String(t))}catch(t){return"Unknown error"}}function $v(t,i,e){return i.errorResult?[{type:"Error",value:e,mechanism:{type:"generic",handled:!0,synthetic:!0,exception_id:0}}]:t.buildProperties(i.error,{handled:!0}).$exception_list.map(t=>as(as({},t),{},{value:bv(t.value)}))}function xv(t,i){if(i)return"Error";try{if(!pi(t))return"Error";let i=mi(t.name)?t.name.trim():"";const e=t.constructor;return i&&"Error"!==i||!fi(e)||"Error"===e.name||(i=e.name),(i||"Error").slice(0,256)}catch(t){return"Error"}}function Sv(t,i){return{message:wv(t,i),type:xv(t,i)}}const Ev={featureFlags:class extends bc{constructor(t){const i=new $c(t.config,t.Yu());super(i),this.name=rh,this._instance=t,this.yf=i}get Jd(){return this._instance.persistence}updateConfig(t,i){this.yf.update(t,i),this.Zd()}}},kv={sessionRecording:class{get Dr(){return this._instance.config}get xc(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.bf)||void 0===t?void 0:t.isStarted)}get status(){var t,i;return"awaiting_config"===this._f||"missing_config"===this._f?this._f:null!==(t=null===(i=this.bf)||void 0===i?void 0:i.status)&&void 0!==t?t:this._f}constructor(t){if(this._instance=t,this._forceAllowLocalhostNetworkCapture=!1,this._f=Hh,this.wf=void 0,this.kf=!1,this.Ye=(()=>{var t,i;if(!(null==Gt?void 0:Gt.visibilityState)||"visible"===Gt.visibilityState)return!0;const e=null==qt||null===(t=qt.performance)||void 0===t||null===(i=t.getEntriesByType)||void 0===i?void 0:i.call(t,"visibility-state");return!(null==e?void 0:e.length)||e.some(t=>"visible"===t.name)})(),this.an=()=>{var t,i;"visible"===(null==Gt?void 0:Gt.visibilityState)&&(this.Ye=!0,null===(t=this.bf)||void 0===t||null===(i=t.setDocumentWasEverVisible)||void 0===i||i.call(t,!0))},!this._instance.sessionManager)throw Wh.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Dr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==Gt?void 0:Gt.addEventListener)&&Lr(Gt,"visibilitychange",this.an)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var i;this.kf=!0,null==Gt||null===(i=Gt.removeEventListener)||void 0===i||i.call(Gt,"visibilitychange",this.an),t?this.Sf(!0):this.stopRecording()}get xf(){var t;const i=!!(null===(t=this._instance.get_property("$session_recording_remote_config"))||void 0===t?void 0:t.enabled),e=!this.Dr.disable_session_recording,s=this.Dr.disable_session_recording||this._instance.consent.isOptedOut();return qt&&i&&e&&!s}startIfEnabledOrStop(t){var i;if(this.kf)return;if(this.xf&&(null===(i=this.bf)||void 0===i?void 0:i.isStarted))return;const e=!_i(Object.assign)&&!_i(Array.from);this.xf&&e?(this.$f(t),Wh.info("starting")):(this._f=Hh,this.stopRecording())}$f(t){var i,e;if(this.xf)if("awaiting_config"!==this._f&&"missing_config"!==this._f&&(this._f=qh),(null==ii||null===(i=ii.__PosthogExtensions__)||void 0===i||null===(i=i.rrweb)||void 0===i?void 0:i.record)&&(null===(e=ii.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))this.Cf(t);else{var s,n;const i=this._instance.sessionManager;null===(s=ii.__PosthogExtensions__)||void 0===s||null===(n=s.loadExternalDependency)||void 0===n||n.call(s,this._instance,this.Tf,e=>{if(!this.kf&&this.xf&&this._instance.sessionManager===i)return e?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Wh.error("could not load recorder",e)):void this.Cf(t);this._f="disabled"})}}stopRecording(){var t,i;null===(t=this.wf)||void 0===t||t.call(this),this.wf=void 0,null===(i=this.bf)||void 0===i||i.stop()}Sf(t=!1){var i,e;null===(i=this.wf)||void 0===i||i.call(this),this.wf=void 0,null===(e=this.bf)||void 0===e||e.discard({discardProducerEvents:t})}If(){var t,i;null===(t=this.xc)||void 0===t||t.unregister("$session_is_sampled"),null===(i=this.xc)||void 0===i||i.unregister("$replay_sample_rate")}Ef(t,i){if(wi(t))return null;const e=$i(t)?t:parseFloat(t);return"number"!=typeof(s=e)||!Number.isFinite(s)||0>s||s>1?(Wh.warn(`${i} must be between 0 and 1. Ignoring invalid value:`,t),null):e;var s}Mf(t){if(this.xc){var i,e;const s=this.xc,n=()=>{var i;const e=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Ef(null===(i=this.Dr.session_recording)||void 0===i?void 0:i.sampleRate,"session_recording.sampleRate"),r=this.Ef(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=n?n:r;wi(o)&&this.If();const l=null==e?void 0:e.minimumDurationMilliseconds;s.register({[G]:as(as({cache_timestamp:Date.now(),enabled:!!e},e),{},{networkPayloadCapture:as({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:o,minimumDurationMilliseconds:_i(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.wf)||void 0===i||i.call(this),this.wf=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.onSessionId(n)}}onRemoteConfig(t){const i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.Mf(i),void this.Sf()):(this.Mf(i),void this.startIfEnabledOrStop()):("awaiting_config"===this._f&&(this._f="missing_config",this._instance.register_for_session({[Tt]:!0}),Wh.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i="log"){var e;(null===(e=this.bf)||void 0===e?void 0:e.log)?this.bf.log(t,i):Wh.warn("log called before recorder was ready")}get Tf(){var t,i;const e=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(G);return(null==e||null===(i=e.scriptConfig)||void 0===i?void 0:i.script)||"lazy-recorder"}Af(){const t=this._instance.get_property(G);if(!t)return!1;let i;try{i="object"==typeof t?t:JSON.parse(t)}catch(t){return Wh.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!wi(i.cache_timestamp)&&36e5>=Date.now()-i.cache_timestamp}Cf(t){var i,e,s;if(!this.kf&&this.xf&&this._instance.sessionManager){if(!(null===(i=ii.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))return Wh.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[kt]:!0});var n;if(this.bf||(this.bf=null===(n=ii.__PosthogExtensions__)||void 0===n?void 0:n.initSessionRecording(this._instance,this.Ye),this.bf._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Af()){if("missing_config"===this._f||"awaiting_config"===this._f)return;return this._f="awaiting_config",Wh.info("persisted remote config is stale, requesting fresh config before starting"),void new pa(this._instance).load()}this._f=qh,null===(e=(s=this.bf).setDocumentWasEverVisible)||void 0===e||e.call(s,this.Ye),this.bf.start(t)}else this._f=Hh}onRRwebEmit(t){var i,e;null===(i=this.bf)||void 0===i||null===(e=i.onRRwebEmit)||void 0===e||e.call(i,t)}overrideLinkedFlag(){var t,i;this.bf||null===(i=this.xc)||void 0===i||i.register({$replay_override_linked_flag:!0}),null===(t=this.bf)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.bf||null===(i=this.xc)||void 0===i||i.register({$replay_override_sampling:!0}),null===(t=this.bf)||void 0===t||t.overrideSampling()}overrideTrigger(t){var i,e;this.bf||null===(e=this.xc)||void 0===e||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(i=this.bf)||void 0===i||i.overrideTrigger(t)}get sdkDebugProperties(){var t;const i={};for(const t of Vh){var e;const s=null===(e=this._instance.sessionPersistence)||void 0===e?void 0:e.get_property(t);_i(s)||(i[t]=s)}return as(as({},i),(null===(t=this.bf)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status})}tryAddCustomEvent(t,i){var e;return!!(null===(e=this.bf)||void 0===e?void 0:e.tryAddCustomEvent(t,i))}flushBeforeIdentityReset(){var t,i;null===(t=this.bf)||void 0===t||null===(i=t.flushBeforeIdentityReset)||void 0===i||i.call(t)}}},Tv={autocapture:class extends nh{constructor(t){super(new Ch(t)),this.instance=t}},historyAutocapture:class{constructor(t){this.Rf=!1,this._instance=t,this.Pf=this.Of()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.Ff();return!!(t.path||t.search||this.Df(t))}startIfEnabled(){this.isEnabled&&(Tr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Pf=this.Of(),this.startIfEnabled()}stop(){this.Lf&&this.Lf(),this.Lf=void 0,this.Nf&&this.Nf(),this.Nf=void 0,Tr.info("History API monitoring stopped")}monitorHistoryChanges(){qt&&qt.history&&(this.jf("pushState"),this.jf("replaceState"),this.qf(),this.Df()&&this.Bf())}jf(t){var i;if(!qt||(null===(i=qt.history[t])||void 0===i?void 0:i.__posthog_wrapped__))return;const e=this;Dh(qt.history,t,i=>function(s,n,r){var o;e.zf(r)&&e.Hf(),i.call(this,s,n,r),e.Uf(t,!e.Rf&&"popstate"!==(null==qt||null===(o=qt.event)||void 0===o?void 0:o.type))})}Of(){const t=null==qt?void 0:qt.location;if(null==t?void 0:t.pathname)return{pathname:t.pathname,search:t.search,hash:t.hash}}Ff(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:pi(t)?t:{}}Df(t=this.Ff()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Wf(t){const i=this.Ff(),e=this.Pf;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.Df(i)&&t.hash!==e.hash))}Uf(t,i=!1){try{i||this.Hf();const e=this.Of();if(!e)return;if(this.Wf(e)){const e=()=>this._instance.capture(Ut,{navigation_type:t});i?(this.Vf=e,Promise.resolve().then(()=>this.Hf())):e()}this.Pf=e}catch(i){Tr.error(`Error capturing ${t} pageview`,i)}}zf(t){var i,e;return!(wi(t)||!qt)&&(null===(i=$l(String(t)))||void 0===i?void 0:i.href)!==(null===(e=qt.location)||void 0===e?void 0:e.href)}Hf(){const t=this.Vf;if(t){this.Vf=void 0,this.Rf=!0;try{t()}catch(t){Tr.error("Error capturing deferred pageview",t)}finally{this.Rf=!1}this.Pf=this.Of()}}qf(){if(this.Lf)return;const t=()=>{this.Uf("popstate")};Lr(qt,"popstate",t),this.Lf=()=>{qt&&qt.removeEventListener("popstate",t)}}Bf(){if(this.Nf)return;const t=()=>{this.Uf("hashchange")};Lr(qt,"hashchange",t),this.Nf=()=>{qt&&qt.removeEventListener("hashchange",t)}}},heatmaps:class{get Dr(){return this.instance.config}constructor(t){var i;this.Gf=!1,this.dl=!1,this.Qf=null,this.instance=t,this.Gf=!!(null===(i=this.instance.persistence)||void 0===i?void 0:i.props[L]),this.rageclicks=new Ku(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return pi(this.Dr.capture_heatmaps)&&this.Dr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Dr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return wi(this.Dr.capture_heatmaps)?wi(this.Dr.enable_heatmaps)?this.Gf:this.Dr.enable_heatmaps:!1!==this.Dr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.dl)return;Gh.info("starting..."),this.Jf(),this.an()}else{var t;clearInterval(null!==(t=this.Qf)&&void 0!==t?t:void 0),this.Zf(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("heatmaps"in i))return;const e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[L]:e}),this.Gf=e,this.startIfEnabled()}getAndClearBuffer(){const t=this.At;return this.At=void 0,t}Kf(t){Kh(t.originalEvent)&&this.Lr(t.originalEvent,"deadclick")}an(){this.Qf&&clearInterval(this.Qf),this.Qf="visible"===(null==Gt?void 0:Gt.visibilityState)?setInterval(this.uc.bind(this),this.flushIntervalMilliseconds):null}Jf(){qt&&Gt&&(this.Yf=this.uc.bind(this),Lr(qt,jt,this.Yf),this.Xf=t=>this.Lr(t||(null==qt?void 0:qt.event)),Lr(Gt,"click",this.Xf,{capture:!0}),this.tp=t=>this.ep(t||(null==qt?void 0:qt.event)),Lr(Gt,"mousemove",this.tp,{capture:!0}),this.np=new hl(this.instance,al,this.Kf.bind(this)),this.np.startIfEnabledOrStop(),this.sp=this.an.bind(this),Lr(Gt,m,this.sp),this.dl=!0)}Zf(){var t;qt&&Gt&&(this.Yf&&qt.removeEventListener(jt,this.Yf),this.Xf&&Gt.removeEventListener("click",this.Xf,{capture:!0}),this.tp&&Gt.removeEventListener("mousemove",this.tp,{capture:!0}),this.sp&&Gt.removeEventListener(m,this.sp),clearTimeout(this.rp),null===(t=this.np)||void 0===t||t.stop(),this.dl=!1)}op(t,i){const e=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),r=function(t,i,e){let s=t;for(;s&&yo(s)&&!bo(s,"body");){if(s===e)return!1;let t;try{var n,r,o;t=null===(n=null!==(r=null===(o=s.ownerDocument)||void 0===o?void 0:o.defaultView)&&void 0!==r?r:qt)||void 0===n?void 0:n.getComputedStyle(s).position}catch(t){return!1}if(oi(i,t))return!0;s=Co(s)}return!1}(Po(t),["fixed","sticky"],n);return{x:t.clientX+(r?0:s),y:t.clientY+(r?0:e),target_fixed:r,type:i}}Lr(t,i="click"){var e;if(mo(t.target)||!Kh(t))return;const s=this.op(t,i);(null===(e=this.rageclicks)||void 0===e?void 0:e.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&qo(Po(t),this.instance.config.rageclick)&&this.Qs(as(as({},s),{},{type:"rageclick"})),this.Qs(s)}ep(t){!mo(t.target)&&Kh(t)&&(clearTimeout(this.rp),this.rp=setTimeout(()=>{this.Qs(this.op(t,"mousemove"))},500))}Qs(t){if(!qt)return;const i=this.Dr.disable_capture_url_hashes?ts(qt.location.href):qt.location.href,e=this.Dr.custom_personal_data_properties,s=this.Dr.mask_personal_data_properties?[...Rl,...e||[]]:[],n=Pl(i,s,Cl);this.At=this.At||{},this.At[n]||(this.At[n]=[]),this.At[n].push(t)}uc(){this.At&&!gi(this.At)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:hl,webVitalsAutocapture:class{constructor(t){var i;this._instance=t,this.Gf=!1,this.dl=!1,this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.ap=(t=!1)=>{clearTimeout(this.lp),this.lp=void 0,0!==this.At.metrics.length&&(this._instance.capture("$web_vitals",as({$current_url:this.At.url},this.At.metrics.reduce((t,i)=>as(as({},t),{},{[`$web_vitals_${i.name}_event`]:as({},i),[`$web_vitals_${i.name}_value`]:i.value}),{})),t?{transport:"sendBeacon",send_instantly:!0}:void 0),this.At={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.up=t=>{var i;if(this.At=this.At||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},wi(null==t?void 0:t.name)||wi(null==t?void 0:t.value))return void Lh.error("Invalid metric received",t);const e="string"==typeof t.navigationURL?t.navigationURL:void 0,s=this.cp(e);if(_i(s))return;const n=$i(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${s}`;if(this.hp&&t.value>=this.hp)return void Lh.error("Ignoring metric with value >= "+this.hp,t);this.At.navigationKey!==n&&(this.ap(),this.lp=setTimeout(this.ap,this.flushToCaptureTimeoutMs)),_i(this.At.navigationKey)&&(this.At.navigationKey=n,this.At.url=s),this.At.firstMetricTimestamp=_i(this.At.firstMetricTimestamp)?Date.now():this.At.firstMetricTimestamp;const r=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.checkAndGetSessionAndWindowId(!0),o=as(as(as({},t),e?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete o.entries,pi(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const i={};for(const e of zh){const s="url"===e&&"string"==typeof t.attribution[e]?this.cp(t.attribution[e]):t.attribution[e];_i(s)||(i[e]=s)}o.attribution=i}else delete o.attribution;_i(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.At.metrics.push(o),this.At.metrics.length===this.allowedMetrics.length&&this.ap()},this.dp=()=>{if(this.dl)return;let t,i,e,s,n=!1;const r=ii.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,l=(null==o?void 0:o[this.vp])||("web-vitals"===this.vp&&_i(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!_i(l)){const r=l.withoutAttribution,o=this.attributionMetrics;n=!_i(r),t=o.indexOf("LCP")>-1?l.onLCP:(null==r?void 0:r.onLCP)||l.onLCP,i=o.indexOf("CLS")>-1?l.onCLS:(null==r?void 0:r.onCLS)||l.onCLS,e=o.indexOf("FCP")>-1?l.onFCP:(null==r?void 0:r.onFCP)||l.onFCP,s=o.indexOf("INP")>-1?l.onINP:(null==r?void 0:r.onINP)||l.onINP}if(!(t&&i&&e&&s))return void Lh.error("web vitals callbacks not loaded - not starting");const a={reportSoftNavs:this.useSoftNavs},u=n&&this.attributionMetrics.indexOf("INP")>-1?as(as({},a),{},{includeProcessedEventEntries:!1}):a;this.allowedMetrics.indexOf("LCP")>-1&&t(this.up.bind(this),a),this.allowedMetrics.indexOf("CLS")>-1&&i(this.up.bind(this),a),this.allowedMetrics.indexOf("FCP")>-1&&e(this.up.bind(this),a),this.allowedMetrics.indexOf("INP")>-1&&s(this.up.bind(this),u);const h=null==qt?void 0:qt.document;Lr(h,m,()=>{"hidden"===(null==h?void 0:h.visibilityState)&&this.ap(!0)}),Lr(qt,"pagehide",()=>this.ap(!0)),this.dl=!0},this.Gf=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[z]),this.startIfEnabled()}get fp(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i;const e=pi(this.fp)?null===(t=this.fp)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return wi(e)?(null===(i=this._instance.persistence)||void 0===i?void 0:i.props.$web_vitals_allowed_metrics)||Uh:e}get flushToCaptureTimeoutMs(){return(pi(this.fp)?this.fp.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=pi(this.fp)?this.fp.web_vitals_attribution:void 0;return Si(t)?t?Uh:[]:vi(t)?t:Bh}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=pi(this.fp)?this.fp.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get hp(){const t=pi(this.fp)&&$i(this.fp.__web_vitals_max_value)?this.fp.__web_vitals_max_value:jh;return t>0&&6e4>=t?jh:t}get isEnabled(){const t=null==Kt?void 0:Kt.protocol;if("http:"!==t&&"https:"!==t)return Lh.info("Web Vitals are disabled on non-http/https protocols"),!1;const i=pi(this.fp)?this.fp.web_vitals:Si(this.fp)?this.fp:void 0;return Si(i)?i:this.Gf}startIfEnabled(){this.isEnabled&&!this.dl&&(Lh.info("enabled, starting..."),this.Pl(this.dp))}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if(!("capturePerformance"in i))return;const e=pi(i.capturePerformance)&&!!i.capturePerformance.web_vitals,s=pi(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[z]:e}),this._instance.persistence.register({[V]:s})),this.Gf=e,this.startIfEnabled()}get vp(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}Pl(t){var i;const e=ii.__PosthogExtensions__,s=this.vp,n=null==e?void 0:e.postHogWebVitalsCallbacksByFlavor;(null==n?void 0:n[s])||"web-vitals"===s&&_i(n)&&(null==e?void 0:e.postHogWebVitalsCallbacks)?t():null==e||null===(i=e.loadExternalDependency)||void 0===i||i.call(e,this._instance,s,i=>{i?Lh.error("failed to load script",i):t()})}cp(t){const i=t||(null==qt?void 0:qt.location.href);if(!i)return void Lh.error("Could not determine current URL");const e=this._instance.config.disable_capture_url_hashes?ts(i):i,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Rl,...s||[]]:[];return Pl(e,n,Cl)}}},Pv={exceptionObserver:class{constructor(t){var i;this.dp=()=>{var t;if(!qt||!this.isEnabled||!(null===(t=ii.__PosthogExtensions__)||void 0===t?void 0:t.errorWrappingFunctions))return;const i=ii.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=ii.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=ii.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.pp&&this.Dr.capture_unhandled_errors&&(this.pp=i(this.captureException.bind(this))),!this.gp&&this.Dr.capture_unhandled_rejections&&(this.gp=e(this.captureException.bind(this))),!this.mp&&this.Dr.capture_console_errors&&(this.mp=s(this.captureException.bind(this)))}catch(t){Ih.error("failed to start",t),this.yp()}},this._instance=t,this.bp=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[j]),this.kt=new Bi(as(as({},function(t={}){var i,e,s,n;return{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(s=null!==(n=t.exceptionRateLimiterBucketSize)&&void 0!==n?n:t.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,A:Ih})),this.Dr=this._p(),this.startIfEnabledOrStop()}_p(){const t=this._instance.config.capture_exceptions;let i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return pi(t)?i=as(as({},i),t):(_i(t)?this.bp:t)&&(i=as(as({},i),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Dr.capture_console_errors||this.Dr.capture_unhandled_errors||this.Dr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Ih.info("enabled"),this.yp(),this.Pl(this.dp)):this.yp()}Pl(t){var i,e,s;(null===(i=ii.__PosthogExtensions__)||void 0===i?void 0:i.errorWrappingFunctions)?t():null===(e=ii.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"exception-autocapture",i=>{if(i)return Ih.error("failed to load script",i);t()})}yp(){var t,i,e;null===(t=this.pp)||void 0===t||t.call(this),this.pp=void 0,null===(i=this.gp)||void 0===i||i.call(this),this.gp=void 0,null===(e=this.mp)||void 0===e||e.call(this),this.mp=void 0}onRemoteConfig(t){if(!t.ok)return;const i=t.config;"autocaptureExceptions"in i&&(this.bp=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[j]:this.bp}),this.Dr=this._p(),this.startIfEnabledOrStop())}onConfigChange(){this.Dr=this._p()}captureException(t){try{var i,e,s;const n=null!==(i=null==t||null===(e=t.$exception_list)||void 0===e||null===(e=e[0])||void 0===e?void 0:e.type)&&void 0!==i?i:"Exception";if(this.kt.consumeRateLimit(n))return void Ih.info("Skipping exception capture because of client rate limiting.",{exception:n});null===(s=this._instance.exceptions)||void 0===s||s.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var i,e;this.wp=[],this.kp=new ps([new Ds,new Vs,new Ls,new Ns,new qs,new Hs,new Us,new Ws],function(t,...i){return(e,s=0)=>{const n=[],r=e.split("\n"),o=Math.min(r.length,s+1e3),l=[];for(let e=s;o>e;e++){const s=r[e];if(s.length>1024)continue;const o=Ps.test(s)?s.replace(Ps,"$1"):s;if(!o.match(/\S*Error: /)){for(const e of i){const i=e(o,t);if(i){n.push(i);const t=Rs(n);if(t){for(let i=l.length-1;i>=0;i--){const e=l[i];if(t.start>=e.start+e.length)break;l.pop()}l.push(t)}break}}if(Ms(n,l)>=50)break}}const a=[...l].sort((t,i)=>i.start-t.start),u=a[a.length-1];if(u){const t=Cs(n,u);n.splice(u.start-t,t);for(const i of a)i.start-=t}for(const t of a)As(n,t);return l.some(t=>0===t.start&&n.length===t.length)&&function(t){const i=t.map(t=>`${t.function}|${t.filename}|${t.lineno}|${t.colno}|${t.module}`);let e=0;for(let t=1;i.length>t;t++)Fs(i,t,e)&&(e=t);t.push(...t.splice(0,e))}(n),function(t){if(!t.length)return[];const i=Array.from(t);return i.reverse(),i.slice(0,50).map(t=>{return as(as({},t),{},{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||"?"});var e})}(n)}}("web:javascript",Ss,Ts)),this._instance=t,this.wp=null!==(i=null===(e=this._instance.persistence)||void 0===e?void 0:e.get_property("$error_tracking_suppression_rules"))&&void 0!==i?i:[],this.Sp=Xs(this.xp()),this.$p=new Zs(this.Sp)}onConfigChange(){this.Sp=Xs(this.xp()),this.$p.setConfig(this.Sp)}onRemoteConfig(t){var i,e,s;if(!t.ok)return;const n=t.config;if(!("errorTracking"in n))return;const r=null!==(i=null===(e=n.errorTracking)||void 0===e?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null===(s=n.errorTracking)||void 0===s?void 0:s.captureExtensionExceptions;this.wp=r,this._instance.persistence&&this._instance.persistence.register({[U]:this.wp,[B]:o})}get Cp(){var t;const i=!!this._instance.get_property(B),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.kp.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.Sp.enabled)try{if(!mi(t)||0===t.trim().length)return void Sc.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:e,droppedKeys:s}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};const i=[];return{sanitizedProperties:Object.keys(t).reduce((e,s)=>Ys.has(s)?(i.push(s),e):(e[s]=t[s],e),{}),droppedKeys:i}}(this.Tp(i));s.length>0&&Sc.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.$p.add(as({[Gs]:t,[Ks]:(new Date).toISOString()},e))}catch(t){Sc.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const i=t.$exception_list;if(this.Ip(i)){if(this.Ep(i))return this.Mp("Exception dropped: matched a suppression rule"),void Sc.info("Skipping exception capture because a suppression rule matched");if(!this.Cp&&this.Ap(i))return this.Mp("Exception dropped: thrown by a browser extension"),void Sc.info("Skipping exception capture because it was thrown by an extension");if(!this.Cp&&this.Rp(i))return this.Mp("Exception dropped: thrown by an injected browser script"),void Sc.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Pp(i))return this.Mp("Exception dropped: thrown by the PostHog SDK"),void Sc.info("Skipping exception capture because it was thrown by the PostHog SDK")}const e=this.Sp.enabled&&wi(t.$exception_steps)?this.Op(t):t,s=function(){if("u">typeof process){var t;const i=null===(t=process.env.POSTHOG_RELEASE_ID)||void 0===t?void 0:t.trim();if(i)return i}const i=globalThis._posthogReleaseId;return"string"==typeof i&&i.length>0?i:void 0}();s&&(e.$release_id=s);try{const t=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",hd:!0});return t&&this.$p.clear(),t}catch(t){return xc(t)||Sc.error("Failed to capture exception event. Dropping this exception.",t),void this.$p.clear()}}catch(t){return void(xc(t)||Sc.error("Failed to process exception event. Ignoring this exception.",t))}}Op(t){try{const i=this.$p.getAttachable();return 0===i.length?t:as(as({},t),{},{$exception_steps:i})}catch(i){return Sc.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Mp(t){this.Sp.enabled&&this.$p.add({[Gs]:t,[Ks]:(new Date).toISOString()})}Tp(t){return pi(t)?as({},t):{}}xp(){var t,i;return null!==(t=null===(i=this._instance.config.error_tracking)||void 0===i?void 0:i.exception_steps)&&void 0!==t?t:{}}Ep(t){if(0===t.length)return!1;try{const i=t.reduce((t,{type:i,value:e})=>(mi(i)&&i.length>0&&t.$exception_types.push(i),mi(e)&&e.length>0&&t.$exception_values.push(e),t),{$exception_types:[],$exception_values:[]});return this.wp.some(t=>{const e=t.values.map(t=>{const e=Iu[t.operator],s=i[t.key];if(!e||!s)return!1;const n=vi(t.value)?t.value:[t.value];return n.length>0&&e(n,s)});return"OR"===t.type?e.some(Boolean):e.every(Boolean)})}catch(t){return Sc.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Ap(t){const i=t.flatMap(t=>{var i,e;return null!==(i=null===(e=t.stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[]}),e=i.filter(({filename:t})=>!!t&&Tc.some(i=>t.startsWith(i)));return 0!==e.length&&(!e.every(({filename:t})=>!!t&&t.startsWith(Ec))||t.some(({type:t,value:i})=>"NoResponse"===t||mi(i)&&kc.some(({value:t,exact:e})=>e?i===t:i.includes(t)))&&!i.some(({in_app:t,filename:i})=>t&&!(null==i?void 0:i.startsWith(Ec))))}Rp(t){return t.some(({value:t})=>mi(t)&&Pc.some(i=>t.includes(i)))}Pp(t){if(t.length>0){var i,e,s,n;const r=null!==(i=null===(e=t[0].stacktrace)||void 0===e?void 0:e.frames)&&void 0!==i?i:[],o=r[r.length-1];return null!==(s=null==o||null===(n=o.filename)||void 0===n?void 0:n.includes("posthog.com/static"))&&void 0!==s&&s}return!1}Ip(t){return!wi(t)&&vi(t)}}},Ov=as({productTours:class{get xc(){return this._instance.persistence}constructor(t){this.Fp=null,this.Dp=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const i=t.config;if("productTours"in i){var e,s;if(this.xc&&this.xc.register({[q]:!!i.productTours}),!Jh(this._instance))return!this.Fp&&wi(null===(e=this.xc)||void 0===e?void 0:e.props.ph_product_tours)||Yh.info("product tours disabled; stopping and clearing cached tours"),null===(s=this.Fp)||void 0===s||s.stop(),this.Fp=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Fp&&Jh(this._instance)&&this.Pl(()=>this.Lp())}Pl(t){var i,e,s;(null===(i=ii.__PosthogExtensions__)||void 0===i?void 0:i.generateProductTours)?t():null===(e=ii.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"product-tours",i=>{i?Yh.error("Could not load product tours script",i):t()})}Lp(){var t;!this.Fp&&(null===(t=ii.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.Fp=ii.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i=!1){if(vi(this.Dp)&&!i)return void t(this.Dp,{isLoaded:!0});const e=this.xc;if(e){const s=e.props[at];if(vi(s)&&!i)return this.Dp=s,void t(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:i=>{if(!Jh(this._instance))return void t([],{isLoaded:!0});const s=i.statusCode;if(200!==s||!i.json){const e=`Product Tours API could not be loaded, status: ${s}`;return 0===s?i.error||Yh.warn(e):Yh.error(e),void t([],{isLoaded:!1,error:e})}const n=vi(i.json.product_tours)?i.json.product_tours:[];this.Dp=n,e&&e.register({[at]:n}),t(n,{isLoaded:!0})}})}getActiveProductTours(t){wi(this.Fp)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Fp.getActiveProductTours(t)}showProductTour(t){var i;null===(i=this.Fp)||void 0===i||i.showTourById(t)}previewTour(t){this.Fp?this.Fp.previewTour(t):this.Pl(()=>{var i;this.Lp(),null===(i=this.Fp)||void 0===i||i.previewTour(t)})}dismissProductTour(){var t;null===(t=this.Fp)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.Fp)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.Fp)||void 0===t||t.previousStep()}clearCache(){var t;this.Dp=null,null===(t=this.xc)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var i;null===(i=this.Fp)||void 0===i||i.resetTour(t)}resetAllTours(){var t;null===(t=this.Fp)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var i;null===(i=this.Fp)||void 0===i||i.cancelPendingTour(t)}}},Ev),Rv={siteApps:class{constructor(t){this._instance=t,this.Np=0,this.jp=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}qp(t,i){if(!i)return;const e=this.globalsForEvent(i);this.jp.push(e),this.jp.length>1e3&&(this.jp=this.jp.slice(10))}get siteAppLoaders(){var t;return null===(t=ii._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.siteApps}initialize(){if(this.isEnabled){const t=this._instance._addCaptureHook(this.qp.bind(this));this.Bp=()=>{t(),this.jp=[],this.Bp=void 0}}}globalsForEvent(t){var i,e,s,n,r,o,l;if(!t)throw new Error("Event payload is required");const a={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(const[t,i]of Object.entries(h))a[t]={id:u[t],type:t,properties:i};const{$set_once:c,$set:d}=t;return{event:as(as({},vn(t,Xh)),{},{properties:as(as(as({},t.properties),d?{$set:as(as({},null!==(i=null===(e=t.properties)||void 0===e?void 0:e.$set)&&void 0!==i?i:{}),d)}:{}),c?{$set_once:as(as({},null!==(s=null===(n=t.properties)||void 0===n?void 0:n.$set_once)&&void 0!==s?s:{}),c)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(l=t.properties)||void 0===l?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:a}}zp(t){var i;const e=null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase();if("style"===e&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(t)||(Zh.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===e&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(t)||(Zh.error("prepare_external_dependency_script returned null"),null)}return t}Hp(){var t,i,e,s,n,r,o,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const a=null==Gt?void 0:Gt.defaultView,u=null==a||null===(t=a.Node)||void 0===t?void 0:t.prototype;if(!a||!u)return()=>{};if(this.Np++,this.Up)return this.Wp();const h=[],c=this,d=new WeakSet,v=(t,i,e)=>{if(!(null==t?void 0:t[i]))return;const s=t[i];t[i]=e(s),h.push(()=>{t[i]=s})},f=t=>{if(d.has(t))return t;const i=c.zp(t);return i&&d.add(i),i},p=t=>t.map(t=>"string"==typeof t?t:f(t)).filter(t=>!bi(t));return v(u,"appendChild",t=>function(i){const e=f(i);return e?t.call(this,e):i}),v(u,"insertBefore",t=>function(i,e){const s=f(i);return s?t.call(this,s,e):i}),v(u,"replaceChild",t=>function(i,e){const s=f(i);return s?t.call(this,s,e):e}),[null===(i=a.Element)||void 0===i?void 0:i.prototype,null===(e=a.Document)||void 0===e?void 0:e.prototype,null===(s=a.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{v(t,"append",t=>function(...i){return t.apply(this,p(i))}),v(t,"prepend",t=>function(...i){return t.apply(this,p(i))})}),[null===(n=a.Element)||void 0===n?void 0:n.prototype,null===(r=a.CharacterData)||void 0===r?void 0:r.prototype,null===(o=a.DocumentType)||void 0===o?void 0:o.prototype].forEach(t=>{v(t,"before",t=>function(...i){return t.apply(this,p(i))}),v(t,"after",t=>function(...i){return t.apply(this,p(i))}),v(t,"replaceWith",t=>function(...i){const e=p(i);return i.length&&!e.length?void 0:t.apply(this,e)})}),v(null===(l=a.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",t=>function(i,e){const s=f(e);return s?t.call(this,i,s):null}),this.Up=()=>{h.forEach(t=>t()),this.Up=void 0},this.Wp()}Wp(){let t=!1;return()=>{var i;t||(t=!0,this.Np--,0===this.Np&&(null===(i=this.Up)||void 0===i||i.call(this)))}}Vp(t,i=!0){const e=this.Hp();try{const s=t(e);return i&&e(),s}catch(t){throw e(),t}}setupSiteApp(t){const i=this.apps[t.id],e=()=>{var e;!i.errored&&this.jp.length&&(Zh.info(`Processing ${this.jp.length} events for site app with id ${t.id}`),this.jp.forEach(t=>this.Vp(()=>{var e;return null===(e=i.processEvent)||void 0===e?void 0:e.call(i,t)})),i.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null===(e=this.Bp)||void 0===e||e.call(this))};let s=!1;const n=n=>{i.errored=!n,i.loaded=!0,Zh.info(`Site app with id ${t.id} ${n?"loaded":"errored"}`),s&&e()};try{const{processEvent:e}=this.Vp(i=>t.init({posthog:this._instance,callback(t){i(),n(t)}}),!1);e&&(i.processEvent=e),s=!0}catch(i){Zh.error(Qh+t.id,i),n(!1)}if(s&&i.loaded)try{e()}catch(e){Zh.error(`Error while processing buffered events PostHog app with config id ${t.id}`,e),i.errored=!0}}Gp(){const t=this.siteAppLoaders||[];for(const i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(const i of t)this.setupSiteApp(i)}Qp(t){if(0===Object.keys(this.apps).length)return;const i=this.globalsForEvent(t);for(const e of Object.values(this.apps))try{this.Vp(()=>{var t;return null===(t=e.processEvent)||void 0===t?void 0:t.call(e,i)})}catch(i){Zh.error(`Error while processing event ${t.event} for site app ${e.id}`,i)}}onRemoteConfig(t){var i,e,s;if(null===(i=this.siteAppLoaders)||void 0===i?void 0:i.length)return this.isEnabled?(this.Gp(),void this._instance.on("eventCaptured",t=>this.Qp(t))):void Zh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(e=this.Bp)||void 0===e||e.call(this),!t.ok)return;const n=t.config;if(null===(s=n.siteApps)||void 0===s?void 0:s.length)if(this.isEnabled)for(const{id:t,url:i}of n.siteApps){var r,o;ii[`__$$ph_site_app_${t}`]=this._instance,null===(r=ii.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,i,i=>{if(i)return Zh.error(Qh+t,i)})}else Zh.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Av={tracingHeaders:class{constructor(t){this._instance=t,this.Jp=void 0,this.Zp=void 0,this.Kp=void 0,this.dp=()=>{const t=this.Yp();var i,e;t?(_i(this.Jp)&&(this.Jp=null===(i=ii.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),_i(this.Zp)&&(this.Zp=null===(e=ii.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.yp()}}initialize(){this.startIfEnabledOrStop()}Pl(t){var i,e,s;(null===(i=ii.__PosthogExtensions__)||void 0===i?void 0:i.tracingHeadersPatchFns)?t():null===(e=ii.__PosthogExtensions__)||void 0===e||null===(s=e.loadExternalDependency)||void 0===s||s.call(e,this._instance,"tracing-headers",i=>{if(i)return Nh.error("failed to load script",i);t()})}Xp(){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}Yp(){const t=this.Xp();return vi(t)?(vi(this.Kp)?this.Kp.splice(0,this.Kp.length,...t):this.Kp=[...t],t.length>0?this.Kp:void 0):(vi(this.Kp)&&this.Kp.splice(0),this.Kp=t||void 0,this.Kp)}yp(){var t,i;null===(t=this.Jp)||void 0===t||t.call(this),null===(i=this.Zp)||void 0===i||i.call(this),this.Jp=void 0,this.Zp=void 0}startIfEnabledOrStop(){this.Yp()?this.Pl(this.dp):this.yp()}}},Cv=as({surveys:class extends lc{constructor(t){super(new ac(t))}}},Ev),Iv={toolbar:class{constructor(t){this.instance=t}tg(t){ii.ph_toolbar_state=t}eg(){var t;return null!==(t=ii.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t=void 0,i=void 0,e=void 0){var s,n;if(jr(this.instance.config))return!1;if(!qt||!Gt)return!1;t=null!==(s=t)&&void 0!==s?s:qt.location,e=null!==(n=e)&&void 0!==n?n:qt.history;try{if(!i){try{qt.localStorage.setItem("test","test"),qt.localStorage.removeItem("test")}catch(t){return!1}i=null==qt?void 0:qt.localStorage}const s=uc||Ol(t.hash,"__posthog")||Ol(t.hash,"state");let n;const r=s?is(()=>JSON.parse(atob(decodeURIComponent(s))))||is(()=>JSON.parse(decodeURIComponent(s))):null;return r&&"ph_authorize"===r.action?(n=r,n.source="url",n&&Object.keys(n).length>0&&(r.desiredHash?t.hash=r.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):(n=JSON.parse(i.getItem(hc)||"{}"),n.source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}ig(t){const i=ii.ph_load_toolbar||ii.ph_load_editor;!wi(i)&&fi(i)?i(t,this.instance):cc.warn("No toolbar load function found")}loadToolbar(t){const i=!!(null==Gt?void 0:Gt.getElementById("__POSTHOG_TOOLBAR__"));if(!qt||i)return!1;const e="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=as(as({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},e?{instrument:!1}:{});if(qt.localStorage.setItem(hc,JSON.stringify(as(as({},s),{},{source:void 0}))),2===this.eg())this.ig(s);else if(0===this.eg()){var n,r;this.tg(1),null===(n=ii.__PosthogExtensions__)||void 0===n||null===(r=n.loadExternalDependency)||void 0===r||r.call(n,this.instance,"toolbar",t=>{if(t)return cc.error("[Toolbar] Failed to load",t),void this.tg(0);this.tg(2),this.ig(s)}),Lr(qt,"turbolinks:load",()=>{this.tg(0),this.loadToolbar(s)})}return!0}ng(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,i=void 0,e=void 0){return this.maybeLoadToolbar(t,i,e)}}},Mv=as({experiments:class t{get Dr(){return this._instance.config}constructor(i){this._instance=i,this.getWebExperimentsAndEvaluateDisplayLogic=(i=!1)=>{this.getWebExperiments(i=>{t.sg("retrieved web experiments from the server"),this.rg=new Map,i.forEach(i=>{if(i.feature_flag_key){var e;this.rg&&(t.sg("setting flag key ",i.feature_flag_key," to web experiment ",i),null===(e=this.rg)||void 0===e||e.set(i.feature_flag_key,i));const s=this._instance.getFeatureFlag(i.feature_flag_key);mi(s)&&i.variants[s]&&this.og(i.name,s,i.variants[s].transforms)}else if(i.variants)for(const e in i.variants){const s=i.variants[e];t.ag(s,this._instance)&&this.og(i.name,e,s.transforms)}})},i)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(i){if(this._is_bot())t.sg(zd);else if(!this.Dr.disable_web_experiments){if(wi(this.rg))return this.rg=new Map,this.loadIfEnabled(),void this.previewWebExperiment();t.sg("applying feature flags",i),i.forEach(t=>{var i;if(this.rg&&(null===(i=this.rg)||void 0===i?void 0:i.has(t))){var e;const i=this._instance.getFeatureFlag(t),s=null===(e=this.rg)||void 0===e?void 0:e.get(t);i&&(null==s?void 0:s.variants[i])&&this.og(s.name,i,s.variants[i].transforms)}})}}previewWebExperiment(){const i=t.getWindowLocation();if(null==i?void 0:i.search){const e=Tl(null==i?void 0:i.search,"__experiment_id"),s=Tl(null==i?void 0:i.search,"__experiment_variant");e&&s&&(t.sg(`previewing web experiments ${e} && ${s}`),this.getWebExperiments(t=>{this.lg(parseInt(e),s,t)},!1,!0))}}loadIfEnabled(){this.Dr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Dr.disable_web_experiments&&!e)return t([]);const s=this._instance.get_property("$web_experiments");if(s&&!i)return t(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Dr.token}`),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}lg(i,e,s){const n=s.filter(t=>t.id===i);n&&n.length>0&&(t.sg(`Previewing web experiment [${n[0].name}] with variant [${e}]`),this.og(n[0].name,e,n[0].variants[e].transforms))}static ag(i,e){return!wi(i.conditions)&&t.ug(i,e)&&t.cg(i)}static ug(i,e){var s;if(wi(i.conditions)||wi(null===(s=i.conditions)||void 0===s?void 0:s.url))return!0;const n=t.getWindowLocation();if(n){var r,o,l;const t=_o(e,n.href);return!(null===(r=i.conditions)||void 0===r?void 0:r.url)||Wd[null!==(o=null===(l=i.conditions)||void 0===l?void 0:l.urlMatchType)&&void 0!==o?o:"icontains"](i.conditions.url,t)}return!1}static getWindowLocation(){return null==qt?void 0:qt.location}static cg(t){var i;if(wi(t.conditions)||wi(null===(i=t.conditions)||void 0===i?void 0:i.utm))return!0;const e=Ml();if(e.utm_source){var s,n,r,o,l,a,u,h;const i=!(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)||(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)==e.utm_campaign,c=!(null===(r=t.conditions)||void 0===r||null===(r=r.utm)||void 0===r?void 0:r.utm_source)||(null===(o=t.conditions)||void 0===o||null===(o=o.utm)||void 0===o?void 0:o.utm_source)==e.utm_source,d=!(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)||(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)==e.utm_medium,v=!(null===(u=t.conditions)||void 0===u||null===(u=u.utm)||void 0===u?void 0:u.utm_term)||(null===(h=t.conditions)||void 0===h||null===(h=h.utm)||void 0===h?void 0:h.utm_term)==e.utm_term;return i&&d&&v&&c}return!1}static sg(t,...i){Tr.info(`[WebExperiments] ${t}`,i)}static hg(i){("http://www.w3.org/1999/xhtml"===i.namespaceURI&&"template"===i.localName?i.content:i).querySelectorAll("a[target], template").forEach(i=>{var e;if("template"===i.localName)return void("http://www.w3.org/1999/xhtml"===i.namespaceURI&&t.hg(i));if("http://www.w3.org/1999/xhtml"!==i.namespaceURI||"_blank"!==(null===(e=i.getAttribute("target"))||void 0===e?void 0:e.toLowerCase()))return void i.removeAttribute("target");const s=(i.getAttribute("rel")||"").split(/\s+/).filter(t=>t&&!/^(opener|noopener)$/i.test(t));s.push("noopener"),i.setAttribute("rel",s.join(" "))})}og(i,e,s){this._is_bot()?t.sg(zd):"control"!==e?s.forEach(s=>{if(s.selector){var n;t.sg(`applying transform of variant ${e} for experiment ${i} `,s);const r=null===(n=document)||void 0===n?void 0:n.querySelectorAll(s.selector),o=new Map;null==r||r.forEach(i=>{if("script"===i.localName.toLowerCase())return;const e=i;if(s.html){var n;const l="http://www.w3.org/1998/Math/MathML"===i.namespaceURI&&"annotation-xml"===i.localName&&(null===(n=i.getAttribute("encoding"))||void 0===n?void 0:n.toLowerCase())||"",a=JSON.stringify([i.namespaceURI,i.localName,l]);let u=o.get(a);if(wi(u)){var r;const e=null!==(r=qd)&&void 0!==r?r:qd=Bd(),n=i.ownerDocument.implementation.createHTMLDocument(""),h=n.createElementNS(i.namespaceURI,i.localName);l&&h.setAttribute("encoding",l);const c=n.createRange();c.selectNodeContents(h);const d="http://www.w3.org/2000/svg"===i.namespaceURI&&/^(foreignObject|desc|title)$/.test(i.localName)||/^(text\/html|application\/xhtml\+xml)$/.test(l)?"http://www.w3.org/1999/xhtml":i.namespaceURI,v=c.createContextualFragment(s.html);"http://www.w3.org/1998/Math/MathML"===i.namespaceURI&&/^(mi|mo|mn|ms|mtext)$/.test(i.localName)?(h.appendChild(v),e.sanitize(h,as(as({},Hd),{},{NAMESPACE:d||void 0,IN_PLACE:!0}))):("http://www.w3.org/1999/xhtml"===h.namespaceURI&&"template"===h.localName?h.content:h).appendChild(e.sanitize(v,as(as({},Hd),{},{NAMESPACE:d||void 0,RETURN_DOM_FRAGMENT:!0}))),t.hg(h),u=h.innerHTML,o.set(a,u)}e.innerHTML=u}s.css&&e.setAttribute("style",s.css)})}}):t.sg("Control variants leave the page unmodified.")}_is_bot(){return Vt&&this._instance?Tu(Vt,this.Dr.custom_blocked_useragents):void 0}}},Ev),Fv={conversations:class{constructor(t){this._instance=t,this.dg=void 0,this._conversationsManager=null,this.vg=!1,this.ie=null,this.fg=!1,this.pg=0,this.gg=null,this.mg=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return void(this.gg=null);if(this.yg=t.ok,!t.ok)return;const i=t.config.conversations;wi(i)?this.gg=null:(Si(i)?this.dg=i:(this.dg=i.enabled,this.ie=i),this.dg||(this.gg=null),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.pg++,this.dg=void 0,this.ie=null,this.yg=void 0,this.fg=!1,this.gg=null}loadIfEnabled(){if(this._conversationsManager)return;if(this.vg)return;if(this._instance.config.disable_conversations)return;if(jr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==ii?void 0:ii.__PosthogExtensions__;if(t&&!_i(this.dg)&&this.dg)if(this.ie&&this.ie.token){this.vg=!0;try{const i=t.initConversations;if(i)return this.bg(i),void(this.vg=!1);const e=t.loadExternalDependency;if(!e)return void this._g(x);const s=this.pg;e(this._instance,"conversations",i=>{if(s!==this.pg)return this.vg=!1,void this.loadIfEnabled();i||!t.initConversations?this._g("Could not load conversations script",i):this.bg(t.initConversations),this.vg=!1})}catch(t){this._g("Error initializing conversations",t),this.vg=!1}}else Vd.error("Conversations enabled but missing token in remote config.")}bg(t){if(this.ie){try{this._conversationsManager=t(this.ie,this._instance),this.fg=!1,Vd.info("Conversations loaded successfully")}catch(t){return void this._g("Error completing conversations initialization",t)}this.mg&&this._conversationsManager.setTheme(this.mg),this.wg()}else Vd.error("Cannot complete initialization: remote config is null")}wg(){const t=this.gg;this.gg=null,this._conversationsManager&&t&&("open"===t?this._conversationsManager.open():this._conversationsManager.close())}_g(t,i){Vd.error(t,i),this._conversationsManager=null,this.vg=!1,this.fg=!0}show(){this._conversationsManager?this._conversationsManager.show():Vd.warn("Conversations not loaded yet.")}hide(){"open"===this.gg&&(this.gg=null),this._conversationsManager&&this._conversationsManager.hide()}open(){this._conversationsManager?(this.gg=null,this._conversationsManager.open()):this.gg="open"}close(){this._conversationsManager?(this.gg=null,this._conversationsManager.close()):this.gg="close"}setTheme(t){var i,e;this.mg=as(as(as({},this.mg),t),{},{dark:as(as({},null===(i=this.mg)||void 0===i?void 0:i.dark),null==t?void 0:t.dark)}),null===(e=this._conversationsManager)||void 0===e||e.setTheme(t)}isAvailable(){return!0===this.dg&&!bi(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":jr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.yg?"remote_config_failed":_i(this.dg)?this.yg?"disabled_in_project":"remote_config_pending":this.dg?wi(this.ie)||!this.ie.token?"missing_token":(null==ii?void 0:ii.__PosthogExtensions__)?this.vg?"initializing":this.fg?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var s=this;return Di(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,e):(Vd.warn(Gd),null)})()}getMessages(t,i){var e=this;return Di(function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(Vd.warn(Gd),null)})()}markAsRead(t){var i=this;return Di(function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Vd.warn(Gd),null)})()}getTickets(t){var i=this;return Di(function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Vd.warn(Gd),null)})()}requestRestoreLink(t){var i=this;return Di(function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Vd.warn(Gd),null)})()}restoreFromToken(t){var i=this;return Di(function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Vd.warn(Gd),null)})()}restoreFromUrlToken(){var t=this;return Di(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Vd.warn(Gd),null)})()}getCurrentTicketId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null===(i=this._conversationsManager)||void 0===i?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}_d(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}wd(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},Dv={logs:class extends iv{constructor(t){super({get(){var i;return null==t||null===(i=t.config)||void 0===i?void 0:i.logs},captureHintKey:W,get remoteConfigWillArrive(){var i,e;return!(null===(i=t.Yu)||void 0===i?void 0:i.call(t))||!!(null===(e=ii._POSTHOG_REMOTE_CONFIG)||void 0===e||null===(e=e[t.config.token])||void 0===e?void 0:e.config)}},()=>function(t){var i;const e={};if(e.distinctId=t.get_distinct_id(),t.sessionManager){const{sessionId:i,windowId:s,sessionStartTimestamp:n,lastActivityTimestamp:r}=t.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i,e.windowId=s,wi(n)||(e.sessionStartTimestamp=n),wi(r)||(e.lastActivityTimestamp=r)}if((null==ii||null===(i=ii.location)||void 0===i?void 0:i.href)&&(e.currentUrl=t.config.disable_capture_url_hashes?ts(ii.location.href):ii.location.href),t.featureFlags){const i=t.featureFlags.getFlags();i&&i.length>0&&(e.activeFeatureFlags=i)}return e}(t)),this._instance=t,this.name=oh,this.Zv()}get Qv(){return this._instance.__loaded}Jv(){const t=Pr("[logs]"),i=null==ii?void 0:ii.__PosthogExtensions__;if(!i)return void t.error("PostHog Extensions not found.");const e=i.loadExternalDependency;if(e)return t=>{e(this._instance,"logs",e=>{const s=i.logs;t(e,(null==s?void 0:s.initializeLogs)?{initialize:t=>s.initializeLogs(t),replay(t,i){var e;return null===(e=s.replayConsoleBuffer)||void 0===e?void 0:e.call(s,t,i)}}:void 0)})};t.error(x)}}},Nv={metrics:class{constructor(t){this._instance=t,this.A=Pr("[metrics]"),this.Ti=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.Ti)return;const i=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);i&&!this.kg?this.kg=(t=>{let i=!0;const e=()=>i?(t=>{var i;const e=null===(i=t.config.metrics)||void 0===i?void 0:i.network;return!0===e?{}:e||void 0})(t):void 0,s=uv(t,e),n=hv(t,e);return()=>{i=!1,s(),n()}})(this._instance):!i&&this.kg&&(this.kg(),this.kg=void 0)}Xv(){var t;const i=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var e;return this.Vv&&this.tf===i||(null===(e=this.Vv)||void 0===e||e.reset(),this.tf=i,this.Vv=new Sr(this.Yv(),function(t){var i,e,s,n,r;const o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==o?void 0:o["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==o?void 0:o["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(s=null==o?void 0:o["deployment.environment"])&&void 0!==s?s:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(n=null==t?void 0:t.flushIntervalMs)&&void 0!==n?n:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(i),this.A)),this.Vv}count(t,i=1,e){this.Xv().count(t,i,e)}gauge(t,i,e){this.Xv().gauge(t,i,e)}histogram(t,i,e){this.Xv().histogram(t,i,e)}flush(t){if(!this.Vv)return Promise.resolve();if(t){const i=this.Vv.drainWindow();return i&&this.bo(i,t),Promise.resolve()}return this.Vv.flush().catch(t=>this.A.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.Vv)||void 0===t||t.reset()}dispose(){var t,i;this.Ti=!0,null===(t=this.kg)||void 0===t||t.call(this),this.kg=void 0,null===(i=this.Vv)||void 0===i||i.reset()}Yv(){const t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},bo:t=>i.bo(t),getLibraryId:()=>e.LIB_NAME,getLibraryVersion:()=>e.LIB_VERSION}}bo(t,i){return new Promise(e=>{let s=!1;const n=t=>{s||(s=!0,clearTimeout(r),e(t))},r=setTimeout(()=>n({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(as(as({method:"POST",url:this.Sg(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i}),{},{fireCallbackOnDrop:!0,callback(t){const i=t.statusCode;if(i>=200&&300>i)n({kind:"ok"});else if(413===i)n({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)n({kind:"fatal",error:new Error(`metrics request failed with status ${i}`)});else{var e;n({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error(`metrics request failed with status ${i}`)})}}}))})}Sg(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Lv={webMCP:class{constructor(t){this._instance=t,this.xg=!1}initialize(){this.startIfEnabled()}startIfEnabled(){if(!this._instance.config.capture_webmcp||this.xg)return;const t=null==Gt?void 0:Gt.modelContext;if(!t||!fi(t.registerTool))return;const i=cv.get(t);if(i)return i.instances.add(this._instance),void(this.xg=!0);const e={instances:new Set([this._instance])},s=t.registerTool,n=this;Dh(t,"registerTool",t=>{const i=t;return function(t,...s){let r=t;try{r=n.$g(t,e)}catch(e){return i.call(this,t,...s)}return i.call(this,r,...s)}}),t.registerTool!==s&&(cv.set(t,e),this.xg=!0)}$g(t,i){if(!t||!fi(t.execute))return t;const e=t.execute,s=this,{tool:n,injected:r}=function(t,i){const e={intent:!1,model:!1},s=t.inputSchema;if(!function(t){return!!_i(t)||pi(t)&&Object.keys(t).every(t=>dv.has(t)||t.startsWith("x-"))&&!0!==t.additionalProperties&&!pi(t.additionalProperties)&&(!t.type||"object"===t.type)&&(!t.properties||pi(t.properties))&&(!t.required||vi(t.required))}(s))return{tool:_v(t),injected:e};const n=(null==s?void 0:s.properties)||{},r=t=>gv(n,t)||vi(null==s?void 0:s.required)&&s.required.includes(t);if(e.intent=i.intent&&!r("context"),e.model=i.model&&!r("llm_model"),!e.intent&&!e.model)return{tool:_v(t),injected:e};const o=as({},n),l=vi(null==s?void 0:s.required)?[...s.required]:[];return e.intent&&(o.context={type:"string",description:'Explain why this tool is called and how it supports the user\'s goal. Describe the abstract purpose only. Do not include personal or identifying information. Generalize specific entities as roles such as "a customer".'},l.includes("context")||l.push("context")),e.model&&(o.llm_model={type:"string",description:'The exact model identifier you are running as, taken from your system prompt or environment. Pass "unknown" if you do not know it. Never guess.'},l.includes("llm_model")||l.push("llm_model")),{tool:_v(t,as(as({},s),{},{type:(null==s?void 0:s.type)||"object",properties:o,required:l})),injected:e}}(t,function(t){const i={intent:!1,model:!1};for(const e of t.instances){const t=pv(e.config.capture_webmcp);i.intent||(i.intent=!0===(null==t?void 0:t.intent)),i.model||(i.model=!0===(null==t?void 0:t.model))}return i}(i));return Object.defineProperty(n,"execute",{configurable:!0,enumerable:!0,writable:!0,value(...o){const l=new Date,a=function(t,i){if(!pi(t))return{};try{const e=i.intent?mv(t.context,2048,!0):void 0,s=i.model?mv(t.llm_model,256):void 0;return as(as({},e&&"{}"!==e?{intent:e}:{}),s&&"unknown"!==s.toLowerCase()?{model:s}:{})}catch(t){return{}}}(o[0],r),u=function(t,i){const e=t[0];if(!pi(e))return t;try{const s=i.intent&&gv(e,"context"),n=i.model&&gv(e,"llm_model");if(!s&&!n)return t;const r=as({},e);return s&&delete r.context,n&&delete r.llm_model,[r,...t.slice(1)]}catch(i){return t}}(o,r);let h;try{h=e.apply(this===n?t:this,u)}catch(t){throw s.Cg(i,n,l,{error:t,errorResult:!1},a),t}if((c=h)&&"function"==typeof c.then)return Promise.resolve(h).then(t=>{const e=yv(t)?{error:t,errorResult:!0}:void 0;return s.Cg(i,n,l,e,a),t},t=>{throw s.Cg(i,n,l,{error:t,errorResult:!1},a),t});var c;const d=yv(h)?{error:h,errorResult:!0}:void 0;return s.Cg(i,n,l,d,a),h}}),n}Cg(t,i,e,s,n){const r=Date.now()-e.getTime();let o;for(const a of t.instances){var l;const t=pv(a.config.capture_webmcp);if(t){s&&!o&&(o=Sv(s.error,s.errorResult));try{a.capture("$mcp_tool_call",as(as(as({$mcp_source:"posthog_mcp_analytics",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==Kt?void 0:Kt.hostname,$mcp_duration_ms:r,$mcp_is_error:!!s},o?{$mcp_error_type:o.type,$mcp_error_message:o.message}:{}),t.intent&&n.intent?{$mcp_intent:n.intent,$mcp_intent_source:"context_parameter"}:{}),t.model&&n.model?{$mcp_llm_model:n.model,$mcp_llm_model_source:"self_reported"}:{}),{timestamp:e})}catch(t){continue}if(s&&o&&a.exceptions&&(null===(l=a.exceptionObserver)||void 0===l?void 0:l.isEnabled))try{const t={$exception_list:$v(a.exceptions,s,o.message),$exception_level:"error",$exception_source:"mcp.tool_call",$mcp_interface:"webmcp",$mcp_tool_name:i.name,$mcp_resource_name:i.name,$mcp_tool_description:i.description,$mcp_server_name:null==Kt?void 0:Kt.hostname};a.exceptionObserver.captureException(t)}catch(t){}}}}}};Rh.__defaultExtensionClasses=as({},as(as(as(as(as(as(as(as(as(as(as(as(as(as({},Ev),kv),Tv),Pv),Ov),Rv),Cv),Av),Iv),Mv),Fv),Dv),Nv),Lv));const jv=Pr("[ExternalScriptsLoader]"),Uv=t=>{const i=null==Gt?void 0:Gt.querySelectorAll("script");if(i)for(let e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},Bv=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return jv.warn(`${i} was requested but loading of external scripts is disabled.`),e("Loading of external scripts is disabled");const s=()=>{if(null==Gt||Gt.removeEventListener("DOMContentLoaded",s),t.config.disable_external_dependency_loading)return e("Loading of external scripts is disabled");if(!Gt)return e("document not found");let r=Gt.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(t.config.disable_external_dependency_loading)return e("Loading of external scripts is disabled");const o=Uv(r.src);if(o){if(o.integrity!==r.integrity||o.crossOrigin!==r.crossOrigin||o.nonce!==r.nonce)return e("Existing script conflicts with prepared script policy");if(o.__posthog_loading_callback_fired)return e();const t=o.__posthog_loading_error;return t?e(t):(o.addEventListener("load",t=>{o.__posthog_loading_callback_fired=!0,e(void 0,t)}),void o.addEventListener("error",t=>{o.__posthog_loading_error=t,e(t)}))}if(!Gt.body)return n();if("head"===t.config.external_scripts_inject_target)Gt.head.appendChild(r);else{const t=Gt.querySelectorAll("body > script");var l;t.length>0?null===(l=t[0].parentNode)||void 0===l||l.insertBefore(r,t[0]):Gt.body.appendChild(r)}},n=()=>{null==Gt||Gt.addEventListener("DOMContentLoaded",s)};(null==Gt?void 0:Gt.body)||Uv(i)?s():n()},zv={},Hv=(t,i)=>{let e=`/static/${i}.js?v=${t.version}`;if("toolbar"===i){const t=3e5;e=`${e}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",e)};ii.__PosthogExtensions__=ii.__PosthogExtensions__||{},ii.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"===i){const i=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void Bv(t,i,e)}const s=t.config.strict_script_versioning;if(s){const n=t.requestRouter.endpointFor("assets",`/static/${t.version}/${i}.js`),r=zv[n];if("fallback"===s&&r){if(Uv(r))return void Bv(t,r,e);delete zv[n]}return void Bv(t,n,"fallback"===s?(s,r)=>{if(s)if("string"==typeof s)e(s);else{var o;const s=Hv(t,i);zv[n]=s;const r=Uv(n);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),Bv(t,s,e)}else e(void 0,r)}:e)}Bv(t,Hv(t,i),e)},ii.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{const s=t.requestRouter.endpointFor("api",i);Bv(t,s,e)};const qv=function(){e.SDK_DIST_CHANNEL="npm";const t=uh[xh]=new Rh;return function(){function t(){t.done||(t.done=!0,fu=!1,Rr(uh,function(t){t._dom_loaded()}))}(null==Gt?void 0:Gt.addEventListener)?"complete"===Gt.readyState?t():Lr(Gt,"DOMContentLoaded",t,{capture:!1}):qt&&Tr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),t}();exports.Compression=sa,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=aa,exports.PostHog=Rh,exports.ProductTourEventName=ha,exports.ProductTourEventProperties=ca,exports.SurveyEventName=oa,exports.SurveyEventProperties=la,exports.SurveyEventType=na,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=ra,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=qv,exports.posthog=qv,exports.severityLevels=["fatal","error","warning","log","info","debug"];
2
2
  //# sourceMappingURL=main.js.map