posthog-js 1.434.12 → 1.434.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(){const t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,n=null==e?void 0:e.document,s=null==e?void 0:e.location,r=null==e?void 0:e.fetch,o=(null==e?void 0:e.XMLHttpRequest)&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,l=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent;function h(){return!(!t||!1===t.navigator.onLine)}const c="undefined"!=typeof globalThis?globalThis:t;c&&"undefined"==typeof self&&(c.self=c),c&&"undefined"==typeof File&&(c.File=function(){});const d=null!=t?t:{},v="$people_distinct_id",f="distinct_id",p="$device_id",g="$device_model",m="__alias",y="__cmpns",b="$fbc",_="$fbc_persistence",w="$fbp",k="$fbp_persistence",S="__timers",x="$autocapture_disabled_server_side",C="$heatmaps_enabled_server_side",T="$exception_capture_enabled_server_side",I="$error_tracking_suppression_rules",M="$error_tracking_capture_extension_exceptions",E="$web_vitals_enabled_server_side",P="$dead_clicks_enabled_server_side",R="$product_tours_enabled_server_side",A="$logs_capture_enabled_server_side",F="$web_vitals_allowed_metrics",O="$session_recording_remote_config",D="$session_recording_enabled_server_side",L="$replay_sample_rate",N="$replay_override_sampling",q="$replay_override_linked_flag",j="$replay_override_url_trigger",B="$replay_override_event_trigger",H="$sesid",z="$session_is_sampled",U="$session_past_minimum_duration",W="$session_recording_url_trigger_activated_session",V="$session_recording_event_trigger_activated_session",G="$posthog_sr_group_event_trigger_",Z="$posthog_sr_group_url_trigger_",Q="$posthog_sr_group_sampling_",J="$debug_first_full_snapshot_timestamp",K="$sess_rec_flush_size",X="$enabled_feature_flags",Y="$active_feature_flags",tt="$early_access_features",et="$feature_flag_details",it="$feature_flag_payloads",nt="$feature_flag_request_id",st="$minimal_flag_called_events",rt="$override_feature_flags",ot="$override_feature_flag_payloads",at="$stored_person_properties",lt="$stored_group_properties",ut="$groups",ht="$surveys",ct="$surveys_loaded_at",dt="$surveys_activated",vt="$surveys_activated_session",ft="$surveys_activated_timestamps",pt="ph_product_tours",gt="$product_tours_activated",mt="$product_tours_activated_session",yt="$conversations_widget_session_id",bt="$conversations_ticket_id",_t="$conversations_widget_state",wt="$conversations_user_traits",kt="$flag_call_reported",St="$flag_call_reported_session_id",xt="$feature_flag_errors",Ct="$feature_flag_evaluated_at",$t="$user_state",Tt="$client_session_props",It="$capture_rate_limit",Mt="$initial_campaign_params",Et="$initial_referrer_info",Pt="$initial_person_info",Rt="$epp",At="$posthog_cookieless",Ft="$cookieless_mode",Ot="$sdk_debug_extensions_init_method",Dt="$sdk_debug_extensions_init_time_ms",Lt="$sdk_debug_recording_script_not_loaded",Nt="$sdk_debug_replay_stale_config",qt="$sdk_debug_replay_event_trigger_status",jt="$sdk_debug_replay_linked_flag_trigger_status",Bt="$sdk_debug_replay_matched_recording_trigger_groups",Ht="$sdk_debug_replay_pending_trigger_conditions",zt="$sdk_debug_replay_remote_trigger_matching_config",Ut="$sdk_debug_replay_trigger_groups_count",Wt="$sdk_debug_replay_url_trigger_status",Vt="$sdk_debug_rrweb_attached",Gt="$sdk_debug_rrweb_start_attempted",Zt="$session_recording_start_reason",Qt="PostHog loadExternalDependency extension not found.",Jt="anonymous",Kt="identified",Xt="identified_only",Yt="visibilitychange",te="beforeunload",ee="$pageview",ie="$pageleave",ne="$identify",se="$groupidentify";function re(t,e,i,n,s,r,o){try{var a=t[r](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,s)}function oe(t){return function(){var e=this,i=arguments;return new Promise(function(n,s){var r=t.apply(e,i);function o(t){re(r,n,s,o,a,"next",t)}function a(t){re(r,n,s,o,a,"throw",t)}o(void 0)})}}function ae(t){return ae="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},ae(t)}function le(t,e,i){return(e=function(t){var e=function(t){if("object"!=ae(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=ae(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ae(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ue(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function he(t){for(var e=1;arguments.length>e;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ue(Object(i),!0).forEach(function(e){le(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ue(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}var ce=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}({}),de=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const ve="min_length",fe="max_length",pe=["$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"],ge=["token"];function me(t,e){return-1!==t.indexOf(e)}const ye=function(t){return t.trim()},be=function(t){return t.replace(/^\$/,"")};function _e(t){var e;const i=[];return null!==(e=JSON.stringify(t,function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}}))&&void 0!==e?e:"null"}const we=Object.prototype,ke=we.hasOwnProperty,Se=we.toString,xe=Array.isArray||function(t){return"[object Array]"===Se.call(t)},Ce=t=>"function"==typeof t,$e=t=>t===Object(t)&&!xe(t),Te=t=>{if($e(t)){for(const e in t)if(ke.call(t,e))return!1;return!0}return!1},Ie=t=>void 0===t,Me=t=>"[object String]"==Se.call(t),Ee=t=>Me(t)&&0===t.trim().length,Pe=t=>null===t,Re=t=>Ie(t)||Pe(t),Ae=t=>"[object Number]"==Se.call(t)&&t==t,Fe=t=>Ae(t)&&t>0,Oe=t=>"[object Boolean]"===Se.call(t),De=t=>t instanceof FormData,Le=t=>me(pe,t),Ne=t=>me(ge,t);function qe(t){return null===t||"object"!=typeof t}function je(t,e){return{}.toString.call(t)===`[object ${e}]`}function Be(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 ze(t,Error)}}function He(t){return"u">typeof Event&&ze(t,Event)}function ze(t,e){try{return t instanceof e}catch(t){return!1}}const Ue=[!0,"true",1,"1","yes"],We=t=>me(Ue,t),Ve=[!1,"false",0,"0","no"],Ge=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Ze=function(t,e=[]){if(!t)return!1;const i=t.toLowerCase();return Ge.concat(e).some(t=>{const e=t.toLowerCase();return-1!==i.indexOf(e)})};function Qe(t,e,i,n,s){return e>i&&(n.warn("min cannot be greater than max."),e=i),Ae(t)?t>i?(n.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(n.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Qe(null!=s?s:i,e,i,n))}var Je=class{constructor(t){this.C={},this.I=t.I,this.R=Qe(t.bucketSize,0,100,t.$),this.A=Qe(t.refillRate,0,this.R,t.$),this.O=Qe(t.refillInterval,0,864e5,t.$)}F(t,e){const i=Math.floor((e-t.lastAccess)/this.O);i>0&&(t.tokens=Math.min(t.tokens+i*this.A,this.R),t.lastAccess=t.lastAccess+i*this.O)}consumeRateLimit(t){var e;const i=Date.now(),n=String(t);let s=this.C[n];return s?this.F(s,i):(s={tokens:this.R,lastAccess:i},this.C[n]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null===(e=this.I)||void 0===e||e.call(this,t)),0===s.tokens)}stop(){this.C={}}};const Ke="Mobile",Xe="Android",Ye="Tablet",ti="Android Tablet",ei="iPad",ii="Apple Watch",ni="Safari",si="BlackBerry",ri="Samsung Internet",oi="Chrome",ai="Chrome iOS",li="Internet Explorer",ui="Internet Explorer Mobile",hi="Opera",ci="Microsoft Edge",di="Firefox",vi="Firefox iOS",fi="Nintendo",pi="PlayStation",gi="Xbox",mi="Android Mobile",yi="Mobile Safari",bi="Windows",_i="Windows Phone",wi="Nokia",ki="Ouya",Si="Generic "+Ke.toLowerCase(),xi="Generic "+Ye.toLowerCase(),Ci="Konqueror",$i="Oculus Browser",Ti="Vivaldi",Ii="Yandex",Mi="Whale",Ei="DuckDuckGo",Pi="Pale Moon",Ri="Waterfox",Ai="Brave",Fi="Claude",Oi="Codex",Di="ChatGPT",Li="Google Search App",Ni=new RegExp("Version/(\\d+(\\.\\d+)?)"),qi=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),ji=new RegExp(gi,"i"),Bi=new RegExp("PlayStation \\w+","i"),Hi=new RegExp("Nintendo \\w+","i"),zi=new RegExp("BlackBerry|PlayBook|BB10","i"),Ui={"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"},Wi=function(t,e,i,n){e=e||"";const s=function(t){return(null==t?void 0:t.brave)?Ai:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&me(t,"GSA/")?Li:me(t," OPR/")&&me(t,"Mini")?"Opera Mini":me(t," OPR/")?hi:zi.test(t)?si:me(t,"IEMobile")||me(t,"WPDesktop")?ui:me(t,"OculusBrowser")?$i:me(t,"SamsungBrowser")?ri:me(t,"Edge")||me(t,"Edg/")?ci:me(t,"Vivaldi/")?Ti:me(t,"YaBrowser/")?Ii:me(t,"Whale/")?Mi:me(t,"DuckDuckGo/")||me(t,"Ddg/")?Ei:me(t,"Claude/")?Fi:me(t,"Codex/")?Oi:me(t,"ChatGPT/")?Di:me(t,"FBIOS")?"Facebook Mobile":me(t,"UCWEB")||me(t,"UCBrowser")?"UC Browser":me(t,"CriOS")?ai:me(t,"CrMo")||me(t,oi)?oi:me(t,Xe)&&me(t,ni)?mi:me(t,"FxiOS")?vi:me(t.toLowerCase(),Ci.toLowerCase())?Ci:me(t,"Brave/")?Ai:((t,e)=>e&&me(e,"Apple")||function(t){return me(t,ni)&&!me(t,oi)&&!me(t,Xe)}(t))(t,e)?me(t,Ke)?yi:ni:me(t,"PaleMoon/")?Pi:me(t,"Waterfox/")?Ri:me(t,di)?di:me(t,"MSIE")||me(t,"Trident/")?li:me(t,"Gecko")?di:"")},Vi={[ui]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[ci]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[oi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ai]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ni]:[Ni],[yi]:[Ni],[hi]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[di]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[vi]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[si]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Ni],[mi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ri]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Mi]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ai]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Fi]:[qi],[Oi]:[qi],[Di]:[qi],[Ei]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Pi]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Li]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[li]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Gi=function(t,e,i,n){const s=Wi(t,e,i,n),r=Vi[s];if(Ie(r))return null;for(let e=0;r.length>e;e++){const i=t.match(r[e]);if(i)return parseFloat(i[i.length-2])}return null},Zi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[gi,t&&t[1]||""]],[new RegExp(fi,"i"),[fi,""]],[new RegExp(pi,"i"),[pi,""]],[zi,[si,""]],[new RegExp(bi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[_i,""];if(new RegExp(Ke).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){let t=Ui[i[1]]||"";return/arm/i.test(e)&&(t="RT"),[bi,t]}return[bi,""]}],[/((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 e="";return t&&t.length>=3&&(e=Ie(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Xe,[t[2],t[3],t[4]||"0"].join(".")]:[Xe,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Qi=function(t){for(let e=0;Zi.length>e;e++){const[i,n]=Zi[e],s=i.exec(t),r=s&&(Ce(n)?n(s,t):n);if(r)return r}return["",""]},Ji=function(t){return Hi.test(t)?fi:Bi.test(t)?pi:ji.test(t)?gi:new RegExp(ki,"i").test(t)?ki:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?_i:/iPad/.test(t)?ei:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ii:zi.test(t)?si:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(wi,"i").test(t)?wi:/(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(Ke).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)?Xe:ti:new RegExp("(pda|Mobile)","i").test(t)?Si:new RegExp(Ye,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?xi:""},Ki=function(t,e){var i;const n=Ji(t);return n===ei||n===ti||"Kobo"===n||"Kindle Fire"===n||n===xi?Ye:n===fi||n===gi||n===pi||n===ki?"Console":n===ii?"Wearable":n?Ke:"Android"===(null==e?void 0:e.userAgentDataPlatform)&&(null!==(i=null==e?void 0:e.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(s=null==e?void 0:e.screenWidth)&&void 0!==s?s:0,null!==(r=null==e?void 0:e.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==e?void 0:e.devicePixelRatio)&&void 0!==o?o:1)?Ke:Ye:"Desktop";var s,r,o},Xi=/\bFBAV\/(\d+(?:\.\d+)*)/i,Yi=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Xi],[/\bFBAN\/EMA\b/i,"Facebook Lite",Xi],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Xi],[/\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"]],tn="[Truncated]",en="[Unserializable]";function nn(t){let e="";for(let i=0;t.length>i;i++){const n=t.charCodeAt(i);if(55296>n||n>56319)e+=56320>n||n>57343?t[i]:"�";else{const n=t.charCodeAt(i+1);56320>n||n>57343?e+="�":(e+=t[i]+t[i+1],i++)}}return e}function sn(t,e){if(!e)return t;let i=[];try{i=Object.keys(e)}catch(t){i=[]}for(const n of i){let i;try{i=e[n]}catch(t){i=en}Object.defineProperty(t,n,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const rn=3e5;var on=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const e=this.isOpen(),i=Date.now(),n=Math.min(t.retryAfterMs,rn);if(!e)return this.ts=i,void(this.es=i+n);this.es=Math.max(this.es,Math.min(i+n,this.ts+rn))}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const e=Math.min(rn,Math.max(0,this.es-t));return 0===e&&this.reset(),e}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const an=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ln(t,e){return"string"==typeof(i=t)&&an.test(i)?t:e();var i}function un(t,e){const i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function hn(t){return t?t.split("#")[0]:t}function cn(t){try{return t()}catch(t){return}}function dn(t,e){const i=setTimeout(t,e);return null!=i&&i.unref&&(null==i||i.unref()),i}function vn(t,e,i){return fn.apply(this,arguments)}function fn(){return(fn=oe(function*(t,e,i){let n;try{return yield Promise.race([t,new Promise((t,s)=>{n=dn(()=>{try{null==i||i(),t()}catch(t){s(t)}},e)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let pn,gn,mn;function yn(t){const e=globalThis._posthogChunkIds;if(!e)return;const i=Object.keys(e);return mn&&i.length===gn||(gn=i.length,mn=i.reduce((i,n)=>{pn||(pn={});const s=pn[n];if(s)i[s[0]]=s[1];else{const s=t(n);for(let t=s.length-1;t>=0;t--){const r=s[t],o=null==r?void 0:r.filename,a=e[n];if(o&&a){i[o]=a,pn[n]=[o,a];break}}}return i},{})),mn}var bn=class{constructor(t,e,i=[]){this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e={}){const i=e&&e.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),r=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(t){var e=this;return oe(function*(){for(const i of t)i.stacktrace&&i.stacktrace.frames&&xe(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t})()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null===(e=t.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var i;let n,s;if(null!=t.cause&&(n=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack)try{s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)}catch(t){}return he(he({},t),{},{cause:n,stack:s,errors:null===(i=t.errors)||void 0===i?void 0:i.map(t=>this.parseStacktrace(t,e))})}applyChunkIds(t,e){return t.map(t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t))}applyCoercers(t,e){for(const i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return oe(function*(){let i=t;for(const t of e.modifiers)i=yield t(i);return i})()}convertToExceptionList(t,e){const i=[],n=(t,s,r)=>{var o;const a=i.length,l=void 0===s?he(he({type:"string"==typeof e.type&&e.type.length>0?e.type:"generic"},"boolean"==typeof e.handled?{handled:e.handled}:void 0===e.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof e.synthetic?e.synthetic:t.synthetic,exception_id:a}):{type:"chained",source:r,synthetic:t.synthetic,exception_id:a,parent_id:s},u={type:t.type,value:t.value,mechanism:l};t.stack&&(u.stacktrace={type:"raw",frames:t.stack}),i.push(u),t.cause&&n(t.cause,a,"cause");for(const e of null!==(o=t.errors)&&void 0!==o?o:[])n(e,a,"member")};return n(t),i}buildParsingContext(t){var e;return{chunkIdMap:yn(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}getAggregateErrors(t){try{if(Be(t)){let i=Object.getPrototypeOf(t);for(let n=0;i&&100>n;n++){var e;const n=null===(e=Object.getOwnPropertyDescriptor(i,"constructor"))||void 0===e?void 0:e.value;if("function"==typeof n&&"AggregateError"===n.name){const e=t.errors;return xe(e)?e:void 0}i=Object.getPrototypeOf(i)}}}catch(t){}}buildCoercingContext(t,e,i=0){let n=0,s=0,r=!1;const o=new Set,a=[],l={},u=(t,e,i=0)=>{const u=h(e,i),c=u.apply;if(u.apply=e=>{a.push(t);try{return c(e)}finally{a.pop()}},i>4||i>0&&-1!==a.indexOf(t))return this.coerceFallback(u);const d="object"==typeof t&&null!==t||"function"==typeof t;if(0===i&&n>=50||d&&o.has(t))return;d&&o.add(t),0===i&&n++;const v=this.getAggregateErrors(t);let f,p;r||(r=!!v);try{if(f=this.applyCoercers(t,u),!f)throw l}catch(t){if(t===l)return void(0===i&&n--);if(!r)throw t;f=this.coerceFallback(u)}if(!v||n>=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>n&&1e3>s&&p>t;t++){let i;s++;try{i=u.next(v[t])}catch(t){n++,i=this.coerceFallback(h(e+1))}i&&g.push(i)}return he(he({},f),{},{errors:g})},h=(i,n=0)=>he(he({},e),{},{syntheticException:0==i?e.syntheticException:void 0,mechanism:0==i?t:{},apply(t){const e=u(t,i,n+1);if(!e)throw l;return e},next:t=>u(t,i+1)}),c=h(i);return he(he({},c),{},{apply:t=>{var e;return null!==(e=u(t,i))&&void 0!==e?e:this.coerceFallback(c)}})}};const _n=/^([a-z][a-z0-9.+-]+):/i,wn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function kn(t){if(!t||"<anonymous>"===t)return!1;const e=_n.exec(t);return!e||wn.includes(e[1].toLowerCase())}function Sn(t,e,i,n,s){const r={platform:t,filename:e,function:"<anonymous>"===i?"?":i,in_app:kn(e)};return Ie(n)||(r.lineno=n),Ie(s)||(r.colno=s),r}const xn=(t,e)=>{const i=-1!==t.indexOf("safari-extension"),n=-1!==t.indexOf("safari-web-extension");return i||n?[-1!==t.indexOf("@")?t.split("@")[0]:"?",i?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Cn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,$n=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Tn=/\((\S*)(?::(\d+))(?::(\d+))\)/,In=(t,e)=>{const i=Cn.exec(t);if(i){const[,t,n,s]=i;return Sn(e,t,"?",+n,+s)}const n=$n.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=Tn.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,i]=xn(n[1]||"?",n[2]);return Sn(e,i,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},Mn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,En=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Pn=(t,e)=>{const i=Mn.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const t=En.exec(i[3]);t&&(i[1]=i[1]||"eval",i[3]=t[1],i[4]=t[2],i[5]="")}let t=i[3],n=i[1]||"?";return[n,t]=xn(n,t),Sn(e,t,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Rn=/\(error: (.*)\)/;function An(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function Fn(t){for(let e=1;10>=e;e++){const i=t.length-2*e;if(0>i)break;let n=!0;for(let s=0;e>s;s++)if(!An(t[i+s],t[i+e+s])){n=!1;break}if(n){for(let n=0;e>n;n++)t[i+n]=t[i+e+n];return t.length=i+e,{start:i,length:e}}}}function On(t,e){const i=e.start+e.length,n=Ln(t,e);n&&t.splice(i+n===t.length?i:e.start,n)}function Dn(t,e){let i=e.start;for(;i>0&&An(t[i-1],t[i-1+e.length]);)i--;return e.start-i}function Ln(t,e){const i=e.start+e.length;let n=i;for(;t.length>n&&An(t[n],t[n-e.length]);)n++;return n-i}function Nn(t,e){const i=e[0];let n=t.length-(i?Dn(t,i):0);for(const i of e)n-=Ln(t,i);return n}function qn(t,e,i){for(let n=0;t.length>n;n++){const s=t[(e+n)%t.length],r=t[(i+n)%t.length];if(s!==r)return r>s}return!1}var jn=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){const i=Me(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){const e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${e}: ${t.message}`:e}isDOMException(t){return je(t,"DOMException")}isDOMError(t){return je(t,"DOMError")}},Bn=class{match(t){return Be(t)}coerce(t,e){var i;const n=this.getStack(t),s=void 0===n?null===(i=e.syntheticException)||void 0===i?void 0:i.stack:void 0,r=!!s;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=n?n:s,cause:t.cause?e.next(t.cause):void 0,synthetic:r}}getType(t){return t.name||t.constructor.name}getMessage(t,e){const i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){try{const e=t.stacktrace;if("string"==typeof e&&e.length>0)return e;const i=t.stack;return"string"==typeof i&&i.length>0?i:void 0}catch(t){return}}},Hn=class{match(t){return!!je(t,"ErrorEvent")&&(null!=t.error||this.ur(t))}coerce(t,e){var i;if(null!=t.error)return e.apply(t.error);const n=e.apply(t.message);return he(he({},n),{},{stack:null!==(i=this.cr(t))&&void 0!==i?i:n.stack,synthetic:!0})}ur(t){return Me(t.message)&&t.message.length>0}cr(t){var e,i;const n=t,s=null!==(e=n.lineno)&&void 0!==e?e:0,r=null!==(i=n.colno)&&void 0!==i?i:0;if(Me(n.filename)&&0!==n.filename.length&&0!==s)return`Error\n at ${n.filename}:${s}:${r}`}};const zn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Un=class{match(t){return"string"==typeof t}coerce(t,e){var i;const[n,s]=this.getInfos(t);return{type:null!=n?n:"Error",value:null!=s?s:t,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}getInfos(t){let e="Error",i=t;const n=t.match(zn);return n&&(e=n[1],i=n[2]),[e,i]}};const Wn=["fatal","error","warning","log","info","debug"];function Vn(t,e=40){const i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(let t=i.length;t>0;t--){const n=i.slice(0,t).join(", ");if(e>=n.length)return t===i.length?n:n.length>e?`${n.slice(0,e)}...`:n}return""}var Gn=class{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,n;const s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(i=this.getStack(t))&&void 0!==i?i:null===(n=e.syntheticException)||void 0===n?void 0:n.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(He(t))return t.constructor.name;const e="name"in t?t.name:void 0;return Me(e)&&!Ee(e)?e:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){let e=`'${t.name}' captured as exception`;return"message"in t&&"string"==typeof t.message&&(e+=` with message: '${t.message}'`),e}if("message"in t&&"string"==typeof t.message)return t.message;const e=this.getObjectClassName(t);return`${e&&"Object"!==e?`'${e}'`:"Object"} captured as exception with keys: ${Vn(t)}`}isSeverityLevel(t){return Me(t)&&!Ee(t)&&Wn.indexOf(t)>=0}getStack(t){try{return Me(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:Me(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(const e in t)if({}.hasOwnProperty.call(t,e)){const i=t[e];if(Be(i))return i}}getObjectClassName(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}},Zn=class{match(t){return He(t)}coerce(t,e){var i;const n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Vn(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Qn=class{match(t){return qe(t)}coerce(t,e){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Jn=class{match(t){return je(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!He(t))return!1;try{const e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i;const n=this.getUnhandledRejectionReason(t);return qe(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:e.apply(n)}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 Kn="$message",Xn="$timestamp",Yn=new Set([Kn,Xn]),ts={enabled:!0,max_bytes:32768};function es(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:ts.enabled,max_bytes:ns(t.max_bytes,ts.max_bytes)}:he({},ts)}var is=class{constructor(t){this.ns=[],this.ss=0,this.Rr=es(t)}setConfig(t){this.Rr=es(t),this.rs()}add(t){const e=function(t){let e;try{e=_e(t)}catch(t){return}try{const t=JSON.parse(e);if(!$e(t))return;const i=t,n=i[Kn],s=i[Xn];if(!Me(n)||0===n.trim().length)return;if(!Me(s)&&!Ae(s))return;return{step:i,json:e}}catch(t){return}}(t);if(!e)return;const i=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;const e=encodeURIComponent(t);let i=0;for(let t=0;e.length>t;t++)"%"===e[t]?(i+=1,t+=2):i+=1;return i}(e.json);i>this.Rr.max_bytes||(this.ns.push({step:e.step,bytes:i}),this.ss+=i,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.Rr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function ns(t,e){if(!Ae(t)||1/0===t||-1/0===t)return e;const i=Math.floor(t);return 0>i?e:i}const ss=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function rs(t){return"string"==typeof t||t}function os(t){return"string"==typeof t?t:void 0}const as=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],ls="NativeGzipValidationError",us=t=>t.length>=2&&31===t[0]&&139===t[1],hs=(t,e)=>t===de.GZipJS||e===de.GZipJS||"gzip"===e,cs=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),ds=t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return cs(t)||e===ls};let vs;const fs=t=>{throw un(ls,`Native gzip produced invalid output: ${t}`)},ps=(gs=oe(function*(t,e){18>t.size&&fs("too-short");const i=new Uint8Array(yield t.slice(0,10).arrayBuffer());us(i)&&8===i[2]||fs("invalid-header");const n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{const e=(()=>{if(vs)return vs;vs=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?3988292384^e>>>1:e>>>1;vs[t]=e>>>0}return vs})();let i=4294967295;for(let n=0;t.length>n;n++)i=e[255&(i^t[n])]^i>>>8;return(4294967295^i)>>>0})(e)&&fs("invalid-crc");const s=e.length>>>0;n.getUint32(4,!0)!==s&&fs("invalid-size")}),function(t,e){return gs.apply(this,arguments)});var gs;function ms(t){return ys.apply(this,arguments)}function ys(){return ys=oe(function*(t,e=!0,i){try{const e=(new TextEncoder).encode(t),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),r=s.write(e).then(()=>s.close()).catch((n=oe(function*(t){try{yield s.abort(t)}catch(t){}throw t}),function(t){return n.apply(this,arguments)})),o=new Response(i.readable).blob(),[a]=yield Promise.all([o,r]);return yield ps(a,e),a}catch(t){if(null==i?void 0:i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}var n}),ys.apply(this,arguments)}function bs(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;r.length>n;n++)e.includes(i=r[n])||{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}const _s={}.propertyIsEnumerable;function ws(t,e){try{return xs(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function ks(t,e,i,n){if(0>=i.remainingNodes)return{stringValue:tn};if(i.remainingNodes--,Oe(t))return{boolValue:t};if("bigint"==typeof t)return function(t,e){const i=t.toString(),n=BigInt("9223372036854775808");return t>=n||-n>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(t,e);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 i=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:nn(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(i.ancestors.has(t))return{stringValue:"[Circular]"};if(n>=20)return{stringValue:tn};if(t instanceof Date){const e=t.getTime(),i=Number.isFinite(e)?t.toISOString():String(t);return{stringValue:"string"==typeof i?nn(i):String(i)}}i.ancestors.add(t);try{try{const s=t.toJSON;if("function"==typeof s)return ks(s.call(t),e,i,n+1)}catch(t){}return xe(t)?{arrayValue:{values:Ss(t,e,i,n+1)}}:{kvlistValue:{values:xs(t,e,i,n+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:nn(String(t))}}function Ss(t,e,i,n){const s=[],r=Math.min(t.length,1e3);let o=0;for(;r>o&&i.remainingNodes>0;o++)try{const r=o in t?t[o]:void 0;if(Re(r))continue;s.push(ks(r,e,i,n))}catch(t){s.push({stringValue:en})}return t.length>o&&s.push({stringValue:tn}),s}function xs(t,e,i,n){const s=[];for(const r in t)if(_s.call(t,r)){if(!r){null==e||e.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=i.remainingNodes){null==e||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=t[r];if(Pe(o)||Ie(o))continue;s.push({key:nn(r),value:ks(o,e,i,n)})}catch(t){s.push({key:nn(r),value:{stringValue:en}})}}return s}function Cs(t,e,i){return he(he(he(he({},sn({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":e,"telemetry.sdk.version":i})}const $s=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function Ts(t,e){const i=sn({},t),n={};for(const t of $s)({}).hasOwnProperty.call(i,t)&&(n[t]=i[t],delete i[t]);return[...ws(i,e),...ws(n,e)]}const Is={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"};const Ms={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}},Es=Ms.info;function Ps(t){try{return nn(String(t))}catch(t){return en}}function Rs(t,e,i,n){const s=t.level||"info",{text:r,number:o}=Ms[s]||Es,a=function(t=Date.now()){return String(t)+"000000"}(Ae(n)?n:void 0),l={};e.distinctId&&(l.posthogDistinctId=e.distinctId),e.sessionId&&(l.sessionId=e.sessionId),e.windowId&&(l["window.id"]=e.windowId),Re(e.sessionStartTimestamp)||(l.sessionStartTimestamp=String(e.sessionStartTimestamp)),Re(e.lastActivityTimestamp)||(l.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(l["url.full"]=e.currentUrl),e.screenName&&(l["screen.name"]=e.screenName),e.appState&&(l["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(l.feature_flags=e.activeFeatureFlags);const u=he({},l),h=t.attributes;if(h){let t=[];try{t=Object.keys(h)}catch(e){t=[]}for(const e of t){let t;try{t=h[e]}catch(e){t=en}Object.defineProperty(u,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const c={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:Ps(t.body)},attributes:ws(u,i)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),Ie(t.trace_flags)||(c.flags=t.trace_flags),c}function As(t,e,i){return Cs(t,e,i)}function Fs(t,e,i,n){return{resourceLogs:[{resource:{attributes:Ts(e)},scopeLogs:[{scope:{name:i,version:n},logRecords:t}]}]}}var Os=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.hs}arm(t){this.clear(),this.us=Date.now()+t,this.hs=dn(()=>{this.hs=void 0,this.ls()},t)}armNoEarlierThan(t){this.hs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function Ds(){return.75+.5*Math.random()}function Ls(t,e,i,n){const s=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,s);return Math.round((void 0===n?r:Math.min(r,Math.max(n,t)))*i)}var Ns=class{constructor(t,e,i,n,s,r=()=>Promise.resolve(),o){var a;this._instance=t,this.Rr=e,this.$=i,this.cs=n,this.ds=s,this.vs=r,this.fs=o,this.ps=new Os(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new on,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=e.maxBufferSize,this.Is=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.Ms=e.flushIntervalMs,this.Es=e.maxBatchRecordsPerPost,this.Ps=e.rateCapWindowMs,this.Rs=e.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(ce.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Rr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(t,e){var i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const n=this.Os(t);if(null===n)return;if(!n.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const s={record:Rs(n,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.cs(),this.$,null==e?void 0:e.occurredAtMs)};this.ds(()=>this.Ls(s))}Os(t){const e=this.Rr.beforeSend;if(!e)return t;const i=xe(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.$.info("Log was rejected in beforeSend function"),null;n=e}catch(t){return this.$.error("Error in beforeSend function for log:",t),null}return n}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),e=t-this.xs;return this.Ps>e&&e>=0||(this.xs=t,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var t=this;return oe(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return oe(function*(){var e;t.ps.clear();let i=null!==(e=t._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==e?e:[];if(0===i.length)return;const n=i.length;let s=0;for(;i.length>0&&n>s;){var r,o;const e=t._s;t.bs=0;const n=Math.min(i.length,t.Es),a=i.slice(0,n),l=Fs(a.map(t=>t.record),t.qs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.js(l);if(t._s!==e)return;if("too-large"===u.kind&&a.length>1)t.Es=Math.max(1,Math.floor(a.length/2)),t.$.warn(`Logs batch of size ${a.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.$.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.Rr.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Rr.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(a.length),i=null!==(o=t._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==o?o:[],s+=a.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var e=this;return oe(function*(){var i;const n=Math.max(0,t-e.bs),s=null!==(i=e._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(ce.LogsQueue,s.slice(n)),yield e.vs()})()}qs(){return As(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var e;if(this._instance.optedOut)return;const i=null!==(e=this._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==e?e:[];this.Is>i.length||(i.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(ce.LogsQueue,i),this.Ts>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(Ls(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const t=this._instance.getPersistedProperty(ce.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return oe(function*(){e.ps.clear();const i=e.flush().catch(()=>{});void 0!==t?yield vn(i,t):yield i})()}flushWithTimeout(t){var e=this;return oe(function*(){const i=e.flush();yield vn(i,t,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=Ds(),this.$.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const qs=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function js(t){return String(t)+"000000"}function Bs(t,e,i,n){let s="";return n&&(s=Object.keys(n).sort().map(t=>`${JSON.stringify(t)}:${JSON.stringify(n[t])}`).join(",")),`${t}\0${e}\0${null!=i?i:""}\0${s}`}var Hs=class{constructor(t,e,i){this._instance=t,this.Rr=e,this.$=i,this.zs=new Map,this.ps=new Os(()=>this.flush().catch(t=>{this.$.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new on,this.ks=0,this.Ss=1,this.Gs=0}count(t,e=1,i){this.Zs({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.Zs({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.Zs({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this;const e=this.ys,i=function(){var i=oe(function*(){e&&(yield e.catch(()=>{})),yield t.Qs()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(0===this.zs.size)return null;const t=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const e=this.Os(t);if(null===e)return;if(!e.name||"string"!=typeof e.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof e.value||!Number.isFinite(e.value))return void this.$.warn(`Dropping metric '${e.name}': value must be a finite number`);if("count"===e.type&&0>e.value)return void this.$.warn(`Dropping count '${e.name}': counters are monotonic, value must be >= 0`);let i,n;try{i=e.attributes?he({},e.attributes):void 0,n=Bs(e.type,e.name,e.unit,i)}catch(t){return void this.$.warn(`Dropping metric '${e.name}': attributes could not be serialized`,t)}let s=this.zs.get(n);if(!s){if(!this.Ks())return;s={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now()},this.zs.set(n,s)}const r=this.Ws.get(e.name);void 0===r?this.Ws.set(e.name,e.type):r===e.type||this.Vs.has(e.name)||(this.Vs.add(e.name),this.$.warn(`Metric name '${e.name}' is already used as a ${r}; recording it as a ${e.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(s,e.value),this.Fs()}Ks(){return this.Rr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Rr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(t,e){switch(t.type){case"count":var i;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(qs.length+1).fill(0)});const i=t.hist;i.count+=1,i.sum+=e,i.min=Math.min(i.min,e),i.max=Math.max(i.max,e),i.bucketCounts[function(t,e){for(let i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,qs)]+=1;break}}}Os(t){const e=this.Rr.beforeSend;if(!e)return t;const i=xe(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.$.info("Metric was rejected in beforeSend function"),null;n=e}catch(t){return this.$.error("Error in beforeSend function for metric:",t),null}return n}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(Ls(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var t=this;return oe(function*(){if(t.ps.clear(),0===t.zs.size)return;const e=t.zs;t.zs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const i=t.Gs,n=yield t._instance.Ys(t.Js(e));if(i===t.Gs)switch(t.ws.record(n),"retry-later"===n.kind?(t.ks++,t.Ss=Ds()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.Hs()),n.kind){case"ok":return;case"retry-later":return t.ho(e),void t.ps.armNoEarlierThan(t.Hs());case"too-large":return void t.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.$.error("Failed to send metrics batch:",n.error)}})()}Js(t){return e=this.vo(t),i=function(t,e,i){return Cs(t,e,i)}(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Ts(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:e}]}]};var e,i,n,s}vo(t){const e=js(Date.now()),i=new Map;for(const o of t.values()){var n;const t=Bs(o.type,o.name,o.unit,void 0);let a=i.get(t);a||(a=he({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(t,a));const l=ws(null!==(n=o.attributes)&&void 0!==n?n:{},this.$),u=js(o.windowStartMs);if("count"===o.type){var s;const t={attributes:l,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(s=o.total)&&void 0!==s?s:0};a.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t={attributes:l,timeUnixNano:e,asDouble:null!==(r=o.last)&&void 0!==r?r:0};a.gauge.dataPoints.push(t)}else o.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:e,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:qs})}return Array.from(i.values())}ho(t){for(const[n,s]of t){const t=this.zs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,s.windowStartMs),t.type){case"count":var e,i;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(i=s.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(s.hist)if(t.hist){t.hist.count+=s.hist.count,t.hist.sum+=s.hist.sum,t.hist.min=Math.min(t.hist.min,s.hist.min),t.hist.max=Math.max(t.hist.max,s.hist.max);for(let e=0;t.hist.bucketCounts.length>e;e++)t.hist.bucketCounts[e]+=s.hist.bucketCounts[e]}else t.hist=s.hist}else this.Ks()&&this.zs.set(n,s)}}};function zs(t,e){if(!t)return;const i=t.find(t=>t.type===e);return null==i?void 0:i.value}const Us="0.9.0",Ws={DEBUG:!1,LIB_VERSION:Us,LIB_NAME:"browser-common",JS_SDK_VERSION:Us},Vs=(e,{debugEnabled:i}={})=>{const n={N(n,...s){t&&(Ws.DEBUG||t.POSTHOG_DEBUG||i)&&!Ie(t.console)&&t.console&&("__rrweb_original__"in t.console[n]?t.console[n].__rrweb_original__:t.console[n])(e,...s)},debug(...t){n.N("debug",...t)},info(...t){n.N("log",...t)},warn(...t){n.N("warn",...t)},error(...t){n.N("error",...t)},critical(...t){console.error(e,...t)},uninitializedWarning(t){n.error(`You must initialize PostHog before calling ${t}`)},createLogger:(t,i)=>Vs(`${e} ${t}`,i)};return n},Gs=Vs("[PostHog.js]"),Zs=Gs.createLogger;function Qs(t,e){xe(t)&&t.forEach(e)}function Js(t,e){if(!Re(t))if(xe(t))t.forEach(e);else if(De(t))t.forEach((t,i)=>e(t,i));else for(const i in t)ke.call(t,i)&&e(t[i],i)}const Ks=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function Xs(t){const e=Object.keys(t);let i=e.length;const n=new Array(i);for(;i--;)n[i]=[e[i],t[e[i]]];return n}const Ys=function(t){return function(...e){try{return t.apply(this,e)}catch(t){Gs.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Gs.critical(t)}}},tr=function(t){const e={};return Js(t,function(t,i){(Me(t)&&t.length>0||Ae(t))&&(e[i]=t)}),e};function er(t){const e=he({},t);for(const i of["name","message","stack","cause","errors"])try{i in t&&(e[i]=t[i])}catch(t){}return e}const ir=["herokuapp.com","vercel.app","netlify.app"];function nr(t){const e=null==t?void 0:t.hostname;if(!Me(e))return!1;const i=e.split(".").slice(-2).join(".");for(const t of ir)if(i===t)return!1;return!0}function sr(t,e,i,n){const{capture:s=!1,passive:r=!0}=null!=n?n:{};null==t||t.addEventListener(e,i,{capture:s,passive:r})}function rr(t){return"ph_toolbar_internal"===t.name}const or=["localhost","127.0.0.1"],ar=(t,e)=>{try{let i;return JSON.stringify(t,(t,e)=>{var n;return Be(e)?(null!==(n=i)&&void 0!==n||(i=new WeakMap),i.has(e)||i.set(e,er(e)),i.get(e)):"bigint"==typeof e?e.toString():e},e)}catch(e){return _e(t)}},lr=t=>{const e=null==n?void 0:n.createElement("a");return Ie(e)?null:(e.href=t,e)},ur=function(t,e="&"){let i,n;const s=[];return Js(t,function(t,e){Ie(t)||Ie(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),n=encodeURIComponent(e),s[s.length]=n+"="+i)}),s.join(e)},hr=function(t,e){const i=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let n;for(let t=0;i.length>t;t++){const s=i[t].split("=");if(s[0]===e){n=s;break}}if(!xe(n)||2>n.length)return"";{let t=n[1];try{t=decodeURIComponent(t)}catch(e){Gs.error("Skipping decoding for malformed query param: "+t)}return t.replace(/\+/g," ")}},cr=function(t,e,i){if(!t||!e||!e.length)return t;const n=t.split("#"),s=n[1],r=(n[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),u=[];for(let t=0;l.length>t;t++){const n=l[t].split("=");xe(n)&&(e.includes(n[0])?u.push(n[0]+"="+i):u.push(l[t]))}let h=a;return null!=o&&(h+="?"+u.join("&")),null!=s&&(h+="#"+s),h},dr=function(t,e){const i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},vr=(t,e)=>t>=e&&h(),fr=(t,e,i,n)=>{if(0===t){if(h()){const t=e+1;return t===i&&n(),t}return e}return 0};function pr(t,e){var i;const n=null==t||null===(i=t.config)||void 0===i?void 0:i.get_current_url;if(!Ce(n))return e;try{const t=n(e);return Me(t)&&t?t:e}catch(t){return Gs.error("Error in get_current_url, falling back to window.location.href",t),e}}function gr(e){var i;const n=null==t||null===(i=t.location)||void 0===i?void 0:i.href;return Ie(n)?void 0:pr(e,n)}function mr(t){var e;return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!!(null===(e=t.closest)||void 0===e?void 0:e.call(t,".toolbar-global-fade-container")))}function yr(t){return!!t&&1===t.nodeType}function br(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function _r(t){return!!t&&3===t.nodeType}function wr(t){return!!t&&11===t.nodeType&&yr(t.host)}function kr(t){return t?ye(t).split(/\s+/):[]}function Sr(t,e){const i=gr(e);return!!(i&&t&&t.some(t=>i.match(t)))}function xr(t){let e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return kr(e)}function Cr(t){return Re(t)?null:ye(t).split(/(\s+)/).filter(t=>Xr(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function $r(t){let e="";return zr(t)&&!Ur(t)&&t.childNodes&&t.childNodes.length&&Js(t.childNodes,function(t){var i;_r(t)&&t.textContent&&(e+=null!==(i=Cr(t.textContent))&&void 0!==i?i:"")}),ye(e)}function Tr(t){var e;return Ie(t.target)?t.srcElement||null:(null===(e=t.target)||void 0===e?void 0:e.shadowRoot)?t.composedPath()[0]||null:t.target||null}const Ir=["a","button","form","input","select","textarea","label"];function Mr(t,e){const i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}function Er(t,e){if(Ie(e))return!0;for(const i of t)if(e.some(t=>Mr(i,t)))return!0;return!1}function Pr(t){const e=t.parentNode;return!(!e||!yr(e))&&e}const Rr=[".ph-no-autocapture","[data-ph-no-autocapture]"],Ar=["next","previous","prev",">","<"],Fr=[...Ar,"+","-","−","–"],Or=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Dr=[".ph-no-deadclick",".ph-no-capture"],Lr=[".ph-no-rageclick",".ph-no-capture"],Nr=["","text","search","email","password","url","tel","number"];function qr(t){return!(!t||!yr(t))&&(!!br(t,"textarea")||(br(t,"input")?me(Nr,(t.getAttribute("type")||"").toLowerCase()):function(t){var e;if(t.isContentEditable)return!0;const i=null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return"true"===i||""===i}(t)))}function jr(e,i){if(!t||Br(e))return!1;let n,s,r;var o,a;if(Oe(i)?(n=!!i&&Lr,s=void 0,r=!1):(n=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Lr,s=null==i?void 0:i.content_ignorelist,r=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===n)return!1;if(r&&qr(e))return!1;const{targetElementList:l}=Hr(e,!1);return!function(t,e){if(!1===t||Ie(t))return!1;let i;if(!0===t)i=Ar;else{if(!xe(t))return!1;if(t.length>10)return Gs.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map(t=>t.toLowerCase())}return e.some(({safeText:t,ariaLabel:e})=>i.some(i=>Or(t,i)||Or(e,i)))}(s,l.map(t=>{var e;return{safeText:$r(t).toLowerCase(),ariaLabel:(null===(e=t.getAttribute("aria-label"))||void 0===e?void 0:e.toLowerCase().trim())||""}}))&&!Er(l,n)}const Br=t=>!t||br(t,"html")||!yr(t),Hr=(e,i)=>{if(!t||Br(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!br(r,"body");){if(wr(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=Pr(r);if(!e)break;if(i||Ir.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{const i=t.getComputedStyle(e);i&&"pointer"===i.getPropertyValue("cursor")&&(n=!0)}catch(t){}s.push(e),r=e}return{parentIsUsefulElement:n,targetElementList:s}};function zr(t){const e=new Set;let i=0;for(let n=t;n.parentNode&&!br(n,"body");n=n.parentNode){if(i++>=1e3||e.has(n))return!1;e.add(n);const t=xr(n);if(me(t,"ph-sensitive")||me(t,"ph-no-capture"))return!1}if(me(xr(t),"ph-include"))return!0;const n=t.type||"";if(Me(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const s=t.name||t.id||"";return!Me(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Ur(t){return!!(br(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||br(t,"select")||br(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Wr=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}))$"),Vr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Gr=[16,15,14,13],Zr=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Qr=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Jr=/[0-9A-Za-z_]/;function Kr(t){let e=0,i=!1;for(let n=t.length-1;n>=0;n--){let s=t.charCodeAt(n)-48;i&&(s*=2,s>9&&(s-=9)),e+=s,i=!i}return e%10==0}function Xr(t,e=!0){if(Re(t))return!1;if(Me(t)){if(t=ye(t),e?Wr.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Vr.lastIndex=0;e=Vr.exec(t);){const t=e[2];if(!t)continue;const i=t.replace(/[- ]/g,"");for(let t=0;i.length>t;t++)for(const e of Gr){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(Wr.test(e)&&Kr(e))return!0}}}return!1}(t))return!1;if(e?Zr.test(t):function(t){let e;for(Qr.lastIndex=0;e=Qr.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&Jr.test(t)&&Jr.test(i)))return!0}return!1}(t))return!1}return!0}function Yr(t){let e=$r(t);return e=`${e} ${to(t)}`.trim(),Xr(e)?e:""}function to(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Js(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=$r(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${to(t)}`.trim())}catch(t){Gs.error("[AutoCapture]",t)}}),e}function eo(t){return t.replace(/"|\\"/g,'\\"')}function io(t){const e=t.attr__class;if(e)return xe(e)?e:kr(e)}const no=1e6;function so(t){var e;return Math.min(no,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:no)}const ro={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:no,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},oo=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],ao=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],lo=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],uo=t=>{Re(t)||Js(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return oo.includes(e)||lo.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},ho=["/s/","/e/","/i/"];function co(t,e,i,n){if(Re(t))return t;let s=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return Me(s)&&(s=parseInt(s)),s>i?`[SessionRecording] ${n} body too large to record (${s} bytes)`:t}function vo(t,e){if(Re(t))return t;let i=t;return Xr(i,!1)||(i="[SessionRecording] "+e+" body redacted"),Js(ao,t=>{(null==i?void 0:i.length)&&-1!==(null==i?void 0:i.indexOf(t))&&(i="[SessionRecording] "+e+" body redacted as might contain: "+t)}),i}const fo=new WeakSet,po="disabled",go="sampled",mo="active",yo="buffering",bo="paused",_o="lazy_loading",wo="rrweb_error",ko="trigger_activated",So="trigger_pending",xo="trigger_disabled";function Co(t,e,i,n,s,r){return 0===e?xo:(null==t?void 0:t.get_property(i?n+i:s))===r?ko:So}function $o(t,e,i){return e.some(e=>{var n;return"regex"===e.matching&&(null!==(n=null==i?void 0:i.get(e.url))&&void 0!==n?n:new RegExp(e.url)).test(t)})}function To(t){return t.includes("trigger_activated")?ko:t.includes("trigger_pending")?So:xo}function Io(t){const e=new Set(t);switch(e.delete(xo),e.size){case 0:return xo;case 1:return Array.from(e)[0];default:return So}}var Mo=class{constructor(t){this.q=t}triggerStatus(t){return To(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return To(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Eo=class{constructor(t){this.q=t}triggerStatus(t){return Io(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return Io(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Po=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return ko}stop(){}};const Ro=t=>"sessionRecording"in t;var Ao=class{constructor(t,e){this._instance=t,this.j=[],this.B=[],this.H=new Map,this.U=new Map,this.W="",this.urlBlocked=!1,this.V=e}onConfig(t){var e,i;this.j=(Ro(t)?$e(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(Ro(t)?$e(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Z()}Z(){this.H.clear(),this.U.clear();for(const t of this.j)if("regex"===t.matching&&!this.H.has(t.url))try{this.H.set(t.url,new RegExp(t.url))}catch(e){Gs.error("Invalid URL trigger regex pattern:",t.url,e)}for(const t of this.B)if("regex"===t.matching&&!this.U.has(t.url))try{this.U.set(t.url,new RegExp(t.url))}catch(e){Gs.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}G(t){return Co(this._instance,this.j.length,this.V,Z,W,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Wt]:e}),e}triggerStatusNoSideEffects(t){return this.G(t)}isCurrentUrlBlocked(){const t=gr(this._instance);if(!t)return!1;try{return $o(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const i=gr(this._instance);if(!i)return;if(i===this.W)return;this.W=i;const n=this.urlBlocked,s=$o(i,this.B,this.U);n&&s||(s&&!n?t():!s&&n&&e())}checkUrlTriggerConditions(t,e,i,n){const s=gr(this._instance);if(!s)return;if(s===this.W)return;this.W=s;const r=this.urlBlocked,o=$o(s,this.B,this.U);o&&!r?t():!o&&r&&e();const a=this.G(n)===ko,l=$o(s,this.j,this.H);!a&&l&&i("url",s)}stop(){this.W=""}},Fo=class{constructor(t){this._instance=t,this.linkedFlag=null,this.linkedFlagSeen=!1,this.J=()=>{}}triggerStatus(){const t=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[jt]:t}),t}triggerStatusNoSideEffects(){let t=So;return Re(this.linkedFlag)&&(t=xo),this.linkedFlagSeen&&(t=ko),t}onConfig(t,e){var i;if(this.linkedFlag=(Ro(t)?$e(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!Re(this.linkedFlag)&&!this.linkedFlagSeen){const t=Me(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=Me(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((n,s)=>{let r=!1;if($e(s)&&t in s){const e=s[t];r=Oe(e)?!0===e:i?e===i:!!e}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&e(t,i)})}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.J()}},Oo=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(Ro(t)?$e(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}X(t){return Co(this._instance,this.K.length,this.V,G,V,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[qt]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,i){if(0===this.K.length)return;const n=this.X(i)===ko,s=this.K.includes(t);!n&&s&&e("event",t)}stop(){}},Do=class{constructor(t,e,i){if(this._instance=t,this.group=e,this.Y=new Ao(t,e.id),this.tt=new Oo(t,e.id),this.et=new Fo(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){const t=(e.conditions.events||[]).map(t=>t.name),n={urlTriggers:e.conditions.urls||[],eventTriggers:t,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.Y.onConfig(n),this.tt.onConfig(n),this.et.onConfig(n,i);const s=[this.tt,this.Y,this.et];this.nt="any"===e.conditions.matchType?new Mo(s):new Eo(s)}else this.nt=new Po}triggerStatus(t){return this.nt.triggerStatus(t)}triggerStatusNoSideEffects(t){return this.nt.triggerStatusNoSideEffects(t)}getPendingTriggerConditions(t){return"trigger_pending"!==this.triggerStatusNoSideEffects(t)?[]:[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===So).map(({label:t})=>t)}checkEventTriggerConditions(t,e,i){this.tt.checkEventTriggerConditions(t,e,i)}checkUrlTriggerConditions(t,e,i,n){this.Y.checkUrlTriggerConditions(t,e,i,n)}activateTrigger(t,e){var i;const n="url"===t?Z+this.group.id:G+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:e})}stop(){this.Y.stop(),this.tt.stop(),this.et.stop()}};function Lo(t){if(t.rrwebError)return wo;if(!t.receivedFlags)return yo;if(!t.isRecordingEnabled)return po;if(t.urlTriggerMatching.urlBlocked)return bo;const e=!0===t.isSampled,i=new Mo([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?go:"trigger_activated"===i?mo:"trigger_pending"===i?yo:!1===t.isSampled?po:mo}function No(t){if(t.rrwebError)return wo;if(!t.receivedFlags)return yo;if(!t.isRecordingEnabled)return po;if(t.urlTriggerMatching.urlBlocked)return bo;const e=new Eo([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),i=e!==xo,n=Oe(t.isSampled);return i&&"trigger_pending"===e?yo:i&&"trigger_disabled"===e||n&&!t.isSampled?po:!0===t.isSampled?go:mo}function qo(){const t=[];return function(e,i){if($e(i)||xe(i)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(i)?"[Circular]":(t.push(i),i)}return i}}function jo(t){try{const e=JSON.stringify(t,qo());return e?new Blob([e]).size:0}catch(t){return-1}}function Bo(t){if(Pe(t))return 4;if(Ie(t))return 0;switch(typeof t){case"string":return t.length+2;case"number":return String(t).length;case"boolean":return t?4:5;case"object":{if(xe(t)){let e=2;for(let i=0;t.length>i;i++){i>0&&(e+=1);const n=t[i];e+=Ie(n)||Pe(n)?4:Bo(n)}return e}const e=t;let i=2,n=!0;for(const t in e){if(!{}.hasOwnProperty.call(e,t))continue;const s=e[t];Ie(s)||(n||(i+=1),n=!1,i+=t.length+3+Bo(s))}return i}default:return 0}}function Ho(t,e=6606028.8){if(t.size>=e&&t.data.length>1){const e=Math.floor(t.data.length/2),i=t.sizes.slice(0,e),n=t.sizes.slice(e);return[Ho({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Ho({size:n.reduce((t,e)=>t+e,0),data:t.data.slice(e),sizes:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap(t=>t)}return[t]}var zo=Uint8Array,Uo=Uint16Array,Wo=Uint32Array,Vo=new zo([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]),Go=new zo([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Zo=new zo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qo=function(t,e){for(var i=new Uo(31),n=0;31>n;++n)i[n]=e+=1<<t[n-1];var s=new Wo(i[30]);for(n=1;30>n;++n)for(var r=i[n];i[n+1]>r;++r)s[r]=r-i[n]<<5|n;return[i,s]},Jo=Qo(Vo,2),Ko=Jo[1];Jo[0][28]=258,Ko[258]=28;for(var Xo=Qo(Go,0)[1],Yo=new Uo(32768),ta=0;32768>ta;++ta){var ea=(43690&ta)>>>1|(21845&ta)<<1;Yo[ta]=((65280&(ea=(61680&(ea=(52428&ea)>>>2|(13107&ea)<<2))>>>4|(3855&ea)<<4))>>>8|(255&ea)<<8)>>>1}var ia=function(t,e,i){for(var n=t.length,s=0,r=new Uo(e);n>s;++s)++r[t[s]-1];var o,a=new Uo(e);for(s=0;e>s;++s)a[s]=a[s-1]+r[s-1]<<1;if(i){o=new Uo(1<<e);var l=15-e;for(s=0;n>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],c=a[t[s]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[Yo[c]>>>l]=u}else for(o=new Uo(n),s=0;n>s;++s)o[s]=Yo[a[t[s]-1]++]>>>15-t[s];return o},na=new zo(288);for(ta=0;144>ta;++ta)na[ta]=8;for(ta=144;256>ta;++ta)na[ta]=9;for(ta=256;280>ta;++ta)na[ta]=7;for(ta=280;288>ta;++ta)na[ta]=8;var sa=new zo(32);for(ta=0;32>ta;++ta)sa[ta]=5;var ra=ia(na,9,0),oa=ia(sa,5,0),aa=function(t){return(t/8|0)+(7&t&&1)},la=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof Uo?Uo:t instanceof Wo?Wo:zo)(i-e);return n.set(t.subarray(e,i)),n},ua=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8},ha=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8,t[n+2]|=i>>>16},ca=function(t,e){for(var i=[],n=0;t.length>n;++n)t[n]&&i.push({s:n,f:t[n]});var s=i.length,r=i.slice();if(!s)return[new zo(0),0];if(1==s){var o=new zo(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(t,e){return t.f-e.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,c=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[c].f>i[u].f?u++:c++],l=i[u!=h&&i[c].f>i[u].f?u++:c++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var d=r[0].s;for(n=1;s>n;++n)r[n].s>d&&(d=r[n].s);var v=new Uo(d+1),f=da(i[h-1],v,0);if(f>e){n=0;var p=0,g=f-e,m=1<<g;for(r.sort(function(t,e){return v[e.s]-v[t.s]||t.f-e.f});s>n;++n){var y=r[n].s;if(e>=v[y])break;p+=m-(1<<f-v[y]),v[y]=e}for(p>>>=g;p>0;){var b=r[n].s;e>v[b]?p-=1<<e-v[b]++-1:++n}for(;n>=0&&p;--n){var _=r[n].s;v[_]==e&&(--v[_],++p)}f=e}return[new zo(v),f]},da=function(t,e,i){return-1==t.s?Math.max(da(t.l,e,i+1),da(t.r,e,i+1)):e[t.s]=i},va=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Uo(++e),n=0,s=t[0],r=1,o=function(t){i[n++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++r;else{if(!s&&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(s),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(s);r=1,s=t[a]}return[i.subarray(0,n),e]},fa=function(t,e){for(var i=0,n=0;e.length>n;++n)i+=t[n]*e[n];return i},pa=function(t,e,i){var n=i.length,s=aa(e+2);t[s]=255&n,t[s+1]=n>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var r=0;n>r;++r)t[s+r+4]=i[r];return 8*(s+4+n)},ga=function(t,e,i,n,s,r,o,a,l,u,h){ua(e,h++,i),++s[256];for(var c=ca(s,15),d=c[0],v=c[1],f=ca(r,15),p=f[0],g=f[1],m=va(d),y=m[0],b=m[1],_=va(p),w=_[0],k=_[1],S=new Uo(19),x=0;y.length>x;++x)S[31&y[x]]++;for(x=0;w.length>x;++x)S[31&w[x]]++;for(var C=ca(S,7),T=C[0],I=C[1],M=19;M>4&&!T[Zo[M-1]];--M);var E,P,R,A,F=u+5<<3,O=fa(s,na)+fa(r,sa)+o,D=fa(s,d)+fa(r,p)+o+14+3*M+fa(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(O>=F&&D>=F)return pa(e,h,t.subarray(l,l+u));if(ua(e,h,1+(O>D)),h+=2,O>D){E=ia(d,v,0),P=d,R=ia(p,g,0),A=p;var L=ia(T,I,0);for(ua(e,h,b-257),ua(e,h+5,k-1),ua(e,h+10,M-4),h+=14,x=0;M>x;++x)ua(e,h+3*x,T[Zo[x]]);h+=3*M;for(var N=[y,w],q=0;2>q;++q){var j=N[q];for(x=0;j.length>x;++x)ua(e,h,L[B=31&j[x]]),h+=T[B],B>15&&(ua(e,h,j[x]>>>5&127),h+=j[x]>>>12)}}else E=ra,P=na,R=oa,A=sa;for(x=0;a>x;++x)if(n[x]>255){var B;ha(e,h,E[257+(B=n[x]>>>18&31)]),h+=P[B+257],B>7&&(ua(e,h,n[x]>>>23&31),h+=Vo[B]);var H=31&n[x];ha(e,h,R[H]),h+=A[H],H>3&&(ha(e,h,n[x]>>>5&8191),h+=Go[H])}else ha(e,h,E[n[x]]),h+=P[n[x]];return ha(e,h,E[256]),h+P[256]},ma=new Wo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ya=new zo(0),ba=function(){for(var t=new Wo(256),e=0;256>e;++e){for(var i=e,n=9;--n;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),_a=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function wa(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,n=0;e.length>n;++n)i=ba[255&i^e[n]]^i>>>8;t=i},d(){return 4294967295^t}}}(),n=t.length;i.p(t);var s,r,o,a,l,u=(s=t,r=e,o=function(t){return 10+(t.filename&&t.filename.length+1||0)}(e),a=8,function(t,e,i,n,s,r){var o=t.length,a=new zo(n+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(n,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=pa(l,u,t.subarray(h,c)):(l[h]=r,u=pa(l,u,t.subarray(h,o)))}else{for(var d=ma[e-1],v=d>>>13,f=8191&d,p=(1<<i)-1,g=new Uo(32768),m=new Uo(p+1),y=Math.ceil(i/3),b=2*y,_=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<b)&p},w=new Wo(25e3),k=new Uo(288),S=new Uo(32),x=0,C=0,T=(h=0,0),I=0,M=0;o>h;++h){var E=_(h),P=32767&h,R=m[E];if(g[P]=R,m[E]=P,h>=I){var A=o-h;if((x>7e3||T>24576)&&A>423){u=ga(t,l,0,w,k,S,C,T,M,h-M,u),T=x=C=0,M=h;for(var F=0;286>F;++F)k[F]=0;for(F=0;30>F;++F)S[F]=0}var O=2,D=0,L=f,N=P-R&32767;if(A>2&&E==_(h-N))for(var q=Math.min(v,A)-1,j=Math.min(32767,h),B=Math.min(258,A);j>=N&&--L&&P!=R;){if(t[h+O]==t[h+O-N]){for(var H=0;B>H&&t[h+H]==t[h+H-N];++H);if(H>O){if(O=H,D=N,H>q)break;var z=Math.min(N,H-2),U=0;for(F=0;z>F;++F){var W=h-N+F+32768&32767,V=W-g[W]+32768&32767;V>U&&(U=V,R=W)}}}N+=(P=R)-(R=g[P])+32768&32767}if(D){w[T++]=268435456|Ko[O]<<18|Xo[D];var G=31&Ko[O],Z=31&Xo[D];C+=Vo[G]+Go[Z],++k[257+G],++S[Z],I=h+O,++x}else w[T++]=t[h],++k[t[h]]}}u=ga(t,l,r,w,k,S,C,T,M,h-M,u),r||(u=pa(l,u,ya))}return la(a,0,n+aa(u)+s)}(s,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+r.mem,o,a,!l)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&_a(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var n=0;i.length>=n;++n)t[n+10]=i.charCodeAt(n)}}(u,e),_a(u,h-8,i.d()),_a(u,h-4,n),u}function ka(t,e){var i=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new zo(t.length+(t.length>>>1)),s=0,r=function(t){n[s++]=t},o=0;i>o;++o){if(s+5>n.length){var a=new zo(s+8+(i-o<<1));a.set(n),n=a}var l=t.charCodeAt(o);128>l||e?r(l):2048>l?(r(192|l>>>6),r(128|63&l)):l>55295&&57344>l?(r(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),r(128|l>>>12&63),r(128|l>>>6&63),r(128|63&l)):(r(224|l>>>12),r(128|l>>>6&63),r(128|63&l))}return la(n,0,s)}function Sa(t,e){var i="";if(!e&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var n=0;t.length>n;){var s=t[n++];128>s||e?i+=String.fromCharCode(s):224>s?i+=String.fromCharCode((31&s)<<6|63&t[n++]):240>s?i+=String.fromCharCode((15&s)<<12|(63&t[n++])<<6|63&t[n++]):(s=((15&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,i+=String.fromCharCode(55296|s>>10,56320|1023&s))}return i}var xa=class{constructor(t,e={}){var i,n,s,r;this._rrweb=t,this.it=e,this.rt={},this.ot=Date.now(),this.st=-1/0,this.ut=()=>{const t=Date.now(),e=t-this.ot;e>0?(this.ct=Math.min(this.dt,this.ct+e/1e3*this.ht),this.ot=t):this.ot=t},this.ft=t=>{if(!this.rt[t]){var e,i;this.rt[t]=!0;const n=this.vt(t);null===(e=(i=this.it).onBlockedNode)||void 0===e||e.call(i,t,n)}},this.yt=t=>{const e=this.vt(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){const t=e.closest("svg");if(t)return[this._rrweb.mirror.getId(t),t]}return[t,e]},this.vt=t=>this._rrweb.mirror.getNode(t),this.bt=t=>{var e,i,n,s,r,o,a,l;return(null!==(e=null===(i=t.removes)||void 0===i?void 0:i.length)&&void 0!==e?e:0)+(null!==(n=null===(s=t.attributes)||void 0===s?void 0:s.length)&&void 0!==n?n:0)+(null!==(r=null===(o=t.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(a=null===(l=t.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;const e=t.data,i=this.bt(e);if(e.attributes){const t=e.attributes.length;e.attributes=e.attributes.filter(t=>{const[e]=this.yt(t.id);return!this.wt.consumeRateLimit(e)&&t});const i=t-e.attributes.length;var n,s;i>0&&(null===(n=(s=this.it).onDroppedAttributeMutations)||void 0===n||n.call(s,i))}const r=this.bt(e);if(0===r&&i!==r)return;if(this.kt)return t;this.ut();const o=Bo(t);var a,l;return o>this.ct?(null===(a=(l=this.it).onDroppedOversizedMutation)||void 0===a||a.call(l,o),void this._t()):(this.ct-=o,t)},this._t=()=>{if(this.St)return;const t=Math.max(0,this.xt-(Date.now()-this.st));this.St=setTimeout(()=>{var t,e;this.St=void 0,this.st=Date.now(),null===(t=(e=this.it).requestFullSnapshot)||void 0===t||t.call(e)},t)},this.wt=new Je({bucketSize:null!==(i=this.it.bucketSize)&&void 0!==i?i:100,refillRate:null!==(n=this.it.refillRate)&&void 0!==n?n:10,refillInterval:1e3,I:this.ft,$:Gs}),this.dt=null!==(s=this.it.bytesBucketSize)&&void 0!==s?s:0,this.ht=null!==(r=this.it.bytesRefillRate)&&void 0!==r?r:25600,this.kt=!Number.isFinite(this.dt)||0>=this.dt,this.ct=this.dt;const o=this.it.resyncIntervalMs;this.xt=Ae(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this.rt={},this.St&&(clearTimeout(this.St),this.St=void 0),this.st=Date.now()}stop(){this.wt.stop(),this.reset(),this.ct=this.dt,this.ot=Date.now(),this.st=-1/0}};const Ca=t=>{if(n){try{const e=t+"=",i=n.cookie.split(";").filter(t=>t.length);for(let t=0;i.length>t;t++){let n=i[t];for(;" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Ae(t)&&isFinite(t)&&Math.floor(t)===t});var $a=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,i,n,s){if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(n)||!Number.isInteger(s)||0>e||0>i||0>n||0>s||e>0xffffffffffff||i>4095||n>1073741823||s>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|i>>>8,r[7]=i,r[8]=128|n>>>24,r[9]=n>>>16,r[10]=n>>>8,r[11]=n,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new t(r)}toString(){let t="";for(let e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(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 e=0;16>e;e++){const i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}},Ta=class{generate(){const t=this.generateOrAbort();if(!Ie(t))return t;{this.Ct=0;const t=this.generateOrAbort();if(Ie(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return Ae(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Ct)this.Ct=t,this.Mt();else{if(this.Ct>=t+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return $a.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new Ma}};let Ia=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!Ie(t.crypto)&&crypto.getRandomValues&&(Ia=t=>crypto.getRandomValues(t));var Ma=class{nextUint32(){return this.Rt.length>this.$t||(Ia(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let Ea;const Pa=()=>Ra().toString(),Ra=()=>(Ea||(Ea=new Ta)).generate();let Aa="";const Fa=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Oa=null;const Da={Et(){if(!Pe(Oa))return Oa;if(Oa=!1,n)try{const t=`__ph_cookie_support_${Pa()}`;Da.At(t,"xyz"),Oa='"xyz"'===Ca(t),Da.Lt(t)}catch(t){Oa=!1}return Oa},Pt(t){Gs.error("cookieStore error: "+t)},Ot:Ca,Dt(t){let e;try{e=JSON.parse(Da.Ot(t))||{}}catch(t){}return e},At(t,e,i,s,r){if(!n)return!1;try{let o="",a="";const l=function(t,e){if(e){let e=function(t,e=n){if(Aa)return Aa;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";const i=t.split(".");let s=Math.min(i.length,8);const r="dmn_chk_"+Pa();for(;!Aa&&s--;){const t=i.slice(s).join("."),n=r+"=1;domain=."+t+";path=/";e.cookie=n+";max-age=3",e.cookie.includes(r)&&(e.cookie=n+";max-age=0",Aa=t)}return Aa}(t);if(!e){const i=(t=>{const e=t.match(Fa);return e?e[0]:""})(t);i!==e&&Gs.info("Warning: cookie subdomain discovery mismatch",i,e),e=i}return e?"; domain=."+e:""}return""}(n.location.hostname,s);if(i){const t=new Date;t.setTime(t.getTime()+864e5*i),o="; expires="+t.toUTCString()}r&&(a="; secure");const u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&Gs.warn("cookieStore warning: large cookie, len="+u.length),n.cookie=u,!0}catch(t){return!1}},Lt(t,e){if((null==n?void 0:n.cookie)&&(!e||!Pe(Ca(t))))try{Da.At(t,"",-1,e)}catch(t){return}}};let La=null;const Na={Et(){if(!Pe(La))return La;let e=!0;if(Ie(t))e=!1;else try{const t="__mplssupport__";Na.At(t,"xyz"),'"xyz"'!==Na.Ot(t)&&(e=!1),Na.Lt(t)}catch(t){e=!1}return e||Gs.error("localStorage unsupported; falling back to cookie store"),La=e,e},Pt(t){Gs.error("localStorage error: "+t)},Ot(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Na.Pt(t)}return null},Dt(t){try{return JSON.parse(Na.Ot(t))||{}}catch(t){}return null},At(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Na.Pt(t)}return!1},Lt(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Na.Pt(t)}}},qa=[at,Y,X,et,it,nt,Ct,xt,kt],ja=[p,f,H,z,Rt,Pt,_,$t],Ba=t=>t+"_cpm",Ha=["__proto__","constructor","prototype"],za=t=>{if(!$e(t))return{};const e={};return Object.keys(t).forEach(i=>{-1===Ha.indexOf(i)&&(e[i]=t[i])}),e},Ua=(t,e=[])=>{const i={};return[...ja,...e].forEach(e=>{const n=t[e];Ie(n)||Pe(n)||""===n||(i[e]=n)}),i},Wa=t=>{let e=5381,i=2166136261;for(let n=0;t.length>n;n++){const s=t.charCodeAt(n);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},Va=(t,e)=>({p:e,f:Wa(JSON.stringify(t))}),Ga=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const i=Da.Dt(Ba(t)),n=(null==i?void 0:i.f)===Wa(e)&&xe(i.p);return{properties:n?i.p:[],isValid:n}}catch(t){return{properties:[],isValid:!1}}},Za=(t,e)=>e+"|"+(Da.Ot(Ba(t))||""),Qa={},Ja={Et:()=>!0,Pt(t){Gs.error("memoryStorage error: "+t)},Ot:t=>t in Qa?Qa[t]:null,Dt:t=>t in Qa?Qa[t]:null,At:(t,e)=>(Qa[t]=e,!0),Lt(t){delete Qa[t]}};let Ka=null;const Xa={Et(){if(!Pe(Ka))return Ka;if(Ka=!0,Ie(t))Ka=!1;else try{const t="__support__";Xa.At(t,"xyz"),'"xyz"'!==Xa.Ot(t)&&(Ka=!1),Xa.Lt(t)}catch(t){Ka=!1}return Ka},Pt(t){Gs.error("sessionStorage error: ",t)},Ot(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Xa.Pt(t)}return null},Dt(t){try{return JSON.parse(Xa.Ot(t))||null}catch(t){}return null},At(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Xa.Pt(t)}return!1},Lt(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Xa.Pt(t)}}};Ws.DEBUG=!1,Ws.LIB_VERSION="1.434.12",Ws.LIB_NAME="web";var Ya=Ws,tl=class{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.Ft=t.get_property.bind(t),this.Nt=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.Nt(K,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(K);return $e(i=e)&&Me(i.sessionId)&&Ae(i.size)&&e.sessionId===t?e.size:0;var i}};function el(t,e){return function(t){let e=0;for(let i=0;t.length>i;i++)e=(e<<5)-e+t.charCodeAt(i),e|=0;return Math.abs(e)}(t)%100<Qe(100*e,0,100,Gs)}function il(t){return`$survey_response_${t}`}function nl(t,e){if(!e)return null;const i=t[il(e)];return xe(i)?[...i]:i}function sl({event:t,survey:e,responses:i={},submissionId:n,completed:s,surveyLanguage:r,questionSnapshots:o}){return he(he(he(he({},!Ie(n)&&{$survey_submission_id:n}),"sent"===t?!Ie(s)&&{$survey_completed:s}:{$survey_partially_completed:rl(i)}),r&&{$survey_language:r}),function(t={},e,i){const n={};return e.questions.forEach(e=>{if(Ie(e.originalQuestionIndex))return;const i=0===(s=e.originalQuestionIndex)?"$survey_response":`$survey_response_${s}`;var s;const r=nl(t,e.id);Ie(r)||(n[i]=r)}),he(he({$survey_questions:e.questions.map(e=>{var n,s;return{id:e.id,question:null!==(n=null==i?void 0:i[null!==(s=e.id)&&void 0!==s?s:""])&&void 0!==n?n:e.question,response:nl(t,e.id)}})},t),n)}(i,e,o))}function rl(t={}){return Object.values(t).some(t=>!Re(t))}function ol(t,e){let i=`$survey_${e}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(i=`$survey_${e}/${t.id}/${t.current_iteration}`),i}function al(t){return"string"==typeof t&&t.trim()?t.trim():null}function ll(t){return t.toLowerCase()}function ul(t,e,i){if(!t||!e)return null;const n=ll(e),s=Object.keys(t).find(t=>ll(t)===n);if(s)return null==i||i.debug(`Found exact translation match: ${s}`),s;if(n.includes("-")){const s=n.split("-")[0],r=Object.keys(t).find(t=>ll(t)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${e})`),r}return null}const hl=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function cl(t,e,i){var n;const s=ul(t.translations,e,i),r=he({},t);let o=!1;if(s){var a;const e=null===(a=t.translations)||void 0===a?void 0:a[s];if(e)if(null==i||i.info(`Applying survey-level translation for language: ${s}`),Ie(e.name)||(r.name=e.name,o=!0),r.appearance){const t=he({},r.appearance);for(const i of hl){const n=e[i];Ie(n)||(t[i]=n,o=!0)}r.appearance=t}else(function(t){return hl.some(e=>!Ie(t[e]))})(e)&&(o=!0)}const l=t.questions.map(t=>function(t,e,i){var n;const s=ul(t.translations,e,i);if(!s)return{question:t,matchedKey:null,hasChanges:!1};const r=null===(n=t.translations)||void 0===n?void 0:n[s];if(!r)return{question:t,matchedKey:null,hasChanges:!1};const o=he({},t);let a=!1;return Ie(r.question)||(o.question=r.question,a=!0),Ie(r.description)||(o.description=r.description,a=!0),Ie(r.buttonText)||(o.buttonText=r.buttonText,a=!0),"link"in o&&!Ie(r.link)&&(o.link=r.link,a=!0),"lowerBoundLabel"in o&&!Ie(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!Ie(r.upperBoundLabel)&&(o.upperBoundLabel=r.upperBoundLabel,a=!0),"choices"in o&&function(t){return xe(t.choices)}(r)&&(o.choices=r.choices,a=!0),{question:a?o:t,matchedKey:a?s:null,hasChanges:a}}(t,e,i)),u=l.map(t=>t.question),h=l.some(t=>t.hasChanges);let c=null;return s||(c=(null===(n=l.find(t=>t.matchedKey))||void 0===n?void 0:n.matchedKey)||null),h&&(r.questions=u,o=!0,null==i||i.info(`Applied question-level translations for language: ${e}`)),{survey:r,matchedKey:o?s||c:null}}function dl(t){var e;return!!(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)}function vl(t){var e;return dl(t)&&!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e?void 0:e.repeatedActivation)||"always"===t.schedule}const fl=(t,e)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},pl=t=>t.toLowerCase(),gl={exact:(t,e)=>e.some(e=>t.some(t=>e===t)),is_not:(t,e)=>e.every(e=>t.every(t=>e!==t)),regex:(t,e)=>e.some(e=>t.some(t=>fl(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!fl(e,t))),icontains:(t,e)=>e.map(pl).some(e=>t.map(pl).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(pl).every(e=>t.map(pl).every(t=>!e.includes(t))),gt:(t,e)=>e.some(e=>{const i=parseFloat(e);return!isNaN(i)&&t.some(t=>i>parseFloat(t))}),lt:(t,e)=>e.some(e=>{const i=parseFloat(e);return!isNaN(i)&&t.some(t=>i<parseFloat(t))})};function ml(t,e){return!t||Object.entries(t).every(([t,i])=>{const n=null==e?void 0:e[t];if(null==n)return!1;const s=gl[i.operator];return!!s&&s(i.values.map(String),[String(n)])})}const yl=t=>{const e=[...t];for(let t=e.length-1;t>0;t--){const i=Math.floor(Math.random()*(t+1));[e[t],e[i]]=[e[i],e[t]]}return e};function bl(t,e,i){return ar({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}const _l=new Set(["is_not","not_icontains","not_regex"]);function wl(t,e,i){return!t||0===t.length||t.every(t=>{const n="person"===t.type?i:e,s=null==n?void 0:n[t.key],r=t.operator||"exact";if(Ie(s)||Pe(s))return _l.has(r);const o=gl[r];return!!o&&!Ie(t.value)&&!Pe(t.value)&&o(xe(t.value)?t.value.map(String):[String(t.value)],xe(s)?s.map(String):[String(s)])})}const kl=Zs("[SessionRecording]");function Sl(t,e){return e?t:"!"+t}function xl(t,e){return t===e||t!=="!"+e&&null}var Cl=class{constructor(t,e,i,n,s,r,o){this._instance=t,this.Y=e,this.tt=i,this.et=n,this.qt=s,this.jt=r,this.Bt=o,this.Ht=null,this.zt=No}onRemoteConfig(t){this.Ht=Ae(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new Mo([this.tt,this.Y]),this.zt=Lo):(this.Ut=new Eo([this.tt,this.Y]),this.zt=No),this._instance.register_for_session({[zt]:t.triggerMatchType}),this.Y.onConfig(t),this.tt.onConfig(t),this.et.onConfig(t,(t,e)=>{this.qt("linked_flag_matched",{flag:t,variant:e}),this.Bt()})}getStatus(t){return this.zt({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){const e=this._instance.get_property("$session_recording_remote_config"),i=null==e?void 0:e.minimumDurationMilliseconds;return Ae(i)?i:null}checkUrlTriggers(t,e,i,n){this.Y.checkUrlTriggerConditions(e,i,n,t)}setupEventTriggerListeners(t,e,i){if(0!==this.tt.K.length&&Re(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,i,e)}catch(t){kl.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const i=this.Ht;var n,s;if(!Ae(i))return null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_is_sampled"),void(null===(s=this._instance.persistence)||void 0===s||s.unregister("$replay_sample_rate"));const r=this._instance.get_property(z),o=this._instance.get_property(L),a=xl(r,t),l=Ae(o)&&o!==i,u=Ie(o)&&r===t,h=l||u||!Oe(a),c=h?el(t,i):a;h&&(c?this.qt("sampled"):kl.warn(`Sample rate (${i}) has determined that this sessionId (${t}) will not be sent to the server.`)),null===(e=this._instance.persistence)||void 0===e||e.register({$session_is_sampled:Sl(t,c),$replay_sample_rate:Pe(o)&&r===t?null:i})}ensureSamplingDecision(t){if(!Ae(this.Ht))return;const e=this._instance.get_property(z);Oe(xl(e,t))||this.makeSamplingDecisions(t)}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,i,n,s;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_event_trigger_activated_session"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$replay_sample_rate"),null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_past_minimum_duration")}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null===(e=this.Ut)||void 0===e?void 0:e.triggerStatus(t))===So}getPendingTriggerConditions(t){return[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===So).map(({label:t})=>t)}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.tt.stop(),this.Y.stop(),this.et.stop()}},$l=class{constructor(t,e,i,n,s){this._instance=t,this.Y=e,this.qt=i,this.Vt=n,this.Bt=s,this.Zt=[],this.Gt=new Map,this.Qt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Jt(t.triggerGroups),this._instance.register_for_session({[zt]:"v2_trigger_groups",[Ut]:t.triggerGroups.length}),this.Y.onConfig(t)):kl.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return wo;if(!t.receivedFlags)return yo;if(!t.isRecordingEnabled)return po;if(t.urlTriggerMatching.urlBlocked)return bo;const e=t.triggerGroupMatchers,i=t.triggerGroupSamplingResults;if(0===e.length)return po;let n=!1,s=!1;for(const r of e){const e=r.triggerStatus(t.sessionId);if("trigger_activated"===e){const t=r.group.id,e=i.get(t);Ie(e)?Gs.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(s=!0)}else"trigger_pending"===e&&(n=!0)}return s?go:n?yo:po}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Zt,triggerGroupSamplingResults:this.Gt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const i of this.Zt)if("trigger_activated"===i.triggerStatus(t)){const t=i.group.minDurationMs;Ae(t)&&(Pe(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,i,n){this.Y.checkUrlBlocklist(e,i);for(const n of this.Zt)n.checkUrlTriggerConditions(e,i,e=>{this.Kt(n,void 0)&&(n.activateTrigger(e,t),this.updateActiveTriggers(t),this.Bt(e))},t)}setupEventTriggerListeners(t,e,i){return this.Wt=t(t=>{var i;if(this.Qt)return kl.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this.Wt)||void 0===i||i.call(this),void(this.Wt=void 0);try{for(const i of this.Zt)i.checkEventTriggerConditions(t.event,n=>{if(!this.Kt(i,t.properties))return;const s=(i.group.conditions.events||[]).filter(e=>e.name===t.event),r=this._instance.get_property(at);s.some(e=>!e.properties||0===e.properties.length||wl(e.properties,t.properties,r))&&(i.activateTrigger(n,e),this.updateActiveTriggers(e),this.Bt(n))},e)}catch(t){kl.error("Could not activate event trigger for trigger groups",t)}}),this.Wt}makeSamplingDecisions(t){for(const i of this.Zt){var e;const n=i.group,s=n.id,r=n.sampleRate,o=Q+s,a=this._instance.get_property(o);let l=null,u=!1,h=!1,c=!1;if($e(a)){const e=a.sessionId,i=a.sampleRate,n=a.sampled;u="string"==typeof e&&e!==t,h=Ae(i)&&i!==r,l=e===t&&Ae(i)&&i===r&&Oe(n)?n:null}else l=a===t||null,u="string"==typeof a&&a!==t,c=a===t;const d=u||h||c||!Oe(l),v=d?el(t+s,r):l;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:s,group_name:n.name,sampleRate:r,isSampled:v}),this.Gt.set(s,v),null===(e=this._instance.persistence)||void 0===e||e.register({[o]:{sessionId:t,sampleRate:r,sampled:v}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Qt=!0}clearConditionalRecordingPersistence(){var t,e,i;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const t of this.Zt){var n,s,r;const e=t.group.id;null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_event_trigger_"+e),null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_url_trigger_"+e),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+e)}}updateActiveTriggers(t){const e=[];for(const i of this.Zt){const n=i.group,s=n.id,r="trigger_activated"===i.triggerStatus(t),o=!0===this.Gt.get(s);r&&e.push({id:s,name:n.name,matched:!0,sampled:o})}this._instance.register_for_session({[Bt]:e})}hasPendingTriggers(t){for(const e of this.Zt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Zt.flatMap(e=>"trigger_pending"!==e.triggerStatusNoSideEffects(t)?[]:e.getPendingTriggerConditions(t).map(t=>`trigger group "${e.group.name}": ${t}`))}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear(),this.Y.stop()}Kt(t,e){const i=t.group.conditions.properties;return!i||0===i.length||wl(i,e,this._instance.get_property(at))}Jt(t){this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear();for(const e of t){const t=new Do(this._instance,e,(t,i)=>{this.qt("linked_flag_matched",{flag:t,variant:i,group_id:e.id,group_name:e.name}),this.Bt()});this.Zt.push(t)}}};const Tl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Il=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Tl],Ml="<masked>",El=["li_fat_id"];function Pl(t,e,i){if(!n)return{};const s=e?[...Tl,...i||[]]:[],r=Rl(cr(n.URL,s,Ml),t),o=function(){const t={};return Js(El,function(e){const i=Ca(e);t[e]=i||null}),t}();return Ks(o,r)}function Rl(t,e){const i=Il.concat(e||[]),n={};return Js(i,function(e){const i=hr(t,e);n[e]=i||null}),n}function Al(t){const e=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),i="yahoo"!=e?"q":"p",s={};if(!Pe(e)){s.$search_engine=e;const t=n?hr(n.referrer,i):"";t.length&&(s.ph_keyword=t)}return s}function Fl(){return navigator.language||navigator.userLanguage}function Ol(){const t=Fl();return"string"==typeof t?t.split("-")[0]:void 0}const Dl="$direct";function Ll(){return(null==n?void 0:n.referrer)||Dl}function Nl(t,e,i=!1){const n=t?[...Tl,...e||[]]:[],r=i?hn(null==s?void 0:s.href):null==s?void 0:s.href,o=null==r?void 0:r.substring(0,1e3);return{r:Ll().substring(0,1e3),u:o?cr(o,n,Ml):void 0}}function ql(t,e=!1){var i;const{r:n,u:s}=t,r=e?hn(s):s,o={$referrer:n,$referring_domain:null==n?void 0:n==Dl?Dl:null===(i=lr(n))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const t=lr(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const e=Rl(r);Ks(o,e)}if(n){const t=Al(n);Ks(o,t)}return o}function jl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Bl(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Hl=1e5,zl=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Ul=[],Wl=()=>!1,Vl="@type @id actionStatus availability bestRating contentRating encodingFormat eventAttendanceMode eventStatus highPrice inLanguage isAccessibleForFree isFamilyFriendly itemCondition itemListOrder lowPrice maximumAttendeeCapacity nonprofitStatus numberOfItems offerCount position price priceCurrency priceValidUntil publicAccess ratingCount ratingValue reviewCount smokingAllowed worstRating".split(" "),Gl="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Zl="AutoDealer Bakery BarOrPub CafeOrCoffeeShop CollegeOrUniversity Corporation DaySpa Dentist EducationalOrganization Electrician FoodEstablishment GovernmentOrganization HealthClub Hotel LegalService Library LibrarySystem LocalBusiness Locksmith LodgingBusiness MedicalBusiness NGO OnlineStore Organization PerformingGroup Pharmacy Physician Plumber RealEstateAgent Restaurant School SportsOrganization Store".split(" "),Ql="Accommodation AdministrativeArea Country Place State".split(" "),Jl={AggregateOffer:{offers:["Offer"]},Brand:{name:!0},BreadcrumbList:{itemListElement:["ListItem"]},CreativeWork:{genre:!0,dateCreated:!0,dateModified:!0,datePublished:!0,expires:!0,learningResourceType:!0,educationalLevel:!0,educationalUse:!0,interactivityType:!0,aggregateRating:["AggregateRating"],potentialAction:Gl,publisher:Zl},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Ul},Offer:{seller:Zl},Organization:{name:!0,legalName:!0,foundingDate:!0,dissolutionDate:!0,aggregateRating:["AggregateRating"],brand:["Brand"]},Place:{aggregateRating:["AggregateRating"]},Product:{name:!0,sku:!0,mpn:!0,gtin:!0,gtin8:!0,gtin12:!0,gtin13:!0,gtin14:!0,productID:!0,productGroupID:!0,asin:!0,model:!0,category:!0,color:!0,material:!0,pattern:!0,size:!0,productionDate:!0,releaseDate:!0,brand:["Brand","Organization"],manufacturer:Zl,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Zl,areaServed:Ql,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Ul}},Kl=[["3DModel AboutPage Answer Article AudioObject Blog BlogPosting Book Clip CollectionPage Comment ContactPage Course CreativeWorkSeason CreativeWorkSeries DataCatalog DataDownload DataFeed Dataset DiscussionForumPosting Episode FAQPage Game HowTo HowToDirection HowToSection HowToStep HowToTip ImageObject LearningResource MediaObject Message MobileApplication Movie MusicPlaylist MusicRecording NewsArticle Photograph PodcastEpisode PodcastSeries ProfilePage QAPage Question Quiz Recipe Review ScholarlyArticle SearchResultsPage SiteNavigationElement SocialMediaPosting SoftwareApplication TVEpisode TVSeries TechArticle VacationRental VideoGame VideoObject WebApplication WebPage WebPageElement WebSite".split(" "),Jl.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Jl.Event],[Zl,Jl.Organization],[Ql,Jl.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Jl.Product]];function Xl(t,e){return ke.call(t,e)?t[e]:void 0}function Yl(t){const e=typeof t;return Pe(t)||"string"===e||"number"===e||"boolean"===e}function tu(t,e){return e&&function(t){return Me(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function eu(t,e){return xe(t)&&t.every(Yl)?t.map(t=>tu(t,e)).filter(t=>!Ie(t)):Yl(t)?tu(t,e):void 0}function iu(t,e){if("string"!=typeof t)return;const i=t.trim(),n=i.indexOf("#"),s=0>n?i:i.slice(n+1);if(!(!s||0>n&&(/^[a-z][a-z\d+.-]*:/i.test(i)||i.includes("/")||i.includes("?"))))try{return e(s)?s:void 0}catch(t){return}}function nu(t){if(ke.call(Jl,t))return Jl[t];for(const[e,i]of Kl)if(e.includes(t))return i}function su(t,e,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0})}function ru(t,e,i,n){if(xe(t)){const s=t.map(t=>ru(t,e,i,n)).filter(t=>!Ie(t));return s.length?s:void 0}return ou(t,e,i,n)||void 0}function ou(t,e,i,n){if(!$e(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(i))return null;const s=Xl(t,"@type"),r=function(t){const e=new Set,i="string"==typeof t?[t]:xe(t)?t:[],n=[];for(const t of i){if("string"!=typeof t)continue;const i=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&zl.test(i)&&!e.has(i)&&(e.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(t=>!!nu(t)&&(!n||!n.length||n.includes(t))),a={};for(const n of Vl){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?iu(Xl(t,n),e):eu(Xl(t,n),i.maskUrl);Ie(o)||su(a,n,o)}for(const n of o){const s=nu(n);for(const n of Object.keys(s)){const r=Xl(t,n),o=s[n];if(!0===o){const t=eu(r,i.maskUrl);Ie(t)||su(a,n,t)}else{const t=ru(r,e,i,o);Ie(t)||su(a,n,t)}}}const l=ru(Xl(t,"@graph"),e,i);return Ie(l)||su(a,"@graph",l),Object.keys(a).length?a:null}function au(t,e,i){if(!$e(t))return null;const n=Xl(t,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=ou(t,e,i);return s?he({"@context":"https://schema.org"},s):null}function lu(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function uu(t,e,i){if("string"==typeof e?t.classList.contains(e):e&&Array.from(t.classList).some(t=>(e.lastIndex=0,e.test(t))))return!0;try{return!!i&&t.matches(i)}catch(t){return!1}}function hu(t,e,i){for(let n=t;n;){if(uu(n,e,i))return!0;const t=n.parentNode;n=n.parentElement||(t&&t.nodeType===t.DOCUMENT_FRAGMENT_NODE?t.host:null)}return!1}function cu(t){return lu(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(lu)}function du(t){return Ie(t)?void 0:Math.round(t)}function vu(t){return $e(t)?t.network_timing:t}const fu=Zs("[SessionRecording]"),pu=[1,2,3,4,5,6,7,12],gu=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function mu(){var t;return null==d||null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function yu(){var t;return null===(t=mu())||void 0===t?void 0:t.record}function bu(t){try{return JSON.stringify(t)}catch(e){if(e instanceof RangeError)throw e;return JSON.stringify(t,qo())}}function _u(t){return Sa(wa(ka(bu(t))),!0)}function wu(t){return ku.apply(this,arguments)}function ku(){return(ku=oe(function*(t){const e=yield ms(bu(t),Ya.DEBUG,{rethrow:!0});return Sa(new Uint8Array(yield e.arrayBuffer()),!0)})).apply(this,arguments)}let Su,xu;const Cu="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let $u=!1;function Tu(t){var e;return xe(t)&&0===t.length?(Su=null!==(e=Su)&&void 0!==e?e:_u([]),Su):_u(t)}function Iu(t){return Mu.apply(this,arguments)}function Mu(){return(Mu=oe(function*(t){var e;return xe(t)&&0===t.length?Su||(xu=null!==(e=xu)&&void 0!==e?e:wu([]).then(t=>(Su=t,t)).catch(t=>{throw Su=void 0,xu=void 0,t}),xu):wu(t)})).apply(this,arguments)}function Eu(t){return Cu&&!$u&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function Pu(t){return{event:t,size:Bo(t)}}function Ru(t,e){return he(he({},t),{},{data:e,cv:"2024-10"})}function Au(t,e){return he(he({},t),{},{cv:"2024-10",data:he(he({},t.data),e)})}function Fu(t){try{if(2===t.type)return Pu(Ru(t,_u(t.data)));if(3===t.type&&0===t.data.source)return Pu(Au(t,{texts:Tu(t.data.texts),attributes:Tu(t.data.attributes),removes:Tu(t.data.removes),adds:Tu(t.data.adds)}));if(3===t.type&&8===t.data.source)return Pu(Au(t,{adds:t.data.adds?_u(t.data.adds):void 0,removes:t.data.removes?_u(t.data.removes):void 0}))}catch(t){fu.warn("could not compress event - will use uncompressed event",t)}return{event:t,size:jo(t)}}function Ou(){return Ou=oe(function*(t){try{if(2===t.type)return Pu(Ru(t,yield wu(t.data)));if(3===t.type&&0===t.data.source){const[e,i,n,s]=yield Promise.all([Iu(t.data.texts),Iu(t.data.attributes),Iu(t.data.removes),Iu(t.data.adds)]);return Pu(Au(t,{texts:e,attributes:i,removes:n,adds:s}))}if(3===t.type&&8===t.data.source){const[e,i]=yield Promise.all([t.data.adds?wu(t.data.adds):void 0,t.data.removes?wu(t.data.removes):void 0]);return Pu(Au(t,{adds:e,removes:i}))}}catch(e){return ds(e)&&($u=!0),fu.warn("could not compress event asynchronously - trying synchronous compression",e),Fu(t)}return{event:t,size:jo(t)}}),Ou.apply(this,arguments)}function Du(t,e){return 5===t.type&&t.data.tag===e}function Lu(t){return Du(t,"sessionIdle")}function Nu(t){return Du(t,"$session_ending")}function qu(t){return Du(t,"$session_starting")}var ju=class{get sessionId(){return this.Xt}get Yt(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get te(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get ee(){return xl(this._instance.get_property(z),this.sessionId)}get Ht(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return Ae(e)?e:null}get ie(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t,e){this._instance=t,this.oe="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.se=void 0,this.ae=!1,this.le=Date.now(),this.ue=!1,this.ce=[],this.de="unknown",this.he=0,this.fe=0,this.ve=0,this.pe=0,this.me=0,this.ge=!1,this.ye=!1,this.be=!1,this.we=!1,this.ke=!1,this._e=!1,this.Se=!1,this.xe=!1,this.Ce=!1,this.Me=!1,this.Ie=!1,this.Te=!1,this.Re=[],this.$e=void 0,this.Ee=void 0,this.Ae=!1,this.Oe=[],this.Le=0,this.Pe=0,this.De=!1,this.Fe=void 0,this.Wt=void 0,this.Ne=void 0,this.qe=void 0,this.je=void 0,this.Be=(t,e,i)=>{var n,s,r,o;if(!i)return;if(t===this.Xt&&e===this.He)return;const a=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),l=this.Xt,u=this.He;var h;if(a&&this.Vt("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le,flushed_size:null===(h=this.ze)||void 0===h?void 0:h.currentTrackedSize(l)}),null===(n=this._instance.persistence)||void 0===n||n.unregister("$debug_first_full_snapshot_timestamp"),this.Se=!1,null===(s=mu())||void 0===s||null===(r=s.resetMaxDepthState)||void 0===r||r.call(s),this.Vt("$session_id_change",{sessionId:t,windowId:e,changeReason:i}),this.Ue(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.He===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.We(e)}a&&this.Vt("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le}),null===(o=this.re)||void 0===o||o.makeSamplingDecisions(t)},this.Ve=!1,this.Ze=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[U])===this.Xt},this.Ge=()=>{var t,e;if(0===this.Rt.data.length)return null;const i=null===(t=this.Rt.data[0])||void 0===t?void 0:t.timestamp,n=null===(e=this.Rt.data[this.Rt.data.length-1])||void 0===e?void 0:e.timestamp;return Ae(i)&&Ae(n)?n-i:null},this.Qe=()=>{var t,e;const i=this.ie;if(!Ae(i))return!1;if(null===(t=null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.strictMinimumDuration)||void 0===t||!t){const t=this.Je;return Ae(t)&&t>=0&&i>t}if(this.Ze())return!1;const n=this.Ge();return!!Pe(n)||i>n||(null===(s=this._instance.persistence)||void 0===s||s.register({$session_past_minimum_duration:this.Xt}),!1);var s},this.Ke=()=>{"buffering"!==this.status?(this.ge&&this.ye&&this.Xe&&!this.be&&this.Ye(void 0),this.tn(),this.en(!0)):this.nn()},this.rn=()=>{this.Ke()},this.sn=()=>{this.Vt("browser offline",{})},this.an=()=>{this.Vt("browser online",{})},this.ln=()=>{(null==n?void 0:n.visibilityState)&&("visible"===n.visibilityState&&(this.Xe=!0),this.Vt("window "+n.visibilityState,{}))},this.Xe=null==e||e;const{sessionId:i,windowId:s,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=i,this.He=s,this._sessionStartTimestamp=r,this.et=new Fo(this._instance),this.Y=new Ao(this._instance),this.tt=new Oo(this._instance),this.Rt=this.nn(),this.un="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this.Yt.sessionTimeoutMs>this.te||fu.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.ze=new tl(this._instance)}setDocumentWasEverVisible(t){t&&(this.Xe=!0)}get cn(){var t,e,i,n,s,r,o,a,l;const u=null===(t=this.ne)||void 0===t?void 0:t.masking,h={maskAllInputs:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.blockSelector,maskAllElementAttributes:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.maskAllElementAttributes},c=null!==(r=null==h?void 0:h.maskAllInputs)&&void 0!==r?r:null==u?void 0:u.maskAllInputs,d=null!==(o=null==h?void 0:h.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,v=null!==(a=null==h?void 0:h.blockSelector)&&void 0!==a?a:null==u?void 0:u.blockSelector,f=null!==(l=null==h?void 0:h.maskAllElementAttributes)&&void 0!==l?l:null==u?void 0:u.maskAllElementAttributes;return Ie(c)&&Ie(d)&&Ie(v)&&Ie(f)?void 0:{maskAllInputs:null==c||c,maskTextSelector:d,blockSelector:v,maskAllElementAttributes:f}}dn(){var t;if(this.Ce)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(Re(e))return;const i=this._instance.config.session_recording,n=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(t=>{const n=null==i?void 0:i[t],s=e[t];return!Ie(n)&&n!==s});0!==n.length&&(this.Ce=!0,fu.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+n.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==i?void 0:i.maskAllInputs,maskTextSelector:null==i?void 0:i.maskTextSelector,blockSelector:null==i?void 0:i.blockSelector,maskAllElementAttributes:null==i?void 0:i.maskAllElementAttributes},project:e}))}get hn(){var t;return Qe(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,Zs("canvas recording resolution scale"),1)}get fn(){var t,e,i,n,s,r,o;const a=this._instance.config.session_recording.captureCanvas,l=null===(t=this.ne)||void 0===t?void 0:t.canvasRecording,u=null!==(e=null!==(i=null==a?void 0:a.recordCanvas)&&void 0!==i?i:null==l?void 0:l.enabled)&&void 0!==e&&e,h=null!==(n=null!==(s=null==a?void 0:a.canvasFps)&&void 0!==s?s:null==l?void 0:l.fps)&&void 0!==n?n:4;let c=null!==(r=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==r?r:.4;if("string"==typeof c){const t=parseFloat(c);c=isNaN(t)?.4:t}return{enabled:u,fps:Qe(h,0,12,Zs("canvas recording fps"),4),quality:Qe(c,0,1,Zs("canvas recording quality"),.4)}}get vn(){var t;const e=!!(null===(t=this.ne)||void 0===t?void 0:t.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:e}get pn(){var t,e,i;const n=null===(t=this.ne)||void 0===t?void 0:t.networkPayloadCapture,s={recordHeaders:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=(null==s?void 0:s.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==s?void 0:s.recordBody)||(null==n?void 0:n.recordBody),a=vu(this._instance.config.capture_performance),l=vu(null==n?void 0:n.capturePerformance),u=!!(Oe(a)?a:l);return r||o||u?{recordHeaders:r,recordBody:o,recordPerformance:u}:void 0}mn(){var t,e;const i=[],n=null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;n&&this.vn&&i.push(n());const r=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.pn&&Ce(r))if(!or.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){const t=Ce(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(((t,e,i)=>{const n={payloadSizeLimitBytes:ro.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...ro.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...ro.payloadHostDenyList]},s=!1!==t.session_recording.recordHeaders&&e.recordHeaders,r=!1!==t.session_recording.recordBody&&e.recordBody,o=!1!==t.capture_performance&&e.recordPerformance,a=(t=>{const e=so(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=co(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=co(t.responseBody,t.responseHeaders,e,"Response")),t)})(n),l=e=>{return a(((t,e,i)=>{var n;if(null==i?void 0:i(t.name))return;const s=lr(t.name);let r=0===e.indexOf("http")?null===(n=lr(e))||void 0===n?void 0:n.pathname:e;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&ho.some(t=>0===o.indexOf(t))?void 0:t})((uo((n=e).requestHeaders),uo(n.responseHeaders),n),t.api_host,i));var n},u=Ce(t.session_recording.maskNetworkRequestFn);return u&&Ce(t.session_recording.maskCapturedNetworkRequestFn)&&Gs.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),u&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{const i=t.session_recording.maskNetworkRequestFn({url:e.name});return!i&&e.isInitial?i:he(he({},e),{},{name:null==i?void 0:i.url})}),n.maskRequestFn=Ce(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var i,n;const s=l(e);if(!s)return;const r=s.isInitial?{name:"",entryType:s.entryType,startTime:s.startTime,duration:s.duration,endTime:s.endTime,timeOrigin:s.timeOrigin,timestamp:s.timestamp,isInitial:!0}:void 0,o=null===(i=(n=t.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(n,s);return Re(o)&&r?(fo.add(r),r):null!=o?o:void 0}:t=>function(t){if(!Ie(t))return t.requestBody=vo(t.requestBody,"Request"),t.responseBody=vo(t.responseBody,"Response"),t}(l(t)),he(he(he({},ro),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.pn,t)))}else fu.info("NetworkCapture not started because we are on localhost.");return i}gn(t){return this._instance.config.disable_capture_url_hashes?hn(t):t}yn(t,e=!1){const i=e?hn(t):this.gn(t),n=this._instance.config.mask_personal_data_properties?[...Tl,...this._instance.config.custom_personal_data_properties||[]]:[];return this.bn(cr(i,n,Ml))}bn(t){const e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var i;const n=e.maskCapturedNetworkRequestFn({name:t});return null!==(i=null==n?void 0:n.name)&&void 0!==i?i:null==n?void 0:n.url}if(e.maskNetworkRequestFn){const i=e.maskNetworkRequestFn({url:t});return null==i?void 0:i.url}return t}wn(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.ce.length?this.ce.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):fu.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.wn(gu(()=>yu().addCustomEvent(t,e)))}kn(){var t;return this.ae&&!0===(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)&&!this.Y.urlBlocked&&!0!==this.de}_n(t){if(!this.kn())return!1;try{const e=yu();return!!e&&(e.addCustomEvent("$json_ld",t),this.kn())}catch(t){return!1}}Sn(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this.xn)||void 0===e?void 0:e.scan(t)})}Cn(){try{if(this._instance.config.capture_pageview||!t)return;const e=new URL(t.location.href),i=this.yn(e.origin+e.pathname+e.search);this.Mn!==i&&(this.Mn=i,this.Vt("$url_changed",{href:i}))}catch(t){}}In(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.wn(t)})}}jt(){return this.wn(gu(()=>yu().takeFullSnapshot()))}get Tn(){var t,e,i;if((null===(t=this.re)||void 0===t?void 0:t.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var n;const t=null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.trigger_pending_buffer_interval_millis;return Ae(t)&&Number.isFinite(t)&&t>=1e3&&36e5>=t?t:6e4}return null!==(e=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Rn(){if(this.$n&&clearInterval(this.$n),!0===this.de)return;const t=this.Tn;t&&(this.$n=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.En(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Rn()}An(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this.xn)||void 0===t||t.scan(),clearInterval(this.$n),fu.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}On(){var t;this.Y.urlBlocked&&(null===(t=this.xn)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this.Sn(),this.Rn(),this.Vt("recording resumed",{reason:"left blocked url"}),fu.info("recording resumed"))}Ln(t,e){var i;if("event"===t&&this.En(),!this.ue&&(null===(i=this.re)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this.ue=!0;try{var n,s;const i="url"===t?W:V;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:this.sessionId}),null===(s=this.re)||void 0===s||s.updateActiveTriggers(this.sessionId),this.Bt(),this.en(),this.qt(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.ue=!1}}}get isStarted(){return!!this.se}get ne(){const t=this._instance.get_property(O);if(!t)return;let e;try{e=$e(t)?t:JSON.parse(t)}catch(t){return void fu.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.Ve){var i;const n=null!==(i=e.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-n>36e5)return void fu.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t})}return e}Pn(t,e,i){this._instance.get_property(t)&&(e(),i())}start(e){var i,s;const r=this.ne;if(!r)return void fu.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.we;this.Ye(t?"no_interaction_since_recording_started":void 0),this.we=!1,this.ye=t,this.be=!1}this.De&&(this.Dn(),this.nn());const{sessionId:o,windowId:a,sessionStartTimestamp:l}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=o,this.He=a,this._sessionStartTimestamp=l,this.Fn(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this.oe=null==r?void 0:r.endpoint),this.re=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new $l(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new Cl(this._instance,this.Y,this.tt,this.et,this.qt.bind(this),this.jt.bind(this),this.Bt.bind(this)),this.re.onRemoteConfig(r),null===(s=this.Wt)||void 0===s||s.call(this),this.Wt=this.re.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(t,e)=>this.Ln(t,e)),this.Pn(N,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(N)}),this.Pn(q,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(q)}),this.Pn(B,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(B)}),this.Pn(j,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(j)}),this.re.makeSamplingDecisions(this.sessionId),this.Nn(),this.ke||(sr(t,"beforeunload",this.Ke),sr(t,"pagehide",this.rn),sr(t,"offline",this.sn),sr(t,"online",this.an),sr(n,"visibilitychange",this.ln),!this.Ne&&Ce(this.Yt.onSessionId)&&(this.Ne=this.Yt.onSessionId(this.Be)),!this.qe&&Ce(this.Yt.on)?this.qe=this.Yt.on("forcedIdleReset",()=>{this.Ue(),this.de="unknown",this.stop(),this.je=this.Yt.onSessionId((t,e,i)=>{var n;null===(n=this.je)||void 0===n||n.call(this),this.je=void 0,this.Be(t,e,i)})}):Ce(this.Yt.on)||fu.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Re(this.Fe)&&(this.Fe=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.yn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){fu.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(e||"recording_initialized"))}qn(){var e,i,s,r,o,a;null==t||t.removeEventListener("beforeunload",this.Ke),null==t||t.removeEventListener("pagehide",this.rn),null==t||t.removeEventListener("offline",this.sn),null==t||t.removeEventListener("online",this.an),null==n||n.removeEventListener("visibilitychange",this.ln),clearInterval(this.$n),this.jn(),null===(e=this.Fe)||void 0===e||e.call(this),this.Fe=void 0,null===(i=this.Wt)||void 0===i||i.call(this),this.Wt=void 0,null===(s=this.Ne)||void 0===s||s.call(this),this.Ne=void 0,null===(r=this.qe)||void 0===r||r.call(this),this.qe=void 0,null===(o=this.je)||void 0===o||o.call(this),this.je=void 0,null===(a=this.re)||void 0===a||a.stop(),this.Bn(),this.Dn()}Dn(){this.Pe+=1,this.Oe=[],this.Le=0,this.Hn=void 0,this.De=!1}Bn(){var t,e;null===(t=this.zn)||void 0===t||t.stop(),this.ce=[],null===(e=this.xn)||void 0===e||e.stop(),this.xn=void 0,this.ae=!1;try{var i;null===(i=this.se)||void 0===i||i.call(this)}catch(t){fu.warn("could not stop rrweb",t)}this.se=void 0}Un(){if(!this.Hn||0===this.Le)return!1;if(this.De)return!0;this.De=!0,this.Wn=void 0;const t=this.Pe;return this.jn(),this.Bn(),this.Hn.catch(()=>{}).then(()=>{t===this.Pe&&(this.De=!1,this.en(),this.nn(),this.Vn(),this.qn(),fu.info("stopped"))}).catch(()=>{this.De=!1,this.Vn(),this.qn(),fu.info("stopped")}),!0}stop(){if(this.Bn(),this.Ve)this.tn();else if(this.Un())return;this.en(),this.nn(),this.Vn(),this.qn(),fu.info("stopped")}Vn(){this.Ye(void 0,{preserveLogDedup:this.Ve}),this.ye=!1}flushBeforeIdentityReset(){(this.isStarted||this.De)&&(this.tn(),this.en())}We(t){this.Ve=!0,this.le=Date.now();try{var e,i;this.stop(),this.Zn=void 0,this.Gn=void 0,this.fe=0,this.ve=0,this.pe=0,this.me=0,null===(e=mu())||void 0===e||null===(i=e.resetSnapshotCostState)||void 0===i||i.call(e),this.start("session_id_changed")}finally{this.Ve=!1}this.Ye(t?"no_interaction_since_session_rotated":void 0),this.ye=!1}Ye(t,{preserveLogDedup:e=!1}={}){if(this.ge=!Ie(t),this.Wn=t,Ie(t))return void(e||(this.Qn=void 0));if(this.Ve)return;const i=`${this.sessionId}:${t}`;i!==this.Qn&&(this.Qn=i,fu.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}En(){this.isStarted||(this.we=!0),this.ge&&(this.Ye(void 0),this.ye=!1,this.be&&(this.be=!1,this.jt()),this.Jn())}discard({discardProducerEvents:t=!1}={}){this.ge=!0,t&&(this.nn(),this.Bn()),this.nn(),this.qn(),this.nn(),this.Vn(),fu.info("discarded")}Kn(t,e,i,n,s){if(-1===i)return this.me+=1,void fu.warn("could not stringify event - dropping it to keep the rest of the recording");const r={$snapshot_bytes:i,$snapshot_data:e,$session_id:n,$window_id:s};"disabled"!==this.status?(this.Xn(t,n),this.Yn(r)):this.nn()}ti(){try{this.ei()}catch(t){this.xe||(this.xe=!0,fu.error("could not track full snapshot cost",t))}}ei(){var t,e;const i=null===(t=mu())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);i&&i!==this.Gn&&(this.Gn=i,this.Zn&&this.Zn.durationMs>=i.durationMs||(this.Zn=i),500>i.durationMs||fu.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(i.durationMs),stylesheetMs:Math.round(i.stylesheetMs),nodeCount:i.nodeCount,cssRuleCount:i.cssRuleCount,nonDeferrableCssRuleCount:i.nonDeferrableCssRuleCount,deferredStylesheetCount:i.deferredStylesheetCount}))}Xn(t,e){2!==t.type?3===t.type&&(Ie(this.$e)||this.$e===e||this.Ee===e||(this.Ee=e,fu.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.$e=e}ni(t){t.counted&&t.generation===this.Pe&&(this.Le=Math.max(0,this.Le-1)),t.counted=!1,this.Oe=this.Oe.filter(e=>e!==t)}ii(t,e,i){t.processed||t.generation!==this.Pe||(t.processed=!0,this.Kn(t.event,e,i,t.targetSessionId,t.targetWindowId))}ri(t){try{let e,i=t.event;if(t.compressionEnabled)try{({event:i,size:e}=Fu(t.event))}catch(t){fu.warn("could not process queued compression event - will use uncompressed event",t)}Ie(e)&&(e=jo(t.event));try{this.ii(t,i,e)}catch(t){fu.warn("could not capture queued compression event",t)}}finally{this.ni(t)}}tn(){[...this.Oe].forEach(t=>{try{this.ri(t)}catch(t){fu.warn("could not drain queued compression event",t)}})}oi(t,e,i,n){var s=this;const r={event:t,compressionEnabled:e,targetSessionId:i,targetWindowId:n,generation:this.Pe,processed:!1,counted:!0};this.Oe.push(r),this.Le+=1;const o=(a=oe(function*(){try{if(r.processed)return;let i,n;try{const s=e?Eu(t)?yield function(t){return Ou.apply(this,arguments)}(t):Fu(t):{event:t,size:jo(t)};i=s.event,n=s.size}catch(e){fu.warn("could not process queued compression event - will use uncompressed event",e),i=t,n=jo(t)}s.ii(r,i,n)}finally{s.ni(r)}}),function(){return a.apply(this,arguments)});var a;this.Hn=this.Hn?this.Hn.catch(()=>{}).then(o):o()}onRRwebEmit(e){var i,n,s,r,o,a,l,u,h,c,d,v,f;if(!this._instance.sessionManager)return;if(this.In(),!e||!$e(e))return;if(4===e.type){const t=this.yn(e.data.href);if(this.Mn=t,!t)return;e.data.href=t}else this.Cn();if(null===(i=this.re)||void 0===i||i.checkUrlTriggers(this.sessionId,()=>this.An(),()=>this.On(),(t,e)=>this.Ln(t,e)),this.Y.urlBlocked&&!function(t){return 5===t.type&&"recording paused"===t.data.tag}(e))return;2===e.type&&((null===(c=mu())||void 0===c||null===(d=c.wasMaxDepthReached)||void 0===d?void 0:d.call(c))&&(this.Se=!0),this.ti(),Promise.resolve().then(()=>this.ti()),this.Rn(),null===(v=this.zn)||void 0===v||v.reset(),null===(f=this._instance.persistence)||void 0===f||f.register_once({$debug_first_full_snapshot_timestamp:e.timestamp},void 0));const p=2===e.type&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));p&&this.si();const g=this.zn?this.zn.throttleMutations(e):e;if(!g)return void(!0===this.de&&this.he++);const m=function(t){const e=t;if(e&&$e(e)&&6===e.type&&$e(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));const i=[];for(let t=0;e.data.payload.payload.length>t;t++)i.push(e.data.payload.payload[t]&&e.data.payload.payload[t].length>2e3?e.data.payload.payload[t].slice(0,2e3)+"...[truncated]":e.data.payload.payload[t]);return e.data.payload.payload=i,t}return t}(g),y=function(t){return Nu(t)?t.data.payload:null}(m),b=function(t){return qu(t)?t.data.payload:null}(m),_=function(t){return Lu(t)?t.data.payload:null}(m);y||b?(null==y?void 0:y.lastActivityTimestamp)&&(m.timestamp=y.lastActivityTimestamp):(null==_?void 0:_.sessionId)||this.ai(m),2===e.type&&(this.Re.push([this.Xt,e.timestamp]),this.Re.length>6&&(this.Re=this.Re.slice(-6)));const w=null!==(s=null!==(r=null!==(o=null==y?void 0:y.currentSessionId)&&void 0!==o?o:null==b?void 0:b.nextSessionId)&&void 0!==r?r:null==_?void 0:_.sessionId)&&void 0!==s?s:this.Xt,k=null!==(a=null!==(l=null!==(u=null==y?void 0:y.currentWindowId)&&void 0!==u?u:null==b?void 0:b.nextWindowId)&&void 0!==l?l:null==_?void 0:_.windowId)&&void 0!==a?a:this.He;if(!0===this.de&&!function(t){return Lu(t)||Nu(t)||qu(t)}(m))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(m)&&this.he++);2===m.type&&(this.he=0),_&&(m.timestamp=_.lastActivityTimestamp+_.threshold);const S=this.ae;this.ae=!0,p?this.Sn(!0):S||this.Sn();const x=null===(h=this._instance.config.session_recording.compress_events)||void 0===h||h;if(5===m.type&&"$json_ld"===m.data.tag){let e;try{e=t?this.yn(t.location.href):void 0}catch(t){}m.data.href=e}if(this.Le>0||x&&Eu(m))return void this.oi(m,x,w,k);const{event:C,size:T}=x?Fu(m):{event:m,size:jo(m)};this.Kn(m,C,T,w,k)}get status(){return this.re?this.re.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ee,rrwebError:this.ke,urlTriggerMatching:this.Y,eventTriggerMatching:this.tt,linkedFlagMatching:this.et,remoteConfig:this.ne}):po}log(t,e="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.et.linkedFlagSeen=!0,this.jt(),this.En(),this.qt("linked_flag_overridden")}overrideSampling(){var t;null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this.jt(),this.En(),this.qt("sampling_overridden")}overrideTrigger(t){this.Ln(t),this.En()}li(){try{var e;const i=null==t||null===(e=t.location)||void 0===e?void 0:e.href;if(!i)return;const n=this.yn(i);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}jn(){this.ui&&(clearTimeout(this.ui),this.ui=void 0)}Jn(){this.ui||(this.ui=setTimeout(()=>{this.en()},2e3))}ci(){return this.$e!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!Nu(t)&&!qu(t))}di(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}hi(t){if("buffering"!==t)return Ie(this.fi)||this._instance.register_for_session({[Ht]:[]}),void(this.fi=void 0);const e=this.di();if(0===e.length)return Ie(this.fi)||this._instance.register_for_session({[Ht]:[]}),void(this.fi=void 0);const i=e.join(", "),n=`${this.sessionId}:${i}`;n!==this.fi&&(this.fi=n,this._instance.register_for_session({[Ht]:e}),fu.info(`buffering: ${i}`))}pi(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.mi)&&Xa.Et()}gi(){0!==this.Rt.data.length&&this.Rt.size!==this.yi&&943718.4>=this.Rt.size&&this.pi()&&(this.yi=this.Rt.size,Xa.At(this.un,this.Rt))}Fn(){if(this.Ae||!this.pi())return;this.Ae=!0;const t=Xa.Dt(this.un);Xa.Lt(this.un),$e(t)&&xe(t.data)&&0!==t.data.length&&xe(t.sizes)&&t.sizes.length===t.data.length&&Ae(t.size)&&t.sessionId===this.Xt&&t.windowId===this.He&&(this.Rt.data.length>0||(this.Rt=t))}en(t=!1){var e;if(this.jn(),this.ge)return this.Rt;if(this.ci())return this.Rt.size>943718.4?this.nn():(t&&this.gi(),this.Rt);const i=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const n=this.Qe(),s=this.status;if(this.hi(s),"buffering"===s||"paused"===s||"disabled"===s||n)return!t||"active"!==s&&"sampled"!==s||this.gi(),this.Jn(),this.Rt;if(this.Rt!==i)return this.Rt;if(i.data.length>0){var r;const t=this.li();Ho(i).forEach(e=>{try{var i;null===(i=this.ze)||void 0===i||i.trackSize(e.sessionId,e.size),this.bi(he({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:Ya.LIB_NAME,$lib_version:Ya.LIB_VERSION,$snapshot_host:t},this.me>0?{$sdk_debug_replay_unstringifiable_events_dropped:this.me}:{}))}catch(t){fu.warn("could not capture snapshot chunk - skipping it",t)}}),Ie(this.yi)||(Xa.Lt(this.un),this.yi=void 0),null===(r=this.re)||void 0===r||r.onFlushComplete()}return this.nn()}Yn(t){var e;const i=2+((null===(e=this.Rt)||void 0===e?void 0:e.data.length)||0),n=t.$session_id,s=this.Rt.sessionId!==n;if(s||!0!==this.de&&!this.ge&&this.Rt.size+t.$snapshot_bytes+i>943718.4){const e=this.Xt;if(this.Rt=this.en(),this.Xt!==e)return;s&&this.Rt.data.length>0&&(this.Rt=this.nn()),this.Rt.sessionId=n,this.Rt.windowId=t.$window_id}this.ge&&(this.be||this.Rt.size+t.$snapshot_bytes+i>943718.4)?this.be||(this.be=!0,this.Rt=this.nn()):(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.de||this.ge||this.Jn())}bi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Je(){var t,e;const i=null===(t=this.Rt)||void 0===t?void 0:t.data[(null===(e=this.Rt)||void 0===e?void 0:e.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}si(){if(!this.Rt||0===this.Rt.data.length)return this.nn();let t=-1;for(let e=this.Rt.data.length-1;e>=0;e--)if(4===this.Rt.data[e].type){t=e;break}return 0>t?this.nn():(this.Rt.data=this.Rt.data.slice(t),this.Rt.sizes=this.Rt.sizes.slice(t),this.Rt.size=this.Rt.sizes.reduce((t,e)=>t+e,0),this.Rt)}nn(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.He},this.Rt}qt(t,e){this._instance.register_for_session({[Zt]:t}),fu.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",he({reason:t},e))}wi(t){var e;return 3===t.type&&-1!==pu.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}ai(t){const e=this.wi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.$n),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.le,threshold:this.te,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.He}),this.en());const{windowId:i,sessionId:n}=this.Yt.checkAndGetSessionAndWindowId(!e,t.timestamp);let s=!1;if(e&&(this.le=t.timestamp,this.de)){const e="unknown"===this.de;this.de=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),s=!0)}const r=this.Xt!==n,o=this.He!==i;if(this.He=i,this.Xt=n,r||o){const t=r&&!1!==this.de;t&&(this.de="unknown"),this.We(t)}else if(e&&this.En(),s){var a;const t=["sampled","active"].includes(this.status)||(null===(a=this.re)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this.he>0&&t&&this.jt(),this.Sn(),this.Rn()}}Ue(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e,i,n,s,r,o,a,l,u,h,c,d,v;const f=null===(t=mu())||void 0===t||null===(e=t.getDeferredStylesheetStats)||void 0===e?void 0:e.call(t);return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.Wn,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_current_session_duration:this.Je,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(i=this.ze)||void 0===i?void 0:i.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Re,$snapshot_max_depth_exceeded:this.Se,$sdk_debug_replay_slowest_full_snapshot_ms:du(null===(n=this.Zn)||void 0===n?void 0:n.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:du(null===(s=this.Zn)||void 0===s?void 0:s.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(r=this.Zn)||void 0===r?void 0:r.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this.Zn)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(a=this.Zn)||void 0===a?void 0:a.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==f?void 0:f.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==f?void 0:f.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==f?void 0:f.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:du(null==f?void 0:f.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:du(null==f?void 0:f.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:du(null===(l=mu())||void 0===l||null===(u=l.getMutationCost)||void 0===u||null===(u=u.call(l))||void 0===u?void 0:u.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null===(h=mu())||void 0===h||null===(c=h.getDiscardedDurationSamples)||void 0===c?void 0:c.call(h),$sdk_debug_replay_throttled_mutations_dropped:this.fe,$sdk_debug_replay_oversized_mutations_dropped:this.ve,$sdk_debug_replay_oversized_mutation_bytes_dropped:this.pe,$sdk_debug_replay_unstringifiable_events_dropped:this.me,$sdk_debug_replay_rrweb_error:this.ke,$sdk_debug_replay_observer_init_failures:null===(d=mu())||void 0===d||null===(v=d.getObserverInitFailures)||void 0===v?void 0:v.call(d),[Vt]:!!this.se,[Gt]:this._e}}Nn(){var e;if(this.se)return;this._e=!0;const i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},s=this._instance.config.session_recording;for(const[t,e]of Object.entries(s||{}))if(t in i)if("maskInputOptions"===t)i.maskInputOptions=he({password:!0},e);else if("sampling"===t){const t=null!=e?e:{},n={};Ie(t.mousemove)||(n.mousemove=t.mousemove),Ie(t.mouseInteraction)||(n.mouseInteraction=t.mouseInteraction),i.sampling=n}else i[t]=e;var r,o,a,l;!0===(null==s?void 0:s.captureJsonLd)&&!0!==i.slimDOMOptions&&"all"!==i.slimDOMOptions&&(i.slimDOMOptions=he(he({},i.slimDOMOptions),{},{script:!0})),this.fn&&this.fn.enabled&&(i.recordCanvas=!0,i.sampling=he(he({},i.sampling),{},{canvas:this.fn.fps}),i.dataURLOptions={type:"image/webp",quality:this.fn.quality},i.canvasResolutionScale=this.hn,i.canvasMasking={configured:()=>{var t;return Ce(null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn)},regionsFn:t=>{var e;const i=null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn;if(Ce(i))try{var n;return null!==(n=i(t))&&void 0!==n?n:null}catch(t){return this.Ie||(this.Ie=!0,fu.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.cn&&(i.maskAllInputs=null===(r=this.cn.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this.cn.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(a=this.cn.blockSelector)&&void 0!==a?a:void 0,i.maskAllElementAttributes=null!==(l=this.cn.maskAllElementAttributes)&&void 0!==l&&l),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this.Me||(this.Me=!0,fu.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this.dn();const u=yu();if(!u)return void fu.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.zn=null!==(e=this.zn)&&void 0!==e?e:new xa(u,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{const i=`Too many mutations on node '${t}'. Rate limiting. This could be due to SVG animations or something similar`;fu.info(i,{node:e}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:t=>this.fe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.Tn,onDroppedOversizedMutation:t=>{0===this.ve&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.ve+=1,this.pe+=t},requestFullSnapshot:()=>this.jt()});const h=this.mn();if(this.se=u(he({emit:t=>{this.onRRwebEmit(t)},plugins:h,errorHandler:(t,e)=>"rrweb"===e&&(this.Te||(this.Te=!0,fu.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},i)),!this.se)return this.ke=!0,void fu.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.ke=!1,!0===(null==s?void 0:s.captureJsonLd)&&n&&(null==t?void 0:t.MutationObserver)&&!this.xn&&(this.xn=function(t,e,i){const n=new WeakMap,s=i.getCaptureState||(()=>!0);let r=Hl;const o=function(t,e){const i=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?Wl:i=>{const n=t.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!e.isRecordedElement||e.isRecordedElement(n))&&!hu(n,e.blockClass,e.blockSelector)}}(t,i),a=e=>{try{const a=s();if(!r||!1===a||!e.isConnected||e.ownerDocument!==t||function(t,e){return hu(t,e.blockClass,e.blockSelector)||hu(t,e.maskTextClass,e.maskTextSelector)}(e,i))return;const l=function(t,e=Wl,i){if(!t||t.length>Hl)return null;try{const n=JSON.parse(t),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=xe(n)?n.map(t=>au(t,e,s)):au(n,e,s);if(s.exceeded||Pe(r)||xe(r)&&(!r.length||r.some(Pe)))return null;const o=JSON.stringify(r);return o.length>2e4?null:[r,o]}catch(t){return null}}(e.text,o,i.maskUrl);if(!l)return void n.delete(e);const[u,h]=l;if(Pe(a))return void n.set(e,h);if(n.get(e)!==h){if(h.length>r)return void(r=0);i.emit(u)&&(n.set(e,h),r-=h.length)}}catch(t){return}};try{const i=new e(t=>{try{if(!r||!1===s())return;const e=t=>{for(const e of cu(t))a(e)};for(const i of t)if("childList"===i.type)lu(i.target)&&a(i.target),i.addedNodes.forEach(e);else if("characterData"===i.type){const t=i.target.parentNode;t&&lu(t)&&a(t)}else"attributes"===i.type&&lu(i.target)&&a(i.target)}catch(t){return}});return i.observe(t,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(e=!1){r&&!1!==s()&&cu(t.documentElement).forEach(t=>{e&&n.delete(t),a(t)})},stop(){return i.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(n,t.MutationObserver,{maskUrl:t=>this.yn(t),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:t=>u.mirror.getId(t)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var t;return!0!==(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)||this.Y.urlBlocked||this.Y.isCurrentUrlBlocked()?null:this.kn()},emit:t=>this._n(t)}),this.Y.isCurrentUrlBlocked()&&this.xn.scan()),this.le=Date.now(),this.de=Oe(this.de)?this.de:"unknown",this.tryAddCustomEvent("$remote_config_received",this.ne),this.Vt("$session_options",{sessionRecordingOptions:i,activePlugins:h.map(t=>null==t?void 0:t.name)}),this.Vt("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(t,e){return this.Vt(t,e)}};const Bu=["type"];var Hu=function(t){return t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t}({}),zu=function(t){return t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t}({}),Uu=function(t){return t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t}({}),Wu=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),Vu=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),Gu=function(t){return t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t}({}),Zu=function(t){return t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t}({});function Qu(t,e){return-1!==t.indexOf(e)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var Ju={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Ku={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Xu={};function Yu(t){if(Xu[t])return Xu[t];const e=function(t){var e,i;const n=null===(e=globalThis)||void 0===e||null===(e=e.Zone)||void 0===e||null===(i=e.__symbol__)||void 0===i?void 0:i.call(e,t);return n&&globalThis[n]?globalThis[n]:void 0}(t)||globalThis[t],i=e.prototype,n=t in Ju?Ju[t]:void 0,s=Boolean(n&&n.every(t=>{var e;return Boolean(null===(e=Object.getOwnPropertyDescriptor(i,t))||void 0===e||null===(e=e.get)||void 0===e?void 0:e.toString().includes("[native code]"))})),r=t in Ku?Ku[t]:void 0,o=Boolean(r&&r.every(t=>{var e;return"function"==typeof i[t]&&(null===(e=i[t])||void 0===e?void 0:e.toString().includes("[native code]"))}));if(s&&o)return Xu[t]=e.prototype,e.prototype;const a=document.createElement("iframe");a.style.display="none";let l=!1;try{document.body.appendChild(a);const n=a.contentWindow;if(!n)return e.prototype;const s=n[t].prototype;return s?(function(t){return Qu(t,"AppleWebKit")&&!Qu(t,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",t),l=!0),Xu[t]=s):i}catch(t){return i}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var th=Object.create(null);function eh(t,e,i){var n;const s=th[t],r=s[i];if(r)return r.call(e);const o=Yu(t),a=null===(n=Object.getOwnPropertyDescriptor(o,i))||void 0===n?void 0:n.get;return a?(s[i]=a,a.call(e)):e[i]}th.Node=Object.create(null),th.ShadowRoot=Object.create(null),th.MutationObserver=Object.create(null),th.Element=Object.create(null);var ih,nh={};function sh(t,e,i){const n=`${t}.${String(i)}`;if(nh[n])return nh[n].bind(e);const s=Yu(t)[i];return"function"!=typeof s?e[i]:(nh[n]=s,s.bind(e))}function rh(){return Yu("MutationObserver").constructor}function oh(t,e,i){try{if(!(e in t))return()=>{};const n=t[e],s={next:n},r=i(function(...t){return s.next.apply(this,t)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:n},__rrweb_layer__:{enumerable:!1,value:s}})),t[e]=r,()=>{if(t[e]===r)return void(t[e]=s.next);const i=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let n=t[e],o=i(n);for(;o;){if(o.next===r)return void(o.next=s.next);n=o.next,o=i(n)}}}catch(t){return()=>{}}}var ah={childNodes:t=>eh("Node",t,"childNodes"),parentNode:t=>eh("Node",t,"parentNode"),parentElement:t=>eh("Node",t,"parentElement"),textContent:t=>eh("Node",t,"textContent"),isConnected(t){if(void 0===ih){var e;const t=null===(e=Object.getOwnPropertyDescriptor(Yu("Node"),"isConnected"))||void 0===e?void 0:e.get;ih=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==ih?void 0:ih.call(t)},contains:(t,e)=>sh("Node",t,"contains")(e),getRootNode:t=>sh("Node",t,"getRootNode")(),host:t=>t&&"host"in t?eh("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?eh("Element",t,"shadowRoot"):null,querySelector:(t,e)=>sh("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>sh("Element",t,"querySelectorAll")(e),mutationObserver:rh,patch:oh};function lh(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var uh=0;function hh(){uh+=1}function ch(){return uh}function dh(t,e){return(e!==uh||t>6e4)&&!0}var vh=0,fh=0,ph=0,gh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},mh=null,yh=null,bh=[],_h=0,wh=0,kh={slowestBatchMs:0},Sh={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function xh(t){(vh+=1)>1||(gh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},bh=[],_h=0,yh=(t=>t&&t>0?t:null)(t),fh=lh(),ph=uh)}function Ch(){return 0===vh?mh||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(vh-=1)>0?gh:(gh.durationMs=lh()-fh,gh.deferredStylesheetCount=_h,Sh.deferredCount+=_h,yh=null,dh(gh.durationMs,ph)?gh:mh=gh)}function $h(t,e,i){let n=t.length;if(i>=32)return n;for(let s=0;t.length>s;s++){const r=t[s];try{const t=r.cssRules;if(t&&t.length)n+=$h(t,e,i+1);else if(e&&r.styleSheet){const t=r.styleSheet;if(!e.has(t)){e.add(t);const s=t.rules||t.cssRules;s&&(n+=$h(s,e,i+1))}}}catch(t){}}return n}function Th(t){if(0===vh)return;const e=$h(t,null,0);gh.cssRuleCount+=e,wh>0&&(gh.nonDeferrableCssRuleCount+=e)}function Ih(t){wh+=1;try{return t()}finally{wh-=1}}function Mh(t){vh>0&&(gh.stylesheetMs+=t)}function Eh(t){if(0===vh||null===yh)return!1;const e=gh.cssRuleCount-gh.nonDeferrableCssRuleCount;return e>=yh||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const i=new WeakSet;return i.add(t),$h(e,i,0)}catch(t){return 0}}(t)>yh}function Ph(){const t=bh;return bh=[],t}function Rh(){Sh.failedCount+=1}function Ah(t){t>0&&(Sh.abandonedCount+=t)}function Fh(t){return Fh="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},Fh(t)}function Oh(t,e,i){return(e=function(t){var e=function(t){if("object"!=Fh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Fh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fh(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Dh(t){return t.nodeType===t.ELEMENT_NODE}function Lh(t){const e=t&&"host"in t&&"mode"in t&&ah.host(t)||null;return Boolean(e&&"shadowRoot"in e&&ah.shadowRoot(e)===t)}function Nh(t){return"[object ShadowRoot]"==={}.toString.call(t)}function qh(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function jh(t){const{cssText:e}=t;if(3>e.split('"').length)return e;const i=["@import",`url(${JSON.stringify(t.href)})`];return""===t.layerName?i.push("layer"):t.layerName&&i.push(`layer(${t.layerName})`),t.supportsText&&i.push(`supports(${t.supportsText})`),t.media.length&&i.push(t.media.mediaText),i.join(" ")+";"}var Bh=0;function Hh(t){const e=0===Bh,i=e?lh():0;Bh+=1;try{const e=t.rules||t.cssRules;if(!e)return null;Th(e);let i=t.href;return!i&&t.ownerNode&&(i=t.ownerNode.baseURI),qh(Array.from(e,t=>zh(t,i)).join(""))}catch(t){return null}finally{Bh-=1,e&&Mh(lh()-i)}}function zh(t,e){if(Wh(t)){let e;try{e=Hh(t.styleSheet)||jh(t)}catch(i){e=t.cssText}try{var i;if(e&&(null===(i=t.styleSheet)||void 0===i?void 0:i.href))return ac(e,t.styleSheet.href)}catch(t){}return e}{let i=t.cssText;return Vh(t)&&t.selectorText.includes(":")&&(i=Uh(i)),e?ac(i,e):i}}function Uh(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Wh(t){return"styleSheet"in t}function Vh(t){return"selectorText"in t}var Gh=/^-?[A-Za-z_][\w-]*$/,Zh=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Qh(t){const e=[];let i=!1,n=null;const s=new Map;function r(t){const s=e.pop();if("group"===s.kind){if(null===t){for(;e.length>0&&"group"===e[e.length-1].kind;)e.pop();return void r(null)}const i=e[e.length-1];return i.parts.push(t),void(i.index+=1)}if(!s.importRule)return i=!0,void(n=t);o(e[e.length-1],s.importRule,t)}function o(t,e,i){try{let s;try{s=i||jh(e)}catch(t){s=e.cssText}try{var n;s&&(null===(n=e.styleSheet)||void 0===n?void 0:n.href)&&(s=ac(s,e.styleSheet.href))}catch(t){}s&&t.parts.push(s),t.index+=1}catch(t){r(null)}}function a(t){const i=t.rules[t.index];if("sheet"===t.kind&&Wh(i)){const n=s.get(i);return null===n?(t.parts.push(i.cssText),void(t.index+=1)):n?void e.push({kind:"sheet",sheet:n.sheet,rules:n.rules,sheetHref:n.sheetHref,index:0,parts:[],importRule:i}):void o(t,i,null)}if(function(t,i){try{const n=function(t){const e=t;if(!e.cssRules||0===e.cssRules.length)return null;if(e.media&&"string"==typeof e.media.mediaText)return`@media ${e.media.mediaText} {`;if(Vh(t)){if("number"==typeof e.type&&1!==e.type)return null;const i=e.style?e.style.cssText:"";return`${t.selectorText} {${i?" "+i:""}`}if("containerName"in e)return"string"!=typeof e.containerQuery||e.containerName&&!Gh.test(e.containerName)?null:`@container ${e.containerName?`${e.containerName} `:""}${e.containerQuery} {`;if("string"==typeof e.conditionText){let n="";try{var i;n=(null===(i=t.constructor)||void 0===i?void 0:i.name)||""}catch(t){return null}return""===n||"Object"===n||"CSSSupportsRule"===n?`@supports ${e.conditionText} {`:null}return"string"==typeof e.name?"keyText"in e.cssRules[0]?Gh.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":Zh.test(e.name)?`@layer ${e.name} {`:null:null}(t);if(null===n)return!1;const s=i.sheetHref;return e.push({kind:"group",rules:Array.from(t.cssRules),sheetHref:s,index:0,parts:[],prelude:s?ac(n,s):n,fixColons:"sheet"===i.kind&&Vh(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(i,t))return;let n=i.cssText;"sheet"===t.kind&&Vh(i)&&i.selectorText.includes(":")&&(n=Uh(n)),t.parts.push(t.sheetHref?ac(n,t.sheetHref):n),t.index+=1}return function(t){try{const i=t.rules||t.cssRules;if(!i)return!1;Th(i);let n=t.href;!n&&t.ownerNode&&(n=t.ownerNode.baseURI);const r=Array.from(i);return e.push({kind:"sheet",sheet:t,rules:r,sheetHref:n,index:0,parts:[],importRule:null}),function(t,e){const i=[{sheet:e,rules:t,index:0}];for(;i.length>0;){const t=i[i.length-1];if(t.index>=t.rules.length){i.pop();continue}const e=t.rules[t.index];if(t.index+=1,!Wh(e)||s.has(e))continue;let n=null;try{n=e.styleSheet}catch(t){s.set(e,null);continue}if(n&&!i.some(t=>t.sheet===n))try{const t=n.rules||n.cssRules;if(!t)continue;Th(t);let r=n.href;!r&&n.ownerNode&&(r=n.ownerNode.baseURI);const o=Array.from(t);s.set(e,{sheet:n,rules:o,sheetHref:r}),i.push({sheet:n,rules:o,index:0})}catch(t){}}}(r,t),!0}catch(t){return!1}}(t)||(i=!0),{advance(t){if(i)return!0;const s=lh();let o=t>0?t:1;try{for(;!i&&o>0;){const t=e[e.length-1];if(t.index>=t.rules.length){let e=null;try{if("group"===t.kind){const i=t.prelude+t.parts.join("")+"}";e=t.fixColons?Uh(i):i}else e=qh(t.parts.join(""))}catch(t){}r(e);continue}o-=1;try{a(t)}catch(t){r(null)}}}catch(t){i=!0,n=null}finally{Mh(lh()-s)}return i},text:()=>i?n:null,remainingRules(){if(i)return 0;let t=0;for(const i of e)t+=i.rules.length-i.index;return t}}}var Jh=class{constructor(){Oh(this,"idNodeMap",new Map),Oh(this,"nodeMetaMap",new WeakMap)}getId(t){var e,i;return t&&null!==(e=null===(i=this.getMeta(t))||void 0===i?void 0:i.id)&&void 0!==e?e:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach(t=>this.removeNodeFromMap(t)),Dh(t)){const e=ah.shadowRoot(t);e&&this.removeNodeFromMap(e),"IFRAME"===t.nodeName&&t.contentDocument&&this.removeNodeFromMap(t.contentDocument)}}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){this.idNodeMap.set(e.id,t),this.nodeMetaMap.set(t,e)}replace(t,e){const i=this.getNode(t);if(i){const t=this.nodeMetaMap.get(i);t&&this.nodeMetaMap.set(e,t)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Kh({element:t,maskInputOptions:e,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const a=n&&Xh(n);return(e[i.toLowerCase()]||a&&e[a])&&(o=r?r(o,t):"*".repeat(o.length)),o}function Xh(t){return t.toLowerCase()}var Yh=new Set(["rr_width","rr_height","rr_left","rr_top","rr_position","rr_transform","rr_display","rr_scrollleft","rr_scrolltop","rr_mediastate","rr_open_mode"]);function tc({element:t,name:e,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Yh.has(Xh(e))?i:"*".repeat(i.length):s?s(e,i,t):i:i}var ec="__rrweb_original__";function ic(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Xh(e):null}catch(t){return null}}var nc=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,sc=/^(?:[a-z+]+:)?\/\//i,rc=/^www\..*/i,oc=/^(data:)([^,]*),(.*)/i;function ac(t,e){return(t||"").replace(nc,(t,i,n,s,r,o)=>{const a=n||r||o,l=i||s||"";if(!a)return t;if(sc.test(a)||rc.test(a))return`url(${l}${a}${l})`;if(oc.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(t){let e="";return e=t.indexOf("//")>-1?t.split("/").slice(0,3).join("/"):t.split("/")[0],e=e.split("?")[0],e}(e)+a}${l})`;const u=e.split("/"),h=a.split("/");u.pop();for(const t of h)"."!==t&&(".."===t?u.pop():u.push(t));return`url(${l}${u.join("/")}${l})`})}var lc,uc,hc=new Map,cc=1,dc=new RegExp("[^a-z0-9-_:]");function vc(){return cc++}var fc=!1,pc=/^[^ \t\n\r\u000c]+/,gc=/^[, \t\n\r\u000c]+/,mc=new WeakMap;function yc(t,e){return e&&""!==e.trim()?bc(t,e):e}function bc(t,e){let i=mc.get(t);if(i||(i=t.createElement("a"),mc.set(t,i)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return i.setAttribute("href",e),i.href}function _c(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":t}(t,e.maxBase64ImageLength):t}function wc(t,e,i,n,s,r){if(!n)return n;if("src"===i||"href"===i&&("use"!==e||"#"!==n[0])){if("link"===e&&s){var o;const t=null===(o=s.sheet)||void 0===o?void 0:o.href;if(t)return t}const i=yc(t,n);if(i.startsWith("data:")){if("img"===e&&s){let t=i;return((null==r?void 0:r.type)||void 0!==(null==r?void 0:r.quality))&&(t=function(t,e,i,n){if(1e5>e.length)return e;if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>4096||t.naturalHeight>4096)return e;const s=hc.get(e);if(s&&s.type===i&&s.quality===n)return s.result;try{const s=document.createElement("canvas");s.width=t.naturalWidth,s.height=t.naturalHeight;const r=s.getContext("2d");if(!r)return e;r.drawImage(t,0,0);const o=s.toDataURL(i||"image/webp",null!=n?n:.4),a=e.length>o.length?o:e;if(hc.size>=10){const t=hc.keys().next().value;void 0!==t&&hc.delete(t)}return hc.set(e,{type:i,quality:n,result:a}),a}catch(t){return e}}(s,i,r.type,r.quality)),_c(t,r)}if("image"===e)return _c(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=yc(t,n);return"image"===e&&i.startsWith("data:")?_c(i,r):i}return"background"!==i||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===i?function(t,e){if(""===e.trim())return e;let i=0;function n(t){let n;const s=t.exec(e.substring(i));return s?(n=s[0],i+=n.length,n):""}const s=[];for(;n(gc),e.length>i;){let r=n(pc);if(","===r.slice(-1))r=yc(t,r.substring(0,r.length-1)),s.push(r);else{let n="";r=yc(t,r);let o=!1;for(;;){const t=e.charAt(i);if(""===t){s.push((r+n).trim());break}if(o)")"===t&&(o=!1);else{if(","===t){i+=1,s.push((r+n).trim());break}"("===t&&(o=!0)}n+=t,i+=1}}}return s.join(", ")}(t,n):"style"===i?ac(n,bc(t)):"object"===e&&"data"===i?yc(t,n):n:yc(t,n)}function kc(t,e,i){return("video"===t||"audio"===t)&&"autoplay"===Xh(e)}function Sc(t){return"string"==typeof t&&Xh(t).split(/\s+/).includes("stylesheet")}function xc(t,e,i){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!i&&xc(ah.parentNode(t),e,i);for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!i&&xc(ah.parentNode(t),e,i)}function Cc(t,e,i,n){let s;if(Dh(t)){if(s=t,!ah.childNodes(s).length)return!1}else{if(null===ah.parentElement(t))return!1;s=ah.parentElement(t)}try{if("string"==typeof e){if(n){if(s.closest(`.${e}`))return!0}else if(s.classList.contains(e))return!0}else if(xc(s,e,n))return!0;if(i)if(n){if(s.closest(i))return!0}else if(s.matches(i))return!0}catch(t){}return!1}function $c(t,e,i){const n=t.removeEventListener;"function"==typeof n&&n.call(t,e,i)}var Tc=new Map;function Ic(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function Mc(t){return null==t?"":t.toLowerCase()}var Ec=!1,Pc=!1;function Rc(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:h={},maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g={},inlineImages:m=!1,recordCanvas:y=!1,canvasMaskingConfigured:b,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k=5e3,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:I=!1,depth:M=0,maxDepth:E=50}=e;let{needsMask:P}=e,{preserveWhiteSpace:R=!0}=e;if(M>=E)return Pc=!0,Ec||(Ec=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${E}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;P||(P=Cc(t,o,a,void 0===P)),vh>0&&(gh.nodeCount+=1);const A=function(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:h,maskAllElementAttributes:c=!1,maskAttributeFn:d,dataURLOptions:v={},inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y=!1}=e,b=function(t,e){if(!e.hasNode(t))return;const i=e.getId(t);return 1===i?void 0:i}(i,n);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:Zu.Document,childNodes:[],compatMode:t.compatMode}:{type:Zu.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:Zu.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:b};case t.ELEMENT_NODE:return function(t,e){const{doc:i,blockClass:n,blockSelector:s,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:a,maskAllElementAttributes:l=!1,maskAttributeFn:u,dataURLOptions:h={},inlineImages:c,recordCanvas:d,canvasMaskingConfigured:v,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:g}=e,m=function(t,e,i){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(i)return t.matches(i)}catch(t){}return!1}(t,n,s),y=function(t){if(t instanceof HTMLFormElement)return"form";const e=Xh(t.tagName);return dc.test(e)?"div":e}(t),b=new Set;let _={};const w=t.attributes.length;for(let e=0;w>e;e++){const n=t.attributes[e];kc(y,n.name)||(_[n.name]=wc(i,y,Xh(n.name),n.value,t,h))}if("link"===y&&r&&!m&&Sc(_.rel)){let e=t.sheet;if(!e){const n=function(t){return t.href}(t);n&&(e=Ic(i,n),!e&&n.includes(".css"))&&(e=Ic(i,window.location.origin+"/"+n.replace(window.location.href,"")))}let n=null;e&&(Eh(e)?vh>0&&(bh.push(t),_h+=1):n=Hh(e)),n&&(delete _.rel,delete _.href,_._cssText=n)}var k;if("style"===y&&t.sheet&&!(t.innerText||ah.textContent(t)||"").trim().length){const e=Ih(()=>Hh(t.sheet));e&&(_._cssText=e)}if("input"===y||"textarea"===y||"select"===y){const e=t.value,i=t.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&e?_.value=Kh({element:t,type:ic(t),tagName:y,value:e,maskInputOptions:o,maskInputFn:a}):i&&(_.checked=i)}if("option"===y&&(t.selected&&!o.select?_.selected=!0:delete _.selected),"dialog"===y&&t.open){try{_.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){_.rr_open_mode="modal",_.ph_rr_could_not_detect_modal=!0}b.add("rr_open_mode")}if("canvas"===y&&d&&!(null==v?void 0:v()))try{if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let i=0;t.width>i;i+=50)for(let n=0;t.height>n;n+=50){const s=e.getImageData,r=ec in s?s[ec]:s;let o;try{o=r.call(e,i,n,Math.min(50,t.width-i),Math.min(50,t.height-n))}catch(t){return!1}if(new Uint32Array(o.data.buffer).some(t=>0!==t))return!1}return!0})(t)||(_.rr_dataURL=t.toDataURL(h.type,h.quality));else if(!("__context"in t)){const e=t.toDataURL(h.type,h.quality),n=i.createElement("canvas");n.width=t.width,n.height=t.height,e!==n.toDataURL(h.type,h.quality)&&(_.rr_dataURL=e)}}catch(t){"SecurityError"===(null==(k=t)?void 0:k.name)?fc||(fc=!0,console.warn("Cannot read canvas pixels, so this canvas is left out of the recording. A cross-origin image or video drawn into it taints it.",k)):console.warn("Cannot read canvas pixels, so this canvas is left out of the recording.",k)}let S,x=!1;if("img"===y&&c){lc||(lc=i.createElement("canvas"),uc=lc.getContext("2d"));const e=t,n=e.currentSrc||e.getAttribute("src")||"<unknown-src>",s=e.crossOrigin,r=(e,i)=>x?tc({element:t,name:e,value:i,maskAllElementAttributes:l,maskAttributeFn:u}):i,o=()=>{$c(e,"load",o);try{lc.width=e.naturalWidth,lc.height=e.naturalHeight,uc.drawImage(e,0,0);const t=lc.toDataURL(h.type,h.quality);_.rr_dataURL=r("rr_dataURL",t)}catch(t){if("anonymous"!==e.crossOrigin)return e.crossOrigin="anonymous",void(e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(s?_.crossOrigin=r("crossOrigin",s):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===y||"video"===y){const e=_;e.rr_mediaState=t.paused?"paused":"played",b.add("rr_mediaState"),e.rr_mediaCurrentTime=t.currentTime,e.rr_mediaPlaybackRate=t.playbackRate,e.rr_mediaMuted=t.muted,e.rr_mediaLoop=t.loop,e.rr_mediaVolume=t.volume}if(p||(t.scrollLeft&&(_.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(_.rr_scrollTop=t.scrollTop)),m){var C,T,I;const{width:e,height:n,left:s,top:r}=t.getBoundingClientRect(),o=null===(C=i.defaultView)||void 0===C?void 0:C.getComputedStyle(t);_={class:_.class,rr_width:`${e}px`,rr_height:`${n}px`,rr_left:`${Math.floor(s+((null===(T=i.defaultView)||void 0===T?void 0:T.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(I=i.defaultView)||void 0===I?void 0:I.scrollY)||0))}px`},b.add("rr_width"),b.add("rr_height"),b.add("rr_left"),b.add("rr_top"),o&&(_.rr_position=o.position||"static",b.add("rr_position"),o.transform&&"none"!==o.transform&&(_.rr_transform=o.transform,b.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(_.rr_display=o.display,b.add("rr_display")))}if("iframe"!==y||f(_.src)||(t.contentDocument||(_.rr_src=_.src),delete _.src),l||u)for(const[e,i]of Object.entries(_))"string"!=typeof i&&null!==i||(_[e]=tc({element:t,name:e,value:i,maskAllElementAttributes:l,maskAttributeFn:u,isGenerated:b.has(e)}));x=!0;try{customElements.get(y)&&(S=!0)}catch(t){}return{type:Zu.Element,tagName:y,attributes:_,childNodes:[],isSVG:(M=t,Boolean("svg"===M.tagName||M.ownerSVGElement)||void 0),needBlock:m,rootId:g,isCustom:S};var M}(t,{doc:i,blockClass:s,blockSelector:r,inlineStylesheet:a,maskInputOptions:l,maskInputFn:h,maskAllElementAttributes:c,maskAttributeFn:d,dataURLOptions:v,inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y,rootId:b});case t.TEXT_NODE:return function(t,e){const{needsMask:i,maskTextFn:n,rootId:s}=e,r=ah.parentNode(t),o=r&&r.tagName;let a=ah.textContent(t);const l="STYLE"===o||void 0,u="SCRIPT"===o||void 0;if(l&&a){try{var h;if(t.nextSibling||t.previousSibling);else if(Eh(r.sheet));else if(null===(h=r.sheet)||void 0===h?void 0:h.cssRules){const t=Hh(r.sheet);t&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(t)&&(a=t)}}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}a=ac(a,bc(e.doc))}return u&&(a="SCRIPT_PLACEHOLDER"),!l&&!u&&a&&i&&(a=n?n(a,ah.parentElement(t)):a.replace(/[\S]/g,"*")),{type:Zu.Text,textContent:a||"",isStyle:l,rootId:s}}(t,{doc:i,needsMask:o,maskTextFn:u,rootId:b});case t.CDATA_SECTION_NODE:return{type:Zu.CDATA,textContent:"",rootId:b};case t.COMMENT_NODE:return{type:Zu.Comment,textContent:ah.textContent(t)||"",rootId:b};default:return!1}}(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,keepIframeSrcFn:T,newlyAddedElement:I});if(!A)return console.warn(t,"not serialized"),null;let F;F=n.hasNode(t)?n.getId(t):function(t,e){if(e.comment&&t.type===Zu.Comment)return!0;if(t.type===Zu.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel&&"script"===t.attributes.as||"modulepreload"===t.attributes.rel)||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===function(t){var e;let i;try{i=new URL(t,window.location.href)}catch(t){return null}const n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(e=null==n?void 0:n[1])&&void 0!==e?e:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(Mc(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Mc(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Mc(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Mc(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Mc(t.attributes.property).match(/^(og|twitter|fb):/)||Mc(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Mc(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Mc(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(Mc(t.attributes.name))||Mc(t.attributes.property).match(/^article:/)||Mc(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(Mc(t.attributes.name)))return!0}}return!1}(A,p)||!R&&A.type===Zu.Text&&!A.isStyle&&!A.textContent.replace(/^\s+|\s+$/gm,"").length?-2:vc();const O=Object.assign(A,{id:F});if(n.add(t,O),-2===F)return null;_&&_(t);let D=!l;if(O.type===Zu.Element){D=D&&!O.needBlock,delete O.needBlock;const e=ah.shadowRoot(t);e&&Nh(e)&&(O.isShadowHost=!0)}if((O.type===Zu.Document||O.type===Zu.Element)&&D){p.headWhitespace&&O.type===Zu.Element&&"head"===O.tagName&&(R=!1);const e={doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:M+1,maxDepth:E};if(O.type===Zu.Element&&"textarea"===O.tagName&&void 0!==O.attributes.value);else for(const i of Array.from(ah.childNodes(t))){const t=Rc(i,e);t&&O.childNodes.push(t)}let I=null;if(Dh(t)&&(I=ah.shadowRoot(t)))for(const t of Array.from(ah.childNodes(I))){const i=Rc(t,e);i&&(Nh(I)&&(i.isShadow=!0),O.childNodes.push(i))}}const L=ah.parentNode(t);if(L&&Lh(L)&&Nh(L)&&(O.isShadow=!0),O.type===Zu.Element&&"iframe"===O.tagName){const e=function(t,e,i){const n=()=>{},s=t.contentWindow;if(!s)return n;let r;try{r=s.document.readyState}catch(t){return n}const o=()=>e();if("complete"!==r){let n=!1,s=null;const r=()=>{n||(n=!0,null!==s&&(clearTimeout(s),s=null),$c(t,"load",a),t.addEventListener("load",o),e())},a=()=>r();return s=setTimeout(r,i),t.addEventListener("load",a),()=>{null!==s&&(clearTimeout(s),s=null),n?$c(t,"load",o):(n=!0,$c(t,"load",a))}}const a="about:blank";let l;try{l=s.location.href}catch(t){return n}if(l!==a||t.src===a||""===t.src){const i=setTimeout(e,0);return t.addEventListener("load",o),()=>{clearTimeout(i),$c(t,"load",o)}}return t.addEventListener("load",o),()=>{$c(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&w){const i=Rc(e,{doc:e,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:M+1,maxDepth:E});i&&w(t,i)}},k);null==S||S(t,e)}return O.type===Zu.Element&&"link"===O.tagName&&Sc(O.attributes.rel)&&function(e,l,S){if(Tc.has(e))return;let I;try{I=e.sheet}catch(t){return}if(I)return;const A=new AbortController;let F=!1;const O=()=>{if(!F){F=!0;try{(()=>{if(x){const e=Rc(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:M,maxDepth:E});e&&x(t,e)}})()}finally{Tc.delete(e),A.abort()}}},D=setTimeout(O,S);A.signal.addEventListener("abort",()=>clearTimeout(D),{once:!0}),e.addEventListener("load",O,{signal:A.signal,once:!0}),Tc.set(e,A)}(t,0,C),O}function Ac(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}var Fc=class t{constructor(...t){Oh(this,"parentElement",null),Oh(this,"parentNode",null),Oh(this,"ownerDocument",void 0),Oh(this,"firstChild",null),Oh(this,"lastChild",null),Oh(this,"previousSibling",null),Oh(this,"nextSibling",null),Oh(this,"ELEMENT_NODE",1),Oh(this,"TEXT_NODE",3),Oh(this,"nodeType",void 0),Oh(this,"nodeName",void 0),Oh(this,"RRNodeType",void 0)}get childNodes(){const t=[];let e=this.firstChild;for(;e;)t.push(e),e=e.nextSibling;return t}contains(e){if(!(e instanceof t))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,e){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function Oc(t,e,i=document){const n={capture:!0,passive:!0};return i.addEventListener(t,e,n),()=>Dc(i,t,e,n)}function Dc(t,e,i,n){Lc(()=>{const s=t.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(t,e,i,n):s.call(t,e,i))})}function Lc(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function Nc(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var qc="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",jc={map:{},getId(){return console.warn(qc),-1},getNode(){return console.warn(qc),null},removeNodeFromMap(){console.warn(qc)},has(){return console.warn(qc),!1},reset(){console.warn(qc)}};function Bc(t,e,i={}){let n=null,s=0;return function(...r){const o=Date.now();s||!1!==i.leading||(s=o);const a=e-(o-s),l=this;0>=a||a>e?(n&&(clearTimeout(n),n=null),s=o,t.apply(l,r)):n||!1===i.trailing||(n=setTimeout(()=>{s=!1===i.leading?0:Date.now(),n=null,t.apply(l,r)},a))}}function Hc(t,e,i,n,s=window){const r=s.Object.getOwnPropertyDescriptor(t,e),o=()=>Hc(t,e,r||{},!0);if(n)return s.Object.defineProperty(t,e,i),o;const a=function(t){let e="function"==typeof t.setTimeout?t.setTimeout:void 0;try{var i,n;const s=null===(i=t.Zone)||void 0===i||null===(n=i.__symbol__)||void 0===n?void 0:n.call(i,"setTimeout"),r=s?t[s]:void 0;"function"==typeof r&&(e=r)}catch(t){}if(!e)return()=>{};const s=e;return e=>{try{s.call(t,e,0)}catch(t){}}}(s);return s.Object.defineProperty(t,e,{set(t){if(a(()=>{try{i.set.call(this,t)}catch(t){}}),r&&r.set){if(r.get)try{r.get.call(this)}catch(t){return}r.set.call(this,t)}}}),o}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(jc=new Proxy(jc,{get(t,e,i){return"map"===e&&console.warn(qc),Reflect.get(t,e,i)}}));var zc=Date.now;function Uc(t){var e,i,n,s;const r=t.document;return{left:r.scrollingElement?r.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:r.documentElement.scrollLeft||(null==r?void 0:r.body)&&(null===(e=ah.parentElement(r.body))||void 0===e?void 0:e.scrollLeft)||(null==r||null===(i=r.body)||void 0===i?void 0:i.scrollLeft)||0,top:r.scrollingElement?r.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==r?void 0:r.documentElement.scrollTop)||(null==r?void 0:r.body)&&(null===(n=ah.parentElement(r.body))||void 0===n?void 0:n.scrollTop)||(null==r||null===(s=r.body)||void 0===s?void 0:s.scrollTop)||0}}function Wc(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Vc(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Gc(t){return t?t.nodeType===t.ELEMENT_NODE?t:ah.parentElement(t):null}function Zc(t,e,i,n){if(!t)return!1;const s=Gc(t);if(!s)return!1;try{if("string"==typeof e){if(s.classList.contains(e))return!0;if(n&&null!==s.closest("."+e))return!0}else if(xc(s,e,n))return!0}catch(t){}if(i){if(s.matches(i))return!0;if(n&&null!==s.closest(i))return!0}return!1}function Qc(t,e,i){return!("TITLE"!==t.tagName||!i.headTitleMutations)||-2===e.getId(t)}function Jc(t,e){if(Lh(t))return!1;const i=e.getId(t);if(!e.has(i))return!0;const n=ah.parentNode(t);return(!n||n.nodeType!==t.DOCUMENT_NODE)&&(!n||Jc(n,e))}function Kc(t){return Boolean(t.changedTouches)}function Xc(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Yc(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function td(t){return!!t&&(t instanceof Fc&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(ah.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(zc=()=>(new Date).getTime());var ed=class{constructor(){Oh(this,"id",1),Oh(this,"styleIDMap",new WeakMap),Oh(this,"idStyleMap",new Map)}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){if(this.has(t))return this.getId(t);let i;return i=void 0===e?this.id++:e,this.styleIDMap.set(t,i),this.idStyleMap.set(i,t),i}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function id(t){var e;let i=null;return"getRootNode"in t&&(null===(e=ah.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&ah.host(ah.getRootNode(t))&&(i=ah.host(ah.getRootNode(t))),i}function nd(t){const e=t.ownerDocument;if(!e)return!1;if(ah.contains(e,t))return!0;const i=ah.isConnected(t);return"boolean"==typeof i?i:function(t){const e=t.ownerDocument;if(!e)return!1;const i=function(t){let e,i=t;for(;e=id(i);)i=e;return i}(t);return ah.contains(e,i)}(t)}function sd(t){return"__ln"in t}var rd,od=class{constructor(){Oh(this,"length",0),Oh(this,"head",null),Oh(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let e=this.head;for(let i=0;t>i;i++)e=(null==e?void 0:e.next)||null;return e}addNode(t){const e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&sd(t.previousSibling)){const i=t.previousSibling.__ln.next;e.next=i,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,i&&(i.previous=e)}else if(t.nextSibling&&sd(t.nextSibling)&&t.nextSibling.__ln.previous){const i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){const e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},ad=(t,e)=>`${t}@${e}`,ld=class{constructor(){Oh(this,"frozen",!1),Oh(this,"locked",!1),Oh(this,"texts",[]),Oh(this,"attributes",[]),Oh(this,"attributeMap",new WeakMap),Oh(this,"generatedAttributes",new WeakMap),Oh(this,"removes",[]),Oh(this,"mapRemoves",new Set),Oh(this,"movedMap",{}),Oh(this,"addedSet",new Set),Oh(this,"movedSet",new Set),Oh(this,"droppedSet",new Set),Oh(this,"removesSubTreeCache",new Set),Oh(this,"mutationCb",void 0),Oh(this,"blockClass",void 0),Oh(this,"blockSelector",void 0),Oh(this,"maskTextClass",void 0),Oh(this,"maskTextSelector",void 0),Oh(this,"inlineStylesheet",void 0),Oh(this,"maskInputOptions",void 0),Oh(this,"maskTextFn",void 0),Oh(this,"maskInputFn",void 0),Oh(this,"maskAllElementAttributes",void 0),Oh(this,"maskAttributeFn",void 0),Oh(this,"keepIframeSrcFn",void 0),Oh(this,"recordCanvas",void 0),Oh(this,"canvasMaskingConfigured",void 0),Oh(this,"inlineImages",void 0),Oh(this,"slimDOMOptions",void 0),Oh(this,"dataURLOptions",void 0),Oh(this,"doc",void 0),Oh(this,"mirror",void 0),Oh(this,"iframeManager",void 0),Oh(this,"stylesheetManager",void 0),Oh(this,"shadowDomManager",void 0),Oh(this,"canvasManager",void 0),Oh(this,"processedNodeManager",void 0),Oh(this,"unattachedDoc",void 0),Oh(this,"canvasManagerReleased",!1),Oh(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),Oh(this,"emit",()=>{if(this.frozen||this.locked)return;const t=lh(),e=ch();try{this.processBufferedMutations()}finally{i=lh()-t,n=e,vh>0||dh(i,null!=n?n:uh)||i>kh.slowestBatchMs&&(kh.slowestBatchMs=i)}var i,n}),Oh(this,"processBufferedMutations",()=>{const t=[],e=new Set,i=new od,n=t=>{let e=t,i=-2;for(;-2===i;)e=e&&e.nextSibling,i=e&&this.mirror.getId(e);return i};let s;const r=r=>{var o;const a=ah.parentNode(r);if(!a||!nd(r)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=Lh(a)?this.mirror.getId(id(r)):this.mirror.getId(a),u=n(r);if(-1===l||-1===u)return i.addNode(r);null!==(o=s)&&void 0!==o||(s={doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:t=>{Xc(t,this.mirror)&&this.iframeManager.addIframe(t),Yc(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),td(t)&&!Zc(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(ah.shadowRoot(t),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});const h=Rc(r,s);h&&(t.push({parentId:l,nextId:u,node:h}),e.add(h.id))};for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t);for(const t of this.movedSet)hd(this.removesSubTreeCache,t)&&!this.movedSet.has(ah.parentNode(t))||r(t);for(const t of this.addedSet)cd(this.droppedSet,t)||hd(this.removesSubTreeCache,t)?cd(this.movedSet,t)?r(t):this.droppedSet.add(t):r(t);let o=null;for(;i.length;){let t=null;if(o){const e=this.mirror.getId(ah.parentNode(o.value)),i=n(o.value);-1!==e&&-1!==i&&(t=o)}if(!t){let e=i.tail;for(;e;){const i=e;if(e=e.previous,i){const e=this.mirror.getId(ah.parentNode(i.value));if(-1===n(i.value))continue;if(-1!==e){t=i;break}{const e=ah.parentNode(i.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=ah.host(e);if(-1!==this.mirror.getId(n)){t=i;break}}}}}}if(!t){for(;i.head;)i.removeNode(i.head.value);break}o=t.previous,i.removeNode(t.value),r(t.value)}const a={texts:this.texts.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const e=t.node,i=ah.parentNode(e);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(e),value:t.value}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),attributes:this.attributes.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const{attributes:e}=t;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof e.style){const i=JSON.stringify(t.styleDiff),n=JSON.stringify(t._unchangedStyles);e.style.length>i.length&&(i+n).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[n,s]of Object.entries(e))if("string"==typeof s||null===s){var i;e[n]=tc({element:t.node,name:n,value:s,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(t.node))||void 0===i?void 0:i.has(n)})}return{id:this.mirror.getId(t.node),attributes:e}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),removes:this.removes,adds:t};this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&this.mutationCb(a)}),Oh(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),Oh(this,"genTextAreaValueMutation",t=>{let e=this.attributeMap.get(t);e||(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(e),this.attributeMap.set(t,e));const i=Array.from(ah.childNodes(t),t=>ah.textContent(t)||"").join("");e.attributes.value=Kh({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:ic(t),value:i,maskInputFn:this.maskInputFn})}),Oh(this,"processMutation",t=>{if(!Qc(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=ah.textContent(t.target);Zc(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:Cc(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,Gc(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const n=t.target,s=Xh(n.tagName),r=t.attributeName,o=null!==(e=t.attributeNamespace)&&void 0!==e?e:null;let a=function(t,e,i){if(!i)return e;const n=t.getAttributeNodeNS(i,e);if(n)return n.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${e}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${e}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===e?e:`xmlns:${e}`;const s=t.lookupPrefix(i);return s?`${s}:${e}`:e}(n,r,o),l=o?n.getAttributeNS(o,r):t.target.getAttribute(r);if("value"===a){const t=n,e=ic(t);l=Kh({element:t,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:l,maskInputFn:this.maskInputFn})}if(Zc(t.target,this.blockClass,this.blockSelector,!1)||l===t.oldValue)return;let u=this.attributeMap.get(t.target);const h="iframe"===s&&"src"===a;if(h&&!this.keepIframeSrcFn(l)&&n.contentDocument)return;if("type"===a&&"input"===s&&"password"===(t.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!kc(s,a)){var i;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=wc(this.doc,s,Xh(a),l,n,this.dataURLOptions);if(h&&!this.keepIframeSrcFn(l)&&(a="rr_src"),u.attributes[a]=e,null===(i=this.generatedAttributes.get(t.target))||void 0===i||i.delete(a),"style"===a){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const e=this.unattachedDoc.createElement("span"),i=n.style;t.oldValue&&(e.style.cssText=t.oldValue);for(const t of Array.from(i)){const n=i.getPropertyValue(t),s=i.getPropertyPriority(t);n!==e.style.getPropertyValue(t)||s!==e.style.getPropertyPriority(t)?u.styleDiff[t]=""===s?n:[n,s]:u._unchangedStyles[t]=[n,s]}for(const t of Array.from(e.style))""===i.getPropertyValue(t)&&(u.styleDiff[t]=!1)}else if("open"===a&&"dialog"===s){u.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";let e=this.generatedAttributes.get(t.target);e||(e=new Set,this.generatedAttributes.set(t.target,e)),e.add("rr_open_mode")}}break}case"childList":if(Zc(t.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach(e=>this.genAdds(e,t.target)),t.removedNodes.forEach(e=>{const i=this.mirror.getId(e),n=Lh(t.target)?this.mirror.getId(ah.host(t.target)):this.mirror.getId(t.target);Zc(t.target,this.blockClass,this.blockSelector,!1)||Qc(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(ud(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===i||Jc(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[ad(i,n)]?ud(this.movedSet,e):(this.removes.push({parentId:n,id:i,isShadow:!(!Lh(t.target)||!Nh(t.target))||void 0}),function(t,e){const i=[t];for(;i.length;){const t=i.pop();e.has(t)||(e.add(t),ah.childNodes(t).forEach(t=>i.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),Oh(this,"genAdds",(t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)){if(this.addedSet.has(t))return this.addedSet.delete(t),void this.addedSet.add(t);if(!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(Qc(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let i=null;e&&this.mirror.hasNode(e)&&(i=this.mirror.getId(e)),i&&-1!==i&&(this.movedMap[ad(this.mirror.getId(t),i)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!Zc(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=ah.childNodes(t);for(let t=0,i=e.length;i>t;t++){const i=e[t];i&&this.genAdds(i)}if(td(t)){const e=ah.childNodes(ah.shadowRoot(t));for(let i=0,n=e.length;n>i;i++){const n=e[i];n&&(this.processedNodeManager.add(n,this),this.genAdds(n,t))}}}}}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(e=>{this[e]=t[e]}),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t)}isBlockedAtEmission(t){const e=this.blockClass,i=e&&"string"!=typeof e&&(e.global||e.sticky)?new RegExp(e):null;for(;t;){if(i&&(i.lastIndex=0),Zc(t,i||e,this.blockSelector,!0))return!0;const n="getRootNode"in t?ah.getRootNode(t):null;t=(null==n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?ah.host(n):null}return!1}};function ud(t,e){const i=[e];for(;i.length;){const e=i.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const n=ah.childNodes(e);for(let t=0,e=n.length;e>t;t++){const e=n[t];e&&i.push(e)}}}function hd(t,e,i){return 0!==t.size&&function(t,e){const i=ah.parentNode(e);return!!i&&t.has(i)}(t,e)}function cd(t,e){if(0===t.size)return!1;let i=ah.parentNode(e);for(;i;){if(t.has(i))return!0;i=ah.parentNode(i)}return!1}function dd(t){rd=t}function vd(){rd=void 0}var fd=(t,e="rrweb")=>rd?(...i)=>{try{return t(...i)}catch(t){if(rd&&!0===rd(t,e))return;throw t}}:t,pd=[];function gd(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(t){}return t&&t.target}function md(t,e){const i=new ld;let n;i.init(t);try{n=new(rh())(fd(i.processMutations.bind(i)));const s={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(s.attributeFilter=t.attributeFilter),n.observe(e,s),pd.push(i),{observer:n,buffer:i}}catch(t){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(t){}throw t}}function yd({scrollCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,a=r=>{const a=gd(r);if(!a||Zc(a,n,s,!0))return;const l=i.getId(a);let u,h;if(a===e&&e.defaultView){const t=Uc(e.defaultView);u=t.left,h=t.top}else u=a.scrollLeft,h=a.scrollTop;const c=`${u},${h}`;o.get(l)!==c&&(o.set(l,c),t({id:l,x:u,y:h}))},l=[Oc("scroll",fd(Bc(fd(t=>a(t)),r.scroll||100)),e)];return"onscrollend"in e&&l.push(Oc("scrollend",fd(a),e)),()=>l.forEach(t=>t())}function bd(t,e){for(let i=pd.length-1;i>=0;i--){const n=pd[i];if(!n)continue;let s=n.bufferBelongsToIframe(t);!s&&e&&e.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),pd.splice(i,1))}}var _d=["INPUT","TEXTAREA","SELECT"],wd=new WeakMap;function kd(t){return function t(e,i){if(Td("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Td("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Td("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Td("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);return i.unshift(n),t(e.parentRule,i)}if(e.parentStyleSheet){const t=Array.from(e.parentStyleSheet.cssRules).indexOf(e);i.unshift(t)}return i}(t,[])}function Sd(t,e,i){let n,s;return t?(t.ownerNode?n=e.getId(t.ownerNode):s=i.getId(t),{styleId:s,id:n}):{}}function xd({mirror:t,stylesheetManager:e},i){var n,s;let r=null;r=t.getId("#document"===i.nodeName?i:ah.host(i));const o="#document"===i.nodeName?null===(n=i.defaultView)||void 0===n?void 0:n.Document:null===(s=i.ownerDocument)||void 0===s||null===(s=s.defaultView)||void 0===s?void 0:s.ShadowRoot,a=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==r&&-1!==r&&o&&a?(Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var t;return null===(t=a.get)||void 0===t?void 0:t.call(this)},set(t){let i;try{var n;i=null===(n=a.set)||void 0===n?void 0:n.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==r&&-1!==r)try{e.adoptStyleSheets(t,r)}catch(t){}return i}}),fd(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}var Cd=new Set;function $d(t,e={}){const i=t.doc.defaultView;if(!i)return()=>{};let n,s;!function(t,e){const{mutationCb:i,mousemoveCb:n,mouseInteractionCb:s,scrollCb:r,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:h,canvasMutationCb:c,fontCb:d,selectionCb:v,customElementCb:f}=t;t.mutationCb=(...t)=>{e.mutation&&e.mutation(...t),i(...t)},t.mousemoveCb=(...t)=>{e.mousemove&&e.mousemove(...t),n(...t)},t.mouseInteractionCb=(...t)=>{e.mouseInteraction&&e.mouseInteraction(...t),s(...t)},t.scrollCb=(...t)=>{e.scroll&&e.scroll(...t),r(...t)},t.viewportResizeCb=(...t)=>{e.viewportResize&&e.viewportResize(...t),o(...t)},t.inputCb=(...t)=>{e.input&&e.input(...t),a(...t)},t.mediaInteractionCb=(...t)=>{e.mediaInteaction&&e.mediaInteaction(...t),l(...t)},t.styleSheetRuleCb=(...t)=>{e.styleSheetRule&&e.styleSheetRule(...t),u(...t)},t.styleDeclarationCb=(...t)=>{e.styleDeclaration&&e.styleDeclaration(...t),h(...t)},t.canvasMutationCb=(...t)=>{e.canvasMutation&&e.canvasMutation(...t),c(...t)},t.fontCb=(...t)=>{e.font&&e.font(...t),d(...t)},t.selectionCb=(...t)=>{e.selection&&e.selection(...t),v(...t)},t.customElementCb=(...t)=>{e.customElement&&e.customElement(...t),f(...t)}}(t,e);const r=[],o=fd(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=pd.indexOf(s);-1!==t&&pd.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==n||n.disconnect()}finally{Nc(r)}}),a=(t,e)=>{const i=fd(()=>{try{return e()}catch(e){throw Cd.add(t),e}})();"function"==typeof i&&r.push(i)};try{if(t.recordDOM&&a("mutation",()=>{const e=md(t,t.doc);n=e.observer,s=e.buffer}),a("move",()=>function({mousemoveCb:t,sampling:e,doc:i,mirror:n}){if(!1===e.mousemove)return()=>{};const s="number"==typeof e.mousemove?e.mousemove:50,r="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let o,a=[];const l=Bc(fd(e=>{const i=Date.now()-o;t(a.map(t=>(t.timeOffset-=i,t)),e),a=[],o=null}),r),u=fd(Bc(fd(t=>{const e=gd(t),{clientX:i,clientY:s}=Kc(t)?t.changedTouches[0]:t;o||(o=zc()),a.push({x:i,y:s,id:n.getId(e),timeOffset:zc()-o}),l("undefined"!=typeof DragEvent&&t instanceof DragEvent?zu.Drag:t instanceof MouseEvent?zu.MouseMove:zu.TouchMove)}),s,{trailing:!1})),h=[Oc("mousemove",u,i),Oc("touchmove",u,i),Oc("drag",u,i)];return fd(()=>{h.forEach(t=>t())})}(t)),a("mouseInteraction",()=>function({mouseInteractionCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){if(!1===r.mouseInteraction)return()=>{};const o=!0===r.mouseInteraction||void 0===r.mouseInteraction?{}:r.mouseInteraction,a=[];let l=null;return Object.keys(Uu).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(r=>{let o=Xh(r);const u=(e=>r=>{const o=gd(r);if(Zc(o,n,s,!0))return;let a=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":a=Wu.Mouse;break;case"touch":a=Wu.Touch;break;case"pen":a=Wu.Pen}a===Wu.Touch&&(Uu[e]===Uu.MouseDown?u="TouchStart":Uu[e]===Uu.MouseUp&&(u="TouchEnd"))}else Kc(r)&&(a=Wu.Touch);null!==a?(l=a,(u.startsWith("Touch")&&a===Wu.Touch||u.startsWith("Mouse")&&a===Wu.Mouse)&&(a=null)):Uu[e]===Uu.Click&&(a=l,l=null);const h=Kc(r)?r.changedTouches[0]:r;if(!h)return;const c=i.getId(o),{clientX:d,clientY:v}=h;fd(t)(he({type:Uu[u],id:c,x:d,y:v},null!==a&&{pointerType:a}))})(r);if(window.PointerEvent)switch(Uu[r]){case Uu.MouseDown:case Uu.MouseUp:o=o.replace("mouse","pointer");break;case Uu.TouchStart:case Uu.TouchEnd:return}a.push(Oc(o,u,e))}),fd(()=>{a.forEach(t=>t())})}(t)),a("scroll",()=>yd(t)),a("viewportResize",()=>function({viewportResizeCb:t},{win:e}){let i=-1,n=-1;return Oc("resize",fd(Bc(fd(()=>{const e=Wc(),s=Vc();i===e&&n===s||(t({width:Number(s),height:Number(e)}),i=e,n=s)}),200)),e)}(t,{win:i})),a("input",()=>function({inputCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,ignoreClass:r,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:u,userTriggeredOnInput:h}){function c(t){let i=gd(t);const u=t.isTrusted,c=e.defaultView;if(i&&c&&!(i instanceof c.HTMLElement))return;const v=i&&i.tagName;if(i&&"OPTION"===v&&(i=ah.parentElement(i)),!i||!v||0>_d.indexOf(v)||Zc(i,n,s,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let f=i.value,p=!1;const g=ic(i)||"";"radio"===g||"checkbox"===g?p=i.checked:(a[v.toLowerCase()]||a[g])&&(f=Kh({element:i,maskInputOptions:a,tagName:v,type:g,value:f,maskInputFn:l})),d(i,h?{text:f,isChecked:p,userTriggered:u}:{text:f,isChecked:p});const m=i.name;"radio"===g&&m&&p&&e.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach(t=>{if(t!==i){const e=t.value;d(t,h?{text:e,isChecked:!p,userTriggered:!1}:{text:e,isChecked:!p})}})}function d(e,n){const s=wd.get(e);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){wd.set(e,n);const s=i.getId(e);fd(t)(he(he({},n),{},{id:s}))}}const v=("last"===u.input?["change"]:["input","change"]).map(t=>Oc(t,fd(c),e)),f=e.defaultView;if(!f)return()=>{v.forEach(t=>t())};const p=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value");return p&&p.set&&v.push(...[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]].map(t=>Hc(t[0],t[1],{set(){fd(c)({target:this,isTrusted:!1})}},!1,f))),fd(()=>{Nc(v)})}(t)),a("mediaInteraction",()=>function({mediaInteractionCb:t,blockClass:e,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=fd(r=>Bc(fd(s=>{const o=gd(s);if(!o||Zc(o,e,i,!0))return;const{currentTime:a,volume:l,muted:u,playbackRate:h,loop:c}=o;t({type:r,id:n.getId(o),currentTime:a,volume:l,muted:u,playbackRate:h,loop:c})}),s.media||500)),a=[Oc("play",o(Gu.Play),r),Oc("pause",o(Gu.Pause),r),Oc("seeked",o(Gu.Seeked),r),Oc("volumechange",o(Gu.VolumeChange),r),Oc("ratechange",o(Gu.RateChange),r)];return fd(()=>{a.forEach(t=>t())})}(t)),t.recordDOM){const e=function(t){const e=new Map,i=new Set;let n=!0;const s=t=>{if(n)try{t()}catch(t){}},r=t=>{var i;const n=e.get(t);if(n){for(;null===(i=n[0])||void 0===i?void 0:i.ready;){const t=n.shift();(null==t?void 0:t.emit)&&s(t.emit)}0===n.length&&e.delete(t)}};return{queueMutation(t,i){if(!t)return void s(i);const n=e.get(t);n?(n.push({emit:i,ready:!0}),r(t)):s(i)},queuePendingMutation(o,a,l){if(!n)return()=>{};let u=e.get(o);u||(u=[],e.set(o,u));const h={emit:a,ready:!1};u.push(h);let c,d=!1,v=!1;const f=()=>{d||v||(d=!0,void 0!==c&&i.delete(c),h.ready=!0,h.emit=void 0,r(o))};try{c=t.setTimeout(f,5e3),d||v?t.clearTimeout(c):i.add(c)}catch(t){f()}return e=>{!v&&n&&(v=!0,void 0!==c&&(t.clearTimeout(c),i.delete(c)),d?e&&s(l):(h.ready=!0,e||(h.emit=void 0),r(o)))}},reset(){n=!1,i.forEach(e=>t.clearTimeout(e)),i.clear(),e.clear()}}}(i);r.push(e.reset),a("styleSheet",()=>function({styleSheetRuleCb:t,mirror:e,stylesheetManager:i},{win:n,mutationQueue:s}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:fd((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=Sd(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,adds:[{rule:a,index:l}]})),l},"host")}),n.CSSStyleSheet.prototype.addRule=function(t,e,i=this.cssRules.length){return n.CSSStyleSheet.prototype.insertRule.apply(this,[`${t} { ${e} }`,i])};const o=n.CSSStyleSheet.prototype.deleteRule;let a,l;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:fd((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=Sd(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,removes:[{index:a}]})),l},"host")}),n.CSSStyleSheet.prototype.removeRule=function(t){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:fd((n,r,o)=>{const[a]=o,l=n.apply(r,o);try{const n=null==l?void 0:l.then;if(r.ownerNode||!l||"function"!=typeof n)return l;i.onCssomSheetMutation(r);const{id:o,styleId:u}=Sd(r,e,i.styleMirror);if(!(o&&-1!==o||u&&-1!==u))return l;const h=s.queuePendingMutation(r,()=>t({id:o,styleId:u,replace:a}),()=>{const e=Hh(r);null!==e&&t({id:o,styleId:u,replace:e})});try{n.call(l,()=>h(!0),()=>h(!1))}catch(t){h(!1)}}catch(t){}return l},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(l=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:fd((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=Sd(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,replaceSync:a})),l},"host")}));const u={};Id("CSSGroupingRule")?u.CSSGroupingRule=n.CSSGroupingRule:(Id("CSSMediaRule")&&(u.CSSMediaRule=n.CSSMediaRule),Id("CSSConditionRule")&&(u.CSSConditionRule=n.CSSConditionRule),Id("CSSSupportsRule")&&(u.CSSSupportsRule=n.CSSSupportsRule));const h={};return Object.entries(u).forEach(([n,r])=>{h[n]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(h[n].insertRule,{apply:fd((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=Sd(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...kd(r),l];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,adds:[{rule:a,index:e}]}))}return l},"host")}),r.prototype.deleteRule=new Proxy(h[n].deleteRule,{apply:fd((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=Sd(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...kd(r),a];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,removes:[{index:e}]}))}return l},"host")})}),fd(()=>{n.CSSStyleSheet.prototype.insertRule=r,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),l&&(n.CSSStyleSheet.prototype.replaceSync=l),Object.entries(u).forEach(([t,e])=>{e.prototype.insertRule=h[t].insertRule,e.prototype.deleteRule=h[t].deleteRule})})}(t,{win:i,mutationQueue:e})),a("adoptedStyleSheet",()=>xd(t,t.doc)),a("styleDeclaration",()=>function({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:i,stylesheetManager:n},{win:s,mutationQueue:r}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:fd((s,o,a)=>{var l;const[u,h,c]=a,d=s.apply(o,a);if(i.has(u))return d;const v=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(v);const{id:f,styleId:p}=Sd(v,e,n.styleMirror);if(f&&-1!==f||p&&-1!==p){const e=kd(o.parentRule);r.queueMutation(v,()=>t({id:f,styleId:p,set:{property:u,value:h,priority:c},index:e}))}return d},"host")});const a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:fd((s,o,a)=>{var l;const[u]=a,h=s.apply(o,a);if(i.has(u))return h;const c=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(c);const{id:d,styleId:v}=Sd(c,e,n.styleMirror);if(d&&-1!==d||v&&-1!==v){const e=kd(o.parentRule);r.queueMutation(c,()=>t({id:d,styleId:v,remove:{property:u},index:e}))}return h},"host")}),fd(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a})}(t,{win:i,mutationQueue:e})),t.collectFonts&&a("font",()=>function({fontCb:t,doc:e}){const i=e.defaultView;if(!i)return()=>{};const n=[],s=new WeakMap,r=i.FontFace;i.FontFace=function(t,e,i){const n=new r(t,e,i);return s.set(n,{family:t,buffer:"string"!=typeof e,descriptors:i,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),n};const o=oh(e.fonts,"add",function(e){return function(i){return setTimeout(fd(()=>{const e=s.get(i);e&&(t(e),s.delete(i))}),0),e.apply(this,[i])}});return n.push(()=>{i.FontFace=r}),n.push(o),fd(()=>{n.forEach(t=>t())})}(t))}a("selection",()=>function(t){const{doc:e,mirror:i,blockClass:n,blockSelector:s,selectionCb:r}=t;let o=!0;const a=fd(()=>{const t=e.getSelection();if(!t||o&&(null==t?void 0:t.isCollapsed))return;o=t.isCollapsed||!1;const a=[],l=t.rangeCount||0;for(let e=0;l>e;e++){const{startContainer:r,startOffset:o,endContainer:l,endOffset:u}=t.getRangeAt(e);Zc(r,n,s,!0)||Zc(l,n,s,!0)||a.push({start:i.getId(r),startOffset:o,end:i.getId(l),endOffset:u})}r({ranges:a})});return a(),Oc("selectionchange",a)}(t)),a("customElement",()=>function({doc:t,customElementCb:e}){const i=t.defaultView;return i&&i.customElements?oh(i.customElements,"define",function(t){return function(i,n,s){try{e({define:{name:i}})}catch(t){console.warn(`Custom element callback failed for ${i}`)}return t.apply(this,[i,n,s])}}):()=>{}}(t));for(const e of t.plugins)a(`plugin:${e.name}`,()=>e.observer(e.callback,i,e.options))}catch(t){try{o()}catch(t){}throw t}return o}function Td(t){return void 0!==window[t]}function Id(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var Md=class{constructor(t){Oh(this,"generateIdFn",void 0),Oh(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Oh(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,i,n){if(0>e)return e;const s=i||this.getRemoteIdToLocalIdMap(t),r=n||this.getLocalIdToRemoteIdMap(t);let o=s.get(e);return void 0===o&&(o=this.generateIdFn(),s.set(e,o),r.set(o,e)),o}getIds(t,e){const i=this.getRemoteIdToLocalIdMap(t),n=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getId(t,e,i,n))}getRemoteId(t,e,i){var n;return"number"!=typeof e||0>e?e:null!==(n=(i||this.getLocalIdToRemoteIdMap(t)).get(e))&&void 0!==n?n:-1}getRemoteIds(t,e){const i=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getRemoteId(t,e,i))}reset(t){if(!t)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(t),this.iframeLocalIdToRemoteIdMap.delete(t)}getRemoteIdToLocalIdMap(t){let e=this.iframeRemoteIdToLocalIdMap.get(t);return e||(e=new Map,this.iframeRemoteIdToLocalIdMap.set(t,e)),e}getLocalIdToRemoteIdMap(t){let e=this.iframeLocalIdToRemoteIdMap.get(t);return e||(e=new Map,this.iframeLocalIdToRemoteIdMap.set(t,e)),e}},Ed=class{constructor(t){Oh(this,"iframes",new WeakMap),Oh(this,"crossOriginIframeMap",new WeakMap),Oh(this,"crossOriginIframeMirror",new Md(vc)),Oh(this,"crossOriginIframeStyleMirror",void 0),Oh(this,"crossOriginIframeRootIdMap",new WeakMap),Oh(this,"mirror",void 0),Oh(this,"mutationCb",void 0),Oh(this,"wrappedEmit",void 0),Oh(this,"loadListener",void 0),Oh(this,"pageHideListener",void 0),Oh(this,"stylesheetManager",void 0),Oh(this,"recordCrossOriginIframes",void 0),Oh(this,"messageHandler",void 0),Oh(this,"nestedIframeListeners",new Map),Oh(this,"attachedWindows",new WeakMap),Oh(this,"attachedDocuments",new WeakMap),Oh(this,"attachedIframes",new Map),Oh(this,"loadListenerDisposers",new WeakMap),Oh(this,"iframeElementsById",new Map),Oh(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Md(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){let i=this.loadListenerDisposers.get(t);i||(i=new Set,this.loadListenerDisposers.set(t,i)),i.add(e);const n=this.mirror.getId(t);-1!==n&&this.iframeElementsById.set(n,t)}getIframeElementById(t){var e,i,n;return null!==(e=null!==(i=null===(n=this.attachedIframes.get(t))||void 0===n?void 0:n.element)&&void 0!==i?i:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){const e=this.loadListenerDisposers.get(t);e&&(e.forEach(t=>Lc(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{Dc(t,"pagehide",e)}),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){const i=this.mirror.getId(t);return this.attachedIframes.set(i,{element:t,content:e}),i}attachIframe(t,e){var i;const n=this.trackIframeContent(t,e);if(t.contentDocument){let e=this.attachedDocuments.get(t);e||(e=new Set,this.attachedDocuments.set(t,e)),e.add(t.contentDocument)}this.mutationCb({adds:[{parentId:n,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const s=t.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){const e=this.handleMessage.bind(this);Lc(()=>{s.addEventListener("message",e),this.nestedIframeListeners.set(s,e);let i=this.attachedWindows.get(t);i||(i=new Set,this.attachedWindows.set(t,i)),i.add(s)})}Lc(()=>{const e=t.contentWindow;if(!e)return;let i=this.pageHideHandlers.get(t);if(i)for(const t of i)if(t.win===e)return;const n=()=>{var e;null===(e=this.pageHideListener)||void 0===e||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument)};e.addEventListener("pagehide",n),i||(i=new Set,this.pageHideHandlers.set(t,i)),i.add({win:e,handler:n})}),null===(i=this.loadListener)||void 0===i||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const e=t;if("rrweb"!==e.data.type||e.origin!==e.data.origin)return;if(!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const n=this.transformCrossOriginEvent(i,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}transformCrossOriginEvent(t,e){switch(e.type){case Hu.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);const i=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(e.data.node,i),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:Hu.IncrementalSnapshot,data:{source:zu.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Hu.Meta:case Hu.Load:case Hu.DomContentLoaded:return!1;case Hu.Plugin:return e;case Hu.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case Hu.IncrementalSnapshot:switch(e.data.source){case zu.Mutation:return e.data.adds.forEach(e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);const i=this.crossOriginIframeRootIdMap.get(t);i&&this.patchRootIdOnNode(e.node,i)}),e.data.removes.forEach(e=>{this.replaceIds(e,t,["parentId","id"])}),e.data.attributes.forEach(e=>{this.replaceIds(e,t,["id"])}),e.data.texts.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case zu.Drag:case zu.TouchMove:case zu.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case zu.ViewportResize:return!1;case zu.MediaInteraction:case zu.MouseInteraction:case zu.Scroll:case zu.CanvasMutation:case zu.Input:return this.replaceIds(e.data,t,["id"]),e;case zu.StyleSheetRule:case zu.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case zu.Font:return e;case zu.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case zu.AdoptedStyleSheet:var i;return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null===(i=e.data.styles)||void 0===i||i.forEach(e=>{this.replaceStyleIds(e,t,["styleId"])}),e}}return!1}replace(t,e,i,n){for(const s of n)(Array.isArray(e[s])||"number"==typeof e[s])&&(e[s]=Array.isArray(e[s])?t.getIds(i,e[s]):t.getId(i,e[s]));return e}replaceIds(t,e,i){return this.replace(this.crossOriginIframeMirror,t,e,i)}replaceStyleIds(t,e,i){return this.replace(this.crossOriginIframeStyleMirror,t,e,i)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(t=>{this.replaceIdOnNode(t,e)})}patchRootIdOnNode(t,e){t.type===Zu.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach(t=>{this.patchRootIdOnNode(t,e)})}removeIframeById(t){const e=this.attachedIframes.get(t),i=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),i){const t=i.contentWindow,e=this.attachedWindows.get(i);e&&(e.forEach(t=>{const e=this.nestedIframeListeners.get(t);e&&(Dc(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(i)),t&&this.nestedIframeListeners.has(t)&&(Dc(t,"message",this.nestedIframeListeners.get(t)),this.nestedIframeListeners.delete(t)),t&&this.crossOriginIframeMap.delete(t),this.iframes.delete(i),this.disposeLoadListeners(i),this.removePageHideListener(i);const n=this.attachedDocuments.get(i);n&&(n.forEach(t=>{Lc(()=>this.mirror.removeNodeFromMap(t))}),Lc(()=>bd(i,n)),this.attachedDocuments.delete(i))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const t=[];this.attachedIframes.forEach((e,i)=>{this.mirror.has(i)||t.push(i)}),t.forEach(t=>this.removeIframeById(t))}reattachIframes(){this.attachedIframes.forEach(({content:t},e)=>{this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)})}destroy(){this.recordCrossOriginIframes&&Dc(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{Dc(e,"message",t)}),this.nestedIframeListeners.clear();const t=new Set;this.iframeElementsById.forEach(e=>t.add(e)),this.attachedIframes.forEach(({element:e})=>t.add(e)),t.forEach(t=>{this.disposeLoadListeners(t),this.removePageHideListener(t)}),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}},Pd=class{constructor(t){Oh(this,"shadowDoms",new WeakSet),Oh(this,"mutationCb",void 0),Oh(this,"scrollCb",void 0),Oh(this,"bypassOptions",void 0),Oh(this,"mirror",void 0),Oh(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,e){var i,n;if(!Nh(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(i=null===(n=ah.host(t))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:e,{observer:r,buffer:o}=md(he(he({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push({doc:s,handler(){r.disconnect(),o.destroy(),o.releaseCanvasManager();const t=pd.indexOf(o);-1!==t&&pd.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:yd(he(he({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))}),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(ah.host(t))),this.restoreHandlers.push({doc:s,handler:xd({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})},0)}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){const i=this;this.restoreHandlers.push({doc:e,handler:oh(t.prototype,"attachShadow",function(t){return function(n){const s=t.call(this,n),r=ah.shadowRoot(this);return r&&nd(this)&&i.addShadowRoot(r,e),s}})})}reset(){this.restoreHandlers.forEach(({handler:t})=>{try{t()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){const e=[];for(const i of this.restoreHandlers)if(i.doc===t)try{i.handler()}catch(t){}else e.push(i);this.restoreHandlers=e}},Rd="skip-frame";function Ad(t){if("object"!=typeof t||null===t)return!1;const{x:e,y:i,width:n,height:s}=t;return Number.isFinite(e)&&Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(s)&&n>=0&&s>=0}for(var Fd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Od="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Dd=0;64>Dd;Dd++)Od[Fd.charCodeAt(Dd)]=Dd;var Ld=function(t){var e,i=new Uint8Array(t),n=i.length,s="";for(e=0;n>e;e+=3)s+=Fd[i[e]>>2],s+=Fd[(3&i[e])<<4|i[e+1]>>4],s+=Fd[(15&i[e+1])<<2|i[e+2]>>6],s+=Fd[63&i[e+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s},Nd=!1,qd=new Map,jd=(t,e,i)=>{if(!t||!zd(t,e)&&"object"!=typeof t)return;const n=function(t,e){let i=qd.get(t);return i||(i=new Map,qd.set(t,i)),i.has(e)||i.set(e,[]),i.get(e)}(i,t.constructor.name);let s=n.indexOf(t);return-1===s&&(s=n.length,n.push(t)),s};function Bd(t,e,i,n){if(t instanceof Array)return t.map(t=>Bd(t,e,i,n));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer)return{rr_type:t.constructor.name,base64:Ld(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Bd(t.buffer,e,i,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const e=t.constructor.name,{src:i}=t;return{rr_type:e,src:i}}if(t instanceof HTMLCanvasElement){const e="HTMLImageElement";let i;try{i=t.toDataURL(n.type,n.quality)}catch(t){throw function(t){"SecurityError"===(null==t?void 0:t.name)?Nd||(Nd=!0,console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read. A cross-origin image or video drawn into it taints it.",t)):console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read.",t)}(t),t}return{rr_type:e,src:i}}return t instanceof ImageData?{rr_type:t.constructor.name,args:[Bd(t.data,e,i,n),t.width,t.height]}:zd(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:jd(t,e,i)}:t}var Hd=(t,e,i,n)=>t.map(t=>Bd(t,e,i,n)),zd=(t,e)=>{const i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(t=>"function"==typeof e[t]);return Boolean(i.find(i=>t instanceof e[i]))},Ud=["webgl","webgl2"];function Wd(t){return"nodeType"in t}function Vd(t,e,i,n){const s=[];try{if(n){const n=function(t,e,i){const n=t.GPUCanvasContext;if((null==n?void 0:n.prototype)&&"function"==typeof n.prototype.configure)return oh(n.prototype,"configure",function(n){return function(s){const r=function(t){const{canvas:e}=t;return e&&"object"==typeof e?e:null}(this);if(!r||Wd(r)&&Zc(r,e,i,!0))return n.call(this,s);Wd(r)&&!("__context"in r)&&(r.__context="webgpu");const o=function(t){const e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return n.call(this,null!==o&&s?he(he({},s),{},{usage:"number"==typeof s.usage?s.usage|o:o}):s)}})}(t,e,i);n&&s.push(n)}const r=oh(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(s,...r){const o=function(t){return"experimental-webgl"===t?"webgl":t}(s);if(!Zc(this,e,i,!0)&&("__context"in this||(this.__context=o),n&&Ud.includes(o)))if(r[0]&&"object"==typeof r[0]){const t=r[0];t.preserveDrawingBuffer||(t.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[s,...r])}});s.push(r)}catch(t){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(t=>t())}}function Gd(t,e,i,n,s,r,o){const a=[],l=Object.getOwnPropertyNames(t);for(const u of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if("function"!=typeof t[u])continue;const l=oh(t,u,function(t){return function(...a){const l=t.apply(this,a);if(jd(l,r,this),this.canvas&&"tagName"in this.canvas&&!Zc(this.canvas,n,s,!0)){let t;try{t=Hd(a,r,this,o)}catch(t){}t&&i(this.canvas,{type:e,property:u,args:t})}return l}});a.push(l)}catch(r){const o=Hc(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!Zc(this.canvas,n,s,!0)&&i(this.canvas,{type:e,property:u,args:[t],setter:!0})}});a.push(o)}return a}var Zd='(function() {\n\t//#region ../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/base64-arraybuffer/1.0.2/f63fa6b5c318cf1c9f6bdd1d4292ad2f15f76f2ec78475025a2d44070e896fe9/node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js\n\tvar chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n\tvar lookup = typeof Uint8Array === "undefined" ? [] : /* @__PURE__ */ new Uint8Array(256);\n\tfor (var i = 0; i < chars.length; i++) lookup[chars.charCodeAt(i)] = i;\n\tvar encode = function(arraybuffer) {\n\t\tvar bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";\n\t\tfor (i = 0; i < len; i += 3) {\n\t\t\tbase64 += chars[bytes[i] >> 2];\n\t\t\tbase64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n\t\t\tbase64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n\t\t\tbase64 += chars[bytes[i + 2] & 63];\n\t\t}\n\t\tif (len % 3 === 2) base64 = base64.substring(0, base64.length - 1) + "=";\n\t\telse if (len % 3 === 1) base64 = base64.substring(0, base64.length - 2) + "==";\n\t\treturn base64;\n\t};\n\t//#endregion\n\t//#region ../rrweb/src/record/workers/image-bitmap-data-url-worker.ts\n\tconst lastFingerprintMap = /* @__PURE__ */ new Map();\n\tconst transparentFingerprintMap = /* @__PURE__ */ new Map();\n\tconst lastSentAtMap = /* @__PURE__ */ new Map();\n\tconst PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n\tfunction hashPixels(data) {\n\t\tconst view = new Uint32Array(data.buffer, data.byteOffset, data.byteLength >>> 2);\n\t\tlet primaryHash = 2166136261;\n\t\tlet secondaryHash = 2654435769;\n\t\tfor (let i = 0; i < view.length; i++) {\n\t\t\tprimaryHash ^= view[i];\n\t\t\tprimaryHash = Math.imul(primaryHash, 16777619);\n\t\t\tsecondaryHash ^= view[i];\n\t\t\tsecondaryHash = Math.imul(secondaryHash, 2246822507);\n\t\t}\n\t\treturn `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n\t}\n\tfunction frameFingerprint(width, height, data) {\n\t\treturn `${width}x${height}:${hashPixels(data)}`;\n\t}\n\tfunction transparentFingerprint(width, height) {\n\t\tconst pixelCount = width * height;\n\t\tlet hash = transparentFingerprintMap.get(pixelCount);\n\t\tif (hash === void 0) {\n\t\t\thash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n\t\t\ttransparentFingerprintMap.set(pixelCount, hash);\n\t\t}\n\t\treturn `${width}x${height}:${hash}`;\n\t}\n\tconst worker = self;\n\tlet reusableCanvas = null;\n\tlet reusableCtx = null;\n\tworker.onmessage = async function(e) {\n\t\tif ("resetFrameDedup" in e.data) {\n\t\t\tlastFingerprintMap.clear();\n\t\t\treturn;\n\t\t}\n\t\tif ("OffscreenCanvas" in globalThis) {\n\t\t\tconst { id, bitmap, width, height, displayWidth, displayHeight, dataURLOptions, maskRegions } = e.data;\n\t\t\ttry {\n\t\t\t\tif (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n\t\t\t\t\treusableCanvas = new OffscreenCanvas(width, height);\n\t\t\t\t\treusableCtx = reusableCanvas.getContext("2d", { willReadFrequently: true });\n\t\t\t\t}\n\t\t\t\tconst ctx = reusableCtx;\n\t\t\t\tctx.clearRect(0, 0, width, height);\n\t\t\t\tctx.drawImage(bitmap, 0, 0);\n\t\t\t\tbitmap.close();\n\t\t\t\tif (maskRegions) {\n\t\t\t\t\tctx.fillStyle = "black";\n\t\t\t\t\tfor (const region of maskRegions) ctx.fillRect(region.x, region.y, region.width, region.height);\n\t\t\t\t}\n\t\t\t\tconst fingerprint = frameFingerprint(width, height, ctx.getImageData(0, 0, width, height).data);\n\t\t\t\tif (fingerprint === (lastFingerprintMap.get(id) ?? transparentFingerprint(width, height))) {\n\t\t\t\t\tconst lastSentAt = lastSentAtMap.get(id);\n\t\t\t\t\tif (!(maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS)) return worker.postMessage({ id });\n\t\t\t\t}\n\t\t\t\tconst blob = await reusableCanvas.convertToBlob(dataURLOptions);\n\t\t\t\tconst arrayBuffer = await blob.arrayBuffer();\n\t\t\t\tworker.postMessage({\n\t\t\t\t\tid,\n\t\t\t\t\ttype: blob.type,\n\t\t\t\t\tbase64: encode(arrayBuffer),\n\t\t\t\t\tdisplayWidth,\n\t\t\t\t\tdisplayHeight\n\t\t\t\t});\n\t\t\t\tlastFingerprintMap.set(id, fingerprint);\n\t\t\t\tlastSentAtMap.set(id, Date.now());\n\t\t\t} catch {\n\t\t\t\tworker.postMessage({ id });\n\t\t\t}\n\t\t} else {\n\t\t\te.data.bitmap.close();\n\t\t\treturn worker.postMessage({ id: e.data.id });\n\t\t}\n\t};\n\t//#endregion\n})();\n',Qd="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Zd],{type:"text/javascript;charset=utf-8"});function Jd(t){let e;try{if(e=Qd&&(self.URL||self.webkitURL).createObjectURL(Qd),!e)throw"";const i=new Worker(e,{name:null==t?void 0:t.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),i}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Zd),{name:null==t?void 0:t.name})}}var Kd="A page CSP that omits blob: from worker-src or script-src blocks it";function Xd(t,...e){console.warn(`[replay] canvas capture: ${t}`,...e)}var Yd,tv,ev,iv=class{onFullSnapshot(){var t;null===(t=this.resetFrameDedup)||void 0===t||t.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(t){Oh(this,"pendingCanvasMutations",new Map),Oh(this,"rafStamps",{latestId:0,invokeId:null}),Oh(this,"mirror",void 0),Oh(this,"mutationCb",void 0),Oh(this,"resetObservers",void 0),Oh(this,"frozen",!1),Oh(this,"locked",!1),Oh(this,"rafIdTimestamp",null),Oh(this,"rafIdFlush",null),Oh(this,"refCount",0),Oh(this,"torndown",!1),Oh(this,"resetFrameDedup",null),Oh(this,"processMutation",(t,e)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)});const{sampling:e="all",win:i,blockClass:n,blockSelector:s,recordCanvas:r,dataURLOptions:o,resolutionScale:a,canvasMasking:l}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,r&&"all"===e&&this.initCanvasMutationObserver(i,n,s,o),r&&"number"==typeof e&&this.initCanvasFPSObserver(e,i,n,s,{dataURLOptions:o,resolutionScale:a,canvasMasking:l})}initCanvasFPSObserver(t,e,i,n,s){var r=this;if(!("OffscreenCanvas"in e))return void Xd("disabled because this browser does not support OffscreenCanvas");const o="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,a=Vd(e,i,n,!0),l=new Map;let u;try{u=new Jd}catch(t){return Xd(`disabled because the encode worker did not start. ${Kd}`,t),void a()}let h=!1;u.onerror=t=>{var e;h=!0,Xd(`stopped because the encode worker failed. ${Kd}`,t),cancelAnimationFrame(f),null===(e=u.terminate)||void 0===e||e.call(u),this.resetFrameDedup=null},this.resetFrameDedup=()=>{u.postMessage({resetFrameDedup:!0})},u.onmessage=t=>{const{id:e}=t.data;if(l.set(e,!1),!("base64"in t.data))return;const{base64:i,type:n,displayWidth:s,displayHeight:r}=t.data;this.mutationCb({id:e,type:Vu["2D"],commands:[{property:"clearRect",args:[0,0,s,r]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:n}]},0,0,s,r]}],displayWidth:s,displayHeight:r})};let c=!1,d=!1;const v=1e3/t;let f,p=0;const g=t=>{var a;h||(p&&v>t-p||(p=t,(()=>{const t=[],s=e=>{try{e.querySelectorAll("canvas").forEach(e=>{Zc(e,i,n,!0)||t.push(e)}),e.querySelectorAll("*").forEach(t=>{t.shadowRoot&&s(t.shadowRoot)})}catch(t){}};return s(e.document),t})().forEach((a=oe(function*(t){const e=r.mirror.getId(t);if(-1!==e&&!l.get(e)&&0!==t.width&&0!==t.height){l.set(e,!0);try{if(["webgl","webgl2"].includes(t.__context)){var i,n;const s=t.getContext(t.__context);if(null==s||null===(i=s.isContextLost)||void 0===i?void 0:i.call(s))return void l.set(e,!1);!1===(null==s||null===(n=s.getContextAttributes())||void 0===n?void 0:n.preserveDrawingBuffer)&&s.clear(s.COLOR_BUFFER_BIT)}const r=t.clientWidth||t.width,a=t.clientHeight||t.height,h=Math.max(1,Math.round(r*o)),d=Math.max(1,Math.round(a*o)),v=function(t,e,i,n,s,r){if(!t||"function"!=typeof t.regionsFn)return;let o;try{o=t.regionsFn(e)}catch(t){return Rd}if(void 0===o)return;if(!Array.isArray(o)||!o.every(Ad))return Rd;const a=i/s,l=n/r;return o.filter(t=>t.width>0&&t.height>0).map(t=>{const e=Math.floor(t.x*a),i=Math.floor(t.y*l);return{x:e,y:i,width:Math.ceil((t.x+t.width)*a)-e,height:Math.ceil((t.y+t.height)*l)-i}})}(s.canvasMasking,t,h,d,r,a);if("skip-frame"===v)return c||(c=!0,Xd("dropped a frame because the mask provider did not return valid regions. A provider that always fails records no canvas frames at all")),void l.set(e,!1);const f=yield createImageBitmap(t,1>o?{resizeWidth:h,resizeHeight:d,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:d});u.postMessage({id:e,bitmap:f,width:h,height:d,displayWidth:r,displayHeight:a,dataURLOptions:s.dataURLOptions,maskRegions:v},[f])}catch(t){d||(d=!0,Xd("dropped a frame because the snapshot failed. A canvas that fails every frame records no canvas frames at all",t)),l.set(e,!1)}}}),function(t){return a.apply(this,arguments)}))),f=requestAnimationFrame(g))};f=requestAnimationFrame(g),this.resetObservers=()=>{var t;a(),cancelAnimationFrame(f),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,i,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Vd(t,e,i,!1),r=function(t,e,i,n,s){const r=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[a])continue;const o=oh(e.CanvasRenderingContext2D.prototype,a,function(r){return function(...o){return Zc(this.canvas,i,n,!0)||setTimeout(()=>{let i;try{i=Hd(o,e,this,s)}catch(t){return}t(this.canvas,{type:Vu["2D"],property:a,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=Hc(e.CanvasRenderingContext2D.prototype,a,{set(e){Zc(this.canvas,i,n,!0)||t(this.canvas,{type:Vu["2D"],property:a,args:[e],setter:!0})}});r.push(o)}return()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n),o=function(t,e,i,n,s){const r=[];return void 0!==e.WebGLRenderingContext&&r.push(...Gd(e.WebGLRenderingContext.prototype,Vu.WebGL,t,i,n,e,s)),void 0!==e.WebGL2RenderingContext&&r.push(...Gd(e.WebGL2RenderingContext.prototype,Vu.WebGL2,t,i,n,e,s)),()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n);this.resetObservers=()=>{s(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,e)=>{const i=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,e){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(t);if(!i||-1===e)return;const n=i.map(t=>bs(t,Bu)),{type:s}=i[0];this.mutationCb({id:e,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}},nv=class{constructor(t){var e;Oh(this,"trackedLinkElements",new WeakSet),Oh(this,"pendingDeferredSheets",new Set),Oh(this,"mutationCb",void 0),Oh(this,"adoptedStyleSheetCb",void 0),Oh(this,"maskAllElementAttributes",void 0),Oh(this,"maskAttributeFn",void 0),Oh(this,"styleMirror",new ed),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(e=t.maskAllElementAttributes)&&void 0!==e&&e,this.maskAttributeFn=t.maskAttributeFn}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}beginDeferredLinkInlining(t,e){if(-1===e||!t.isConnected)return null;let i=null,n=null;try{n=t.sheet,n&&(i=Qh(n))}catch(t){}if(!i||!n)return Rh(),null;const s=i;let r=!1;const o={sheet:n,invalidate(){r=!0}};this.pendingDeferredSheets.add(o);let a=!1;return{advance:i=>{if(a)return!0;const l=lh(),u=ch();let h=!0;try{if(r)return a=!0,Rh(),!0;if(!s.advance(i))return h=!1,!1;a=!0;const o=s.text();if(!t.isConnected)return!0;let l=null;try{l=t.sheet}catch(t){}return l!==n?(Rh(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(Rh(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),dh(c=lh()-l,null!=(d=u)?d:uh)||(Sh.totalMs+=c,c>Sh.slowestSliceMs&&(Sh.slowestSliceMs=c))}var c,d},remainingRules:()=>s.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(t){if(t&&0!==this.pendingDeferredSheets.size)for(const e of this.pendingDeferredSheets)e.sheet===t&&(this.pendingDeferredSheets.delete(e),e.invalidate())}inlineDeferredLinkElement(t,e){var i;null===(i=this.beginDeferredLinkInlining(t,e))||void 0===i||i.advance(1/0)}emitCssTextMutation(t,e,i){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:{_cssText:tc({element:t,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){if(0===t.length)return;const i={id:e,styleIds:[]},n=[];for(const e of t){let t;if(this.styleMirror.has(e))t=this.styleMirror.getId(e);else{const i=this.styleMirror.add(e);t=i;const s=lh();try{Ih(()=>{try{const t=e.rules||e.cssRules;t&&Th(t)}catch(t){}n.push({styleId:i,rules:Array.from(e.rules||CSSRule,(t,i)=>({rule:zh(t,e.href),index:i}))})})}finally{Mh(lh()-s)}}i.styleIds.push(t)}n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),Tc.forEach(t=>t.abort()),Tc.clear()}trackStylesheetInLinkElement(t){}},sv=class{constructor(){Oh(this,"nodeMap",new WeakMap),Oh(this,"active",!1)}inOtherBuffer(t,e){const i=this.nodeMap.get(t);return i&&Array.from(i).some(t=>t!==e)}add(t,e){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}},rv=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var ov;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(ov=t.contentWindow)||void 0===ov?void 0:ov.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var av=new Jh,lv=new Set([zu.Mutation,zu.MediaInteraction,zu.StyleSheetRule,zu.CanvasMutation,zu.Font,zu.Log,zu.StyleDeclaration,zu.AdoptedStyleSheet]);function uv(t){const e=window;if("function"==typeof e.requestIdleCallback){const i=e.requestIdleCallback(t,{timeout:2e3});return{cancel(){var t;return null===(t=e.cancelIdleCallback)||void 0===t?void 0:t.call(e,i)}}}const i=setTimeout(t,250);return{cancel:()=>clearTimeout(i)}}function hv(t={}){let e;const{emit:i,checkoutEveryNms:n,checkoutEveryNth:s,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:u="rr-mask",maskTextSelector:h=null,inlineStylesheet:c=!0,inlineStylesheetBudgetRules:d,maskAllInputs:v,maskInputOptions:f,slimDOMOptions:p,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y=!1,maskAttributeFn:b,hooks:_,packFn:w,sampling:k={},dataURLOptions:S={},canvasResolutionScale:x,canvasMasking:C,mousemoveWait:T,recordDOM:I=!0,recordCanvas:M=!1,recordCrossOriginIframes:E=!1,recordAfter:P=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:R=!1,collectFonts:A=!1,inlineImages:F=!1,plugins:O,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:L=new Set([]),attributeFilter:N,errorHandler:q}=t;dd(q);const j=he({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},S),B=!E||window.parent===window;let H=!1;if(!B)try{window.parent.document&&(H=!1)}catch(t){H=!0}if(B&&!i)throw new Error("emit function is required");if(!B&&!H)return()=>{};void 0!==T&&void 0===k.mousemove&&(k.mousemove=T),av.reset();const z=!0===v?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==f?f:{password:!0},U=Ac(void 0!==p&&p);let W;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let V=0;const G=new Map;let Z,Q;const J=t=>{for(const e of O||[])e.eventProcessor&&(t=e.eventProcessor(t));return w&&!H&&(t=w(t)),t};Yd=(t,e)=>{var r;const o=t;if(o.timestamp=zc(),!(null===(r=pd[0])||void 0===r?void 0:r.isFrozen())||o.type===Hu.FullSnapshot||o.type===Hu.IncrementalSnapshot&&lv.has(o.data.source)||pd.forEach(t=>t.unfreeze()),B)null==i||i(J(o),e);else if(H){const t={type:"rrweb",event:J(o),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(o.type===Hu.FullSnapshot)W=o,V=0;else if(o.type===Hu.IncrementalSnapshot){if(o.data.source===zu.Mutation&&o.data.isAttachIframe)return;V++,(s&&V>=s||n&&o.timestamp-W.timestamp>n)&&tv(!0)}};const K=t=>{if(t.removes&&t.removes.length>0){const e=t.adds.length>0?new Set(t.adds.map(t=>t.node.id)):null,i=new Set;if(t.adds.length>0)for(const e of t.adds){const t=av.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&i.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const n=et.getIframeElementById(t);n&&i.has(n)?et.forgetIframeId(t):(null==Z||Z(t),et.removeIframeById(t))}),null==Q||Q(),et.cleanupDetachedIframes()}Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.Mutation},t)})},X=t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.Scroll},t)}),Y=t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.CanvasMutation},t)}),tt=new nv({mutationCb:K,adoptedStyleSheetCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.AdoptedStyleSheet},t)}),maskAllElementAttributes:y,maskAttributeFn:b}),et=new Ed({mirror:av,mutationCb:K,stylesheetManager:tt,recordCrossOriginIframes:E,wrappedEmit:Yd});for(const t of O||[])t.getMirror&&t.getMirror({nodeMirror:av,crossOriginIframeMirror:et.crossOriginIframeMirror,crossOriginIframeStyleMirror:et.crossOriginIframeStyleMirror});const it=new sv,nt=null==C?void 0:C.configured;ev=new iv({recordCanvas:M,mutationCb:Y,win:window,blockClass:r,blockSelector:o,mirror:av,sampling:k.canvas,dataURLOptions:j,resolutionScale:x,canvasMasking:C});const st=new Pd({mutationCb:K,scrollCb:X,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskInputOptions:z,dataURLOptions:j,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:b,recordCanvas:M,canvasMaskingConfigured:nt,inlineImages:F,sampling:k,slimDOMOptions:U,iframeManager:et,stylesheetManager:tt,canvasManager:ev,keepIframeSrcFn:D,processedNodeManager:it,attributeFilter:N},mirror:av});tv=(t=!1)=>{if(I){xh(d);try{Yd({type:Hu.Meta,data:{href:window.location.href,width:Vc(),height:Wc()}},t),null==e||e.cancel(),e=void 0,tt.reset(),st.init(),pd.forEach(t=>t.lock());let i=null,n=[];try{i=function(t,e){const{mirror:i=new Jh,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,canvasMaskingConfigured:h,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f=!1,maskAttributeFn:p,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:_,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C=()=>!1,maxDepth:T,inlineStylesheetBudgetRules:I}=e||{},M=!0===c?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===c?{password:!0}:c,E=Ac(g);xh(I);try{return Rc(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:M,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:p,slimDOMOptions:E,dataURLOptions:m,inlineImages:l,recordCanvas:u,canvasMaskingConfigured:h,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:_,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:T})}finally{Ch()}}(document,{mirror:av,blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskAllInputs:z,inlineStylesheetBudgetRules:d,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:b,slimDOM:U,dataURLOptions:j,recordCanvas:M,canvasMaskingConfigured:nt,inlineImages:F,onSerialize(t){Xc(t,av)&&et.addIframe(t),Yc(t,av)&&tt.trackLinkElement(t),td(t)&&st.addShadowRoot(ah.shadowRoot(t),document)},onIframeLoad(t,e){et.attachIframe(t,e),st.observeAttachShadow(t)},onIframeListenerRegistered(t,e){et.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){tt.attachLinkElement(t,e)},keepIframeSrcFn:D})}finally{n=Ph()}if(!i)return console.warn("Failed to snapshot the document");if(Yd({type:Hu.FullSnapshot,data:{node:i,initialOffset:Uc(window)}},t),pd.forEach(t=>t.unlock()),ev.onFullSnapshot(),n.length){const t=function(t,e,i){let n=!1,s=null,r=0,o=null;const a=()=>null!==o||t.length>r,l=()=>{const i=t[r];t[r]=null,r+=1,i&&Lc(()=>{o=e.beginDeferredLinkInlining(i,av.getId(i))})},u=()=>{if(!o)return;const t=o;let e=!0;Lc(()=>{e=t.advance(200)}),e&&(o=null)},h=()=>{o||l(),u()},c=t=>{if(s=null,n)return;let e=0;do{try{h()}catch(t){null==o||o.discard(),o=null,Ah(1)}e+=1}while(!n&&a()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));n||(a()?s=uv(c):i())};return s=uv(c),{cancel(){n=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(n)return;n=!0,null==s||s.cancel(),s=null;let e=0,h=0;for(;a()&&50>e;){o||l();const t=o;if(t)if(Math.floor(t.remainingRules()/200)+1>50-e)t.discard(),o=null,h+=1;else{try{u()}catch(t){null==o||o.discard(),o=null,h+=1}e+=1}}if(a()||h>0){let e=h+(null!==o?1:0);for(let i=r;t.length>i;i++)null!==t[i]&&(e+=1);Ah(e),null==o||o.discard(),o=null}i()}}}(n,tt,()=>{e===t&&(e=void 0)});e=t}E&&et.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&tt.adoptStyleSheets(document.adoptedStyleSheets,av.getId(document))}finally{Ch()}}};try{const t=[];t.push(Oc("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(Oc(e,hh,document));Z=e=>{const i=G.get(e);i&&(i.forEach(e=>{Lc(e);const i=t.indexOf(e);-1!==i&&t.splice(i,1)}),G.delete(e))},Q=()=>{for(const[t]of G){const e=av.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==Z||Z(t)}catch(e){null==Z||Z(t)}else null==Z||Z(t)}};const i=t=>{var e;return fd($d)({mutationCb:K,mousemoveCb:(t,e)=>Yd({type:Hu.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.MouseInteraction},t)}),scrollCb:X,viewportResizeCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.ViewportResize},t)}),inputCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.Input},t)}),mediaInteractionCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.MediaInteraction},t)}),styleSheetRuleCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.StyleSheetRule},t)}),styleDeclarationCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.StyleDeclaration},t)}),canvasMutationCb:Y,fontCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.Font},t)}),selectionCb(t){Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.Selection},t)})},customElementCb(t){Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.CustomElement},t)})},blockClass:r,ignoreClass:a,ignoreSelector:l,maskTextClass:u,maskTextSelector:h,maskInputOptions:z,inlineStylesheet:c,sampling:k,recordDOM:I,recordCanvas:M,canvasMaskingConfigured:nt,inlineImages:F,userTriggeredOnInput:R,collectFonts:A,doc:t,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y,maskAttributeFn:b,keepIframeSrcFn:D,blockSelector:o,slimDOMOptions:U,dataURLOptions:j,mirror:av,iframeManager:et,stylesheetManager:tt,shadowDomManager:st,processedNodeManager:it,canvasManager:ev,ignoreCSSAttributes:L,attributeFilter:N,plugins:(null==O||null===(e=O.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({name:t.name,observer:t.observer,options:t.options,callback:e=>Yd({type:Hu.Plugin,data:{plugin:t.name,payload:e}})})))||[]},_)};et.addLoadListener(e=>{try{const n=av.getId(e),s=i(e.contentDocument);if("function"==typeof s&&(t.push(s),-1!==n)){let t=G.get(n);t||(t=new Set,G.set(n,t)),t.add(s)}}catch(t){console.warn(t)}}),et.addPageHideListener(t=>{const e=av.getId(t);null==Z||Z(e),bd(t)});let n=-1;const s=t=>Yd({type:Hu.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),d=()=>{var t,e,i,r;const o=document,a=null!==(t=null!==(e=null!==(i=null!==(r=o.fullscreenElement)&&void 0!==r?r:o.webkitFullscreenElement)&&void 0!==i?i:o.mozFullScreenElement)&&void 0!==e?e:o.msFullscreenElement)&&void 0!==t?t:null,l=a?av.getId(a):-1;l!==n&&(-1!==n&&s({id:n,enter:!1}),n=l,-1!==l&&s({id:l,enter:!0}))},v=()=>{tv();const e=i(document);"function"==typeof e&&t.push(e),t.push(Oc("fullscreenchange",d)),t.push(Oc("webkitfullscreenchange",d)),t.push(Oc("mozfullscreenchange",d)),t.push(Oc("MSFullscreenChange",d)),rv=!0};return["interactive","complete"].includes(document.readyState)?v():(t.push(Oc("DOMContentLoaded",()=>{Yd({type:Hu.DomContentLoaded,data:{}}),"DOMContentLoaded"===P&&v()})),t.push(Oc("load",()=>{Yd({type:Hu.Load,data:{}}),"load"===P&&v()},window))),()=>{try{null==e||e.flush()}catch(t){}e=void 0,Nc(t),it.destroy(),et.removeLoadListener(),et.destroy(),G.clear(),st.reset(),av.reset(),rv=!1,vd()}}catch(t){console.warn(t)}}hv.addCustomEvent=(t,e)=>{if(!rv)throw new Error("please add custom event after start recording");Yd({type:Hu.Custom,data:{tag:t,payload:e}})},hv.freezePage=()=>{pd.forEach(t=>t.freeze())},hv.takeFullSnapshot=t=>{if(!rv)throw new Error("please take full snapshot after start recording");tv(t)},hv.mirror=av,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var cv=Object.create(null);function dv(t){return dv="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},dv(t)}function vv(t,e,i){return(e=function(t){var e=function(t){if("object"!=dv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=dv(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dv(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}cv.Node=Object.create(null),cv.ShadowRoot=Object.create(null),cv.MutationObserver=Object.create(null),cv.Element=Object.create(null);var fv=class{constructor(t){vv(this,"fileName",void 0),vv(this,"functionName",void 0),vv(this,"lineNumber",void 0),vv(this,"columnNumber",void 0),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){const t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${t}:${e})`:`${this.fileName}:${t}:${e}`}},pv=/(^|@)\S+:\d+/,gv=/^\s*at .*(\S+:\d+|\(native\))/m,mv=/^(eval@)?(\[native code])?$/,yv={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(gv)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];const e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error(`Cannot parse given url: ${t}`);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE(t){return t.stack.split("\n").filter(function(t){return!!t.match(gv)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let e=t.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=e.match(/ (\((.+):(\d+):(\d+)\)$)/);e=i?e.replace(i[0],""):e;const n=e.split(/\s+/).slice(1),s=this.extractLocation(i?i[1]:n.pop());return new fv({functionName:n.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(s[0])>-1?void 0:s[0],lineNumber:s[1],columnNumber:s[2]})},this)},parseFFOrSafari(t){return t.stack.split("\n").filter(function(t){return!t.match(mv)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new fv({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(e),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(t.replace(e,""));return new fv({functionName:n,fileName:s[0],lineNumber:s[1],columnNumber:s[2]})}},this)},parseOpera(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9(t){const e=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),n=[];for(let t=2,s=i.length;s>t;t+=2){const s=e.exec(i[t]);s&&n.push(new fv({fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera10(t){const e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),n=[];for(let t=0,s=i.length;s>t;t+=2){const s=e.exec(i[t]);s&&n.push(new fv({functionName:s[3]||void 0,fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera11(t){return t.stack.split("\n").filter(function(t){return!!t.match(pv)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),i=this.extractLocation(e.pop());return new fv({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function bv(t){if(!t||!t.outerHTML)return"";let e="";for(;t.parentElement;){let i=t.localName;if(!i)break;i=i.toLowerCase();const n=t.parentElement,s=[];if(n.children&&n.children.length>0)for(let t=0;n.children.length>t;t++){const e=n.children[t];e.localName&&e.localName.toLowerCase&&e.localName.toLowerCase()===i&&s.push(e)}s.length>1&&(i+=`:eq(${s.indexOf(t)})`),e=i+(e?">"+e:""),t=n}return e}function _v(t){return Array.isArray(t)}function wv(t){return"object"==typeof t&&null!==t&&!_v(t)}function kv(t,e){if(0===e)return!0;const i=Object.keys(t);for(const n of i)if(wv(t[n])&&kv(t[n],e-1))return!0;return!1}function Sv(t,e){const i={numOfKeysLimit:50,depthOfLimit:4};Object.assign(i,e);const n=[],s=[];return JSON.stringify(t,function(t,e){if(n.length>0){const i=n.indexOf(this);~i?n.splice(i+1):n.push(this),~i?s.splice(i,1/0,t):s.push(t),~n.indexOf(e)&&(e=n[0]===e?"[Circular ~]":"[Circular ~."+s.slice(0,n.indexOf(e)).join(".")+"]")}else n.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(wv(r=e)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||wv(r)&&kv(r,i.depthOfLimit))return function(t){let e=t.toString();return i.stringLengthLimit&&e.length>i.stringLengthLimit&&(e=`${e.slice(0,i.stringLengthLimit)}...`),e}(e);var r;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){const t={};for(const i in e){const n=e[i];t[i]=_v(n)?bv(n.length?n[0]:null):n}return t}return e instanceof Node?e instanceof HTMLElement?e?e.outerHTML:"":e.nodeName:e instanceof Error?e.stack?e.stack+"\nEnd of stack for Error object":e.name+": "+e.message:e})}var xv={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function Cv(t,e,i){const n=i?Object.assign({},xv,i):xv,s=n.logger;if(!s)return()=>{};let r;r="string"==typeof s?e[s]:s;let o=0,a=!1,l=!0;const u=[];if(n.level.includes("error")){const i=e=>{const i=e.message;t({level:"error",trace:yv.parse(e.error).map(t=>t.toString()),payload:[Sv(i,n.stringifyOptions)]})};e.addEventListener("error",i),u.push(()=>{e.removeEventListener("error",i)});const s=e=>{let i,s;e.reason instanceof Error?(i=e.reason,s=[Sv(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[Sv("Uncaught (in promise)",n.stringifyOptions),Sv(e.reason,n.stringifyOptions)]),t({level:"error",trace:yv.parse(i).map(t=>t.toString()),payload:s})};e.addEventListener("unhandledrejection",s),u.push(()=>{e.removeEventListener("unhandledrejection",s)})}for(const t of n.level)u.push(h(r,t));return()=>{l=!1,u.forEach(t=>t())};function h(e,i){return e[i]?function(s,r){try{if(!(r in s))return()=>{};const u=s[r],h={next:u},c=(s=>(...r)=>{if(s.apply(e,r),l&&!("assert"===i&&r[0]||a)){a=!0;try{const e=yv.parse(new Error).map(t=>t.toString()).splice(1),s=("assert"===i?r.slice(1):r).map(t=>Sv(t,n.stringifyOptions));o++,n.lengthThreshold>o?t({level:i,trace:e,payload:s}):o===n.lengthThreshold&&t({level:"warn",trace:[],payload:[Sv("The number of log records reached the threshold.")]})}catch(t){s.apply(e,["rrweb logger error:",t,...r])}finally{a=!1}}})(function(...t){return h.next.apply(this,t)});return"function"==typeof c&&(c.prototype=c.prototype||{},Object.defineProperties(c,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:h}})),s[r]=c,()=>{if(s[r]===c)return void(s[r]=h.next);const t=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let e=s[r],i=t(e);for(;i;){if(i.next===c)return void(i.next=h.next);e=i.next,i=t(e)}}}catch(t){return()=>{}}}(e,i):()=>{}}}var $v=t=>({name:"rrweb/console@1",observer:Cv,options:t});const Tv=()=>{},Iv=t=>{var e;if(Ce(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function Mv(t,e,i){try{if(!(e in t))return Tv;const n={next:t[e]},s=i(function(...t){return n.next.apply(this,t)});return Ce(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]===s)return void(t[e]=n.next);let i=t[e],r=Iv(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=Iv(i)}}}catch(t){return Tv}}function Ev(t,e){var i;const n=function(t){try{return"string"==typeof t?new URL(t).hostname:"url"in t?new URL(t.url).hostname:t.hostname}catch(t){return null}}(t),s={hostname:n,isHostDenied:!1};if(!(null===(i=e.payloadHostDenyList)||void 0===i?void 0:i.length)||!(null==n?void 0:n.trim().length))return s;for(const t of e.payloadHostDenyList)if(n.endsWith(t))return{hostname:n,isHostDenied:!0};return s}const Pv=Zs("[Recorder]"),Rv=t=>"navigation"===t.entryType,Av=t=>"resource"===t.entryType,Fv=()=>{};function Ov(t,e){var i;return Rv(e)&&"complete"===(null===(i=t.document)||void 0===i?void 0:i.readyState)&&e.loadEventEnd>0}function Dv(t,e){return e.recordInitialRequests?t.performance.getEntries().filter(i=>Ov(t,i)||Av(i)&&e.initiatorTypes.includes(i.initiatorType)):e.performanceEntryTypeToObserve.includes("navigation")?function(t){var e;return"complete"!==(null===(e=t.document)||void 0===e?void 0:e.readyState)?[]:t.performance.getEntriesByType("navigation").filter(e=>Ov(t,e))}(t):[]}function Lv(t,e){return!!e&&(Oe(e)||e[t])}function Nv(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}const qv=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function jv({type:t,recordBody:e,headers:i,url:n}){function s(t){const e=Object.keys(i).find(t=>"content-type"===t.toLowerCase()),n=e&&i[e];return t.some(t=>null==n?void 0:n.toLowerCase().includes(t))}if(!e)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!Nv(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s(qv))return!1;if(Oe(e))return!0;if(xe(e))return s(e);const r=e[t];return Oe(r)?r:s(r)}function Bv(t,e,i,n,s){return Hv.apply(this,arguments)}function Hv(){return Hv=oe(function*(t,e,i,n,s,r=0){if(r>10)return Pv.warn("Failed to get performance entry for request",{url:i,initiatorType:e}),null;const o=function(t,e){for(let i=t.length-1;i>=0;i-=1)if(e(t[i]))return t[i]}(t.performance.getEntriesByName(i),t=>Av(t)&&t.initiatorType===e&&(Ie(n)||t.startTime>=n)&&(Ie(s)||s>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*r)),Bv(t,e,i,n,s,r+1))}),Hv.apply(this,arguments)}function zv({body:t,options:e,url:i}){if(Re(t))return null;const{hostname:n,isHostDenied:s}=Ev(i,e);if(s)return n+" is in deny list";if(Me(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(De(t))return ur(t);if($e(t))try{return JSON.stringify(t)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}const Uv=t=>!Pe(t)&&("navigation"===t.entryType||"resource"===t.entryType);function Wv(t,{entry:e,method:i,status:n,networkRequest:s,isInitial:r,start:o,end:a,url:l,initiatorType:u}){o=e?e.startTime:o,a=e?e.responseEnd:a;const h=Math.floor(Date.now()-t.performance.now()),c=Math.floor(h+(o||0)),d=[he(he({},e?e.toJSON():{name:l}),{},{startTime:Ie(o)?void 0:Math.round(o),endTime:Ie(a)?void 0:Math.round(a),timeOrigin:h,timestamp:c,method:i,initiatorType:u||(e?e.initiatorType:void 0),status:n,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:r})];if(Uv(e))for(const t of e.serverTiming||[])d.push({timeOrigin:h,timestamp:c,startTime:Math.round(e.startTime),name:t.name,duration:t.duration,entryType:"serverTiming"});return d}const Vv=["video/","audio/"];function Gv(t){return $e(t)&&Ce(t.getReader)&&Ce(t.tee)}const Zv="[SessionReplay] Timeout while trying to read body",Qv="[SessionReplay] Failed to read body";function Jv(t){return`${Qv}: ${t}`}function Kv(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function Xv(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const i=setTimeout(()=>e(Zv),500);try{t.clone().text().then(t=>e(t),t=>e(Jv(t))).finally(()=>clearTimeout(i))}catch(t){clearTimeout(i),e(Qv)}})}(t);const i=so(e);return function(t,e){try{var i,n;const s=null===(i=t.headers)||void 0===i||null===(n=i.get)||void 0===n?void 0:n.call(i,"content-length");if(!s)return!1;const r=parseInt(s,10);return Number.isFinite(r)&&r>e}catch(t){return!1}}(t,i)?Promise.resolve(Kv(i)):function(t,e){return new Promise(i=>{let n,s=!1;function r(){try{null==n||n.cancel().catch(()=>{})}catch(t){}}function o(t){s||(s=!0,clearTimeout(a),r(),i(t))}const a=setTimeout(()=>o(Zv),500);let l;try{l=t.clone()}catch(t){return void o(Qv)}const u=l.body;if(!Gv(u)||"undefined"==typeof TextDecoder){try{l.text().then(t=>o(t),t=>o(Jv(t)))}catch(t){o(Qv)}return}try{n=u.getReader()}catch(t){return void o(Qv)}const h=[];let c=0;!function t(){n.read().then(({done:i,value:n})=>{if(s)r();else if(i)o((new TextDecoder).decode(function(t,e){const i=new Uint8Array(e);let n=0;for(const e of t)i.set(e,n),n+=e.byteLength;return i}(h,c)));else{if(n){if(c+n.byteLength>e)return void o(Kv(e));c+=n.byteLength,h.push(n)}t()}},t=>o(Jv(t)))}()})}(t,i)}function Yv(){return Yv=oe(function*({r:t,options:e,url:i}){const{hostname:n,isHostDenied:s}=Ev(i,e);return s?Promise.resolve(n+" is in deny list"):Xv(t,e)}),Yv.apply(this,arguments)}function tf(){return tf=oe(function*({r:t,options:e,url:i}){const n=function({r:t,options:e,url:i}){var n;if("chunked"===t.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const s=null===(n=t.headers.get("Content-Type"))||void 0===n?void 0:n.toLowerCase(),r=Vv.some(t=>null==s?void 0:s.startsWith(t));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:a}=Ev(i,e);return a?o+" is in deny list":null}({r:t,options:e,url:i});return Pe(n)?Xv(t,e):Promise.resolve(n)}),tf.apply(this,arguments)}let ef=null;function nf(t,e,i){if(!("performance"in e))return()=>{};if(ef)return Pv.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},ro,i):ro;let s=!0;const r=e=>{if(!s)return;const i=[];let r=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&r)return;const s=n.maskRequestFn(t);e||(r=!s||(t=>!!t&&fo.has(t))(s)),s&&i.push(s)}),i.length>0&&t(he(he({},e),{},{requests:i}))},o=function(t,e,i){try{t({requests:Dv(e,i).flatMap(t=>Wv(e,{entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}catch(t){Pv.error("Failed to capture initial performance entries for network capture",t)}const n=e.PerformanceObserver,s=null==n?void 0:n.supportedEntryTypes;if(!n||!xe(s))return;const r=s.filter(t=>i.performanceEntryTypeToObserve.includes(t));if(!r.length)return;const o=new n(n=>{t({requests:n.getEntries().filter(t=>Rv(t)||Av(t)&&i.initiatorTypes.includes(t.initiatorType)&&(t=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>Wv(e,{entry:t,method:void 0,status:void 0,networkRequest:{}}))})});return o.observe({entryTypes:r}),()=>{o.disconnect()}}(r,e,n),a=n.recordHeaders||n.recordBody;if(!o&&!a)return s=!1,Fv;let l=()=>{},u=()=>{};return a&&(l=function(t,e,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const n=Lv("request",i.recordHeaders),s=Lv("response",i.recordHeaders),r=Mv(e.XMLHttpRequest.prototype,"open",r=>function(o,a,l=!0,u,h){const c=this;try{const r=new Request(a),l={};let u,h;const d={},v=c.setRequestHeader.bind(c);c.setRequestHeader=(t,e)=>(d[t]=e,v(t,e)),n&&(l.requestHeaders=d);const f=c.send.bind(c);c.send=t=>(jv({type:"request",headers:d,url:a,recordBody:i.recordBody})&&(l.requestBody=zv({body:t,options:i,url:a})),u=e.performance.now(),f(t));const p=()=>{c.removeEventListener("readystatechange",g),c.removeEventListener("error",p),c.removeEventListener("abort",p),c.removeEventListener("timeout",p)},g=()=>{if(c.readyState!==c.DONE)return;p(),h=e.performance.now();const n={};c.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{const e=t.split(": "),i=e.shift(),s=e.join(": ");i&&(n[i]=s)}),s&&(l.responseHeaders=n),jv({type:"response",headers:n,url:a,recordBody:i.recordBody})&&(l.responseBody=zv({body:c.response,options:i,url:a})),Bv(e,"xmlhttprequest",r.url,u,h).then(i=>{t({requests:Wv(e,{entry:i,method:o,status:null==c?void 0:c.status,networkRequest:l,start:u,end:h,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};c.addEventListener("readystatechange",g),c.addEventListener("error",p),c.addEventListener("abort",p),c.addEventListener("timeout",p)}catch(t){Pv.error("Failed to instrument XHR for network capture",t)}r.call(c,o,a.toString(),l,u,h)});return()=>{r()}}(r,e,n),u=function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=Lv("request",i.recordHeaders),s=Lv("response",i.recordHeaders),r=Mv(e,"fetch",r=>function(){var o=oe(function*(o,a){let l,u;try{l=new Request(o,a)}catch(t){return Pv.error("Failed to instrument fetch for network capture",t),r(o,a)}const h={};let c,d;try{try{const t={};l.headers.forEach((e,i)=>{t[i]=e}),n&&(h.requestHeaders=t),!Gv(null==a?void 0:a.body)&&jv({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(h.requestBody=yield function(t){return Yv.apply(this,arguments)}({r:l,options:i,url:o}))}catch(t){Pv.error("Failed to record fetch request for network capture",t)}c=e.performance.now(),u=Nv(o)?yield r(l):yield r(o,a),d=e.performance.now();try{const t={};u.headers.forEach((e,i)=>{t[i]=e}),s&&(h.responseHeaders=t),jv({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(h.responseBody=yield function(t){return tf.apply(this,arguments)}({r:u,options:i,url:o}))}catch(t){Pv.error("Failed to record fetch response for network capture",t)}return u}finally{Bv(e,"fetch",l.url,c,d).then(i=>{t({requests:Wv(e,{entry:i,method:l.method,status:null==u?void 0:u.status,networkRequest:h,start:c,end:d,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(t,e){return o.apply(this,arguments)}}());return()=>{r()}}(r,e,n)),ef=()=>{s=!1,null==o||o(),l(),u(),ef=null},ef}const sf=t=>({name:"rrweb/network@1",observer:nf,options:t});var rf,of,af,lf,uf,hf,cf,df,vf,ff,pf,gf,mf,yf,bf;d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:$v,getRecordNetworkPlugin:sf},d.__PosthogExtensions__.rrweb={record:hv,version:"v2",wasMaxDepthReached:()=>Pc,resetMaxDepthState(){Pc=!1,Ec=!1},getLastSnapshotCost:()=>mh,getMutationCost:()=>he({},kh),getObserverInitFailures:()=>Cd.size?Array.from(Cd):void 0,resetSnapshotCostState(){vh=0,fh=0,ph=0,uh=0,gh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},mh=null,yh=null,bh=[],_h=0,wh=0,kh={slowestBatchMs:0},Sh={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},d.rrweb={record:hv,version:"v2"},d.rrwebConsoleRecord={getRecordConsolePlugin:$v},d.getRecordNetworkPlugin=sf,d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initSessionRecording=(t,e)=>new ju(t,e);var _f,wf,kf,Sf,xf={},Cf=[],$f=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Tf=Array.isArray;function If(t,e){for(var i in e)t[i]=e[i];return t}function Mf(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Ef(t,e,i){var n,s,r,o={};for(r in e)"key"==r?n=e[r]:"ref"==r?s=e[r]:o[r]=e[r];if(arguments.length>2&&(o.children=arguments.length>3?rf.call(arguments,2):i),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===o[r]&&(o[r]=t.defaultProps[r]);return Pf(t,o,n,s,null)}function Pf(t,e,i,n,s){var r={type:t,props:e,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++af:s,__i:-1,__u:0};return null==s&&null!=of.vnode&&of.vnode(r),r}function Rf(t){return t.children}function Af(t,e){this.props=t,this.context=e}function Ff(t,e){if(null==e)return t.__?Ff(t.__,t.__i+1):null;for(var i;t.__k.length>e;e++)if(null!=(i=t.__k[e])&&null!=i.__e)return i.__e;return"function"==typeof t.type?Ff(t):null}function Of(t){if(t.__P&&t.__d){var e=t.__v,i=e.__e,n=[],s=[],r=If({},e);r.__v=e.__v+1,of.vnode&&of.vnode(r),Wf(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[i]:null,n,null==i?Ff(e):i,!!(32&e.__u),s),r.__v=e.__v,r.__.__k[r.__i]=r,Gf(n,r,s),e.__e=e.__=null,r.__e!=i&&Df(r)}}function Df(t){if(null!=(t=t.__)&&null!=t.__c)return t.__e=t.__c.base=null,t.__k.some(function(e){if(null!=e&&null!=e.__e)return t.__e=t.__c.base=e.__e}),Df(t)}function Lf(t){(!t.__d&&(t.__d=!0)&&lf.push(t)&&!Nf.__r++||uf!=of.debounceRendering)&&((uf=of.debounceRendering)||hf)(Nf)}function Nf(){try{for(var t,e=1;lf.length;)lf.length>e&&lf.sort(cf),t=lf.shift(),e=lf.length,Of(t)}finally{lf.length=Nf.__r=0}}function qf(t,e,i,n,s,r,o,a,l,u,h){var c,d,v,f,p,g,m,y=n&&n.__k||Cf,b=e.length;for(l=function(t,e,i,n,s){var r,o,a,l,u,h=i.length,c=h,d=0;for(t.__k=new Array(s),r=0;s>r;r++)null!=(o=e[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=t.__k[r]=Pf(null,o,null,null,null):Tf(o)?o=t.__k[r]=Pf(Rf,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=t.__k[r]=Pf(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[r]=o,l=r+d,o.__=t,o.__b=t.__b+1,a=null,-1!=(u=o.__i=Bf(o,i,l,c))&&(c--,(a=i[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(s>h?d--:h>s&&d++),"function"!=typeof o.type&&(o.__u|=4)):u!=l&&(u==l-1?d--:u==l+1?d++:(u>l?d--:d++,o.__u|=4))):t.__k[r]=null;if(c)for(r=0;h>r;r++)null!=(a=i[r])&&!(2&a.__u)&&(a.__e==n&&(n=Ff(a)),Jf(a,a));return n}(i,e,y,l,b),c=0;b>c;c++)null!=(v=i.__k[c])&&(d=-1!=v.__i&&y[v.__i]||xf,v.__i=c,g=Wf(t,v,d,s,r,o,a,l,u,h),f=v.__e,v.ref&&d.ref!=v.ref&&(d.ref&&Qf(d.ref,null,v),h.push(v.ref,v.__c||f,v)),null==p&&null!=f&&(p=f),(m=!!(4&v.__u))||d.__k===v.__k?(l=jf(v,l,t,m),m&&d.__e&&(d.__e=null)):"function"==typeof v.type&&void 0!==g?l=g:f&&(l=f.nextSibling),v.__u&=-7);return i.__e=p,l}function jf(t,e,i,n){var s,r;if("function"==typeof t.type){for(s=t.__k,r=0;s&&s.length>r;r++)s[r]&&(s[r].__=t,e=jf(s[r],e,i,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=Ff(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function Bf(t,e,i,n){var s,r,o,a=t.key,l=t.type,u=e[i],h=null!=u&&!(2&u.__u);if(null===u&&null==a||h&&a==u.key&&l==u.type)return i;if(n>(h?1:0))for(s=i-1,r=i+1;s>=0||e.length>r;)if(null!=(u=e[o=0>s?r++:s--])&&!(2&u.__u)&&a==u.key&&l==u.type)return o;return-1}function Hf(t,e,i){"-"==e[0]?t.setProperty(e,null==i?"":i):t[e]=null==i?"":"number"!=typeof i||$f.test(e)?i:i+"px"}function zf(t,e,i,n,s){var r,o;t:if("style"==e)if("string"==typeof i)t.style.cssText=i;else{if("string"==typeof n&&(t.style.cssText=n=""),n)for(e in n)i&&e in i||Hf(t.style,e,"");if(i)for(e in i)n&&i[e]==n[e]||Hf(t.style,e,i[e])}else if("o"==e[0]&&"n"==e[1])r=e!=(e=e.replace(pf,"$1")),o=e.toLowerCase(),e=o in t||"onFocusOut"==e||"onFocusIn"==e?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=i,i?n?i[ff]=n[ff]:(i[ff]=gf,t.addEventListener(e,r?yf:mf,r)):t.removeEventListener(e,r?yf:mf,r);else{if("http://www.w3.org/2000/svg"==s)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==i?"":i;break t}catch(t){}"function"==typeof i||(null==i||!1===i&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==i?"":i))}}function Uf(t){return function(e){if(this.l){var i=this.l[e.type+t];if(null==e[vf])e[vf]=gf++;else if(i[ff]>e[vf])return;return i(of.event?of.event(e):e)}}}function Wf(t,e,i,n,s,r,o,a,l,u){var h,c,d,v,f,p,g,m,y,b,$,_,w,k,S,x,C=e.type;if(void 0!==e.constructor)return null;128&i.__u&&(l=!!(32&i.__u),r=[a=e.__e=i.__e]),(h=of.__b)&&h(e);t:if("function"==typeof C){c=o.length;try{if(y=e.props,b=C.prototype&&C.prototype.render,$=(h=C.contextType)&&n[h.__c],_=h?$?$.props.value:h.__:n,i.__c?m=(d=e.__c=i.__c).__=d.__E:(b?e.__c=d=new C(y,_):(e.__c=d=new Af(y,_),d.constructor=C,d.render=Kf),$&&$.sub(d),d.state||(d.state={}),d.__n=n,v=d.__d=!0,d.__h=[],d._sb=[]),b&&null==d.__s&&(d.__s=d.state),b&&null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=If({},d.__s)),If(d.__s,C.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=e,v)b&&null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),b&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(b&&null==C.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,_),e.__v==i.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,_)){e.__v!=i.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(t){t&&(t.__=e)}),Cf.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break t}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,_),b&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,p,g)})}if(d.context=_,d.props=y,d.__P=t,d.__e=!1,w=of.__r,k=0,b)d.state=d.__s,d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),Cf.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&25>++k);d.state=d.__s,null!=d.getChildContext&&(n=If(If({},n),d.getChildContext())),b&&!v&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(f,p)),S=null!=h&&h.type===Rf&&null==h.key?Zf(h.props.children):h,a=qf(t,Tf(S)?S:[S],e,i,n,s,r,o,a,l,u),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),m&&(d.__E=d.__=null)}catch(t){if(o.length=c,e.__v=null,l||null!=r)if(t.then){for(e.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=r&&(r[r.indexOf(a)]=null),e.__e=a}else{if(null!=r)for(x=r.length;x--;)Mf(r[x]);Vf(e)}else e.__e=i.__e,!e.__k&&i.__k&&(e.__k=i.__k),t.then||Vf(e);of.__e(t,e,i)}}else null==r&&e.__v==i.__v?(e.__k=i.__k,e.__e=i.__e):a=e.__e=function(t,e,i,n,s,r,o,a,l){var u,h,c,d,v,f,p,g=i.props||xf,m=e.props,y=e.type;if("svg"==y?s="http://www.w3.org/2000/svg":"math"==y?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=r)for(u=0;r.length>u;u++)if((v=r[u])&&"setAttribute"in v==!!y&&(y?v.localName==y:3==v.nodeType)){t=v,r[u]=null;break}if(null==t){if(null==y)return document.createTextNode(m);t=document.createElementNS(s,y,m.is&&m),a&&(of.__m&&of.__m(e,r),a=!1),r=null}if(null==y)g===m||a&&t.data==m||(t.data=m);else{if(r="textarea"==y&&null!=m.defaultValue?null:r&&rf.call(t.childNodes),!a&&null!=r)for(g={},u=0;t.attributes.length>u;u++)g[(v=t.attributes[u]).name]=v.value;for(u in g)v=g[u],"dangerouslySetInnerHTML"==u?c=v:"children"==u||u in m||"value"==u&&"defaultValue"in m||"checked"==u&&"defaultChecked"in m||zf(t,u,null,v,s);for(u in m)v=m[u],"children"==u?d=v:"dangerouslySetInnerHTML"==u?h=v:"value"==u?f=v:"checked"==u?p=v:a&&"function"!=typeof v||g[u]===v||zf(t,u,v,g[u],s);if(h)a||c&&(h.__html==c.__html||h.__html==t.innerHTML)||(t.innerHTML=h.__html),e.__k=[];else if(c&&(t.innerHTML=""),qf("template"==e.type?t.content:t,Tf(d)?d:[d],e,i,n,"foreignObject"==y?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&Ff(i,0),a,l),null!=r)for(u=r.length;u--;)Mf(r[u]);a&&"textarea"!=y||(u="value","progress"==y&&null==f?t.removeAttribute("value"):null!=f&&(f!==t[u]||"progress"==y&&!f||"option"==y&&f!=g[u])&&zf(t,u,f,g[u],s),u="checked",null!=p&&p!=t[u]&&zf(t,u,p,g[u],s))}return t}(i.__e,e,i,n,s,r,o,l,u);return(h=of.diffed)&&h(e),128&e.__u?void 0:a}function Vf(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Vf))}function Gf(t,e,i){for(var n=0;i.length>n;n++)Qf(i[n],i[++n],i[++n]);of.__c&&of.__c(e,t),t.some(function(e){try{t=e.__h,e.__h=[],t.some(function(t){t.call(e)})}catch(t){of.__e(t,e.__v)}})}function Zf(t){return"object"!=typeof t||null==t||t.__b>0?t:Tf(t)?t.map(Zf):void 0!==t.constructor?null:If({},t)}function Qf(t,e,i){try{if("function"==typeof t){var n="function"==typeof t.__u;n&&t.__u(),n&&null==e||(t.__u=t(e))}else t.current=e}catch(t){of.__e(t,i)}}function Jf(t,e,i){var n,s;if(of.unmount&&of.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Qf(n,null,e)),null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){of.__e(t,e)}n.base=n.__P=n.__n=null}if(n=t.__k)for(s=0;n.length>s;s++)n[s]&&Jf(n[s],e,i||"function"!=typeof t.type);i||Mf(t.__e),t.__c=t.__=t.__e=void 0}function Kf(t,e,i){return this.constructor(t,i)}function Xf(t,e,i){var n,s,r,o;e==document&&(e=document.documentElement),of.__&&of.__(t,e),s=(n="function"==typeof i)?null:i&&i.__k||e.__k,r=[],o=[],Wf(e,t=(!n&&i||e).__k=Ef(Rf,null,[t]),s||xf,xf,e.namespaceURI,!n&&i?[i]:s?null:e.firstChild?rf.call(e.childNodes):null,r,!n&&i?i:s?s.__e:e.firstChild,n,o),Gf(r,t,o),t.props.children=null}rf=Cf.slice,of={__e(t,e,i,n){for(var s,r,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((r=s.constructor)&&null!=r.getDerivedStateFromError&&(s.setState(r.getDerivedStateFromError(t)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(t,n||{}),o=s.__d),o)return s.__E=s}catch(e){t=e}throw t}},af=0,Af.prototype.setState=function(t,e){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=If({},this.state);"function"==typeof t&&(t=t(If({},i),this.props)),t&&If(i,t),null!=t&&this.__v&&(e&&this._sb.push(e),Lf(this))},Af.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Lf(this))},Af.prototype.render=Rf,lf=[],hf="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,cf=function(t,e){return t.__v.__b-e.__v.__b},Nf.__r=0,df=Math.random().toString(8),vf="__d"+df,ff="__a"+df,pf=/(PointerCapture)$|Capture$/i,gf=0,mf=Uf(!1),yf=Uf(!0),bf=0;var Yf=0,tp=[],ep=of,ip=ep.__b,np=ep.__r,sp=ep.diffed,rp=ep.__c,op=ep.unmount,ap=ep.__;function lp(t,e){ep.__h&&ep.__h(wf,t,Yf||e),Yf=0;var i=wf.__H||(wf.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function up(t){return Yf=1,function(t,e){var i=lp(_f++,2);if(i.t=t,!i.__c&&(i.__=[_p(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=wf,!wf.__f)){var n=function(t,e,n){if(!i.__c.__H)return!0;var r=!1,o=i.__c.props!==t;if(i.__c.__H.__.some(function(t){if(t.__N){r=!0;var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(o=!0)}}),s){var a=s.call(this,t,e,n);return r?a||o:a}return!r||o};wf.__f=!0;var s=wf.shouldComponentUpdate,r=wf.componentWillUpdate;wf.componentWillUpdate=function(t,e,i){if(this.__e){var o=s;s=void 0,n(t,e,i),s=o}r&&r.call(this,t,e,i)},wf.shouldComponentUpdate=n}return i.__N||i.__}(_p,t)}function hp(t,e){var i=lp(_f++,3);!ep.__s&&bp(i.__H,e)&&(i.__=t,i.u=e,wf.__H.__h.push(i))}function cp(t){return Yf=5,dp(function(){return{current:t}},[])}function dp(t,e){var i=lp(_f++,7);return bp(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function vp(t){var e=wf.context[t.__c],i=lp(_f++,9);return i.c=t,e?(null==i.__&&(i.__=!0,e.sub(wf)),e.props.value):t.__}function fp(){for(var t;t=tp.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(mp),e.__h.some(yp),e.__h=[]}catch(i){e.__h=[],ep.__e(i,t.__v)}}}ep.__b=function(t){wf=null,ip&&ip(t)},ep.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),ap&&ap(t,e)},ep.__r=function(t){np&&np(t),_f=0;var e=(wf=t.__c).__H;e&&(kf===wf?(e.__h=[],wf.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.length&&fp(),_f=0)),kf=wf},ep.diffed=function(t){sp&&sp(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==tp.push(e)&&Sf===ep.requestAnimationFrame||((Sf=ep.requestAnimationFrame)||gp)(fp)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),kf=wf=null},ep.__c=function(t,e){e.some(function(t){try{t.__h.some(mp),t.__h=t.__h.filter(function(t){return!t.__||yp(t)})}catch(i){e.some(function(t){t.__h&&(t.__h=[])}),e=[],ep.__e(i,t.__v)}}),rp&&rp(t,e)},ep.unmount=function(t){op&&op(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.some(function(t){try{mp(t)}catch(t){e=t}}),i.__H=void 0,e&&ep.__e(e,i.__v))};var pp="function"==typeof requestAnimationFrame;function gp(t){var e,i=function(){clearTimeout(n),pp&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,35);pp&&(e=requestAnimationFrame(i))}function mp(t){var e=wf,i=t.__c;"function"==typeof i&&(t.__c=void 0,i()),wf=e}function yp(t){var e=wf;t.__c=t.__(),wf=e}function bp(t,e){return!t||t.length!==e.length||e.some(function(e,i){return e!==t[i]})}function _p(t,e){return"function"==typeof e?e(t):e}const wp="gzip-js",kp="base64",Sp="events",xp="cancelEvents",Cp="tab",$p="left",Tp="center",Ip="right",Mp="next_to_trigger",Ep="popover",Pp="widget",Rp="external_survey",Ap="open",Fp="multiple_choice",Op="single_choice",Dp="rating",Lp="end",Np="always",qp="survey shown",jp="survey dismissed",Bp="survey sent",Hp="$survey_id",zp="$survey_name",Up="$survey_iteration",Wp="$survey_iteration_start_date",Vp="$survey_last_seen_date",Gp="$survey_language",Zp="popover";function Qp(t){let e=!0;return{dispose(){if(e){e=!1;const i=t();i&&Ce(i.then)&&i.then(void 0,()=>{})}}}}const Jp=Zs("[Surveys]"),Kp="PostHog is not capturing, so a survey response cannot be recorded";function Xp(t){return Ce(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing()}function Yp(t){return!(!t.start_date||t.end_date)}function tg(t){var e;return!!(null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)}const eg=(t,e)=>`${t}${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(e)}`,ig=t=>eg("seenSurvey_",t),ng=t=>{try{const e=ig(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Jp.error("Failed to persist survey seen state",t)}},sg=[Ep,Pp,"api"],rg={ignoreConditions:!1,ignoreDelay:!1,displayType:Zp},og="logs",ag=Zs("[Stylesheet Loader]"),lg=t,ug=n,hg="#020617",cg={fontFamily:"inherit",backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:Ip,widgetType:Cp,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:hg,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},dg=[Tp,$p,Ip];function vg(t){if(t.startsWith("#")){let e=t.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(e)&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),/^[0-9A-Fa-f]{6}$/.test(e)?`rgb(${parseInt(e.slice(0,2),16)},${parseInt(e.slice(2,4),16)},${parseInt(e.slice(4,6),16)})`:"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function fg(t=cg.backgroundColor){let e;"#"===t[0]&&(e=vg(t)),t.startsWith("rgb")&&(e=t);const i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[t.toLowerCase()];if(i&&(e=vg(i)),!e)return hg;const n=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(n){const t=parseInt(n[1]),e=parseInt(n[2]),i=parseInt(n[3]);return Math.sqrt(t*t*.299+e*e*.587+i*i*.114)>127.5?hg:"white"}return hg}const pg=(t,e,i)=>{const n=Ag(t),s=ug.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=ug.createElement("div");((t,e,i)=>{const n=he(he({},cg),i),s=t.style,r=!dg.includes(n.position)||e===Pp&&(null==i?void 0:i.widgetType)===Cp;s.setProperty("--ph-survey-font-family",function(t){if("inherit"===t)return"inherit";const e='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return t?`${t}, ${e}`:`-apple-system, ${e}`}(n.fontFamily)),s.setProperty("--ph-survey-box-padding",n.boxPadding),s.setProperty("--ph-survey-max-width",n.maxWidth),s.setProperty("--ph-survey-z-index",n.zIndex),s.setProperty("--ph-survey-border-color",n.borderColor),r?(s.setProperty("--ph-survey-border-radius",n.borderRadius),s.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(s.setProperty("--ph-survey-border-bottom","none"),s.setProperty("--ph-survey-border-radius",`${n.borderRadius} ${n.borderRadius} 0 0`)),s.setProperty("--ph-survey-background-color",n.backgroundColor),s.setProperty("--ph-survey-box-shadow",n.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",n.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",n.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||fg(n.submitButtonColor)),s.setProperty("--ph-survey-rating-bg-color",n.ratingButtonColor),s.setProperty("--ph-survey-rating-active-bg-color",n.ratingButtonActiveColor),s.setProperty("--ph-survey-rating-active-text-color",fg(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||fg(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",fg(n.widgetColor)),s.setProperty("--ph-widget-z-index",n.zIndex);const o=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor);let a=o||n.inputBackground;o||"white"!==n.backgroundColor||(a="#f8f8f8"),s.setProperty("--ph-survey-input-background",a);const l=(null==i?void 0:i.inputTextColor)||fg(a);s.setProperty("--ph-survey-input-text-color",l),s.setProperty("--ph-survey-rating-text-color",l),s.setProperty("--ph-survey-scrollbar-thumb-color",n.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",n.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",n.outlineColor)})(r,t.type,t.appearance),r.className=n;const o=r.attachShadow({mode:"open"}),a=function(t){const e=((t,e,i)=>{let n=t.createElement("style");n.innerText=e;const s=(t=>{var e;return Ce(t)?t:null==t||null===(e=t.config)||void 0===e?void 0:e.prepare_external_dependency_stylesheet})(i);return s&&(n=s(n)),n||(ag.error("prepare_external_dependency_stylesheet returned null"),null)})(ug,':host{--ph-survey-font-family:-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:calc(2147480000 + 3645);--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px #00000026;--ph-survey-submit-button-color:black;--ph-survey-submit-button-text-color:white;--ph-survey-rating-bg-color:white;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:black;--ph-survey-rating-active-text-color:white;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:white;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:#3b82f6cc;--ph-survey-input-background:white;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:.6}.ph-survey{min-width:300px;width:var(--ph-survey-max-width);max-width:85%;z-index:var(--ph-survey-z-index);height:fit-content;margin:0;position:fixed;bottom:0}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;font-family:var(--ph-survey-font-family);color:var(--ph-survey-text-primary-color)}.ph-survey textarea,.ph-survey input[type=text],.ph-survey .multiple-choice-options label{color:var(--ph-survey-input-text-color);background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey textarea,.ph-survey input[type=text]{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey textarea:focus,.ph-survey textarea:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=radio]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus-visible{outline:1.5px solid var(--ph-survey-outline-color);border-color:var(--ph-survey-rating-active-bg-color);outline-offset:2px}.ph-survey textarea:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible){outline:none}.ph-survey textarea:hover:not(:focus),.ph-survey input[type=text]:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey textarea,.ph-survey input[type=text]{font-size:1rem}}.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey .form-cancel,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey label,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);color:var(--ph-widget-text-color);text-align:center;cursor:pointer;z-index:var(--ph-survey-z-index);border:none;border-radius:3px 3px 0 0;padding:10px 12px;transition:padding .2s ease-out;position:fixed}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{flex-direction:column;gap:16px;display:flex}.bottom-section{flex-direction:column;gap:8px;display:flex}.thank-you-message-header~.bottom-section,.intro-screen-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message,.intro-screen{flex-direction:column;gap:8px;display:flex}.survey-question{font-size:14px;font-weight:500}.survey-question-description{opacity:.8;padding-top:4px;font-size:13px}.survey-question-description,.thank-you-message-body,.intro-screen-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{max-width:100%;height:auto}.question-textarea-wrapper{flex-direction:column;display:flex}.survey-form{animation:.3s ease-out forwards ph-survey-fade-in}.survey-form,.thank-you-message,.intro-screen{text-align:left;width:100%;z-index:var(--ph-survey-z-index);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);background:var(--ph-survey-background-color);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);padding:var(--ph-survey-box-padding);margin:0;position:relative}.survey-form textarea,.survey-form input[type=text]{min-width:100%}.survey-form textarea:focus,.survey-form textarea:focus-visible{box-shadow:0 4px 12px #00000014}.survey-form textarea:focus:not(:focus-visible){box-shadow:none}.survey-box .question-header--empty~.multiple-choice-options,.survey-box .question-header--empty~textarea{margin-top:0}.multiple-choice-options{border:none;flex-direction:column;gap:8px;margin:0;padding:1px 0;font-size:14px;display:flex}.multiple-choice-options label,.multiple-choice-options .response-choice{color:inherit;align-items:center;gap:8px;display:flex}.multiple-choice-options label{cursor:pointer;font-size:13px}.multiple-choice-options label:hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px #00000014}.multiple-choice-options label:has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px #0000000d}.multiple-choice-options label.choice-option-open{flex-wrap:wrap}.multiple-choice-options label span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ph-survey-input-background);cursor:pointer;z-index:1;border-radius:3px;flex-shrink:0;width:1rem;height:1rem;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;position:relative}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;width:4px;height:8px;animation:.2s ease-out .1s forwards ph-survey-checkmark-reveal;left:4px;transform:rotate(45deg)scale(0)}.multiple-choice-options input[type=radio]:checked:after{background:var(--ph-survey-rating-active-text-color);border-radius:50%;width:6px;height:6px;animation:.15s ease-out 50ms forwards ph-survey-radio-reveal;top:5px;left:5px;transform:scale(0)}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{content:"";box-sizing:content-box;position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}.multiple-choice-options .choice-option-open input[type=text]::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{justify-content:space-between;display:flex}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{opacity:.5;background-color:#0000;border:none;padding:0;font-size:16px}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;grid-auto-columns:1fr;grid-auto-flow:column;display:grid;overflow:hidden}.rating-options-number .ratings-number{border-right:1px solid var(--ph-survey-border-color);text-align:center;cursor:pointer;color:var(--ph-survey-rating-text-color);border-top:none;border-bottom:none;border-left:none;font-weight:700}.rating-options-number .ratings-number:last-of-type{border-right:0}.rating-options-number .ratings-number.rating-active{background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb, var(--ph-survey-rating-active-bg-color) 14%, var(--ph-survey-rating-bg-color))}}.rating-text{opacity:.7;flex-direction:row;justify-content:space-between;font-size:11px;display:flex}.form-buttons{flex-direction:row;gap:8px;width:100%;display:flex}.form-buttons-with-back>.form-submit{flex:auto;min-width:0}.form-submit{text-align:center;cursor:pointer;user-select:none;background:var(--ph-survey-submit-button-color);color:var(--ph-survey-submit-button-text-color);border:none;border-radius:6px;min-width:100%;padding:12px;font-weight:700;box-shadow:0 2px #0000000b}.form-submit:not([disabled]):hover{transform:scale(1.02);box-shadow:0 4px 8px #0000001a}.form-submit:not([disabled]):active{transform:scale(.98);box-shadow:0 1px 2px #0000000d}.form-submit[disabled]{opacity:var(--ph-survey-disabled-button-opacity);cursor:not-allowed}.form-back{text-align:center;cursor:pointer;user-select:none;color:var(--ph-survey-text-primary-color);border:1.5px solid var(--ph-survey-border-color);background:0 0;border-radius:6px;flex:none;padding:12px 16px;font-weight:600}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{opacity:.7;margin-top:4px;font-size:12px}.form-cancel{cursor:pointer;background:#fff;border-radius:100%;padding:12px;line-height:0;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%)scale(1.1)}.footer-branding{opacity:.6;justify-content:center;align-items:center;gap:4px;font-size:11px;font-weight:500;text-decoration:none;display:flex}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{opacity:.8;font-size:14px}.intro-screen{text-align:center;animation:.3s ease-out forwards ph-survey-fade-in}.intro-screen-header{margin:10px 0 0}.intro-screen-body{opacity:.8;font-size:14px}.limit-height{scrollbar-width:thin;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);max-height:256px;overflow:hidden auto}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb:hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.ph-survey *{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg)scale(0)}50%{opacity:1;transform:rotate(45deg)scale(1.2)}to{opacity:1;transform:rotate(45deg)scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',t);return null==e||e.setAttribute("data-ph-survey-style","true"),e}(e);if(a){const t=o.querySelector("style");t&&o.removeChild(t),o.appendChild(a)}return(i||ug.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},gg=({responses:t,survey:e,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:a})=>{var l;n?Xp(n)&&(ng(e),n.capture(Bp,he(he(he({[zp]:e.name,[Hp]:e.id,[Up]:e.current_iteration,[Wp]:e.current_iteration_start_date,sessionRecordingUrl:null===(l=n.get_session_replay_url)||void 0===l?void 0:l.call(n)},sl({event:"sent",survey:e,responses:t,submissionId:i,completed:s,surveyLanguage:o,questionSnapshots:a})),r),{},{$set:{[ol(e,"responded")]:!0}})),s&&(lg.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:e.id}})),Rg(e),n.reloadFeatureFlags())):Jp.error("[survey sent] event not captured, PostHog instance not found.")},mg=(t,e,i,n)=>{var s;return he({[zp]:e.name,[Hp]:e.id,[Up]:e.current_iteration,[Wp]:e.current_iteration_start_date,sessionRecordingUrl:null===(s=n.get_session_replay_url)||void 0===s?void 0:s.call(n)},sl({event:t,survey:e,responses:null==i?void 0:i.responses,submissionId:null==i?void 0:i.surveySubmissionId,surveyLanguage:null==i?void 0:i.surveyLanguage,questionSnapshots:null==i?void 0:i.questionSnapshots}))},yg=(t,e,i,n)=>{if(!e)return void Jp.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const s=Eg(t),r=s?s.surveyLanguage:n;e.capture(jp,he(he(he({},mg("dismissed",t,s,e)),r&&{[Gp]:r}),{},{$set:{[ol(t,"dismissed")]:!0}})),Rg(t),ng(t),lg.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:t.id}}))},bg=(t,e)=>{if(!e)return void Jp.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(t=>eg("abandonedSurvey_",t))(t);try{if("true"===localStorage.getItem(i))return}catch(t){return}const n=Eg(t);if(n){try{localStorage.setItem(i,"true")}catch(t){}e.capture("survey abandoned",mg("abandoned",t,n,e),{transport:"sendBeacon"})}},_g=t=>{const e=t.map(t=>t.id);return e.every(t=>!!t)?e:void 0},wg=(t,e)=>{return(t=>t.questions.some(t=>{var e;return!!(null===(e=t.branching)||void 0===e?void 0:e.type)}))(t)?t.questions:e?null!==(i=((t,e)=>{if(!e||e.length!==t.questions.length)return null;const i=new Map(t.questions.map(t=>[t.id,t])),n=[];for(const t of e){const e=i.get(t);if(!e)return null;n.push(e)}return n})(t,e.questionOrder))&&void 0!==i?i:t.questions:t.appearance&&t.appearance.shuffleQuestions&&!t.enable_partial_responses?(n=t.questions,s=yl(t.questions),n.length===s.length&&n.every((t,e)=>t===s[e])?s.reverse():s):t.questions;var i,n,s},kg=t=>vl(t)||Pg(t),Sg=function(t){function e(t){var i,n;return this.getChildContext||(i=new Set,(n={})[e.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(t){this.props.value!=t.value&&i.forEach(function(t){t.__e=!0,Lf(t)})},this.sub=function(t){i.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){i&&i.delete(t),e&&e.call(t)}}),t.children}return e.__c="__cC"+bf++,e.__=t,e.Provider=e.__l=(e.Consumer=function(t,e){return t.children(e)}).contextType=e,e}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),xg=()=>vp(Sg),Cg=({component:t,children:e,renderAsHtml:i,style:n})=>function(t,e,i){var n,s,r,o,a=If({},t.props);for(r in t.type&&t.type.defaultProps&&(o=t.type.defaultProps),e)"key"==r?n=e[r]:"ref"==r?s=e[r]:a[r]=void 0===e[r]&&null!=o?o[r]:e[r];return arguments.length>2&&(a.children=arguments.length>3?rf.call(arguments,2):i),Pf(t.type,a,n||t.key,s||t.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:e},style:n}:{children:e,style:n});function $g(t,e){var i,n;if(!(null===(i=t.conditions)||void 0===i?void 0:i.url))return!0;const s=gr(e);if(!s)return!1;const r=[t.conditions.url],o=function(t){return null!=t?t:"icontains"}(null===(n=t.conditions)||void 0===n?void 0:n.urlMatchType);return gl[o](r,[s])}const Tg=t=>eg("inProgressSurvey_",t),Ig={},Mg=(t,e)=>{const i=Tg(t);try{localStorage.setItem(i,JSON.stringify(e)),delete Ig[i]}catch(t){Jp.error("Error setting in-progress survey state in localStorage",t),Ig[i]=e}},Eg=t=>{const e=Tg(t),i=Ig[e];if(i)return i;try{const t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch(t){Jp.error("Error getting in-progress survey state from localStorage",t)}return null},Pg=t=>{const e=Eg(t);return!Re(null==e?void 0:e.surveySubmissionId)},Rg=t=>{const e=Tg(t);delete Ig[e];try{localStorage.removeItem(e)}catch(t){Jp.error("Error clearing in-progress survey state from localStorage",t)}};function Ag(t,e=!1){const i=`PostHogSurvey-${t.id}`;return e?`.${i}`:i}function Fg(t,e=Ip,i){if(t===Rp)return{};switch(e){case"top_left":return{top:"0",left:"0",transform:"translate(30px, 30px)"};case"top_right":return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case"top_center":return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case"middle_left":return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case"middle_right":return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case"middle_center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case $p:return{left:"30px"};case Tp:return{left:"50%",transform:"translateX(-50%)"};default:return{right:t===Pp&&i===Cp?"60px":"30px"}}}var Og=0;function Dg(t,e,i,n,s,r){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)"ref"==a?o=e[a]:l[a]=e[a];var u={type:t,props:l,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Og,__i:-1,__u:0,__source:s,__self:r};if("function"==typeof t&&(o=t.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return of.vnode&&of.vnode(u),u}const Lg=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Dg("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Ng=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Dg("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),qg=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Dg("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),jg=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Dg("path",{d:"M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z"})}),Bg=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Dg("path",{d:"M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Hg=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Dg("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})}),zg=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Dg("path",{d:"M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4H6.55c-.7 0-1.36.37-1.72.97l-2.66 6.15z"})}),Ug=({fill:t="currentColor"}={})=>Dg("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:t,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[Dg("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Dg("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:t})]}),Wg=Dg("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Dg("g",{"clip-path":"url(#clip0_2415_6911)",children:[Dg("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Dg("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Dg("g",{mask:"url(#mask0_2415_6911)",children:[Dg("path",{d:"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z",fill:"#1D4AFF"}),Dg("path",{d:"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z",fill:"#F9BD2B"}),Dg("path",{d:"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z",fill:"currentColor"}),Dg("path",{d:"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z",fill:"#1D4AFF"}),Dg("path",{d:"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z",fill:"#F54E00"}),Dg("path",{d:"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z",fill:"currentColor"})]})]}),Dg("defs",{children:Dg("clipPath",{id:"clip0_2415_6911",children:Dg("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function Vg({urlParams:t}){const e=t?Object.entries(t).map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"):"";return Dg("a",{href:"https://posthog.com/surveys"+(e?`?${e}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",Wg]})}function Gg({text:e,submitDisabled:i,appearance:n,onSubmit:s,link:r,onPreviewSubmit:o,skipSubmitButton:a,canGoBack:l,onBack:u}){const{isPreviewMode:h}=vp(Sg),c=!!l&&!!u,d=!a&&Dg("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){r&&(null==t||t.open(r)),h?null==o||o():s()},children:e});return Dg("div",{className:"bottom-section",children:[c?Dg("div",{className:"form-buttons form-buttons-with-back",children:[Dg("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:n.backButtonText||"Back"}),d]}):d,!n.whiteLabel&&Dg(Vg,{urlParams:{utm_source:"survey-footer"}})]})}function Zg({question:t,forceDisableHtml:e,htmlFor:i}){return Dg("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[Dg(t.type===Ap?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&Cg({component:Ef("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!e&&"text"!==t.descriptionContentType})]})}function Qg({onClick:t}){const{isPreviewMode:e}=vp(Sg);return Dg("button",{className:"form-cancel",onClick:t,disabled:e,"aria-label":"Close survey",type:"button",children:Ug({fill:"black"})})}const Jg=t;function Kg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=vp(Sg);return hp(()=>{const t=t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),r())};return sr(Jg,"keydown",t),()=>{Jg.removeEventListener("keydown",t)}},[r]),Dg("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&Dg(Qg,{onClick:()=>r()}),Dg("h3",{className:"thank-you-message-header",children:t}),e&&Cg({component:Ef("p",{className:"thank-you-message-body"}),children:e,renderAsHtml:!n&&"text"!==i}),o&&Dg(Gg,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function Xg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:a,onPopupSurveyDismissed:l}=vp(Sg);return Dg("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&Dg(Qg,{onClick:()=>l()}),t&&Dg("h3",{className:"intro-screen-header",children:t}),e&&Cg({component:Ef("p",{className:"intro-screen-body"}),children:e,renderAsHtml:!n&&"text"!==i}),Dg(Gg,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>a(null)})]})}const Yg=t=>xe(t)&&t.every(t=>Me(t));function tm({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:a,onBack:l}){const{isPreviewMode:u}=xg(),h=cp(null),[c,d]=up(()=>Me(o)?o:""),v=null==i?void 0:i.disableAutofocus;hp(()=>{v||setTimeout(()=>{var t;u||null===(t=h.current)||void 0===t||t.focus()},100)},[u,v]);const f=`surveyQuestion${r}`,p=dp(()=>function(t,e,i){const n=t.trim();if(!i&&""===n)return"This field is required";if(""===n)return!1;if(e&&e.length>0)for(const t of e)switch(t.type){case ve:var s;if(void 0!==t.value&&t.value>n.length)return null!==(s=t.errorMessage)&&void 0!==s?s:`Please enter at least ${t.value} characters`;break;case fe:var r;if(void 0!==t.value&&n.length>t.value)return null!==(r=t.errorMessage)&&void 0!==r?r:`Please enter no more than ${t.value} characters`}return!1}(c,t.validation,t.optional),[c,t.validation,t.optional]),g=zs(t.validation,ve),m=zs(t.validation,fe),y=dp(()=>function(t,e){const i=1===t?void 0:t;return i&&e?`Enter ${i}-${e} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:e?`Maximum ${e} ${1===e?"character":"characters"}`:void 0}(g,m),[g,m]),b=()=>{p||n(c.trim())},_=()=>{p||s(c.trim())};return Dg(Rf,{children:[Dg("div",{className:"question-container",children:[Dg(Zg,{question:t,forceDisableHtml:e,htmlFor:f}),Dg("textarea",{ref:h,id:f,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:g,maxLength:m,onInput(t){d(t.currentTarget.value),t.stopPropagation()},onKeyDown(t){t.stopPropagation(),"Enter"!==t.key||!t.metaKey&&!t.ctrlKey||p||(t.preventDefault(),u?_():b())},value:c}),y&&Dg("div",{className:"validation-hint",children:y})]}),Dg(Gg,{text:t.buttonText||"Submit",submitDisabled:!!p,appearance:i,onSubmit:b,onPreviewSubmit:_,canGoBack:a,onBack:l})]})}function em({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return Dg(Rf,{children:[Dg("div",{className:"question-container",children:Dg(Zg,{question:t,forceDisableHtml:e})}),Dg(Gg,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function im({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){var u;const h=t.scale,c=10===t.scale?0:1,[d,v]=up(()=>Ae(o)?o:xe(o)&&o.length>0&&Ae(parseInt(o[0]))?parseInt(o[0]):Me(o)&&Ae(parseInt(o))?parseInt(o):null),f="emoji"===t.display&&2===t.scale,{isPreviewMode:p}=xg(),g=t=>p?r(t):s(t);return Dg(Rf,{children:[Dg("div",{className:"question-container",children:[Dg(Zg,{question:t,forceDisableHtml:e}),Dg("div",{className:"rating-section",children:[Dg("div",{className:"rating-options",children:["emoji"===t.display&&Dg("div",{className:"rating-options-emoji"+(f?" rating-options-emoji-2":""),children:null===(u=lm[t.scale])||void 0===u?void 0:u.map((e,n)=>Dg("button",{"aria-label":`Rate ${n+1}`,className:`ratings-emoji question-${i}-rating-${n} ${n+1===d?"rating-active":""}`,value:n+1,type:"button",onClick(){const e=n+1;v(e),t.skipSubmitButton&&g(e)},children:e},n))}),"number"===t.display&&Dg("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${h-c+1}, minmax(0, 1fr))`},children:um(t.scale).map((e,s)=>Dg(nm,{displayQuestionIndex:i,active:d===e,appearance:n,num:e,setActiveNumber(e){v(e),t.skipSubmitButton&&g(e)}},s))})]}),!f&&Dg("div",{className:"rating-text",children:[Dg("div",{children:t.lowerBoundLabel}),Dg("div",{children:t.upperBoundLabel})]})]})]}),Dg(Gg,{text:t.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Pe(d)&&!t.optional,appearance:n,onSubmit:()=>s(d),onPreviewSubmit:()=>r(d),skipSubmitButton:t.skipSubmitButton,canGoBack:a,onBack:l})]})}function nm({num:t,active:e,displayQuestionIndex:i,setActiveNumber:n}){return Dg("button",{"aria-label":`Rate ${t}`,className:`ratings-number question-${i}-rating-${t} ${e?"rating-active":""}`,type:"button",onClick(){n(t)},children:t})}function sm({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){const u=cp(null),h=dp(()=>(t=>{var e;if(!t.shuffleOptions)return t.choices;const i=[...t.choices],n=t.hasOpenChoice&&null!==(e=i.pop())&&void 0!==e?e:null,s=(r=i,(o=yl(i)).length>1&&r.every((t,e)=>t===o[e])?o.reverse():o);var r,o;return Pe(n)||s.push(n),s})(t),[t]),[c,d]=up(()=>((t,e)=>Me(t)||Yg(t)?t:e===Op?null:[])(o,t.type)),[v,f]=up(()=>((t,e)=>{if(Me(t)&&!e.includes(t))return{isSelected:!0,inputValue:t};if(Yg(t)){const i=t.find(t=>!e.includes(t));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,h)),{isPreviewMode:p}=xg(),g=t.type===Op,m=t.type===Fp,y=t.skipSubmitButton&&g&&!t.hasOpenChoice,b=(t,e)=>{if(e){const t=!v.isSelected;return f(e=>he(he({},e),{},{isSelected:t,inputValue:t?e.inputValue:""})),g&&d(""),void(t&&setTimeout(()=>{var t;return null===(t=u.current)||void 0===t?void 0:t.focus()},75))}if(g)return d(t),f(t=>he(he({},t),{},{isSelected:!1,inputValue:""})),void(y&&(s(t),p&&r(t)));m&&xe(c)&&(c.includes(t)?d(c.filter(e=>e!==t)):d([...c,t]))},_=t=>{t.stopPropagation();const e=t.currentTarget.value;f(t=>he(he({},t),{},{inputValue:e})),g&&d(e)},w=t=>{t.stopPropagation(),"Enter"!==t.key||k()||(t.preventDefault(),S()),"Escape"===t.key&&(t.preventDefault(),f(t=>he(he({},t),{},{isSelected:!1,inputValue:""})),g&&d(null))},k=()=>!(t.optional||!Pe(c)&&(!xe(c)||v.isSelected||0!==c.length)&&(!v.isSelected||""!==v.inputValue.trim())),S=()=>{v.isSelected&&m?xe(c)&&(p?r([...c,v.inputValue]):s([...c,v.inputValue])):p?r(c):s(c)};return Dg(Rf,{children:[Dg("div",{className:"question-container",children:[Dg(Zg,{question:t,forceDisableHtml:e}),Dg("fieldset",{className:"multiple-choice-options limit-height",children:[Dg("legend",{className:"sr-only",children:m?" Select all that apply":" Select one"}),h.map((e,n)=>{const s=!!t.hasOpenChoice&&n===t.choices.length-1,r=`surveyQuestion${i}Choice${n}`,o=`${r}Open`,a=s?v.isSelected:g?c===e:xe(c)&&c.includes(e);return Dg("label",{className:s?"choice-option-open":"",children:[Dg("div",{className:"response-choice",children:[Dg("input",{type:g?"radio":"checkbox",name:r,checked:a,onChange:()=>b(e,s),id:r,"aria-controls":o}),Dg("span",{children:s?`${e}:`:e})]}),s&&Dg("input",{type:"text",ref:u,id:o,name:`question${i}Open`,value:v.inputValue,onKeyDown:w,onInput:_,onClick(t){v.isSelected||b(e,!0),t.stopPropagation()},"aria-label":`${e} - please specify`})]},n)})]})]}),Dg(Gg,{text:t.buttonText||"Submit",submitDisabled:k(),appearance:n,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:y,canGoBack:a,onBack:l})]})}const rm=[1,2,3,4,5],om=[1,2,3,4,5,6,7],am=[0,1,2,3,4,5,6,7,8,9,10],lm={2:[Hg,zg],3:[qg,Ng,Lg],5:[jg,qg,Ng,Lg,Bg]};function um(t){switch(t){case 5:default:return rm;case 7:return om;case 10:return am}}const hm=Zs("[Surveys]");function cm(t,e,i){var n;const s=t.questions[e],r=e+1;if(!(null===(n=s.branching)||void 0===n?void 0:n.type))return e===t.questions.length-1?Lp:r;if(s.branching.type===Lp)return Lp;if("specific_question"===s.branching.type){if(Number.isInteger(s.branching.index))return s.branching.index}else if("response_based"===s.branching.type){if(s.type===Op){var o;let t=s.choices.indexOf(`${i}`);if(-1===t&&s.hasOpenChoice&&(t=s.choices.length-1),null===(o=s.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===Lp?Lp:r}}else if(s.type===Dp){var a;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const t=function(t,e){if(2===e){if(1>t||t>2)throw new Error("The response must be in range 1-2");return 1===t?"positive":"negative"}if(3===e){if(1>t||t>3)throw new Error("The response must be in range 1-3");return 1===t?"negative":2===t?"neutral":"positive"}if(5===e){if(1>t||t>5)throw new Error("The response must be in range 1-5");return t>2?3===t?"neutral":"positive":"negative"}if(7===e){if(1>t||t>7)throw new Error("The response must be in range 1-7");return t>3?4===t?"neutral":"positive":"negative"}if(10===e){if(0>t||t>10)throw new Error("The response must be in range 0-10");return t>6?t>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,s.scale);if(null===(a=s.branching)||void 0===a||null===(a=a.responseValues)||void 0===a?void 0:a.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===Lp?Lp:r}}return r}return hm.warn("Falling back to next question index due to unexpected branching type"),r}const dm=Zs("[SurveyTranslations]");function vm(t,e){const i=function(t){return function({overrideLanguage:t,storedPersonProperties:e,locale:i},n){const s=al(t);if(s)return null==n||n.info(`Using override display language: ${s}`),s;const r=function(t){return t&&"object"==typeof t&&"language"in t?al(t.language):null}(e);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=al(i);return o?(null==n||n.info(`Using detected locale: ${o}`),o):(null==n||n.info("No user language detected"),null)}({overrideLanguage:t.config.override_display_language,storedPersonProperties:Ce(t.get_property)?t.get_property(at):void 0,locale:Fl()},dm)}(e);if(!i)return dm.info("No user language detected"),{survey:t,language:null};const n=cl(t,i,dm);return{survey:n.survey,language:n.matchedKey}}const fm=t,pm=n,gm="ph:show_survey_widget",mm="PHWidgetSurveyClickListener";function ym(t,e){try{const i=t.getBoundingClientRect(),n=fm.innerHeight,s=fm.innerWidth;let r=i.left+i.width/2-e/2;r+e>s-20&&(r=s-e-20),20>r&&(r=20);const o=n-i.bottom,a=250>o&&i.top>o;return{position:"fixed",top:a?"auto":`${i.bottom+12}px`,left:`${r}px`,right:"auto",bottom:a?n-i.top+12+"px":"auto",zIndex:cg.zIndex}}catch(t){return Jp.warn("Failed to calculate trigger position:",t),null}}var bm=class{constructor(t){this.ki=new Map,this.Si=new Map,this.xi=new Map,this.Ci=new Map,this.Mi=new Set,this.Ii=null,this.Ti=!1,this.Ri=null,this.$i=null,this.Ei=null,this.Ai=!1,this.handlePageUnload=()=>{const t=this._posthog.get_property(ht);if(t)for(const e of t)Pg(e)&&bg(e,this._posthog)},this.handlePopoverSurvey=(t,e,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,a,l;if(!Xp(this._posthog))return;const{survey:u,language:h}=this.Oi(t);this.Ii=h,this.Ei=null,this.Li=e;const c=this.Pi(u,e);this.Di(c.id);const{properties:d,initialResponses:v}=null!=e?e:{},f=!(!v||0>=Object.keys(v).length)&&this.Fi(c,v,d,h);if(f&&!(null===(n=c.appearance)||void 0===n?void 0:n.displayThankYouMessage))return;this.Ni(c);let p={};if((null===(s=c.appearance)||void 0===s?void 0:s.position)===Mp&&(null===(r=c.appearance)||void 0===r?void 0:r.widgetSelector)){const t=pm.querySelector(c.appearance.widgetSelector);var g;t&&(p=ym(t,parseInt((null===(g=c.appearance)||void 0===g?void 0:g.maxWidth)||cg.maxWidth))||{})}const m=(null===(o=c.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:y}=pg(c,this._posthog);this.Ci.set(y,y.host);const b={posthog:this._posthog,survey:c,removeSurveyFromFocus:this.qi,properties:d,style:p,isSurveyCompleted:f,skipShownEvent:null==e?void 0:e.skipShownEvent,surveyLanguage:h};if(this.Ei=b,0>=m)return this.Ti=!0,Xf(Dg(xm,he({},b)),y);const _=()=>{this.Ti=!0;const{survey:i,language:n}=this.Oi(t);this.Ii=n;const s=this.Pi(i,e),r=he(he({},b),{},{survey:s,surveyLanguage:n});this.Ei=r,Xf(Dg(xm,he(he({},r),{},{survey:he(he({},s),{},{appearance:he(he({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),y)},w=()=>{if(!Xp(this._posthog)||!this.ji(c))return Jp.info(`Survey ${c.id} no longer eligible when its display delay elapsed; not displaying`),this.qi(c);_()},k=i?null===(a=this._posthog.surveys)||void 0===a||null===(a=a._surveyEventReceiver)||void 0===a||null===(l=a.getActivationTimestamp)||void 0===l?void 0:l.call(a,c.id):void 0,S=Ae(k)?Math.max(0,Date.now()-k):0,x=Math.max(0,1e3*m-S);if(0>=x)return w();const C=fm.setTimeout(()=>{this.ki.delete(c.id),w()},x);this.ki.set(c.id,C)},this.Bi=t=>{var e;const{survey:i,language:n}=this.Oi(t),{shadow:s,isNewlyCreated:r}=pg(i,this._posthog);this.Ci.set(s,s.host),(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===Cp&&this.xi.set(t.id,t),r&&Xf(Dg($m,{posthog:this._posthog,survey:i,surveyLanguage:n},t.id),s)},this.Hi=t=>{const e=this.Si.get(t);e&&(e.element.removeEventListener("click",e.listener),e.element.removeAttribute(mm),this.Si.delete(t),Jp.info(`Removed click listener for survey ${t}`))},this.zi=t=>{this.Ui(t)||(this.Wi(t),this.Hi(t.id))},this.Vi=t=>{this.Ui(t)||(this.Wi(t),this.xi.delete(t.id))},this.Ui=t=>{try{var e;const i=pm.querySelector(Ag(t,!0));return!!(null==i||null===(e=i.shadowRoot)||void 0===e?void 0:e.querySelector(".ph-survey"))}catch(t){return!1}},this.Zi=(t,e)=>{const i=pm.querySelector(e),n=this.Si.get(t.id);if(i){if(this.Bi(t),n){if(i===n.element)return;Jp.info(`Selector element changed for survey ${t.id}. Re-attaching listener.`),this.Hi(t.id)}if(!i.hasAttribute(mm)){const e=e=>{var i,n;e.stopPropagation();const s=(null===(i=t.appearance)||void 0===i?void 0:i.position)===Mp?ym(e.currentTarget,parseInt((null===(n=t.appearance)||void 0===n?void 0:n.maxWidth)||cg.maxWidth)):{};fm.dispatchEvent(new CustomEvent(gm,{detail:{surveyId:t.id,position:s}}))};sr(i,"click",e),i.setAttribute(mm,"true"),this.Si.set(t.id,{element:i,listener:e,survey:t}),Jp.info(`Attached click listener for feedback button survey ${t.id}`)}}else n&&this.zi(t)},this.renderPopover=t=>{if(!Xp(this._posthog))return;const{survey:e,language:i}=this.Oi(t),{shadow:n}=pg(e,this._posthog);this.Ci.set(n,n.host),Xf(Dg(xm,{posthog:this._posthog,survey:e,removeSurveyFromFocus:this.qi,surveyLanguage:i}),n)},this.renderSurvey=(t,e,i)=>{var n;if(!Xp(this._posthog))return;const{survey:s,language:r}=this.Oi(t);let o=!1;(null===(n=this._posthog.config)||void 0===n||null===(n=n.surveys)||void 0===n?void 0:n.prefillFromUrl)&&(o=this.Gi(s,r,i)),Xf(Dg(xm,{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.qi,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),e)},this.getActiveMatchingSurveys=(t,e=!1)=>{var i;null===(i=this._posthog)||void 0===i||null===(i=i.surveys)||void 0===i||i.getSurveys(e=>{t(e.filter(t=>this.ji(t)))},e)},this.callSurveysAndEvaluateDisplayLogic=(t=!1)=>{this.getActiveMatchingSurveys(t=>{const e=Xp(this._posthog),i=t.filter(t=>e&&(t.type===Ep||t.type===Pp)),n=new Set(i.map(t=>t.id));for(const t of Array.from(this.ki.keys()))n.has(t)||this.cancelSurvey(t);const s=this.Qi(i),r=new Set,o=new Set;s.forEach(t=>{if(t.type===Pp){var e,i,n,s;if((null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===Cp)return o.add(t.id),void this.Bi(t);"selector"===(null===(i=t.appearance)||void 0===i?void 0:i.widgetType)&&(null===(n=t.appearance)||void 0===n?void 0:n.widgetSelector)&&(r.add(t.id),this.Zi(t,null===(s=t.appearance)||void 0===s?void 0:s.widgetSelector))}Pe(this.Ji)&&t.type===Ep&&this.handlePopoverSurvey(t,void 0,{resumeDelayFromActivation:!0})}),this.Si.forEach(({survey:t})=>{r.has(t.id)||this.zi(t)}),this.xi.forEach((t,e)=>{o.has(e)||this.Vi(t)})},t)},this.Ni=t=>{Pe(this.Ji)||Jp.error(`Survey ${this.Ji} already in focus. Cannot add survey ${t.id}.`),this.Ji=t.id},this.qi=t=>{this.Ji!==t.id&&Jp.error(`Survey ${t.id} is not in focus. Cannot remove survey ${t.id}.`),this.Di(t.id),this.Ji=null,this.Ii=null,this.Ti=!1,this.Ei=null,this.Li=void 0,this.Wi(t)},this._posthog=t,this.Ji=null,this.Ri=()=>this.Ki(),sr(fm,"languagechange",this.Ri),this.$i=t.onFeatureFlags(()=>this.Ki())}Ki(){if(Pe(this.Ji))return;const t=this._posthog.get_property(ht),e=null==t?void 0:t.find(t=>t.id===this.Ji);if(!e)return;const{survey:i,language:n}=this.Oi(e);if(n===this.Ii)return;if(this.Ii=n,!this.Ti)return;const s=this.Pi(i,this.Li),{shadow:r}=pg(s,this._posthog);Xf(Dg(xm,he(he({},this.Ei),{},{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.qi,surveyLanguage:n})),r)}get Xi(){var t,e,i;return null!==(t=null===(e=(i=this._posthog).getExtension)||void 0===e?void 0:e.call(i,"featureFlags"))&&void 0!==t?t:this._posthog.featureFlags}Pi(t,e){return(null==e?void 0:e.position)||(null==e?void 0:e.selector)?he(he({},t),{},{appearance:he(he(he({},t.appearance),e.position&&{position:e.position}),e.selector&&{widgetSelector:e.selector})}):t}Di(t){const e=this.ki.get(t);e&&(clearTimeout(e),this.ki.delete(t))}cancelSurvey(t){this.ki.has(t)&&(Jp.info(`Cancelled pending survey ${t}`),this.Di(t),this.Ji===t&&(this.Ji=null,this.Ii=null,this.Ti=!1,this.Ei=null,this.Li=void 0))}clearInMemoryInProgressSurveyState(){(()=>{for(const t of Object.keys(Ig))delete Ig[t]})()}setAutomaticDisplayDispose(t){this.Yi=t}dispose(){var t;null===(t=this.Yi)||void 0===t||t.call(this),this.Yi=void 0,this.Ri&&(fm.removeEventListener("languagechange",this.Ri),this.Ri=null),this.$i&&(this.$i(),this.$i=null),this.ki.forEach((t,e)=>this.Di(e)),this.Si.forEach((t,e)=>this.Hi(e)),this.Ci.forEach((t,e)=>{Xf(null,e),null==t||t.remove()}),this.Ci.clear(),this.xi.clear(),this.Ji=null}Qi(t){return t.sort((t,e)=>{var i,n;const s=Pg(t),r=Pg(e);if(s&&!r)return-1;if(!s&&r)return 1;const o=t.schedule===Np,a=e.schedule===Np;return o&&!a?1:!o&&a?-1:((null===(i=t.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)})}Oi(t){return vm(t,this._posthog)}Gi(t,e,i){if(this.Mi.has(t.id))return!1;const{params:n}=function(t){const e={};let i=!1;const n=t.replace(/^\?/,"");if(!n)return{params:e,autoSubmit:i};const s=n.split("&");for(const t of s){const[n,s]=t.split("=");if(!n||Ie(s))continue;const r=decodeURIComponent(n),o=decodeURIComponent(s);if("auto_submit"===r&&"true"===o){i=!0;continue}const a=r.match(/^q(\d+)$/);if(a){const t=parseInt(a[1],10);e[t]||(e[t]=[]),e[t].push(o)}}return{params:e,autoSubmit:i}}(fm.location.search);if(0===Object.keys(n).length)return!1;Jp.info("[Survey Prefill] Detected URL prefill parameters");const s=this.tr(t,n,e);return!!s&&(this.er(t,s,i,e),this.Mi.add(t.id),s.isSurveyCompleted)}er(t,e,i,n){const{responses:s,submissionId:r,isSurveyCompleted:o,skippedResponses:a}=e;(Object.keys(a).length>0&&t.enable_partial_responses||o)&&gg({responses:o?s:a,survey:t,surveySubmissionId:r,posthog:this._posthog,isSurveyCompleted:o,properties:i,surveyLanguage:n})}Fi(t,e,i,n){const s={};for(const[t,i]of Object.entries(e))s[parseInt(t)]=xe(i)?i.map(String):[String(i)];Jp.info("[Survey] Processing initial responses");const r=this.tr(t,s,n);return!!r&&(this.er(t,r,i,n),r.isSurveyCompleted)}tr(t,e,i){try{const n=function(t,e){const i={};return t.questions.forEach((t,n)=>{if(!e[n]||!t.id)return;const s=e[n],r=il(t.id);try{switch(t.type){case Op:{if(!t.choices||0===t.choices.length)return void Gs.warn(`[Survey Prefill] Question ${n} has no choices`);const e=parseInt(s[0],10);if(isNaN(e)||0>e||e>=t.choices.length)return void Gs.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=t.choices[e];break}case Fp:{if(!t.choices||0===t.choices.length)return void Gs.warn(`[Survey Prefill] Question ${n} has no choices`);const e=s.map(t=>parseInt(t,10)).filter(e=>!isNaN(e)&&e>=0&&t.choices.length>e);if(0===e.length)return void Gs.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(e.map(e=>t.choices[e]))];e.length>o.length&&Gs.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case Dp:{const e=parseInt(s[0],10),o=t.scale||10;if(isNaN(e)||0>e||e>o)return void Gs.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: 0-${o})`);i[r]=e;break}default:Gs.info(`[Survey Prefill] Question type ${t.type} does not support prefill`)}}catch(t){Gs.error(`[Survey Prefill] Error converting q${n}:`,t)}}),i}(t,e);if(0===Object.keys(n).length)return Jp.warn("[Survey Prefill] No valid responses after conversion"),null;const s=Pa(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:a}=function(t,e,i){let n=0;const s={},r=[],o=t.questions.length+1;let a=0;for(;t.questions.length>n&&o>a&&(a++,e.includes(n));){const e=t.questions[n];if(!e||!("skipSubmitButton"in e)||!e.skipSubmitButton)break;if(e.id){const t=il(e.id);Ie(i[t])||(s[t]=i[t])}r.push(n);const o=cm(t,n,e.id?i[il(e.id)]:null);if(o===Lp)return{startQuestionIndex:t.questions.length,skippedResponses:s,skippedIndices:r};n=o}return{startQuestionIndex:n,skippedResponses:s,skippedIndices:r}}(t,Object.keys(e).map(t=>parseInt(t,10)),n),l=r>=t.questions.length;return Mg(t,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:_g(t.questions),visitedIndices:a,surveyLanguage:i}),Jp.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:l,skippedResponses:o}}catch(t){return Jp.error("[Survey Prefill] Error handling prefill:",t),null}}nr(t,e=void 0){if(!t)return!0;const i=this.Xi,n=!!(null==i?void 0:i.isFeatureEnabled(t,{send_event:!t.startsWith("survey-targeting-")}));let s=!0;e&&(s=(null==i?void 0:i.getFeatureFlag(t,{send_event:!1}))===e||"any"===e);const r=n&&s;return r||this.ir(t),r}ir(t){var e;!this.Ai&&(null===(e=this._posthog.config)||void 0===e?void 0:e.advanced_disable_feature_flags)&&(this.Ai=!0,Jp.warn(`Survey feature flag "${t}" evaluated to false because advanced_disable_feature_flags is set. PostHog creates an internal targeting flag for almost every survey, so no survey can display while flags are disabled. To keep surveys working, replace advanced_disable_feature_flags with advanced_only_evaluate_survey_feature_flags, which evaluates survey flags only.`))}rr(e){return!e.conditions||$g(e,this._posthog)&&function(e){var n,s;return function(e,n){var s,r,o;if(!e||0===e.length)return!0;if(!u)return!1;const a=Ki(u,{userAgentDataPlatform:null==i||null===(s=i.userAgentData)||void 0===s?void 0:s.platform,maxTouchPoints:null==i?void 0:i.maxTouchPoints,screenWidth:null==t||null===(r=t.screen)||void 0===r?void 0:r.width,screenHeight:null==t||null===(o=t.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio});return gl[null!=n?n:"icontains"](e,[a])}(null===(n=e.conditions)||void 0===n?void 0:n.deviceTypes,null===(s=e.conditions)||void 0===s?void 0:s.deviceTypesMatchType)}(e)&&function(t){var e;return!(null===(e=t.conditions)||void 0===e?void 0:e.selector)||!!(null==ug?void 0:ug.querySelector(t.conditions.selector))}(e)}sr(t){var e;return kg(t)?{satisfied:!0}:t.internal_targeting_flag_key&&function(t){var e;return"recurring"===t.schedule||(null!==(e=t.current_iteration)&&void 0!==e?e:0)>0}(t)&&!(null===(e=this.Xi)||void 0===e?void 0:e.hasLoadedFlags)?(this.ir(t.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this.nr(t.internal_targeting_flag_key)}}checkSurveyEligibility(t){var e,i;const n={eligible:!0,reason:void 0};if(!Yp(t))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${t.end_date}`,n;if(!sg.includes(t.type))return n.eligible=!1,n.reason=`Surveys of type ${t.type} are never eligible to be shown in the app`,n;const s=null===(e=t.conditions)||void 0===e?void 0:e.linkedFlagVariant;if(!this.nr(t.linked_flag_key,s))return n.eligible=!1,n.reason=s?`Survey linked feature flag is not enabled for variant ${s}`:"Survey linked feature flag is not enabled",n;if(!this.nr(t.targeting_flag_key))return n.eligible=!1,n.reason="Survey targeting feature flag is not enabled",n;const r=this.sr(t);var o;return r.satisfied?function(t,e){if(!t||!e)return!0;const i="string"==typeof e?new Date(e):e,n=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(n/864e5)>t}(null===(i=t.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays,Na.Ot("lastSeenSurveyDate"))?(t=>!!Na.Ot(ig(t))&&!kg(t))(t)?(n.eligible=!1,n.reason="Survey has already been seen and it can't be activated again",n):n:(n.eligible=!1,n.reason="Survey wait period has not passed",n):(n.eligible=!1,n.reason=null!==(o=r.reason)&&void 0!==o?o:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",n)}checkSurveyCaptureEligibility(){return Xp(this._posthog)?{eligible:!0}:{eligible:!1,reason:Kp}}checkSurveyDisplayEligibility(t){const e=this.checkSurveyCaptureEligibility();return e.eligible?this.checkSurveyEligibility(t):e}checkSurveyRenderability(t){const e=this.checkSurveyDisplayEligibility(t);return e.eligible&&!this.ar(t)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:e}ar(t){var e;if(!dl(t)&&!tg(t))return!0;const i=null===(e=this._posthog.surveys)||void 0===e||null===(e=e._surveyEventReceiver)||void 0===e?void 0:e.getSurveys();return!!(null==i?void 0:i.includes(t.id))}lr(t){var e;return!(null===(e=t.feature_flag_keys)||void 0===e?void 0:e.length)||t.feature_flag_keys.every(({key:t,value:e})=>!t||!e||this.nr(e))}ji(t){return this.checkSurveyEligibility(t).eligible&&this.rr(t)&&this.ar(t)&&this.lr(t)}Wi(t){try{const e=pm.querySelector(Ag(t,!0));(null==e?void 0:e.shadowRoot)&&(Xf(null,e.shadowRoot),this.Ci.delete(e.shadowRoot)),null==e||e.remove()}catch(e){Jp.warn(`Failed to remove survey ${t.id} from DOM:`,e)}}getTestAPI(){return{addSurveyToFocus:this.Ni,removeSurveyFromFocus:this.qi,surveyInFocus:this.Ji,surveyTimeouts:this.ki,handleWidget:this.Bi,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this.Zi,sortSurveysByAppearanceDelay:this.Qi,checkFlags:this.lr.bind(this),isSurveyFeatureFlagEnabled:this.nr.bind(this),onLanguageChange:this.Ki.bind(this),currentLanguage:this.Ii,surveyIsRendered:this.Ti}}};function _m(t,e){if(!pm||!fm)return;const i=new bm(t);if(t.config.disable_surveys_automatic_display)return Jp.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===e)return Jp.info("There are no surveys to load or Surveys is disabled in the project settings."),i;let n;i.callSurveysAndEvaluateDisplayLogic(!0);const s=()=>{Ie(n)&&(n=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{Ie(n)||(clearInterval(n),n=void 0)};s();const o=()=>{pm.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return sr(pm,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),pm.removeEventListener("visibilitychange",o)}),i}function wm({survey:t,removeSurveyFromFocus:e=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){hp(()=>{var r;if(n||!(null===(r=t.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=t.type===Pp,o=$g(t,s),a=(null===(n=t.appearance)||void 0===n?void 0:n.widgetType)===Cp&&r;if(!o)return Jp.info(`Hiding survey ${t.id} because URL does not match`),i(!1),e(t);a&&(Jp.info(`Showing survey ${t.id} because it is a feedback button tab and URL matches`),i(!0))};sr(fm,"popstate",o),sr(fm,"hashchange",o);const a=fm.history.pushState,l=fm.history.replaceState;return fm.history.pushState=function(...t){a.apply(this,t),o()},fm.history.replaceState=function(...t){l.apply(this,t),o()},()=>{fm.removeEventListener("popstate",o),fm.removeEventListener("hashchange",o),fm.history.pushState=a,fm.history.replaceState=l}},[n,t,e,i,s])}const km=200;function Sm(t="right"){switch(t){case"top":return{top:"0",left:"50%",transform:"translateX(-50%)"};case"left":return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case"bottom":return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function xm({survey:t,forceDisableHtml:e,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:a=()=>{},onPreviewBack:l=()=>{},onPopupSurveyDismissed:u=()=>{},onCloseConfirmationMessage:h=()=>{},properties:c,isSurveyCompleted:d,skipShownEvent:v,surveyLanguage:f}){var p,g,m,y,b,_,w,k,S,x,C,T;const I=cp(null),M=Number.isInteger(s),{isPopupVisible:E,isSurveySent:P,hidePopupWithAnimation:R}=function(t,e,i,n,s,r,o,a,l){const[u,h]=up(n||0===i||t.type===Rp),[c,d]=up(!1),v=cp(!1),f=()=>{const e=()=>{r&&s(t),h(!1)};if(v.current)return;const i=null==o?void 0:o.current;i?(v.current=!0,i.style.transition=`opacity ${km}ms ease-out`,i.style.opacity="0",setTimeout(()=>{v.current=!1,e()},250)):e()},p=e=>{e.detail.surveyId===t.id&&f()};return hp(()=>{if(!e)return void Jp.error("usePopupVisibility hook called without a PostHog instance.");if(n)return;let s;const r=e=>{var i,n;if(e.detail.surveyId===t.id){if(!(null===(i=t.appearance)||void 0===i?void 0:i.displayThankYouMessage))return f();d(!0),(null===(n=t.appearance)||void 0===n?void 0:n.autoDisappear)&&(s&&clearTimeout(s),s=setTimeout(f,5e3))}},o=()=>{if($g(t,e)){var i;h(!0),fm.dispatchEvent(new Event("PHSurveyShown")),a||e.capture(qp,he(he({[zp]:t.name,[Hp]:t.id,[Up]:t.current_iteration,[Wp]:t.current_iteration_start_date},l&&{[Gp]:l}),{},{sessionRecordingUrl:null===(i=e.get_session_replay_url)||void 0===i?void 0:i.call(e)}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}};sr(fm,"PHSurveyClosed",p),sr(fm,"PHSurveySent",r);const u=i>0?setTimeout(o,i):void 0;return Ie(u)&&o(),()=>{Ie(u)||clearTimeout(u),Ie(s)||clearTimeout(s),fm.removeEventListener("PHSurveyClosed",p),fm.removeEventListener("PHSurveySent",r)}},[]),wm({survey:t,removeSurveyFromFocus:s,setSurveyVisible:h,isPreviewMode:n,posthog:e}),{isPopupVisible:u,isSurveySent:c,setIsPopupVisible:h,hidePopupWithAnimation:f}}(t,i,(null===(p=t.appearance)||void 0===p?void 0:p.surveyPopupDelaySeconds)?1e3*t.appearance.surveyPopupDelaySeconds:0,M,r,o,I,v,f),A=P||s===t.questions.length||!0===d,[F,O]=up(!1),D=dp(()=>!!Eg(t),[t]),L=!(!(null===(g=t.appearance)||void 0===g?void 0:g.introScreenHeader)&&!(null===(m=t.appearance)||void 0===m?void 0:m.introScreenDescription)),N=M?-1===s:!!(null===(y=t.appearance)||void 0===y?void 0:y.displayIntroScreen)&&L&&!F&&!D,q=dp(()=>{const e=Eg(t),n=(null==e?void 0:e.surveySubmissionId)||Pa();return{isPreviewMode:M,previewPageIndex:s,onPopupSurveyDismissed(){f?yg(t,i,M,f):yg(t,i,M),u()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:a,onPreviewBack:l,posthog:i,properties:c,surveyLanguage:f}},[M,s,o,i,t,u,a,l,c,f]);return E?Dg(Sg.Provider,{value:q,children:Dg("div",{className:"ph-survey",style:he(he({},Fg(t.type,null===(b=t.appearance)||void 0===b?void 0:b.position,null===(_=t.appearance)||void 0===_?void 0:_.widgetType)),n),ref:I,children:A?Dg(Kg,{header:(null===(w=t.appearance)||void 0===w?void 0:w.thankYouMessageHeader)||"Thank you!",description:(null===(k=t.appearance)||void 0===k?void 0:k.thankYouMessageDescription)||"",forceDisableHtml:!!e,contentType:null===(S=t.appearance)||void 0===S?void 0:S.thankYouMessageDescriptionContentType,appearance:t.appearance||cg,onClose(){R(),h()}}):N?Dg(Xg,{header:(null===(x=t.appearance)||void 0===x?void 0:x.introScreenHeader)||"",description:(null===(C=t.appearance)||void 0===C?void 0:C.introScreenDescription)||"",forceDisableHtml:!!e,contentType:null===(T=t.appearance)||void 0===T?void 0:T.introScreenDescriptionContentType,appearance:t.appearance||cg,onStart:()=>O(!0)}):Dg(Cm,{survey:t,forceDisableHtml:!!e,posthog:i})})}):null}function Cm({survey:t,forceDisableHtml:e,posthog:i}){var n,s;const r=dp(()=>{const e=Eg(t);if(!e)return null;const i=Ae(e.lastQuestionIndex);return!i||i&&e.lastQuestionIndex>=0&&t.questions.length>e.lastQuestionIndex?e:(Rg(t),null)},[t]),[o,a]=up(()=>((null==r?void 0:r.responses)&&Jp.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[l,u]=up(!1),{previewPageIndex:h,onPopupSurveyDismissed:c,isPopup:d,onPreviewSubmit:v,onPreviewBack:f,surveySubmissionId:p,isPreviewMode:g,properties:m,surveyLanguage:y}=vp(Sg),[b,_]=up(()=>{const e=null==r?void 0:r.lastQuestionIndex,i=Ae(e)&&e>=0&&t.questions.length>e?e:0;return Ae(h)&&h>=0?h:i}),[w,k]=up(()=>{var e;return(null!==(e=null==r?void 0:r.visitedIndices)&&void 0!==e?e:[]).filter(e=>e>=0&&t.questions.length>e)}),[S,x]=up(()=>{var e;const i=Eg(t);return null!==(e=null==i?void 0:i.questionSnapshots)&&void 0!==e?e:{}}),C=dp(()=>_g(wg(t,r)),[t.id,r]),T=dp(()=>{if(!C||new Set(C).size!==C.length)return wg(t,r);const e=new Map(t.questions.map(t=>[t.id,t])),i=C.map(t=>e.get(t)).filter(t=>!!t);return i.length===C.length?i:t.questions},[C,t.questions,t,r]);hp(()=>{!g||Ie(h)||0>h||_(h)},[h,g]);const I=!!(null===(n=t.appearance)||void 0===n?void 0:n.allowGoBack)&&(g?(null!=h?h:0)>0:w.length>0),M=T.at(b);return M?Dg("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null===(s=t.appearance)||void 0===s?void 0:s.hideCancelButton)&&Dg(Qg,{onClick(){c()}}),Dg("div",{className:"survey-box","data-question-index":b,children:[l&&Dg("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),Tm({question:M,forceDisableHtml:e,displayQuestionIndex:b,appearance:t.appearance||cg,onSubmit:e=>(({res:e,displayQuestionIndex:n,questionId:s})=>{if(!i)return void Jp.error("onNextButtonClick called without a PostHog instance.");if(!Xp(i))return void u(!0);if(u(!1),!s)return void Jp.error("onNextButtonClick called without a questionId.");const{responses:r,questionSnapshots:l}=function({responses:t,questionSnapshots:e={}},i,n,s){return{responses:he(he({},t),{},{[il(i)]:n}),questionSnapshots:(null==s?void 0:s.id)?he(he({},e),{},{[s.id]:s.question}):e}}({responses:o,questionSnapshots:S},s,e,T[n]);a(r),x(l);const h=cm(t,n,e),c=h===Lp,d=[...w,n];if(c||(k(d),_(h),Mg(t,{surveySubmissionId:p,responses:r,lastQuestionIndex:h,questionOrder:_g(T),visitedIndices:d,surveyLanguage:y,questionSnapshots:l})),t.enable_partial_responses||c){const e=new Set(d.map(t=>{var e;return null===(e=T[t])||void 0===e?void 0:e.id}).filter(t=>!!t).map(t=>il(t))),n=Object.fromEntries(Object.entries(r).filter(([t])=>e.has(t)));gg({responses:n,survey:t,surveySubmissionId:p,isSurveyCompleted:c,posthog:i,properties:m,surveyLanguage:y,questionSnapshots:l})}})({res:e,displayQuestionIndex:b,questionId:M.id}),onPreviewSubmit:v,initialValue:M.id?o[il(M.id)]:void 0,canGoBack:I,onBack(){if(g)return void f();if(0===w.length)return;const e=w[w.length-1],i=w.slice(0,-1);k(i),_(e),Mg(t,{surveySubmissionId:p,responses:o,lastQuestionIndex:e,questionOrder:_g(T),visitedIndices:i,surveyLanguage:y,questionSnapshots:S})}})]})]}):null}function $m({survey:t,forceDisableHtml:e,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,a,l,u,h,c;const[d,v]=up(!0),[f,p]=up(!1),[g,m]=up({}),y=cp(void 0),b=()=>{(f||!i||n||Xp(i))&&p(!f)};if(hp(()=>{var e;if(!i)return void Jp.error("FeedbackWidget called without a PostHog instance.");if(n)return;"tab"===(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)&&m({top:"50%",bottom:"auto"});const s=e=>{var i;const n=e;(null===(i=n.detail)||void 0===i?void 0:i.surveyId)===t.id&&(Jp.info(`Received show event for feedback button survey ${t.id}`),m(n.detail.position||{}),b())};return sr(fm,gm,s),()=>{Ie(y.current)||(clearTimeout(y.current),y.current=void 0),fm.removeEventListener(gm,s)}},[i,n,t.id,null===(r=t.appearance)||void 0===r?void 0:r.widgetType,null===(o=t.appearance)||void 0===o?void 0:o.widgetSelector,null===(a=t.appearance)||void 0===a?void 0:a.borderColor]),wm({survey:t,setSurveyVisible:v,posthog:i}),!d)return null;const _=()=>{t.schedule!==Np&&v(!1),Ie(y.current)||clearTimeout(y.current),y.current=setTimeout(()=>{y.current=void 0,p(!1)},200)};return Dg(Rf,{children:["tab"===(null===(l=t.appearance)||void 0===l?void 0:l.widgetType)&&Dg("button",{className:"ph-survey-widget-tab "+("top"===(null===(u=t.appearance)||void 0===u?void 0:u.tabPosition)?"widget-tab-top":""),onClick:b,disabled:n,style:Sm(null===(h=t.appearance)||void 0===h?void 0:h.tabPosition),children:(null===(c=t.appearance)||void 0===c?void 0:c.widgetLabel)||""}),f&&Dg(xm,{posthog:i,survey:t,forceDisableHtml:e,style:g,onPopupSurveyDismissed:_,onCloseConfirmationMessage:_,surveyLanguage:s})]})}const Tm=({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l})=>{const u={forceDisableHtml:e,appearance:n,onPreviewSubmit(t){r(t)},onSubmit(t){s(t)},initialValue:o,displayQuestionIndex:i,canGoBack:a,onBack:l};switch(t.type){case Ap:return Ef(tm,he(he({},u),{},{question:t,key:t.id}));case"link":return Ef(em,he(he({},u),{},{question:t,key:t.id}));case Dp:return Ef(im,he(he({},u),{},{question:t,key:t.id}));case Op:case Fp:return Ef(sm,he(he({},u),{},{question:t,key:t.id}));default:return Jp.error(`Unsupported question type: ${t.type}`),null}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.generateSurveys=_m,d.extendPostHogWithSurveys=_m;const Im=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},Mm=1e4,Em=(t,e,i)=>i.remaining>0?e.length>i.remaining?(t.push(e.slice(0,i.remaining)),i.remaining=0,i.truncated=!0,!1):(t.push(e),i.remaining-=e.length,!0):(i.truncated=!0,!1),Pm=(t,e,i)=>{const n=JSON.stringify(t);if(i.remaining>=n.length)return Em(e,n,i);if(i.truncated=!0,2>i.remaining)return!1;let s=0,r=Math.min(t.length,i.remaining-2);for(;r>s;){const e=Math.ceil((s+r)/2);JSON.stringify(t.slice(0,e)).length>i.remaining?r=e-1:s=e}return Em(e,JSON.stringify(t.slice(0,s)),i)},Rm=t=>void 0!==t&&"function"!=typeof t&&"symbol"!=typeof t&&"bigint"!=typeof t,Am=(t,e,i)=>{if(!i.truncated){if(i.keysRemaining-=1,i.sizeRemaining-=String(e).length+t.length,0>=i.keysRemaining||0>=i.sizeRemaining)return i.truncated=!0,void(i.result.attributes_truncated=!0);i.result[t]=e}},Fm=(t,e,i)=>{if(!i.truncated)if($e(t)){if(i.seen.has(t))return void Am(e||"circular","[Circular]",i);i.seen.add(t);try{for(const n in t)try{if(!{}.hasOwnProperty.call(t,n))continue;if(Fm(t[n],e?`${e}.${n}`:n,i),i.truncated)return}catch(t){continue}}catch(t){}}else Am(e,t,i)},Om=(t,e,i,n,s=!1,r)=>{if(!Rm(t))return!s||Em(e,"null",i);if(Pe(t)||(t=>{try{return Ae(t)||Oe(t)}catch(t){return!1}})(t))return Em(e,JSON.stringify(t),i);if("string"==typeof t)return Pm(t,e,i);if(!$e(t)&&!xe(t))return Em(e,JSON.stringify(t),i);if(n.has(t))return Pm("[Circular]",e,i);n.add(t);try{const r=t.toJSON;if(Ce(r))return Om(r.call(t),e,i,n,s)}catch(t){}try{const n={}.toString.call(t);if("[object String]"===n)return Pm(String(t.valueOf()),e,i);if("[object Number]"===n||"[object Boolean]"===n)return Em(e,JSON.stringify(t.valueOf()),i)}catch(t){}if(t instanceof Error){const o={};try{for(const e in t)({}).hasOwnProperty.call(t,e)&&(o[e]=t[e])}catch(t){}try{o.name=t.name}catch(t){}try{o.message=t.message}catch(t){}try{o.stack=t.stack}catch(t){}return Om(o,e,i,n,s,r)}if(xe(t)){if(!Em(e,"[",i))return!1;for(let s=0;t.length>s;s++){if(s>0&&!Em(e,",",i))return!1;let r;try{r=t[s]}catch(t){r=void 0}if(!Om(r,e,i,n,!0))return!1}return Em(e,"]",i)}if(!Em(e,"{",i))return!1;let o=!0;try{for(const s in t){if(!{}.hasOwnProperty.call(t,s))continue;if(0>=i.remaining)return i.truncated=!0,!1;let a;try{a=t[s]}catch(t){continue}if(r)try{Fm(a,s,r)}catch(t){}if(!Rm(a))continue;const l=`${o?"":","}${JSON.stringify(s)}:`;if(l.length>=i.remaining)return i.truncated=!0,!1;const u=e.length,h=i.remaining,c=i.truncated;if(!Em(e,l,i))return!1;const d=e.length,v=Om(a,e,i,n,!1),f=i.truncated;if(e.length!==d){if(o=!1,!v)return!1}else if(e.length=u,i.remaining=h,i.truncated=v?c:f,!v)return!1}}catch(t){}return Em(e,"}",i)},Dm=(t,e)=>{const i=[],n={remaining:e,truncated:!1},s=$e(t[0])?{result:{},keysRemaining:50,sizeRemaining:Mm,truncated:!1,seen:new WeakSet([t[0]])}:void 0;for(let e=0;t.length>e&&(0>=e||Em(i," ",n))&&Om(t[e],i,n,new WeakSet,!1,0===e?s:void 0);e++);return{body:i.join("")+(n.truncated?"...":""),truncated:n.truncated,attributes:(null==s?void 0:s.result)||{}}},Lm={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},Nm=t=>"canCapture"in t,qm=t=>Nm(t)?t.canCapture?t.getExtension(og):void 0:t.is_capturing()?t.logs:void 0,jm=(t,e,i)=>{if(Nm(t))return void e.captureConsoleLog(i);const n=(t=>{const e=/^1\.(\d+)\.(\d+)$/.exec(t);if(!e)return;const i=Number(e[1]),n=Number(e[2]);return 392>i||i>419?void 0:410===i?n>4?n>10?void 0:"de":"le":418===i?n>3?n>10?n>14?n>17?void 0:"vi":"ci":"ui":"he":419===i?n>2?void 0:"vi":410>i?"le":"he"})(t.version),s=n?e[n]:void 0;Ce(s)&&s.call(e,i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.logs={initializeLogs(t){let e=t;const i=[],n={host:d.location.host};let s=!1;for(const t of Object.keys(Lm)){const r=i=>(...r)=>{let o=!1;try{const i=e;if(r.length>0&&!s&&i){const e=qm(i);if(e){s=!0,o=!0;const{body:a,truncated:l,attributes:u}=Dm(r,Mm),h=he(he({},n),l?{body_truncated:"true"}:{}),c={level:Lm[t],body:a,attributes:he(he({"log.source":`console.${t}`},h),u)};jm(i,e,c)}}}catch(t){}finally{o&&(s=!1),i.apply(d.console,r)}},o=d.console[t];i.push(Mv(d.console,t,t=>{const e=r(t);return e.__rrweb_original__=Im(o),e}))}return()=>{e=void 0,i.forEach(t=>t())}},replayConsoleBuffer(t,e){const i=qm(t);if(i)for(const t of e)try{var n;const{body:e,truncated:s,attributes:r}=Dm(t.args,Mm);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:Lm[t.level],body:e,attributes:he(he({"log.source":`console.${t.level}`,host:d.location.host},s?{body_truncated:"true"}:{}),r)},t.context,t.occurredAtMs)}catch(t){}}};const Bm=t=>Be(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Hm=Zs("[Error tracking]"),zm="webkit-masked-url:",Um=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Wm=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",zm],Vm=["__firefox__","__gCrWeb"];function Gm(){return new bn([new jn,new Jn,new Hn,new Bn,new Zn,new Gn,new Un,new Qn],function(t,...e){return(i,n=0)=>{const s=[],r=i.split("\n"),o=Math.min(r.length,n+1e3),a=[];for(let i=n;o>i;i++){const n=r[i];if(n.length>1024)continue;const o=Rn.test(n)?n.replace(Rn,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of e){const e=i(o,t);if(e){s.push(e);const t=Fn(s);if(t){for(let e=a.length-1;e>=0;e--){const i=a[e];if(t.start>=i.start+i.length)break;a.pop()}a.push(t)}break}}if(Nn(s,a)>=50)break}}const l=[...a].sort((t,e)=>e.start-t.start),u=l[l.length-1];if(u){const t=Dn(s,u);s.splice(u.start-t,t);for(const e of l)e.start-=t}for(const t of l)On(s,t);return a.some(t=>0===t.start&&s.length===t.length)&&function(t){const e=t.map(t=>`${t.function}|${t.filename}|${t.lineno}|${t.colno}|${t.module}`);let i=0;for(let t=1;e.length>t;t++)qn(e,t,i)&&(i=t);t.push(...t.splice(0,i))}(s),function(t){if(!t.length)return[];const e=Array.from(t);return e.reverse(),e.slice(0,50).map(t=>{return he(he({},t),{},{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||"?"});var i})}(s)}}("web:javascript",In,Pn))}const Zm=Zs("[ExceptionAutocapture]"),Qm=Gm(),Jm=(t,e)=>{try{return t()}catch(t){return e}},Km=(t,e)=>Jm(()=>t(e()),void 0),Xm=t=>Jm(()=>Ce(t)&&Ce(t.call),!1),Ym=(t,e)=>Jm(()=>{t[e].__POSTHOG_INSTRUMENTED__=!0},void 0),ty=(t,e,i)=>{Jm(()=>{var i;null===(i=t[e])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),Jm(()=>{t[e]=i},void 0)},ey=e=>{const i=t;i||Zm.info("window not available, cannot wrap onerror");const n=Jm(()=>i.onerror,void 0);return i.onerror=function(...t){var i;return Km(e,()=>Qm.buildFromUnknown((([t,e,i,n,s])=>{if(null!=s)return s;if(Me(t)&&Me(e)&&e.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:t,filename:e,lineno:i,colno:n})}catch(e){return t}return t})(t),{mechanism:{handled:!1}})),!!Xm(n)&&null!==(i=n(...t))&&void 0!==i&&i},Ym(i,"onerror"),()=>ty(i,"onerror",n)},iy=(e,i=!1)=>{const n=t;n||Zm.info("window not available, cannot wrap onUnhandledRejection");const s=Jm(()=>n.onunhandledrejection,void 0);return n.onunhandledrejection=function(t){var n;return Km(e,()=>Qm.buildFromUnknown(t,{mechanism:{handled:!1}})),Xm(s)?null!==(n=s(t))&&void 0!==n&&n:i},Ym(n,"onunhandledrejection"),()=>ty(n,"onunhandledrejection",s)},ny={wrapOnError:ey,wrapUnhandledRejection:iy,wrapConsoleError(t){const e=console;e||Zm.info("console not available, cannot wrap console.error");const i=Jm(()=>e.error,void 0);return e.error=function(...e){Jm(()=>e.length>1&&Me(e[0])&&(/^\[PostHog\.js\](?: |$)/.test(e[0])||"rrweb logger error:"===e[0]),!1)||Km(t,()=>{let t;t=1==e.length?e[0]:e.join(" ");const i=e.find(t=>t instanceof Error);return Qm.buildFromUnknown(i||t,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),Xm(i)&&i(...e)},Ym(e,"error"),()=>ty(e,"error",i)}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.errorWrappingFunctions=ny,d.posthogErrorWrappingFunctions=ny;const sy=(t,e)=>{if(!Ce(null==t?void 0:t.capture))return;const i=null==e?void 0:e.autocaptureExceptions,n=!Pe(i)&&"object"==typeof i&&xe(i.errors_to_ignore)?i.errors_to_ignore.reduce((t,e)=>{try{t.push(new RegExp(e))}catch(t){Zm.error("Ignoring invalid legacy exception exclusion rule",e,t)}return t},[]):[],s=e=>{try{var i;null===(i=t.capture)||void 0===i||i.call(t,"$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(t){Zm.error("Failed to capture exception for a legacy client",t)}};ey(t=>{n.some(e=>t.$exception_list.some(t=>e.test(t.value||"")))||s(t)}),iy(s,!0)};d.extendPostHogWithExceptionAutoCapture=sy,d.extendPostHogWithExceptionAutocapture=sy;const ry="X-POSTHOG-SESSION-ID",oy="X-POSTHOG-WINDOW-ID",ay="X-POSTHOG-DISTINCT-ID",ly=[ry,oy,ay],uy=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],hy=(t,e)=>({}.hasOwnProperty.call(t,e)),cy=t=>"object"==typeof t&&!Pe(t)||Ce(t),dy=t=>"undefined"!=typeof Request&&(t instanceof Request||"[object Request]"==={}.toString.call(t)),vy=e=>{try{var i;return dy(e)?e.url:new URL(e instanceof URL?e.toString():String(e),null==t||null===(i=t.location)||void 0===i?void 0:i.href).toString()}catch(t){return}},fy=(t,e,i,n,s)=>{let r;try{r=new URL(n).hostname}catch(t){return!1}if(!t)return!1;if(xe(t)&&!t.includes(r))return!1;let o=!1;if(i){const{sessionId:t,windowId:e}=i.checkAndGetSessionAndWindowId(!0);s.set(ry,t),s.set(oy,e),o=!0}const a=(t=>Ce(t)?t():t)(e);return a&&"$posthog_cookieless"!==a&&(s.set(ay,a),o=!0),o};d.__PosthogExtensions__=d.__PosthogExtensions__||{};const py={_patchFetch:(e,i,n)=>Mv(t,"fetch",t=>function(s,r){const o=arguments.length>1?[s,r]:[s];let a=o;try{const t=vy(s);if(t)if(dy(s)){const t=new Request(s,r);fy(e,i,n,t.url,t.headers),a=[t]}else{const o=new Headers(cy(r)?r.headers:void 0);if(fy(e,i,n,t,o)){const t=((t,e)=>{if(Ie(t)||Pe(t))return{headers:e};if(!cy(t))return;const i=t;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){const t=Object.create(i);return Object.defineProperty(t,"headers",{configurable:!0,enumerable:!0,value:e,writable:!0}),t}return new Proxy({headers:e},{get:(t,e)=>hy(t,e)?Reflect.get(t,e):Reflect.get(i,e,i),has:(t,e)=>hy(t,e)||e in i,ownKeys(t){const e=new Set(Reflect.ownKeys(t));return Reflect.ownKeys(i).forEach(t=>e.add(t)),uy.forEach(t=>{t in i&&e.add(t)}),Array.from(e)},getOwnPropertyDescriptor(t,e){const n=Reflect.getOwnPropertyDescriptor(t,e);if(n)return n;if("string"==typeof e&&uy.includes(e)&&e in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,e,i)}};const s=Reflect.getOwnPropertyDescriptor(i,e);return s?he(he({},s),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);t&&(a=[s,t])}}}catch(t){a=o}return t.apply(this,a)}),_patchXHR:(e,i,n)=>Mv(t.XMLHttpRequest.prototype,"open",t=>function(s,r,o=!0,a,l){const u=this,h=new Headers,c=vy(r);c&&fy(e,i,n,c,h);const d=t.call(u,s,r,o,a,l);return ly.forEach(t=>{const e=h.get(t);if(e)try{u.setRequestHeader(t,e)}catch(t){}}),d})};d.__PosthogExtensions__.tracingHeadersPatchFns=py,d.postHogTracingHeadersPatchFns=py,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(t){const e=this.length;let i=Math.trunc(t)||0;return 0>i&&(i+=e),0>i||i>=e?void 0:this[i]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(t,e){for(let i=this.length-1;i>=0;i--){const n=this[i];if(t.call(e,n,i,this))return n}},writable:!0,enumerable:!1,configurable:!0});var gy=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(t){var e;if(t.hadRecentInput)return;const i=this.i[0],n=this.i.at(-1);this.o&&i&&n&&1e3>t.startTime-n.startTime&&5e3>t.startTime-i.startTime?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),null===(e=this.t)||void 0===e||e.call(this,t)}};const my=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},yy=t=>{if("loading"===document.readyState)return"loading";const e=my();if(e){if(e.domInteractive>t)return"loading";if(0===e.domContentLoadedEventStart||e.domContentLoadedEventStart>t)return"dom-interactive";if(0===e.domComplete||e.domComplete>t)return"dom-content-loaded"}return"complete"},by=t=>{const e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,"")},_y=t=>{let e="";try{for(;9!==(null==t?void 0:t.nodeType);){var i;const n=t,s=n.id?"#"+n.id:[by(n),...Array.from(null!==(i=n.classList)&&void 0!==i?i:[]).sort()].join(".");if(e.length+s.length>99)return e||s;if(e=e?s+">"+e:s,n.id)break;t=n.parentNode}}catch(t){}return e},wy=new WeakMap;function ky(t,e){let i=wy.get(e);return i||(i=new WeakMap,wy.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}let Sy=-1;const xy=()=>Sy,Cy=t=>{addEventListener("pageshow",e=>{e.persisted&&(Sy=e.timeStamp,t(e))},!0)},$y=(t,e,i,n)=>{let s,r;return o=>{var a;e.value>=0&&(o||n)&&(r=e.value-(null!==(a=s)&&void 0!==a?a:0),(r||void 0===s)&&(s=e.value,e.delta=r,e.rating=((t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good")(e.value,i),t(e)))}},Ty=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},Iy=()=>{var t,e;return null!==(t=null===(e=my())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let My=-1;const Ey=new Set,Py=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Ry=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of Ey)t();isFinite(My)||(My="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",Ry,!0))}},Ay=(t=!1)=>{if(t&&(My=1/0),0>My){var e;const t=Iy(),i=document.prerendering||null===(e=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=t))||void 0===e?void 0:e.startTime;My=null!=i?i:Py(),addEventListener("visibilitychange",Ry,!0),addEventListener("prerenderingchange",Ry,!0),Cy(()=>{setTimeout(()=>{My=Py()})})}return{get firstHiddenTime(){return My},onHidden(t){Ey.add(t)}}},Fy=(t,e=-1,i,n=0,s,r,o)=>{const a=my(),l=(null==a?void 0:a.navigationId)||0;let u="navigate";return i?u=i:0>xy()?a&&(document.prerendering||Iy()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:t,value:e,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:n||l,navigationInteractionId:s,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},Oy=(t,e,i={})=>{try{const n=t.filter(t=>PerformanceObserver.supportedEntryTypes.includes(t));if(n.length>0){const t=new PerformanceObserver(t=>{queueMicrotask(()=>{const i=t.getEntries();n.length>1&&i.sort((t,e)=>t.startTime+t.duration-(e.startTime+e.duration)),e(i)})});for(const e of n)t.observe(he({type:e,buffered:!0},i));return t}}catch(t){}},Dy=t=>{var e,i;return(null===(e=globalThis.PerformanceObserver)||void 0===e||null===(e=e.supportedEntryTypes)||void 0===e?void 0:e.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&t&&t.reportSoftNavs},Ly=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},Ny=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var qy=class{constructor(){this.u=void 0}};const jy=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},By=[1800,3e3],Hy=(t,e={})=>{const i=Dy(e);jy(()=>{const n=ky(e,qy),s=Ay();let r,o=Fy("FCP");const a=Oy(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(a.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-Iy(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});a&&(r=$y(t,o,By,e.reportAllChanges),Cy(i=>{o=Fy("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,xy()),r=$y(t,o,By,e.reportAllChanges),Ty(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Oy(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&Ly(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Fy("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=$y(t,o,By,e.reportAllChanges),r(!0)})},e)})},zy=[.1,.25],Uy=t=>t.find(t=>{var e;return 1===(null===(e=t.node)||void 0===e?void 0:e.nodeType)})||t[0],Wy=(t,e={})=>{const i=ky(e=Object.assign({},e),gy),n=new WeakMap;i.t=t=>{var i;if(null==t||null===(i=t.sources)||void 0===i?void 0:i.length){const i=Uy(t.sources),o=null==i?void 0:i.node;if(o){var s,r;const t=null!==(s=null===(r=e.generateTarget)||void 0===r?void 0:r.call(e,o))&&void 0!==s?s:_y(o);n.set(i,t)}}},((t,e={})=>{const i=Ay();Hy(Ny(()=>{let n,s=Fy("CLS",0);const r=ky(e,gy),o=(i,o,a,l,u)=>{s=Fy("CLS",0,i,o,a,l,u),r.o=0,n=$y(t,s,zy,e.reportAllChanges)},a=(t=!1)=>{r.o>s.value&&(s.value=r.o,s.entries=r.i),n(t)},l=t=>{a(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.l(e):l(e);a()},h=["layout-shift"];Dy(e)&&h.push("soft-navigation");const c=Oy(h,u);c&&(n=$y(t,s,zy,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),Cy(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,xy()),Ty(n)}),setTimeout(n))}))})(e=>{t((t=>{let e={};if(t.entries.length){var i;const s=t.entries.reduce((t,e)=>t.value>e.value?t:e);if(null==s||null===(i=s.sources)||void 0===i?void 0:i.length){const t=Uy(s.sources);t&&(e={largestShiftTarget:n.get(t),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:t,largestShiftEntry:s,loadState:yy(s.startTime)})}}return Object.assign(t,{attribution:e})})(e))},e)},Vy=(t,e={})=>{const i=ky(e=Object.assign({},e),qy);Dy(e)&&(i.u=new Map),Hy(e=>{t((t=>{let e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:yy(xy())};if("soft-navigation"!==t.navigationType){if(t.entries.length){const i=my(),n=t.entries.at(-1);if(i){const s=Math.max(0,i.responseStart-(i.activationStart||0));e={timeToFirstByte:s,firstByteToFCP:t.value-s,loadState:yy(t.entries[0].startTime),navigationEntry:i,fcpEntry:n}}}}else{var n;const s=null===(n=i.u)||void 0===n?void 0:n.get(t.navigationId);s&&(e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:"complete",navigationEntry:s})}return Object.assign(t,{attribution:e})})(e))},e)};let Gy=0,Zy=1/0,Qy=0;const Jy=t=>{for(const e of t)e.interactionId&&(Zy=Math.min(Zy,e.interactionId),Qy=Math.max(Qy,e.interactionId),Gy=Qy?(Qy-Zy)/7+1:0)};let Ky;const Xy=()=>{var t;return Ky?Gy:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var Yy=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return Xy()-this.h}D(){this.h=Xy(),this.v.length=0,this.p.clear()}S(t){const e=this.T(),i=Math.min(this.v.length-1,Math.floor(e/50));return!e||-1!==i||"soft-navigation"!==t&&"back-forward-cache"!==t?this.v[i]:{k:8,id:-1,entries:[]}}l(t){var e;if(null===(e=this.m)||void 0===e||e.call(this,t),!t.interactionId)return;const i=this.v.at(-1);let n=this.p.get(t.interactionId);if(n||10>this.v.length||t.duration>i.k){var s;if(n?t.duration>n.k?(n.entries=[t],n.k=t.duration):t.duration===n.k&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],k:t.duration},this.p.set(n.id,n),this.v.push(n)),this.v.sort((t,e)=>e.k-t.k),this.v.length>10){const t=this.v.splice(10);for(const e of t)this.p.delete(e.id)}null===(s=this.M)||void 0===s||s.call(this,n)}}};const tb=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=Ny(t);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:e})}},eb=[200,500],ib=(t,e={})=>{const i=ky(e=Object.assign({},e),Yy);let n=[],s=[],r=0;const o=new WeakMap,a=new WeakMap;let l=!1;const u=()=>{l||(tb(h),l=!0)},h=()=>{const t=new Set(i.v.map(t=>o.get(t.entries[0]))),e=s.length-10;s=s.filter((i,n)=>n>=e||t.has(i));const a=new Set;for(const t of s){const e=c(t.startTime,t.processingEnd);for(const t of e)a.add(t)}n=n.filter(t=>t.startTime>r||a.has(t)),l=!1};i.m=t=>{const i=t.startTime+t.duration;let n;r=Math.max(r,t.processingEnd);for(let r=s.length-1;r>=0;r--){const o=s[r];if(8>=Math.abs(i-o.renderTime)){n=o,n.startTime=Math.min(t.startTime,n.startTime),n.processingStart=Math.min(t.processingStart,n.processingStart),n.processingEnd=Math.max(t.processingEnd,n.processingEnd),e.includeProcessedEventEntries&&n.entries.push(t);break}}n||(n={startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,renderTime:i,entries:e.includeProcessedEventEntries?[t]:[]},s.push(n)),t.interactionId&&o.set(t,n),u()},i.M=t=>{if(!a.get(t)){var i;const o=null===(i=t.entries.find(t=>t.target))||void 0===i?void 0:i.target;if(o){var n,s;const i=null!==(n=null===(s=e.generateTarget)||void 0===s?void 0:s.call(e,o))&&void 0!==n?n:_y(o);a.set(t,i)}else{var r;const e=null===(r=t.entries.find(t=>t.targetSelector))||void 0===r?void 0:r.targetSelector;e&&a.set(t,e)}}};const c=(t,e)=>{const i=[];for(const s of n)if(s.startTime+s.duration>=t){if(s.startTime>e)break;i.push(s)}return i};Oy(["long-animation-frame"],t=>{n=n.concat(t),u()},e),((t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Ay();jy(()=>{var n;"interactionCount"in performance||Ky||(Ky=Oy(["event"],Jy,{durationThreshold:0}));let s,r=Fy("INP");const o=ky(e,Yy),a=(i,n,a,l,u)=>{o.D(),r=Fy("INP",-1,i,n,a,l,u),s=$y(t,r,eb,e.reportAllChanges)},l=()=>{const t=o.S(r.navigationType);t&&t.k!==r.value&&(r.value=t.k,r.entries=t.entries,s())},u=t=>{l(),s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},h=(t,e=!1)=>{tb(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.l(e):u(e);l(),e&&s(!0)})},c=["event","first-input"];Dy(e)&&c.push("soft-navigation");const d=Oy(c,h,he(he({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=$y(t,r,eb,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),Cy(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,xy())}))})})(e=>{t((t=>{if(0===t.entries.length){const e={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:t.value,loadState:yy(t.navigationStartTime||0)};return Object.assign(t,{attribution:e})}const e=t.entries[0],n=o.get(e),s=Math.max(n.processingStart,e.startTime),r=Math.max(e.startTime+e.duration,s),l=Math.min(n.processingEnd,r),u=n.entries.sort((t,e)=>t.processingStart-e.processingStart),h=c(e.startTime,l),d=i.p.get(e.interactionId),v={interactionTarget:a.get(d),interactionType:e.name.startsWith("key")?"keyboard":"pointer",interactionTime:e.startTime,nextPaintTime:r,processedEventEntries:u,longAnimationFrameEntries:h,inputDelay:s-e.startTime,processingDuration:l-s,presentationDelay:r-l,loadState:yy(e.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(t=>{var e;const i=t.interactionTime,n=t.nextPaintTime;if(!(null===(e=t.longAnimationFrameEntries)||void 0===e?void 0:e.length)||!i||!n)return;const s=t.inputDelay,r=t.processingDuration;let o,a,l=0,u=0,h=0,c=0;for(const e of t.longAnimationFrameEntries){u=u+e.startTime+e.duration-e.styleAndLayoutStart;for(const t of e.scripts){const e=t.startTime+t.duration;if(i>e)continue;const n=e-Math.max(i,t.startTime),h=t.duration?n/t.duration*t.forcedStyleAndLayoutDuration:0;l+=n-h,u+=h,n>c&&(a=i+s>t.startTime?"input-delay":i+s+r>t.startTime?"processing-duration":"presentation-delay",o=t,c=n)}}const d=t.longAnimationFrameEntries.at(-1),v=d?d.startTime+d.duration:0;v>=i+s+r&&(h=n-v),o&&a&&(t.longestScript={entry:o,subpart:a,intersectingDuration:c}),t.totalScriptDuration=l,t.totalStyleAndLayoutDuration=u,t.totalPaintDuration=h,t.totalUnattributedDuration=n-i-l-u-h})(v),Object.assign(t,{attribution:v})})(e))},e)};var nb=class{constructor(){this.m=void 0,this.u=void 0}l(t){var e;null===(e=this.m)||void 0===e||e.call(this,t)}};const $=[2500,4e3];let sb=50;const rb=[];Oy(["resource"],t=>{for(const e of t)rb.push(e),rb.length>sb&&rb.shift()});const ob=(t,e={})=>{null!=(e=Object.assign({},e)).resourceBufferSize&&(sb=e.resourceBufferSize);const i=ky(e,nb),n=new WeakMap;Dy(e)&&(i.u=new Map),i.m=t=>{const i=t.element;if(i){var s,r;const o=null!==(s=null===(r=e.generateTarget)||void 0===r?void 0:r.call(e,i))&&void 0!==s?s:_y(i);n.set(t,o)}else t.id&&n.set(t,`#${t.id}`)},((t,e={})=>{let i=!1;const n=Dy(e);jy(()=>{let s,r=Ay(),o=Fy("LCP");const a=ky(e,nb),l=(n,a,l,u,h)=>{o=Fy("LCP",-1,n,a,l,u,h),s=$y(t,o,$,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=Ay(!0))},u=t=>{var e;a.u&&t.navigationId&&Ly(a.u,t),i||s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&h([n])},h=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],l=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-Iy(),0),a.l(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;l=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(l-e.startTime,0),s.largestContentfulPaint&&(a.l(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=t,o.entries=n,s())}},c=["largest-contentful-paint"];n&&c.push("interaction-contentful-paint","soft-navigation");const d=Oy(c,h);if(d){s=$y(t,o,$,e.reportAllChanges);const r=["keydown","click","visibilitychange"],a=t=>{if(t.isTrusted&&!i){const t=o.id;tb(()=>{if(!i){if(!n){d.disconnect();for(const t of r)removeEventListener(t,a,{capture:!0})}t===o.id&&(i=!0,s(!0))}})}};for(const t of r)addEventListener(t,a,{capture:!0});Cy(n=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,xy()),s=$y(t,o,$,e.reportAllChanges),Ty(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})})(e=>{t((t=>{let e={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:t.value};if(t.entries.length){var s,r,o;const a=t.entries.at(-1),l=a.url&&(rb.findLast(t=>t.name===a.url)||performance.getEntriesByType("resource").findLast(t=>t.name===a.url));let u;e.target=n.get(a),e.lcpEntry=a,a.url&&(e.url=a.url),l&&(e.lcpResourceEntry=l);let h=0,c=0;if("soft-navigation"!==t.navigationType?(u=my(),h=null!==(s=null==u?void 0:u.activationStart)&&void 0!==s?s:0,c=null!==(r=null==u?void 0:u.responseStart)&&void 0!==r?r:0):(h=t.navigationStartTime||0,u=null===(o=i.u)||void 0===o?void 0:o.get(t.navigationId)),u){const i=Math.max(0,c-h),n=Math.max(i,l?(l.requestStart||l.startTime)-h:0),s=Math.min(t.value,Math.max(n,l?l.responseEnd-h:0));e=he(he({},e),{},{timeToFirstByte:i,resourceLoadDelay:n-i,resourceLoadDuration:s-n,elementRenderDelay:t.value-s,navigationEntry:u})}}return Object.assign(t,{attribution:e})})(e))},e)};let ab=-1;const lb=()=>ab,ub=t=>{addEventListener("pageshow",e=>{e.persisted&&(ab=e.timeStamp,t(e))},!0)},hb=(t,e,i,n)=>{let s,r;return o=>{var a;e.value>=0&&(o||n)&&(r=e.value-(null!==(a=s)&&void 0!==a?a:0),(r||void 0===s)&&(s=e.value,e.delta=r,e.rating=((t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good")(e.value,i),t(e)))}},cb=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},db=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},vb=()=>{var t,e;return null!==(t=null===(e=db())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let fb=-1;const pb=new Set,gb=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,mb=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of pb)t();isFinite(fb)||(fb="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",mb,!0))}},yb=(t=!1)=>{if(t&&(fb=1/0),0>fb){var e;const t=vb(),i=document.prerendering||null===(e=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=t))||void 0===e?void 0:e.startTime;fb=null!=i?i:gb(),addEventListener("visibilitychange",mb,!0),addEventListener("prerenderingchange",mb,!0),ub(()=>{setTimeout(()=>{fb=gb()})})}return{get firstHiddenTime(){return fb},onHidden(t){pb.add(t)}}},bb=(t,e=-1,i,n=0,s,r,o)=>{const a=db(),l=(null==a?void 0:a.navigationId)||0;let u="navigate";return i?u=i:0>lb()?a&&(document.prerendering||vb()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:t,value:e,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:n||l,navigationInteractionId:s,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},_b=new WeakMap;function wb(t,e){let i=_b.get(e);return i||(i=new WeakMap,_b.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}var kb=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(t){var e;if(t.hadRecentInput)return;const i=this.o[0],n=this.o.at(-1);this.i&&i&&n&&1e3>t.startTime-n.startTime&&5e3>t.startTime-i.startTime?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),null===(e=this.t)||void 0===e||e.call(this,t)}};const Sb=(t,e,i={})=>{try{const n=t.filter(t=>PerformanceObserver.supportedEntryTypes.includes(t));if(n.length>0){const t=new PerformanceObserver(t=>{queueMicrotask(()=>{const i=t.getEntries();n.length>1&&i.sort((t,e)=>t.startTime+t.duration-(e.startTime+e.duration)),e(i)})});for(const e of n)t.observe(he({type:e,buffered:!0},i));return t}}catch(t){}},xb=t=>{var e,i;return(null===(e=globalThis.PerformanceObserver)||void 0===e||null===(e=e.supportedEntryTypes)||void 0===e?void 0:e.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&t&&t.reportSoftNavs},Cb=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},$b=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var Tb=class{constructor(){this.l=void 0}};const Ib=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},Mb=[1800,3e3],Eb=(t,e={})=>{const i=xb(e);Ib(()=>{const n=wb(e,Tb),s=yb();let r,o=bb("FCP");const a=Sb(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(a.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-vb(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});a&&(r=hb(t,o,Mb,e.reportAllChanges),ub(i=>{o=bb("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,lb()),r=hb(t,o,Mb,e.reportAllChanges),cb(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Sb(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&Cb(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=bb("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=hb(t,o,Mb,e.reportAllChanges),r(!0)})},e)})},Pb=[.1,.25],Rb=(t,e={})=>{const i=yb();Eb($b(()=>{let n,s=bb("CLS",0);const r=wb(e,kb),o=(i,o,a,l,u)=>{s=bb("CLS",0,i,o,a,l,u),r.i=0,n=hb(t,s,Pb,e.reportAllChanges)},a=(t=!1)=>{r.i>s.value&&(s.value=r.i,s.entries=r.o),n(t)},l=t=>{a(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.h(e):l(e);a()},h=["layout-shift"];xb(e)&&h.push("soft-navigation");const c=Sb(h,u);c&&(n=hb(t,s,Pb,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),ub(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,lb()),cb(n)}),setTimeout(n))}))};let Ab=0,Fb=1/0,Ob=0;const Db=t=>{for(const e of t)e.interactionId&&(Fb=Math.min(Fb,e.interactionId),Ob=Math.max(Ob,e.interactionId),Ab=Ob?(Ob-Fb)/7+1:0)};let Lb;const Nb=()=>{var t;return Lb?Ab:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var qb=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return Nb()-this.u}M(){this.u=Nb(),this.v.length=0,this.m.clear()}L(t){const e=this._(),i=Math.min(this.v.length-1,Math.floor(e/50));return!e||-1!==i||"soft-navigation"!==t&&"back-forward-cache"!==t?this.v[i]:{P:8,id:-1,entries:[]}}h(t){var e;if(null===(e=this.p)||void 0===e||e.call(this,t),!t.interactionId)return;const i=this.v.at(-1);let n=this.m.get(t.interactionId);if(n||10>this.v.length||t.duration>i.P){var s;if(n?t.duration>n.P?(n.entries=[t],n.P=t.duration):t.duration===n.P&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],P:t.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((t,e)=>e.P-t.P),this.v.length>10){const t=this.v.splice(10);for(const e of t)this.m.delete(e.id)}null===(s=this.T)||void 0===s||s.call(this,n)}}};const jb=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=$b(t);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:e})}},Bb=[200,500],Hb=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=yb();Ib(()=>{var n;"interactionCount"in performance||Lb||(Lb=Sb(["event"],Db,{durationThreshold:0}));let s,r=bb("INP");const o=wb(e,qb),a=(i,n,a,l,u)=>{o.M(),r=bb("INP",-1,i,n,a,l,u),s=hb(t,r,Bb,e.reportAllChanges)},l=()=>{const t=o.L(r.navigationType);t&&t.P!==r.value&&(r.value=t.P,r.entries=t.entries,s())},u=t=>{l(),s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},h=(t,e=!1)=>{jb(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.h(e):u(e);l(),e&&s(!0)})},c=["event","first-input"];xb(e)&&c.push("soft-navigation");const d=Sb(c,h,he(he({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=hb(t,r,Bb,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),ub(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,lb())}))})};var zb=class{constructor(){this.p=void 0,this.l=void 0}h(t){var e;null===(e=this.p)||void 0===e||e.call(this,t)}};const Ub=[2500,4e3],Wb=(t,e={})=>{let i=!1;const n=xb(e);Ib(()=>{let s,r=yb(),o=bb("LCP");const a=wb(e,zb),l=(n,a,l,u,h)=>{o=bb("LCP",-1,n,a,l,u,h),s=hb(t,o,Ub,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=yb(!0))},u=t=>{var e;a.l&&t.navigationId&&Cb(a.l,t),i||s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&h([n])},h=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],l=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-vb(),0),a.h(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;l=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(l-e.startTime,0),s.largestContentfulPaint&&(a.h(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=t,o.entries=n,s())}},c=["largest-contentful-paint"];n&&c.push("interaction-contentful-paint","soft-navigation");const d=Sb(c,h);if(d){s=hb(t,o,Ub,e.reportAllChanges);const r=["keydown","click","visibilitychange"],a=t=>{if(t.isTrusted&&!i){const t=o.id;jb(()=>{if(!i){if(!n){d.disconnect();for(const t of r)removeEventListener(t,a,{capture:!0})}t===o.id&&(i=!0,s(!0))}})}};for(const t of r)addEventListener(t,a,{capture:!0});ub(n=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,lb()),s=hb(t,o,Ub,e.reportAllChanges),cb(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},Vb={onLCP:ob,onCLS:Wy,onFCP:Vy,onINP:ib,withoutAttribution:{onLCP:Wb,onCLS:Rb,onFCP:Eb,onINP:Hb}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=Vb,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Vb,d.postHogWebVitalsCallbacks=Vb;const Gb={onLCP:Wb,onCLS:Rb,onFCP:Eb,onINP:Hb};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=Gb,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Gb,d.postHogWebVitalsCallbacks=Gb,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Gb;const Zb={onLCP:ob,onCLS:Wy,onFCP:Vy,onINP:ib,withoutAttribution:{onLCP:Wb,onCLS:Rb,onFCP:Eb,onINP:Hb}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=Zb,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Zb,d.postHogWebVitalsCallbacks=Zb;const Qb={onLCP:Wb,onCLS:Rb,onFCP:Eb,onINP:Hb};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=Qb,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Qb,d.postHogWebVitalsCallbacks=Qb,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Qb;var Jb=class{constructor(t){this.disabled=!1===t;const e=$e(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;const n=this.clicks[this.clicks.length-1];if(n&&Math.abs(t-n.x)+Math.abs(e-n.y)<this.thresholdPx&&this.timeoutMs>i-n.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}};const Kb="$copy_autocapture",Xb=Zs("[AutoCapture]");function Yb(t,e){return e.length>t?e.slice(0,t)+"...":e}function t_(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!yr(e));return e}function e_(e,{e:i,maskAllElementAttributes:n,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:a}){var l,u;if(!yr(e))return{props:{}};const h=[e],c=new Set([e]);let d=e;for(;d.parentNode&&!br(d,"body")&&1e3>h.length;){if(wr(d.parentNode)){const t=d.parentNode.host;if(c.has(t))break;c.add(t),h.push(t),d=t;continue}if(!yr(d.parentNode))break;if(c.has(d.parentNode))break;c.add(d.parentNode),h.push(d.parentNode),d=d.parentNode}const v="click"===i.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?h.findIndex(t=>br(t,"button")||br(t,"a")):-1;v>0&&(s=s||h.slice(0,v+1).some(t=>!zr(t)||Ur(t)));const f=[],p={};let g,m=!1,y=!1;if(Js(h,t=>{const e=zr(t);if(br(t,"a")&&!n&&!(null==r?void 0:r.includes("href"))){const i=t.getAttribute("href");m=!!(e&&i&&Xr(i))&&(a?hn(i):i)}me(xr(t),"ph-no-capture")&&(y=!0),f.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};Ir.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?Yb(1024,Yr(t)):Yb(1024,$r(t)));const a=xr(t);e||(null==n?void 0:n.includes("class"))||0>=a.length||(o.classes=a.filter(function(t){return""!==t})),Js(t.attributes,function(i){var r;if((!Ur(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&Xr(i.value)&&(!Me(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=kr(t).join(" ")),o["attr__"+i.name]=Yb(1024,"href"===i.name&&s?hn(t):t)}});let l=1,u=1,h=t;for(;h=t_(h);)l++,h.tagName===t.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(t,n,s,r,a)),Js(function(t){if(!zr(t))return{};const e={};return Js(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const i=t.name.replace("data-ph-capture-attribute-",""),n=t.value;i&&n&&Xr(n)&&(e[i]=n)}}),e}(t),(t,e)=>{({}).hasOwnProperty.call(p,e)||(p[e]=t)})}),y)return{props:{},explicitNoCapture:y};if(v>0&&(e=h[v],f.splice(0,v)),s||(f[0].$el_text=br(e,"a")||br(e,"button")?Yr(e):$r(e)),m){var b,_;f[0].attr__href=m;const e=null===(b=lr(m))||void 0===b?void 0:b.host,i=null==t||null===(_=t.location)||void 0===_?void 0:_.host;e&&i&&e!==i&&(g=m)}return{props:Ks((k=i.type,{$event_type:k,$ce_version:1}),o?{}:{$elements:f},{$elements_chain:(w=f,xe(w)?function(t){return t.map(t=>{var e,i;let n="";if(t.tag_name&&(n+=t.tag_name),t.attr_class){t.attr_class.sort();for(const e of t.attr_class)n+=`.${e.replace(/"/g,"")}`}const s=he(he(he(he({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return Xs(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[eo(t.toString())]=eo(e.toString())),n+=":",n+=Xs(r).map(([t,e])=>`${t}="${e}"`).join(""),n}).join(";")}(function(t){return t.map(t=>{var e,i;const n={text:null===(e=t.$el_text)||void 0===e?void 0:e.slice(0,400),tag_name:t.tag_name,href:null===(i=t.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:io(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Xs(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,e])=>n.attributes[t]=e),n})}(w)):"")},(null===(l=f[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(u=f[0])||void 0===u?void 0:u.$el_text}:{},g&&"click"===i.type?{$external_click_url:g}:{},p),target:e};var w,k}var i_=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(t){var e;if(!zr(t))return!0;const i=null!==(e=this.bo().css_selector_ignorelist)&&void 0!==e?e:Rr,n=new Set;let s=t;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const t=s,e=xr(t);if(me(e,"ph-no-capture")||me(e,"ph-sensitive")||Ur(t)||i.some(e=>Mr(t,e)))return!0;const r=s.parentNode;s=wr(r)?r.host:r&&yr(r)?r:null}return!1}_o(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.fo();if("pointerdown"===t.type){this.fo();const i=Tr(t);var e;return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&i&&yr(i)&&(this.po={target:i,excluded:this.yo(i),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(e=this.wo)||void 0===e?void 0:e.distinctId}))}const i=this.po;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.fo():"pointerup"===t.type&&(i.released=!0,this.mo=setTimeout(()=>this.fo(),0)))}ko(t){var e;const i=this.po;this.fo();const s=Tr(t);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(e=this.wo)||void 0===e?void 0:e.distinctId)&&t.pointerId===i.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-i.x)&&5>=Math.abs(t.clientY-i.y)&&s&&(br(s,"html")||br(s,"body"))){var r;if(i.excluded)return null;const t=null!==(r=this.bo().css_selector_ignorelist)&&void 0!==r?r:Rr;return[s,null==n?void 0:n.documentElement,null==n?void 0:n.body].some(e=>{if(!e)return!1;const i=xr(e);return me(i,"ph-no-capture")||me(i,"ph-sensitive")||!zr(e)||Ur(e)||t.some(t=>Mr(e,t))})?null:i.target}}constructor(t){this.So=t,this.name="autocapture",this.xo=!1,this.Co=null,this.$o=!1,this.To=!1,this.Rr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Io=!1,this.So.refresh(this.Rr),this.rageclicks=new Jb(this.Rr.rageclick),this.Mo=null}setup(t){this.Eo(),this.wo=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Io?e.dispose():(this.Po=e,this.startIfEnabled())}dispose(){var t;this.Io||(this.Io=!0,this.wo=void 0,null===(t=this.Po)||void 0===t||t.dispose(),this.Po=void 0,this.Ro())}bo(){return this.So.refresh(this.Rr),this.Rr}Eo(){var t,e;return this.bo(),this.Rr.url_allowlist=null===(t=this.Rr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Rr.url_ignorelist=null===(e=this.Rr.url_ignorelist)||void 0===e?void 0:e.map(t=>new RegExp(t)),this.Rr}Ao(){if(!this.isBrowserSupported())return void Xb.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!n)return;const e=this.Fo=e=>{e=e||(null==t?void 0:t.event);try{if("blur"===e.type)return void this.fo();if(0===e.type.indexOf("pointer"))return void this._o(e);const t="click"===e.type?this.ko(e):void 0;if(Pe(t))return;this.Oo(e,"$autocapture",t)}catch(t){Xb.error("Failed to capture event",t)}};if(sr(t,"blur",e),sr(n,"submit",e,{capture:!0}),sr(n,"change",e,{capture:!0}),sr(n,"click",e,{capture:!0}),Js(["pointerdown","pointermove","pointerup","pointercancel"],t=>{sr(n,t,e,{capture:!0})}),this.bo().capture_copied_text){const e=this.Do=e=>{e=e||(null==t?void 0:t.event);try{this.Oo(e,Kb)}catch(t){Xb.error("Failed to capture clipboard event",t)}};sr(n,"copy",e,{capture:!0}),sr(n,"cut",e,{capture:!0}),sr(n,"paste",e,{capture:!0})}}Ro(){this.fo(),this.Fo&&(null==t||t.removeEventListener("blur",this.Fo),Js(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==n||n.removeEventListener(t,this.Fo,!0)}),null==n||n.removeEventListener("submit",this.Fo,!0),null==n||n.removeEventListener("change",this.Fo,!0),null==n||n.removeEventListener("click",this.Fo,!0),this.Fo=void 0),this.Do&&(null==n||n.removeEventListener("copy",this.Do,!0),null==n||n.removeEventListener("cut",this.Do,!0),null==n||n.removeEventListener("paste",this.Do,!0),this.Do=void 0),this.xo=!1}startIfEnabled(){this.isEnabled||this.fo(),!this.Io&&this.wo&&this.isEnabled&&!this.xo&&(this.Ao(),this.xo=!0)}onRemoteConfig(t){if(this.Io)return;if(this.$o=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.To=e.elementsChainAsString);const i=e.autocapture_opt_out;var n;Oe(i)&&(null===(n=this.wo)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this.Co=i),this.startIfEnabled()}setElementSelectors(t){this.Mo=t}getElementSelectors(t,e){var i;const s=[];return null===(i=this.Mo)||void 0===i||i.forEach(i=>{const r=null==n?void 0:n.querySelectorAll(i);null==r||r.forEach(n=>{t!==n&&e!==n||me(s,i)||s.push(i)})}),s}get isEnabled(){var t,e;if(this.Io)return!1;const i=null===(t=this.wo)||void 0===t?void 0:t.kv.get(x),n=this.Co,s=this.bo();if(!s.remoteRequestsDisabled&&!this.$o)return!1;const r=s.remoteRequestsDisabled&&!this.$o;if(Pe(n)&&!Oe(i)&&!r)return!1;const o=null!==(e=this.Co)&&void 0!==e?e:!!i;return!!s.enabled&&!o}Oo(e,i="$autocapture",n){if(!this.isEnabled)return void this.fo();let s=n||Tr(e);_r(s)&&(s=s.parentNode||null);const r=this.Eo();var o;"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&jr(s,r.rageclick)&&this.Oo(e,"$rageclick",n);const a=i===Kb,l=a?he(he({},r),{},{dom_event_allowlist:void 0}):r;if(s&&function(e,i,n,s,r,o){var a;if(!t||Br(e))return!1;if((null==n?void 0:n.url_allowlist)&&!Sr(n.url_allowlist,o))return!1;if((null==n?void 0:n.url_ignorelist)&&Sr(n.url_ignorelist,o))return!1;if(null==n?void 0:n.dom_event_allowlist){const t=n.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:l,targetElementList:u}=Hr(e,s);if(!function(t,e){const i=null==e?void 0:e.element_allowlist;if(Ie(i))return!0;for(const e of t)if(i.some(t=>e.tagName.toLowerCase()===t))return!0;return!1}(u,n))return!1;if(!Er(u,null==n?void 0:n.css_selector_allowlist))return!1;if(Er(u,null!==(a=null==n?void 0:n.css_selector_ignorelist)&&void 0!==a?a:Rr))return!1;try{const n=t.getComputedStyle(e);if(n&&"pointer"===n.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(r||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(i.type)>=0;default:return l?(r||["click"]).indexOf(i.type)>=0:(r||["click"]).indexOf(i.type)>=0&&(Ir.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var u;const{props:n,explicitNoCapture:o,target:a}=e_(s,{e:e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const l=this.getElementSelectors(s,a);if(l&&l.length>0&&(n.$element_selectors=l),i===Kb){const i=e.type||"clipboard";if("paste"!==i){var h,c;const e=null==t||null===(h=t.getSelection())||void 0===h?void 0:h.toString(),i=Cr(e);if(!i)return!1;n.$selected_content=i,n.$clipboard_text_length=null!==(c=null==e?void 0:e.length)&&void 0!==c?c:0}n.$copy_type=i}return null===(u=this.wo)||void 0===u||u.capture(i,n),!0}}isBrowserSupported(){return Ce(null==n?void 0:n.querySelectorAll)}};const n_={};function s_(t,e){const i=Tr(t);return i?he({node:i,originalEvent:t,timestamp:Date.now()},e):null}function r_(t){return!!cn(()=>yr(t))}function o_(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function a_(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const l_="canvas,video,audio,embed,object";function u_(t,e){return Ae(t)&&t>=e}function h_(t,e=1e3){return t>=0&&e>t?t:void 0}function c_(t,e,i=1e3){return Ae(e)?h_(t-e,i):void 0}var d_=class{dr(t){var e,i,n,s,r,o,a,l;const u=this.hr((null==t?void 0:t.__onCapture)||this.vr.bind(this));return{element_attribute_ignorelist:null!==(e=null==t?void 0:t.element_attribute_ignorelist)&&void 0!==e?e:u.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==t?void 0:t.scroll_threshold_ms)&&void 0!==i?i:u.scroll_threshold_ms,selection_change_threshold_ms:null!==(n=null==t?void 0:t.selection_change_threshold_ms)&&void 0!==n?n:u.selection_change_threshold_ms,mutation_threshold_ms:null!==(s=null==t?void 0:t.mutation_threshold_ms)&&void 0!==s?s:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==t?void 0:t.capture_clicks_with_modifier_keys)&&void 0!==r?r:u.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==t?void 0:t.capture_dead_swipes)&&void 0!==o?o:u.capture_dead_swipes,swipe_threshold_px:null!==(a=null==t?void 0:t.swipe_threshold_px)&&void 0!==a?a:u.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==t?void 0:t.max_dead_swipes_per_page_load)&&void 0!==l?l:u.max_dead_swipes_per_page_load,css_selector_ignorelist:null==t?void 0:t.css_selector_ignorelist,__onCapture:u.__onCapture}}constructor(t,e){this.instance=t,this.pr=new WeakSet,this.mr=!1,this.gr=[],this.yr=0,this.hr=t=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:t}),this.br=()=>{clearTimeout(this.wr),this.wr=void 0,this.kr=void 0},this._r=t=>{if(this.Sr(t),this.br(),0===t.button){const e={path:t.composedPath(),trusted:t.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},i=null==n?void 0:n.getSelection();e.selectionInitiallyRelated="Range"===(null==i?void 0:i.type)&&this.Cr(i,e),this.kr=e}},this.Mr=t=>{Pe(t.relatedTarget)&&this.br()},this.Ir=t=>{const e=this.kr,i=t;if(!e||0!==i.button||t.isTrusted!==e.trusted)return;const n=t.composedPath();for(const t of e.path)if(r_(t)&&-1!==n.indexOf(t)){e.clickTarget=t;break}e.clickDetail=i.detail,this.wr=d.setTimeout(this.br,0)},this.Tr=t=>{this.Sr(t);const e=t,i=s_(e,{type:"click"}),n=this.kr;i&&n&&0===e.button&&e.detail>0&&e.detail===n.clickDetail&&t.isTrusted===n.trusted&&i.node===n.clickTarget&&(i.selectionChangedDuringGesture=n.selectionChanged&&this.Rr.selection_change_threshold_ms>0,this.br()),Pe(i)||this.$r(i)||this.Er(i),this.Ar()},this.Or=()=>{const t=Date.now();this.Lr=t,t%50==0&&this.gr.forEach(e=>{Ie(e.scrollDelayMs)&&(e.scrollDelayMs=t-e.timestamp)})},this.Pr=t=>{var e,i;const s=null==n?void 0:n.getSelection(),r=this.mr;this.mr="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,a=o&&(yr(o)?o:o.parentElement),l=null==n?void 0:n.activeElement;let u=l;for(;null==u||null===(e=u.shadowRoot)||void 0===e?void 0:e.activeElement;)u=u.shadowRoot.activeElement;const h=qr(Tr(t))||qr(null!=a?a:null)||qr(null!==(i=u)&&void 0!==i?i:null),c="Caret"===(null==s?void 0:s.type)&&u&&!u.shadowRoot&&o&&o!==l&&o.contains(null!=l?l:null);if(!(r||this.mr||h||c))return;const d=Date.now();this.Dr=d;const v=this.kr;if(v&&(r||this.mr||h)){const e=Tr(t);let i;if(qr(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var f;qr(null!==(f=u)&&void 0!==f?f:null)||c?i=u:h&&(i=a)}const n=i?this.Fr(i,v):s&&(o||s.anchorNode)?this.Cr(s,v):r&&!this.mr&&v.selectionInitiallyRelated;v.selectionChanged=v.selectionChanged||n}this.gr.forEach(t=>{const e=d-t.timestamp;0>e||!Ie(t.selectionChangedDelayMs)&&e>=t.selectionChangedDelayMs||(t.selectionChangedDelayMs=e)})},this.ln=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this.br();const t=Date.now();this.Nr=t,this.qr("visibilityChangedDelayMs",t)},this.jr=()=>{const t=Date.now();this.Br=t,this.qr("focusChangedDelayMs",t)},this.Hr=t=>{this.Sr(t);const e=t.touches,i=1===(null==e?void 0:e.length)?e[0]:void 0;this.zr=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this.Ur=()=>{this.zr=void 0},this.Wr=t=>{var e;const i=this.zr;if(this.zr=void 0,Ie(i)||this.yr>=this.Rr.max_dead_swipes_per_page_load)return;const s=t,r=null===(e=s.changedTouches)||void 0===e?void 0:e[0];if(!r)return;const o=r.clientX-i.x,a=r.clientY-i.y,l=o*o+a*a,u=this.Rr.swipe_threshold_px;if(u*u>l)return;if([this.Lr,this.Vr,this.Dr].some(t=>Ae(t)&&t>=i.timestamp))return;var h,c;if(this.Zr()&&(null!==(h=null==n||null===(c=n.elementsFromPoint)||void 0===c?void 0:c.call(n,i.x,i.y))&&void 0!==h?h:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,l_)}))return;const d=s_(s,{type:"swipe",swipeDirection:o_(o,a),swipeDistancePx:Math.round(Math.sqrt(l))});Pe(d)||this.$r(d)||this.Er(d),this.Ar()},this.Rr=this.dr(e),this._onCapture=this.Rr.__onCapture}start(t){this.Gr(),this.Qr(),this.Jr(),this.Kr(),this.Xr(),this.Yr(t),this.Rr.capture_dead_swipes&&this.eo()}Yr(e){if(!this.no){const i=function(e){return function(e,i){const n=n_[e];if(n)return n;let s=i[e];if((t=>Ce(t)&&-1!==t.toString().indexOf("[native code]"))(s)&&!(null==t?void 0:t.Zone))return n_[e]=s.bind(i);const r=i.document;if(r&&Ce(r.createElement)){let t,n=!1;try{t=r.createElement("iframe"),t.hidden=!0,r.head.appendChild(t);const l=t.contentWindow;var o,a;l&&l[e]&&(s=l[e],"MutationObserver"===e&&function(t){return me(t,"AppleWebKit")&&!me(t,"Chrome")}(null!==(o=null===(a=i.navigator)||void 0===a?void 0:a.userAgent)&&void 0!==o?o:"")&&(t.classList.add("rr-block","ph-no-capture"),n=!0))}catch(t){Gs.warn(`Could not create sandbox iframe for ${e} check, bailing to assignableWindow.${e}: `,t)}finally{!n&&(null==t?void 0:t.parentNode)&&t.parentNode.removeChild(t)}}return s&&Ce(s)?n_[e]=s.bind(i):s}("MutationObserver",e)}(d);this.no=new i(t=>{this.io(t)}),this.ro(e)}}ro(t){t&&this.no&&(this.pr.has(t)||(this.no.observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),this.pr.add(t),this.oo(t)))}oo(t,e){var i,n;yr(t)&&t.shadowRoot&&this.ro(t.shadowRoot);const s=null!==(i=null===(n=t.querySelectorAll)||void 0===n?void 0:n.call(t,"*"))&&void 0!==i?i:[];for(let t=0;s.length>t;t++)null==e||e.add(s[t]),this.ro(s[t].shadowRoot)}Sr(t){var e,i;const n=null!==(e=null===(i=t.composedPath)||void 0===i?void 0:i.call(t))&&void 0!==e?e:[];for(let t=0;n.length>t;t++){const e=n[t];r_(e)&&this.ro(e.shadowRoot)}}stop(){var t;null===(t=this.no)||void 0===t||t.disconnect(),this.no=void 0,this.pr=new WeakSet,d.removeEventListener("click",this.Tr,{capture:!0}),d.removeEventListener("mousedown",this._r,{capture:!0}),d.removeEventListener("mouseup",this.Ir,{capture:!0}),d.removeEventListener("mouseout",this.Mr,{capture:!0}),d.removeEventListener("dragstart",this.br,{capture:!0}),d.removeEventListener("pointercancel",this.br,{capture:!0}),d.removeEventListener("blur",this.br),this.br(),d.removeEventListener("scroll",this.Or,{capture:!0}),null==n||n.removeEventListener("selectionchange",this.Pr),d.removeEventListener("touchstart",this.Hr,{capture:!0}),d.removeEventListener("touchend",this.Wr,{capture:!0}),d.removeEventListener("touchcancel",this.Ur,{capture:!0}),null==n||n.removeEventListener("visibilitychange",this.ln),d.removeEventListener("blur",this.jr),d.removeEventListener("focus",this.jr),this.zr=void 0}io(t){const e=new Set;for(const n of t)try{var i;if(!1===(null===(i=n.target)||void 0===i?void 0:i.isConnected))continue;this.Vr=Date.now();const t=n.addedNodes;for(let i=0;t.length>i;i++){const n=t[i];r_(n)&&!e.has(n)&&this.oo(n,e)}}catch(t){}}Gr(){sr(d,"click",this.Tr,{capture:!0}),sr(d,"mousedown",this._r,{capture:!0}),sr(d,"mouseup",this.Ir,{capture:!0}),sr(d,"mouseout",this.Mr,{capture:!0}),sr(d,"dragstart",this.br,{capture:!0}),sr(d,"pointercancel",this.br,{capture:!0}),sr(d,"blur",this.br)}Er(t){t.selectionChangedDelayMs=c_(t.timestamp,this.Dr,this.Rr.selection_change_threshold_ms),t.visibilityChangedDelayMs=c_(t.timestamp,this.Nr),t.focusChangedDelayMs=c_(t.timestamp,this.Br),this.gr.push(t)}Ar(){this.gr.length&&Ie(this.so)&&(this.so=d.setTimeout(()=>{this.ao()},1e3))}Qr(){sr(d,"scroll",this.Or,{capture:!0})}Jr(){var t;this.mr="Range"===(null==n||null===(t=n.getSelection())||void 0===t?void 0:t.type),sr(n,"selectionchange",this.Pr)}Fr(t,e){const i=e.path[0];try{for(;t;){if(-1!==e.path.indexOf(t)||yr(i)&&i.contains(t))return!0;t=t.getRootNode().host}}catch(t){}return!1}Cr(t,e){const i=e.path[0],n=t.rangeCount>0?t.getRangeAt(0):void 0,s=!!n&&cn(()=>n.startContainer.getRootNode()===i.getRootNode());if(n&&s&&yr(i)){var r;if(!n.collapsed)return n.intersectsNode(i);const t=yr(n.startContainer)&&null!==(r=n.startContainer.childNodes[n.startOffset])&&void 0!==r?r:n.startContainer;return this.Fr(t,e)}return this.Fr(t.focusNode,e)||this.Fr(t.anchorNode,e)}Kr(){sr(n,"visibilitychange",this.ln)}Xr(){sr(d,"blur",this.jr),sr(d,"focus",this.jr)}qr(t,e){this.gr.forEach(i=>{const n=h_(e-i.timestamp);Ae(n)&&(Ie(i[t])||i[t]>n)&&(i[t]=n)})}eo(){sr(d,"touchstart",this.Hr,{capture:!0,passive:!0}),sr(d,"touchend",this.Wr,{capture:!0,passive:!0}),sr(d,"touchcancel",this.Ur,{capture:!0,passive:!0})}Zr(){const t=Ie(this.lo)||Ae(this.Vr)&&this.Vr>this.lo;return(Ie(this.uo)||t)&&(this.lo=Date.now(),this.uo=!!(null==n?void 0:n.querySelector(l_))),!!this.uo}$r(t){return!t||("swipe"===t.type?this.co(t):this.do(t))}co(e){return!(!mr(e.node)&&!this.gr.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!br(e.node,"html")&&yr(e.node)&&function(e,i){var n;if(!t||Br(e))return!1;const s=Oe(i)?Dr:null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:Dr,{targetElementList:r}=Hr(e,!1);return!Er(r,s)}(e.node,{css_selector_ignorelist:this.Rr.css_selector_ignorelist}))}do(e){return!(this.Rr.capture_clicks_with_modifier_keys||(i=e.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this.co(e)||function(e){if(!t||Br(e))return!1;const{targetElementList:i}=Hr(e,!1);return i.some(t=>br(t,"a"))}(e.node);var i}ao(){if(!this.gr.length)return;clearTimeout(this.so),this.so=void 0;const t=this.gr;this.gr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.Vr&&this.Vr>=i.timestamp?this.Vr-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=u_(i.scrollDelayMs,this.Rr.scroll_threshold_ms),n=u_(i.selectionChangedDelayMs,this.Rr.selection_change_threshold_ms),s=u_(i.mutationDelayMs,this.Rr.mutation_threshold_ms),r=u_(i.absoluteDelayMs,1.1*this.Rr.mutation_threshold_ms),o=Ae(i.scrollDelayMs)&&this.Rr.scroll_threshold_ms>i.scrollDelayMs,a=Ae(i.mutationDelayMs)&&this.Rr.mutation_threshold_ms>i.mutationDelayMs,l=i.selectionChangedDuringGesture||Ae(i.selectionChangedDelayMs)&&this.Rr.selection_change_threshold_ms>i.selectionChangedDelayMs,u=Ae(i.visibilityChangedDelayMs),h=Ae(i.focusChangedDelayMs);if(!(o||a||l||u||h))if(t||s||r||n){const e=a_(i);if("$dead_swipe"===e){if(this.yr>=this.Rr.max_dead_swipes_per_page_load)continue;this.yr++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.Vr,[`${e}_event_timestamp`]:i.timestamp,[`${e}_scroll_timeout`]:t,[`${e}_mutation_timeout`]:s,[`${e}_absolute_timeout`]:r,[`${e}_selection_changed_timeout`]:n,[`${e}_visibility_changed_timeout`]:!1})}else this.Rr.mutation_threshold_ms>i.absoluteDelayMs&&this.gr.push(i)}this.Ar()}vr(t,e){const i=a_(t);this.instance.capture(i,he(he(he({},e),e_(t.node,{e:t.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rr.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:t.scrollDelayMs,[`${i}_mutation_delay_ms`]:t.mutationDelayMs,[`${i}_absolute_delay_ms`]:t.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:t.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:t.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:t.focusChangedDelayMs,$dead_swipe_direction:t.swipeDirection,$dead_swipe_distance_px:t.swipeDistancePx}),{timestamp:new Date(t.timestamp)})}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initDeadClicksAutocapture=(t,e)=>new d_(t,e);const v_=Zs("[ExternalScriptsLoader]"),f_=t=>{const e=null==n?void 0:n.querySelectorAll("script");if(e)for(let i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},p_=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return v_.warn(`${e} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=f_(e);if(s){if(s.__posthog_loading_callback_fired)return i();const t=s.__posthog_loading_error;return t?i(t):(s.addEventListener("load",t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)}),void s.addEventListener("error",t=>{s.__posthog_loading_error=t,i(t)}))}const r=()=>{if(!n)return i("document not found");if(f_(e))return p_(t,e,i);let s=n.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)n.head.appendChild(s);else{const t=n.querySelectorAll("body > script");var r;t.length>0?null===(r=t[0].parentNode)||void 0===r||r.insertBefore(s,t[0]):n.body.appendChild(s)}};(null==n?void 0:n.body)?r():null==n||n.addEventListener("DOMContentLoaded",r)},g_={},m_=(t,e)=>{let i=`/static/${e}.js?v=${t.version}`;if("toolbar"===e){const t=3e5;i=`${i}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"===e){const e=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void p_(t,e,i)}const n=t.config.strict_script_versioning;if(n){const s=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=g_[s];if("fallback"===n&&r){if(f_(r))return void p_(t,r,i);delete g_[s]}return void p_(t,s,"fallback"===n?(n,r)=>{if(n)if("string"==typeof n)i(n);else{var o;const n=m_(t,e);g_[s]=n;const r=f_(s);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),p_(t,n,i)}else i(void 0,r)}:i)}p_(t,m_(t,e),i)},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{const n=t.requestRouter.endpointFor("api",e);p_(t,n,i)};var y_=class{constructor(t){this._instance=t}get Rr(){return this._instance.config}get consent(){return this.Lo()?0:this.No}isOptedOut(){return"always"===this.Rr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Rr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Rr.opt_out_capturing_by_default}optInOut(t){this.qo.At(this.jo,t?1:0,this.Rr.cookie_expiration,this.Rr.cross_subdomain_cookie,this.Rr.secure_cookie)}reset(){this.qo.Lt(this.jo,this.Rr.cross_subdomain_cookie)}get jo(){const{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get No(){const t=this.qo.Ot(this.jo);return We(t)?1:me(Ve,t)?0:-1}get qo(){const t=this.Rr.opt_out_capturing_persistence_type,e="localStorage"===t?Na:Da,i=e.Et()?e:Ja;if(!this.Bo||this.Bo!==i){this.Bo=i;const e="localStorage"===t?Da:Na;e.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(We(e.Ot(this.jo))),e.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(t=>We(t))}};const b_=Zs("[Dead Clicks]"),__=()=>!0,w_=t=>{var e;const i=!!(null===(e=t.instance.persistence)||void 0===e?void 0:e.get_property(P)),n=t.instance.config.capture_dead_clicks;return Oe(n)?n:!!$e(n)||i};var k_=class{get lazyLoadedDeadClicksAutocapture(){return this.Ho}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[P]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this.instance,"dead-clicks-autocapture",e=>{e?b_.error("failed to load script",e):t()})}Uo(){var t;if(n){if(!this.Ho&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=$e(this.instance.config.capture_dead_clicks)?he({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Ho=d.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Ho.start(n),b_.info("starting...")}}else b_.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,b_.info("stopping..."))}};const S_=Zs("[SegmentIntegration]");function x_(t,e,i=!0){const n=t.config.segment;if(!n)return e();const{analytics:s,filterProperties:r}=(t=>Ce(t.register))(o=n)?{analytics:o}:o;var o;!function(t,e,i,n){const s=e=>{const s=()=>e.anonymousId()||Pa();t.config.get_device_id=s,n&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property($t,Kt)),i(n?void 0:e.anonymousId()||void 0)},r=e.user();"then"in r&&Ce(r.then)?r.then(s):s(r)}(t,s,i=>{s.register(((t,e,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||S_.warn("This browser does not have Promise support, and can not use the segment integration");const n=(n,s)=>{if(!s)return n;const r=!!e&&n.event.anonymousId===e&&!n.event.userId;r||n.event.userId||n.event.anonymousId===t.get_distinct_id()||(S_.info("No userId set, resetting PostHog"),t.reset()),r||(e=void 0),n.event.userId&&n.event.userId!==t.get_distinct_id()&&(S_.info("UserId set, identifying with PostHog"),t.identify(n.event.userId));let o=t.calculateEventProperties(s,n.event.properties);if(!Re(i)){const t=n.event.properties||{},e={};for(const i of Object.keys(o))ke.call(t,i)||(e[i]=o[i]);const s=((t,e)=>{const i=xe(t)?t:[t];let n=he({},e);for(const t of i)try{if(n=t(n),Re(n))return null}catch(t){return S_.error("Error in Segment filterProperties:",t),null}return n})(i,e);if(Re(s))return n;o=s}return n.event.properties=Object.assign({},o,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return n(t,t.event.event)},page(t){return n(t,ee)},identify(t){return n(t,ne)},screen(t){return n(t,"$screen")}}})(t,i,{filterProperties:r})).then(()=>{e()},t=>{S_.error("Failed to register the Segment integration",t),e()})},i)}const C_="posthog-js";function $_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,u,h,c;if("*"!==s&&!s.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===(a=o.exception)||void 0===a?void 0:a.values)||[],f=v.map(t=>he(he({},t),{},{stacktrace:t.stacktrace?he(he({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>he(he({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(l=v[0])||void 0===l?void 0:l.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 e&&i&&(p.$sentry_url=(n||"https://sentry.io/organizations/")+e+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var T_=class{constructor(t,e,i,n,s,r){this.name=C_,this.setupOnce=function(o){o($_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},I_=class{constructor(t){this.Wo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Gs.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Vo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Go()}Go(){var t;this.Zo=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.Wo)}destroy(){var t;null===(t=this.Zo)||void 0===t||t.call(this),this.Zo=void 0}doPageView(e,i){var n;const s=this.Qo(e,i);return this.Vo={pathname:null!==(n=null==t?void 0:t.location.pathname)&&void 0!==n?n:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.Qo(t,null===(e=this.Vo)||void 0===e?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Vo)||void 0===t?void 0:t.pageViewId}}Qo(t,e){const i=this.Vo;if(!i)return{$pageview_id:e};let n={$pageview_id:e,$prev_pageview_id:i.pageViewId};const s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:e,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:a}=s;if(!(Ie(t)||Ie(e)||Ie(i)||Ie(r)||Ie(o)||Ie(a))){t=Math.ceil(t),e=Math.ceil(e),i=Math.ceil(i),r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a);const s=t>1?Qe(e/t,0,1,Gs):1,l=t>1?Qe(i/t,0,1,Gs):1,u=r>1?Qe(o/r,0,1,Gs):1,h=r>1?Qe(a/r,0,1,Gs):1;n=Ks(n,{$prev_pageview_last_scroll:e,$prev_pageview_last_scroll_percentage:s,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:l,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:h})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),n}};const M_=["flags","surveys"],E_={[v]:{exposure:"hidden"},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[S]:{exposure:"hidden"},[_]:{exposure:"hidden"},[k]:{exposure:"hidden"},[x]:{exposure:"event"},[C]:{exposure:"hidden"},[A]:{exposure:"hidden"},[T]:{exposure:"event"},[I]:{exposure:"hidden"},[M]:{exposure:"event"},[E]:{exposure:"event"},[P]:{exposure:"event"},[R]:{exposure:"hidden"},[F]:{exposure:"event"},[O]:{exposure:"hidden"},[D]:{exposure:"hidden"},[H]:{exposure:"hidden"},[z]:{exposure:"event"},[L]:{exposure:"event",shouldSkipFromEventProperties:t=>Pe(t)},[U]:{exposure:"event"},[W]:{exposure:"event"},[V]:{exposure:"event"},[J]:{exposure:"event"},[K]:{exposure:"hidden"},[X]:{exposure:"hidden",storageGroup:"flags"},[Y]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"hidden"},[et]:{exposure:"hidden",storageGroup:"flags"},[it]:{exposure:"hidden",storageGroup:"flags"},[nt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[st]:{exposure:"hidden",storageGroup:"flags"},[rt]:{exposure:"hidden"},[ot]:{exposure:"hidden"},[at]:{exposure:"hidden"},[lt]:{exposure:"hidden"},[ht]:{exposure:"hidden",storageGroup:"surveys"},[ct]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[dt]:{exposure:"event"},[vt]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[pt]:{exposure:"hidden"},[gt]:{exposure:"hidden"},[mt]:{exposure:"hidden"},[yt]:{exposure:"event"},[bt]:{exposure:"event"},[_t]:{exposure:"event"},[wt]:{exposure:"event"},[kt]:{exposure:"hidden"},[St]:{exposure:"hidden"},[ut]:{exposure:"event"},[xt]:{exposure:"hidden"},[Ct]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[$t]:{exposure:"hidden"},[Tt]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[Pt]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[N]:{exposure:"event"},[q]:{exposure:"event"},[j]:{exposure:"event"},[B]:{exposure:"event"},[Ot]:{exposure:"event"},[Dt]:{exposure:"event"},[Lt]:{exposure:"event"},[Nt]:{exposure:"event"},[qt]:{exposure:"event"},[jt]:{exposure:"event"},[Bt]:{exposure:"event"},[Ht]:{exposure:"event"},[zt]:{exposure:"event"},[Ut]:{exposure:"event"},[Wt]:{exposure:"event"},[Zt]:{exposure:"event"}},P_=[[G,{exposure:"hidden"}],[Z,{exposure:"hidden"}],[Q,{exposure:"hidden"}]],R_=t=>{const e=E_[t];if(e)return e;for(const[e,i]of P_)if(0===t.indexOf(e))return i},A_={flags:Ct,surveys:ct},F_=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],O_=t=>`${t}_cookie_identity_change_pending`,D_=t=>{let e="",i=0;for(const n of t){const t=encodeURIComponent(JSON.stringify(n).slice(1,-1)).length;if(i+t>1e3)break;e+=n,i+=t}return e},L_="main",N_=[X,Y,et,it,nt,Ct,st,at],q_=t=>-1!==N_.indexOf(t),j_=[_,k],B_=t=>-1!==j_.indexOf(t),H_=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},z_=t=>{if(!t)return{};const e=JSON.parse(t);return $e(e)?e:{}},U_=(t,e)=>{Js(t,(i,n)=>{const s=R_(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,n)||delete t[n]})};var W_=class{constructor(e,i,n=!0){if(this.Jo={},this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=new Map,this.na=!1,this.sa=!1,this.ra=!1,this.oa=new Set,this.aa=new Set,this.Rr=e,this.la=n,this.props={},this.ua=void 0,this.ha=(t=>{let e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.qo=this.ca(e),this.Yo=this.da(e),this.load(),this.va(),e.debug&&Gs.info("Persistence loaded",e.persistence,he({},this.props)),this.update_config(e,e,i),this.save(),t){const e=()=>this.flush();sr(t,"beforeunload",e,{capture:!1}),sr(t,"pagehide",e,{capture:!1}),this.fa=e=>{if(this.Ko&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.ha){if(this.Yo){const t=M_.find(t=>e.key===this.pa(t));t&&this.ga(e.key,t)}}else this.ga(e.key,L_)},sr(t,"storage",this.fa)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,e])=>{const i=this.ia.get(t);if(!q_(t)||!0===i)return;if(!0===e)return void this.ma(t,!0);const n=new Set(i||[]);e.forEach(t=>n.add(t)),n.size&&this.ma(t,n)})}onCrossTabFeatureFlagChange(t){return this.aa.add(t),()=>this.aa.delete(t)}destroy(){this.fa&&t&&(t.removeEventListener("storage",this.fa),this.fa=void 0),this.aa.clear()}ga(t,e,i=!0){if(this.mi)return!1;let n,s;try{if(s=Na.Ot(t),Pe(s)){const t=this.ya(e);return t.storageValue=null,e!==L_&&(t.persisted=!1),!1}n=z_(s)}catch(t){return!1}const r=e===L_?n:Na.Dt(this.ha);if(r&&this.ba(r))return!1;const o=this._a(n,e,i);return e===L_&&this.Yo&&!H_(this.wa().main,n)||this.ka(n,e,!0,s),o}ba(t){const e=this.props[f],i=t[f];return!Ie(e)&&!Ie(i)&&e!==i}ka(t,e,i,n){const s=this.ya(e);s.storageValue=n,e!==L_&&(s.persisted=i);try{s.fingerprint=this.Sa(t,e)}catch(t){s.fingerprint=void 0}}_a(t,e,i){let n=!1;return N_.forEach(i=>{var s;const r=null===(s=R_(i))||void 0===s?void 0:s.storageGroup;if(e===L_&&this.Yo&&r||e!==L_&&r!==e)return;const o=i in t,a=this.xa(i,o?t[i]:void 0),l=this.ia.has(i)?i in this.props:o;l===i in this.props&&H_(a,this.props[i])||(l?this.Ca(i,a,!1):this.$a(i,!1),n=!0)}),n&&i&&this.aa.forEach(t=>t()),n}Ta(){if(!this.Ko)return!1;try{this.ra=!1;const t=Na.Ot(this.ha),e=this.ya(L_);let i,n=!1,s=!1;if(t!==e.storageValue)if(Pe(t))e.storageValue=null;else{if(i=z_(t),this.ra=!this.sa&&this.ba(i),this.ra)return!1;s=this._a(i,L_,!1),!this.Yo||H_(this.wa().main,i)?this.ka(i,L_,!0,t):e.storageValue=t,n=!0}return this.Yo&&M_.forEach(t=>{const e=Na.Ot(this.pa(t)),r=this.ya(t),o=i||{},a=n&&N_.some(e=>{var i;return(null===(i=R_(e))||void 0===i?void 0:i.storageGroup)===t&&e in o});if(e===r.storageValue&&!a)return;if(Pe(e))return r.storageValue=null,r.persisted=!1,void(a&&(s=this._a(o,t,!1)||s));const l=z_(e);s=this._a(l,t,!1)||s,this.ka(l,t,!0,e)}),s}catch(t){return!1}}ma(t,e){this.ia.set(t,e);const i=R_(t);(null==i?void 0:i.volatile)||(this.ya((this.Yo?null==i?void 0:i.storageGroup:void 0)||L_).fingerprint=void 0,this.Ia(t))}Ma(){N_.forEach(t=>this.ia.set(t,!0))}va(){if(this.Ko)try{const t=Na.Ot(this.ha),e=z_(t);this.ya(L_).storageValue=t,N_.forEach(t=>{var i;const n=this.Yo?null===(i=R_(t))||void 0===i?void 0:i.storageGroup:void 0,s=n?Na.Ot(this.pa(n)):null;if(n){const t=this.ya(n);t.storageValue=s,t.persisted=!Pe(s)}const r=n&&!Pe(s)?z_(s):e;t in this.props?this.Ea(t,r[t],this.props[t]):t in r&&this.ma(t,!0)})}catch(t){}}xa(t,e){const i=this.ia.get(t);if(!i)return e;if(!0===i)return this.props[t];if("$active_feature_flags"===t){const n=new Set(xe(e)?e:[]),s=new Set(xe(this.props[t])?this.props[t]:[]);return i.forEach(t=>s.has(t)?n.add(t):n.delete(t)),Array.from(n)}const n=$e(e)?he({},e):{},s=$e(this.props[t])?this.props[t]:{};return i.forEach(t=>{t in s?n[t]=s[t]:delete n[t]}),n}Ea(t,e,i){if(!q_(t))return;const n=this.ia.get(t);if(!0===n)return;let s=e;if(this.Ko)try{var r;const e=this.Yo?null===(r=R_(t))||void 0===r?void 0:r.storageGroup:void 0,i=e?this.pa(e):this.ha;s=z_(Na.Ot(i))[t]}catch(t){}const o=new Set(n||[]);if("$active_feature_flags"===t){if(!Ie(e)&&!xe(e)||!Ie(s)&&!xe(s)||!xe(i))return void this.ma(t,!0);const n=new Set(e||[]),r=new Set(s||[]),a=new Set(i);new Set([...n,...a]).forEach(t=>{n.has(t)!==a.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===a.has(t)&&o.delete(t)})}else{if(!$e(i))return void(H_(s,i)?this.ia.delete(t):this.ma(t,!0));{if(!Ie(e)&&!$e(e)||Ie(e)&&Te(i)&&Ie(s))return void this.ma(t,!0);const n=$e(e)?e:{},r=$e(s)?s:{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(t=>{t in n==t in i&&H_(n[t],i[t])||o.add(t)}),o.forEach(t=>{t in r==t in i&&H_(r[t],i[t])&&o.delete(t)})}}o.size?this.ma(t,o):this.ia.delete(t)}Pa(){var t;const e=null===(t=this.Rr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Ae(e)&&e>0?e:0}Ra(t){if(this.Rr.cookieWinsOnConflict&&"localstorage+cookie"===this.Rr.persistence.toLowerCase())if(t)try{const e=Ua(t,this.Rr.cookie_persisted_properties||[]),i=Va(e,this.Rr.cookie_persisted_properties||[]),n=JSON.stringify(e)+"|"+JSON.stringify(i),s=Da.Ot(this.ha)||void 0;s&&Za(this.ha,s)===n&&(this.Aa=n,this.Fa=s)}catch(t){}else try{const t=Da.Ot(this.ha)||void 0;this.Aa=t?Za(this.ha,t):void 0,this.Fa=t}catch(t){}}syncCookieProperties(){return this.Oa(this.Rr)}Oa(t,e=!1){if(this.mi&&!e||this.ea||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let i;try{i=Da.Ot(this.ha)||void 0}catch(t){}if(!i||i===this.Fa)return!1;const n=Za(this.ha,i);let s;try{s=za(JSON.parse(i))}catch(t){return!1}if((Da.Ot(this.ha)||void 0)!==i)return!1;this.Aa=n,this.Fa=i;const r=Ga(this.ha,i),o=[...ja,...r.properties],a={};if(Object.keys(s).forEach(t=>{const e=s[t];(Ie(e)||Pe(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(a[t]=!0,delete s[t])}),Te(s))return!1;const l="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,h=u[f],c=u[$t],d=Ks({},u);[...ja,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in s)&&!a[t]&&(l||"distinct_id"!==t&&"$user_state"!==t)){const e=d[t];(r.isValid||-1===ja.indexOf(t)||!1!==e&&0!==e)&&delete d[t]}}),this.props=Ks(d,s),N_.forEach(t=>{const e=t in this.props;t in u===e&&H_(u[t],this.props[t])||(e?this.Ea(t,u[t],this.props[t]):this.ma(t,!0))}),!l||"$user_state"in s||"$user_state"in this.props||this.Ca($t,Jt);const v=this.props[f],p=this.props[$t];return!l||v===h&&p===c||(this.sa=!0,this.ta=!0,Xa.At(O_(this.ha),!0),this.$a(at),this.$a(Y),this.$a(X),this.$a(et),this.$a(it),this.$a(nt),this.$a(Ct),this.$a(xt),this.$a(kt),"anonymous"!==p||"identified"!==c&&"anonymous"!==s.$user_state&&(Ie(h)||v===h)||(U_(this.props,s),this.$a(lt)),"identified"===p?this.props.$user_id=v:delete this.props.$user_id,this.$a(m)),!0}consumeCookieIdentityChange(){const t=O_(this.ha),e=this.ta||!!Xa.Ot(t);return this.ta=!1,e&&Xa.Lt(t),e}Da(t=!1){return!(this.ea||this.mi&&!t||!this.Rr.cookieWinsOnConflict||"localstorage+cookie"!==this.Rr.persistence.toLowerCase()||(this.ea=!0,0))}La(){this.ea&&(Ie(this.Na)||(clearTimeout(this.Na),this.Na=void 0),delete this.Jo[L_],this.qa(!0))}ja(t=!0){if(this.ea)try{t?this.La():Ie(this.Na)||(clearTimeout(this.Na),this.Na=void 0)}finally{this.ea=!1}}isDisabled(){return!!this.mi}ca(e){-1===F_.indexOf(e.persistence.toLowerCase())&&(Gs.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const i=((e=[],i=!1)=>{const n=[...ja,...e];return he(he({},Na),{},{Dt(t){try{let s,r={};try{s=Da.Ot(t)||void 0,r=s?za(JSON.parse(s)):{}}catch(t){}const o=JSON.parse(Na.Ot(t)||"{}");let a;if(i){const i=Ga(t,s),l=[...ja,...i.properties],u={};Object.keys(r).forEach(t=>{const e=r[t];Pe(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(u[t]=e)});const h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var e;const t=o[f],s=null!==(e=o.$user_state)&&void 0!==e?e:Jt;n.forEach(t=>{if(-1!==l.indexOf(t)&&!(t in r)&&(h||"distinct_id"!==t&&"$user_state"!==t)){const e=o[t];(i.isValid||-1===ja.indexOf(t)||!1!==e&&0!==e)&&delete o[t]}}),!h||"$user_state"in r||"$user_state"in o||(o[$t]=Jt),!h||("distinct_id"in u?u[f]:o[f])===t&&("$user_state"in u?u[$t]:o[$t])===s||(qa.forEach(t=>delete o[t]),"identified"===u.$user_state&&"distinct_id"in u?o.$user_id=u[f]:delete o.$user_id,"identified"!==u.$user_state&&(delete o[ut],delete o[lt]),delete o.__alias)}a=Ks(o,u)}else a=Ks(r,o);return Na.At(t,a),a}catch(t){}return null},At(t,n,s,r,o,a){const l=Na.At(t,n,void 0,void 0,a);try{const u=Ua(n,e);if(Object.keys(u).length){if(i){const i=Ba(t),h=Va(u,e);if(Da.At(i,h,s,r,o,a),Da.Ot(i)!==JSON.stringify(h)){Da.Lt(i,r);const e=Ua(n);return Da.At(t,e,s,r,o,a),l}}Da.At(t,u,s,r,o,a)}}catch(t){Na.Pt(t)}return l},Lt(e,i){try{null==t||t.localStorage.removeItem(e),Da.Lt(e,i),Da.Lt(Ba(e),i)}catch(t){Na.Pt(t)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let n,s=!1,r=!1;const o=e.persistence.toLowerCase();return"localstorage"===o&&Na.Et()?(n=Na,r=!0):"localstorage+cookie"===o&&i.Et()?(n=i,r=!0,s=!0):"sessionstorage"===o&&Xa.Et()?n=Xa:"memory"===o?n=Ja:"cookie"===o&&Da.Et()?(n=Da,s=!0):i.Et()?(n=i,r=!0,s=!0):Da.Et()?(n=Da,s=!0):n=Ja,this.Ko=r,this.Xo=s,n}pa(t){return`${this.ha}__${t}`}da(t){return this.Ko&&!!t.split_storage}properties(){const t={};return Js(this.props,(e,i)=>{const n=R_(i);if(!n||"event"===n.exposure){var s;if(null==n||null===(s=n.shouldSkipFromEventProperties)||void 0===s?void 0:s.call(n,e))return;t[i]=e}}),t}load(t=!1){if(this.mi&&!t)return;const e=this.Rr.cookieWinsOnConflict&&"localstorage+cookie"===this.Rr.persistence.toLowerCase(),i=e?Na.Dt(this.ha):null;let n={};if(e)try{n=za(Da.Dt(this.ha)),Js(n,(t,e)=>{(Ie(t)||Pe(t)||""===t)&&delete n[e]})}catch(t){}const s=this.qo.Dt(this.ha);if(s&&(this.props=Ks({},s)),this.Yo&&this.Ba(),e&&s){var r,o;const t=null==i?void 0:i[f],e=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Jt,a=s[f],l=null!==(o=s.$user_state)&&void 0!==o?o:Jt;if(a!==t||l!==e){this.ta=!0,Xa.At(O_(this.ha),!0);const i=Ks({},this.props);qa.forEach(t=>delete i[t]),"anonymous"!==l||"identified"!==e&&"anonymous"!==n.$user_state&&(Ie(t)||a===t)||(U_(i,n),delete i[lt]),this.props=i;const s=new Set;qa.forEach(t=>{var e;const i=null===(e=R_(t))||void 0===e?void 0:e.storageGroup;i&&s.add(i)}),s.forEach(t=>{const e={};Js(this.props,(i,n)=>{var s;(null===(s=R_(n))||void 0===s?void 0:s.storageGroup)===t&&(e[n]=i)}),Te(e)?(Na.Lt(this.pa(t)),this.Jo[t]={}):Na.At(this.pa(t),e)&&(this.Jo[t]={persisted:!0,fingerprint:this.Sa(e,t)})})}}Xa.Ot(O_(this.ha))&&(this.ta=!0)}Ba(){for(const t of M_){const e=Na.Dt(this.pa(t));if(e&&!Te(e)){const i=this.ya(t);i.persisted=!0,this.Ha(t)||(i.fingerprint=this.Sa(e,t)),this.za(t,e)||Ks(this.props,e)}}}Ha(t){return Object.keys(this.props).some(e=>{var i;return(null===(i=R_(e))||void 0===i?void 0:i.storageGroup)===t})}za(t,e){const i=A_[t];if(!i)return!1;const n=e[i],s=this.props[i];return Ae(n)&&Ae(s)&&s>n}refreshKey(t){var e;if(this.mi)return;if(this.oa.has(t))return;const i=this.Yo?null===(e=R_(t))||void 0===e?void 0:e.storageGroup:void 0,n=i?Na.Dt(this.pa(i)):this.qo.Dt(this.ha);if(n&&t in n)this.Ca(t,n[t],!1);else{if(i){const e=this.qo.Dt(this.ha);if(e&&t in e)return void this.Ca(t,e[t],!1)}this.$a(t,!1)}}save(){if(this.mi)return;const t=this.Pa();t>0?Ie(this.Na)&&(this.Na=setTimeout(()=>{this.Na=void 0,this.qa()},t)):this.qa()}flush(){Ie(this.Na)||(clearTimeout(this.Na),this.Na=void 0,this.qa())}qa(t=!1){if(this.mi||this.ea&&!t)return;t||(this.syncCookieProperties(),this.Rr.cookieWinsOnConflict&&"localstorage+cookie"===this.Rr.persistence.toLowerCase()||j_.forEach(t=>this.refreshKey(t)));const e=!t&&!this.na;e||(this.ra=!1);const i=!!e&&this.Ta();if(this.ra)return void(this.Rr.debug&&Gs.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Yo)return this.Ua(),void(i&&this.aa.forEach(t=>t()));const n=this.Wa(this.qo,this.ha,this.props,L_);"written"===n&&this.Ra(this.props),"failed"!==n&&(this.ia.clear(),this.sa=!1,this.oa.clear()),i&&this.aa.forEach(t=>t())}Ua(){const{main:t,groups:e}=this.wa(),i=this.Wa(this.qo,this.ha,t,L_);"written"===i&&this.Ra(t),"failed"!==i&&(this.sa=!1,this.oa.clear(),N_.forEach(t=>{var e;(null===(e=R_(t))||void 0===e?void 0:e.storageGroup)||this.ia.delete(t)}));for(const t of M_){var n;const i=e[t];if(Te(i)&&!(null===(n=this.Jo[t])||void 0===n?void 0:n.persisted)){N_.forEach(e=>{var i;(null===(i=R_(e))||void 0===i?void 0:i.storageGroup)===t&&this.ia.delete(e)});continue}const s=this.Wa(Na,this.pa(t),i,t);"failed"!==s&&N_.forEach(e=>{const i=R_(e);(null==i?void 0:i.storageGroup)!==t||"written"!==s&&i.volatile||this.ia.delete(e)})}}wa(){const t={},e={flags:{},surveys:{}};return Js(this.props,(i,n)=>{var s;const r=null===(s=R_(n))||void 0===s?void 0:s.storageGroup;r?e[r][n]=i:t[n]=i}),{main:t,groups:e}}Sa(t,e){if(e===L_)return JSON.stringify(t)+"|"+this.Va+"|"+this.Ga+"|"+this.Za;const i={};return Js(t,(t,e)=>{var n;i[e]=(null===(n=R_(e))||void 0===n?void 0:n.volatile)?"__volatile__":t}),JSON.stringify(i)}Wa(t,e,i,n){const s=this.ya(n);if(n!==L_&&!s.dirty&&!Ie(s.fingerprint))return"skipped";let r;try{if(r=this.Sa(i,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(t){r=void 0}return t.At(e,i,this.Va,this.Ga,this.Za,this.Rr.debug)?(s.dirty=!1,n!==L_&&(s.persisted=!0),Ie(r)||(s.fingerprint=r),this.Ko&&(s.storageValue=Na.Ot(e)),"written"):(this.Rr.debug&&Gs.warn(`failed to persist storage entry "${e}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.Ma(),Ie(this.Na)||(clearTimeout(this.Na),this.Na=void 0),this.qo.Lt(this.ha,!1),this.qo.Lt(this.ha,!0),!t&&this.la)for(const t of M_)Na.Lt(this.pa(t));t?delete this.Jo[L_]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if($e(t)){this.syncCookieProperties(),Ie(e)&&(e="None"),this.Va=Ie(i)?this.Qa:i;let n=!1;if(Js(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Ca(i,t),n=!0)}),n)return this.save(),!0}return!1}register(t,e){if($e(t)){this.syncCookieProperties(),this.Va=Ie(e)?this.Qa:e;let i=!1;if(Js(t,(e,n)=>{t.hasOwnProperty(n)&&(this.props[n]!==e||$e(e)||xe(e))&&(this.Ca(n,e),i=!0)}),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const e="string"==typeof t?[t]:t;let i=!1;for(const t of e)t in this.props&&(this.$a(t),i=!0);i&&this.save()}update_campaign_params(){const t=null==n?void 0:n.URL;if(t===this.ua)return;const e=Pl(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),i=!Te(tr(e));return i&&this.register(e),this.ua=t,i?e:void 0}update_search_keyword(){this.register(function(){const t=null==n?void 0:n.referrer;return t?Al(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Ll(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(t=lr(n.referrer))||void 0===t?void 0:t.host)||Dl},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Nl(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[Pt]:this.Xo?{r:D_(t.r),u:t.u?D_(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Js([Et,Mt],e=>{const i=this.props[e];i&&Js(i,function(e,i){t["$initial_"+be(i)]=e})});const e=this.props[Pt];if(e){const i=function(t,e=!1){const i=ql(t,e),n={};return Js(i,function(t,e){n[`$initial_${be(e)}`]=t}),n}(e,this.Rr.disable_capture_url_hashes);Ks(t,i)}return t}safe_merge(t){return Js(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,i){const n=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;const i=[...t].sort(),n=[...e].sort();return i.every((t,e)=>t===n[e])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),r=n||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,l=!!this.mi&&!a;a||this.Oa(e,l),this.Rr=t,!a&&(n||s||o)&&(this.Aa=void 0,this.Fa=void 0,this.Oa(he(he({},t),{},{cookie_persisted_properties:e.cookie_persisted_properties}),l));const u=r||o?this.ca(t):this.qo;this.Ja();const h=this.da(t),c=r||h!==this.Yo,d=!a&&(c||t.cross_subdomain_cookie!==this.Ga||t.secure_cookie!==this.Za)&&this.Da(l);this.na=c;try{if(this.Qa=this.Va=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.qo=u,this.Yo=h,this.props=t,this.save()}else o&&(this.qo=u,a||(delete this.Jo[L_],this.qa()))}finally{this.na=!1,d&&this.ja()}}Ja(){const t=this.props[Pt];if(!this.Xo||!$e(t)||"string"!=typeof t.r)return;const e=D_(t.r),i="string"==typeof t.u?D_(t.u):t.u;e===t.r&&i===t.u||this.Ca(Pt,he(he({},t),{},{r:e,u:i}))}set_disabled(t){this.mi=t,this.mi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Ga&&(this.Ga=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Za&&(this.Za=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){const i=this.props.__timers||{};i[t]=e,this.Ca(S,i),this.save()}remove_event_timer(t){const e=this.props.__timers||{},i=e[t];return Ie(i)||(delete e[t],this.Ca(S,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Ca(t,e),this.save()}Ca(t,e,i=!0){var n;const s=this.props[t];this.props[t]=e,i&&("distinct_id"!==t&&"$user_state"!==t||s===e||(this.sa=!0),B_(t)&&!H_(s,e)&&this.oa.add(t),this.Ea(t,s,e),(null===(n=R_(t))||void 0===n?void 0:n.volatile)||this.Ia(t))}$a(t,e=!0){delete this.props[t],e&&(q_(t)&&this.ma(t,!0),B_(t)&&this.oa.add(t),this.Ia(t))}Ia(t){var e;const i=null===(e=R_(t))||void 0===e?void 0:e.storageGroup;i&&(this.ya(i).dirty=!0)}ya(t){return this.Jo[t]||(this.Jo[t]={})}};const V_=Zs("[RateLimiter]");var G_=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach(t=>{V_.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void V_.warn(`could not rate limit - continuing. Error: "${null==t?void 0:t.message}"`,{text:e})}},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 e,i,n;const{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,o=(new Date).getTime(),a=null!==(e=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>s&&(a.tokens=s);const l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){const t=(Ae(a.dropped)?a.dropped:0)+1;a.dropped=t,!this.lastEventRateLimited&&this.Ka(t)&&(a.dropped=0)}return this.lastEventRateLimited=l,null===(n=this.instance.persistence)||void 0===n||n.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Xa(t){const e=this.instance.config.property_denylist;return!xe(e)||!e.includes(t)}Ya(){var t;if(this.Xa("$current_url")&&this.Xa("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(t=s.origin)&&void 0!==t?t:""}${s.pathname}`}Ka(t){var e,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this.Ya(),o=this.Xa("$session_id")?null===(e=(i=this.instance).get_session_id)||void 0===e?void 0:e.call(i):void 0,a=[`${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: ${a}. Config is set to ${s} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}};const Z_=Zs("[RemoteConfig]");var Q_=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}tl(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.loadExternalDependency)?null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}el(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 Z_.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void Z_.warn("Remote config is disabled. Falling back to local config.");this.tl(t=>{if(!t)return Z_.info("No config found after loading remote JS config. Falling back to JSON."),void this.el(t=>{this.il(t.json,t)});this.il(t)})}catch(t){Z_.error("Error loading remote config",t),this.il()}}il(t,e){!t&&e&&(0===e.statusCode?e.error||Z_.warn("Failed to fetch remote config from PostHog."):Z_.error("Failed to fetch remote config from PostHog."));try{this._instance.il(t?{ok:!0,config:t}:{ok:!1})}catch(t){Z_.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 i;null===(i=this._instance.featureFlags)||void 0===i||i.ensureFlagsLoaded()}catch(t){Z_.error("Error loading feature flags",t)}}};const J_=!!o||!!r,K_=new WeakMap,X_="text/plain";let Y_=0,tw=!1;const ew=(t,e)=>{const[i,n]=t.split("#"),[s,r]=i.split("?");if(!r)return t;const o=r.split("&").filter(t=>t.split("=")[0]!==e).join("&");return`${s}${o?`?${o}`:""}${n?`#${n}`:""}`},iw=(t,e,i=!0)=>{var n;const[s,r]=t.split("?"),o=he({},e),a=null!==(n=null==r?void 0:r.split("&").map(t=>{var e;const[n,s]=t.split("="),r=i&&null!==(e=o[n])&&void 0!==e?e:s;return delete o[n],`${n}=${r}`}))&&void 0!==n?n:[],l=ur(o);return l&&a.push(l),a.length>0?`${s}?${a.join("&")}`:s},nw=t=>{if(t.sl)return t.sl;const{data:e,compression:i}=t;if(!e)return;if(i===wp){const t=wa(ka(ar(e)),{mtime:0});return{contentType:X_,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(i===kp){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(ar(e)),i=(t=>"data="+encodeURIComponent("string"==typeof t?t:ar(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=ar(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},sw=t=>{const e=()=>"sendBeacon"===t.transport?{url:iw(t.url,{compression:kp}),encodedBody:nw(he(he({},t),{},{compression:kp,sl:void 0}))}:{url:ew(t.url,"compression"),encodedBody:nw(he(he({},t),{},{compression:void 0,sl:void 0}))};let i;try{i=nw(t)}catch(i){if(hs(t.compression,hr(t.url,"compression")))return Gs.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return i&&hs(t.compression,hr(t.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?us(new Uint8Array(n)):ArrayBuffer.isView(n)&&us(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(tw=!0,e()):{url:t.url,encodedBody:i};var n},rw=t=>{try{return sw(t)}catch(i){var e;return Gs.error(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}},ow=function(){var t=oe(function*(t){const e=yield ms(ar(t.data),Ya.DEBUG,{rethrow:!0});if(!e)return t;const i=yield e.arrayBuffer();return he(he({},t),{},{sl:{contentType:X_,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),aw=/Failed to fetch|NetworkError|Load failed/i,lw=t=>"TypeError"===(null==t?void 0:t.name)&&aw.test((null==t?void 0:t.message)||""),uw=t=>{try{const e=function(t,e=Date.now()){if("string"!=typeof t||!t)return;const i=t.trim(),n=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(n)){const t=1e3*Math.min(Number(n),300);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const s=/^\w{3} \w{3} /.test(n)?n+" GMT":n,r=Date.parse(s)-e;return Number.isFinite(r)&&r>0?Math.min(r,rn):void 0}(t());return Ie(e)?void 0:Math.min(e,3e4)}catch(t){return}},hw=t=>{const e=rw(t);if(!e)return;const i=new o;K_.set(i,!0);const{url:n,encodedBody:s}=e;i.open(t.method||"GET",n,!0);const{contentType:r,body:a}=null!=s?s:{};Js(t.headers,function(t,e){i.setRequestHeader(e,t)}),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e;const n={statusCode:i.status,text:i.responseText};if(200===i.status)try{n.json=JSON.parse(i.responseText)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,n,uw(()=>i.getResponseHeader("Retry-After")))}},i.send(a)},cw=t=>{const e=rw(t);if(!e)return;const{url:i,encodedBody:n}=e,{contentType:s,body:o,estimatedSize:l}=null!=n?n:{},u=new Headers;Js(t.headers,function(t,e){u.append(e,t)}),s&&u.append("Content-Type",s);let h=null,c=!1;if(a){const e=new a;h={signal:e.signal,timeout:setTimeout(()=>{c=!0;try{e.abort(un("AbortError","PostHog request timed out"+((i=t.timeout)?` after ${i}ms`:"")))}catch(t){v(t)}var i},t.timeout)}}let d=!1;const v=e=>{var i;d||(d=!0,c&&"AbortError"===(null==e?void 0:e.name)||lw(e)?Gs.warn(e):Gs.error(e),null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))};let f=0;const p=()=>{Y_-=f,f=0,h&&clearTimeout(h.timeout)};try{const e=he({method:(null==t?void 0:t.method)||"GET",headers:u,referrerPolicy:"strict-origin",body:o,signal:null==h?void 0:h.signal},t.fetchOptions),n=null!=l?l:Ie(o)?0:void 0;e.keepalive="POST"===e.method&&!t.rl&&!1!==e.keepalive&&e.body===o&&!Ie(n)&&n>=0&&52428.8>Y_+n,e.keepalive&&(f=n,Y_+=f),r(i,e).then(e=>e.text().then(i=>{var n;if(d)return;const s={statusCode:e.status,text:i};if(200===e.status)try{s.json=JSON.parse(i)}catch(t){Gs.error(t)}d=!0,p(),null===(n=t.callback)||void 0===n||n.call(t,s,uw(()=>e.headers.get("Retry-After")))})).catch(t=>{p(),v(t)}).finally(p)}catch(t){p(),v(t)}},dw=t=>{try{var e;const{url:n,encodedBody:s}=sw(t),{contentType:o,body:a,estimatedSize:l}=null!=s?s:{};if(!a)return;const u=a instanceof Blob?a:new Blob([a],{type:o});if(i.sendBeacon(n,u))return;const h=xe(t.data)?t.data:null===(e=t.data)||void 0===e?void 0:e.batch;if(xe(h)&&h.length>1&&(null!=l?l:0)>16384){const e=Math.ceil(h.length/2),i=e=>xe(t.data)?e:he(he({},t.data),{},{batch:e});return dw(he(he({},t),{},{data:i(h.slice(0,e))})),void dw(he(he({},t),{},{data:i(h.slice(e))}))}Gs.warn(`Beacon of ~${null!=l?l:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?cw(he(he({},t),{},{rl:!0})):hw(t)}catch(t){Gs.warn("Beacon send failed",t)}},vw=(t,e,i,n)=>{const s="query"===n?"POST"===e?"sent_at":"_":void 0;return iw(i===wp?ew(t,"compression"):t,he(he({},s?{[s]:Date.now().toString()}:{}),i===wp?{}:{compression:i}))},fw=(()=>{const t=[];return r&&t.push({transport:"fetch",method:cw}),o&&t.push({transport:"XHR",method:hw}),(null==i?void 0:i.sendBeacon)&&t.push({transport:"sendBeacon",method:dw}),t})();let pw=!J_&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));function gw(t,e,i){var n,s,r;i&&(e=he(he({},e),{},{callback:t=>i(t)})),t.__loaded?pw?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null===(s=e.callback)||void 0===s||s.call(e,{statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=he(he({},t.config.request_headers),e.headers),e.compression="best-available"===e.compression?null!==(n=t.compression)&&void 0!==n?n:e.compressionFallback:e.compression,(Ie(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((t,e)=>{var i,n,s;const r=he(he({},t),{},{callback:null!=e?e:e=>{var i;return null===(i=t.callback)||void 0===i?void 0:i.call(t,e)}});r.timeout=r.timeout||6e4;const o=null!==(i=r.transport)&&void 0!==i?i:"fetch";"sendBeacon"===o&&Ie(r.compression)&&r.data&&(r.compression=kp),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(t=>{var e,i;const n=(xe(t)?t:[t]).map(t=>he(he({},t),t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})),s=n[0];return{api_key:null!==(e=null==s||null===(i=s.properties)||void 0===i?void 0:i.token)&&void 0!==e?e:null==s?void 0:s.token,batch:n,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((t,e=(new Date).toISOString())=>xe(t)?t.map(t=>he(he({},t),{},{sent_at:e})):he(he({},t),{},{sent_at:e}))(r.data))),r.url=vw(r.url,r.method,r.compression,r.timestampMode);const a=fw.filter(t=>!r.disableTransport||!t.transport||!r.disableTransport.includes(t.transport)),u=null!==(n=null===(s=function(t,e){for(let i=0;t.length>i;i++)if(e(t[i]))return t[i]}(a,t=>t.transport===o))||void 0===s?void 0:s.method)&&void 0!==n?n:a[0].method;if(!u)throw new Error("No available transport method");const h=t=>{try{u(t)}catch(t){var e;lw(t)?Gs.warn(t):Gs.error(t),null===(e=r.callback)||void 0===e||e.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===wp&&l&&"undefined"!=typeof Promise&&!tw?ow(r).then(t=>{h(t)}).catch(e=>{if(cs(e))return tw=!0,void h(he(he({},r),{},{compression:void 0,url:vw(t.url,t.method,void 0,t.timestampMode)}));ds(e)&&(tw=!0),h(r)}):h(r)})(e,(n,s)=>{var r,o,a;t.rateLimiter.checkForLimiting(n),400>n.statusCode||null===(r=(o=t.config).on_request_error)||void 0===r||r.call(o,n),i?i(n,s):null===(a=e.callback)||void 0===a||a.call(e,n)})):e.fireCallbackOnDrop&&(null===(r=e.callback)||void 0===r||r.call(e,{statusCode:0}))}var mw=class{constructor(t,e){this.ol=!0,this.al=[],this.ll=Qe((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,Gs.createLogger("flush interval"),3e3),this.ul=t}enqueue(t){this.al.push(t),this.hl||this.cl()}unload(){this.dl();const t=this.al.length>0?this.vl():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.fl(t,"sendBeacon")})}enable(){this.ol=!1,this.cl()}cl(){this.ol||(this.hl=setTimeout(()=>{if(this.dl(),this.al.length>0){const t=this.vl();for(const e in t)this.fl(t[e])}},this.ll))}fl(t,e){try{this.ul(t,e)}catch(t){Gs.error(t)}}dl(){clearTimeout(this.hl),this.hl=void 0}vl(){const t={};return Js(this.al,e=>{var i;const n=e,s=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");Ie(t[s])&&(t[s]=he(he({},n),{},{data:[]})),null===(i=t[s].data)||void 0===i||i.push(n.data)}),this.al=[],t}};const yw=["retriesPerformedSoFar"];var bw=class{constructor(t){this._instance=t,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}resume(){if(!Ie(t)&&"onLine"in t.navigator){if(this.ml=t.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},sr(t,"online",this.yl),sr(t,"offline",this._l)}}get length(){return this.al.length}retriableRequest(t,e){let{retriesPerformedSoFar:i}=t,n=bs(t,yw);Fe(i)&&(n.url=iw(n.url,{retry_count:i})),gw(this._instance,e?he(he({},n),{},{transport:e}):n,(t,e)=>{var s;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.Ls(he({retriesPerformedSoFar:i},n),e);0===t.statusCode&&Gs.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!=i?i:0} retries.`)}null===(s=n.callback)||void 0===s||s.call(n,t)})}Ls(t,e){const i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;const n=Math.max(function(t){const e=3e3*Math.pow(2,t),i=e/2,n=Math.min(18e5,e),s=(Math.random()-.5)*(n-i);return Math.ceil(n+s)}(i),null!=e?e:0),s=Date.now()+n;this.al.push({retryAt:s,requestOptions:t});let r=`Enqueued failed request for retry in ${n}`;navigator.onLine||(r+=" (Browser is offline)"),Gs.warn(r),this.pl||(this.pl=!0,this.wl())}wl(){if(this.kl&&clearTimeout(this.kl),0===this.al.length)return this.pl=!1,void(this.kl=void 0);this.kl=setTimeout(()=>{this.ml&&this.al.length>0&&this.bl(),this.wl()},this.gl)}bl(){const t=Date.now(),e=[],i=this.al.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.al=e,i.length>0)for(const{requestOptions:t}of i)this.retriableRequest(t)}unload(){this.kl&&(clearTimeout(this.kl),this.kl=void 0),this.pl=!1,Ie(t)||(this.yl&&(t.removeEventListener("online",this.yl),this.yl=void 0),this._l&&(t.removeEventListener("offline",this._l),this._l=void 0));for(const{requestOptions:t}of this.al)try{this._instance._send_request(he(he({},t),{},{transport:"sendBeacon"}))}catch(t){Gs.error(t)}this.al=[]}},_w=class{constructor(t){this._instance=t,this.Sl=()=>{var t,e,i,n;this.xl||(this.xl={});const s=this.scrollElement(),r=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=r+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.xl.lastScrollY=Math.ceil(r),this.xl.maxScrollY=Math.max(r,null!==(t=this.xl.maxScrollY)&&void 0!==t?t:0),this.xl.maxScrollHeight=Math.max(o,null!==(e=this.xl.maxScrollHeight)&&void 0!==e?e:0),this.xl.lastContentY=a,this.xl.maxContentY=Math.max(a,null!==(i=this.xl.maxContentY)&&void 0!==i?i:0),this.xl.maxContentHeight=Math.max(l,null!==(n=this.xl.maxContentHeight)&&void 0!==n?n:0)}}get Cl(){return this._instance.config.scroll_root_selector}getContext(){return this.xl}resetContext(){const t=this.xl;return this.xl=void 0,setTimeout(this.Sl,0),t}startMeasuringScrollPosition(){sr(t,"scroll",this.Sl,{capture:!0}),sr(t,"scrollend",this.Sl,{capture:!0}),sr(t,"resize",this.Sl)}scrollElement(){if(this.Cl){const i=xe(this.Cl)?this.Cl:[this.Cl];for(const n of i){var e;const i=null==t||null===(e=t.document)||void 0===e?void 0:e.querySelector(n);if(i)return i}return}var i;return null==t||null===(i=t.document)||void 0===i?void 0:i.documentElement}$l(e){var i,n;const s="y"===e?"scrollTop":"scrollLeft";if(this.Cl){const t=this.scrollElement();return t&&t[s]||0}return t?"y"===e?t.scrollY||t.pageYOffset||(null===(i=t.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:t.scrollX||t.pageXOffset||(null===(n=t.document)||void 0===n||null===(n=n.documentElement)||void 0===n?void 0:n.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}};const ww=t=>Nl(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 kw=class{constructor(t,e,i,n){this.Be=t=>{const e=this.Tl();if(e&&e.sessionId===t)return;const i={sessionId:t,props:this.Il(this._instance)};this.Ml.register({[Tt]:i})},this._instance=t,this.El=e,this.Ml=i,this.Il=n||ww,this.El.onSessionId(this.Be)}Tl(){return this.Ml.props[Tt]}getSetOnceProps(){var t;const e=null===(t=this.Tl())||void 0===t?void 0:t.props;return e?"r"in e?ql(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){const t={};return Js(tr(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t[`$session_entry_${be(i)}`]=e}),t}},Sw=class{on(t,e){return this.Pl[t]||(this.Pl[t]=[]),this.Pl[t].push(e),()=>{this.Pl[t]=this.Pl[t].filter(t=>t!==e)}}emit(t,e){for(const i of this.Pl[t]||[])i(e);for(const i of this.Pl["*"]||[])i(t,e)}constructor(){this.Pl={}}};const xw=Zs("[SessionId]"),Cw=864e5;var $w=class{on(t,e){return this.Rl.on(t,e)}constructor(t,e,i){var n;if(this.Al=null,this.Fl=null,this.Ol=[],this.Dl=void 0,this.Ll=!1,this.Rl=new Sw,this.Nl=(t,e)=>!(!Fe(t)||!Fe(e))&&Math.abs(t-e)>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.Rr=t.config,this.Ml=t.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.ql=void 0,this._sessionActivityTimestamp=null,this.jl=e||Pa,this.Bl=i||Pa;const s=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*Qe(this.Rr.session_idle_timeout_seconds||1800,60,36e3,xw.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hl(),this.zl="ph_"+s+"_window_id",this.Ul="ph_"+s+"_primary_window_exists",this.Wl()){const t=Xa.Dt(this.zl),e=Xa.Dt(this.Ul);t&&!e?this.He=t:Xa.Lt(this.zl),Xa.At(this.Ul,!0)}(null===(n=this.Rr.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this.Rr.bootstrap.sessionID),this.Vl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Ie(this.Ol)&&(this.Ol=[]),this.Ol.push(t),this.Xt&&t(this.Xt,this.He),()=>{this.Ol=this.Ol.filter(e=>e!==t)}}Wl(){return"memory"!==this.Rr.persistence&&!this.Ml.mi&&Xa.Et()}Gl(t){t!==this.He&&(this.He=t,this.Wl()&&Xa.At(this.zl,t))}Zl(){return this.He?this.He:this.Wl()?Xa.Dt(this.zl):null}Ql(t){const e=this.Al;return!Pe(e)&&!Pe(t)&&5e3>Math.abs(t-e)}Jl(t,e,i){const n=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xt=t,s&&!n||s&&this.Ql(e)||(this.Al=e,this.Ml.register({[H]:[e,t,i]}))}Kl(){var t;const e=null===(t=this.Rr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Fe(e)&&e>0}Xl(){this.Kl()?this.Ml.refreshKey(H):(this.Ml.flush(),this.Ml.load())}Yl(){var t;if(Pe(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Al)return;this.Xl();const[,e,i]=this.tu();e===this.Xt&&i===this._sessionStartTimestamp&&(this.Al=this._sessionActivityTimestamp,this.Ml.register({[H]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){const[t]=this.tu(),e=Fe(t)?t:0,i=Fe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}iu(t){return this.Xl(),this.Nl(t,this.eu())}tu(){const t=this.Ml.props[H];return xe(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Al=null,this.ql=void 0,clearTimeout(this.nu),this.nu=void 0,this.Jl(null,null,null)}setBootstrapSessionId(t,e=!1){const i=((t,e=(new Date).getTime())=>{try{const i=(t=>{const e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void xw.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void xw.error("Invalid sessionID in bootstrap",t)}})(t);return!Ie(i)&&(e?this.ql={sessionId:t,sessionStartTimestamp:i}:this.Jl(t,(new Date).getTime(),i),!0)}destroy(){this.Ll=!0,this.Yl(),clearTimeout(this.nu),this.nu=void 0,this.Dl&&t&&(t.removeEventListener(te,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&Xa.Lt(this.Ul)},sr(t,te,this.Dl,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,e=null,i=!1){if("always"===this.Rr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const n=e||(new Date).getTime(),s=this.Xt;if(i)this.Fl=n;else if(Pe(this.Fl)||this.Fl>n||n-this.Fl>=1e3){var r,o;null===(r=(o=this.Ml).syncCookieProperties)||void 0===r||r.call(o),this.Fl=n}let[,a,l]=this.tu();const u=!Ie(s)&&a!==s,h=this.eu();let c=this.Zl();const d=this.ql,v=!!d&&(d.sessionStartTimestamp>n+6e4||n-d.sessionStartTimestamp>Cw),f=d?v:Fe(l)&&Math.abs(n-l)>Cw;let p=!1,g=u,m=!a||!!d;const y=a;let b=!m&&!t&&this.Nl(n,h);if(b&&(b=this.iu(n),b||xw.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.tu(),b||(m=!a||!!d)),m||b||f){g=!1;const t=d&&!v;a=t?d.sessionId:this.jl(),c=this.Bl(),xw.info("new session ID assigned",{sessionId:a,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f}}),l=t?d.sessionStartTimestamp:n,this.ql=void 0,p=!0}else c||(c=this.Bl(),p=!0),g=g||a!==y,g&&(xw.info("adopted cross-tab session id",{sessionId:a,windowId:c}),p=!0);const _=Fe(h)&&t&&!f?h:n,w=Fe(l)?l:(new Date).getTime();this.Gl(c),this.Jl(a,_,w),t||this.Hl();const k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.Ol.forEach(t=>t(a,c,k)),{sessionId:a,windowId:c,sessionStartTimestamp:w,changeReason:p?k:void 0,lastActivityTimestamp:h}}Hl(){this.Ll||(clearTimeout(this.nu),this.nu=setTimeout(()=>{if(!this.Ll)if(this.iu((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Rl.emit("forcedIdleReset",{idleSessionId:t})}else this.Hl()},1.1*this.sessionTimeoutMs))}};const Tw=function(t,e){if(!t)return!1;const i=t.userAgent;if(i&&Ze(i,e))return!0;try{const i=null==t?void 0:t.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(t=>Ze(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver};function Iw(){return Iw=oe(function*(){const t=null==i?void 0:i.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return Me(i)&&i.length>0?i:void 0}catch(t){return void Gs.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}),Iw.apply(this,arguments)}const Mw="custom",Ew="i.posthog.com",Pw=/^\/static\//,Rw=["/s/","/e/","/i/"];var Aw=class{constructor(t){this.su={},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 e=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace(`.${Ew}`,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.su[this.apiHost]||(this.su[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":Mw),this.su[this.apiHost]}ru(t){if(!Pw.test(t))return;const e=this.instance.config.asset_host;return"string"==typeof e&&e.trim().replace(/\/$/,"")||void 0}ou(t){const e=lr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}au(t,e,i){if("ui"===t)return i;let n=i;const s=this.instance.config.rewriteRequestPath;if(s){var r;const t=(null===(r=lr(i))||void 0===r?void 0:r.href)||i;n=s(new URL(t)).toString()}if(s&&"api"===t&&Rw.some(t=>0===e.indexOf(t))){const t=this.ou(n);if(t){const e=this.apiHost;let i=this.lu;(null==i?void 0:i.apiHost)===e&&i.rewriteRequestPath===s||(i={apiHost:e,rewriteRequestPath:s,urls:new Set},this.lu=i),i.urls.add(t)}}return n}isIngestionEndpoint(t){const e=this.lu,i=this.ou(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e=""){if(e&&(e="/"===e[0]?e:`/${e}`),"ui"===t)return this.au(t,e,this.uiHost+e);if("flags"===t)return this.au(t,e,this.flagsApiHost+e);if("assets"===t){const i=this.ru(e);if(i)return this.au(t,e,`${i}${e}`)}if(this.region===Mw)return this.au(t,e,this.apiHost+e);const i=Ew+e;switch(t){case"assets":return this.au(t,e,`https://${this.region}-assets.${i}`);case"api":return this.au(t,e,`https://${this.region}.${i}`)}}};const Fw=Zs("[PostHog ExternalIntegrations]"),Ow={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var Dw=class{constructor(t){this._instance=t}zo(t,e){var i,n;null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,t,t=>{if(t)return Fw.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t;for(const[s,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var e,i,n;r&&!(null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[s])&&this.zo(Ow[s],()=>{var t;null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[s])||void 0===t||t.start(this._instance)}),!r&&(null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[s])&&(null===(n=d.__PosthogExtensions__)||void 0===n||null===(n=n.integrations)||void 0===n||null===(n=n[s])||void 0===n||n.stop())}}},Lw=class{constructor(t,e){this.$=t,this.wo=e,this.uu=new Map,this.Io=!1}add(t){var e=this;return oe(function*(){if(e.Io)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.uu.has(t.name))throw new Error(`Browser extension "${t.name}" is already registered`);e.uu.set(t.name,t);try{const i=t.setup(e.wo);i&&(yield i)}catch(i){const n=e.uu.get(t.name)===t;n&&e.uu.delete(t.name),e.$.error(`Failed to set up browser extension "${t.name}"`,i),n&&e.hu(t)}})()}getExtension(t){return this.uu.get(t)}dispose(){if(this.Io)return;this.Io=!0;const t=Array.from(this.uu.values()).reverse();this.uu.clear();for(const e of t)this.hu(e)}hu(t){try{var e;const i=null===(e=t.dispose)||void 0===e?void 0:e.call(t);i&&Ce(i.then)&&i.then(void 0,e=>{this.$.error(`Failed to dispose browser extension "${t.name}"`,e)})}catch(e){this.$.error(`Failed to dispose browser extension "${t.name}"`,e)}}},Nw=class{constructor(t){this._instance=t}initialize(){}get(t){const e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);const i={};for(const n of t){const t=null==e?void 0:e.get_property(n);Ie(t)||(i[n]=t)}return i}set(t,e){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null===(e=this._instance.persistence)||void 0===e||e.unregister(t)}};const qw="extensionsRemoteConfig";var jw=class{constructor(t){this.instance=t,this.Io=!1,this.$=Gs,this.cu=t.du,this.kv=new Nw(t),this.onEvent=t=>Qp(this.instance.on("eventCaptured",e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.Io)return Qp(()=>{});const e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.vu.on(qw,e);return this.cu&&e(this.cu),Qp(i)},this.fu=new Lw(Gs.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}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(p);return"string"==typeof t?t:void 0}get library(){return{name:Ya.LIB_NAME,version:Ya.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,n;const s=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(n=null==s?void 0:s.sessionStartTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.fu.add(t)}getExtension(t){return this.fu.getExtension(t)}capture(t,e,i){i?this.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):this.instance.capture(t,e)}registerDynamicEventProperties(t){return Qp(this.instance.pu(t))}handleRemoteConfig(t){this.Io||(this.cu=t,this.instance.vu.emit(qw,t))}sendRequest(t){var e=this;return oe(function*(t,i={}){var n;const s=e.instance.requestRouter.endpointFor(null!==(n=i.target)&&void 0!==n?n:"api",t),r={method:i.method,url:i.query?iw(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?de.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(e.instance._send_request(r),{statusCode:202}):new Promise(t=>{r.callback=t,e.instance._send_request(r)})}).apply(this,arguments)}dispose(){this.Io||(this.Io=!0,this.fu.dispose())}};const Bw={};let Hw=0;const zw=()=>{},Uw='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ww="Surveys module not available",Vw="sanitize_properties is deprecated. Use before_send instead",Gw="Invalid value for property_denylist config: ",Zw=/^[A-Za-z0-9_-]{1,400}$/,Qw=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Jw=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Kw=["token","distinct_id",Ft],Xw="posthog",Yw=t=>{const e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},tk=e=>{var i;return he({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==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:zw,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&Me(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null===(i=t.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){Gs.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:Xt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:zw},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Fr,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Yw(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)}))(e))},ek=[["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"]],ik=t=>{const e={};for(const[i,n]of ek)Ie(t[i])||(e[n]=t[i]);const i=Ks({},e,t),n=t.__preview_external_dependency_versioned_paths;return Ie(n)||(Ie(t.strict_script_versioning)&&(i.strict_script_versioning=!!n),Me(n)&&Ie(t.asset_host)&&(i.asset_host=n)),xe(t.property_blacklist)&&(Ie(t.property_denylist)?i.property_denylist=t.property_blacklist:xe(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:Gs.error(Gw+t.property_denylist)),i};var nk=class{constructor(){this.__forceAllowLocalhost=!1}get gu(){return this.__forceAllowLocalhost}set gu(t){Gs.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},sk=class e{mu(t){if(!t)return;const e=this.uu.indexOf(t);-1!==e&&this.uu.splice(e,1)}yu(t,e){var i;return this.mu(t),this.uu.push(e),null===(i=e.initialize)||void 0===i||i.call(e),e}bu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_u(){if(this.wu)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.bu())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.ku)return;let e,i,n;t?(e=`persistence is set to '${this.config.persistence}'`,i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(e="persistence is disabled (disable_persistence is true)",i="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.wu=!0,console.warn("[PostHog.js]",`${e} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${n}`)}Su(){if(this.bu()||"$posthog_cookieless"!==this.get_distinct_id())return;const t=this.persistence;if(!t)return;this.xu()||t.load(!0);const e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){const e=this.config.get_device_id(Pa());this.register({distinct_id:e,$device_id:e}),t.set_property($t,Jt)}this.Cu()}get decideEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.$u=!1,this.Tu=!1,this.webPerformance=new nk,this.Iu=!1,this.version=Ya.LIB_VERSION,this.Mu=new Set,this.Eu="",this.vu=new Sw,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=tk(),this.SentryIntegration=T_,this.sentryIntegration=t=>function(t,e){const i=$_(t,e);return{name:C_,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new _w(this),this.pageViewManager=new I_(this),this.rateLimiter=new G_(this),this.requestRouter=new Aw(this),this.consent=new y_(this),this.externalIntegrations=new Dw(this);const i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,e,i)=>{const n=Me(t)?{[t]:e}:t;this.setPersonProperties(n),null==i||i({})},set_once:(t,e,i)=>{const n=Me(t)?{[t]:e}:t;this.setPersonProperties(void 0,n),null==i||i({})}},this.on("eventCaptured",t=>Gs.info(`send "${null==t?void 0:t.event}"`,t))}init(t,i,n){if(n&&n!==Xw){var s;const r=null!==(s=Bw[n])&&void 0!==s?s:new e;return r._init(t,i,n),Bw[n]=r,Bw[Xw][n]=r,r}return this._init(t,i,n)}_init(e,i={},n){var s,r,o;const a=Me(e)?e.trim():"";if(!a)return Gs.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==(null===(l=this.config)||void 0===l?void 0:l.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=tk(i.defaults),i.debug=this.Du(i.debug),this.Lu=i,this.Nu=[],i.person_profiles?this.Fu=i.person_profiles:i.process_person&&(this.Fu=i.process_person);const u=tk(i.defaults),h=ik(i),c=Ks({},u,h,{name:n,token:a});$e(u.rageclick)&&$e(h.rageclick)&&(c.rageclick=Ks({},u.rageclick,h.rageclick)),$e(u.session_recording)&&$e(h.session_recording)&&(c.session_recording=Ks({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&Gs.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:wp;const d=this.xu();if(this.persistence=new W_(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new W_(he(he({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.Eu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Xa.Et()){const t=Xa.Dt(this.Eu);xe(t)&&t.forEach(t=>{Me(t)&&this.Mu.add(t)})}else Xa.Lt(this.Eu);const v=he({},this.persistence.props),f=he({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.qu=new mw((t,e)=>this.ju(t,e),this.config.request_queue_config),this.Bu=new bw(this),this.__request_queue=[];const p=this.bu();p||(this.sessionManager=new $w(this),this.sessionPropsManager=new kw(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(Gs.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(p)},0)):(Gs.info("Initializing extensions synchronously"),this.Uu(p)),Ya.DEBUG=Ya.DEBUG||this.config.debug,Ya.DEBUG&&Gs.info("Starting in debug mode",{this:this,config:i,thisC:he({},this.config),p:v,s:f}),this.config.identity_distinct_id&&!(null===(s=i.bootstrap)||void 0===s?void 0:s.distinctID)&&(i.bootstrap=he(he({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this.ku=!!m&&!Ee(m),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const t=i.bootstrap.distinctID,e=this.get_distinct_id(),n=this.persistence.get_property($t);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===n)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===n)Gs.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(Pa()),n=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property($t,i.bootstrap.isIdentifiedID?Kt:Jt),this.register({distinct_id:t,$device_id:n})}}if(p)this.register_once({distinct_id:At,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(Pa());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property($t,Jt)}return sr(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),sr(t,"pageshow",()=>{var t;this.$u=!1,this.Tu||null===(t=this.Bu)||void 0===t||t.resume()}),i.segment?x_(this,()=>this.Wu()):this.Wu(),Ce(this.config._onCapture)&&this.config._onCapture!==zw&&(Gs.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Gs.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 Iw.apply(this,arguments)}().then(t=>{t&&this.register({[g]:t})}).catch(zw),this}Vu(t){const e=t;return Me(e.name)&&Ce(e.setup)}Gu(t,e){this.Vu(t)?e.push(()=>{this.Zu().add(t).catch(()=>{var e;return null===(e=t.dispose)||void 0===e?void 0:e.call(t)}).catch(e=>{Gs.error(`Failed to dispose browser extension "${t.name}"`,e)})}):this.uu.push(t)}zu(){var t,i,n;const s=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(n=e.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var r,o,a;s&&(this.featureFlags&&this.featureFlags instanceof s||(null===(r=this.Qu)||void 0===r||r.call(this),this.Qu=void 0,this.featureFlags=new s(this)),Ce(this.featureFlags.onReloading)&&Ce(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.vu.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):null===(o=(a=this.featureFlags).initialize)||void 0===o||o.call(a))}Uu(t){const i=performance.now(),n=he(he({},e.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,a,l,u,h,c;n.exceptions&&this.uu.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this.uu.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this.uu.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.uu.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!t&&this.uu.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this.Gu(this.autocapture=new n.autocapture(this),s),n.surveys&&this.Gu(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this.Gu(this.logs=null!==(a=this.logs)&&void 0!==a?a:new n.logs(this),s),n.metrics&&this.uu.push(this.metrics=null!==(l=this.metrics)&&void 0!==l?l:new n.metrics(this)),n.conversations&&this.uu.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new n.conversations(this)),n.productTours&&this.uu.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.uu.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.uu.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.uu.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.uu.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,w_)),n.toolbar&&this.uu.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new n.toolbar(this)),n.experiments&&this.uu.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new n.experiments(this)),this.uu.forEach(t=>{t.initialize&&s.push(()=>{var e;null===(e=t.initialize)||void 0===e||e.call(t)})}),s.push(()=>{if(this.Ju){const t=this.Ju;this.Ju=void 0,this.uu.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}}),this.Ku(s,i)}Ku(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.Ku(t,e)},0);const i=t.shift();if(i)try{i()}catch(t){Gs.error("Error initializing extension:",t)}}const i=Math.round(performance.now()-e);this.register_for_session({[Ot]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Dt]:i}),this.config.__preview_deferred_init_extensions&&Gs.info(`PostHog extensions initialized (${i}ms)`)}il(t){var e;if(!n||!n.body)return Gs.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.il(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=t),this.du=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=me(e.supportedCompression,wp)?wp:me(e.supportedCompression,kp)?kp:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:Xt}),null===(e=this.Xu)||void 0===e||e.handleRemoteConfig(t),this.uu.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}Wu(){try{this.config.loaded(this)}catch(t){Gs.critical("`loaded` function failed",t)}if(this.Yu(),this.config.internal_or_test_user_hostname&&(null==s?void 0:s.hostname)){const t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.bu())&&this.th()},1),this.eh=new Q_(this),this.eh.load()}Yu(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.qu)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Qs(this.__request_queue,t=>this.ju(t)),this.__request_queue=[],this.Yu()}_handle_unload(){var t,e,i,n,s,r;this.$u=!0,null===(t=this.surveys)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(ie),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this.qu)||void 0===s||s.unload(),null===(r=this.Bu)||void 0===r||r.unload()):this.ih()&&this.capture(ie,null,{transport:"sendBeacon"})}_send_request(t){gw(this,t)}ju(t,e){this.Bu?this.Bu.retriableRequest(t,e):this._send_request(e?he(he({},t),{},{transport:e}):t)}_execute_array(t){Hw++;try{let e;const i=[],n=[],s=[];Qs(t,t=>{if(t)if(e=t[0],xe(e))s.push(t);else if(Ce(t))try{t.call(this)}catch(e){Gs.error("Error executing queued PostHog call",t,e)}else xe(t)&&"alias"===e?i.push(t):xe(t)&&-1!==e.indexOf("capture")&&Ce(this[e])?s.push(t):n.push(t)});const r=function(t,e){Qs(t,function(t){try{if(xe(t[0])){let i=e;Js(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){Gs.error("Error executing queued PostHog call",t,e)}})};r(i,this),r(n,this),r(s,this)}finally{Hw--}}push(t){if(Hw>0&&xe(t)&&Me(t[0])){const i=e.prototype[t[0]];return void(Ce(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}get nh(){return{property:b,persistenceKey:_,cookieName:"_fbc",pattern:Qw,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[_]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(_)}}}get sh(){return{property:w,persistenceKey:k,cookieName:"_fbp",pattern:Jw,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[k]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(k)}}}rh(t){var e;const i=null===(e=this.persistence)||void 0===e?void 0:e.get_property(t.persistenceKey);return Me(i)&&t.pattern.test(i)?{value:i,delivered:!1}:$e(i)&&Me(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}oh(t,e,i){return e===(null==i?void 0:i.value)?{value:e,pending:!i.delivered}:(t.register(e,!1),{value:e,pending:!0})}ah(t){if(!this.config.save_campaign_params||this.bu())return;const e=Ca(t.cookieName);return Me(e)&&t.pattern.test(e)?e:void 0}uh(t,e,i,n){if(!this.persistence)return;const s=this.nh;this.persistence.refreshKey(s.persistenceKey);const r=this.rh(s);if(n)return void s.unregister();if(i)return Me(e)&&Qw.test(e)?this.oh(s,e,r):void s.unregister();const o=Me(t)&&Zw.test(t)?t:void 0,a=this.ah(s);return a&&((t,e,i)=>{const n=t.split(".");if(e)return n[3]===e;if(!i)return!0;const s=i.value.split(".");return n[3]===s[3]||Number(n[2])>Number(s[2])})(a,o,r)?this.oh(s,a,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.oh(s,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}hh(t,e,i){if(!this.persistence)return;const n=this.sh;this.persistence.refreshKey(n.persistenceKey);const s=this.rh(n);if(i)return void n.unregister();if(e)return Me(t)&&Jw.test(t)?this.oh(n,t,s):void n.unregister();const r=this.ah(n);return r?this.oh(n,r,s):s?{value:s.value,pending:!s.delivered}:void 0}dh(t,e){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const i=this.rh(t);(null==i?void 0:i.value)!==e||i.delivered||t.register(e,!0)}capture(t,e,i){var n,s;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void Gs.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Ie(t)||!Me(t))return void Gs.error("No event name provided to posthog.capture");this.Su();const r=!this.config.opt_out_useragent_filter&&this._is_bot();if(r&&!this.config.__preview_capture_bot_pageviews)return;const o=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==o?void 0:o.isRateLimited)return void Gs.critical("This capture call is ignored due to client rate limiting.");let a;(null==e?void 0:e.$current_url)&&!Me(null==e?void 0:e.$current_url)&&(Gs.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||(null==i?void 0:i.fh)||Gs.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(a=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const l=new Date,u=(null==i?void 0:i.timestamp)||l,h=ln(null==i?void 0:i.uuid,Pa);let c={uuid:h,event:t,properties:this.calculateEventProperties(t,e||{},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==i?void 0:i.$set)&&!d&&(c.$set=null==i?void 0:i.$set);const v=$e(null==e?void 0:e.$set)?e.$set:void 0,f=xe(null==e?void 0:e.$unset)?e.$unset:[],p=(null==i?void 0:i.$unset)||[],g=t=>{var e;const n=!!(null==i?void 0:i.$set)&&t in i.$set;return{hasProvided:n||!!v&&t in v,provided:n?null==i||null===(e=i.$set)||void 0===e?void 0:e[t]:null==v?void 0:v[t],unset:-1!==f.indexOf(t)||-1!==p.indexOf(t)}},m=g(b),y=g(w),_=[{channel:this.nh,hasProvided:m.hasProvided,update:this.uh(null==a?void 0:a.fbclid,m.provided,m.hasProvided,m.unset)},{channel:this.sh,hasProvided:y.hasProvided,update:this.hh(y.provided,y.hasProvided,y.unset)}];for(const{channel:t,hasProvided:e,update:i}of _)i&&!0===c.properties.$process_person_profile&&i.pending&&!e&&!d&&(c.$set=he({[t.property]:i.value},c.$set));const k=null==i?void 0:i.$unset;k&&(c.$unset=k);const S=d?void 0:this.ph(null==i?void 0:i.$set_once,t!==se,t===ne);if(S&&(c.$set_once=S),(null==i?void 0:i._noTruncate)||(x=this.config.properties_string_max_length,c=function(t,e){const i=new Set;return function t(n,s){if(n!==Object(n))return e?e(n):n;if(i.has(n))return;let r;if(i.add(n),xe(n))r=[],Qs(n,e=>{r.push(t(e))});else{const e={};Js(Be(n)?er(n):n,(n,s)=>{i.has(n)||(e[s]=t(n,s))}),r=e}return r}(t)}(c,t=>Me(t)?t.slice(0,x):t)),c.timestamp=u,Ie(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=l),d&&(c.properties=((t,e=[])=>{const i={},n=e=>{void 0!==t[e]&&(i[e]=t[e])};return as.forEach(n),e.forEach(n),i})(c.properties,Kw)),t===jp||t===Bp){const i=null==e?void 0:e[Hp],n=null==e?void 0:e[Up];ng({id:i,current_iteration:n}),c.$set=he(he({},c.$set),{},{[ol({id:i,current_iteration:n},t===Bp?"responded":"dismissed")]:!0})}else t===qp&&(c.$set=he(he({},c.$set),{},{[Vp]:(new Date).toISOString()}));var x;if("product tour shown"===t){const t=null==e?void 0:e.$product_tour_type;t&&(c.$set=he(he({},c.$set),{},{[`$product_tour_last_seen_date/${t}`]:(new Date).toISOString()}))}const C=he(he({},c.properties.$set),c.$set);if(Te(C)||this.setPersonPropertiesForFlags(C),!Re(this.config.before_send)){const t=this.Os(c);if(!t)return;c=t,c.uuid=ln(c.uuid,Pa)}const T=_.filter(({channel:t,update:e})=>{var i,n,s;const r=null!==(i=null===(n=c.$set)||void 0===n?void 0:n[t.property])&&void 0!==i?i:$e(null===(s=c.properties)||void 0===s?void 0:s.$set)?c.properties.$set[t.property]:void 0;return(null==e?void 0:e.pending)&&r===e.value});this.vu.emit("eventCaptured",c);const I=null!==(n=null==i?void 0:i._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),M="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(I),E=he(he(he({method:"POST",url:I,data:c,compression:"best-available",preferSyncCompression:null==i?void 0:i.send_instantly,timestampMode:M?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},M&&(null===(s=c.properties)||void 0===s?void 0:s.$session_id)?{batchGroup:c.properties.$session_id+(c.properties.$window_id?`-${c.properties.$window_id}`:"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),T.length?{fireCallbackOnDrop:!0,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(const{channel:t,update:e}of T)this.dh(t,e.value)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||T.length){var P;let t;!E.transport&&!E.callback&&Te(null!==(P=this.config.request_headers)&&void 0!==P?P:{})&&this.$u&&(t="sendBeacon"),this.ju(E,t)}else this.qu.enqueue(E);return c}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null===(e=this.Xu)||void 0===e?void 0:e.getExtension(t)}Zu(){var t;return null!==(t=this.Xu)&&void 0!==t?t:this.Xu=new jw(this)}pu(t){this.Pu.push(t);let e=!0;return()=>{if(!e)return;e=!1;const i=this.Pu.indexOf(t);-1!==i&&this.Pu.splice(i,1)}}gh(t=!0){var e,i,n;return!!(null===(e=this.persistence)||void 0===e?void 0:e.consumeCookieIdentityChange())&&(this.Ou=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.Mu.clear(),this.mh()),null===(i=this.featureFlags)||void 0===i||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,r,o,a){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.gh();const l=a?void 0:this.persistence.remove_event_timer(e);let h=he({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.bu()&&(h[Ft]=!0),"$snapshot"===e){const t=he(he({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=t.distinct_id,(!Me(h.distinct_id)&&!Ae(h.distinct_id)||Ee(h.distinct_id))&&Gs.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const c=function(e,i,n,r=!1){var o,a,l,h;if(!u)return{};const c=e?[...Tl,...i||[]]:[],[d,v]=Qi(u),[f,p]=function(t){for(let e=0;Yi.length>e;e++){const[i,n,s]=Yi[e],r=t.match(i);if(r){const e=s&&t.match(s)||r;return[n,(null==e?void 0:e[1])||""]}}return["",""]}(u),g=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),m={};Ie(n)||(m.detectGoogleSearchApp=n);const y={},b=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,_=null===(a=navigator)||void 0===a?void 0:a.maxTouchPoints,w=null==t||null===(l=t.screen)||void 0===l?void 0:l.width,k=null==t||null===(h=t.screen)||void 0===h?void 0:h.height,S=null==t?void 0:t.devicePixelRatio;Ie(b)||(y.userAgentDataPlatform=b),Ie(_)||(y.maxTouchPoints=_),Ie(w)||(y.screenWidth=w),Ie(k)||(y.screenHeight=k),Ie(S)||(y.devicePixelRatio=S);const x=Ks(tr({$os:d,$os_version:v,$browser:Wi(u,navigator.vendor,g,m),$webview_app:f,$webview_app_version:p,$device:Ji(u),$device_type:Ki(u,y),$timezone:jl(),$timezone_offset:Bl()}),{$current_url:cr(r?hn(null==s?void 0:s.href):null==s?void 0:s.href,c,Ml),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Gi(u,navigator.vendor,g,m),$browser_language:Fl(),$browser_language_prefix:Ol(),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:Ws.LIB_NAME,$lib_version:Ws.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Ws.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=Ws.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:e}=this.sessionManager.checkAndGetSessionAndWindowId(a,r.getTime(),!0);h.$session_id=t,h.$window_id=e}this.sessionPropsManager&&Ks(h,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&Ks(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null===(d=this.Bu)||void 0===d?void 0:d.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}let v;if(this.requestRouter.region===Mw&&(h.$lib_custom_api_host=this.config.api_host),v="$pageview"!==e||a?"$pageleave"!==e||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),h=Ks(h,v),"$pageview"===e&&n&&(h.title=n.title),!Ie(l)){const t=r.getTime()-l;h.$duration=parseFloat((t/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const f=this.persistence.properties(),p=this.sessionPersistence.properties(),g=h.$groups,m=f.$groups;$e(g)&&!Te(g)&&(h.$groups=he(he({},$e(m)?m:{}),g)),Js(["$referrer","$referring_domain"],t=>{t in f&&delete p[t]});const y={};if(this.Pu.length>0)for(const t of this.Pu.slice())try{Ks(y,t())}catch(t){Gs.error("Failed to produce browser extension event properties",t)}h=Ks({},c,f,p,he(he({},y),h)),h.$is_identified=this._isIdentified(),xe(this.config.property_denylist)?Js(this.config.property_denylist,function(t){delete h[t]}):Gs.error(Gw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const b=this.config.sanitize_properties;b&&(Gs.error(Vw),h=b(h,e));const _=this.yh();return h.$process_person_profile=_,_&&!a&&this.bh("_calculate_event_properties"),h}ph(t,e=!0,i=!1){var n;if(!this.persistence||!this.yh())return t;if(this.Iu&&!i)return t;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Ks({},s,r||{},t||{});const a=this.config.sanitize_properties;return a&&(Gs.error(Vw),o=a(o,"$set_once")),e&&(this.Iu=!0),Te(o)?void 0:o}register(t,e){var i;null===(i=this.persistence)||void 0===i||i.register(t,e)}register_once(t,e,i){var n;null===(n=this.persistence)||void 0===n||n.register_once(t,e,i)}register_for_session(t){var e,i;null===(e=this.persistence)||void 0===e||e.syncCookieProperties(),this.gh(),null===(i=this.sessionPersistence)||void 0===i||i.register(t),Object.keys(t).forEach(t=>this.Mu.add(t)),this.mh()}unregister(t){var e;null===(e=this.persistence)||void 0===e||e.unregister(t)}unregister_for_session(t){var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t),this.Mu.delete(t),this.mh()}_h(t,e){this.register({[t]:e})}Hu(){this.Mu.forEach(t=>{var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t)}),this.Mu.clear(),this.mh()}mh(){var t;if(!this.Eu)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.mi)||!Xa.Et())return void Xa.Lt(this.Eu);const e=[];this.Mu.forEach(t=>e.push(t)),e.length>0?Xa.At(this.Eu,e):Xa.Lt(this.Eu)}getFeatureFlag(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,n;return null!==(i=null===(n=this.featureFlags)||void 0===n?void 0:n.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e=!1,i){var n;return null===(n=this.featureFlags)||void 0===n?void 0:n.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.vu.on(t,e)}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:Ww}),()=>{})}onSessionId(t){var e,i;return null!==(e=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e=!1){this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:Ww})}getActiveMatchingSurveys(t,e=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Ww})}renderSurvey(t,e){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(t,e)}displaySurvey(t,e=rg){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null===(e=this.surveys)||void 0===e||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:Ww}}canRenderSurveyAsync(t,e=!1){var i,n;return null!==(i=null===(n=this.surveys)||void 0===n?void 0:n.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Ww})}wh(t){return!t||Ee(t)?(Gs.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Gs.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())||(Gs.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,e,i){if(!this.__loaded||!this.persistence)return Gs.uninitializedWarning("posthog.identify");if(Ae(t)&&(t=t.toString(),Gs.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(t))return;if(!this.bh("posthog.identify"))return;this.Su();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this.gh(!1),o=this.persistence.Da();let a=!1;try{const n=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),t!==n&&t!==this.get_property("__alias")&&(this.unregister(m),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Jt,u=t!==n,h=!u&&o;if(u&&o){var l;const s=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:n};this.persistence.set_property($t,Kt),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$identify",s,{$set:e||{},$set_once:i||{}})&&(this.Ou=bl(t,e,i)),null===(l=this.featureFlags)||void 0===l||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:n)}else if(h){this.persistence.set_property($t,Kt);const n=e||{},s=i||{};this.setPersonPropertiesForFlags({$set:n,$set_once:s},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$set",{$set:n,$set_once:s})&&(this.Ou=bl(t,e,i))}else(e||i)&&this.setPersonProperties(e,i);u||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(kt)):h&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.ja(a)}}setPersonProperties(t,e){if(!t&&!e)return;if(!this.bh("posthog.setPersonProperties"))return;const i=bl(this.get_distinct_id(),t,e);this.Ou!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}})&&(this.Ou=i)):Gs.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var e;const i=(xe(t)?t:[t]).filter(t=>Me(t)&&t.length>0);0!==i.length&&this.bh("posthog.unsetPersonProperties")&&(null===(e=this.featureFlags)||void 0===e||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Ou=null)}group(t,e,i){var n;if(!t||!e)return void Gs.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.gh();const s=this.getGroups(),r=s[t]!==e;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:he(he({},s),{},{[t]:e})}),(r||i)&&this.yh()){const n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(se,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),r&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t=!0){var e;null===(e=this.featureFlags)||void 0===e||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e=!0){var i;this.bh("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null===(e=this.featureFlags)||void 0===e||e.resetGroupPropertiesForFlags(t)}reset(t){const e=Oe(t)?t:null==t?void 0:t.resetDeviceID,i=Oe(t)||null==t?void 0:t.bootstrap;this.kh(e,!1,i)}kh(t,e=!1,i){var n,s,r,o,a,l;if(Gs.info("reset"),!this.__loaded)return Gs.uninitializedWarning("posthog.reset");const u=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this.Lu)||void 0===n?void 0:n.bootstrap)||{},null===(s=this.featureFlags)||void 0===s||null===(r=s.updateConfig)||void 0===r||r.call(s,this.config,this.nl());const h=this.get_property(p),c=this.get_property(g),d=this.get_property(O);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();this.consent.reset(),e||!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===(a=this.persistence)||void 0===a||null===(l=a.Da)||void 0===l?void 0:l.call(a);let m=!1;try{var y,b,_,w,k,S,x,C,T,I,M,E,P;if(null===(y=this.persistence)||void 0===y||y.clear(),null===(b=this.sessionPersistence)||void 0===b||b.clear(),this.Mu.clear(),this.mh(),Ie(d)||null===(I=this.persistence)||void 0===I||I.register({$session_recording_remote_config:d}),null===(_=this.surveys)||void 0===_||_.reset(),null===(w=this.featureFlags)||void 0===w||w.reset(),null===(k=this.conversations)||void 0===k||k.reset(),null===(S=this.logs)||void 0===S||S.reset(),null===(x=this.metrics)||void 0===x||x.reset(),null===(C=this.persistence)||void 0===C||C.set_property("$user_state","anonymous"),null===(T=this.sessionManager)||void 0===T||T.resetSessionId(),this.Ou=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:At,$device_id:null},"");else{const e=this.config.get_device_id(Pa());this.register_once({distinct_id:e,$device_id:t?e:h},""),t||Ie(c)||this.register({[g]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this.bu()&&(null===(P=this.persistence)||void 0===P||P.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(M=this.featureFlags)||void 0===M||M.initialize(),!Re(u)&&!(null===(E=this.sessionManager)||void 0===E?void 0:E.setBootstrapSessionId(u,!0))){const t=he({},i);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var R,A;f&&(null===(R=this.persistence)||void 0===R||null===(A=R.ja)||void 0===A||A.call(R,m))}this.reloadFeatureFlags()}shutdown(t){var e=this;return oe(function*(){var t,i,n,s,r,o,a,l;if(e.__loaded){e.Tu=!0,e.Zu().dispose(),null===(t=e.sessionRecording)||void 0===t||t.dispose(),null===(i=e.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(n=e.metrics)||void 0===n||n.flush("sendBeacon"),null===(s=e.metrics)||void 0===s||s.dispose(),null===(r=e.qu)||void 0===r||r.unload(),null===(o=e.Bu)||void 0===o||o.unload();try{var u;null===(u=e.featureFlags)||void 0===u||u.destroy()}catch(t){Gs.error("Error while destroying feature flags",t)}null===(a=e.persistence)||void 0===a||a.destroy(),null===(l=e.sessionPersistence)||void 0===l||l.destroy()}else Gs.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null===(i=this.conversations)||void 0===i||i.Sh()}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.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null===(e=this.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let n=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${e}`);if((null==t?void 0:t.withTimestamp)&&i){var s;const e=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return n;n+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-e,0)}`}return n}alias(t,e){return t===this.get_property("$people_distinct_id")?(Gs.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(Ie(e)&&(e=this.get_distinct_id()),t!==e?(this._h(m,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Gs.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const e=he({},this.config);if($e(t)){var i,n,s,r,o,a,l,u,h,c,d,v,f,p;Ks(this.config,ik(t));const m=this.xu();null===(i=this.persistence)||void 0===i||i.update_config(this.config,e,m),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new W_(he(he({},this.config),{},{persistence:"sessionStorage"}),m,!1);const y=this.Du(this.config.debug);var g;Oe(y)&&(this.config.debug=y),Oe(this.config.debug)&&(this.config.debug?(Ya.DEBUG=!0,Na.Et()&&Na.At("ph_debug",!0),Gs.info("set_config",{config:t,oldConfig:e,newConfig:he({},this.config)})):(Ya.DEBUG=!1,Na.Et()&&Na.Lt("ph_debug"))),null===(n=this.featureFlags)||void 0===n||null===(s=n.updateConfig)||void 0===s||s.call(n,this.config,this.nl()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(a=this.metrics)||void 0===a||a.onConfigChange(),null===(l=this.sessionRecording)||void 0===l||l.startIfEnabledOrStop(),null===(u=this.tracingHeaders)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.autocapture)||void 0===h||h.startIfEnabled(),null===(c=this.heatmaps)||void 0===c||c.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(g=this.historyAutocapture)||void 0===g||g.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.deadClicksAutocapture)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),this.Cu(),null===(p=this.externalIntegrations)||void 0===p||p.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&x_(this,zw,!1)}}_overrideSDKInfo(t,e){Ya.LIB_NAME=t,Ya.LIB_VERSION=e}startSessionRecording(t){const e=!0===t,i={sampling:e||!!(null==t?void 0:t.sampling),linked_flag:e||!!(null==t?void 0:t.linked_flag),url_trigger:e||!!(null==t?void 0:t.url_trigger),event_trigger:e||!!(null==t?void 0:t.event_trigger)};var n,s,r,o,a;Object.values(i).some(Boolean)&&(null===(n=this.sessionManager)||void 0===n||n.checkAndGetSessionAndWindowId(),i.sampling&&(null===(s=this.sessionRecording)||void 0===s||s.overrideSampling()),i.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),i.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),i.event_trigger&&(null===(a=this.sessionRecording)||void 0===a||a.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,e){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(he(he({},i),e))}catch(t){return}}addExceptionStep(t,e){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(t,e)}captureLog(t){var e;null===(e=this.logs)||void 0===e||e.captureLog(t)}get logger(){var t,i;return null!==(t=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==t?t:e.Ch}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null===(i=this.toolbar)||void 0===i?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null===(e=this.persistence)||void 0===e?void 0:e.props[t]}getSessionProperty(t){var e;return null===(e=this.sessionPersistence)||void 0===e?void 0:e.props[t]}toString(){var t;let e=null!==(t=this.config.name)&&void 0!==t?t:Xw;return e!==Xw&&(e="posthog."+e),e}_isIdentified(){var t,e;return"identified"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))||"identified"===(null===(e=this.sessionPersistence)||void 0===e?void 0:e.get_property("$user_state"))}yh(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&Te(this.getGroups())&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.__alias)&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.$epp))}ih(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(t){return"never"===this.config.person_profiles?(Gs.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._u(),this._h(Rt,!0),!0)}xu(){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)}Cu(){var t,e;const i=this.xu();var n,s,r;return this.is_capturing()||null===(n=this.logs)||void 0===n||n.$h(),(null===(t=this.persistence)||void 0===t?void 0:t.mi)!==i&&(null===(s=this.persistence)||void 0===s||s.set_disabled(i)),(null===(e=this.sessionPersistence)||void 0===e?void 0:e.mi)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),i&&(this.Mu.clear(),this.mh()),i}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){if(this.bu()){var n,s,r,o,a,l;null===(n=this.sessionRecording)||void 0===n||n.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),null===(s=this.sessionManager)||void 0===s||s.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new $w(this),this.pageViewManager=new I_(this),this.persistence&&(this.sessionPropsManager=new kw(this,this.sessionManager,this.persistence));const t=null!==(o=null===(a=this.config.__extensionClasses)||void 0===a?void 0:a.sessionRecording)&&void 0!==o?o:null===(l=e.__defaultExtensionClasses)||void 0===l?void 0:l.sessionRecording;var u,h;t&&(this.sessionRecording=this.yu(this.sessionRecording,new t(this)),this.du&&(null===(u=this.sessionRecording)||void 0===u||null===(h=u.onRemoteConfig)||void 0===h||h.call(u,this.du)))}var c,d;this.consent.optInOut(!0),this.Cu(),this.Yu(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(c=this.surveys)||void 0===c||c.loadIfEnabled()),(Ie(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else Gs.warn(Uw)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void Gs.warn(Uw);const t="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;var e,i;null==t||t.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.Cu(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:At,$device_id:null}),this.mu(t),this.sessionRecording=void 0,null===(e=this.sessionManager)||void 0===e||e.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}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"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.Cu()}_is_bot(){return i?Tw(i,this.config.custom_blocked_useragents):void 0}th(){n&&("visible"===n.visibilityState?this.Ru||(this.Ru=!0,this.capture(ee,{title:n.title},{send_instantly:!0}),this.Au&&(n.removeEventListener(Yt,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),sr(n,Yt,this.Au)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}nl(){const t=this.Lu||{};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?(Gs.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,e,i,n,s){const r=e in t&&!Re(t[e]),o=i in t&&!Re(t[i]);return r?t[e]:!!o&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${e}' instead. The old field will be removed in a future major version.`),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,Gs)}Os(t){var e;if(Re(this.config.before_send))return t;const i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(Ne),n=xe(this.config.before_send)?this.config.before_send:[this.config.before_send];let s=t;for(const e of n)try{if(s=e(s),Re(s)){const e=`Event '${t.event}' was rejected in beforeSend function`;return Le(t.event)?Gs.warn(`${e}. This can cause unexpected behavior.`):Gs.info(e),null}s.properties&&!Te(s.properties)||Gs.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(e){return Gs.error(`Error in beforeSend function for event '${t.event}':`,e),null}for(const e of i)if(s.properties&&Re(s.properties[e]))return Gs.warn(`Event '${t.event}' had its '${e}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return s}getPageViewId(){var t;return null===(t=this.pageViewManager.Vo)||void 0===t?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Du(t){const e=Oe(t)&&!t,i=Na.Et()&&"true"===Na.Ot("ph_debug");return!e&&(!!i||t)}};sk.__defaultExtensionClasses={},sk.Ch=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(let i=0;e.length>i;i++)t.prototype[e[i]]=Ys(t.prototype[e[i]])}(sk,["identify"]);var rk=class{constructor(t){this._instance=t}refresh(t){const e=this._instance.config,i=$e(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.nl(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}};const ok=Zs("[ExceptionAutocapture]"),ak=Zs("[TracingHeaders]"),lk=Zs("[Web Vitals]"),uk=9e5,hk=["CLS","FCP","INP","LCP"],ck=["INP","LCP"],dk=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],vk=Zs("[SessionRecording]"),fk=Zs("[Heatmaps]");function pk(t){return $e(t)&&"clientX"in t&&"clientY"in t&&Ae(t.clientX)&&Ae(t.clientY)}const gk=Zs("[Product Tours]"),mk=t=>{var e;return!t.config.disable_product_tours&&!!(null===(e=t.persistence)||void 0===e?void 0:e.get_property(R))},yk=["$set_once","$set"],bk=Zs("[SiteApps]"),_k="Error while initializing PostHog app with config id ",wk=(t,e)=>(null==t?void 0:t.then)?t.then(e):e(t),kk="SDK is not enabled or survey functionality is not yet loaded",Sk="Disabled. Not loading surveys.";var xk=class{constructor(t,e){this.So=t,this.Th=e,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=[],this.Eh=null,this.Ph=null,this.Io=!1,this.Rh=new Set,this.onRemoteConfig=t=>{if(this.Io)return;if(this.Rr.disableSurveys)return;if(!t.ok)return Jp.warn("Remote config unavailable. Not loading surveys.");const e=t.config.surveys;if(Re(e))return Jp.warn("Flags not loaded yet. Not loading surveys.");this.Ah=Oe(e)?e:e.length>0,Jp.info(`flags response received, isSurveysEnabled: ${this.Ah}`),this.loadIfEnabled()}}setup(t){if(!this.Io)return this.Fh=t,wk(t.kv.initialize(),()=>{if(this.Fh!==t||this.Io)return;this.Fh=void 0,this.wo=t;const e=t.onRemoteConfig(this.onRemoteConfig);this.Io?e.dispose():(this.Po=e,this.loadIfEnabled())})}dispose(){var t,e,i,n;this.Io||(this.Io=!0,this.Fh=void 0,this.wo=void 0,null===(t=this.Po)||void 0===t||t.dispose(),this.Po=void 0,null===(e=this._surveyEventReceiver)||void 0===e||e.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(n=i.dispose)||void 0===n||n.call(i),this._surveyManager=null,this.Mh=[],this.Eh=null,this.Rh.forEach(t=>clearTimeout(t)),this.Rh.clear())}get Rr(){return this.So.get()}initialize(){this.loadIfEnabled()}reset(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.clearInMemoryInProgressSurveyState)||void 0===e||e.call(t);try{var i;null===(i=this._surveyEventReceiver)||void 0===i||i.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let e=0;e<localStorage.length;e++){const i=localStorage.key(e);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&t.push(i)}t.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(this.Io||!this.wo)return;const t=this.Rr;if(this._surveyManager)return;if(this.Ih)return void Jp.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Jp.info(Sk);if(t.cookielessMode&&this.So.isOptedOut())return void Jp.info("Not loading surveys in cookieless mode without consent.");const e=this.So.getExtensions();if(!e)return void Jp.error("PostHog Extensions not found.");if(Ie(this.Ah)&&!t.advancedEnableSurveys)return;const i=this.Ah||t.advancedEnableSurveys;this.Ih=!0;try{const t=e.generateSurveys;if(t)return this.Oh(t,i),void(this.Ih=!1);const n=e.loadExternalDependency;if(!n)return this.Dh(Qt),void(this.Ih=!1);n(t=>{try{if(this.Io)return;const e=this.So.getExtensions();t||!(null==e?void 0:e.generateSurveys)?this.Dh("Could not load surveys script",t):this.Oh(e.generateSurveys,i)}finally{this.Ih=!1}})}catch(t){throw this.Ih=!1,this.Dh("Error initializing surveys",t),t}}Oh(t,e){this.Io||(this._surveyManager=t(e),this._surveyEventReceiver=this.So.createEventReceiver(),Jp.info("Surveys loaded successfully"),this.Lh({isLoaded:!0}))}Dh(t,e){Jp.error(t,e),this.Lh({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Mh.push(t),this._surveyManager&&this.Lh({isLoaded:!0}),()=>{this.Mh=this.Mh.filter(e=>e!==t)}}getSurveys(t,e=!1){var i;const n=null!==(i=this.wo)&&void 0!==i?i:this.Th;if(!n||this.Io)return;if(this.Rr.disableSurveys)return Jp.info(Sk),t([]);const s=n.kv.get(ht);if(s&&!e)return t(s,{isLoaded:!0}),void(this.Nh()&&this.getSurveys(()=>{},!0));if(this.Eh)return void this.Eh.then(({surveys:e,context:i})=>{this.Io||t(e,i)}).catch(t=>Jp.error("Error in survey callback",t));const r=this.qh("/api/surveys/",{method:"GET",query:{token:n.projectToken},sentAt:"query",timeoutMs:this.Rr.requestTimeoutMs}).then(t=>{try{return this.jh(n,t)}catch(t){return Jp.error("Error processing surveys response",t),this.jh(n,{statusCode:0,error:t})}},t=>this.jh(n,{statusCode:0,error:t}));this.Eh=r;const o=()=>{this.Eh===r&&(this.Eh=null)};r.then(e=>{o(),this.Io||t(e.surveys,e.context)},o).catch(t=>Jp.error("Error in survey callback",t))}qh(t,e){const i=this.wo;return i?i.sendRequest(t,e):new Promise(t=>t({statusCode:0,error:new Error(kk)}))}jh(t,e){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:kk}};const i=e.statusCode;if(200!==i||!e.json){const t=`Surveys API could not be loaded, status: ${i}`;return 0!==i?Jp.error(t):e.error||Jp.warn(t),this.Ph=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.Ph=null;const n=e.json.surveys||[],s=n.filter(t=>Yp(t)&&(dl(t)||tg(t)));var r;return s.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(s)),t.kv.set({[ht]:n,[ct]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Nh(){return this.Bh()&&!this.Eh&&!this.Hh()}Bh(){var t,e;const i=null===(t=null!==(e=this.wo)&&void 0!==e?e:this.Th)||void 0===t?void 0:t.kv.get(ct);return Ae(i)&&Date.now()-i>3e5}Hh(){return Ae(this.Ph)&&3e5>Date.now()-this.Ph}markSurveyAsSeen(t,e){var i;const n={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};ng(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Lh(t){for(const e of this.Mh)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Jp.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e=!1){if(!Re(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Jp.warn("init was not called")}zh(t){let e=null;return this.getSurveys(i=>{var n;e=null!==(n=i.find(e=>e.id===t))&&void 0!==n?n:null}),e}Uh(t){if(Re(this._surveyManager))return{eligible:!1,reason:kk};const e="string"==typeof t?this.zh(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Wh(t){if(!this.So.isCapturing())return{eligible:!1,reason:Kp};if(Re(this._surveyManager))return{eligible:!1,reason:kk};const e="string"==typeof t?this.zh(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Re(this._surveyManager))return Jp.warn("init was not called"),{visible:!1,disabledReason:kk};const e=this.Wh(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Re(this._surveyManager)?(Jp.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:kk})):new Promise(i=>{this.getSurveys(e=>{var n;const s=null!==(n=e.find(e=>e.id===t))&&void 0!==n?n:null;if(s){const t=this.Wh(s);i({visible:t.eligible,disabledReason:t.reason})}else i({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,i){var s;if(!this.So.isCapturing())return;if(Re(this._surveyManager))return void Jp.warn("init was not called");const r="string"==typeof t?this.zh(t):t;if(!(null==r?void 0:r.id))return void Jp.warn("Survey not found");if(!sg.includes(r.type))return void Jp.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const o=null==n?void 0:n.querySelector(e);if(o){if(null===(s=r.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds){Jp.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var e,n;this.Rh.delete(t),!this.Io&&this.So.isCapturing()&&(Jp.info(`Rendering survey ${r.id} with delay of ${null===(e=r.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(r,o,i),Jp.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Rh.add(t)}this._surveyManager.renderSurvey(r,o,i)}else Jp.warn("Survey element not found")}displaySurvey(t,e){var i;if(!this.So.isCapturing())return;if(Re(this._surveyManager))return void Jp.warn("init was not called");const n=this.zh(t);if(!n)return void Jp.warn("Survey not found");let s=n;if((null===(i=n.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&e.ignoreDelay&&(s=he(he({},n),{},{appearance:he(he({},n.appearance),{},{surveyPopupDelaySeconds:0})})),e.displayType!==Zp&&e.initialResponses&&Jp.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){const t=this.Uh(n);if(!t.eligible)return void Jp.warn("Survey is not eligible to be displayed: ",t.reason)}"inline"!==e.displayType?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}cancelPendingSurvey(t){Re(this._surveyManager)?Jp.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t)}};function Ck(t,e,i){if(Re(t))return!1;switch(i){case"exact":return t===e;case"contains":{const i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}var $k=class{constructor(t){this._instance=t,this.Vh=new Set,this.Gh=new Set,this.Zh=new Sw,this.Qh=(t,e)=>this.Jh(t,e)&&this.Kh(t,e)&&this.Xh(t,e)&&this.Yh(t,e),this.Jh=(t,e)=>!(null==e?void 0:e.event)||(null==t?void 0:t.event)===(null==e?void 0:e.event)}init(){var t,e;Ie(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)||(this.tc=null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook((t,e)=>{this.on(t,e)}))}dispose(){var t;null===(t=this.tc)||void 0===t||t.call(this),this.tc=void 0,this.Zh=new Sw}register(t){var e,i;if(!Ie(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)&&(t.forEach(t=>{var e;this.Vh.add(t),null===(e=t.steps)||void 0===e||e.forEach(t=>{this.Gh.add((null==t?void 0:t.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const t=new Set;this.Vh.forEach(e=>{var i;null===(i=e.steps)||void 0===i||i.forEach(e=>{(null==e?void 0:e.selector)&&t.add(e.selector)})}),this._instance.autocapture.setElementSelectors(t)}}replace(t){this.Vh.clear(),this.Gh.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Gh.has(t)||this.Gh.has(e.event))&&this.Vh.forEach(t=>{this.ec(e,t)&&this.Zh.emit("actionCaptured",t.name)})}nc(t){this.onAction("actionCaptured",e=>t(e))}ec(t,e){if(null==(null==e?void 0:e.steps))return!1;for(const i of e.steps)if(this.Qh(t,i))return!0;return!1}onAction(t,e){return this.Zh.on(t,e)}Kh(t,e){if(null==e?void 0:e.url){var i;const n=null==t||null===(i=t.properties)||void 0===i?void 0:i.$current_url;if(!n||"string"!=typeof n)return!1;if(!Ck(n,e.url,e.url_matching||"contains"))return!1}return!0}Xh(t,e){return!!this.sc(t,e)&&!!this.rc(t,e)&&!!this.oc(t,e)}sc(t,e){var i;if(!(null==e?void 0:e.href))return!0;const n=this.ac(t);if(n.length>0)return n.some(t=>Ck(t.href,e.href,e.href_matching||"exact"));const s=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&Ck(function(t){const e=t.match(/(?::|")href="(.*?)"/);return e?e[1]:""}(s),e.href,e.href_matching||"exact")}rc(t,e){var i;if(!(null==e?void 0:e.text))return!0;const n=this.ac(t);if(n.length>0)return n.some(t=>Ck(t.text,e.text,e.text_matching||"exact")||Ck(t.$el_text,e.text,e.text_matching||"exact"));const s=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&(r=function(t){const e=[],i=/(?::|")text="(.*?)"/g;let n;for(;!Re(n=i.exec(t));)e.includes(n[1])||e.push(n[1]);return e}(s),o=e.text,a=e.text_matching||"exact",r.some(t=>Ck(t,o,a)));var r,o,a}oc(t,e){var i,n;if(!(null==e?void 0:e.selector))return!0;const s=null==t||null===(i=t.properties)||void 0===i?void 0:i.$element_selectors;if(null==s?void 0:s.includes(e.selector))return!0;const r=(null==t||null===(n=t.properties)||void 0===n?void 0:n.$elements_chain)||"";if(e.selector_regex&&r)try{return new RegExp(e.selector_regex).test(r)}catch(t){return!1}return!1}ac(t){var e;return null==(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}Yh(t,e){return!(null==e?void 0:e.properties)||0===e.properties.length||ml(e.properties.reduce((t,e)=>{const i=xe(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t},{}),null==t?void 0:t.properties)}},Tk=class{constructor(t){var e,i;this.lc=[],this._instance=t,this.uc=new Map,this.hc=new Map,this.cc=new Map,this.dc=null===(e=this._instance)||void 0===e||null===(i=e.onSessionId)||void 0===i?void 0:i.call(e,t=>this.vc(t))}fc(t){return!1}gc(){return null}mc(t){}yc(){}bc(t,e){return!!t&&ml(t.propertyFilters,null==e?void 0:e.properties)}_c(t,e){const i=new Map;return t.forEach(t=>{var n;null===(n=t.conditions)||void 0===n||null===(n=n[e])||void 0===n||null===(n=n.values)||void 0===n||n.forEach(e=>{if(null==e?void 0:e.name){const n=i.get(e.name)||[];n.push(t.id),i.set(e.name,n)}})}),i}wc(t,e,i){const n=(i===Sp?this.uc:this.hc).get(t);let s=[];return this.kc(t=>{s=t.filter(t=>null==n?void 0:n.includes(t.id))}),s.filter(n=>{var s;const r=null===(s=n.conditions)||void 0===s||null===(s=s[i])||void 0===s||null===(s=s.values)||void 0===s?void 0:s.find(e=>e.name===t);return this.bc(r,e)})}register(t){this.Sc(t,!1)}replace(t){this.Sc(t,!0)}Sc(t,e){var i;Ie(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this.xc(t,e),this.Cc(t,e))}Cc(t,e){const i=t.filter(t=>{var e;return null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length});var n;if(e&&this.cc.clear(),0===i.length)return void(e&&(null===(n=this.$c)||void 0===n||n.replace([])));this.$c||(this.$c=new $k(this._instance),this.$c.init(),this.$c.nc(t=>this.onAction(t)));const s=[];i.forEach(t=>{var e;null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||e.values.forEach(e=>{if(s.push(e),e.name){var i;const n=null!==(i=this.cc.get(e.name))&&void 0!==i?i:[];n.includes(t.id)||n.push(t.id),this.cc.set(e.name,n)}})}),e?this.$c.replace(s):this.$c.register(s)}Tc(t,e){e.forEach((e,i)=>{var n;const s=null!==(n=t.get(i))&&void 0!==n?n:[];e.forEach(t=>{s.includes(t)||s.push(t)}),t.set(i,s)})}xc(t,e){var i,n;const s=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.events)&&(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)>0}),r=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.cancelEvents)&&(null===(i=t.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=this._c(t,Sp),a=this._c(t,xp);e?(this.uc=o,this.hc=a):(this.Tc(this.uc,o),this.Tc(this.hc,a)),(0!==s.length||0!==r.length)&&(null!==(i=this.tc)&&void 0!==i||(this.tc=null===(n=this._instance)||void 0===n?void 0:n._addCaptureHook((t,e)=>{this.onEvent(t,e)})))}onEvent(t,e){var i,n;const s=this.Ic(),r=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$survey_id)||(null==e||null===(n=e.properties)||void 0===n?void 0:n.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const e=this.Mc(t,r);if("consume"===e)return s.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.Ec([r]);if("persist"===e)return s.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.Pc(r),void this.Rc([r])}if(this.hc.has(t)){const i=this.wc(t,e,xp);i.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:i.map(t=>t.id)}),this.Ec(i.map(t=>t.id)),i.forEach(t=>this.Ac(t.id)))}if(!this.uc.has(t))return;s.info("event name matched",{event:t,eventPayload:e,items:this.uc.get(t)});const o=this.wc(t,e,Sp);this.Fc(o.map(t=>t.id))}onAction(t){this.cc.has(t)&&this.Fc(this.cc.get(t)||[])}Fc(t){var e,i;if(0===t.length)return;const n=!!(null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e)),s=[];for(const e of t)n&&this.fc(e)?this.Pc(e)&&this.Oc(e):s.push(e);s.length>0&&(this.lc=[...new Set([...this.lc,...s])]),this.Ic().info("updating activated items",{activatedItems:this.getActivatedIds()})}Pc(t){this.lc=this.lc.filter(e=>e!==t);const e=this.Dc();return!e.includes(t)&&(this.Lc([...e,t]),this.Nc(),!0)}Ec(t){const e=new Set(t);this.lc=this.lc.filter(t=>!e.has(t));const i=this.qc(),n=i.filter(t=>!e.has(t));n.length!==i.length&&(this.Lc(n),0===n.length&&this.jc()),this.Rc(t)}Bc(){var t;const e=this.gc();if(!e)return{};const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e];return i&&"object"==typeof i?i:{}}Oc(t){if(!this.gc())return;const e=this.Bc();this.mc(he(he({},e),{},{[t]:Date.now()}))}Rc(t){if(!this.gc())return;const e=this.Bc(),i={};let n=!1;for(const[s,r]of Object.entries(e))t.includes(s)?n=!0:i[s]=r;n&&(Te(i)?this.yc():this.mc(i))}Hc(){this.gc()&&this.yc()}getActivationTimestamp(t){if(!this.Dc().includes(t))return;const e=this.Bc()[t];return Ae(e)?e:void 0}qc(){var t;const e=this.zc();return(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e])||[]}Dc(){var t,e,i;const n=this.qc();if(0===n.length)return[];const s=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this.Uc()],r=null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e);return r&&s===r?n:[]}Nc(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(e=t.get_session_id)||void 0===e?void 0:e.call(t);i&&this.Wc(i)}jc(){this.Vc()}vc(t){var e;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this.Uc()];if(i&&i!==t){const t=this.qc(),e=this.Bc();t.length>0&&(this.Lc([]),t.filter(t=>Ae(e[t])).forEach(t=>this.Ac(t))),this.jc(),this.Hc()}}getActivatedIds(){return[...new Set([...this.Dc(),...this.lc])].filter(t=>!this.Gc(t))}dispose(){var t,e,i;null===(t=this.dc)||void 0===t||t.call(this),this.dc=void 0,null===(e=this.tc)||void 0===e||e.call(this),this.tc=void 0,null===(i=this.$c)||void 0===i||i.dispose(),this.$c=void 0}reset(){this.lc=[],this.qc().length>0&&this.Lc([]),this.jc(),this.Hc()}getEventToItemsMap(){return this.uc}Zc(){return this.$c}},Ik=class extends Tk{constructor(t){super(t)}zc(){return dt}Uc(){return vt}gc(){return ft}mc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_timestamps:t})}yc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_timestamps")}fc(t){var e;let i;this.kc(e=>{i=e.find(e=>e.id===t)});const n=null==i||null===(e=i.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds;return Ae(n)&&n>0}Qc(){return qp}kc(t){var e;null===(e=this._instance)||void 0===e||e.getSurveys(t)}Ac(t){var e;null===(e=this._instance)||void 0===e||e.cancelPendingSurvey(t)}Ic(){return Jp}Lc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated:t})}Wc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_session:t})}Vc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_session")}Gc(){return!1}Mc(t,e){let i;return this.kc(t=>{i=t.find(t=>t.id===e)}),!i||vl(i)?t===qp?"consume":"ignore":t===qp?"persist":t===jp||t===Bp?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Mk=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);const e={};for(const i of t){const t=this._instance.get_property(i);Ie(t)||(e[i]=t)}return e}set(t,e){this._instance.register("string"==typeof t?{[t]:e}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},Ek=class{constructor(t){this._instance=t}get(){const t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return;const{generateSurveys:e,loadExternalDependency:i}=t;return{generateSurveys:e?t=>e(this._instance,t):void 0,loadExternalDependency:i?t=>i(this._instance,"surveys",t):void 0}}createEventReceiver(){return new Ik(this._instance)}};const Pk=(null==t?void 0:t.location)?dr(t.location.hash,"__posthog")||dr(location.hash,"state"):null,Rk="_postHogToolbarParams",Ak=Zs("[Toolbar]"),Fk=Zs("[FeatureFlags]");var Ok=class{constructor(t,e=!1){this.Jc=!1,this.update(t,e)}update(t,e){this.Kc=((t,e)=>{var i,n,s,r,o,a,l,u;return{bootstrap:{featureFlags:null!==(i=null===(n=t.bootstrap)||void 0===n?void 0:n.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(s=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:void 0},remoteRequestsDisabled:e,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:Ie(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(a=t.feature_flag_request_max_retries)&&void 0!==a?a:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(u=t.evaluation_contexts)&&void 0!==u?u:t.evaluation_environments)&&void 0!==l?l:[],flagKeys:xe(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Jc||(Fk.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Jc=!0),Ie(t.flag_keys)||xe(t.flag_keys)||Fk.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Kc}};const Dk=Zs("[FeatureFlags]"),Lk=Zs("[FeatureFlags]",{debugEnabled:!0}),Nk="\" failed. Feature flags didn't load in time.",qk=[502,504],jk=["click","keydown","wheel","touchstart","pointerdown"],Bk="connection_error",Hk=t=>{const e={};for(let i=0;t.length>i;i++)e[t[i]]=!0;return e},zk=t=>{const e={};for(const[i,n]of Xs(t||{}))n&&(e[i]=n);return e},Uk="Refusing to render web experiment since the viewer is a likely bot",Wk={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>fl(e,t),not_regex:(t,e)=>!fl(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},Vk=Zs("[Conversations]"),Gk="Conversations not available yet.";function Zk(t,e){var n,s,r,o,a,l,u;const h=null!==(n=null==t?void 0:t.flushIntervalMs)&&void 0!==n?n:3e3,c=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,d=(null==e?void 0:e.consoleCapture)?void 0:null!==(r=null==t?void 0:t.maxLogsPerInterval)&&void 0!==r?r:1e3,v=Ie(d)?Math.max(c,2048):Math.max(c,d),f=he(he({},function(){let t="",e="";try{const n=null==i?void 0:i.userAgent;n&&([t,e]=Qi(n))}catch(t){}return function(t,e){const i=function(t){if(t)return{}.hasOwnProperty.call(Is,t)?Is[t]:t}(t);return he(he({},i?{"os.name":i}:{}),e?{"os.version":e}:{})}(t,e)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==f?void 0:f["service.name"])&&void 0!==a?a:null==t?void 0:t.serviceName)&&void 0!==o?o:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(l=null==f?void 0:f["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(u=null==f?void 0:f["deployment.environment"])&&void 0!==u?u:null==t?void 0:t.environment,resourceAttributes:f,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:h,maxBufferSize:c,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const Qk=["debug","log","warn","error","info"],Jk="console",Kk="__posthogHandledLogsRequestError",Xk=(t,e)=>{const i=t instanceof Error?t:new Error(e);return i[Kk]=!0,i},Yk=t=>!!t&&"object"==typeof t&&!0===t[Kk],tS=Zs("[NetworkMetrics]"),eS=()=>{var e;return(null==t||null===(e=t.performance)||void 0===e?void 0:e.now)?t.performance.now():Date.now()},iS={"http:":80,"https:":443},nS=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),sS=(t,e)=>{var i;const n=String(e);return{method:String(t).toUpperCase(),url:(null===(i=lr(n))||void 0===i?void 0:i.href)||n}},rS=(t,e,i,n,s,r,o=!1)=>{try{var a,l;const u=s();if(!u)return;const h=i||void 0,c=eS()-n,d=lr(e.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||e.url,method:e.method},f=Ce(u.name)?u.name(v):Me(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=o&&!h?void 0:((t,e)=>t?400>t?void 0:String(t):(null==e?void 0:e.name)||"_OTHER")(h,r),g=he(he(he(he(he({},(t=>{const e=nS.has(t)?t:"_OTHER";return he({"http.request.method":e},"_OTHER"===e&&t!==e?{"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)||iS[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(e=t.pathname,e.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 e})(d):{}),h?{"http.response.status_code":h}:{}),p?{"error.type":p}:{}),null===(a=u.attributes)||void 0===a?void 0:a.call(u,v,{status:h,durationMs:c}));null===(l=t.metrics)||void 0===l||l.histogram(f,c,{unit:"ms",attributes:g})}catch(t){tS.error("Failed to record network metric",t)}},oS=()=>{},aS=(e,i)=>Ce(null==t?void 0:t.fetch)?Mv(t,"fetch",t=>function(...n){const s=eS(),r=t.apply(this,n);if(!i())return r;try{var o,a,l;const[t,u]=n,h=sS(null!==(o=null!==(a=null==u?void 0:u.method)&&void 0!==a?a:null==t?void 0:t.method)&&void 0!==o?o:"GET",null!==(l=null==t?void 0:t.url)&&void 0!==l?l:t);return r.then(t=>(rS(e,h,null==t?void 0:t.status,s,i,void 0,!0),t),t=>{throw rS(e,h,void 0,s,i,t),t})}catch(t){return tS.error("Failed to observe fetch",t),r}}):oS,lS=(e,i)=>{var n;const s=null==t||null===(n=t.XMLHttpRequest)||void 0===n?void 0:n.prototype;if(!s)return oS;const r=new WeakMap,o=Mv(s,"open",t=>function(...e){try{(()=>K_.has(this))()||r.set(this,sS(e[0],e[1]))}catch(t){tS.error("Failed to observe XHR open",t)}return t.apply(this,e)}),a=Mv(s,"send",t=>function(...n){let s;try{const t=r.get(this);if(t&&i()){const n=eS();s=()=>{this.removeEventListener("loadend",s),rS(e,t,this.status,n,i)},sr(this,"loadend",s)}}catch(t){tS.error("Failed to observe XHR send",t)}try{return t.apply(this,n)}catch(t){throw s&&this.removeEventListener("loadend",s),t}});return()=>{o(),a()}},uS={featureFlags:class{constructor(t){this.name="featureFlags",this.Xc=!1,this.featureFlagEventHandlers=[],this.$=Dk,this.Yc={},this.td={},this.ed=[],this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.ad=!1,this.ld=!1,this.ud=!1,this.hd=0,this.dd=!1,this.an=()=>{const t=this.vd();this.hd=0,t&&this.reloadFeatureFlags()},this.fd=()=>{var t,e;const i=this.pd,s=null!==(t=this.gd)&&void 0!==t?t:i;Ie(i)||Ie(s)||this.Rr.remoteRequestsDisabled||!n||"hidden"===n.visibilityState||Date.now()-(null!==(e=this.md)&&void 0!==e?e:0)<s||(this.gd=this.dd||!this.Rr.idleRefreshBackoff?i:Math.min(2*s,36e5),this.dd=!1,this.reloadFeatureFlags(),this.yd())},this.bd=()=>{this.dd&&this.gd===this.pd||this._d()},this.ln=()=>{"visible"===(null==n?void 0:n.visibilityState)&&this._d()},"get"in t?this.So=t:(this._instance=t,this.wd=new Ok(t.config,t.nl()),this.So=this.wd)}updateConfig(t,e){var i;null===(i=this.wd)||void 0===i||i.update(t,e),this.wo&&this.kd()}setup(t){return this.Fh=t,this.$=t.logger.createLogger("[FeatureFlags]"),wk(t.kv.initialize(),()=>{this.Fh===t&&(this.Fh=void 0,this.wo=t,this.Sd(t))})}Sd(e){var i;if(this.wo===e)return t&&sr(t,"online",this.an),this.kd(),this.xd=e.registerDynamicEventProperties(()=>this.Cd()?this.Yc:this.td),this.$d=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.Td(),this.Id(),this.Md()}),this.Id(),this.initialize()}_d(){this.dd=!0,this.gd=this.pd,this.fd()}kd(){const t=this.Rr.refreshIntervalMs,e=!this.Rr.remoteRequestsDisabled&&n&&!Ie(t)&&t>0?t:void 0;this.Rr.idleRefreshBackoff||(this.gd=e),e!==this.pd&&(this.Ed(),Ie(e)||(this.pd=e,this.gd=e,this.yd(),(null==n?void 0:n.addEventListener)&&(sr(n,Yt,this.ln),Qs(jk,t=>{sr(n,t,this.bd,{capture:!0})}))))}yd(){Ie(this.pd)||(Ie(this.Pd)||clearInterval(this.Pd),this.md=Date.now(),this.Pd=setInterval(this.fd,this.pd))}Ed(){var t;Ie(this.Pd)||(clearInterval(this.Pd),this.Pd=void 0,null==n||null===(t=n.removeEventListener)||void 0===t||t.call(n,"visibilitychange",this.ln),Qs(jk,t=>{var e;null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,t,this.bd,{capture:!0})})),this.pd=void 0,this.gd=void 0,this.dd=!1,this.md=void 0}destroy(){this.Rd()}dispose(){this.Rd()}Rd(){var e,i;this.Ed(),this.rd++,this.ad=!1,this.Fh=void 0,this.wo&&(this.Ad(),null===(e=this.xd)||void 0===e||e.dispose(),this.xd=void 0,null===(i=this.$d)||void 0===i||i.call(this),this.$d=void 0,this.ed=[],null==t||t.removeEventListener("online",this.an),this.wo=void 0)}get Rr(){return this.So.get()}Fd(t){var e;return this.Od&&t in this.Od?this.Od[t]:null===(e=this.wo)||void 0===e?void 0:e.kv.get(t)}Td(){return!!this.Od&&(this.Od=void 0,!0)}Dd(){var t;return!Ie(null===(t=this.wo)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.Td()}At(t){this.Ld(()=>{var e;return null===(e=this.wo)||void 0===e?void 0:e.kv.set(t)})}Nd(t,e,i){var n;if(!(null===(n=this._instance)||void 0===n?void 0:n.persistence)||!t.$enabled_feature_flags)return;const s=this.Fd("$enabled_feature_flags")||{},r=t.$enabled_feature_flags||{},o=e.flags||e.featureFlags,a=e.flags?Object.entries(e.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],l=!!e.errorsWhileComputingFlags&&!!e.flags,u=l?a:i&&!xe(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(r)])),h=this.Fd("$feature_flag_payloads")||{},c=t.$feature_flag_payloads||{},d=l||i?u:Array.from(new Set([...Object.keys(h),...Object.keys(c)])),v=!l&&!i,f=!!v||u,p=!!v||d,g={[Y]:f,[X]:f,[it]:p};t.$feature_flag_details&&(g[et]=f);for(const e of[nt,Ct,st])Ie(t[e])||(g[e]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}Lt(t){this.Ld(()=>{var e;return null===(e=this.wo)||void 0===e?void 0:e.kv.remove(t)})}Ld(t){try{t()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}Id(){const t={};for(const e of[Y,it,nt,rt]){const i=this.Fd(e);Ie(i)||(t[e]=i)}this.Yc=t;const e=he({},t),i=this.Fd(X);if(i)for(const[t,n]of Object.entries(i))e[`$feature/${t}`]=n;this.td=e}Cd(){const t=this.Rr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.Fd(Ct);return"number"!=typeof e||Date.now()-e>t}qd(){return!!this.Cd()&&(this.ud||this.sd||(this.ud=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}jd(){const t=this.Rr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),e}):[]}Bd(){const t=this.Rr.flagKeys;if(!Ie(t))return t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),e})}initialize(){var t,e;const i=this.Rr,n=null!==(t=null===(e=i.bootstrap)||void 0===e?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(n).length){var s,r;const t=null!==(s=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:{},e=Object.keys(n).filter(t=>!Ie(n[t])).reduce((t,e)=>(t[e]=n[e],t),{}),o=Object.keys(t).filter(t=>e[t]).reduce((e,i)=>(e[i]=t[i],e),{});return this.Hd({featureFlags:e,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,e,i){var n,s;const r=(null==i?void 0:i.merge)&&null!==(n=this.Fd("$enabled_feature_flags"))&&void 0!==n?n:{},o=(null==i?void 0:i.merge)&&null!==(s=this.Fd("$feature_flag_payloads"))&&void 0!==s?s:{},a=he(he({},r),t),l=he(he({},o),e),u={};for(const[t,e]of Object.entries(a))u[t]={key:t,enabled:rs(e),variant:os(e),reason:void 0,metadata:Ie(null==l?void 0:l[t])?void 0:{id:0,version:void 0,description:void 0,payload:l[t]}};this.Hd({flags:u})}get hasLoadedFlags(){return this.nd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.Fd(et),e=this.Fd(rt),i=this.Fd(ot);if(!i&&!e)return t||{};const n=Ks({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(const t of s){var r;const s=n[t],a=null==e?void 0:e[t],l=Ie(a)?null!==(r=null==s?void 0:s.enabled)&&void 0!==r&&r:!!a,u=Ie(a)?null==s?void 0:s.variant:"string"==typeof a?a:void 0,h=null==i?void 0:i[t],c=he(he({},s),{},{enabled:l,variant:l?null!=u?u:null==s?void 0:s.variant:void 0});var o;l!==(null==s?void 0:s.enabled)&&(c.original_enabled=null==s?void 0:s.enabled),u!==(null==s?void 0:s.variant)&&(c.original_variant=null==s?void 0:s.variant),h&&(c.metadata=he(he({},null==s?void 0:s.metadata),{},{payload:h,original_payload:null==s||null===(o=s.metadata)||void 0===o?void 0:o.payload})),n[t]=c}return this.Xc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:n}),this.Xc=!0),n}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(i=>{const n=t[i];return{key:i,enabled:rs(n),variant:os(n),payload:ss(e[i])}})}getFlagVariants(){const t=this.Fd(X),e=this.Fd(rt);if(!e)return t||{};const i=Ks({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Xc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Xc=!0),i}getFlagPayloads(){const t=this.Fd(it),e=this.Fd(ot);if(!e)return t||{};const i=Ks({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Xc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Xc=!0),i}reloadFeatureFlags(){this.od||this.Rr.featureFlagsDisabled||this.vd()||(this.sd&&(this.ad=!0),this.zd||(this.ed.slice().forEach(t=>{try{t()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.zd=setTimeout(()=>{this.Ud()},5)))}Ad(){clearTimeout(this.zd),this.zd=void 0}onReloading(t){return this.ed.push(t),()=>{this.ed=this.ed.filter(e=>e!==t)}}ensureFlagsLoaded(){this.nd||this.sd||this.zd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.od=t}resetFlagCallReported(){this.Lt(kt)}Ud(t){this.Ad();const e=this.wo;if(!e||this.Rr.remoteRequestsDisabled||this.vd())return;if(this.sd)return void(this.ad=!0);const i={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:he(he(he({},e.initialPersonProperties),this.Fd("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Fd(lt),timezone:jl()};Ie(e.deviceId)||(i.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Rr.featureFlagsDisabled)&&(i.disable_flags=!0);const n=this.jd();n.length&&(i.evaluation_contexts=n);const s=this.Bd();Ie(s)||(i.flag_keys=s);const r=this.Rr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this.rd;this.sd=!0;const l=()=>{this.ad&&(this.ad=!1,this.Ud())},u=t=>{var e,n;const s=null!==(e=t.json)&&void 0!==e?e:{},o=200!==t.statusCode;if(this.sd=!1,a!==this.rd)return void l();if(this.Wd(t.statusCode),o||this.ad||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.ad)return;this.ld=!o;const u=[];t.error?u.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Bk:"unknown_error"):200!==t.statusCode&&u.push(`api_error_${t.statusCode}`),s.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");const h=!!(null===(n=s.quotaLimited)||void 0===n?void 0:n.includes("feature_flags"));h&&u.push("quota_limited"),this.At({[xt]:u}),h?this.$.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."):i.disable_flags||this.Hd(s,o,{partialResponse:r}),l()},h=t=>{this.sd=!1,a===this.rd?(this.At({[xt]:[Bk]}),this.$.error("Feature flag request failed",t),this.Dd()&&this.Md(!0),l()):l()};let c=this.Rr.requestMaxRetries;const d=()=>c>0&&a===this.rd,v=()=>{if(a!==this.rd||!this.wo||this.Rr.remoteRequestsDisabled)return this.sd=!1,void l();try{e.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this.Rr.compression,sentAt:"body",timeoutMs:this.Rr.requestTimeoutMs}).then(t=>{if((t=>qk.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&d())return c--,void setTimeout(v,500);u(t)}).catch(h)}catch(t){h(t)}};v()}vd(){return vr(this.hd,3)}Wd(t){this.hd=fr(t,this.hd,3,()=>this.$.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,e={}){var i;if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+Nk);if(this.qd())return;const n=this.getFeatureFlagResult(t,e);return null!==(i=null==n?void 0:n.variant)&&void 0!==i?i:null==n?void 0:n.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e={}){if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+Nk);if(this.qd())return;const i=this.getFlagVariants(),n=t in i,s=i[t],r=this.getFlagPayloads()[t],o=String(s),a=this.Fd("$feature_flag_request_id")||void 0,l=this.Fd("$feature_flag_evaluated_at")||void 0;let u,h=this.Fd("$flag_call_reported")||{};if(this.Rr.deduplicateCallsPerSession){var c;const t=null===(c=this.wo)||void 0===c?void 0:c.session.sessionId,e=this.Fd(St);t&&t!==e&&(h={},u=t)}if(e.send_event||!("send_event"in e))if(t in h&&h[t].includes(o))u&&this.At({[kt]:h,[St]:u});else{var d,v,f,p,g,m,y,b,_,w,k,S;xe(h[t])?h[t].push(o):h[t]=[o],this.At(he({[kt]:h},u?{[St]:u}:{}));const e=this.getFeatureFlagDetails(t),i=[...null!==(d=this.Fd("$feature_flag_errors"))&&void 0!==d?d:[]];Ie(s)&&i.push("flag_missing");const n={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:null!==(v=null===(f=this.Rr.bootstrap)||void 0===f||null===(f=f.featureFlags)||void 0===f?void 0:f[t])&&void 0!==v?v:null,$feature_flag_bootstrapped_payload:null!==(p=null===(g=this.Rr.bootstrap)||void 0===g||null===(g=g.featureFlagPayloads)||void 0===g?void 0:g[t])&&void 0!==p?p:null,$used_bootstrap_value:!this.ld};Ie(null==e||null===(m=e.metadata)||void 0===m?void 0:m.has_experiment)||(n.$feature_flag_has_experiment=e.metadata.has_experiment),Ie(null==e||null===(y=e.metadata)||void 0===y?void 0:y.version)||(n.$feature_flag_version=e.metadata.version);const c=null!==(b=null==e||null===(_=e.reason)||void 0===_?void 0:_.description)&&void 0!==b?b:null==e||null===(w=e.reason)||void 0===w?void 0:w.code;var x;c&&(n.$feature_flag_reason=c),(null==e||null===(k=e.metadata)||void 0===k?void 0:k.id)&&(n.$feature_flag_id=e.metadata.id),Ie(null==e?void 0:e.original_variant)&&Ie(null==e?void 0:e.original_enabled)||(n.$feature_flag_original_response=Ie(e.original_variant)?e.original_enabled:e.original_variant),(null==e||null===(S=e.metadata)||void 0===S?void 0:S.original_payload)&&(n.$feature_flag_original_payload=null==e||null===(x=e.metadata)||void 0===x?void 0:x.original_payload),i.length&&(n.$feature_flag_error=i.join(",")),this.Vd(n)}else u&&this.At({[kt]:h,[St]:u});return n?{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:ss(r)}:void 0}Vd(t){try{var e;null===(e=this.wo)||void 0===e||e.capture("$feature_flag_called",t)}catch(t){this.$.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,e){this.Gd(t,e)}Gd(t,e){var i=this;return oe(function*(){const n=i.wo;if(!n)return;const s={distinct_id:n.distinctId,token:n.projectToken,person_properties:{$lib:n.library.name,$lib_version:n.library.version}},r=i.jd();r.length&&(s.evaluation_contexts=r);const o=i.Bd();let a;Ie(o)||(s.flag_keys=o);try{var l;const e=null===(l=(yield n.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:i.Rr.compression,sentAt:"body",timeoutMs:i.Rr.requestTimeoutMs})).json)||void 0===l?void 0:l.featureFlagPayloads;a=(null==e?void 0:e[t])||void 0}catch(t){return void i.$.error("Remote config feature flag request failed",t)}try{e(a)}catch(t){i.$.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.ld)return e.defaultValue;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+Nk),e.defaultValue;const i=this.getFeatureFlag(t,e);return Ie(i)?e.defaultValue:!!i}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,i){this.Hd(t,e,i)}Hd(t,e,i){if(!this.wo)return;this.nd=!0;const n=((t,e={},i={},n={},s,r=Dk)=>{const o=((t,e)=>{const i=t.flags;if(i){const e=Object.fromEntries(Object.keys(i).map(t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]})),n=Object.fromEntries(Object.keys(i).filter(t=>i[t].enabled).filter(t=>{var e;return!Ie(null===(e=i[t].metadata)||void 0===e?void 0:e.payload)}).map(t=>{var e;return[t,null===(e=i[t].metadata)||void 0===e?void 0:e.payload]}));return he(he({},t),{},{featureFlags:e,featureFlagPayloads:n})}return t.featureFlags&&e.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,r),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(!l)return;const h=t.requestId,c=t.evaluatedAt;if(xe(l)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const t={};if(l)for(let e=0;l.length>e;e++)t[l[e]]=!0;return{[Y]:l,[X]:t,[st]:!1}}let d=l,v=u,f=a;if(null==s?void 0:s.partialResponse){const t=Object.keys(d),s=v||{};d=he(he({},e),d),v=he(he({},i),s),t.forEach(t=>{t in s||null==v||delete v[t]}),f=he(he({},n),f)}else if(t.errorsWhileComputingFlags)if(a){const t=new Set(Object.keys(a).filter(t=>{var e;return!(null===(e=a[t])||void 0===e?void 0:e.failed)}));d=he(he({},e),Object.fromEntries(Object.entries(d).filter(([e])=>t.has(e))));const s=Object.fromEntries(Object.entries(v||{}).filter(([e])=>t.has(e)));v=he(he({},i),s),t.forEach(t=>{t in s||null==v||delete v[t]}),f=he(he({},n),Object.fromEntries(Object.entries(f||{}).filter(([e])=>t.has(e))))}else d=he(he({},e),d),v=he(he({},i),v),f=he(he({},n),f);return he(he({[Y]:Object.keys(zk(d)),[X]:d||{},[it]:v||{},[et]:f||{},[st]:!0===t.minimalFlagCalledEvents},h?{[nt]:h}:{}),c?{[Ct]:c}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.$);if(n)if(!1===(null==i?void 0:i.persist)){const t=!Ie(this.wo.kv.get(X));this.Od=n,t||this.At(n)}else this.Td(),this.Nd(n,t,!!(null==i?void 0:i.partialResponse)),this.At(n);else e&&this.Dd();e||(this.ud=!1),this.Md(e)}override(t,e=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Zd(t)}Zd(t){if(this.wo){if(!1===t)return this.Lt([rt,ot]),this.Md(),void Lk.info("All overrides cleared");if(xe(t))return this.At({[rt]:Hk(t)}),this.Md(),void Lk.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e;const i=t;this.Xc=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);const n={},s=i.flags,r=i.payloads;return s&&(n[rt]=xe(s)?Hk(s):s),r&&(n[ot]=r),Object.keys(n).length&&this.At(n),!1===s&&!1===r?this.Lt([rt,ot]):!1===s?this.Lt(rt):!1===r&&this.Lt(ot),this.Md(),!1===s?Lk.info("Flag overrides cleared"):s&&Lk.info("Flag overrides set",{flags:s}),void(!1===r?Lk.info("Payload overrides cleared"):r&&Lk.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.At({[rt]:t}),this.Md(),void Lk.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.nd){const{flags:e,flagVariants:i}=this.Qd();try{t(e,i)}catch(t){this.$.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;const s=(this.Fd("$early_access_features")||[]).find(e=>e.flagKey===t),r={[`$feature_enrollment/${t}`]:e},o={$feature_flag:t,$feature_enrollment:e,$set:r};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i);const a=he(he({},this.getFlagVariants()),{},{[t]:e});null===(n=this._instance)||void 0===n||null===(n=n.persistence)||void 0===n||n.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.At({[Y]:Object.keys(zk(a)),[X]:a,[at]:he(he({},this.Fd("$stored_person_properties")||{}),r)}),this.Md();try{var l;null===(l=this.wo)||void 0===l||l.capture("$feature_enrollment_update",o)}catch(t){this.$.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e=!1,i){const n=this.Fd(tt);!n||e?this.Jd(t,i):t(n)}Jd(t,e){var i=this;return oe(function*(){const n=i.wo;if(!n)return;const s=e?`&${e.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,i.At({[tt]:r})}catch(t){return void i.$.error("Early access feature request failed",t)}try{t(r)}catch(t){i.$.error("Early access feature callback failed",t)}})()}Qd(){const t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(t=>e[t]),flagVariants:Object.keys(e).filter(t=>e[t]).reduce((t,i)=>(t[i]=e[i],t),{})}}Md(t){this.Id();const{flags:e,flagVariants:i}=this.Qd();this.featureFlagEventHandlers.forEach(n=>{try{n(e,i,{errorsLoading:t})}catch(t){this.$.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,e=!0){this.Kd(t,e)}Kd(t,e=!0){const i=this.Fd("$stored_person_properties")||{},n=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),s=null==t?void 0:t.$set_once,r={};if(s)for(const t in s)({}).hasOwnProperty.call(s,t)&&(t in i||(r[t]=s[t]));this.At({[at]:he(he(he({},i),r),n)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const i=he({},this.Fd("$stored_person_properties")||{});t.forEach(t=>{delete i[t]}),this.At({[at]:i}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(at),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const i=this.Fd("$stored_group_properties")||{},n=he({},i);for(const e of Object.keys(t))n[e]=he(he({},i[e]),t[e]);this.At({[lt]:n}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.Fd("$stored_group_properties")||{};this.At({[lt]:he(he({},e),{},{[t]:{}})})}else this.Lt(lt)}reset(){this.rd++,this.ad=!1,this.Yc={},this.td={},this.Od=void 0,this.nd=!1,this.od=!1,this.ld=!1,this.$anon_distinct_id=void 0,this.Ad(),this.Xc=!1,this.hd=0}}},hS={sessionRecording:class{get Rr(){return this._instance.config}get Ml(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.Xd)||void 0===t?void 0:t.isStarted)}get status(){var t,e;return"awaiting_config"===this.Yd||"missing_config"===this.Yd?this.Yd:null!==(t=null===(e=this.Xd)||void 0===e?void 0:e.status)&&void 0!==t?t:this.Yd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Yd=po,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var e,i;if(!(null==n?void 0:n.visibilityState)||"visible"===n.visibilityState)return!0;const s=null==t||null===(e=t.performance)||void 0===e||null===(i=e.getEntriesByType)||void 0===i?void 0:i.call(e,"visibility-state");return!(null==s?void 0:s.length)||s.some(t=>"visible"===t.name)})(),this.ln=()=>{var t,e;"visible"===(null==n?void 0:n.visibilityState)&&(this.Xe=!0,null===(t=this.Xd)||void 0===t||null===(e=t.setDocumentWasEverVisible)||void 0===e||e.call(t,!0))},!this._instance.sessionManager)throw vk.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Rr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==n?void 0:n.addEventListener)&&sr(n,"visibilitychange",this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.ev=!0,null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,"visibilitychange",this.ln),t?this.iv(!0):this.stopRecording()}get nv(){var e;const i=!!(null===(e=this._instance.get_property("$session_recording_remote_config"))||void 0===e?void 0:e.enabled),n=!this.Rr.disable_session_recording,s=this.Rr.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&n&&!s}startIfEnabledOrStop(t){var e;if(this.ev)return;if(this.nv&&(null===(e=this.Xd)||void 0===e?void 0:e.isStarted))return;const i=!Ie(Object.assign)&&!Ie(Array.from);this.nv&&i?(this.sv(t),vk.info("starting")):(this.Yd=po,this.stopRecording())}sv(t){var e,i;if(this.nv)if("awaiting_config"!==this.Yd&&"missing_config"!==this.Yd&&(this.Yd=_o),(null==d||null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrweb)||void 0===e?void 0:e.record)&&(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this.rv(t);else{var n,s;const e=this._instance.sessionManager;null===(n=d.__PosthogExtensions__)||void 0===n||null===(s=n.loadExternalDependency)||void 0===s||s.call(n,this._instance,this.ov,i=>{if(!this.ev&&this.nv&&this._instance.sessionManager===e)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),vk.error("could not load recorder",i)):void this.rv(t);this.Yd="disabled"})}}stopRecording(){var t,e;null===(t=this.tv)||void 0===t||t.call(this),this.tv=void 0,null===(e=this.Xd)||void 0===e||e.stop()}iv(t=!1){var e,i;null===(e=this.tv)||void 0===e||e.call(this),this.tv=void 0,null===(i=this.Xd)||void 0===i||i.discard({discardProducerEvents:t})}av(){var t,e;null===(t=this.Ml)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this.Ml)||void 0===e||e.unregister("$replay_sample_rate")}lv(t,e){if(Re(t))return null;const i=Ae(t)?t:parseFloat(t);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(vk.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):i;var n}uv(t){if(this.Ml){var e,i;const n=this.Ml,s=()=>{var e;const i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.lv(null===(e=this.Rr.session_recording)||void 0===e?void 0:e.sampleRate,"session_recording.sampleRate"),r=this.lv(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Re(o)&&this.av();const a=null==i?void 0:i.minimumDurationMilliseconds;n.register({[O]:he(he({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:he({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:Ie(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null===(e=this.tv)||void 0===e||e.call(this),this.tv=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(s)}}onRemoteConfig(t){const e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?!1===e.sessionRecording?(this.uv(e),void this.iv()):(this.uv(e),void this.startIfEnabledOrStop()):("awaiting_config"===this.Yd&&(this.Yd="missing_config",this._instance.register_for_session({[Nt]:!0}),vk.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var i;(null===(i=this.Xd)||void 0===i?void 0:i.log)?this.Xd.log(t,e):vk.warn("log called before recorder was ready")}get ov(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(O);return(null==i||null===(e=i.scriptConfig)||void 0===e?void 0:e.script)||"lazy-recorder"}hv(){const t=this._instance.get_property(O);if(!t)return!1;let e;try{e="object"==typeof t?t:JSON.parse(t)}catch(t){return vk.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!Re(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}rv(t){var e,i,n;if(!this.ev&&this.nv&&this._instance.sessionManager){if(!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))return vk.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Lt]:!0});var s;if(this.Xd||(this.Xd=null===(s=d.__PosthogExtensions__)||void 0===s?void 0:s.initSessionRecording(this._instance,this.Xe),this.Xd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hv()){if("missing_config"===this.Yd||"awaiting_config"===this.Yd)return;return this.Yd="awaiting_config",vk.info("persisted remote config is stale, requesting fresh config before starting"),void new Q_(this._instance).load()}this.Yd=_o,null===(i=(n=this.Xd).setDocumentWasEverVisible)||void 0===i||i.call(n,this.Xe),this.Xd.start(t)}else this.Yd=po}onRRwebEmit(t){var e,i;null===(e=this.Xd)||void 0===e||null===(i=e.onRRwebEmit)||void 0===i||i.call(e,t)}overrideLinkedFlag(){var t,e;this.Xd||null===(e=this.Ml)||void 0===e||e.register({$replay_override_linked_flag:!0}),null===(t=this.Xd)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Xd||null===(e=this.Ml)||void 0===e||e.register({$replay_override_sampling:!0}),null===(t=this.Xd)||void 0===t||t.overrideSampling()}overrideTrigger(t){var e,i;this.Xd||null===(i=this.Ml)||void 0===i||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(e=this.Xd)||void 0===e||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null===(t=this.Xd)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!!(null===(i=this.Xd)||void 0===i?void 0:i.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;null===(t=this.Xd)||void 0===t||null===(e=t.flushBeforeIdentityReset)||void 0===e||e.call(t)}}},cS={autocapture:class extends i_{constructor(t){super(new rk(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.dv=this.vv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.fv();return!!(t.path||t.search||this.pv(t))}startIfEnabled(){this.isEnabled&&(Gs.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.dv=this.vv(),this.startIfEnabled()}stop(){this.gv&&this.gv(),this.gv=void 0,this.mv&&this.mv(),this.mv=void 0,Gs.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.yv("pushState"),this.yv("replaceState"),this.bv(),this.pv()&&this._v())}yv(e){var i;if(!t||(null===(i=t.history[e])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;Mv(t.history,e,t=>function(i,s,r){t.call(this,i,s,r),n.wv(e)})}vv(){const e=null==t?void 0:t.location;if(null==e?void 0:e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}fv(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:$e(t)?t:{}}pv(t=this.fv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Sv(t){const e=this.fv(),i=this.dv;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.pv(e)&&t.hash!==i.hash))}wv(t){try{const e=this.vv();if(!e)return;this.Sv(e)&&this._instance.capture(ee,{navigation_type:t}),this.dv=e}catch(e){Gs.error(`Error capturing ${t} pageview`,e)}}bv(){if(this.gv)return;const e=()=>{this.wv("popstate")};sr(t,"popstate",e),this.gv=()=>{t&&t.removeEventListener("popstate",e)}}_v(){if(this.mv)return;const e=()=>{this.wv("hashchange")};sr(t,"hashchange",e),this.mv=()=>{t&&t.removeEventListener("hashchange",e)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(t){var e;this.xv=!1,this.xo=!1,this.Cv=null,this.instance=t,this.xv=!!(null===(e=this.instance.persistence)||void 0===e?void 0:e.props[C]),this.rageclicks=new Jb(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return $e(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Re(this.Rr.capture_heatmaps)?Re(this.Rr.enable_heatmaps)?this.xv:this.Rr.enable_heatmaps:!1!==this.Rr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.xo)return;fk.info("starting..."),this.$v(),this.ln()}else{var t;clearInterval(null!==(t=this.Cv)&&void 0!==t?t:void 0),this.Tv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("heatmaps"in e))return;const i=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[C]:i}),this.xv=i,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Iv(t){pk(t.originalEvent)&&this.Tr(t.originalEvent,"deadclick")}ln(){this.Cv&&clearInterval(this.Cv),this.Cv=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(n)?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}$v(){t&&n&&(this.Mv=this.bl.bind(this),sr(t,te,this.Mv),this.Ev=e=>this.Tr(e||(null==t?void 0:t.event)),sr(n,"click",this.Ev,{capture:!0}),this.Pv=e=>this.Rv(e||(null==t?void 0:t.event)),sr(n,"mousemove",this.Pv,{capture:!0}),this.Av=new k_(this.instance,__,this.Iv.bind(this)),this.Av.startIfEnabledOrStop(),this.Fv=this.ln.bind(this),sr(n,Yt,this.Fv),this.xo=!0)}Tv(){var e;t&&n&&(this.Mv&&t.removeEventListener(te,this.Mv),this.Ev&&n.removeEventListener("click",this.Ev,{capture:!0}),this.Pv&&n.removeEventListener("mousemove",this.Pv,{capture:!0}),this.Fv&&n.removeEventListener(Yt,this.Fv),clearTimeout(this.Ov),null===(e=this.Av)||void 0===e||e.stop(),this.xo=!1)}Dv(e,i){const n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(e,i,n){let s=e;for(;s&&yr(s)&&!br(s,"body");){if(s===n)return!1;let e;try{var r,o,a;e=null===(r=null!==(o=null===(a=s.ownerDocument)||void 0===a?void 0:a.defaultView)&&void 0!==o?o:t)||void 0===r?void 0:r.getComputedStyle(s).position}catch(t){return!1}if(me(i,e))return!0;s=Pr(s)}return!1}(Tr(e),["fixed","sticky"],r);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:n),target_fixed:o,type:i}}Tr(t,e="click"){var i;if(mr(t.target)||!pk(t))return;const n=this.Dv(t,e);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&jr(Tr(t),this.instance.config.rageclick)&&this.Zs(he(he({},n),{},{type:"rageclick"})),this.Zs(n)}Rv(t){!mr(t.target)&&pk(t)&&(clearTimeout(this.Ov),this.Ov=setTimeout(()=>{this.Zs(this.Dv(t,"mousemove"))},500))}Zs(e){if(!t)return;const i=this.Rr.disable_capture_url_hashes?hn(t.location.href):t.location.href,n=this.Rr.custom_personal_data_properties,s=this.Rr.mask_personal_data_properties?[...Tl,...n||[]]:[],r=cr(i,s,Ml);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}bl(){this.Rt&&!Te(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:k_,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.xv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Lv=()=>{clearTimeout(this.Nv),this.Nv=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",he({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,e)=>he(he({},t),{},{[`$web_vitals_${e.name}_event`]:he({},e),[`$web_vitals_${e.name}_value`]:e.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.qv=t=>{var e;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Re(null==t?void 0:t.name)||Re(null==t?void 0:t.value))return void lk.error("Invalid metric received",t);const i="string"==typeof t.navigationURL?t.navigationURL:void 0,n=this.jv(i);if(Ie(n))return;const s=Ae(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${n}`;if(this.Bv&&t.value>=this.Bv)return void lk.error("Ignoring metric with value >= "+this.Bv,t);this.Rt.navigationKey!==s&&(this.Lv(),this.Nv=setTimeout(this.Lv,this.flushToCaptureTimeoutMs)),Ie(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=n),this.Rt.firstMetricTimestamp=Ie(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0),o=he(he(he({},t),i?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete o.entries,$e(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const e={};for(const i of dk){const n="url"===i&&"string"==typeof t.attribution[i]?this.jv(t.attribution[i]):t.attribution[i];Ie(n)||(e[i]=n)}o.attribution=e}else delete o.attribution;Ie(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.Lv()},this.Hv=()=>{if(this.xo)return;let t,e,i,n,s=!1;const r=d.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this.zv])||("web-vitals"===this.zv&&Ie(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!Ie(a)){const r=a.withoutAttribution,o=this.attributionMetrics;s=!Ie(r),t=o.indexOf("LCP")>-1?a.onLCP:(null==r?void 0:r.onLCP)||a.onLCP,e=o.indexOf("CLS")>-1?a.onCLS:(null==r?void 0:r.onCLS)||a.onCLS,i=o.indexOf("FCP")>-1?a.onFCP:(null==r?void 0:r.onFCP)||a.onFCP,n=o.indexOf("INP")>-1?a.onINP:(null==r?void 0:r.onINP)||a.onINP}if(!(t&&e&&i&&n))return void lk.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},u=s&&this.attributionMetrics.indexOf("INP")>-1?he(he({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&t(this.qv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&e(this.qv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.qv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&n(this.qv.bind(this),u),this.xo=!0},this.xv=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[E]),this.startIfEnabled()}get Uv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const i=$e(this.Uv)?null===(t=this.Uv)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return Re(i)?(null===(e=this._instance.persistence)||void 0===e?void 0:e.props.$web_vitals_allowed_metrics)||hk:i}get flushToCaptureTimeoutMs(){return($e(this.Uv)?this.Uv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=$e(this.Uv)?this.Uv.web_vitals_attribution:void 0;return Oe(t)?t?hk:[]:xe(t)?t:ck}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=$e(this.Uv)?this.Uv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Bv(){const t=$e(this.Uv)&&Ae(this.Uv.__web_vitals_max_value)?this.Uv.__web_vitals_max_value:uk;return t>0&&6e4>=t?uk:t}get isEnabled(){const t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return lk.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=$e(this.Uv)?this.Uv.web_vitals:Oe(this.Uv)?this.Uv:void 0;return Oe(e)?e:this.xv}startIfEnabled(){this.isEnabled&&!this.xo&&(lk.info("enabled, starting..."),this.zo(this.Hv))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const i=$e(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=$e(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[E]:i}),this._instance.persistence.register({[F]:n})),this.xv=i,this.startIfEnabled()}get zv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(t){var e;const i=d.__PosthogExtensions__,n=this.zv,s=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==s?void 0:s[n])||"web-vitals"===n&&Ie(s)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?t():null==i||null===(e=i.loadExternalDependency)||void 0===e||e.call(i,this._instance,n,e=>{e?lk.error("failed to load script",e):t()})}jv(e){const i=e||(null==t?void 0:t.location.href);if(!i)return void lk.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?hn(i):i,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Tl,...s||[]]:[];return cr(n,r,Ml)}}},dS={exceptionObserver:class{constructor(e){var i;this.Hv=()=>{var e;if(!t||!this.isEnabled||!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions))return;const i=d.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=d.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=d.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Wv&&this.Rr.capture_unhandled_errors&&(this.Wv=i(this.captureException.bind(this))),!this.Vv&&this.Rr.capture_unhandled_rejections&&(this.Vv=n(this.captureException.bind(this))),!this.Gv&&this.Rr.capture_console_errors&&(this.Gv=s(this.captureException.bind(this)))}catch(t){ok.error("failed to start",t),this.Zv()}},this._instance=e,this.Qv=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[T]),this.wt=new Je(he(he({},function(t={}){var e,i,n,s;return{refillRate:null!==(e=null!==(i=t.exceptionRateLimiterRefillRate)&&void 0!==i?i:t.__exceptionRateLimiterRefillRate)&&void 0!==e?e:1,bucketSize:null!==(n=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==n?n:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:ok})),this.Rr=this.Jv(),this.startIfEnabledOrStop()}Jv(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return $e(t)?e=he(he({},e),t):(Ie(t)?this.Qv:t)&&(e=he(he({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Rr.capture_console_errors||this.Rr.capture_unhandled_errors||this.Rr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ok.info("enabled"),this.Zv(),this.zo(this.Hv)):this.Zv()}zo(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"exception-autocapture",e=>{if(e)return ok.error("failed to load script",e);t()})}Zv(){var t,e,i;null===(t=this.Wv)||void 0===t||t.call(this),this.Wv=void 0,null===(e=this.Vv)||void 0===e||e.call(this),this.Vv=void 0,null===(i=this.Gv)||void 0===i||i.call(this),this.Gv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.Qv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[T]:this.Qv}),this.Rr=this.Jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.Jv()}captureException(t){try{var e,i,n;const s=null!==(e=null==t||null===(i=t.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==e?e:"Exception";if(this.wt.consumeRateLimit(s))return void ok.info("Skipping exception capture because of client rate limiting.",{exception:s});null===(n=this._instance.exceptions)||void 0===n||n.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var e,i;this.Kv=[],this.Xv=Gm(),this._instance=t,this.Kv=null!==(e=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==e?e:[],this.Yv=es(this.tf()),this.ef=new is(this.Yv)}onConfigChange(){this.Yv=es(this.tf()),this.ef.setConfig(this.Yv)}onRemoteConfig(t){var e,i,n;if(!t.ok)return;const s=t.config;if(!("errorTracking"in s))return;const r=null!==(e=null===(i=s.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==e?e:[],o=null===(n=s.errorTracking)||void 0===n?void 0:n.captureExtensionExceptions;this.Kv=r,this._instance.persistence&&this._instance.persistence.register({[I]:this.Kv,[M]:o})}get if(){var t;const e=!!this._instance.get_property(M),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.Xv.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.Yv.enabled)try{if(!Me(t)||0===t.trim().length)return void Hm.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};const e=[];return{sanitizedProperties:Object.keys(t).reduce((i,n)=>Yn.has(n)?(e.push(n),i):(i[n]=t[n],i),{}),droppedKeys:e}}(this.nf(e));n.length>0&&Hm.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.ef.add(he({[Kn]:t,[Xn]:(new Date).toISOString()},i))}catch(t){Hm.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.sf(e)){if(this.rf(e))return this.af("Exception dropped: matched a suppression rule"),void Hm.info("Skipping exception capture because a suppression rule matched");if(!this.if&&this.lf(e))return this.af("Exception dropped: thrown by a browser extension"),void Hm.info("Skipping exception capture because it was thrown by an extension");if(!this.if&&this.uf(e))return this.af("Exception dropped: thrown by an injected browser script"),void Hm.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.hf(e))return this.af("Exception dropped: thrown by the PostHog SDK"),void Hm.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.Yv.enabled&&Re(t.$exception_steps)?this.cf(t):t,n=function(){const t=globalThis._posthogReleaseId;return"string"==typeof t&&t.length>0?t:void 0}();n&&(i.$release_id=n);try{const t=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return t&&this.ef.clear(),t}catch(t){return Bm(t)||Hm.error("Failed to capture exception event. Dropping this exception.",t),void this.ef.clear()}}catch(t){return void(Bm(t)||Hm.error("Failed to process exception event. Ignoring this exception.",t))}}cf(t){try{const e=this.ef.getAttachable();return 0===e.length?t:he(he({},t),{},{$exception_steps:e})}catch(e){return Hm.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}af(t){this.Yv.enabled&&this.ef.add({[Kn]:t,[Xn]:(new Date).toISOString()})}nf(t){return $e(t)?he({},t):{}}tf(){var t,e;return null!==(t=null===(e=this._instance.config.error_tracking)||void 0===e?void 0:e.exception_steps)&&void 0!==t?t:{}}rf(t){if(0===t.length)return!1;try{const e=t.reduce((t,{type:e,value:i})=>(Me(e)&&e.length>0&&t.$exception_types.push(e),Me(i)&&i.length>0&&t.$exception_values.push(i),t),{$exception_types:[],$exception_values:[]});return this.Kv.some(t=>{const i=t.values.map(t=>{const i=gl[t.operator],n=e[t.key];if(!i||!n)return!1;const s=xe(t.value)?t.value:[t.value];return s.length>0&&i(s,n)});return"OR"===t.type?i.some(Boolean):i.every(Boolean)})}catch(t){return Hm.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}lf(t){const e=t.flatMap(t=>{var e,i;return null!==(e=null===(i=t.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==e?e:[]}),i=e.filter(({filename:t})=>!!t&&Wm.some(e=>t.startsWith(e)));return 0!==i.length&&(!i.every(({filename:t})=>!!t&&t.startsWith(zm))||t.some(({type:t,value:e})=>"NoResponse"===t||Me(e)&&Um.some(({value:t,exact:i})=>i?e===t:e.includes(t)))&&!e.some(({in_app:t,filename:e})=>t&&!(null==e?void 0:e.startsWith(zm))))}uf(t){return t.some(({value:t})=>Me(t)&&Vm.some(e=>t.includes(e)))}hf(t){if(t.length>0){var e,i,n,s;const r=null!==(e=null===(i=t[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==e?e:[],o=r[r.length-1];return null!==(n=null==o||null===(s=o.filename)||void 0===s?void 0:s.includes("posthog.com/static"))&&void 0!==n&&n}return!1}sf(t){return!Re(t)&&xe(t)}}},vS=he({productTours:class{get Ml(){return this._instance.persistence}constructor(t){this.df=null,this.vf=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if("productTours"in e){var i,n;if(this.Ml&&this.Ml.register({[R]:!!e.productTours}),!mk(this._instance))return!this.df&&Re(null===(i=this.Ml)||void 0===i?void 0:i.props.ph_product_tours)||gk.info("product tours disabled; stopping and clearing cached tours"),null===(n=this.df)||void 0===n||n.stop(),this.df=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.df&&mk(this._instance)&&this.zo(()=>this.ff())}zo(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"product-tours",e=>{e?gk.error("Could not load product tours script",e):t()})}ff(){var t;!this.df&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.df=d.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(xe(this.vf)&&!e)return void t(this.vf,{isLoaded:!0});const i=this.Ml;if(i){const n=i.props[pt];if(xe(n)&&!e)return this.vf=n,void t(n,{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:e=>{if(!mk(this._instance))return void t([],{isLoaded:!0});const n=e.statusCode;if(200!==n||!e.json){const i=`Product Tours API could not be loaded, status: ${n}`;return 0===n?e.error||gk.warn(i):gk.error(i),void t([],{isLoaded:!1,error:i})}const s=xe(e.json.product_tours)?e.json.product_tours:[];this.vf=s,i&&i.register({[pt]:s}),t(s,{isLoaded:!0})}})}getActiveProductTours(t){Re(this.df)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.df.getActiveProductTours(t)}showProductTour(t){var e;null===(e=this.df)||void 0===e||e.showTourById(t)}previewTour(t){this.df?this.df.previewTour(t):this.zo(()=>{var e;this.ff(),null===(e=this.df)||void 0===e||e.previewTour(t)})}dismissProductTour(){var t;null===(t=this.df)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.df)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.df)||void 0===t||t.previousStep()}clearCache(){var t;this.vf=null,null===(t=this.Ml)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var e;null===(e=this.df)||void 0===e||e.resetTour(t)}resetAllTours(){var t;null===(t=this.df)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var e;null===(e=this.df)||void 0===e||e.cancelPendingTour(t)}}},uS),fS={siteApps:class{constructor(t){this._instance=t,this.pf=0,this.gf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}mf(t,e){if(!e)return;const i=this.globalsForEvent(e);this.gf.push(i),this.gf.length>1e3&&(this.gf=this.gf.slice(10))}get siteAppLoaders(){var t;return null===(t=d._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.mf.bind(this));this.yf=()=>{t(),this.gf=[],this.yf=void 0}}}globalsForEvent(t){var e,i,n,s,r,o,a;if(!t)throw new Error("Event payload is required");const l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(const[t,e]of Object.entries(h))l[t]={id:u[t],type:t,properties:e};const{$set_once:c,$set:d}=t;return{event:he(he({},bs(t,yk)),{},{properties:he(he(he({},t.properties),d?{$set:he(he({},null!==(e=null===(i=t.properties)||void 0===i?void 0:i.$set)&&void 0!==e?e:{}),d)}:{}),c?{$set_once:he(he({},null!==(n=null===(s=t.properties)||void 0===s?void 0:s.$set_once)&&void 0!==n?n:{}),c)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(a=t.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}bf(t){var e;const i=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase();if("style"===i&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(t)||(bk.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===i&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(t)||(bk.error("prepare_external_dependency_script returned null"),null)}return t}_f(){var t,e,i,s,r,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const u=null==n?void 0:n.defaultView,h=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!h)return()=>{};if(this.pf++,this.wf)return this.kf();const c=[],d=this,v=new WeakSet,f=(t,e,i)=>{if(!(null==t?void 0:t[e]))return;const n=t[e];t[e]=i(n),c.push(()=>{t[e]=n})},p=t=>{if(v.has(t))return t;const e=d.bf(t);return e&&v.add(e),e},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!Pe(t));return f(h,"appendChild",t=>function(e){const i=p(e);return i?t.call(this,i):e}),f(h,"insertBefore",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):e}),f(h,"replaceChild",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):i}),[null===(e=u.Element)||void 0===e?void 0:e.prototype,null===(i=u.Document)||void 0===i?void 0:i.prototype,null===(s=u.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{f(t,"append",t=>function(...e){return t.apply(this,g(e))}),f(t,"prepend",t=>function(...e){return t.apply(this,g(e))})}),[null===(r=u.Element)||void 0===r?void 0:r.prototype,null===(o=u.CharacterData)||void 0===o?void 0:o.prototype,null===(a=u.DocumentType)||void 0===a?void 0:a.prototype].forEach(t=>{f(t,"before",t=>function(...e){return t.apply(this,g(e))}),f(t,"after",t=>function(...e){return t.apply(this,g(e))}),f(t,"replaceWith",t=>function(...e){const i=g(e);return e.length&&!i.length?void 0:t.apply(this,i)})}),f(null===(l=u.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",t=>function(e,i){const n=p(i);return n?t.call(this,e,n):null}),this.wf=()=>{c.forEach(t=>t()),this.wf=void 0},this.kf()}kf(){let t=!1;return()=>{var e;t||(t=!0,this.pf--,0===this.pf&&(null===(e=this.wf)||void 0===e||e.call(this)))}}Sf(t,e=!0){const i=this._f();try{const n=t(i);return e&&i(),n}catch(t){throw i(),t}}setupSiteApp(t){const e=this.apps[t.id],i=()=>{var i;!e.errored&&this.gf.length&&(bk.info(`Processing ${this.gf.length} events for site app with id ${t.id}`),this.gf.forEach(t=>this.Sf(()=>{var i;return null===(i=e.processEvent)||void 0===i?void 0:i.call(e,t)})),e.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null===(i=this.yf)||void 0===i||i.call(this))};let n=!1;const s=s=>{e.errored=!s,e.loaded=!0,bk.info(`Site app with id ${t.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this.Sf(e=>t.init({posthog:this._instance,callback(t){e(),s(t)}}),!1);i&&(e.processEvent=i),n=!0}catch(e){bk.error(_k+t.id,e),s(!1)}if(n&&e.loaded)try{i()}catch(i){bk.error(`Error while processing buffered events PostHog app with config id ${t.id}`,i),e.errored=!0}}xf(){const t=this.siteAppLoaders||[];for(const e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(const e of t)this.setupSiteApp(e)}Cf(t){if(0===Object.keys(this.apps).length)return;const e=this.globalsForEvent(t);for(const i of Object.values(this.apps))try{this.Sf(()=>{var t;return null===(t=i.processEvent)||void 0===t?void 0:t.call(i,e)})}catch(e){bk.error(`Error while processing event ${t.event} for site app ${i.id}`,e)}}onRemoteConfig(t){var e,i,n;if(null===(e=this.siteAppLoaders)||void 0===e?void 0:e.length)return this.isEnabled?(this.xf(),void this._instance.on("eventCaptured",t=>this.Cf(t))):void bk.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.yf)||void 0===i||i.call(this),!t.ok)return;const s=t.config;if(null===(n=s.siteApps)||void 0===n?void 0:n.length)if(this.isEnabled)for(const{id:t,url:e}of s.siteApps){var r,o;d[`__$$ph_site_app_${t}`]=this._instance,null===(r=d.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,e,e=>{if(e)return bk.error(_k+t,e)})}else bk.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},pS={tracingHeaders:class{constructor(t){this._instance=t,this.$f=void 0,this.Tf=void 0,this.If=void 0,this.Hv=()=>{const t=this.Mf();var e,i;t?(Ie(this.$f)&&(this.$f=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Ie(this.Tf)&&(this.Tf=null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Zv()}}initialize(){this.startIfEnabledOrStop()}zo(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.tracingHeadersPatchFns)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"tracing-headers",e=>{if(e)return ak.error("failed to load script",e);t()})}Ef(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Mf(){const t=this.Ef();return xe(t)?(xe(this.If)?this.If.splice(0,this.If.length,...t):this.If=[...t],t.length>0?this.If:void 0):(xe(this.If)&&this.If.splice(0),this.If=t||void 0,this.If)}Zv(){var t,e;null===(t=this.$f)||void 0===t||t.call(this),null===(e=this.Tf)||void 0===e||e.call(this),this.$f=void 0,this.Tf=void 0}startIfEnabledOrStop(){this.Mf()?this.zo(this.Hv):this.Zv()}}},gS=he({surveys:class extends xk{constructor(t){var e;super(new Ek(t),(e=t,{get projectToken(){return e.config.token},kv:new Mk(e)})),this._instance=t}qh(t,e){const i=e.query?iw(t,e.query):t;return new Promise(t=>{var n;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor(null!==(n=e.target)&&void 0!==n?n:"api",i),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:t})})}}},uS),mS={toolbar:class{constructor(t){this.instance=t}Pf(t){d.ph_toolbar_state=t}Rf(){var t;return null!==(t=d.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,i=void 0,s=void 0){var r,o;if(rr(this.instance.config))return!1;if(!t||!n)return!1;e=null!==(r=e)&&void 0!==r?r:t.location,s=null!==(o=s)&&void 0!==o?o:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}i=null==t?void 0:t.localStorage}const n=Pk||dr(e.hash,"__posthog")||dr(e.hash,"state");let r;const o=n?cn(()=>JSON.parse(atob(decodeURIComponent(n))))||cn(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):(r=JSON.parse(i.getItem(Rk)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Af(t){const e=d.ph_load_toolbar||d.ph_load_editor;!Re(e)&&Ce(e)?e(t,this.instance):Ak.warn("No toolbar load function found")}loadToolbar(e){const i=!!(null==n?void 0:n.getElementById("__POSTHOG_TOOLBAR__"));if(!t||i)return!1;const s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=he(he({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(Rk,JSON.stringify(he(he({},r),{},{source:void 0}))),2===this.Rf())this.Af(r);else if(0===this.Rf()){var o,a;this.Pf(1),null===(o=d.__PosthogExtensions__)||void 0===o||null===(a=o.loadExternalDependency)||void 0===a||a.call(o,this.instance,"toolbar",t=>{if(t)return Ak.error("[Toolbar] Failed to load",t),void this.Pf(0);this.Pf(2),this.Af(r)}),sr(t,"turbolinks:load",()=>{this.Pf(0),this.loadToolbar(r)})}return!0}Ff(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,i=void 0){return this.maybeLoadToolbar(t,e,i)}}},yS=he({experiments:class e{get Rr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.Of("retrieved web experiments from the server"),this.Df=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.Df&&(e.Of("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.Df)||void 0===i||i.set(t.feature_flag_key,t));const n=this._instance.getFeatureFlag(t.feature_flag_key);Me(n)&&t.variants[n]&&this.Lf(t.name,n,t.variants[n].transforms)}else if(t.variants)for(const i in t.variants){const n=t.variants[i];e.Nf(n,this._instance)&&this.Lf(t.name,i,n.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Of(Uk);else if(!this.Rr.disable_web_experiments){if(Re(this.Df))return this.Df=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Of("applying feature flags",t),t.forEach(t=>{var e;if(this.Df&&(null===(e=this.Df)||void 0===e?void 0:e.has(t))){var i;const e=this._instance.getFeatureFlag(t),n=null===(i=this.Df)||void 0===i?void 0:i.get(t);e&&(null==n?void 0:n.variants[e])&&this.Lf(n.name,e,n.variants[e].transforms)}})}}previewWebExperiment(){const t=e.getWindowLocation();if(null==t?void 0:t.search){const i=hr(null==t?void 0:t.search,"__experiment_id"),n=hr(null==t?void 0:t.search,"__experiment_variant");i&&n&&(e.Of(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(t=>{this.qf(parseInt(i),n,t)},!1,!0))}}loadIfEnabled(){this.Rr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Rr.disable_web_experiments&&!i)return t([]);const n=this._instance.get_property("$web_experiments");if(n&&!e)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Rr.token}`),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}qf(t,i,n){const s=n.filter(e=>e.id===t);s&&s.length>0&&(e.Of(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this.Lf(s[0].name,i,s[0].variants[i].transforms))}static Nf(t,i){return!Re(t.conditions)&&e.jf(t,i)&&e.Bf(t)}static jf(t,i){var n;if(Re(t.conditions)||Re(null===(n=t.conditions)||void 0===n?void 0:n.url))return!0;const s=e.getWindowLocation();if(s){var r,o,a;const e=pr(i,s.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||Wk[null!==(o=null===(a=t.conditions)||void 0===a?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](t.conditions.url,e)}return!1}static getWindowLocation(){return null==t?void 0:t.location}static Bf(t){var e;if(Re(t.conditions)||Re(null===(e=t.conditions)||void 0===e?void 0:e.utm))return!0;const i=Pl();if(i.utm_source){var n,s,r,o,a,l,u,h;const e=!(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)||(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)==i.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)==i.utm_source,d=!(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)||(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)==i.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)==i.utm_term;return e&&d&&v&&c}return!1}static Of(t,...e){Gs.info(`[WebExperiments] ${t}`,e)}Lf(t,i,n){this._is_bot()?e.Of(Uk):"control"!==i?n.forEach(n=>{if(n.selector){var s;e.Of(`applying transform of variant ${i} for experiment ${t} `,n);const r=null===(s=document)||void 0===s?void 0:s.querySelectorAll(n.selector);null==r||r.forEach(t=>{const e=t;n.html&&(e.innerHTML=n.html),n.css&&e.setAttribute("style",n.css)})}}):e.Of("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?Tw(i,this.Rr.custom_blocked_useragents):void 0}}},uS),bS={conversations:class{constructor(t){this._instance=t,this.Hf=void 0,this._conversationsManager=null,this.zf=!1,this.ne=null,this.Uf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return;if(this.Wf=t.ok,!t.ok)return;const e=t.config.conversations;Re(e)||(Oe(e)?this.Hf=e:(this.Hf=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Hf=void 0,this.ne=null,this.Wf=void 0,this.Uf=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this.zf)return;if(this._instance.config.disable_conversations)return;if(rr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==d?void 0:d.__PosthogExtensions__;if(t&&!Ie(this.Hf)&&this.Hf)if(this.ne&&this.ne.token){this.zf=!0;try{const e=t.initConversations;if(e)return this.Vf(e),void(this.zf=!1);const i=t.loadExternalDependency;if(!i)return void this.Gf(Qt);i(this._instance,"conversations",e=>{e||!t.initConversations?this.Gf("Could not load conversations script",e):this.Vf(t.initConversations),this.zf=!1})}catch(t){this.Gf("Error initializing conversations",t),this.zf=!1}}else Vk.error("Conversations enabled but missing token in remote config.")}Vf(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.Uf=!1,Vk.info("Conversations loaded successfully")}catch(t){this.Gf("Error completing conversations initialization",t)}else Vk.error("Cannot complete initialization: remote config is null")}Gf(t,e){Vk.error(t,e),this._conversationsManager=null,this.zf=!1,this.Uf=!0}show(){this._conversationsManager?this._conversationsManager.show():Vk.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Hf&&!Pe(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":rr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Wf?"remote_config_failed":Ie(this.Hf)?this.Wf?"disabled_in_project":"remote_config_pending":this.Hf?Re(this.ne)||!this.ne.token?"missing_token":(null==d?void 0:d.__PosthogExtensions__)?this.zf?"initializing":this.Uf?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,e,i){var n=this;return oe(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(t,e,i):(Vk.warn(Gk),null)})()}getMessages(t,e){var i=this;return oe(function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(Vk.warn(Gk),null)})()}markAsRead(t){var e=this;return oe(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Vk.warn(Gk),null)})()}getTickets(t){var e=this;return oe(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Vk.warn(Gk),null)})()}requestRestoreLink(t){var e=this;return oe(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Vk.warn(Gk),null)})()}restoreFromToken(t){var e=this;return oe(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Vk.warn(Gk),null)})()}restoreFromUrlToken(){var t=this;return oe(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Vk.warn(Gk),null)})()}getCurrentTicketId(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}Sh(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}xh(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},_S={logs:class{constructor(e){var i;this._instance=e,this.name=og,this.Zf=!1,this.Qf=!1,this.Jf=!1,this.$=Zs("[logs]"),this.Kf=he(he({},this.$),{},{error:(...t)=>{t.some(Yk)||this.$.error(...t)}}),this.al=[],this.Xf=[],this.hd=0,this.Io=!1,this.Yf=[],this.tp=[],this.ep=!1,this.np=!1,this.sp=()=>{var t,e;this.Io||(this.hd=0,null===(t=this.rp)||void 0===t||t.onReconnect(),null===(e=this.op)||void 0===e||e.onReconnect())},this._instance&&(null===(i=this._instance.config.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this.Zf=!0),t&&sr(t,"online",this.sp)}ap(t,e,i,n){var s;const r=Zk(null===(s=this._instance)||void 0===s||null===(s=s.config)||void 0===s?void 0:s.logs,i);return[new Ns(this.lp(t,e),r,this.Kf,()=>this.up(),t=>t(),void 0,n),r]}hp(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var i;return this.rp&&this.cp===e||(null===(i=this.rp)||void 0===i||i.reset(),this.cp=e,[this.rp,this.dp]=this.ap(()=>this.al,t=>{this.al=t})),this.rp}vp(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var i;return this.op&&this.fp===e||(null===(i=this.op)||void 0===i||i.reset(),this.fp=e,[this.op,this.pp]=this.ap(()=>this.Xf,t=>{this.Xf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Jk)),this.op}setup(t){var e;if(this.Io)return;this.wo=t,(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.logs)||void 0===e?void 0:e.captureConsoleLogs)&&(this.Zf=!0),(this.Zf||this.gp()&&this.mp())&&this.yp();let i=!1;const n=t.onRemoteConfig(t=>{var e;i=t.ok&&!0===(null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs),this.onRemoteConfig(t)});this.Io?n.dispose():(this.Po=n,i||this.loadIfEnabled())}dispose(){var e,i,n,s;this.Io||(this.Io=!0,this.bp(),null===(e=this.Po)||void 0===e||e.dispose(),this.Po=void 0,this.wo=void 0,this.Jf=!1,null==t||t.removeEventListener("online",this.sp),null===(i=this._p)||void 0===i||i.call(this),this._p=void 0,null===(n=this.rp)||void 0===n||n.reset(),null===(s=this.op)||void 0===s||s.reset())}onRemoteConfig(t){var e,i;if(this.Io)return;const n=t.ok?null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs:void 0;Re(n)?this.wp():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!n}),n?(this.Zf=!0,this.Qf||this.yp(),this.loadIfEnabled()):this.wp())}reset(){var t,e,i,n;this.bp(),null===(t=this.rp)||void 0===t||t.clearQueue(),this.al=[],null===(e=this.rp)||void 0===e||e.reset(),null===(i=this.op)||void 0===i||i.clearQueue(),this.Xf=[],null===(n=this.op)||void 0===n||n.reset(),this.hd=0}captureLog(t){this.Io||this.hp().captureLog(t)}captureConsoleLog(t){this.Io||this.vp().captureLog(t)}captureBufferedConsoleLog(t,e,i){this.Io||this.vp().captureLog(t,{context:e,occurredAtMs:i})}mp(){var t;return!!(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t[A])}gp(){var t,e,i;return!(null===(t=this._instance)||void 0===t||null===(e=t.nl)||void 0===e?void 0:e.call(t))||!!(null===(i=d._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}$h(){var t;this.bp(),null===(t=this.op)||void 0===t||t.clearQueue(),this.Xf=[]}wp(){this.Zf||this.bp()}yp(){var t;if(this.ep||!(null==d?void 0:d.console))return;const e=Zk(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs).maxBufferSize;let i=!0;this.tp.push(()=>{i=!1});for(const t of Qk){let n;try{n=Im(d.console[t])}catch(t){continue}n&&this.tp.push(Mv(d.console,t,s=>{const r=(...n)=>{try{i&&this.kp(t,n,e)}catch(t){}return s.apply(d.console,n)};return r.__rrweb_original__=n,r}))}this.ep=!0,this.Sp=setTimeout(()=>{this.bp()},3e4)}kp(t,e,i){var n;if(this.ep&&!this.np&&0!==e.length)if(null===(n=this._instance)||void 0===n?void 0:n.is_capturing()){if(i>this.Yf.length){this.np=!0;try{this.Yf.push({level:t,args:e,occurredAtMs:Date.now(),context:this.up()})}finally{this.np=!1}}}else this.bp()}bp(){if(this.Yf=[],this.ep){this.ep=!1,this.Sp&&(clearTimeout(this.Sp),this.Sp=void 0);for(const t of this.tp)t();this.tp=[]}}xp(){const t=this.Yf;return this.bp(),t}get logger(){return this.Cp||(this.Cp={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Cp}flushLogs(t){t?this.$p(t):(this.rp&&this.rp.flush().catch(t=>this.Tp(t)),this.op&&this.op.flush().catch(t=>this.Tp(t)))}Tp(t){Yk(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Io||!this.Zf||this.Qf||this.Jf)return;const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.bp();const e=t.loadExternalDependency;if(!e)return this.$.error(Qt),void this.bp();this.Jf=!0;try{e(this._instance,"logs",e=>{if(this.Jf=!1,this.Io||!this.Zf)return;const i=t.logs;if(e||!(null==i?void 0:i.initializeLogs))this.$.error("Could not load logs script",e),this.bp();else{var n;const t=this.xp();var s,r;this._p=i.initializeLogs(null!==(n=this.wo)&&void 0!==n?n:this._instance),this.Qf=!0,t.length>0&&(null===(s=i.replayConsoleBuffer)||void 0===s||s.call(i,null!==(r=this.wo)&&void 0!==r?r:this._instance,t))}})}catch(t){throw this.Jf=!1,t}}lp(t,e){const i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===ce.LogsQueue?t():void 0,setPersistedProperty(t,i){var n;t===ce.LogsQueue&&e(null!==(n=i)&&void 0!==n?n:[])},js:t=>this.js(t),getLibraryId:()=>Ya.LIB_NAME,getLibraryVersion:()=>Ya.LIB_VERSION}}js(t){return new Promise(e=>{if(vr(this.hd,3))return void e({kind:"fatal",error:Xk(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const n=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:Xk(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Ip(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{const e=t.statusCode;if(this.Mp(e),e>=200&&300>e)n({kind:"ok"});else if(413===e)n({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)n({kind:"fatal",error:new Error(`logs request failed with status ${e}`)});else{var i;0===e?(t.error||this.$.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:Xk(t.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`logs request failed with status ${e}`)})}}})})}Mp(t){(0!==t||this._instance.__loaded)&&(this.hd=fr(t,this.hd,3,()=>this.$.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.")))}$p(t){this.al.length>0&&this.Ep(t,this.al,this.dp,Ya.LIB_NAME,t=>{this.al=t}),this.Xf.length>0&&this.Ep(t,this.Xf,this.pp,Jk,t=>{this.Xf=t})}Ep(t,e,i,n,s){if(0===e.length)return;const r=e.map(t=>t.record);s([]);const o=Fs(r,As(i,Ya.LIB_NAME,Ya.LIB_VERSION),n,Ya.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ip(),data:o,compression:"best-available",batchKey:"logs",transport:t})}Ip(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}up(){var t;const e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:t,windowId:i,sessionStartTimestamp:n,lastActivityTimestamp:s}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=t,e.windowId=i,Re(n)||(e.sessionStartTimestamp=n),Re(s)||(e.lastActivityTimestamp=s)}if((null==d||null===(t=d.location)||void 0===t?void 0:t.href)&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?hn(d.location.href):d.location.href),this._instance.featureFlags){const t=this._instance.featureFlags.getFlags();t&&t.length>0&&(e.activeFeatureFlags=t)}return e}}},wS={metrics:class{constructor(t){this._instance=t,this.$=Zs("[metrics]"),this.Io=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.Io)return;const e=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);e&&!this.Pp?this.Pp=(t=>{let e=!0;const i=()=>e?(t=>{var e;const i=null===(e=t.config.metrics)||void 0===e?void 0:e.network;return!0===i?{}:i||void 0})(t):void 0,n=aS(t,i),s=lS(t,i);return()=>{e=!1,n(),s()}})(this._instance):!e&&this.Pp&&(this.Pp(),this.Pp=void 0)}hp(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var i;return this.rp&&this.cp===e||(null===(i=this.rp)||void 0===i||i.reset(),this.cp=e,this.rp=new Hs(this.lp(),function(t){var e,i,n,s,r;const o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==t?void 0:t.serviceVersion,environment:null!==(n=null==o?void 0:o["deployment.environment"])&&void 0!==n?n:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(e),this.$)),this.rp}count(t,e=1,i){this.hp().count(t,e,i)}gauge(t,e,i){this.hp().gauge(t,e,i)}histogram(t,e,i){this.hp().histogram(t,e,i)}flush(t){if(!this.rp)return Promise.resolve();if(t){const e=this.rp.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.rp.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.rp)||void 0===t||t.reset()}dispose(){var t,e;this.Io=!0,null===(t=this.Pp)||void 0===t||t.call(this),this.Pp=void 0,null===(e=this.rp)||void 0===e||e.reset()}lp(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:t=>e.Ys(t),getLibraryId:()=>Ya.LIB_NAME,getLibraryVersion:()=>Ya.LIB_VERSION}}Ys(t,e){return new Promise(i=>{let n=!1;const s=t=>{n||(n=!0,clearTimeout(r),i(t))},r=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(he(he({method:"POST",url:this.Rp(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),{},{fireCallbackOnDrop:!0,callback(t){const e=t.statusCode;if(e>=200&&300>e)s({kind:"ok"});else if(413===e)s({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)s({kind:"fatal",error:new Error(`metrics request failed with status ${e}`)});else{var i;s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`metrics request failed with status ${e}`)})}}}))})}Rp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};sk.__defaultExtensionClasses=he({},he(he(he(he(he(he(he(he(he(he(he(he(he({},uS),hS),cS),dS),vS),fS),gS),pS),mS),yS),bS),_S),wS)),function(){Ya.SDK_DIST_CHANNEL="cdn";const e=d.posthog;if(e&&!xe(e._i)&&Ce(e.init))return;const i=Bw[Xw]=new sk;if(e){const t=[];Js(e._i,function(n){if(n&&xe(n)){const s=i.init(n[0],n[1],n[2]),r=e[n[2]]||e;s.__loaded&&-1===t.indexOf(r)&&(t.push(r),s._execute_array.call(s.people,r.people),s._execute_array(r))}})}i.__SV=1,d.posthog=i,function(){function e(){e.done||(e.done=!0,pw=!1,Js(Bw,function(t){t._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?e():sr(n,"DOMContentLoaded",e,{capture:!1}):t&&Gs.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
1
+ !function(){const t="u">typeof window?window:void 0,e="u">typeof globalThis?globalThis:t,i=null==e?void 0:e.navigator,n=null==e?void 0:e.document,s=null==e?void 0:e.location,r=null==e?void 0:e.fetch,o=(null==e?void 0:e.XMLHttpRequest)&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,l=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent;function h(){return!(!t||!1===t.navigator.onLine)}const c="undefined"!=typeof globalThis?globalThis:t;c&&"undefined"==typeof self&&(c.self=c),c&&"undefined"==typeof File&&(c.File=function(){});const d=null!=t?t:{},v="$people_distinct_id",f="distinct_id",p="$device_id",g="$device_model",m="__alias",y="__cmpns",b="$fbc",_="$fbc_persistence",w="$fbp",k="$fbp_persistence",S="__timers",x="$autocapture_disabled_server_side",C="$heatmaps_enabled_server_side",T="$exception_capture_enabled_server_side",I="$error_tracking_suppression_rules",M="$error_tracking_capture_extension_exceptions",E="$web_vitals_enabled_server_side",P="$dead_clicks_enabled_server_side",R="$product_tours_enabled_server_side",A="$logs_capture_enabled_server_side",F="$web_vitals_allowed_metrics",O="$session_recording_remote_config",D="$session_recording_enabled_server_side",L="$replay_sample_rate",N="$replay_override_sampling",q="$replay_override_linked_flag",j="$replay_override_url_trigger",B="$replay_override_event_trigger",H="$sesid",z="$session_is_sampled",U="$session_past_minimum_duration",W="$session_recording_url_trigger_activated_session",V="$session_recording_event_trigger_activated_session",G="$posthog_sr_group_event_trigger_",Z="$posthog_sr_group_url_trigger_",Q="$posthog_sr_group_sampling_",J="$debug_first_full_snapshot_timestamp",K="$sess_rec_flush_size",X="$enabled_feature_flags",Y="$active_feature_flags",tt="$early_access_features",et="$feature_flag_details",it="$feature_flag_payloads",nt="$feature_flag_request_id",st="$minimal_flag_called_events",rt="$override_feature_flags",ot="$override_feature_flag_payloads",at="$stored_person_properties",lt="$stored_group_properties",ut="$groups",ht="$surveys",ct="$surveys_loaded_at",dt="$surveys_activated",vt="$surveys_activated_session",ft="$surveys_activated_timestamps",pt="ph_product_tours",gt="$product_tours_activated",mt="$product_tours_activated_session",yt="$conversations_widget_session_id",bt="$conversations_ticket_id",_t="$conversations_widget_state",wt="$conversations_user_traits",kt="$flag_call_reported",St="$flag_call_reported_session_id",xt="$feature_flag_errors",Ct="$feature_flag_evaluated_at",$t="$user_state",Tt="$client_session_props",It="$capture_rate_limit",Mt="$initial_campaign_params",Et="$initial_referrer_info",Pt="$initial_person_info",Rt="$epp",At="$posthog_cookieless",Ft="$cookieless_mode",Ot="$sdk_debug_extensions_init_method",Dt="$sdk_debug_extensions_init_time_ms",Lt="$sdk_debug_recording_script_not_loaded",Nt="$sdk_debug_replay_stale_config",qt="$sdk_debug_replay_event_trigger_status",jt="$sdk_debug_replay_linked_flag_trigger_status",Bt="$sdk_debug_replay_matched_recording_trigger_groups",Ht="$sdk_debug_replay_pending_trigger_conditions",zt="$sdk_debug_replay_remote_trigger_matching_config",Ut="$sdk_debug_replay_trigger_groups_count",Wt="$sdk_debug_replay_url_trigger_status",Vt="$sdk_debug_rrweb_attached",Gt="$sdk_debug_rrweb_start_attempted",Zt="$session_recording_start_reason",Qt="PostHog loadExternalDependency extension not found.",Jt="anonymous",Kt="identified",Xt="identified_only",Yt="visibilitychange",te="beforeunload",ee="$pageview",ie="$pageleave",ne="$identify",se="$groupidentify";function re(t,e,i,n,s,r,o){try{var a=t[r](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(n,s)}function oe(t){return function(){var e=this,i=arguments;return new Promise(function(n,s){var r=t.apply(e,i);function o(t){re(r,n,s,o,a,"next",t)}function a(t){re(r,n,s,o,a,"throw",t)}o(void 0)})}}function ae(t){return ae="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},ae(t)}function le(t,e,i){return(e=function(t){var e=function(t){if("object"!=ae(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=ae(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==ae(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function ue(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),i.push.apply(i,n)}return i}function he(t){for(var e=1;arguments.length>e;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ue(Object(i),!0).forEach(function(e){le(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ue(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}var ce=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}({}),de=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({});const ve="min_length",fe="max_length",pe=["$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"],ge=["token"];function me(t,e){return-1!==t.indexOf(e)}const ye=function(t){return t.trim()},be=function(t){return t.replace(/^\$/,"")};function _e(t){var e;const i=[];return null!==(e=JSON.stringify(t,function(t,e){if("bigint"==typeof e)return e.toString();if("function"!=typeof e&&"symbol"!=typeof e){if(e instanceof Error)return{name:e.name,message:e.message,stack:e.stack};if(e&&"object"==typeof e){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(e))return"[Circular]";i.push(e)}return e}}))&&void 0!==e?e:"null"}const we=Object.prototype,ke=we.hasOwnProperty,Se=we.toString,xe=Array.isArray||function(t){return"[object Array]"===Se.call(t)},Ce=t=>"function"==typeof t,$e=t=>t===Object(t)&&!xe(t),Te=t=>{if($e(t)){for(const e in t)if(ke.call(t,e))return!1;return!0}return!1},Ie=t=>void 0===t,Me=t=>"[object String]"==Se.call(t),Ee=t=>Me(t)&&0===t.trim().length,Pe=t=>null===t,Re=t=>Ie(t)||Pe(t),Ae=t=>"[object Number]"==Se.call(t)&&t==t,Fe=t=>Ae(t)&&t>0,Oe=t=>"[object Boolean]"===Se.call(t),De=t=>t instanceof FormData,Le=t=>me(pe,t),Ne=t=>me(ge,t);function qe(t){return null===t||"object"!=typeof t}function je(t,e){return{}.toString.call(t)===`[object ${e}]`}function Be(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 ze(t,Error)}}function He(t){return"u">typeof Event&&ze(t,Event)}function ze(t,e){try{return t instanceof e}catch(t){return!1}}const Ue=[!0,"true",1,"1","yes"],We=t=>me(Ue,t),Ve=[!1,"false",0,"0","no"],Ge=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterestbot","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Ze=function(t,e=[]){if(!t)return!1;const i=t.toLowerCase();return Ge.concat(e).some(t=>{const e=t.toLowerCase();return-1!==i.indexOf(e)})};function Qe(t,e,i,n,s){return e>i&&(n.warn("min cannot be greater than max."),e=i),Ae(t)?t>i?(n.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(n.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(n.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Qe(null!=s?s:i,e,i,n))}var Je=class{constructor(t){this.C={},this.I=t.I,this.R=Qe(t.bucketSize,0,100,t.$),this.A=Qe(t.refillRate,0,this.R,t.$),this.O=Qe(t.refillInterval,0,864e5,t.$)}F(t,e){const i=Math.floor((e-t.lastAccess)/this.O);i>0&&(t.tokens=Math.min(t.tokens+i*this.A,this.R),t.lastAccess=t.lastAccess+i*this.O)}consumeRateLimit(t){var e;const i=Date.now(),n=String(t);let s=this.C[n];return s?this.F(s,i):(s={tokens:this.R,lastAccess:i},this.C[n]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null===(e=this.I)||void 0===e||e.call(this,t)),0===s.tokens)}stop(){this.C={}}};const Ke="Mobile",Xe="Android",Ye="Tablet",ti="Android Tablet",ei="iPad",ii="Apple Watch",ni="Safari",si="BlackBerry",ri="Samsung Internet",oi="Chrome",ai="Chrome iOS",li="Internet Explorer",ui="Internet Explorer Mobile",hi="Opera",ci="Microsoft Edge",di="Firefox",vi="Firefox iOS",fi="Nintendo",pi="PlayStation",gi="Xbox",mi="Android Mobile",yi="Mobile Safari",bi="Windows",_i="Windows Phone",wi="Nokia",ki="Ouya",Si="Generic "+Ke.toLowerCase(),xi="Generic "+Ye.toLowerCase(),Ci="Konqueror",$i="Oculus Browser",Ti="Vivaldi",Ii="Yandex",Mi="Whale",Ei="DuckDuckGo",Pi="Pale Moon",Ri="Waterfox",Ai="Brave",Fi="Claude",Oi="Codex",Di="ChatGPT",Li="Google Search App",Ni=new RegExp("Version/(\\d+(\\.\\d+)?)"),qi=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),ji=new RegExp(gi,"i"),Bi=new RegExp("PlayStation \\w+","i"),Hi=new RegExp("Nintendo \\w+","i"),zi=new RegExp("BlackBerry|PlayBook|BB10","i"),Ui={"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"},Wi=function(t,e,i,n){e=e||"";const s=function(t){return(null==t?void 0:t.brave)?Ai:null}(i);return s||((null==n?void 0:n.detectGoogleSearchApp)&&me(t,"GSA/")?Li:me(t," OPR/")&&me(t,"Mini")?"Opera Mini":me(t," OPR/")?hi:zi.test(t)?si:me(t,"IEMobile")||me(t,"WPDesktop")?ui:me(t,"OculusBrowser")?$i:me(t,"SamsungBrowser")?ri:me(t,"Edge")||me(t,"Edg/")?ci:me(t,"Vivaldi/")?Ti:me(t,"YaBrowser/")?Ii:me(t,"Whale/")?Mi:me(t,"DuckDuckGo/")||me(t,"Ddg/")?Ei:me(t,"Claude/")?Fi:me(t,"Codex/")?Oi:me(t,"ChatGPT/")?Di:me(t,"FBIOS")?"Facebook Mobile":me(t,"UCWEB")||me(t,"UCBrowser")?"UC Browser":me(t,"CriOS")?ai:me(t,"CrMo")||me(t,oi)?oi:me(t,Xe)&&me(t,ni)?mi:me(t,"FxiOS")?vi:me(t.toLowerCase(),Ci.toLowerCase())?Ci:me(t,"Brave/")?Ai:((t,e)=>e&&me(e,"Apple")||function(t){return me(t,ni)&&!me(t,oi)&&!me(t,Xe)}(t))(t,e)?me(t,Ke)?yi:ni:me(t,"PaleMoon/")?Pi:me(t,"Waterfox/")?Ri:me(t,di)?di:me(t,"MSIE")||me(t,"Trident/")?li:me(t,"Gecko")?di:"")},Vi={[ui]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[ci]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[oi]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[ai]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ni]:[Ni],[yi]:[Ni],[hi]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[di]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[vi]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Ci]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[si]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Ni],[mi]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[ri]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[$i]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Ti]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Ii]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Mi]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Ai]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Fi]:[qi],[Oi]:[qi],[Di]:[qi],[Ei]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Pi]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Ri]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Li]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[li]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},Gi=function(t,e,i,n){const s=Wi(t,e,i,n),r=Vi[s];if(Ie(r))return null;for(let e=0;r.length>e;e++){const i=t.match(r[e]);if(i)return parseFloat(i[i.length-2])}return null},Zi=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),t=>[gi,t&&t[1]||""]],[new RegExp(fi,"i"),[fi,""]],[new RegExp(pi,"i"),[pi,""]],[zi,[si,""]],[new RegExp(bi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[_i,""];if(new RegExp(Ke).test(e)&&!/IEMobile\b/.test(e))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){let t=Ui[i[1]]||"";return/arm/i.test(e)&&(t="RT"),[bi,t]}return[bi,""]}],[/((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 e="";return t&&t.length>=3&&(e=Ie(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),t=>t&&t[2]?[Xe,[t[2],t[3],t[4]||"0"].join(".")]:[Xe,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{const e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Qi=function(t){for(let e=0;Zi.length>e;e++){const[i,n]=Zi[e],s=i.exec(t),r=s&&(Ce(n)?n(s,t):n);if(r)return r}return["",""]},Ji=function(t){return Hi.test(t)?fi:Bi.test(t)?pi:ji.test(t)?gi:new RegExp(ki,"i").test(t)?ki:new RegExp("(Windows Phone|WPDesktop)","i").test(t)?_i:/iPad/.test(t)?ei:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ii:zi.test(t)?si:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(wi,"i").test(t)?wi:/(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(Ke).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)?Xe:ti:new RegExp("(pda|Mobile)","i").test(t)?Si:new RegExp(Ye,"i").test(t)&&!new RegExp("Tablet pc","i").test(t)?xi:""},Ki=function(t,e){var i;const n=Ji(t);return n===ei||n===ti||"Kobo"===n||"Kindle Fire"===n||n===xi?Ye:n===fi||n===gi||n===pi||n===ki?"Console":n===ii?"Wearable":n?Ke:"Android"===(null==e?void 0:e.userAgentDataPlatform)&&(null!==(i=null==e?void 0:e.maxTouchPoints)&&void 0!==i?i:0)>0?600>Math.min(null!==(s=null==e?void 0:e.screenWidth)&&void 0!==s?s:0,null!==(r=null==e?void 0:e.screenHeight)&&void 0!==r?r:0)/(null!==(o=null==e?void 0:e.devicePixelRatio)&&void 0!==o?o:1)?Ke:Ye:"Desktop";var s,r,o},Xi=/\bFBAV\/(\d+(?:\.\d+)*)/i,Yi=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Xi],[/\bFBAN\/EMA\b/i,"Facebook Lite",Xi],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Xi],[/\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"]],tn="[Truncated]",en="[Unserializable]";function nn(t){let e="";for(let i=0;t.length>i;i++){const n=t.charCodeAt(i);if(55296>n||n>56319)e+=56320>n||n>57343?t[i]:"�";else{const n=t.charCodeAt(i+1);56320>n||n>57343?e+="�":(e+=t[i]+t[i+1],i++)}}return e}function sn(t,e){if(!e)return t;let i=[];try{i=Object.keys(e)}catch(t){i=[]}for(const n of i){let i;try{i=e[n]}catch(t){i=en}Object.defineProperty(t,n,{value:i,enumerable:!0,writable:!0,configurable:!0})}return t}Date,Date;const rn=3e5;var on=class{record(t){if("too-large"===t.kind)return;if("retry-later"!==t.kind)return void this.reset();if(!t.retryAfterMs)return;const e=this.isOpen(),i=Date.now(),n=Math.min(t.retryAfterMs,rn);if(!e)return this.ts=i,void(this.es=i+n);this.es=Math.max(this.es,Math.min(i+n,this.ts+rn))}remainingMs(){const t=Date.now();if(this.ts-5e3>t)return this.reset(),0;const e=Math.min(rn,Math.max(0,this.es-t));return 0===e&&this.reset(),e}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const an=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ln(t,e){return"string"==typeof(i=t)&&an.test(i)?t:e();var i}function un(t,e){const i=new Error(e);try{Object.defineProperty(i,"name",{value:t,writable:!0,enumerable:!0,configurable:!0})}catch(t){}return i}function hn(t){return t?t.split("#")[0]:t}function cn(t){try{return t()}catch(t){return}}function dn(t,e){const i=setTimeout(t,e);return null!=i&&i.unref&&(null==i||i.unref()),i}function vn(t,e,i){return fn.apply(this,arguments)}function fn(){return(fn=oe(function*(t,e,i){let n;try{return yield Promise.race([t,new Promise((t,s)=>{n=dn(()=>{try{null==i||i(),t()}catch(t){s(t)}},e)})])}finally{clearTimeout(n)}})).apply(this,arguments)}let pn,gn,mn;function yn(t){const e=globalThis._posthogChunkIds;if(!e)return;const i=Object.keys(e);return mn&&i.length===gn||(gn=i.length,mn=i.reduce((i,n)=>{pn||(pn={});const s=pn[n];if(s)i[s[0]]=s[1];else{const s=t(n);for(let t=s.length-1;t>=0;t--){const r=s[t],o=null==r?void 0:r.filename,a=e[n];if(o&&a){i[o]=a,pn[n]=[o,a];break}}}return i},{})),mn}var bn=class{constructor(t,e,i=[]){this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e={}){const i=e&&e.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),r=this.parseStacktrace(n,s);return{$exception_list:this.convertToExceptionList(r,i),$exception_level:"error"}}modifyFrames(t){var e=this;return oe(function*(){for(const i of t)i.stacktrace&&i.stacktrace.frames&&xe(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t})()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null===(e=t.syntheticException)||void 0===e?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var i;let n,s;if(null!=t.cause&&(n=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack)try{s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)}catch(t){}return he(he({},t),{},{cause:n,stack:s,errors:null===(i=t.errors)||void 0===i?void 0:i.map(t=>this.parseStacktrace(t,e))})}applyChunkIds(t,e){return t.map(t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t))}applyCoercers(t,e){for(const i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return oe(function*(){let i=t;for(const t of e.modifiers)i=yield t(i);return i})()}convertToExceptionList(t,e){const i=[],n=(t,s,r)=>{var o;const a=i.length,l=void 0===s?he(he({type:"string"==typeof e.type&&e.type.length>0?e.type:"generic"},"boolean"==typeof e.handled?{handled:e.handled}:void 0===e.handled?{handled:!0}:{}),{},{synthetic:"boolean"==typeof e.synthetic?e.synthetic:t.synthetic,exception_id:a}):{type:"chained",source:r,synthetic:t.synthetic,exception_id:a,parent_id:s},u={type:t.type,value:t.value,mechanism:l};t.stack&&(u.stacktrace={type:"raw",frames:t.stack}),i.push(u),t.cause&&n(t.cause,a,"cause");for(const e of null!==(o=t.errors)&&void 0!==o?o:[])n(e,a,"member")};return n(t),i}buildParsingContext(t){var e;return{chunkIdMap:yn(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}getAggregateErrors(t){try{if(Be(t)){let i=Object.getPrototypeOf(t);for(let n=0;i&&100>n;n++){var e;const n=null===(e=Object.getOwnPropertyDescriptor(i,"constructor"))||void 0===e?void 0:e.value;if("function"==typeof n&&"AggregateError"===n.name){const e=t.errors;return xe(e)?e:void 0}i=Object.getPrototypeOf(i)}}}catch(t){}}buildCoercingContext(t,e,i=0){let n=0,s=0,r=!1;const o=new Set,a=[],l={},u=(t,e,i=0)=>{const u=h(e,i),c=u.apply;if(u.apply=e=>{a.push(t);try{return c(e)}finally{a.pop()}},i>4||i>0&&-1!==a.indexOf(t))return this.coerceFallback(u);const d="object"==typeof t&&null!==t||"function"==typeof t;if(0===i&&n>=50||d&&o.has(t))return;d&&o.add(t),0===i&&n++;const v=this.getAggregateErrors(t);let f,p;r||(r=!!v);try{if(f=this.applyCoercers(t,u),!f)throw l}catch(t){if(t===l)return void(0===i&&n--);if(!r)throw t;f=this.coerceFallback(u)}if(!v||n>=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>n&&1e3>s&&p>t;t++){let i;s++;try{i=u.next(v[t])}catch(t){n++,i=this.coerceFallback(h(e+1))}i&&g.push(i)}return he(he({},f),{},{errors:g})},h=(i,n=0)=>he(he({},e),{},{syntheticException:0==i?e.syntheticException:void 0,mechanism:0==i?t:{},apply(t){const e=u(t,i,n+1);if(!e)throw l;return e},next:t=>u(t,i+1)}),c=h(i);return he(he({},c),{},{apply:t=>{var e;return null!==(e=u(t,i))&&void 0!==e?e:this.coerceFallback(c)}})}};const _n=/^([a-z][a-z0-9.+-]+):/i,wn=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function kn(t){if(!t||"<anonymous>"===t)return!1;const e=_n.exec(t);return!e||wn.includes(e[1].toLowerCase())}function Sn(t,e,i,n,s){const r={platform:t,filename:e,function:"<anonymous>"===i?"?":i,in_app:kn(e)};return Ie(n)||(r.lineno=n),Ie(s)||(r.colno=s),r}const xn=(t,e)=>{const i=-1!==t.indexOf("safari-extension"),n=-1!==t.indexOf("safari-web-extension");return i||n?[-1!==t.indexOf("@")?t.split("@")[0]:"?",i?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Cn=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,$n=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Tn=/\((\S*)(?::(\d+))(?::(\d+))\)/,In=(t,e)=>{const i=Cn.exec(t);if(i){const[,t,n,s]=i;return Sn(e,t,"?",+n,+s)}const n=$n.exec(t);if(n){if(n[2]&&0===n[2].indexOf("eval")){const t=Tn.exec(n[2]);t&&(n[2]=t[1],n[3]=t[2],n[4]=t[3])}const[t,i]=xn(n[1]||"?",n[2]);return Sn(e,i,t,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},Mn=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,En=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Pn=(t,e)=>{const i=Mn.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const t=En.exec(i[3]);t&&(i[1]=i[1]||"eval",i[3]=t[1],i[4]=t[2],i[5]="")}let t=i[3],n=i[1]||"?";return[n,t]=xn(n,t),Sn(e,t,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Rn=/\(error: (.*)\)/;function An(t,e){return t.filename===e.filename&&t.function===e.function&&t.module===e.module&&t.lineno===e.lineno&&t.colno===e.colno}function Fn(t){for(let e=1;10>=e;e++){const i=t.length-2*e;if(0>i)break;let n=!0;for(let s=0;e>s;s++)if(!An(t[i+s],t[i+e+s])){n=!1;break}if(n){for(let n=0;e>n;n++)t[i+n]=t[i+e+n];return t.length=i+e,{start:i,length:e}}}}function On(t,e){const i=e.start+e.length,n=Ln(t,e);n&&t.splice(i+n===t.length?i:e.start,n)}function Dn(t,e){let i=e.start;for(;i>0&&An(t[i-1],t[i-1+e.length]);)i--;return e.start-i}function Ln(t,e){const i=e.start+e.length;let n=i;for(;t.length>n&&An(t[n],t[n-e.length]);)n++;return n-i}function Nn(t,e){const i=e[0];let n=t.length-(i?Dn(t,i):0);for(const i of e)n-=Ln(t,i);return n}function qn(t,e,i){for(let n=0;t.length>n;n++){const s=t[(e+n)%t.length],r=t[(i+n)%t.length];if(s!==r)return r>s}return!1}var jn=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){const i=Me(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){const e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${e}: ${t.message}`:e}isDOMException(t){return je(t,"DOMException")}isDOMError(t){return je(t,"DOMError")}},Bn=class{match(t){return Be(t)}coerce(t,e){var i;const n=this.getStack(t),s=void 0===n?null===(i=e.syntheticException)||void 0===i?void 0:i.stack:void 0,r=!!s;return{type:this.getType(t),value:this.getMessage(t,e),stack:null!=n?n:s,cause:t.cause?e.next(t.cause):void 0,synthetic:r}}getType(t){return t.name||t.constructor.name}getMessage(t,e){const i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){try{const e=t.stacktrace;if("string"==typeof e&&e.length>0)return e;const i=t.stack;return"string"==typeof i&&i.length>0?i:void 0}catch(t){return}}},Hn=class{match(t){return!!je(t,"ErrorEvent")&&(null!=t.error||this.ur(t))}coerce(t,e){var i;if(null!=t.error)return e.apply(t.error);const n=e.apply(t.message);return he(he({},n),{},{stack:null!==(i=this.cr(t))&&void 0!==i?i:n.stack,synthetic:!0})}ur(t){return Me(t.message)&&t.message.length>0}cr(t){var e,i;const n=t,s=null!==(e=n.lineno)&&void 0!==e?e:0,r=null!==(i=n.colno)&&void 0!==i?i:0;if(Me(n.filename)&&0!==n.filename.length&&0!==s)return`Error\n at ${n.filename}:${s}:${r}`}};const zn=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Un=class{match(t){return"string"==typeof t}coerce(t,e){var i;const[n,s]=this.getInfos(t);return{type:null!=n?n:"Error",value:null!=s?s:t,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}getInfos(t){let e="Error",i=t;const n=t.match(zn);return n&&(e=n[1],i=n[2]),[e,i]}};const Wn=["fatal","error","warning","log","info","debug"];function Vn(t,e=40){const i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(let t=i.length;t>0;t--){const n=i.slice(0,t).join(", ");if(e>=n.length)return t===i.length?n:n.length>e?`${n.slice(0,e)}...`:n}return""}var Gn=class{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,n;const s=this.getErrorPropertyFromObject(t);return s?e.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(i=this.getStack(t))&&void 0!==i?i:null===(n=e.syntheticException)||void 0===n?void 0:n.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(He(t))return t.constructor.name;const e="name"in t?t.name:void 0;return Me(e)&&!Ee(e)?e:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){let e=`'${t.name}' captured as exception`;return"message"in t&&"string"==typeof t.message&&(e+=` with message: '${t.message}'`),e}if("message"in t&&"string"==typeof t.message)return t.message;const e=this.getObjectClassName(t);return`${e&&"Object"!==e?`'${e}'`:"Object"} captured as exception with keys: ${Vn(t)}`}isSeverityLevel(t){return Me(t)&&!Ee(t)&&Wn.indexOf(t)>=0}getStack(t){try{return Me(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:Me(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(const e in t)if({}.hasOwnProperty.call(t,e)){const i=t[e];if(Be(i))return i}}getObjectClassName(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}},Zn=class{match(t){return He(t)}coerce(t,e){var i;const n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${Vn(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Qn=class{match(t){return qe(t)}coerce(t,e){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}}},Jn=class{match(t){return je(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!He(t))return!1;try{const e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i;const n=this.getUnhandledRejectionReason(t);return qe(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:null===(i=e.syntheticException)||void 0===i?void 0:i.stack,synthetic:!0}:e.apply(n)}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 Kn="$message",Xn="$timestamp",Yn=new Set([Kn,Xn]),ts={enabled:!0,max_bytes:32768};function es(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:ts.enabled,max_bytes:ns(t.max_bytes,ts.max_bytes)}:he({},ts)}var is=class{constructor(t){this.ns=[],this.ss=0,this.Rr=es(t)}setConfig(t){this.Rr=es(t),this.rs()}add(t){const e=function(t){let e;try{e=_e(t)}catch(t){return}try{const t=JSON.parse(e);if(!$e(t))return;const i=t,n=i[Kn],s=i[Xn];if(!Me(n)||0===n.trim().length)return;if(!Me(s)&&!Ae(s))return;return{step:i,json:e}}catch(t){return}}(t);if(!e)return;const i=function(t){if("u">typeof TextEncoder)return(new TextEncoder).encode(t).length;const e=encodeURIComponent(t);let i=0;for(let t=0;e.length>t;t++)"%"===e[t]?(i+=1,t+=2):i+=1;return i}(e.json);i>this.Rr.max_bytes||(this.ns.push({step:e.step,bytes:i}),this.ss+=i,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.Rr.max_bytes&&this.ns.length>0;){const t=this.ns.shift();t&&(this.ss-=t.bytes)}}};function ns(t,e){if(!Ae(t)||1/0===t||-1/0===t)return e;const i=Math.floor(t);return 0>i?e:i}const ss=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function rs(t){return"string"==typeof t||t}function os(t){return"string"==typeof t?t:void 0}const as=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],ls="NativeGzipValidationError",us=t=>t.length>=2&&31===t[0]&&139===t[1],hs=(t,e)=>t===de.GZipJS||e===de.GZipJS||"gzip"===e,cs=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),ds=t=>{if(!t||"object"!=typeof t)return!1;const e="name"in t?String(t.name):"";return cs(t)||e===ls};let vs;const fs=t=>{throw un(ls,`Native gzip produced invalid output: ${t}`)},ps=(gs=oe(function*(t,e){18>t.size&&fs("too-short");const i=new Uint8Array(yield t.slice(0,10).arrayBuffer());us(i)&&8===i[2]||fs("invalid-header");const n=new DataView(yield t.slice(t.size-8).arrayBuffer());n.getUint32(0,!0)!==(t=>{const e=(()=>{if(vs)return vs;vs=[];for(let t=0;256>t;t++){let e=t;for(let t=0;8>t;t++)e=1&e?3988292384^e>>>1:e>>>1;vs[t]=e>>>0}return vs})();let i=4294967295;for(let n=0;t.length>n;n++)i=e[255&(i^t[n])]^i>>>8;return(4294967295^i)>>>0})(e)&&fs("invalid-crc");const s=e.length>>>0;n.getUint32(4,!0)!==s&&fs("invalid-size")}),function(t,e){return gs.apply(this,arguments)});var gs;function ms(t){return ys.apply(this,arguments)}function ys(){return ys=oe(function*(t,e=!0,i){try{const e=(new TextEncoder).encode(t),i=new globalThis.CompressionStream("gzip"),s=i.writable.getWriter(),r=s.write(e).then(()=>s.close()).catch((n=oe(function*(t){try{yield s.abort(t)}catch(t){}throw t}),function(t){return n.apply(this,arguments)})),o=new Response(i.readable).blob(),[a]=yield Promise.all([o,r]);return yield ps(a,e),a}catch(t){if(null==i?void 0:i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}var n}),ys.apply(this,arguments)}function bs(t,e){if(null==t)return{};var i,n,s=function(t,e){if(null==t)return{};var i={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;i[n]=t[n]}return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(n=0;r.length>n;n++)e.includes(i=r[n])||{}.propertyIsEnumerable.call(t,i)&&(s[i]=t[i])}return s}const _s={}.propertyIsEnumerable;function ws(t,e){try{return xs(t,e,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch(t){return[]}}function ks(t,e,i,n){if(0>=i.remainingNodes)return{stringValue:tn};if(i.remainingNodes--,Oe(t))return{boolValue:t};if("bigint"==typeof t)return function(t,e){const i=t.toString(),n=BigInt("9223372036854775808");return t>=n||-n>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}(t,e);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 i=BigInt(t).toString();return t>=0x8000000000000000||-0x8000000000000000>t?(null==e||e.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:nn(t)};if("function"==typeof t)return{stringValue:"[Function]"};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(i.ancestors.has(t))return{stringValue:"[Circular]"};if(n>=20)return{stringValue:tn};if(t instanceof Date){const e=t.getTime(),i=Number.isFinite(e)?t.toISOString():String(t);return{stringValue:"string"==typeof i?nn(i):String(i)}}i.ancestors.add(t);try{try{const s=t.toJSON;if("function"==typeof s)return ks(s.call(t),e,i,n+1)}catch(t){}return xe(t)?{arrayValue:{values:Ss(t,e,i,n+1)}}:{kvlistValue:{values:xs(t,e,i,n+1)}}}finally{i.ancestors.delete(t)}}return{stringValue:nn(String(t))}}function Ss(t,e,i,n){const s=[],r=Math.min(t.length,1e3);let o=0;for(;r>o&&i.remainingNodes>0;o++)try{const r=o in t?t[o]:void 0;if(Re(r))continue;s.push(ks(r,e,i,n))}catch(t){s.push({stringValue:en})}return t.length>o&&s.push({stringValue:tn}),s}function xs(t,e,i,n){const s=[];for(const r in t)if(_s.call(t,r)){if(!r){null==e||e.debug("Dropping an attribute with an empty key");continue}if(s.length>=1e3||0>=i.remainingNodes){null==e||e.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=t[r];if(Pe(o)||Ie(o))continue;s.push({key:nn(r),value:ks(o,e,i,n)})}catch(t){s.push({key:nn(r),value:{stringValue:en}})}}return s}function Cs(t,e,i){return he(he(he(he({},sn({},t.resourceAttributes)),{},{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment}),t.serviceVersion&&{"service.version":t.serviceVersion}),{},{"telemetry.sdk.name":e,"telemetry.sdk.version":i})}const $s=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function Ts(t,e){const i=sn({},t),n={};for(const t of $s)({}).hasOwnProperty.call(i,t)&&(n[t]=i[t],delete i[t]);return[...ws(i,e),...ws(n,e)]}const Is={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"};const Ms={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}},Es=Ms.info;function Ps(t){try{return nn(String(t))}catch(t){return en}}function Rs(t,e,i,n){const s=t.level||"info",{text:r,number:o}=Ms[s]||Es,a=function(t=Date.now()){return String(t)+"000000"}(Ae(n)?n:void 0),l={};e.distinctId&&(l.posthogDistinctId=e.distinctId),e.sessionId&&(l.sessionId=e.sessionId),e.windowId&&(l["window.id"]=e.windowId),Re(e.sessionStartTimestamp)||(l.sessionStartTimestamp=String(e.sessionStartTimestamp)),Re(e.lastActivityTimestamp)||(l.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(l["url.full"]=e.currentUrl),e.screenName&&(l["screen.name"]=e.screenName),e.appState&&(l["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(l.feature_flags=e.activeFeatureFlags);const u=he({},l),h=t.attributes;if(h){let t=[];try{t=Object.keys(h)}catch(e){t=[]}for(const e of t){let t;try{t=h[e]}catch(e){t=en}Object.defineProperty(u,e,{value:t,enumerable:!0,writable:!0,configurable:!0})}}const c={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:r,body:{stringValue:Ps(t.body)},attributes:ws(u,i)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),Ie(t.trace_flags)||(c.flags=t.trace_flags),c}function As(t,e,i){return Cs(t,e,i)}function Fs(t,e,i,n){return{resourceLogs:[{resource:{attributes:Ts(e)},scopeLogs:[{scope:{name:i,version:n},logRecords:t}]}]}}var Os=class{constructor(t){this.ls=t,this.us=0}get pending(){return!!this.hs}arm(t){this.clear(),this.us=Date.now()+t,this.hs=dn(()=>{this.hs=void 0,this.ls()},t)}armNoEarlierThan(t){this.hs&&Date.now()+t<=this.us||this.arm(t)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function Ds(){return.75+.5*Math.random()}function Ls(t,e,i,n){const s=Math.min(Math.max(0,e-1),6),r=t*Math.pow(2,s);return Math.round((void 0===n?r:Math.min(r,Math.max(n,t)))*i)}var Ns=class{constructor(t,e,i,n,s,r=()=>Promise.resolve(),o){var a;this._instance=t,this.Rr=e,this.$=i,this.cs=n,this.ds=s,this.vs=r,this.fs=o,this.ps=new Os(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new on,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=e.maxBufferSize,this.Is=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.Ms=e.flushIntervalMs,this.Es=e.maxBatchRecordsPerPost,this.Ps=e.rateCapWindowMs,this.Rs=e.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(ce.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Rr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(t,e){var i;if(this._instance.isDisabled)return;if(this._instance.optedOut)return;if(!(null==t?void 0:t.body))return;const n=this.Os(t);if(null===n)return;if(!n.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const s={record:Rs(n,null!==(i=null==e?void 0:e.context)&&void 0!==i?i:this.cs(),this.$,null==e?void 0:e.occurredAtMs)};this.ds(()=>this.Ls(s))}Os(t){const e=this.Rr.beforeSend;if(!e)return t;const i=xe(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.$.info("Log was rejected in beforeSend function"),null;n=e}catch(t){return this.$.error("Error in beforeSend function for log:",t),null}return n}Ds(){if(void 0===this.Rs)return!0;const t=Date.now(),e=t-this.xs;return this.Ps>e&&e>=0||(this.xs=t,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var t=this;return oe(function*(){if(!t._instance.isDisabled)return t.ys||(t.ys=t.Ns().finally(()=>{t.ys=null})),t.ys})()}Ns(){var t=this;return oe(function*(){var e;t.ps.clear();let i=null!==(e=t._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==e?e:[];if(0===i.length)return;const n=i.length;let s=0;for(;i.length>0&&n>s;){var r,o;const e=t._s;t.bs=0;const n=Math.min(i.length,t.Es),a=i.slice(0,n),l=Fs(a.map(t=>t.record),t.qs(),null!==(r=t.fs)&&void 0!==r?r:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.js(l);if(t._s!==e)return;if("too-large"===u.kind&&a.length>1)t.Es=Math.max(1,Math.floor(a.length/2)),t.$.warn(`Logs batch of size ${a.length} was too large for the ingestion endpoint, reducing batch size to ${t.Es}`);else{if(t.ws.record(u),t.ps.pending&&t.ps.arm(Math.max(t.Ms,t.ws.remainingMs())),"retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.$.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.Rr.maxBatchRecordsPerPost>t.Es&&(t.Es=Math.min(t.Rr.maxBatchRecordsPerPost,t.Es+1)),yield t.Bs(a.length),i=null!==(o=t._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==o?o:[],s+=a.length,"fatal"===u.kind)throw u.error}}})()}Bs(t){var e=this;return oe(function*(){var i;const n=Math.max(0,t-e.bs),s=null!==(i=e._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(ce.LogsQueue,s.slice(n)),yield e.vs()})()}qs(){return As(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(t){var e;if(this._instance.optedOut)return;const i=null!==(e=this._instance.getPersistedProperty(ce.LogsQueue))&&void 0!==e?e:[];this.Is>i.length||(i.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(ce.LogsQueue,i),this.Ts>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(Ls(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const t=this._instance.getPersistedProperty(ce.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return oe(function*(){e.ps.clear();const i=e.flush().catch(()=>{});void 0!==t?yield vn(i,t):yield i})()}flushWithTimeout(t){var e=this;return oe(function*(){const i=e.flush();yield vn(i,t,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},t=>{this.ks++,this.Ss=Ds(),this.$.error("PostHog logs flush failed:",t)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const qs=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function js(t){return String(t)+"000000"}function Bs(t,e,i,n){let s="";return n&&(s=Object.keys(n).sort().map(t=>`${JSON.stringify(t)}:${JSON.stringify(n[t])}`).join(",")),`${t}\0${e}\0${null!=i?i:""}\0${s}`}var Hs=class{constructor(t,e,i){this._instance=t,this.Rr=e,this.$=i,this.zs=new Map,this.ps=new Os(()=>this.flush().catch(t=>{this.$.error("Metrics flush failed:",t)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new on,this.ks=0,this.Ss=1,this.Gs=0}count(t,e=1,i){this.Zs({name:t,type:"count",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(t,e,i){this.Zs({name:t,type:"gauge",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(t,e,i){this.Zs({name:t,type:"histogram",value:e,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var t=this;const e=this.ys,i=function(){var i=oe(function*(){e&&(yield e.catch(()=>{})),yield t.Qs()});return function(){return i.apply(this,arguments)}}()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(0===this.zs.size)return null;const t=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(t)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(t){if(this._instance.isDisabled||this._instance.optedOut)return;const e=this.Os(t);if(null===e)return;if(!e.name||"string"!=typeof e.name)return void this.$.warn("Dropping metric with empty name");if("number"!=typeof e.value||!Number.isFinite(e.value))return void this.$.warn(`Dropping metric '${e.name}': value must be a finite number`);if("count"===e.type&&0>e.value)return void this.$.warn(`Dropping count '${e.name}': counters are monotonic, value must be >= 0`);let i,n;try{i=e.attributes?he({},e.attributes):void 0,n=Bs(e.type,e.name,e.unit,i)}catch(t){return void this.$.warn(`Dropping metric '${e.name}': attributes could not be serialized`,t)}let s=this.zs.get(n);if(!s){if(!this.Ks())return;s={name:e.name,type:e.type,unit:e.unit,attributes:i,windowStartMs:Date.now()},this.zs.set(n,s)}const r=this.Ws.get(e.name);void 0===r?this.Ws.set(e.name,e.type):r===e.type||this.Vs.has(e.name)||(this.Vs.add(e.name),this.$.warn(`Metric name '${e.name}' is already used as a ${r}; recording it as a ${e.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(s,e.value),this.Fs()}Ks(){return this.Rr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Rr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(t,e){switch(t.type){case"count":var i;t.total=(null!==(i=t.total)&&void 0!==i?i:0)+e;break;case"gauge":t.last=e;break;case"histogram":{t.hist||(t.hist={count:0,sum:0,min:e,max:e,bucketCounts:new Array(qs.length+1).fill(0)});const i=t.hist;i.count+=1,i.sum+=e,i.min=Math.min(i.min,e),i.max=Math.max(i.max,e),i.bucketCounts[function(t,e){for(let i=0;e.length>i;i++)if(e[i]>=t)return i;return e.length}(e,qs)]+=1;break}}}Os(t){const e=this.Rr.beforeSend;if(!e)return t;const i=xe(e)?e:[e];let n=t;for(const t of i)try{const e=t(n);if(!e)return this.$.info("Metric was rejected in beforeSend function"),null;n=e}catch(t){return this.$.error("Error in beforeSend function for metric:",t),null}return n}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(Ls(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var t=this;return oe(function*(){if(t.ps.clear(),0===t.zs.size)return;const e=t.zs;t.zs=new Map,t.Us=!1,t.Ws=new Map,t.Vs=new Set;const i=t.Gs,n=yield t._instance.Ys(t.Js(e));if(i===t.Gs)switch(t.ws.record(n),"retry-later"===n.kind?(t.ks++,t.Ss=Ds()):(t.ks=0,t.Ss=1),t.ps.pending&&t.ps.arm(t.Hs()),n.kind){case"ok":return;case"retry-later":return t.ho(e),void t.ps.armNoEarlierThan(t.Hs());case"too-large":return void t.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.$.error("Failed to send metrics batch:",n.error)}})()}Js(t){return e=this.vo(t),i=function(t,e,i){return Cs(t,e,i)}(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:Ts(i)},scopeMetrics:[{scope:{name:n,version:s},metrics:e}]}]};var e,i,n,s}vo(t){const e=js(Date.now()),i=new Map;for(const o of t.values()){var n;const t=Bs(o.type,o.name,o.unit,void 0);let a=i.get(t);a||(a=he({name:o.name},o.unit&&{unit:o.unit}),"count"===o.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===o.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(t,a));const l=ws(null!==(n=o.attributes)&&void 0!==n?n:{},this.$),u=js(o.windowStartMs);if("count"===o.type){var s;const t={attributes:l,startTimeUnixNano:u,timeUnixNano:e,asDouble:null!==(s=o.total)&&void 0!==s?s:0};a.sum.dataPoints.push(t)}else if("gauge"===o.type){var r;const t={attributes:l,timeUnixNano:e,asDouble:null!==(r=o.last)&&void 0!==r?r:0};a.gauge.dataPoints.push(t)}else o.hist&&a.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:e,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:qs})}return Array.from(i.values())}ho(t){for(const[n,s]of t){const t=this.zs.get(n);if(t)switch(t.windowStartMs=Math.min(t.windowStartMs,s.windowStartMs),t.type){case"count":var e,i;t.total=(null!==(e=t.total)&&void 0!==e?e:0)+(null!==(i=s.total)&&void 0!==i?i:0);break;case"gauge":break;case"histogram":if(s.hist)if(t.hist){t.hist.count+=s.hist.count,t.hist.sum+=s.hist.sum,t.hist.min=Math.min(t.hist.min,s.hist.min),t.hist.max=Math.max(t.hist.max,s.hist.max);for(let e=0;t.hist.bucketCounts.length>e;e++)t.hist.bucketCounts[e]+=s.hist.bucketCounts[e]}else t.hist=s.hist}else this.Ks()&&this.zs.set(n,s)}}};function zs(t,e){if(!t)return;const i=t.find(t=>t.type===e);return null==i?void 0:i.value}const Us="0.9.0",Ws={DEBUG:!1,LIB_VERSION:Us,LIB_NAME:"browser-common",JS_SDK_VERSION:Us},Vs=(e,{debugEnabled:i}={})=>{const n={N(n,...s){t&&(Ws.DEBUG||t.POSTHOG_DEBUG||i)&&!Ie(t.console)&&t.console&&("__rrweb_original__"in t.console[n]?t.console[n].__rrweb_original__:t.console[n])(e,...s)},debug(...t){n.N("debug",...t)},info(...t){n.N("log",...t)},warn(...t){n.N("warn",...t)},error(...t){n.N("error",...t)},critical(...t){console.error(e,...t)},uninitializedWarning(t){n.error(`You must initialize PostHog before calling ${t}`)},createLogger:(t,i)=>Vs(`${e} ${t}`,i)};return n},Gs=Vs("[PostHog.js]"),Zs=Gs.createLogger;function Qs(t,e){xe(t)&&t.forEach(e)}function Js(t,e){if(!Re(t))if(xe(t))t.forEach(e);else if(De(t))t.forEach((t,i)=>e(t,i));else for(const i in t)ke.call(t,i)&&e(t[i],i)}const Ks=function(t,...e){for(const i of e)for(const e in i)void 0!==i[e]&&(t[e]=i[e]);return t};function Xs(t){const e=Object.keys(t);let i=e.length;const n=new Array(i);for(;i--;)n[i]=[e[i],t[e[i]]];return n}const Ys=function(t){return function(...e){try{return t.apply(this,e)}catch(t){Gs.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Gs.critical(t)}}},tr=function(t){const e={};return Js(t,function(t,i){(Me(t)&&t.length>0||Ae(t))&&(e[i]=t)}),e};function er(t){const e=he({},t);for(const i of["name","message","stack","cause","errors"])try{i in t&&(e[i]=t[i])}catch(t){}return e}const ir=["herokuapp.com","vercel.app","netlify.app"];function nr(t){const e=null==t?void 0:t.hostname;if(!Me(e))return!1;const i=e.split(".").slice(-2).join(".");for(const t of ir)if(i===t)return!1;return!0}function sr(t,e,i,n){const{capture:s=!1,passive:r=!0}=null!=n?n:{};null==t||t.addEventListener(e,i,{capture:s,passive:r})}function rr(t){return"ph_toolbar_internal"===t.name}const or=["localhost","127.0.0.1"],ar=(t,e)=>{try{let i;return JSON.stringify(t,(t,e)=>{var n;return Be(e)?(null!==(n=i)&&void 0!==n||(i=new WeakMap),i.has(e)||i.set(e,er(e)),i.get(e)):"bigint"==typeof e?e.toString():e},e)}catch(e){return _e(t)}},lr=t=>{const e=null==n?void 0:n.createElement("a");return Ie(e)?null:(e.href=t,e)},ur=function(t,e="&"){let i,n;const s=[];return Js(t,function(t,e){Ie(t)||Ie(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),n=encodeURIComponent(e),s[s.length]=n+"="+i)}),s.join(e)},hr=function(t,e){const i=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let n;for(let t=0;i.length>t;t++){const s=i[t].split("=");if(s[0]===e){n=s;break}}if(!xe(n)||2>n.length)return"";{let t=n[1];try{t=decodeURIComponent(t)}catch(e){Gs.error("Skipping decoding for malformed query param: "+t)}return t.replace(/\+/g," ")}},cr=function(t,e,i){if(!t||!e||!e.length)return t;const n=t.split("#"),s=n[1],r=(n[0]||"").split("?"),o=r[1],a=r[0],l=(o||"").split("&"),u=[];for(let t=0;l.length>t;t++){const n=l[t].split("=");xe(n)&&(e.includes(n[0])?u.push(n[0]+"="+i):u.push(l[t]))}let h=a;return null!=o&&(h+="?"+u.join("&")),null!=s&&(h+="#"+s),h},dr=function(t,e){const i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},vr=(t,e)=>t>=e&&h(),fr=(t,e,i,n)=>{if(0===t){if(h()){const t=e+1;return t===i&&n(),t}return e}return 0};function pr(t,e){var i;const n=null==t||null===(i=t.config)||void 0===i?void 0:i.get_current_url;if(!Ce(n))return e;try{const t=n(e);return Me(t)&&t?t:e}catch(t){return Gs.error("Error in get_current_url, falling back to window.location.href",t),e}}function gr(e){var i;const n=null==t||null===(i=t.location)||void 0===i?void 0:i.href;return Ie(n)?void 0:pr(e,n)}function mr(t){var e;return t instanceof Element&&("__POSTHOG_TOOLBAR__"===t.id||!!(null===(e=t.closest)||void 0===e?void 0:e.call(t,".toolbar-global-fade-container")))}function yr(t){return!!t&&1===t.nodeType}function br(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function _r(t){return!!t&&3===t.nodeType}function wr(t){return!!t&&11===t.nodeType&&yr(t.host)}function kr(t){return t?ye(t).split(/\s+/):[]}function Sr(t,e){const i=gr(e);return!!(i&&t&&t.some(t=>i.match(t)))}function xr(t){let e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return kr(e)}function Cr(t){return Re(t)?null:ye(t).split(/(\s+)/).filter(t=>Xr(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function $r(t){let e="";return zr(t)&&!Ur(t)&&t.childNodes&&t.childNodes.length&&Js(t.childNodes,function(t){var i;_r(t)&&t.textContent&&(e+=null!==(i=Cr(t.textContent))&&void 0!==i?i:"")}),ye(e)}function Tr(t){var e;return Ie(t.target)?t.srcElement||null:(null===(e=t.target)||void 0===e?void 0:e.shadowRoot)?t.composedPath()[0]||null:t.target||null}const Ir=["a","button","form","input","select","textarea","label"];function Mr(t,e){const i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}function Er(t,e){if(Ie(e))return!0;for(const i of t)if(e.some(t=>Mr(i,t)))return!0;return!1}function Pr(t){const e=t.parentNode;return!(!e||!yr(e))&&e}const Rr=[".ph-no-autocapture","[data-ph-no-autocapture]"],Ar=["next","previous","prev",">","<"],Fr=[...Ar,"+","-","−","–"],Or=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,Dr=[".ph-no-deadclick",".ph-no-capture"],Lr=[".ph-no-rageclick",".ph-no-capture"],Nr=["","text","search","email","password","url","tel","number"];function qr(t){return!(!t||!yr(t))&&(!!br(t,"textarea")||(br(t,"input")?me(Nr,(t.getAttribute("type")||"").toLowerCase()):function(t){var e;if(t.isContentEditable)return!0;const i=null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return"true"===i||""===i}(t)))}function jr(e,i){if(!t||Br(e))return!1;let n,s,r;var o,a;if(Oe(i)?(n=!!i&&Lr,s=void 0,r=!1):(n=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:Lr,s=null==i?void 0:i.content_ignorelist,r=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===n)return!1;if(r&&qr(e))return!1;const{targetElementList:l}=Hr(e,!1);return!function(t,e){if(!1===t||Ie(t))return!1;let i;if(!0===t)i=Ar;else{if(!xe(t))return!1;if(t.length>10)return Gs.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map(t=>t.toLowerCase())}return e.some(({safeText:t,ariaLabel:e})=>i.some(i=>Or(t,i)||Or(e,i)))}(s,l.map(t=>{var e;return{safeText:$r(t).toLowerCase(),ariaLabel:(null===(e=t.getAttribute("aria-label"))||void 0===e?void 0:e.toLowerCase().trim())||""}}))&&!Er(l,n)}const Br=t=>!t||br(t,"html")||!yr(t),Hr=(e,i)=>{if(!t||Br(e))return{parentIsUsefulElement:!1,targetElementList:[]};let n=!1;const s=[e];let r=e;for(;r.parentNode&&!br(r,"body");){if(wr(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const e=Pr(r);if(!e)break;if(i||Ir.indexOf(e.tagName.toLowerCase())>-1)n=!0;else try{const i=t.getComputedStyle(e);i&&"pointer"===i.getPropertyValue("cursor")&&(n=!0)}catch(t){}s.push(e),r=e}return{parentIsUsefulElement:n,targetElementList:s}};function zr(t){const e=new Set;let i=0;for(let n=t;n.parentNode&&!br(n,"body");n=n.parentNode){if(i++>=1e3||e.has(n))return!1;e.add(n);const t=xr(n);if(me(t,"ph-sensitive")||me(t,"ph-no-capture"))return!1}if(me(xr(t),"ph-include"))return!0;const n=t.type||"";if(Me(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const s=t.name||t.id||"";return!Me(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Ur(t){return!!(br(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||br(t,"select")||br(t,"textarea")||"true"===t.getAttribute("contenteditable"))}const Wr=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}))$"),Vr=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Gr=[16,15,14,13],Zr=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),Qr=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Jr=/[0-9A-Za-z_]/;function Kr(t){let e=0,i=!1;for(let n=t.length-1;n>=0;n--){let s=t.charCodeAt(n)-48;i&&(s*=2,s>9&&(s-=9)),e+=s,i=!i}return e%10==0}function Xr(t,e=!0){if(Re(t))return!1;if(Me(t)){if(t=ye(t),e?Wr.test((t||"").replace(/[- ]/g,"")):function(t){let e;for(Vr.lastIndex=0;e=Vr.exec(t);){const t=e[2];if(!t)continue;const i=t.replace(/[- ]/g,"");for(let t=0;i.length>t;t++)for(const e of Gr){const n=t+e;if(i.length>=n){const e=i.slice(t,n);if(Wr.test(e)&&Kr(e))return!0}}}return!1}(t))return!1;if(e?Zr.test(t):function(t){let e;for(Qr.lastIndex=0;e=Qr.exec(t);){const t=e[1],i=e[3];if(!(t&&i&&Jr.test(t)&&Jr.test(i)))return!0}return!1}(t))return!1}return!0}function Yr(t){let e=$r(t);return e=`${e} ${to(t)}`.trim(),Xr(e)?e:""}function to(t){let e="";return t&&t.childNodes&&t.childNodes.length&&Js(t.childNodes,function(t){var i;if(t&&"span"===(null===(i=t.tagName)||void 0===i?void 0:i.toLowerCase()))try{const i=$r(t);e=`${e} ${i}`.trim(),t.childNodes&&t.childNodes.length&&(e=`${e} ${to(t)}`.trim())}catch(t){Gs.error("[AutoCapture]",t)}}),e}function eo(t){return t.replace(/"|\\"/g,'\\"')}function io(t){const e=t.attr__class;if(e)return xe(e)?e:kr(e)}const no=1e6;function so(t){var e;return Math.min(no,null!==(e=t.payloadSizeLimitBytes)&&void 0!==e?e:no)}const ro={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:no,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","google-analytics.com","analytics.google.com","nr-data.net","datadoghq.com","datadoghq.eu","ddog-gov.com","segment.io","rudderstack.com","amplitude.com","mixpanel.com","hotjar.com","hotjar.io","fullstory.com"],streamNetworkBody:!1},oo=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],ao=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],lo=["auth","token","secret","session","api-key","apikey","api_key","credential","password","passwd","cookie","csrf","xsrf"],uo=t=>{Re(t)||Js(Object.keys(t),e=>{(t=>{const e=t.toLowerCase();return oo.includes(e)||lo.some(t=>e.includes(t))})(e)&&(t[e]="redacted")})},ho=["/s/","/e/","/i/"];function co(t,e,i,n){if(Re(t))return t;let s=(null==e?void 0:e["content-length"])||function(t){return new Blob([t]).size}(t);return Me(s)&&(s=parseInt(s)),s>i?`[SessionRecording] ${n} body too large to record (${s} bytes)`:t}function vo(t,e){if(Re(t))return t;let i=t;return Xr(i,!1)||(i="[SessionRecording] "+e+" body redacted"),Js(ao,t=>{(null==i?void 0:i.length)&&-1!==(null==i?void 0:i.indexOf(t))&&(i="[SessionRecording] "+e+" body redacted as might contain: "+t)}),i}const fo=new WeakSet,po="disabled",go="sampled",mo="active",yo="buffering",bo="paused",_o="lazy_loading",wo="rrweb_error",ko="trigger_activated",So="trigger_pending",xo="trigger_disabled";function Co(t,e,i,n,s,r){return 0===e?xo:(null==t?void 0:t.get_property(i?n+i:s))===r?ko:So}function $o(t,e,i){return e.some(e=>{var n;return"regex"===e.matching&&(null!==(n=null==i?void 0:i.get(e.url))&&void 0!==n?n:new RegExp(e.url)).test(t)})}function To(t){return t.includes("trigger_activated")?ko:t.includes("trigger_pending")?So:xo}function Io(t){const e=new Set(t);switch(e.delete(xo),e.size){case 0:return xo;case 1:return Array.from(e)[0];default:return So}}var Mo=class{constructor(t){this.q=t}triggerStatus(t){return To(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return To(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Eo=class{constructor(t){this.q=t}triggerStatus(t){return Io(this.q.map(e=>e.triggerStatus(t)))}triggerStatusNoSideEffects(t){return Io(this.q.map(e=>e.triggerStatusNoSideEffects(t)))}stop(){this.q.forEach(t=>t.stop())}},Po=class{triggerStatus(){return this.triggerStatusNoSideEffects()}triggerStatusNoSideEffects(){return ko}stop(){}};const Ro=t=>"sessionRecording"in t;var Ao=class{constructor(t,e){this._instance=t,this.j=[],this.B=[],this.H=new Map,this.U=new Map,this.W="",this.urlBlocked=!1,this.V=e}onConfig(t){var e,i;this.j=(Ro(t)?$e(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.urlTriggers:[]:null==t?void 0:t.urlTriggers)||[],this.B=(Ro(t)?$e(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.urlBlocklist:[]:null==t?void 0:t.urlBlocklist)||[],this.Z()}Z(){this.H.clear(),this.U.clear();for(const t of this.j)if("regex"===t.matching&&!this.H.has(t.url))try{this.H.set(t.url,new RegExp(t.url))}catch(e){Gs.error("Invalid URL trigger regex pattern:",t.url,e)}for(const t of this.B)if("regex"===t.matching&&!this.U.has(t.url))try{this.U.set(t.url,new RegExp(t.url))}catch(e){Gs.error("Invalid URL blocklist regex pattern:",t.url,e)}}onRemoteConfig(t){this.onConfig(t)}G(t){return Co(this._instance,this.j.length,this.V,Z,W,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[Wt]:e}),e}triggerStatusNoSideEffects(t){return this.G(t)}isCurrentUrlBlocked(){const t=gr(this._instance);if(!t)return!1;try{return $o(t,this.B,this.U)}catch(t){return!0}}checkUrlBlocklist(t,e){const i=gr(this._instance);if(!i)return;if(i===this.W)return;this.W=i;const n=this.urlBlocked,s=$o(i,this.B,this.U);n&&s||(s&&!n?t():!s&&n&&e())}checkUrlTriggerConditions(t,e,i,n){const s=gr(this._instance);if(!s)return;if(s===this.W)return;this.W=s;const r=this.urlBlocked,o=$o(s,this.B,this.U);o&&!r?t():!o&&r&&e();const a=this.G(n)===ko,l=$o(s,this.j,this.H);!a&&l&&i("url",s)}stop(){this.W=""}},Fo=class{constructor(t){this._instance=t,this.linkedFlag=null,this.linkedFlagSeen=!1,this.J=()=>{}}triggerStatus(){const t=this.triggerStatusNoSideEffects();return this._instance.register_for_session({[jt]:t}),t}triggerStatusNoSideEffects(){let t=So;return Re(this.linkedFlag)&&(t=xo),this.linkedFlagSeen&&(t=ko),t}onConfig(t,e){var i;if(this.linkedFlag=(Ro(t)?$e(t.sessionRecording)?null===(i=t.sessionRecording)||void 0===i?void 0:i.linkedFlag:null:null==t?void 0:t.linkedFlag)||null,!Re(this.linkedFlag)&&!this.linkedFlagSeen){const t=Me(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,i=Me(this.linkedFlag)?null:this.linkedFlag.variant;this.J=this._instance.onFeatureFlags((n,s)=>{let r=!1;if($e(s)&&t in s){const e=s[t];r=Oe(e)?!0===e:i?e===i:!!e}const o=r&&!this.linkedFlagSeen;this.linkedFlagSeen=r,o&&e(t,i)})}}onRemoteConfig(t,e){this.onConfig(t,e)}stop(){this.J()}},Oo=class{constructor(t,e){this._instance=t,this.K=[],this.V=e}onConfig(t){var e;this.K=(Ro(t)?$e(t.sessionRecording)?null===(e=t.sessionRecording)||void 0===e?void 0:e.eventTriggers:[]:null==t?void 0:t.eventTriggers)||[]}onRemoteConfig(t){this.onConfig(t)}X(t){return Co(this._instance,this.K.length,this.V,G,V,t)}triggerStatus(t){const e=this.triggerStatusNoSideEffects(t);return this._instance.register_for_session({[qt]:e}),e}triggerStatusNoSideEffects(t){return this.X(t)}checkEventTriggerConditions(t,e,i){if(0===this.K.length)return;const n=this.X(i)===ko,s=this.K.includes(t);!n&&s&&e("event",t)}stop(){}},Do=class{constructor(t,e,i){if(this._instance=t,this.group=e,this.Y=new Ao(t,e.id),this.tt=new Oo(t,e.id),this.et=new Fo(t),e.conditions.events&&e.conditions.events.length>0||e.conditions.urls&&e.conditions.urls.length>0||e.conditions.flag){const t=(e.conditions.events||[]).map(t=>t.name),n={urlTriggers:e.conditions.urls||[],eventTriggers:t,linkedFlag:e.conditions.flag||null,urlBlocklist:[]};this.Y.onConfig(n),this.tt.onConfig(n),this.et.onConfig(n,i);const s=[this.tt,this.Y,this.et];this.nt="any"===e.conditions.matchType?new Mo(s):new Eo(s)}else this.nt=new Po}triggerStatus(t){return this.nt.triggerStatus(t)}triggerStatusNoSideEffects(t){return this.nt.triggerStatusNoSideEffects(t)}getPendingTriggerConditions(t){return"trigger_pending"!==this.triggerStatusNoSideEffects(t)?[]:[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===So).map(({label:t})=>t)}checkEventTriggerConditions(t,e,i){this.tt.checkEventTriggerConditions(t,e,i)}checkUrlTriggerConditions(t,e,i,n){this.Y.checkUrlTriggerConditions(t,e,i,n)}activateTrigger(t,e){var i;const n="url"===t?Z+this.group.id:G+this.group.id;null===(i=this._instance.persistence)||void 0===i||i.register({[n]:e})}stop(){this.Y.stop(),this.tt.stop(),this.et.stop()}};function Lo(t){if(t.rrwebError)return wo;if(!t.receivedFlags)return yo;if(!t.isRecordingEnabled)return po;if(t.urlTriggerMatching.urlBlocked)return bo;const e=!0===t.isSampled,i=new Mo([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?go:"trigger_activated"===i?mo:"trigger_pending"===i?yo:!1===t.isSampled?po:mo}function No(t){if(t.rrwebError)return wo;if(!t.receivedFlags)return yo;if(!t.isRecordingEnabled)return po;if(t.urlTriggerMatching.urlBlocked)return bo;const e=new Eo([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),i=e!==xo,n=Oe(t.isSampled);return i&&"trigger_pending"===e?yo:i&&"trigger_disabled"===e||n&&!t.isSampled?po:!0===t.isSampled?go:mo}function qo(){const t=[];return function(e,i){if($e(i)||xe(i)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(i)?"[Circular]":(t.push(i),i)}return i}}function jo(t){try{const e=JSON.stringify(t,qo());return e?new Blob([e]).size:0}catch(t){return-1}}function Bo(t){if(Pe(t))return 4;if(Ie(t))return 0;switch(typeof t){case"string":return t.length+2;case"number":return String(t).length;case"boolean":return t?4:5;case"object":{if(xe(t)){let e=2;for(let i=0;t.length>i;i++){i>0&&(e+=1);const n=t[i];e+=Ie(n)||Pe(n)?4:Bo(n)}return e}const e=t;let i=2,n=!0;for(const t in e){if(!{}.hasOwnProperty.call(e,t))continue;const s=e[t];Ie(s)||(n||(i+=1),n=!1,i+=t.length+3+Bo(s))}return i}default:return 0}}function Ho(t,e=6606028.8){if(t.size>=e&&t.data.length>1){const e=Math.floor(t.data.length/2),i=t.sizes.slice(0,e),n=t.sizes.slice(e);return[Ho({size:i.reduce((t,e)=>t+e,0),data:t.data.slice(0,e),sizes:i,sessionId:t.sessionId,windowId:t.windowId}),Ho({size:n.reduce((t,e)=>t+e,0),data:t.data.slice(e),sizes:n,sessionId:t.sessionId,windowId:t.windowId})].flatMap(t=>t)}return[t]}var zo=Uint8Array,Uo=Uint16Array,Wo=Uint32Array,Vo=new zo([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]),Go=new zo([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Zo=new zo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qo=function(t,e){for(var i=new Uo(31),n=0;31>n;++n)i[n]=e+=1<<t[n-1];var s=new Wo(i[30]);for(n=1;30>n;++n)for(var r=i[n];i[n+1]>r;++r)s[r]=r-i[n]<<5|n;return[i,s]},Jo=Qo(Vo,2),Ko=Jo[1];Jo[0][28]=258,Ko[258]=28;for(var Xo=Qo(Go,0)[1],Yo=new Uo(32768),ta=0;32768>ta;++ta){var ea=(43690&ta)>>>1|(21845&ta)<<1;Yo[ta]=((65280&(ea=(61680&(ea=(52428&ea)>>>2|(13107&ea)<<2))>>>4|(3855&ea)<<4))>>>8|(255&ea)<<8)>>>1}var ia=function(t,e,i){for(var n=t.length,s=0,r=new Uo(e);n>s;++s)++r[t[s]-1];var o,a=new Uo(e);for(s=0;e>s;++s)a[s]=a[s-1]+r[s-1]<<1;if(i){o=new Uo(1<<e);var l=15-e;for(s=0;n>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],c=a[t[s]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)o[Yo[c]>>>l]=u}else for(o=new Uo(n),s=0;n>s;++s)o[s]=Yo[a[t[s]-1]++]>>>15-t[s];return o},na=new zo(288);for(ta=0;144>ta;++ta)na[ta]=8;for(ta=144;256>ta;++ta)na[ta]=9;for(ta=256;280>ta;++ta)na[ta]=7;for(ta=280;288>ta;++ta)na[ta]=8;var sa=new zo(32);for(ta=0;32>ta;++ta)sa[ta]=5;var ra=ia(na,9,0),oa=ia(sa,5,0),aa=function(t){return(t/8|0)+(7&t&&1)},la=function(t,e,i){(null==e||0>e)&&(e=0),(null==i||i>t.length)&&(i=t.length);var n=new(t instanceof Uo?Uo:t instanceof Wo?Wo:zo)(i-e);return n.set(t.subarray(e,i)),n},ua=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8},ha=function(t,e,i){var n=e/8|0;t[n]|=i<<=7&e,t[n+1]|=i>>>8,t[n+2]|=i>>>16},ca=function(t,e){for(var i=[],n=0;t.length>n;++n)t[n]&&i.push({s:n,f:t[n]});var s=i.length,r=i.slice();if(!s)return[new zo(0),0];if(1==s){var o=new zo(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(t,e){return t.f-e.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,c=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[c].f>i[u].f?u++:c++],l=i[u!=h&&i[c].f>i[u].f?u++:c++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var d=r[0].s;for(n=1;s>n;++n)r[n].s>d&&(d=r[n].s);var v=new Uo(d+1),f=da(i[h-1],v,0);if(f>e){n=0;var p=0,g=f-e,m=1<<g;for(r.sort(function(t,e){return v[e.s]-v[t.s]||t.f-e.f});s>n;++n){var y=r[n].s;if(e>=v[y])break;p+=m-(1<<f-v[y]),v[y]=e}for(p>>>=g;p>0;){var b=r[n].s;e>v[b]?p-=1<<e-v[b]++-1:++n}for(;n>=0&&p;--n){var _=r[n].s;v[_]==e&&(--v[_],++p)}f=e}return[new zo(v),f]},da=function(t,e,i){return-1==t.s?Math.max(da(t.l,e,i+1),da(t.r,e,i+1)):e[t.s]=i},va=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Uo(++e),n=0,s=t[0],r=1,o=function(t){i[n++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++r;else{if(!s&&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(s),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(s);r=1,s=t[a]}return[i.subarray(0,n),e]},fa=function(t,e){for(var i=0,n=0;e.length>n;++n)i+=t[n]*e[n];return i},pa=function(t,e,i){var n=i.length,s=aa(e+2);t[s]=255&n,t[s+1]=n>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var r=0;n>r;++r)t[s+r+4]=i[r];return 8*(s+4+n)},ga=function(t,e,i,n,s,r,o,a,l,u,h){ua(e,h++,i),++s[256];for(var c=ca(s,15),d=c[0],v=c[1],f=ca(r,15),p=f[0],g=f[1],m=va(d),y=m[0],b=m[1],_=va(p),w=_[0],k=_[1],S=new Uo(19),x=0;y.length>x;++x)S[31&y[x]]++;for(x=0;w.length>x;++x)S[31&w[x]]++;for(var C=ca(S,7),T=C[0],I=C[1],M=19;M>4&&!T[Zo[M-1]];--M);var E,P,R,A,F=u+5<<3,O=fa(s,na)+fa(r,sa)+o,D=fa(s,d)+fa(r,p)+o+14+3*M+fa(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(O>=F&&D>=F)return pa(e,h,t.subarray(l,l+u));if(ua(e,h,1+(O>D)),h+=2,O>D){E=ia(d,v,0),P=d,R=ia(p,g,0),A=p;var L=ia(T,I,0);for(ua(e,h,b-257),ua(e,h+5,k-1),ua(e,h+10,M-4),h+=14,x=0;M>x;++x)ua(e,h+3*x,T[Zo[x]]);h+=3*M;for(var N=[y,w],q=0;2>q;++q){var j=N[q];for(x=0;j.length>x;++x)ua(e,h,L[B=31&j[x]]),h+=T[B],B>15&&(ua(e,h,j[x]>>>5&127),h+=j[x]>>>12)}}else E=ra,P=na,R=oa,A=sa;for(x=0;a>x;++x)if(n[x]>255){var B;ha(e,h,E[257+(B=n[x]>>>18&31)]),h+=P[B+257],B>7&&(ua(e,h,n[x]>>>23&31),h+=Vo[B]);var H=31&n[x];ha(e,h,R[H]),h+=A[H],H>3&&(ha(e,h,n[x]>>>5&8191),h+=Go[H])}else ha(e,h,E[n[x]]),h+=P[n[x]];return ha(e,h,E[256]),h+P[256]},ma=new Wo([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ya=new zo(0),ba=function(){for(var t=new Wo(256),e=0;256>e;++e){for(var i=e,n=9;--n;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),_a=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function wa(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,n=0;e.length>n;++n)i=ba[255&i^e[n]]^i>>>8;t=i},d(){return 4294967295^t}}}(),n=t.length;i.p(t);var s,r,o,a,l,u=(s=t,r=e,o=function(t){return 10+(t.filename&&t.filename.length+1||0)}(e),a=8,function(t,e,i,n,s,r){var o=t.length,a=new zo(n+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(n,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var c=h+65535;o>c?u=pa(l,u,t.subarray(h,c)):(l[h]=r,u=pa(l,u,t.subarray(h,o)))}else{for(var d=ma[e-1],v=d>>>13,f=8191&d,p=(1<<i)-1,g=new Uo(32768),m=new Uo(p+1),y=Math.ceil(i/3),b=2*y,_=function(e){return(t[e]^t[e+1]<<y^t[e+2]<<b)&p},w=new Wo(25e3),k=new Uo(288),S=new Uo(32),x=0,C=0,T=(h=0,0),I=0,M=0;o>h;++h){var E=_(h),P=32767&h,R=m[E];if(g[P]=R,m[E]=P,h>=I){var A=o-h;if((x>7e3||T>24576)&&A>423){u=ga(t,l,0,w,k,S,C,T,M,h-M,u),T=x=C=0,M=h;for(var F=0;286>F;++F)k[F]=0;for(F=0;30>F;++F)S[F]=0}var O=2,D=0,L=f,N=P-R&32767;if(A>2&&E==_(h-N))for(var q=Math.min(v,A)-1,j=Math.min(32767,h),B=Math.min(258,A);j>=N&&--L&&P!=R;){if(t[h+O]==t[h+O-N]){for(var H=0;B>H&&t[h+H]==t[h+H-N];++H);if(H>O){if(O=H,D=N,H>q)break;var z=Math.min(N,H-2),U=0;for(F=0;z>F;++F){var W=h-N+F+32768&32767,V=W-g[W]+32768&32767;V>U&&(U=V,R=W)}}}N+=(P=R)-(R=g[P])+32768&32767}if(D){w[T++]=268435456|Ko[O]<<18|Xo[D];var G=31&Ko[O],Z=31&Xo[D];C+=Vo[G]+Go[Z],++k[257+G],++S[Z],I=h+O,++x}else w[T++]=t[h],++k[t[h]]}}u=ga(t,l,r,w,k,S,C,T,M,h-M,u),r||(u=pa(l,u,ya))}return la(a,0,n+aa(u)+s)}(s,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+r.mem,o,a,!l)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&_a(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var n=0;i.length>=n;++n)t[n+10]=i.charCodeAt(n)}}(u,e),_a(u,h-8,i.d()),_a(u,h-4,n),u}function ka(t,e){var i=t.length;if(!e&&"undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var n=new zo(t.length+(t.length>>>1)),s=0,r=function(t){n[s++]=t},o=0;i>o;++o){if(s+5>n.length){var a=new zo(s+8+(i-o<<1));a.set(n),n=a}var l=t.charCodeAt(o);128>l||e?r(l):2048>l?(r(192|l>>>6),r(128|63&l)):l>55295&&57344>l?(r(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),r(128|l>>>12&63),r(128|l>>>6&63),r(128|63&l)):(r(224|l>>>12),r(128|l>>>6&63),r(128|63&l))}return la(n,0,s)}function Sa(t,e){var i="";if(!e&&"undefined"!=typeof TextDecoder)return(new TextDecoder).decode(t);for(var n=0;t.length>n;){var s=t[n++];128>s||e?i+=String.fromCharCode(s):224>s?i+=String.fromCharCode((31&s)<<6|63&t[n++]):240>s?i+=String.fromCharCode((15&s)<<12|(63&t[n++])<<6|63&t[n++]):(s=((15&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536,i+=String.fromCharCode(55296|s>>10,56320|1023&s))}return i}var xa=class{constructor(t,e={}){var i,n,s,r;this._rrweb=t,this.it=e,this.rt={},this.ot=Date.now(),this.st=-1/0,this.ut=()=>{const t=Date.now(),e=t-this.ot;e>0?(this.ct=Math.min(this.dt,this.ct+e/1e3*this.ht),this.ot=t):this.ot=t},this.ft=t=>{if(!this.rt[t]){var e,i;this.rt[t]=!0;const n=this.vt(t);null===(e=(i=this.it).onBlockedNode)||void 0===e||e.call(i,t,n)}},this.yt=t=>{const e=this.vt(t);if("svg"!==(null==e?void 0:e.nodeName)&&e instanceof Element){const t=e.closest("svg");if(t)return[this._rrweb.mirror.getId(t),t]}return[t,e]},this.vt=t=>this._rrweb.mirror.getNode(t),this.bt=t=>{var e,i,n,s,r,o,a,l;return(null!==(e=null===(i=t.removes)||void 0===i?void 0:i.length)&&void 0!==e?e:0)+(null!==(n=null===(s=t.attributes)||void 0===s?void 0:s.length)&&void 0!==n?n:0)+(null!==(r=null===(o=t.texts)||void 0===o?void 0:o.length)&&void 0!==r?r:0)+(null!==(a=null===(l=t.adds)||void 0===l?void 0:l.length)&&void 0!==a?a:0)},this.throttleMutations=t=>{if(3!==t.type||0!==t.data.source)return t;const e=t.data,i=this.bt(e);if(e.attributes){const t=e.attributes.length;e.attributes=e.attributes.filter(t=>{const[e]=this.yt(t.id);return!this.wt.consumeRateLimit(e)&&t});const i=t-e.attributes.length;var n,s;i>0&&(null===(n=(s=this.it).onDroppedAttributeMutations)||void 0===n||n.call(s,i))}const r=this.bt(e);if(0===r&&i!==r)return;if(this.kt)return t;this.ut();const o=Bo(t);var a,l;return o>this.ct?(null===(a=(l=this.it).onDroppedOversizedMutation)||void 0===a||a.call(l,o),void this._t()):(this.ct-=o,t)},this._t=()=>{if(this.St)return;const t=Math.max(0,this.xt-(Date.now()-this.st));this.St=setTimeout(()=>{var t,e;this.St=void 0,this.st=Date.now(),null===(t=(e=this.it).requestFullSnapshot)||void 0===t||t.call(e)},t)},this.wt=new Je({bucketSize:null!==(i=this.it.bucketSize)&&void 0!==i?i:100,refillRate:null!==(n=this.it.refillRate)&&void 0!==n?n:10,refillInterval:1e3,I:this.ft,$:Gs}),this.dt=null!==(s=this.it.bytesBucketSize)&&void 0!==s?s:0,this.ht=null!==(r=this.it.bytesRefillRate)&&void 0!==r?r:25600,this.kt=!Number.isFinite(this.dt)||0>=this.dt,this.ct=this.dt;const o=this.it.resyncIntervalMs;this.xt=Ae(o)&&Number.isFinite(o)&&o>0?o:3e5}reset(){this.rt={},this.St&&(clearTimeout(this.St),this.St=void 0),this.st=Date.now()}stop(){this.wt.stop(),this.reset(),this.ct=this.dt,this.ot=Date.now(),this.st=-1/0}};const Ca=t=>{if(n){try{const e=t+"=",i=n.cookie.split(";").filter(t=>t.length);for(let t=0;i.length>t;t++){let n=i[t];for(;" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Ae(t)&&isFinite(t)&&Math.floor(t)===t});var $a=class t{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,i,n,s){if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(n)||!Number.isInteger(s)||0>e||0>i||0>n||0>s||e>0xffffffffffff||i>4095||n>1073741823||s>4294967295)throw new RangeError("invalid field value");const r=new Uint8Array(16);return r[0]=e/Math.pow(2,40),r[1]=e/Math.pow(2,32),r[2]=e/Math.pow(2,24),r[3]=e/Math.pow(2,16),r[4]=e/256,r[5]=e,r[6]=112|i>>>8,r[7]=i,r[8]=128|n>>>24,r[9]=n>>>16,r[10]=n>>>8,r[11]=n,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new t(r)}toString(){let t="";for(let e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(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 e=0;16>e;e++){const i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}},Ta=class{generate(){const t=this.generateOrAbort();if(!Ie(t))return t;{this.Ct=0;const t=this.generateOrAbort();if(Ie(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const t=(()=>{const t=Date.now();return Ae(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(t>this.Ct)this.Ct=t,this.Mt();else{if(this.Ct>=t+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return $a.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new Ma}};let Ia=t=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!Ie(t.crypto)&&crypto.getRandomValues&&(Ia=t=>crypto.getRandomValues(t));var Ma=class{nextUint32(){return this.Rt.length>this.$t||(Ia(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let Ea;const Pa=()=>Ra().toString(),Ra=()=>(Ea||(Ea=new Ta)).generate();let Aa="";const Fa=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Oa=null;const Da={Et(){if(!Pe(Oa))return Oa;if(Oa=!1,n)try{const t=`__ph_cookie_support_${Pa()}`;Da.At(t,"xyz"),Oa='"xyz"'===Ca(t),Da.Lt(t)}catch(t){Oa=!1}return Oa},Pt(t){Gs.error("cookieStore error: "+t)},Ot:Ca,Dt(t){let e;try{e=JSON.parse(Da.Ot(t))||{}}catch(t){}return e},At(t,e,i,s,r){if(!n)return!1;try{let o="",a="";const l=function(t,e){if(e){let e=function(t,e=n){if(Aa)return Aa;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";const i=t.split(".");let s=Math.min(i.length,8);const r="dmn_chk_"+Pa();for(;!Aa&&s--;){const t=i.slice(s).join("."),n=r+"=1;domain=."+t+";path=/";e.cookie=n+";max-age=3",e.cookie.includes(r)&&(e.cookie=n+";max-age=0",Aa=t)}return Aa}(t);if(!e){const i=(t=>{const e=t.match(Fa);return e?e[0]:""})(t);i!==e&&Gs.info("Warning: cookie subdomain discovery mismatch",i,e),e=i}return e?"; domain=."+e:""}return""}(n.location.hostname,s);if(i){const t=new Date;t.setTime(t.getTime()+864e5*i),o="; expires="+t.toUTCString()}r&&(a="; secure");const u=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&Gs.warn("cookieStore warning: large cookie, len="+u.length),n.cookie=u,!0}catch(t){return!1}},Lt(t,e){if((null==n?void 0:n.cookie)&&(!e||!Pe(Ca(t))))try{Da.At(t,"",-1,e)}catch(t){return}}};let La=null;const Na={Et(){if(!Pe(La))return La;let e=!0;if(Ie(t))e=!1;else try{const t="__mplssupport__";Na.At(t,"xyz"),'"xyz"'!==Na.Ot(t)&&(e=!1),Na.Lt(t)}catch(t){e=!1}return e||Gs.error("localStorage unsupported; falling back to cookie store"),La=e,e},Pt(t){Gs.error("localStorage error: "+t)},Ot(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Na.Pt(t)}return null},Dt(t){try{return JSON.parse(Na.Ot(t))||{}}catch(t){}return null},At(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Na.Pt(t)}return!1},Lt(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Na.Pt(t)}}},qa=[at,Y,X,et,it,nt,Ct,xt,kt],ja=[p,f,H,z,Rt,Pt,_,$t],Ba=t=>t+"_cpm",Ha=["__proto__","constructor","prototype"],za=t=>{if(!$e(t))return{};const e={};return Object.keys(t).forEach(i=>{-1===Ha.indexOf(i)&&(e[i]=t[i])}),e},Ua=(t,e=[])=>{const i={};return[...ja,...e].forEach(e=>{const n=t[e];Ie(n)||Pe(n)||""===n||(i[e]=n)}),i},Wa=t=>{let e=5381,i=2166136261;for(let n=0;t.length>n;n++){const s=t.charCodeAt(n);e=33*e^s,i=Math.imul(i^s,16777619)}return t.length.toString(36)+"."+(e>>>0).toString(36)+"."+(i>>>0).toString(36)},Va=(t,e)=>({p:e,f:Wa(JSON.stringify(t))}),Ga=(t,e)=>{if(!e)return{properties:[],isValid:!1};try{const i=Da.Dt(Ba(t)),n=(null==i?void 0:i.f)===Wa(e)&&xe(i.p);return{properties:n?i.p:[],isValid:n}}catch(t){return{properties:[],isValid:!1}}},Za=(t,e)=>e+"|"+(Da.Ot(Ba(t))||""),Qa={},Ja={Et:()=>!0,Pt(t){Gs.error("memoryStorage error: "+t)},Ot:t=>t in Qa?Qa[t]:null,Dt:t=>t in Qa?Qa[t]:null,At:(t,e)=>(Qa[t]=e,!0),Lt(t){delete Qa[t]}};let Ka=null;const Xa={Et(){if(!Pe(Ka))return Ka;if(Ka=!0,Ie(t))Ka=!1;else try{const t="__support__";Xa.At(t,"xyz"),'"xyz"'!==Xa.Ot(t)&&(Ka=!1),Xa.Lt(t)}catch(t){Ka=!1}return Ka},Pt(t){Gs.error("sessionStorage error: ",t)},Ot(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Xa.Pt(t)}return null},Dt(t){try{return JSON.parse(Xa.Ot(t))||null}catch(t){}return null},At(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Xa.Pt(t)}return!1},Lt(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Xa.Pt(t)}}};Ws.DEBUG=!1,Ws.LIB_VERSION="1.434.13",Ws.LIB_NAME="web";var Ya=Ws,tl=class{constructor(t){if(!t.persistence)throw new Error("it is not valid to not have persistence and be this far into setting up the application");this.Ft=t.get_property.bind(t),this.Nt=t.persistence.set_property.bind(t.persistence)}trackSize(t,e){this.Nt(K,{sessionId:t,size:this.currentTrackedSize(t)+e})}currentTrackedSize(t){const e=this.Ft(K);return $e(i=e)&&Me(i.sessionId)&&Ae(i.size)&&e.sessionId===t?e.size:0;var i}};function el(t,e){return function(t){let e=0;for(let i=0;t.length>i;i++)e=(e<<5)-e+t.charCodeAt(i),e|=0;return Math.abs(e)}(t)%100<Qe(100*e,0,100,Gs)}function il(t){return`$survey_response_${t}`}function nl(t,e){if(!e)return null;const i=t[il(e)];return xe(i)?[...i]:i}function sl({event:t,survey:e,responses:i={},submissionId:n,completed:s,surveyLanguage:r,questionSnapshots:o}){return he(he(he(he({},!Ie(n)&&{$survey_submission_id:n}),"sent"===t?!Ie(s)&&{$survey_completed:s}:{$survey_partially_completed:rl(i)}),r&&{$survey_language:r}),function(t={},e,i){const n={};return e.questions.forEach(e=>{if(Ie(e.originalQuestionIndex))return;const i=0===(s=e.originalQuestionIndex)?"$survey_response":`$survey_response_${s}`;var s;const r=nl(t,e.id);Ie(r)||(n[i]=r)}),he(he({$survey_questions:e.questions.map(e=>{var n,s;return{id:e.id,question:null!==(n=null==i?void 0:i[null!==(s=e.id)&&void 0!==s?s:""])&&void 0!==n?n:e.question,response:nl(t,e.id)}})},t),n)}(i,e,o))}function rl(t={}){return Object.values(t).some(t=>!Re(t))}function ol(t,e){let i=`$survey_${e}/${t.id}`;return t.current_iteration&&t.current_iteration>0&&(i=`$survey_${e}/${t.id}/${t.current_iteration}`),i}function al(t){return"string"==typeof t&&t.trim()?t.trim():null}function ll(t){return t.toLowerCase()}function ul(t,e,i){if(!t||!e)return null;const n=ll(e),s=Object.keys(t).find(t=>ll(t)===n);if(s)return null==i||i.debug(`Found exact translation match: ${s}`),s;if(n.includes("-")){const s=n.split("-")[0],r=Object.keys(t).find(t=>ll(t)===s);if(r)return null==i||i.debug(`Found base language translation match: ${r} (from ${e})`),r}return null}const hl=["thankYouMessageHeader","thankYouMessageDescription","thankYouMessageCloseButtonText","introScreenHeader","introScreenDescription","introScreenButtonText","submitButtonText","backButtonText"];function cl(t,e,i){var n;const s=ul(t.translations,e,i),r=he({},t);let o=!1;if(s){var a;const e=null===(a=t.translations)||void 0===a?void 0:a[s];if(e)if(null==i||i.info(`Applying survey-level translation for language: ${s}`),Ie(e.name)||(r.name=e.name,o=!0),r.appearance){const t=he({},r.appearance);for(const i of hl){const n=e[i];Ie(n)||(t[i]=n,o=!0)}r.appearance=t}else(function(t){return hl.some(e=>!Ie(t[e]))})(e)&&(o=!0)}const l=t.questions.map(t=>function(t,e,i){var n;const s=ul(t.translations,e,i);if(!s)return{question:t,matchedKey:null,hasChanges:!1};const r=null===(n=t.translations)||void 0===n?void 0:n[s];if(!r)return{question:t,matchedKey:null,hasChanges:!1};const o=he({},t);let a=!1;return Ie(r.question)||(o.question=r.question,a=!0),Ie(r.description)||(o.description=r.description,a=!0),Ie(r.buttonText)||(o.buttonText=r.buttonText,a=!0),"link"in o&&!Ie(r.link)&&(o.link=r.link,a=!0),"lowerBoundLabel"in o&&!Ie(r.lowerBoundLabel)&&(o.lowerBoundLabel=r.lowerBoundLabel,a=!0),"upperBoundLabel"in o&&!Ie(r.upperBoundLabel)&&(o.upperBoundLabel=r.upperBoundLabel,a=!0),"choices"in o&&function(t){return xe(t.choices)}(r)&&(o.choices=r.choices,a=!0),{question:a?o:t,matchedKey:a?s:null,hasChanges:a}}(t,e,i)),u=l.map(t=>t.question),h=l.some(t=>t.hasChanges);let c=null;return s||(c=(null===(n=l.find(t=>t.matchedKey))||void 0===n?void 0:n.matchedKey)||null),h&&(r.questions=u,o=!0,null==i||i.info(`Applied question-level translations for language: ${e}`)),{survey:r,matchedKey:o?s||c:null}}function dl(t){var e;return!!(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)}function vl(t){var e;return dl(t)&&!!(null===(e=t.conditions)||void 0===e||null===(e=e.events)||void 0===e?void 0:e.repeatedActivation)||"always"===t.schedule}const fl=(t,e)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}},pl=t=>t.toLowerCase(),gl={exact:(t,e)=>e.some(e=>t.some(t=>e===t)),is_not:(t,e)=>e.every(e=>t.every(t=>e!==t)),regex:(t,e)=>e.some(e=>t.some(t=>fl(e,t))),not_regex:(t,e)=>e.every(e=>t.every(t=>!fl(e,t))),icontains:(t,e)=>e.map(pl).some(e=>t.map(pl).some(t=>e.includes(t))),not_icontains:(t,e)=>e.map(pl).every(e=>t.map(pl).every(t=>!e.includes(t))),gt:(t,e)=>e.some(e=>{const i=parseFloat(e);return!isNaN(i)&&t.some(t=>i>parseFloat(t))}),lt:(t,e)=>e.some(e=>{const i=parseFloat(e);return!isNaN(i)&&t.some(t=>i<parseFloat(t))})};function ml(t,e){return!t||Object.entries(t).every(([t,i])=>{const n=null==e?void 0:e[t];if(null==n)return!1;const s=gl[i.operator];return!!s&&s(i.values.map(String),[String(n)])})}const yl=t=>{const e=[...t];for(let t=e.length-1;t>0;t--){const i=Math.floor(Math.random()*(t+1));[e[t],e[i]]=[e[i],e[t]]}return e};function bl(t,e,i){return ar({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}const _l=new Set(["is_not","not_icontains","not_regex"]);function wl(t,e,i){return!t||0===t.length||t.every(t=>{const n="person"===t.type?i:e,s=null==n?void 0:n[t.key],r=t.operator||"exact";if(Ie(s)||Pe(s))return _l.has(r);const o=gl[r];return!!o&&!Ie(t.value)&&!Pe(t.value)&&o(xe(t.value)?t.value.map(String):[String(t.value)],xe(s)?s.map(String):[String(s)])})}const kl=Zs("[SessionRecording]");function Sl(t,e){return e?t:"!"+t}function xl(t,e){return t===e||t!=="!"+e&&null}var Cl=class{constructor(t,e,i,n,s,r,o){this._instance=t,this.Y=e,this.tt=i,this.et=n,this.qt=s,this.jt=r,this.Bt=o,this.Ht=null,this.zt=No}onRemoteConfig(t){this.Ht=Ae(t.sampleRate)?t.sampleRate:null,"any"===t.triggerMatchType?(this.Ut=new Mo([this.tt,this.Y]),this.zt=Lo):(this.Ut=new Eo([this.tt,this.Y]),this.zt=No),this._instance.register_for_session({[zt]:t.triggerMatchType}),this.Y.onConfig(t),this.tt.onConfig(t),this.et.onConfig(t,(t,e)=>{this.qt("linked_flag_matched",{flag:t,variant:e}),this.Bt()})}getStatus(t){return this.zt({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId})}getMinimumDuration(t){const e=this._instance.get_property("$session_recording_remote_config"),i=null==e?void 0:e.minimumDurationMilliseconds;return Ae(i)?i:null}checkUrlTriggers(t,e,i,n){this.Y.checkUrlTriggerConditions(e,i,n,t)}setupEventTriggerListeners(t,e,i){if(0!==this.tt.K.length&&Re(this.Wt))return this.Wt=t(t=>{try{this.tt.checkEventTriggerConditions(t.event,i,e)}catch(t){kl.error("Could not activate event trigger",t)}}),this.Wt}makeSamplingDecisions(t){var e;const i=this.Ht;var n,s;if(!Ae(i))return null===(n=this._instance.persistence)||void 0===n||n.unregister("$session_is_sampled"),void(null===(s=this._instance.persistence)||void 0===s||s.unregister("$replay_sample_rate"));const r=this._instance.get_property(z),o=this._instance.get_property(L),a=xl(r,t),l=Ae(o)&&o!==i,u=Ie(o)&&r===t,h=l||u||!Oe(a),c=h?el(t,i):a;h&&(c?this.qt("sampled"):kl.warn(`Sample rate (${i}) has determined that this sessionId (${t}) will not be sent to the server.`)),null===(e=this._instance.persistence)||void 0===e||e.register({$session_is_sampled:Sl(t,c),$replay_sample_rate:Pe(o)&&r===t?null:i})}ensureSamplingDecision(t){if(!Ae(this.Ht))return;const e=this._instance.get_property(z);Oe(xl(e,t))||this.makeSamplingDecisions(t)}onFlushComplete(){}clearConditionalRecordingPersistence(){var t,e,i,n,s;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_recording_event_trigger_activated_session"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$session_recording_url_trigger_activated_session"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_is_sampled"),null===(n=this._instance.persistence)||void 0===n||n.unregister("$replay_sample_rate"),null===(s=this._instance.persistence)||void 0===s||s.unregister("$session_past_minimum_duration")}updateActiveTriggers(t){}hasPendingTriggers(t){var e;return(null===(e=this.Ut)||void 0===e?void 0:e.triggerStatus(t))===So}getPendingTriggerConditions(t){return[{label:"URL condition not matched",status:this.Y.triggerStatusNoSideEffects(t)},{label:"event condition not matched",status:this.tt.triggerStatusNoSideEffects(t)},{label:"linked flag condition not matched",status:this.et.triggerStatusNoSideEffects()}].filter(({status:t})=>t===So).map(({label:t})=>t)}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.tt.stop(),this.Y.stop(),this.et.stop()}},$l=class{constructor(t,e,i,n,s){this._instance=t,this.Y=e,this.qt=i,this.Vt=n,this.Bt=s,this.Zt=[],this.Gt=new Map,this.Qt=!1}onRemoteConfig(t){t.triggerGroups&&0!==t.triggerGroups.length?(this.Jt(t.triggerGroups),this._instance.register_for_session({[zt]:"v2_trigger_groups",[Ut]:t.triggerGroups.length}),this.Y.onConfig(t)):kl.warn("[V2Strategy] No trigger groups configured")}getStatus(t){return function(t){if(t.rrwebError)return wo;if(!t.receivedFlags)return yo;if(!t.isRecordingEnabled)return po;if(t.urlTriggerMatching.urlBlocked)return bo;const e=t.triggerGroupMatchers,i=t.triggerGroupSamplingResults;if(0===e.length)return po;let n=!1,s=!1;for(const r of e){const e=r.triggerStatus(t.sessionId);if("trigger_activated"===e){const t=r.group.id,e=i.get(t);Ie(e)?Gs.warn("[V2 Triggers] Group activated but no sampling decision found",{groupId:t}):!0===e&&(s=!0)}else"trigger_pending"===e&&(n=!0)}return s?go:n?yo:po}({receivedFlags:!0,isRecordingEnabled:!0,isSampled:t.isSampled,rrwebError:t.rrwebError,urlTriggerMatching:t.urlTriggerMatching,eventTriggerMatching:t.eventTriggerMatching,linkedFlagMatching:t.linkedFlagMatching,sessionId:t.sessionId,triggerGroupMatchers:this.Zt,triggerGroupSamplingResults:this.Gt,minimumDuration:this.getMinimumDuration(t.sessionId)})}getMinimumDuration(t){let e=null;for(const i of this.Zt)if("trigger_activated"===i.triggerStatus(t)){const t=i.group.minDurationMs;Ae(t)&&(Pe(e)||e>t)&&(e=t)}return e}checkUrlTriggers(t,e,i,n){this.Y.checkUrlBlocklist(e,i);for(const n of this.Zt)n.checkUrlTriggerConditions(e,i,e=>{this.Kt(n,void 0)&&(n.activateTrigger(e,t),this.updateActiveTriggers(t),this.Bt(e))},t)}setupEventTriggerListeners(t,e,i){return this.Wt=t(t=>{var i;if(this.Qt)return kl.info("[SessionRecorder] Stopping trigger checks - initial buffer flushed"),null===(i=this.Wt)||void 0===i||i.call(this),void(this.Wt=void 0);try{for(const i of this.Zt)i.checkEventTriggerConditions(t.event,n=>{if(!this.Kt(i,t.properties))return;const s=(i.group.conditions.events||[]).filter(e=>e.name===t.event),r=this._instance.get_property(at);s.some(e=>!e.properties||0===e.properties.length||wl(e.properties,t.properties,r))&&(i.activateTrigger(n,e),this.updateActiveTriggers(e),this.Bt(n))},e)}catch(t){kl.error("Could not activate event trigger for trigger groups",t)}}),this.Wt}makeSamplingDecisions(t){for(const i of this.Zt){var e;const n=i.group,s=n.id,r=n.sampleRate,o=Q+s,a=this._instance.get_property(o);let l=null,u=!1,h=!1,c=!1;if($e(a)){const e=a.sessionId,i=a.sampleRate,n=a.sampled;u="string"==typeof e&&e!==t,h=Ae(i)&&i!==r,l=e===t&&Ae(i)&&i===r&&Oe(n)?n:null}else l=a===t||null,u="string"==typeof a&&a!==t,c=a===t;const d=u||h||c||!Oe(l),v=d?el(t+s,r):l;d&&this.Vt("triggerGroupSamplingDecisionMade",{group_id:s,group_name:n.name,sampleRate:r,isSampled:v}),this.Gt.set(s,v),null===(e=this._instance.persistence)||void 0===e||e.register({[o]:{sessionId:t,sampleRate:r,sampled:v}})}this.updateActiveTriggers(t)}ensureSamplingDecision(t){}onFlushComplete(){this.Qt=!0}clearConditionalRecordingPersistence(){var t,e,i;null===(t=this._instance.persistence)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this._instance.persistence)||void 0===e||e.unregister("$replay_sample_rate"),null===(i=this._instance.persistence)||void 0===i||i.unregister("$session_past_minimum_duration");for(const t of this.Zt){var n,s,r;const e=t.group.id;null===(n=this._instance.persistence)||void 0===n||n.unregister("$posthog_sr_group_event_trigger_"+e),null===(s=this._instance.persistence)||void 0===s||s.unregister("$posthog_sr_group_url_trigger_"+e),null===(r=this._instance.persistence)||void 0===r||r.unregister("$posthog_sr_group_sampling_"+e)}}updateActiveTriggers(t){const e=[];for(const i of this.Zt){const n=i.group,s=n.id,r="trigger_activated"===i.triggerStatus(t),o=!0===this.Gt.get(s);r&&e.push({id:s,name:n.name,matched:!0,sampled:o})}this._instance.register_for_session({[Bt]:e})}hasPendingTriggers(t){for(const e of this.Zt)if("trigger_pending"===e.triggerStatus(t))return!0;return!1}getPendingTriggerConditions(t){return this.Zt.flatMap(e=>"trigger_pending"!==e.triggerStatusNoSideEffects(t)?[]:e.getPendingTriggerConditions(t).map(t=>`trigger group "${e.group.name}": ${t}`))}stop(){var t;null===(t=this.Wt)||void 0===t||t.call(this),this.Wt=void 0,this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear(),this.Y.stop()}Kt(t,e){const i=t.group.conditions.properties;return!i||0===i.length||wl(i,e,this._instance.get_property(at))}Jt(t){this.Zt.forEach(t=>t.stop()),this.Zt=[],this.Gt.clear();for(const e of t){const t=new Do(this._instance,e,(t,i)=>{this.qt("linked_flag_matched",{flag:t,variant:i,group_id:e.id,group_name:e.name}),this.Bt()});this.Zt.push(t)}}};const Tl=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Il=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Tl],Ml="<masked>",El=["li_fat_id"];function Pl(t,e,i){if(!n)return{};const s=e?[...Tl,...i||[]]:[],r=Rl(cr(n.URL,s,Ml),t),o=function(){const t={};return Js(El,function(e){const i=Ca(e);t[e]=i||null}),t}();return Ks(o,r)}function Rl(t,e){const i=Il.concat(e||[]),n={};return Js(i,function(e){const i=hr(t,e);n[e]=i||null}),n}function Al(t){const e=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),i="yahoo"!=e?"q":"p",s={};if(!Pe(e)){s.$search_engine=e;const t=n?hr(n.referrer,i):"";t.length&&(s.ph_keyword=t)}return s}function Fl(){return navigator.language||navigator.userLanguage}function Ol(){const t=Fl();return"string"==typeof t?t.split("-")[0]:void 0}const Dl="$direct";function Ll(){return(null==n?void 0:n.referrer)||Dl}function Nl(t,e,i=!1){const n=t?[...Tl,...e||[]]:[],r=i?hn(null==s?void 0:s.href):null==s?void 0:s.href,o=null==r?void 0:r.substring(0,1e3);return{r:Ll().substring(0,1e3),u:o?cr(o,n,Ml):void 0}}function ql(t,e=!1){var i;const{r:n,u:s}=t,r=e?hn(s):s,o={$referrer:n,$referring_domain:null==n?void 0:n==Dl?Dl:null===(i=lr(n))||void 0===i?void 0:i.host};if(r){o.$current_url=r;const t=lr(r);o.$host=null==t?void 0:t.host,o.$pathname=null==t?void 0:t.pathname;const e=Rl(r);Ks(o,e)}if(n){const t=Al(n);Ks(o,t)}return o}function jl(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Bl(){try{return(new Date).getTimezoneOffset()}catch(t){return}}const Hl=1e5,zl=/^[A-Za-z0-9]*[A-Za-z][A-Za-z0-9]*$/,Ul=[],Wl=()=>!1,Vl="@type @id actionStatus availability bestRating contentRating encodingFormat eventAttendanceMode eventStatus highPrice inLanguage isAccessibleForFree isFamilyFriendly itemCondition itemListOrder lowPrice maximumAttendeeCapacity nonprofitStatus numberOfItems offerCount position price priceCurrency priceValidUntil publicAccess ratingCount ratingValue reviewCount smokingAllowed worstRating".split(" "),Gl="Action BorrowAction ReadAction SearchAction SeekToAction SolveMathAction WatchAction".split(" "),Zl="AutoDealer Bakery BarOrPub CafeOrCoffeeShop CollegeOrUniversity Corporation DaySpa Dentist EducationalOrganization Electrician FoodEstablishment GovernmentOrganization HealthClub Hotel LegalService Library LibrarySystem LocalBusiness Locksmith LodgingBusiness MedicalBusiness NGO OnlineStore Organization PerformingGroup Pharmacy Physician Plumber RealEstateAgent Restaurant School SportsOrganization Store".split(" "),Ql="Accommodation AdministrativeArea Country Place State".split(" "),Jl={AggregateOffer:{offers:["Offer"]},Brand:{name:!0},BreadcrumbList:{itemListElement:["ListItem"]},CreativeWork:{genre:!0,dateCreated:!0,dateModified:!0,datePublished:!0,expires:!0,learningResourceType:!0,educationalLevel:!0,educationalUse:!0,interactivityType:!0,aggregateRating:["AggregateRating"],potentialAction:Gl,publisher:Zl},Event:{startDate:!0,endDate:!0,previousStartDate:!0,aggregateRating:["AggregateRating"],offers:["AggregateOffer","Offer"]},ItemList:{itemListElement:["ListItem"]},ListItem:{item:Ul},Offer:{seller:Zl},Organization:{name:!0,legalName:!0,foundingDate:!0,dissolutionDate:!0,aggregateRating:["AggregateRating"],brand:["Brand"]},Place:{aggregateRating:["AggregateRating"]},Product:{name:!0,sku:!0,mpn:!0,gtin:!0,gtin8:!0,gtin12:!0,gtin13:!0,gtin14:!0,productID:!0,productGroupID:!0,asin:!0,model:!0,category:!0,color:!0,material:!0,pattern:!0,size:!0,productionDate:!0,releaseDate:!0,brand:["Brand","Organization"],manufacturer:Zl,offers:["Offer","AggregateOffer"],aggregateRating:["AggregateRating"]},Service:{name:!0,serviceType:!0,category:!0,provider:Zl,areaServed:Ql,offers:["AggregateOffer","Offer"],aggregateRating:["AggregateRating"]},OfferCatalog:{name:!0,itemListElement:Ul}},Kl=[["3DModel AboutPage Answer Article AudioObject Blog BlogPosting Book Clip CollectionPage Comment ContactPage Course CreativeWorkSeason CreativeWorkSeries DataCatalog DataDownload DataFeed Dataset DiscussionForumPosting Episode FAQPage Game HowTo HowToDirection HowToSection HowToStep HowToTip ImageObject LearningResource MediaObject Message MobileApplication Movie MusicPlaylist MusicRecording NewsArticle Photograph PodcastEpisode PodcastSeries ProfilePage QAPage Question Quiz Recipe Review ScholarlyArticle SearchResultsPage SiteNavigationElement SocialMediaPosting SoftwareApplication TVEpisode TVSeries TechArticle VacationRental VideoGame VideoObject WebApplication WebPage WebPageElement WebSite".split(" "),Jl.CreativeWork],["BroadcastEvent BusinessEvent EducationEvent Festival MusicEvent SportsEvent TheaterEvent".split(" "),Jl.Event],[Zl,Jl.Organization],[Ql,Jl.Place],["Car IndividualProduct ProductGroup ProductModel".split(" "),Jl.Product]];function Xl(t,e){return ke.call(t,e)?t[e]:void 0}function Yl(t){const e=typeof t;return Pe(t)||"string"===e||"number"===e||"boolean"===e}function tu(t,e){return e&&function(t){return Me(t)&&/^(https?:\/\/|\/|\.\.?\/)/i.test(t.trim())}(t)?e(t.trim())||void 0:t}function eu(t,e){return xe(t)&&t.every(Yl)?t.map(t=>tu(t,e)).filter(t=>!Ie(t)):Yl(t)?tu(t,e):void 0}function iu(t,e){if("string"!=typeof t)return;const i=t.trim(),n=i.indexOf("#"),s=0>n?i:i.slice(n+1);if(!(!s||0>n&&(/^[a-z][a-z\d+.-]*:/i.test(i)||i.includes("/")||i.includes("?"))))try{return e(s)?s:void 0}catch(t){return}}function nu(t){if(ke.call(Jl,t))return Jl[t];for(const[e,i]of Kl)if(e.includes(t))return i}function su(t,e,i){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:i,writable:!0})}function ru(t,e,i,n){if(xe(t)){const s=t.map(t=>ru(t,e,i,n)).filter(t=>!Ie(t));return s.length?s:void 0}return ou(t,e,i,n)||void 0}function ou(t,e,i,n){if(!$e(t)||!function(t){return t.remainingNodes?(t.remainingNodes--,!0):(t.exceeded=!0,!1)}(i))return null;const s=Xl(t,"@type"),r=function(t){const e=new Set,i="string"==typeof t?[t]:xe(t)?t:[],n=[];for(const t of i){if("string"!=typeof t)continue;const i=t.replace(/^https?:\/\/schema\.org\//,"");if(100>=i.length&&zl.test(i)&&!e.has(i)&&(e.add(i),n.push(i),20===n.length))break}return n}(s),o=r.filter(t=>!!nu(t)&&(!n||!n.length||n.includes(t))),a={};for(const n of Vl){const o="@type"===n?r.length?"string"==typeof s?r[0]:r:void 0:"@id"===n?iu(Xl(t,n),e):eu(Xl(t,n),i.maskUrl);Ie(o)||su(a,n,o)}for(const n of o){const s=nu(n);for(const n of Object.keys(s)){const r=Xl(t,n),o=s[n];if(!0===o){const t=eu(r,i.maskUrl);Ie(t)||su(a,n,t)}else{const t=ru(r,e,i,o);Ie(t)||su(a,n,t)}}}const l=ru(Xl(t,"@graph"),e,i);return Ie(l)||su(a,"@graph",l),Object.keys(a).length?a:null}function au(t,e,i){if(!$e(t))return null;const n=Xl(t,"@context");if("string"!=typeof n||!/^https?:\/\/schema\.org\/?$/.test(n))return null;const s=ou(t,e,i);return s?he({"@context":"https://schema.org"},s):null}function lu(t){var e;return"SCRIPT"===t.nodeName&&"application/ld+json"===(null===(e=t.getAttribute("type"))||void 0===e?void 0:e.trim().toLowerCase())}function uu(t,e,i){if("string"==typeof e?t.classList.contains(e):e&&Array.from(t.classList).some(t=>(e.lastIndex=0,e.test(t))))return!0;try{return!!i&&t.matches(i)}catch(t){return!1}}function hu(t,e,i){for(let n=t;n;){if(uu(n,e,i))return!0;const t=n.parentNode;n=n.parentElement||(t&&t.nodeType===t.DOCUMENT_FRAGMENT_NODE?t.host:null)}return!1}function cu(t){return lu(t)?[t]:t.nodeType!==t.ELEMENT_NODE?[]:Array.from(t.querySelectorAll("script")).filter(lu)}function du(t){return Ie(t)?void 0:Math.round(t)}function vu(t){return $e(t)?t.network_timing:t}const fu=Zs("[SessionRecording]"),pu=[1,2,3,4,5,6,7,12],gu=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function mu(){var t;return null==d||null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.rrweb}function yu(){var t;return null===(t=mu())||void 0===t?void 0:t.record}function bu(t){try{return JSON.stringify(t)}catch(e){if(e instanceof RangeError)throw e;return JSON.stringify(t,qo())}}function _u(t){return Sa(wa(ka(bu(t))),!0)}function wu(t){return ku.apply(this,arguments)}function ku(){return(ku=oe(function*(t){const e=yield ms(bu(t),Ya.DEBUG,{rethrow:!0});return Sa(new Uint8Array(yield e.arrayBuffer()),!0)})).apply(this,arguments)}let Su,xu;const Cu="undefined"!=typeof globalThis&&"CompressionStream"in globalThis&&"TextEncoder"in globalThis&&"Response"in globalThis&&"function"==typeof Response.prototype.blob;let $u=!1;function Tu(t){var e;return xe(t)&&0===t.length?(Su=null!==(e=Su)&&void 0!==e?e:_u([]),Su):_u(t)}function Iu(t){return Mu.apply(this,arguments)}function Mu(){return(Mu=oe(function*(t){var e;return xe(t)&&0===t.length?Su||(xu=null!==(e=xu)&&void 0!==e?e:wu([]).then(t=>(Su=t,t)).catch(t=>{throw Su=void 0,xu=void 0,t}),xu):wu(t)})).apply(this,arguments)}function Eu(t){return Cu&&!$u&&function(t){return 2===t.type||3===t.type&&(0===t.data.source||8===t.data.source)}(t)}function Pu(t){return{event:t,size:Bo(t)}}function Ru(t,e){return he(he({},t),{},{data:e,cv:"2024-10"})}function Au(t,e){return he(he({},t),{},{cv:"2024-10",data:he(he({},t.data),e)})}function Fu(t){try{if(2===t.type)return Pu(Ru(t,_u(t.data)));if(3===t.type&&0===t.data.source)return Pu(Au(t,{texts:Tu(t.data.texts),attributes:Tu(t.data.attributes),removes:Tu(t.data.removes),adds:Tu(t.data.adds)}));if(3===t.type&&8===t.data.source)return Pu(Au(t,{adds:t.data.adds?_u(t.data.adds):void 0,removes:t.data.removes?_u(t.data.removes):void 0}))}catch(t){fu.warn("could not compress event - will use uncompressed event",t)}return{event:t,size:jo(t)}}function Ou(){return Ou=oe(function*(t){try{if(2===t.type)return Pu(Ru(t,yield wu(t.data)));if(3===t.type&&0===t.data.source){const[e,i,n,s]=yield Promise.all([Iu(t.data.texts),Iu(t.data.attributes),Iu(t.data.removes),Iu(t.data.adds)]);return Pu(Au(t,{texts:e,attributes:i,removes:n,adds:s}))}if(3===t.type&&8===t.data.source){const[e,i]=yield Promise.all([t.data.adds?wu(t.data.adds):void 0,t.data.removes?wu(t.data.removes):void 0]);return Pu(Au(t,{adds:e,removes:i}))}}catch(e){return ds(e)&&($u=!0),fu.warn("could not compress event asynchronously - trying synchronous compression",e),Fu(t)}return{event:t,size:jo(t)}}),Ou.apply(this,arguments)}function Du(t,e){return 5===t.type&&t.data.tag===e}function Lu(t){return Du(t,"sessionIdle")}function Nu(t){return Du(t,"$session_ending")}function qu(t){return Du(t,"$session_starting")}var ju=class{get sessionId(){return this.Xt}get Yt(){if(!this._instance.sessionManager)throw new Error("[SessionRecording] must be started with a valid sessionManager.");return this._instance.sessionManager}get te(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get ee(){return xl(this._instance.get_property(z),this.sessionId)}get Ht(){var t;const e=null===(t=this.ne)||void 0===t?void 0:t.sampleRate;return Ae(e)?e:null}get ie(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getMinimumDuration(this.sessionId))&&void 0!==t?t:null}constructor(t,e){this._instance=t,this.oe="/s/",this._forceAllowLocalhostNetworkCapture=!1,this.se=void 0,this.ae=!1,this.le=Date.now(),this.ue=!1,this.ce=[],this.de="unknown",this.he=0,this.fe=0,this.ve=0,this.pe=0,this.me=0,this.ge=!1,this.ye=!1,this.be=!1,this.we=!1,this.ke=!1,this._e=!1,this.Se=!1,this.xe=!1,this.Ce=!1,this.Me=!1,this.Ie=!1,this.Te=!1,this.Re=[],this.$e=void 0,this.Ee=void 0,this.Ae=!1,this.Oe=[],this.Le=0,this.Pe=0,this.De=!1,this.Fe=void 0,this.Wt=void 0,this.Ne=void 0,this.qe=void 0,this.je=void 0,this.Be=(t,e,i)=>{var n,s,r,o;if(!i)return;if(t===this.Xt&&e===this.He)return;const a=!i.noSessionId&&(i.activityTimeout||i.sessionPastMaximumLength),l=this.Xt,u=this.He;var h;if(a&&this.Vt("$session_ending",{currentSessionId:l,currentWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le,flushed_size:null===(h=this.ze)||void 0===h?void 0:h.currentTrackedSize(l)}),null===(n=this._instance.persistence)||void 0===n||n.unregister("$debug_first_full_snapshot_timestamp"),this.Se=!1,null===(s=mu())||void 0===s||null===(r=s.resetMaxDepthState)||void 0===r||r.call(s),this.Vt("$session_id_change",{sessionId:t,windowId:e,changeReason:i}),this.Ue(),!(!1===this.de&&this.isStarted||this.Xt===t&&this.He===e)){const e=this.Xt!==t&&!1!==this.de;this.de="unknown",this.We(e)}a&&this.Vt("$session_starting",{previousSessionId:l,previousWindowId:u,nextSessionId:t,nextWindowId:e,changeReason:i,lastActivityTimestamp:this.le}),null===(o=this.re)||void 0===o||o.makeSamplingDecisions(t)},this.Ve=!1,this.Ze=()=>{var t;return(null===(t=this._instance.persistence)||void 0===t?void 0:t.props[U])===this.Xt},this.Ge=()=>{var t,e;if(0===this.Rt.data.length)return null;const i=null===(t=this.Rt.data[0])||void 0===t?void 0:t.timestamp,n=null===(e=this.Rt.data[this.Rt.data.length-1])||void 0===e?void 0:e.timestamp;return Ae(i)&&Ae(n)?n-i:null},this.Qe=()=>{var t,e;const i=this.ie;if(!Ae(i))return!1;if(null===(t=null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.strictMinimumDuration)||void 0===t||!t){const t=this.Je;return Ae(t)&&t>=0&&i>t}if(this.Ze())return!1;const n=this.Ge();return!!Pe(n)||i>n||(null===(s=this._instance.persistence)||void 0===s||s.register({$session_past_minimum_duration:this.Xt}),!1);var s},this.Ke=()=>{"buffering"!==this.status?(this.ge&&this.ye&&this.Xe&&!this.be&&this.Ye(void 0),this.tn(),this.en(!0)):this.nn()},this.rn=()=>{this.Ke()},this.sn=()=>{this.Vt("browser offline",{})},this.an=()=>{this.Vt("browser online",{})},this.ln=()=>{(null==n?void 0:n.visibilityState)&&("visible"===n.visibilityState&&(this.Xe=!0),this.Vt("window "+n.visibilityState,{}))},this.Xe=null==e||e;const{sessionId:i,windowId:s,sessionStartTimestamp:r}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=i,this.He=s,this._sessionStartTimestamp=r,this.et=new Fo(this._instance),this.Y=new Ao(this._instance),this.tt=new Oo(this._instance),this.Rt=this.nn(),this.un="ph_replay_pending_buffer_"+JSON.stringify([this._instance.config.persistence_name||this._instance.config.token,this._instance.config.token]),this.Yt.sessionTimeoutMs>this.te||fu.warn(`session_idle_threshold_ms (${this.te}) is greater than the session timeout (${this.Yt.sessionTimeoutMs}). Session will never be detected as idle`),this.ze=new tl(this._instance)}setDocumentWasEverVisible(t){t&&(this.Xe=!0)}get cn(){var t,e,i,n,s,r,o,a,l;const u=null===(t=this.ne)||void 0===t?void 0:t.masking,h={maskAllInputs:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.maskAllInputs,maskTextSelector:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.maskTextSelector,blockSelector:null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.blockSelector,maskAllElementAttributes:null===(s=this._instance.config.session_recording)||void 0===s?void 0:s.maskAllElementAttributes},c=null!==(r=null==h?void 0:h.maskAllInputs)&&void 0!==r?r:null==u?void 0:u.maskAllInputs,d=null!==(o=null==h?void 0:h.maskTextSelector)&&void 0!==o?o:null==u?void 0:u.maskTextSelector,v=null!==(a=null==h?void 0:h.blockSelector)&&void 0!==a?a:null==u?void 0:u.blockSelector,f=null!==(l=null==h?void 0:h.maskAllElementAttributes)&&void 0!==l?l:null==u?void 0:u.maskAllElementAttributes;return Ie(c)&&Ie(d)&&Ie(v)&&Ie(f)?void 0:{maskAllInputs:null==c||c,maskTextSelector:d,blockSelector:v,maskAllElementAttributes:f}}dn(){var t;if(this.Ce)return;const e=null===(t=this.ne)||void 0===t?void 0:t.masking;if(Re(e))return;const i=this._instance.config.session_recording,n=["maskAllInputs","maskTextSelector","blockSelector","maskAllElementAttributes"].filter(t=>{const n=null==i?void 0:i[t],s=e[t];return!Ie(n)&&n!==s});0!==n.length&&(this.Ce=!0,fu.warn('Session recording masking is configured both in `posthog.init` and in your project settings, and they differ. The `session_recording` options in `posthog.init` take precedence, so the project ("Privacy and masking") setting is ignored for: '+n.join(", ")+". Remove these masking options from `posthog.init` to use the project setting instead. See https://posthog.com/docs/session-replay/privacy",{client:{maskAllInputs:null==i?void 0:i.maskAllInputs,maskTextSelector:null==i?void 0:i.maskTextSelector,blockSelector:null==i?void 0:i.blockSelector,maskAllElementAttributes:null==i?void 0:i.maskAllElementAttributes},project:e}))}get hn(){var t;return Qe(null===(t=this._instance.config.session_recording.canvasCapture)||void 0===t?void 0:t.resolutionScale,.1,1,Zs("canvas recording resolution scale"),1)}get fn(){var t,e,i,n,s,r,o;const a=this._instance.config.session_recording.captureCanvas,l=null===(t=this.ne)||void 0===t?void 0:t.canvasRecording,u=null!==(e=null!==(i=null==a?void 0:a.recordCanvas)&&void 0!==i?i:null==l?void 0:l.enabled)&&void 0!==e&&e,h=null!==(n=null!==(s=null==a?void 0:a.canvasFps)&&void 0!==s?s:null==l?void 0:l.fps)&&void 0!==n?n:4;let c=null!==(r=null!==(o=null==a?void 0:a.canvasQuality)&&void 0!==o?o:null==l?void 0:l.quality)&&void 0!==r?r:.4;if("string"==typeof c){const t=parseFloat(c);c=isNaN(t)?.4:t}return{enabled:u,fps:Qe(h,0,12,Zs("canvas recording fps"),4),quality:Qe(c,0,1,Zs("canvas recording quality"),.4)}}get vn(){var t;const e=!!(null===(t=this.ne)||void 0===t?void 0:t.consoleLogRecordingEnabled),i=this._instance.config.enable_recording_console_log;return null!=i?i:e}get pn(){var t,e,i;const n=null===(t=this.ne)||void 0===t?void 0:t.networkPayloadCapture,s={recordHeaders:null===(e=this._instance.config.session_recording)||void 0===e?void 0:e.recordHeaders,recordBody:null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.recordBody},r=(null==s?void 0:s.recordHeaders)||(null==n?void 0:n.recordHeaders),o=(null==s?void 0:s.recordBody)||(null==n?void 0:n.recordBody),a=vu(this._instance.config.capture_performance),l=vu(null==n?void 0:n.capturePerformance),u=!!(Oe(a)?a:l);return r||o||u?{recordHeaders:r,recordBody:o,recordPerformance:u}:void 0}mn(){var t,e;const i=[],n=null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.rrwebPlugins)||void 0===t?void 0:t.getRecordConsolePlugin;n&&this.vn&&i.push(n());const r=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrwebPlugins)||void 0===e?void 0:e.getRecordNetworkPlugin;if(this.pn&&Ce(r))if(!or.includes(s.hostname)||this._forceAllowLocalhostNetworkCapture){const t=Ce(this._instance.requestRouter.isIngestionEndpoint)?this._instance.requestRouter.isIngestionEndpoint.bind(this._instance.requestRouter):void 0;i.push(r(((t,e,i)=>{const n={payloadSizeLimitBytes:ro.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...ro.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...ro.payloadHostDenyList]},s=!1!==t.session_recording.recordHeaders&&e.recordHeaders,r=!1!==t.session_recording.recordBody&&e.recordBody,o=!1!==t.capture_performance&&e.recordPerformance,a=(t=>{const e=so(t);return t=>((null==t?void 0:t.requestBody)&&(t.requestBody=co(t.requestBody,t.requestHeaders,e,"Request")),(null==t?void 0:t.responseBody)&&(t.responseBody=co(t.responseBody,t.responseHeaders,e,"Response")),t)})(n),l=e=>{return a(((t,e,i)=>{var n;if(null==i?void 0:i(t.name))return;const s=lr(t.name);let r=0===e.indexOf("http")?null===(n=lr(e))||void 0===n?void 0:n.pathname:e;"/"===r&&(r="");const o=null==s?void 0:s.pathname.replace(r||"","");return s&&o&&ho.some(t=>0===o.indexOf(t))?void 0:t})((uo((n=e).requestHeaders),uo(n.responseHeaders),n),t.api_host,i));var n},u=Ce(t.session_recording.maskNetworkRequestFn);return u&&Ce(t.session_recording.maskCapturedNetworkRequestFn)&&Gs.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),u&&(t.session_recording.maskCapturedNetworkRequestFn=e=>{const i=t.session_recording.maskNetworkRequestFn({url:e.name});return!i&&e.isInitial?i:he(he({},e),{},{name:null==i?void 0:i.url})}),n.maskRequestFn=Ce(t.session_recording.maskCapturedNetworkRequestFn)?e=>{var i,n;const s=l(e);if(!s)return;const r=s.isInitial?{name:"",entryType:s.entryType,startTime:s.startTime,duration:s.duration,endTime:s.endTime,timeOrigin:s.timeOrigin,timestamp:s.timestamp,isInitial:!0}:void 0,o=null===(i=(n=t.session_recording).maskCapturedNetworkRequestFn)||void 0===i?void 0:i.call(n,s);return Re(o)&&r?(fo.add(r),r):null!=o?o:void 0}:t=>function(t){if(!Ie(t))return t.requestBody=vo(t.requestBody,"Request"),t.responseBody=vo(t.responseBody,"Response"),t}(l(t)),he(he(he({},ro),n),{},{recordHeaders:s,recordBody:r,recordPerformance:o,recordInitialRequests:o,streamNetworkBody:!0===t.session_recording.streamNetworkBody})})(this._instance.config,this.pn,t)))}else fu.info("NetworkCapture not started because we are on localhost.");return i}gn(t){return this._instance.config.disable_capture_url_hashes?hn(t):t}yn(t,e=!1){const i=e?hn(t):this.gn(t),n=this._instance.config.mask_personal_data_properties?[...Tl,...this._instance.config.custom_personal_data_properties||[]]:[];return this.bn(cr(i,n,Ml))}bn(t){const e=this._instance.config.session_recording;if(e.maskCapturedNetworkRequestFn){var i;const n=e.maskCapturedNetworkRequestFn({name:t});return null!==(i=null==n?void 0:n.name)&&void 0!==i?i:null==n?void 0:n.url}if(e.maskNetworkRequestFn){const i=e.maskNetworkRequestFn({url:t});return null==i?void 0:i.url}return t}wn(t){try{return t.rrwebMethod(),!0}catch(e){return 10>this.ce.length?this.ce.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt+1,rrwebMethod:t.rrwebMethod}):fu.warn("could not emit queued rrweb event.",e,t),!1}}Vt(t,e){return this.wn(gu(()=>yu().addCustomEvent(t,e)))}kn(){var t;return this.ae&&!0===(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)&&!this.Y.urlBlocked&&!0!==this.de}_n(t){if(!this.kn())return!1;try{const e=yu();return!!e&&(e.addCustomEvent("$json_ld",t),this.kn())}catch(t){return!1}}Sn(t=!1){Promise.resolve().then(()=>{var e;return null===(e=this.xn)||void 0===e?void 0:e.scan(t)})}Cn(){try{if(this._instance.config.capture_pageview||!t)return;const e=new URL(t.location.href),i=this.yn(e.origin+e.pathname+e.search);this.Mn!==i&&(this.Mn=i,this.Vt("$url_changed",{href:i}))}catch(t){}}In(){if(this.ce.length){const t=[...this.ce];this.ce=[],t.forEach(t=>{Date.now()-t.enqueuedAt>2e3||this.wn(t)})}}jt(){return this.wn(gu(()=>yu().takeFullSnapshot()))}get Tn(){var t,e,i;if((null===(t=this.re)||void 0===t?void 0:t.hasPendingTriggers(this.sessionId))&&!["sampled","active"].includes(this.status)){var n;const t=null===(n=this._instance.config.session_recording)||void 0===n?void 0:n.trigger_pending_buffer_interval_millis;return Ae(t)&&Number.isFinite(t)&&t>=1e3&&36e5>=t?t:6e4}return null!==(e=null===(i=this._instance.config.session_recording)||void 0===i?void 0:i.full_snapshot_interval_millis)&&void 0!==e?e:3e5}Rn(){if(this.$n&&clearInterval(this.$n),!0===this.de)return;const t=this.Tn;t&&(this.$n=setInterval(()=>{this.jt()},t))}Bt(t){"event"===t&&this.En(),!this.Y.urlBlocked&&["sampled","active"].includes(this.status)&&this.Rn()}An(){var t;this.Y.urlBlocked||(this.Y.urlBlocked=!0,null===(t=this.xn)||void 0===t||t.scan(),clearInterval(this.$n),fu.info("recording paused due to URL blocker"),this.Vt("recording paused",{reason:"url blocker"}))}On(){var t;this.Y.urlBlocked&&(null===(t=this.xn)||void 0===t||t.scan(),this.Y.urlBlocked=!1,this.jt(),this.Sn(),this.Rn(),this.Vt("recording resumed",{reason:"left blocked url"}),fu.info("recording resumed"))}Ln(t,e){var i;if("event"===t&&this.En(),!this.ue&&(null===(i=this.re)||void 0===i?void 0:i.hasPendingTriggers(this.sessionId))){this.ue=!0;try{var n,s;const i="url"===t?W:V;null===(n=this._instance.persistence)||void 0===n||n.register({[i]:this.sessionId}),null===(s=this.re)||void 0===s||s.updateActiveTriggers(this.sessionId),this.Bt(),this.en(),this.qt(t+"_trigger_matched",{["url"===t?"matchedUrl":"matchedEvent"]:e})}finally{this.ue=!1}}}get isStarted(){return!!this.se}get ne(){const t=this._instance.get_property(O);if(!t)return;let e;try{e=$e(t)?t:JSON.parse(t)}catch(t){return void fu.warn("persisted remote config for session recording is invalid and will be ignored",t)}if(!this.isStarted&&!this.Ve){var i;const n=null!==(i=e.cache_timestamp)&&void 0!==i?i:Date.now();if(Date.now()-n>36e5)return void fu.info("persisted remote config for session recording is stale and will be ignored",{cacheTimestamp:n,persistedConfig:t})}return e}Pn(t,e,i){this._instance.get_property(t)&&(e(),i())}start(e){var i,s;const r=this.ne;if(!r)return void fu.info("remote config must be stored in persistence before recording can start");if(!this.isStarted){const t=!1!==this.de&&!this.we;this.Ye(t?"no_interaction_since_recording_started":void 0),this.we=!1,this.ye=t,this.be=!1}this.De&&(this.Dn(),this.nn());const{sessionId:o,windowId:a,sessionStartTimestamp:l}=this.Yt.checkAndGetSessionAndWindowId();this.Xt=o,this.He=a,this._sessionStartTimestamp=l,this.Fn(),null===(i=this._instance.persistence)||void 0===i||i.unregister("$debug_first_full_snapshot_timestamp"),(null==r?void 0:r.endpoint)&&(this.oe=null==r?void 0:r.endpoint),this.re=2===(null==r?void 0:r.version)&&(null==r?void 0:r.triggerGroups)&&r.triggerGroups.length>0?new $l(this._instance,this.Y,this.qt.bind(this),this.Vt.bind(this),this.Bt.bind(this)):new Cl(this._instance,this.Y,this.tt,this.et,this.qt.bind(this),this.jt.bind(this),this.Bt.bind(this)),this.re.onRemoteConfig(r),null===(s=this.Wt)||void 0===s||s.call(this),this.Wt=this.re.setupEventTriggerListeners(this._instance.on.bind(this._instance,"eventCaptured"),this.sessionId,(t,e)=>this.Ln(t,e)),this.Pn(N,()=>{this.overrideSampling()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(N)}),this.Pn(q,()=>{this.overrideLinkedFlag()},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(q)}),this.Pn(B,()=>{this.overrideTrigger("event")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(B)}),this.Pn(j,()=>{this.overrideTrigger("url")},()=>{var t;return null===(t=this._instance.persistence)||void 0===t?void 0:t.unregister(j)}),this.re.makeSamplingDecisions(this.sessionId),this.Nn(),this.ke||(sr(t,"beforeunload",this.Ke),sr(t,"pagehide",this.rn),sr(t,"offline",this.sn),sr(t,"online",this.an),sr(n,"visibilitychange",this.ln),!this.Ne&&Ce(this.Yt.onSessionId)&&(this.Ne=this.Yt.onSessionId(this.Be)),!this.qe&&Ce(this.Yt.on)?this.qe=this.Yt.on("forcedIdleReset",()=>{this.Ue(),this.de="unknown",this.stop(),this.je=this.Yt.onSessionId((t,e,i)=>{var n;null===(n=this.je)||void 0===n||n.call(this),this.je=void 0,this.Be(t,e,i)})}):Ce(this.Yt.on)||fu.warn("bundled core has no SessionIdManager.on (requires posthog-js >= 1.268.6); recording will start but skip forced-idle-reset handling"),Re(this.Fe)&&(this.Fe=this._instance.on("eventCaptured",t=>{try{if("$pageview"===t.event){const e=(null==t?void 0:t.properties.$current_url)?this.yn(t.properties.$current_url):"";if(!e)return;this.Vt("$pageview",{href:e})}}catch(t){fu.error("Could not add $pageview to rrweb session",t)}})),"active"===this.status&&this.qt(e||"recording_initialized"))}qn(){var e,i,s,r,o,a;null==t||t.removeEventListener("beforeunload",this.Ke),null==t||t.removeEventListener("pagehide",this.rn),null==t||t.removeEventListener("offline",this.sn),null==t||t.removeEventListener("online",this.an),null==n||n.removeEventListener("visibilitychange",this.ln),clearInterval(this.$n),this.jn(),null===(e=this.Fe)||void 0===e||e.call(this),this.Fe=void 0,null===(i=this.Wt)||void 0===i||i.call(this),this.Wt=void 0,null===(s=this.Ne)||void 0===s||s.call(this),this.Ne=void 0,null===(r=this.qe)||void 0===r||r.call(this),this.qe=void 0,null===(o=this.je)||void 0===o||o.call(this),this.je=void 0,null===(a=this.re)||void 0===a||a.stop(),this.Bn(),this.Dn()}Dn(){this.Pe+=1,this.Oe=[],this.Le=0,this.Hn=void 0,this.De=!1}Bn(){var t,e;null===(t=this.zn)||void 0===t||t.stop(),this.ce=[],null===(e=this.xn)||void 0===e||e.stop(),this.xn=void 0,this.ae=!1;try{var i;null===(i=this.se)||void 0===i||i.call(this)}catch(t){fu.warn("could not stop rrweb",t)}this.se=void 0}Un(){if(!this.Hn||0===this.Le)return!1;if(this.De)return!0;this.De=!0,this.Wn=void 0;const t=this.Pe;return this.jn(),this.Bn(),this.Hn.catch(()=>{}).then(()=>{t===this.Pe&&(this.De=!1,this.en(),this.nn(),this.Vn(),this.qn(),fu.info("stopped"))}).catch(()=>{this.De=!1,this.Vn(),this.qn(),fu.info("stopped")}),!0}stop(){if(this.Bn(),this.Ve)this.tn();else if(this.Un())return;this.en(),this.nn(),this.Vn(),this.qn(),fu.info("stopped")}Vn(){this.Ye(void 0,{preserveLogDedup:this.Ve}),this.ye=!1}flushBeforeIdentityReset(){(this.isStarted||this.De)&&(this.tn(),this.en())}We(t){this.Ve=!0,this.le=Date.now();try{var e,i;this.stop(),this.Zn=void 0,this.Gn=void 0,this.fe=0,this.ve=0,this.pe=0,this.me=0,null===(e=mu())||void 0===e||null===(i=e.resetSnapshotCostState)||void 0===i||i.call(e),this.start("session_id_changed")}finally{this.Ve=!1}this.Ye(t?"no_interaction_since_session_rotated":void 0),this.ye=!1}Ye(t,{preserveLogDedup:e=!1}={}){if(this.ge=!Ie(t),this.Wn=t,Ie(t))return void(e||(this.Qn=void 0));if(this.Ve)return;const i=`${this.sessionId}:${t}`;i!==this.Qn&&(this.Qn=i,fu.info(`holding buffer: ${t}. nothing is uploaded until the user interacts with the page`))}En(){this.isStarted||(this.we=!0),this.ge&&(this.Ye(void 0),this.ye=!1,this.be&&(this.be=!1,this.jt()),this.Jn())}discard({discardProducerEvents:t=!1}={}){this.ge=!0,t&&(this.nn(),this.Bn()),this.nn(),this.qn(),this.nn(),this.Vn(),fu.info("discarded")}Kn(t,e,i,n,s){if(-1===i)return this.me+=1,void fu.warn("could not stringify event - dropping it to keep the rest of the recording");const r={$snapshot_bytes:i,$snapshot_data:e,$session_id:n,$window_id:s};"disabled"!==this.status?(this.Xn(t,n),this.Yn(r)):this.nn()}ti(){try{this.ei()}catch(t){this.xe||(this.xe=!0,fu.error("could not track full snapshot cost",t))}}ei(){var t,e;const i=null===(t=mu())||void 0===t||null===(e=t.getLastSnapshotCost)||void 0===e?void 0:e.call(t);i&&i!==this.Gn&&(this.Gn=i,this.Zn&&this.Zn.durationMs>=i.durationMs||(this.Zn=i),500>i.durationMs||fu.warn("full snapshot was slow, the page may have been unresponsive while it ran",{durationMs:Math.round(i.durationMs),stylesheetMs:Math.round(i.stylesheetMs),nodeCount:i.nodeCount,cssRuleCount:i.cssRuleCount,nonDeferrableCssRuleCount:i.nonDeferrableCssRuleCount,deferredStylesheetCount:i.deferredStylesheetCount}))}Xn(t,e){2!==t.type?3===t.type&&(Ie(this.$e)||this.$e===e||this.Ee===e||(this.Ee=e,fu.info("incremental snapshot for a session with no full snapshot - requesting one",{sessionId:e}),this.jt())):this.$e=e}ni(t){t.counted&&t.generation===this.Pe&&(this.Le=Math.max(0,this.Le-1)),t.counted=!1,this.Oe=this.Oe.filter(e=>e!==t)}ii(t,e,i){t.processed||t.generation!==this.Pe||(t.processed=!0,this.Kn(t.event,e,i,t.targetSessionId,t.targetWindowId))}ri(t){try{let e,i=t.event;if(t.compressionEnabled)try{({event:i,size:e}=Fu(t.event))}catch(t){fu.warn("could not process queued compression event - will use uncompressed event",t)}Ie(e)&&(e=jo(t.event));try{this.ii(t,i,e)}catch(t){fu.warn("could not capture queued compression event",t)}}finally{this.ni(t)}}tn(){[...this.Oe].forEach(t=>{try{this.ri(t)}catch(t){fu.warn("could not drain queued compression event",t)}})}oi(t,e,i,n){var s=this;const r={event:t,compressionEnabled:e,targetSessionId:i,targetWindowId:n,generation:this.Pe,processed:!1,counted:!0};this.Oe.push(r),this.Le+=1;const o=(a=oe(function*(){try{if(r.processed)return;let i,n;try{const s=e?Eu(t)?yield function(t){return Ou.apply(this,arguments)}(t):Fu(t):{event:t,size:jo(t)};i=s.event,n=s.size}catch(e){fu.warn("could not process queued compression event - will use uncompressed event",e),i=t,n=jo(t)}s.ii(r,i,n)}finally{s.ni(r)}}),function(){return a.apply(this,arguments)});var a;this.Hn=this.Hn?this.Hn.catch(()=>{}).then(o):o()}onRRwebEmit(e){var i,n,s,r,o,a,l,u,h,c,d,v,f;if(!this._instance.sessionManager)return;if(this.In(),!e||!$e(e))return;if(4===e.type){const t=this.yn(e.data.href);if(this.Mn=t,!t)return;e.data.href=t}else this.Cn();if(null===(i=this.re)||void 0===i||i.checkUrlTriggers(this.sessionId,()=>this.An(),()=>this.On(),(t,e)=>this.Ln(t,e)),this.Y.urlBlocked&&!function(t){return 5===t.type&&"recording paused"===t.data.tag}(e))return;2===e.type&&((null===(c=mu())||void 0===c||null===(d=c.wasMaxDepthReached)||void 0===d?void 0:d.call(c))&&(this.Se=!0),this.ti(),Promise.resolve().then(()=>this.ti()),this.Rn(),null===(v=this.zn)||void 0===v||v.reset(),null===(f=this._instance.persistence)||void 0===f||f.register_once({$debug_first_full_snapshot_timestamp:e.timestamp},void 0));const p=2===e.type&&(null===(n=this.re)||void 0===n?void 0:n.hasPendingTriggers(this.sessionId));p&&this.si();const g=this.zn?this.zn.throttleMutations(e):e;if(!g)return void(!0===this.de&&this.he++);const m=function(t){const e=t;if(e&&$e(e)&&6===e.type&&$e(e.data)&&"rrweb/console@1"===e.data.plugin){e.data.payload.payload.length>10&&(e.data.payload.payload=e.data.payload.payload.slice(0,10),e.data.payload.payload.push("...[truncated]"));const i=[];for(let t=0;e.data.payload.payload.length>t;t++)i.push(e.data.payload.payload[t]&&e.data.payload.payload[t].length>2e3?e.data.payload.payload[t].slice(0,2e3)+"...[truncated]":e.data.payload.payload[t]);return e.data.payload.payload=i,t}return t}(g),y=function(t){return Nu(t)?t.data.payload:null}(m),b=function(t){return qu(t)?t.data.payload:null}(m),_=function(t){return Lu(t)?t.data.payload:null}(m);y||b?(null==y?void 0:y.lastActivityTimestamp)&&(m.timestamp=y.lastActivityTimestamp):(null==_?void 0:_.sessionId)||this.ai(m),2===e.type&&(this.Re.push([this.Xt,e.timestamp]),this.Re.length>6&&(this.Re=this.Re.slice(-6)));const w=null!==(s=null!==(r=null!==(o=null==y?void 0:y.currentSessionId)&&void 0!==o?o:null==b?void 0:b.nextSessionId)&&void 0!==r?r:null==_?void 0:_.sessionId)&&void 0!==s?s:this.Xt,k=null!==(a=null!==(l=null!==(u=null==y?void 0:y.currentWindowId)&&void 0!==u?u:null==b?void 0:b.nextWindowId)&&void 0!==l?l:null==_?void 0:_.windowId)&&void 0!==a?a:this.He;if(!0===this.de&&!function(t){return Lu(t)||Nu(t)||qu(t)}(m))return void(function(t){return 2===t.type||4===t.type||3===t.type&&9!==t.data.source}(m)&&this.he++);2===m.type&&(this.he=0),_&&(m.timestamp=_.lastActivityTimestamp+_.threshold);const S=this.ae;this.ae=!0,p?this.Sn(!0):S||this.Sn();const x=null===(h=this._instance.config.session_recording.compress_events)||void 0===h||h;if(5===m.type&&"$json_ld"===m.data.tag){let e;try{e=t?this.yn(t.location.href):void 0}catch(t){}m.data.href=e}if(this.Le>0||x&&Eu(m))return void this.oi(m,x,w,k);const{event:C,size:T}=x?Fu(m):{event:m,size:jo(m)};this.Kn(m,C,T,w,k)}get status(){return this.re?this.re.getStatus({instance:this._instance,sessionId:this.sessionId,isSampled:this.ee,rrwebError:this.ke,urlTriggerMatching:this.Y,eventTriggerMatching:this.tt,linkedFlagMatching:this.et,remoteConfig:this.ne}):po}log(t,e="log"){var i;null===(i=this._instance.sessionRecording)||void 0===i||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:e,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}overrideLinkedFlag(){this.et.linkedFlagSeen=!0,this.jt(),this.En(),this.qt("linked_flag_overridden")}overrideSampling(){var t;null===(t=this._instance.persistence)||void 0===t||t.register({$session_is_sampled:this.sessionId,$replay_sample_rate:null}),this.jt(),this.En(),this.qt("sampling_overridden")}overrideTrigger(t){this.Ln(t),this.En()}li(){try{var e;const i=null==t||null===(e=t.location)||void 0===e?void 0:e.href;if(!i)return;const n=this.yn(i);if(!n)return;return new URL(n).hostname||void 0}catch(t){return}}jn(){this.ui&&(clearTimeout(this.ui),this.ui=void 0)}Jn(){this.ui||(this.ui=setTimeout(()=>{this.en()},2e3))}ci(){return this.$e!==this.Rt.sessionId&&0!==this.Rt.data.length&&this.Rt.data.every(t=>5===(null==t?void 0:t.type)&&!Nu(t)&&!qu(t))}di(){var t,e;return null!==(t=null===(e=this.re)||void 0===e?void 0:e.getPendingTriggerConditions(this.sessionId))&&void 0!==t?t:[]}hi(t){if("buffering"!==t)return Ie(this.fi)||this._instance.register_for_session({[Ht]:[]}),void(this.fi=void 0);const e=this.di();if(0===e.length)return Ie(this.fi)||this._instance.register_for_session({[Ht]:[]}),void(this.fi=void 0);const i=e.join(", "),n=`${this.sessionId}:${i}`;n!==this.fi&&(this.fi=n,this._instance.register_for_session({[Ht]:e}),fu.info(`buffering: ${i}`))}pi(){var t;return"memory"!==this._instance.config.persistence&&!0!==(null===(t=this._instance.persistence)||void 0===t?void 0:t.mi)&&Xa.Et()}gi(){0!==this.Rt.data.length&&this.Rt.size!==this.yi&&943718.4>=this.Rt.size&&this.pi()&&(this.yi=this.Rt.size,Xa.At(this.un,this.Rt))}Fn(){if(this.Ae||!this.pi())return;this.Ae=!0;const t=Xa.Dt(this.un);Xa.Lt(this.un),$e(t)&&xe(t.data)&&0!==t.data.length&&xe(t.sizes)&&t.sizes.length===t.data.length&&Ae(t.size)&&t.sessionId===this.Xt&&t.windowId===this.He&&(this.Rt.data.length>0||(this.Rt=t))}en(t=!1){var e;if(this.jn(),this.ge)return this.Rt;if(this.ci())return this.Rt.size>943718.4?this.nn():(t&&this.gi(),this.Rt);const i=this.Rt;null===(e=this.re)||void 0===e||e.ensureSamplingDecision(this.sessionId);const n=this.Qe(),s=this.status;if(this.hi(s),"buffering"===s||"paused"===s||"disabled"===s||n)return!t||"active"!==s&&"sampled"!==s||this.gi(),this.Jn(),this.Rt;if(this.Rt!==i)return this.Rt;if(i.data.length>0){var r;const t=this.li();Ho(i).forEach(e=>{try{var i;null===(i=this.ze)||void 0===i||i.trackSize(e.sessionId,e.size),this.bi(he({$snapshot_bytes:e.size,$snapshot_data:e.data,$session_id:e.sessionId,$window_id:e.windowId,$lib:Ya.LIB_NAME,$lib_version:Ya.LIB_VERSION,$snapshot_host:t},this.me>0?{$sdk_debug_replay_unstringifiable_events_dropped:this.me}:{}))}catch(t){fu.warn("could not capture snapshot chunk - skipping it",t)}}),Ie(this.yi)||(Xa.Lt(this.un),this.yi=void 0),null===(r=this.re)||void 0===r||r.onFlushComplete()}return this.nn()}Yn(t){var e;const i=2+((null===(e=this.Rt)||void 0===e?void 0:e.data.length)||0),n=t.$session_id,s=this.Rt.sessionId!==n;if(s||!0!==this.de&&!this.ge&&this.Rt.size+t.$snapshot_bytes+i>943718.4){const e=this.Xt;if(this.Rt=this.en(),this.Xt!==e)return;s&&this.Rt.data.length>0&&(this.Rt=this.nn()),this.Rt.sessionId=n,this.Rt.windowId=t.$window_id}this.ge&&(this.be||this.Rt.size+t.$snapshot_bytes+i>943718.4)?this.be||(this.be=!0,this.Rt=this.nn()):(this.Rt.size+=t.$snapshot_bytes,this.Rt.data.push(t.$snapshot_data),this.Rt.sizes.push(t.$snapshot_bytes),!0===this.de||this.ge||this.Jn())}bi(t){this._instance.capture("$snapshot",t,{_url:this._instance.requestRouter.endpointFor("api",this.oe),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}get Je(){var t,e;const i=null===(t=this.Rt)||void 0===t?void 0:t.data[(null===(e=this.Rt)||void 0===e?void 0:e.data.length)-1];return i?i.timestamp-this._sessionStartTimestamp:null}si(){if(!this.Rt||0===this.Rt.data.length)return this.nn();let t=-1;for(let e=this.Rt.data.length-1;e>=0;e--)if(4===this.Rt.data[e].type){t=e;break}return 0>t?this.nn():(this.Rt.data=this.Rt.data.slice(t),this.Rt.sizes=this.Rt.sizes.slice(t),this.Rt.size=this.Rt.sizes.reduce((t,e)=>t+e,0),this.Rt)}nn(){return this.Rt={size:0,data:[],sizes:[],sessionId:this.Xt,windowId:this.He},this.Rt}qt(t,e){this._instance.register_for_session({[Zt]:t}),fu.info(t.replace("_"," "),e),"session_id_changed"!==t&&this.Vt("$recording_started",he({reason:t},e))}wi(t){var e;return 3===t.type&&-1!==pu.indexOf(null===(e=t.data)||void 0===e?void 0:e.source)}ai(t){const e=this.wi(t);e||!0===this.de||t.timestamp-this.le>this.te&&(this.de=!0,clearInterval(this.$n),this.Vt("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this.le,threshold:this.te,bufferLength:this.Rt.data.length,bufferSize:this.Rt.size,sessionId:this.Xt,windowId:this.He}),this.en());const{windowId:i,sessionId:n}=this.Yt.checkAndGetSessionAndWindowId(!e,t.timestamp);let s=!1;if(e&&(this.le=t.timestamp,this.de)){const e="unknown"===this.de;this.de=!1,e||(this.Vt("sessionNoLongerIdle",{reason:"user activity",type:t.type}),s=!0)}const r=this.Xt!==n,o=this.He!==i;if(this.He=i,this.Xt=n,r||o){const t=r&&!1!==this.de;t&&(this.de="unknown"),this.We(t)}else if(e&&this.En(),s){var a;const t=["sampled","active"].includes(this.status)||(null===(a=this.re)||void 0===a?void 0:a.hasPendingTriggers(this.sessionId));this.he>0&&t&&this.jt(),this.Sn(),this.Rn()}}Ue(){var t;null===(t=this.re)||void 0===t||t.clearConditionalRecordingPersistence()}get sdkDebugProperties(){var t,e,i,n,s,r,o,a,l,u,h,c,d,v;const f=null===(t=mu())||void 0===t||null===(e=t.getDeferredStylesheetStats)||void 0===e?void 0:e.call(t);return{$recording_status:this.status,$sdk_debug_replay_flush_hold_reason:this.Wn,$sdk_debug_replay_internal_buffer_length:this.Rt.data.length,$sdk_debug_replay_internal_buffer_size:this.Rt.size,$sdk_debug_current_session_duration:this.Je,$sdk_debug_session_start:this._sessionStartTimestamp,$sdk_debug_replay_flushed_size:null===(i=this.ze)||void 0===i?void 0:i.currentTrackedSize(this.sessionId),$sdk_debug_replay_full_snapshots:this.Re,$snapshot_max_depth_exceeded:this.Se,$sdk_debug_replay_slowest_full_snapshot_ms:du(null===(n=this.Zn)||void 0===n?void 0:n.durationMs),$sdk_debug_replay_slowest_full_snapshot_stylesheet_ms:du(null===(s=this.Zn)||void 0===s?void 0:s.stylesheetMs),$sdk_debug_replay_slowest_full_snapshot_nodes:null===(r=this.Zn)||void 0===r?void 0:r.nodeCount,$sdk_debug_replay_slowest_full_snapshot_css_rules:null===(o=this.Zn)||void 0===o?void 0:o.cssRuleCount,$sdk_debug_replay_slowest_full_snapshot_css_rules_non_deferrable:null===(a=this.Zn)||void 0===a?void 0:a.nonDeferrableCssRuleCount,$sdk_debug_replay_deferred_stylesheets:null==f?void 0:f.deferredCount,$sdk_debug_replay_deferred_stylesheets_failed:null==f?void 0:f.failedCount,$sdk_debug_replay_deferred_stylesheets_abandoned:null==f?void 0:f.abandonedCount,$sdk_debug_replay_deferred_stylesheet_ms:du(null==f?void 0:f.totalMs),$sdk_debug_replay_deferred_stylesheet_slowest_slice_ms:du(null==f?void 0:f.slowestSliceMs),$sdk_debug_replay_slowest_mutation_batch_ms:du(null===(l=mu())||void 0===l||null===(u=l.getMutationCost)||void 0===u||null===(u=u.call(l))||void 0===u?void 0:u.slowestBatchMs),$sdk_debug_replay_discarded_duration_samples:null===(h=mu())||void 0===h||null===(c=h.getDiscardedDurationSamples)||void 0===c?void 0:c.call(h),$sdk_debug_replay_throttled_mutations_dropped:this.fe,$sdk_debug_replay_oversized_mutations_dropped:this.ve,$sdk_debug_replay_oversized_mutation_bytes_dropped:this.pe,$sdk_debug_replay_unstringifiable_events_dropped:this.me,$sdk_debug_replay_rrweb_error:this.ke,$sdk_debug_replay_observer_init_failures:null===(d=mu())||void 0===d||null===(v=d.getObserverInitFailures)||void 0===v?void 0:v.call(d),[Vt]:!!this.se,[Gt]:this._e}}Nn(){var e;if(this.se)return;this._e=!0;const i={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,maskAllElementAttributes:!1,maskAttributeFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,inlineStylesheetBudgetRules:1e4,recordCrossOriginIframes:!1,sampling:void 0,attributeFilter:void 0},s=this._instance.config.session_recording;for(const[t,e]of Object.entries(s||{}))if(t in i)if("maskInputOptions"===t)i.maskInputOptions=he({password:!0},e);else if("sampling"===t){const t=null!=e?e:{},n={};Ie(t.mousemove)||(n.mousemove=t.mousemove),Ie(t.mouseInteraction)||(n.mouseInteraction=t.mouseInteraction),i.sampling=n}else i[t]=e;var r,o,a,l;!0===(null==s?void 0:s.captureJsonLd)&&!0!==i.slimDOMOptions&&"all"!==i.slimDOMOptions&&(i.slimDOMOptions=he(he({},i.slimDOMOptions),{},{script:!0})),this.fn&&this.fn.enabled&&(i.recordCanvas=!0,i.sampling=he(he({},i.sampling),{},{canvas:this.fn.fps}),i.dataURLOptions={type:"image/webp",quality:this.fn.quality},i.canvasResolutionScale=this.hn,i.canvasMasking={configured:()=>{var t;return Ce(null===(t=this._instance.config.session_recording)||void 0===t||null===(t=t.canvasCapture)||void 0===t?void 0:t.maskRegionsFn)},regionsFn:t=>{var e;const i=null===(e=this._instance.config.session_recording)||void 0===e||null===(e=e.canvasCapture)||void 0===e?void 0:e.maskRegionsFn;if(Ce(i))try{var n;return null!==(n=i(t))&&void 0!==n?n:null}catch(t){return this.Ie||(this.Ie=!0,fu.warn("canvasCapture.maskRegionsFn threw, canvas frames will be skipped",t)),null}}}),this.cn&&(i.maskAllInputs=null===(r=this.cn.maskAllInputs)||void 0===r||r,i.maskTextSelector=null!==(o=this.cn.maskTextSelector)&&void 0!==o?o:void 0,i.blockSelector=null!==(a=this.cn.blockSelector)&&void 0!==a?a:void 0,i.maskAllElementAttributes=null!==(l=this.cn.maskAllElementAttributes)&&void 0!==l&&l),i.maskAllElementAttributes&&i.maskAttributeFn&&(i.maskAttributeFn=void 0,this.Me||(this.Me=!0,fu.warn('`maskAllElementAttributes` and `maskAttributeFn` are mutually exclusive, and `maskAttributeFn` is being ignored. Remove one of the two. Note that `maskAllElementAttributes` can also come from your project\'s "Privacy and masking" settings. See https://posthog.com/docs/session-replay/privacy'))),this.dn();const u=yu();if(!u)return void fu.error("_startRecorder was called but rrwebRecord is not available. This indicates something has gone wrong.");this.zn=null!==(e=this.zn)&&void 0!==e?e:new xa(u,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(t,e)=>{const i=`Too many mutations on node '${t}'. Rate limiting. This could be due to SVG animations or something similar`;fu.info(i,{node:e}),this.log("[SessionRecording] "+i,"warn")},onDroppedAttributeMutations:t=>this.fe+=t,bytesRefillRate:this._instance.config.session_recording.__mutationBytesRefillRate,bytesBucketSize:this._instance.config.session_recording.__mutationBytesBucketSize,resyncIntervalMs:this.Tn,onDroppedOversizedMutation:t=>{0===this.ve&&this.log("[SessionRecording] Dropped an oversized DOM mutation to keep the recording playable. The recording will resync with a full snapshot.","warn"),this.ve+=1,this.pe+=t},requestFullSnapshot:()=>this.jt()});const h=this.mn();if(this.se=u(he({emit:t=>{this.onRRwebEmit(t)},plugins:h,errorHandler:(t,e)=>"rrweb"===e&&(this.Te||(this.Te=!0,fu.error("rrweb internal error - recording will continue but may be incomplete",t)),!0)},i)),!this.se)return this.ke=!0,void fu.error("rrweb failed to start - Loss of recording data is possible. Check the browser console for rrweb errors.");this.ke=!1,!0===(null==s?void 0:s.captureJsonLd)&&n&&(null==t?void 0:t.MutationObserver)&&!this.xn&&(this.xn=function(t,e,i){const n=new WeakMap,s=i.getCaptureState||(()=>!0);let r=Hl;const o=function(t,e){const i=e.attributeFilter;return e.maskAllElementAttributes||e.maskAttributeFn||(null==i?void 0:i.length)&&!i.includes("id")?Wl:i=>{const n=t.getElementById(i);return!!n&&"SCRIPT"!==n.nodeName&&(!e.isRecordedElement||e.isRecordedElement(n))&&!hu(n,e.blockClass,e.blockSelector)}}(t,i),a=e=>{try{const a=s();if(!r||!1===a||!e.isConnected||e.ownerDocument!==t||function(t,e){return hu(t,e.blockClass,e.blockSelector)||hu(t,e.maskTextClass,e.maskTextSelector)}(e,i))return;const l=function(t,e=Wl,i){if(!t||t.length>Hl)return null;try{const n=JSON.parse(t),s={maskUrl:i,remainingNodes:2048,exceeded:!1},r=xe(n)?n.map(t=>au(t,e,s)):au(n,e,s);if(s.exceeded||Pe(r)||xe(r)&&(!r.length||r.some(Pe)))return null;const o=JSON.stringify(r);return o.length>2e4?null:[r,o]}catch(t){return null}}(e.text,o,i.maskUrl);if(!l)return void n.delete(e);const[u,h]=l;if(Pe(a))return void n.set(e,h);if(n.get(e)!==h){if(h.length>r)return void(r=0);i.emit(u)&&(n.set(e,h),r-=h.length)}}catch(t){return}};try{const i=new e(t=>{try{if(!r||!1===s())return;const e=t=>{for(const e of cu(t))a(e)};for(const i of t)if("childList"===i.type)lu(i.target)&&a(i.target),i.addedNodes.forEach(e);else if("characterData"===i.type){const t=i.target.parentNode;t&&lu(t)&&a(t)}else"attributes"===i.type&&lu(i.target)&&a(i.target)}catch(t){return}});return i.observe(t,{attributes:!0,attributeFilter:["type"],characterData:!0,childList:!0,subtree:!0}),{scan(e=!1){r&&!1!==s()&&cu(t.documentElement).forEach(t=>{e&&n.delete(t),a(t)})},stop(){return i.disconnect()}}}catch(t){return{scan(){},stop(){}}}}(n,t.MutationObserver,{maskUrl:t=>this.yn(t),attributeFilter:i.attributeFilter,blockClass:i.blockClass,blockSelector:i.blockSelector,isRecordedElement:t=>u.mirror.getId(t)>0,maskAllElementAttributes:i.maskAllElementAttributes,maskAttributeFn:i.maskAttributeFn,maskTextClass:i.maskTextClass,maskTextSelector:i.maskTextSelector,getCaptureState:()=>{var t;return!0!==(null===(t=this._instance.config.session_recording)||void 0===t?void 0:t.captureJsonLd)||this.Y.urlBlocked||this.Y.isCurrentUrlBlocked()?null:this.kn()},emit:t=>this._n(t)}),this.Y.isCurrentUrlBlocked()&&this.xn.scan()),this.le=Date.now(),this.de=Oe(this.de)?this.de:"unknown",this.tryAddCustomEvent("$remote_config_received",this.ne),this.Vt("$session_options",{sessionRecordingOptions:i,activePlugins:h.map(t=>null==t?void 0:t.name)}),this.Vt("$posthog_config",{config:this._instance.config})}tryAddCustomEvent(t,e){return this.Vt(t,e)}};const Bu=["type"];var Hu=function(t){return t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t}({}),zu=function(t){return t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t}({}),Uu=function(t){return t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t}({}),Wu=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}({}),Vu=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}({}),Gu=function(t){return t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t}({}),Zu=function(t){return t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t}({});function Qu(t,e){return-1!==t.indexOf(e)}"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var Ju={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot"],MutationObserver:[]},Ku={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:["querySelector","querySelectorAll"],MutationObserver:["constructor"]},Xu={};function Yu(t){if(Xu[t])return Xu[t];const e=function(t){var e,i;const n=null===(e=globalThis)||void 0===e||null===(e=e.Zone)||void 0===e||null===(i=e.__symbol__)||void 0===i?void 0:i.call(e,t);return n&&globalThis[n]?globalThis[n]:void 0}(t)||globalThis[t],i=e.prototype,n=t in Ju?Ju[t]:void 0,s=Boolean(n&&n.every(t=>{var e;return Boolean(null===(e=Object.getOwnPropertyDescriptor(i,t))||void 0===e||null===(e=e.get)||void 0===e?void 0:e.toString().includes("[native code]"))})),r=t in Ku?Ku[t]:void 0,o=Boolean(r&&r.every(t=>{var e;return"function"==typeof i[t]&&(null===(e=i[t])||void 0===e?void 0:e.toString().includes("[native code]"))}));if(s&&o)return Xu[t]=e.prototype,e.prototype;const a=document.createElement("iframe");a.style.display="none";let l=!1;try{document.body.appendChild(a);const n=a.contentWindow;if(!n)return e.prototype;const s=n[t].prototype;return s?(function(t){return Qu(t,"AppleWebKit")&&!Qu(t,"Chrome")}(navigator.userAgent)&&(a.classList.add("rr-block","ph-no-capture"),a.setAttribute("__rrwebUntaintedPrototype",t),l=!0),Xu[t]=s):i}catch(t){return i}finally{!l&&a.parentNode&&document.body.removeChild(a)}}var th=Object.create(null);function eh(t,e,i){var n;const s=th[t],r=s[i];if(r)return r.call(e);const o=Yu(t),a=null===(n=Object.getOwnPropertyDescriptor(o,i))||void 0===n?void 0:n.get;return a?(s[i]=a,a.call(e)):e[i]}th.Node=Object.create(null),th.ShadowRoot=Object.create(null),th.MutationObserver=Object.create(null),th.Element=Object.create(null);var ih,nh={};function sh(t,e,i){const n=`${t}.${String(i)}`;if(nh[n])return nh[n].bind(e);const s=Yu(t)[i];return"function"!=typeof s?e[i]:(nh[n]=s,s.bind(e))}function rh(){return Yu("MutationObserver").constructor}function oh(t,e,i){try{if(!(e in t))return()=>{};const n=t[e],s={next:n},r=i(function(...t){return s.next.apply(this,t)});return"function"==typeof r&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__rrweb_original__:{enumerable:!1,value:n},__rrweb_layer__:{enumerable:!1,value:s}})),t[e]=r,()=>{if(t[e]===r)return void(t[e]=s.next);const i=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let n=t[e],o=i(n);for(;o;){if(o.next===r)return void(o.next=s.next);n=o.next,o=i(n)}}}catch(t){return()=>{}}}var ah={childNodes:t=>eh("Node",t,"childNodes"),parentNode:t=>eh("Node",t,"parentNode"),parentElement:t=>eh("Node",t,"parentElement"),textContent:t=>eh("Node",t,"textContent"),isConnected(t){if(void 0===ih){var e;const t=null===(e=Object.getOwnPropertyDescriptor(Yu("Node"),"isConnected"))||void 0===e?void 0:e.get;ih=(null==t?void 0:t.toString().includes("[native code]"))?t:null}return null==ih?void 0:ih.call(t)},contains:(t,e)=>sh("Node",t,"contains")(e),getRootNode:t=>sh("Node",t,"getRootNode")(),host:t=>t&&"host"in t?eh("ShadowRoot",t,"host"):null,styleSheets:t=>t.styleSheets,shadowRoot:t=>t&&"shadowRoot"in t?eh("Element",t,"shadowRoot"):null,querySelector:(t,e)=>sh("Element",t,"querySelector")(e),querySelectorAll:(t,e)=>sh("Element",t,"querySelectorAll")(e),mutationObserver:rh,patch:oh};function lh(){try{if("undefined"!=typeof performance&&performance.now)return performance.now()}catch(t){}return Date.now()}var uh=0;function hh(){uh+=1}function ch(){return uh}function dh(t,e){return(e!==uh||t>6e4)&&!0}var vh=0,fh=0,ph=0,gh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},mh=null,yh=null,bh=[],_h=0,wh=0,kh={slowestBatchMs:0},Sh={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0};function xh(t){(vh+=1)>1||(gh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},bh=[],_h=0,yh=(t=>t&&t>0?t:null)(t),fh=lh(),ph=uh)}function Ch(){return 0===vh?mh||{durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0}:(vh-=1)>0?gh:(gh.durationMs=lh()-fh,gh.deferredStylesheetCount=_h,Sh.deferredCount+=_h,yh=null,dh(gh.durationMs,ph)?gh:mh=gh)}function $h(t,e,i){let n=t.length;if(i>=32)return n;for(let s=0;t.length>s;s++){const r=t[s];try{const t=r.cssRules;if(t&&t.length)n+=$h(t,e,i+1);else if(e&&r.styleSheet){const t=r.styleSheet;if(!e.has(t)){e.add(t);const s=t.rules||t.cssRules;s&&(n+=$h(s,e,i+1))}}}catch(t){}}return n}function Th(t){if(0===vh)return;const e=$h(t,null,0);gh.cssRuleCount+=e,wh>0&&(gh.nonDeferrableCssRuleCount+=e)}function Ih(t){wh+=1;try{return t()}finally{wh-=1}}function Mh(t){vh>0&&(gh.stylesheetMs+=t)}function Eh(t){if(0===vh||null===yh)return!1;const e=gh.cssRuleCount-gh.nonDeferrableCssRuleCount;return e>=yh||e+function(t){try{const e=t&&(t.rules||t.cssRules);if(!e)return 0;const i=new WeakSet;return i.add(t),$h(e,i,0)}catch(t){return 0}}(t)>yh}function Ph(){const t=bh;return bh=[],t}function Rh(){Sh.failedCount+=1}function Ah(t){t>0&&(Sh.abandonedCount+=t)}function Fh(t){return Fh="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},Fh(t)}function Oh(t,e,i){return(e=function(t){var e=function(t){if("object"!=Fh(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=Fh(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==Fh(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Dh(t){return t.nodeType===t.ELEMENT_NODE}function Lh(t){const e=t&&"host"in t&&"mode"in t&&ah.host(t)||null;return Boolean(e&&"shadowRoot"in e&&ah.shadowRoot(e)===t)}function Nh(t){return"[object ShadowRoot]"==={}.toString.call(t)}function qh(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function jh(t){const{cssText:e}=t;if(3>e.split('"').length)return e;const i=["@import",`url(${JSON.stringify(t.href)})`];return""===t.layerName?i.push("layer"):t.layerName&&i.push(`layer(${t.layerName})`),t.supportsText&&i.push(`supports(${t.supportsText})`),t.media.length&&i.push(t.media.mediaText),i.join(" ")+";"}var Bh=0;function Hh(t){const e=0===Bh,i=e?lh():0;Bh+=1;try{const e=t.rules||t.cssRules;if(!e)return null;Th(e);let i=t.href;return!i&&t.ownerNode&&(i=t.ownerNode.baseURI),qh(Array.from(e,t=>zh(t,i)).join(""))}catch(t){return null}finally{Bh-=1,e&&Mh(lh()-i)}}function zh(t,e){if(Wh(t)){let e;try{e=Hh(t.styleSheet)||jh(t)}catch(i){e=t.cssText}try{var i;if(e&&(null===(i=t.styleSheet)||void 0===i?void 0:i.href))return ac(e,t.styleSheet.href)}catch(t){}return e}{let i=t.cssText;return Vh(t)&&t.selectorText.includes(":")&&(i=Uh(i)),e?ac(i,e):i}}function Uh(t){return t.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function Wh(t){return"styleSheet"in t}function Vh(t){return"selectorText"in t}var Gh=/^-?[A-Za-z_][\w-]*$/,Zh=/^-?[A-Za-z_][\w-]*(\.-?[A-Za-z_][\w-]*)*$/;function Qh(t){const e=[];let i=!1,n=null;const s=new Map;function r(t){const s=e.pop();if("group"===s.kind){if(null===t){for(;e.length>0&&"group"===e[e.length-1].kind;)e.pop();return void r(null)}const i=e[e.length-1];return i.parts.push(t),void(i.index+=1)}if(!s.importRule)return i=!0,void(n=t);o(e[e.length-1],s.importRule,t)}function o(t,e,i){try{let s;try{s=i||jh(e)}catch(t){s=e.cssText}try{var n;s&&(null===(n=e.styleSheet)||void 0===n?void 0:n.href)&&(s=ac(s,e.styleSheet.href))}catch(t){}s&&t.parts.push(s),t.index+=1}catch(t){r(null)}}function a(t){const i=t.rules[t.index];if("sheet"===t.kind&&Wh(i)){const n=s.get(i);return null===n?(t.parts.push(i.cssText),void(t.index+=1)):n?void e.push({kind:"sheet",sheet:n.sheet,rules:n.rules,sheetHref:n.sheetHref,index:0,parts:[],importRule:i}):void o(t,i,null)}if(function(t,i){try{const n=function(t){const e=t;if(!e.cssRules||0===e.cssRules.length)return null;if(e.media&&"string"==typeof e.media.mediaText)return`@media ${e.media.mediaText} {`;if(Vh(t)){if("number"==typeof e.type&&1!==e.type)return null;const i=e.style?e.style.cssText:"";return`${t.selectorText} {${i?" "+i:""}`}if("containerName"in e)return"string"!=typeof e.containerQuery||e.containerName&&!Gh.test(e.containerName)?null:`@container ${e.containerName?`${e.containerName} `:""}${e.containerQuery} {`;if("string"==typeof e.conditionText){let n="";try{var i;n=(null===(i=t.constructor)||void 0===i?void 0:i.name)||""}catch(t){return null}return""===n||"Object"===n||"CSSSupportsRule"===n?`@supports ${e.conditionText} {`:null}return"string"==typeof e.name?"keyText"in e.cssRules[0]?Gh.test(e.name)?`@keyframes ${e.name} {`:null:""===e.name?"@layer {":Zh.test(e.name)?`@layer ${e.name} {`:null:null}(t);if(null===n)return!1;const s=i.sheetHref;return e.push({kind:"group",rules:Array.from(t.cssRules),sheetHref:s,index:0,parts:[],prelude:s?ac(n,s):n,fixColons:"sheet"===i.kind&&Vh(t)&&t.selectorText.includes(":")}),!0}catch(t){return!1}}(i,t))return;let n=i.cssText;"sheet"===t.kind&&Vh(i)&&i.selectorText.includes(":")&&(n=Uh(n)),t.parts.push(t.sheetHref?ac(n,t.sheetHref):n),t.index+=1}return function(t){try{const i=t.rules||t.cssRules;if(!i)return!1;Th(i);let n=t.href;!n&&t.ownerNode&&(n=t.ownerNode.baseURI);const r=Array.from(i);return e.push({kind:"sheet",sheet:t,rules:r,sheetHref:n,index:0,parts:[],importRule:null}),function(t,e){const i=[{sheet:e,rules:t,index:0}];for(;i.length>0;){const t=i[i.length-1];if(t.index>=t.rules.length){i.pop();continue}const e=t.rules[t.index];if(t.index+=1,!Wh(e)||s.has(e))continue;let n=null;try{n=e.styleSheet}catch(t){s.set(e,null);continue}if(n&&!i.some(t=>t.sheet===n))try{const t=n.rules||n.cssRules;if(!t)continue;Th(t);let r=n.href;!r&&n.ownerNode&&(r=n.ownerNode.baseURI);const o=Array.from(t);s.set(e,{sheet:n,rules:o,sheetHref:r}),i.push({sheet:n,rules:o,index:0})}catch(t){}}}(r,t),!0}catch(t){return!1}}(t)||(i=!0),{advance(t){if(i)return!0;const s=lh();let o=t>0?t:1;try{for(;!i&&o>0;){const t=e[e.length-1];if(t.index>=t.rules.length){let e=null;try{if("group"===t.kind){const i=t.prelude+t.parts.join("")+"}";e=t.fixColons?Uh(i):i}else e=qh(t.parts.join(""))}catch(t){}r(e);continue}o-=1;try{a(t)}catch(t){r(null)}}}catch(t){i=!0,n=null}finally{Mh(lh()-s)}return i},text:()=>i?n:null,remainingRules(){if(i)return 0;let t=0;for(const i of e)t+=i.rules.length-i.index;return t}}}var Jh=class{constructor(){Oh(this,"idNodeMap",new Map),Oh(this,"nodeMetaMap",new WeakMap)}getId(t){var e,i;return t&&null!==(e=null===(i=this.getMeta(t))||void 0===i?void 0:i.id)&&void 0!==e?e:-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const e=this.getId(t);if(this.idNodeMap.delete(e),t.childNodes&&t.childNodes.forEach(t=>this.removeNodeFromMap(t)),Dh(t)){const e=ah.shadowRoot(t);e&&this.removeNodeFromMap(e),"IFRAME"===t.nodeName&&t.contentDocument&&this.removeNodeFromMap(t.contentDocument)}}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,e){this.idNodeMap.set(e.id,t),this.nodeMetaMap.set(t,e)}replace(t,e){const i=this.getNode(t);if(i){const t=this.nodeMetaMap.get(i);t&&this.nodeMetaMap.set(e,t)}this.idNodeMap.set(t,e)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function Kh({element:t,maskInputOptions:e,tagName:i,type:n,value:s,maskInputFn:r}){let o=s||"";const a=n&&Xh(n);return(e[i.toLowerCase()]||a&&e[a])&&(o=r?r(o,t):"*".repeat(o.length)),o}function Xh(t){return t.toLowerCase()}var Yh=new Set(["rr_width","rr_height","rr_left","rr_top","rr_position","rr_transform","rr_display","rr_scrollleft","rr_scrolltop","rr_mediastate","rr_open_mode"]);function tc({element:t,name:e,value:i,maskAllElementAttributes:n,maskAttributeFn:s,isGenerated:r=!1}){return i?n?r&&Yh.has(Xh(e))?i:"*".repeat(i.length):s?s(e,i,t):i:i}var ec="__rrweb_original__";function ic(t){try{const e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?Xh(e):null}catch(t){return null}}var nc=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,sc=/^(?:[a-z+]+:)?\/\//i,rc=/^www\..*/i,oc=/^(data:)([^,]*),(.*)/i;function ac(t,e){return(t||"").replace(nc,(t,i,n,s,r,o)=>{const a=n||r||o,l=i||s||"";if(!a)return t;if(sc.test(a)||rc.test(a))return`url(${l}${a}${l})`;if(oc.test(a))return`url(${l}${a}${l})`;if("/"===a[0])return`url(${l}${function(t){let e="";return e=t.indexOf("//")>-1?t.split("/").slice(0,3).join("/"):t.split("/")[0],e=e.split("?")[0],e}(e)+a}${l})`;const u=e.split("/"),h=a.split("/");u.pop();for(const t of h)"."!==t&&(".."===t?u.pop():u.push(t));return`url(${l}${u.join("/")}${l})`})}var lc,uc,hc=new Map,cc=1,dc=new RegExp("[^a-z0-9-_:]");function vc(){return cc++}var fc=!1,pc=/^[^ \t\n\r\u000c]+/,gc=/^[, \t\n\r\u000c]+/,mc=new WeakMap;function yc(t,e){return e&&""!==e.trim()?bc(t,e):e}function bc(t,e){let i=mc.get(t);if(i||(i=t.createElement("a"),mc.set(t,i)),e){if(e.startsWith("blob:")||e.startsWith("data:"))return e}else e="";return i.setAttribute("href",e),i.href}function _c(t,e){return(null==e?void 0:e.maxBase64ImageLength)?function(t,e){return e&&t.length>e?"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxkZWZzPgogICAgPHBhdHRlcm4gaWQ9InN0cmlwZXMiIHBhdHRlcm5Vbml0cz0idXNlclNwYWNlT25Vc2UiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI+CiAgICAgIDxyZWN0IHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0iYmxhY2siLz4KICAgICAgPHBhdGggZD0iTTggMEgxNkwwIDE2VjhMOCAwWiIgZmlsbD0iIzJEMkQyRCIvPgogICAgICA8cGF0aCBkPSJNMTYgOFYxNkg4TDE2IDhaIiBmaWxsPSIjMkQyRDJEIi8+CiAgICA8L3BhdHRlcm4+CiAgPC9kZWZzPgogIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InVybCgjc3RyaXBlcykiLz4KPC9zdmc+Cg==":t}(t,e.maxBase64ImageLength):t}function wc(t,e,i,n,s,r){if(!n)return n;if("src"===i||"href"===i&&("use"!==e||"#"!==n[0])){if("link"===e&&s){var o;const t=null===(o=s.sheet)||void 0===o?void 0:o.href;if(t)return t}const i=yc(t,n);if(i.startsWith("data:")){if("img"===e&&s){let t=i;return((null==r?void 0:r.type)||void 0!==(null==r?void 0:r.quality))&&(t=function(t,e,i,n){if(1e5>e.length)return e;if(!t.complete||0===t.naturalWidth)return e;if(t.naturalWidth>4096||t.naturalHeight>4096)return e;const s=hc.get(e);if(s&&s.type===i&&s.quality===n)return s.result;try{const s=document.createElement("canvas");s.width=t.naturalWidth,s.height=t.naturalHeight;const r=s.getContext("2d");if(!r)return e;r.drawImage(t,0,0);const o=s.toDataURL(i||"image/webp",null!=n?n:.4),a=e.length>o.length?o:e;if(hc.size>=10){const t=hc.keys().next().value;void 0!==t&&hc.delete(t)}return hc.set(e,{type:i,quality:n,result:a}),a}catch(t){return e}}(s,i,r.type,r.quality)),_c(t,r)}if("image"===e)return _c(i,r)}return i}if("xlink:href"===i&&"#"!==n[0]){const i=yc(t,n);return"image"===e&&i.startsWith("data:")?_c(i,r):i}return"background"!==i||"table"!==e&&"td"!==e&&"th"!==e?"srcset"===i?function(t,e){if(""===e.trim())return e;let i=0;function n(t){let n;const s=t.exec(e.substring(i));return s?(n=s[0],i+=n.length,n):""}const s=[];for(;n(gc),e.length>i;){let r=n(pc);if(","===r.slice(-1))r=yc(t,r.substring(0,r.length-1)),s.push(r);else{let n="";r=yc(t,r);let o=!1;for(;;){const t=e.charAt(i);if(""===t){s.push((r+n).trim());break}if(o)")"===t&&(o=!1);else{if(","===t){i+=1,s.push((r+n).trim());break}"("===t&&(o=!0)}n+=t,i+=1}}}return s.join(", ")}(t,n):"style"===i?ac(n,bc(t)):"object"===e&&"data"===i?yc(t,n):n:yc(t,n)}function kc(t,e,i){return("video"===t||"audio"===t)&&"autoplay"===Xh(e)}function Sc(t){return"string"==typeof t&&Xh(t).split(/\s+/).includes("stylesheet")}function xc(t,e,i){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return!!i&&xc(ah.parentNode(t),e,i);for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;return!!i&&xc(ah.parentNode(t),e,i)}function Cc(t,e,i,n){let s;if(Dh(t)){if(s=t,!ah.childNodes(s).length)return!1}else{if(null===ah.parentElement(t))return!1;s=ah.parentElement(t)}try{if("string"==typeof e){if(n){if(s.closest(`.${e}`))return!0}else if(s.classList.contains(e))return!0}else if(xc(s,e,n))return!0;if(i)if(n){if(s.closest(i))return!0}else if(s.matches(i))return!0}catch(t){}return!1}function $c(t,e,i){const n=t.removeEventListener;"function"==typeof n&&n.call(t,e,i)}var Tc=new Map;function Ic(t,e){return Array.from(t.styleSheets).find(t=>t.href===e)}function Mc(t){return null==t?"":t.toLowerCase()}var Ec=!1,Pc=!1;function Rc(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,maskTextClass:o,maskTextSelector:a,skipChild:l=!1,inlineStylesheet:u=!0,maskInputOptions:h={},maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v=!1,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g={},inlineImages:m=!1,recordCanvas:y=!1,canvasMaskingConfigured:b,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k=5e3,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:T=()=>!1,newlyAddedElement:I=!1,depth:M=0,maxDepth:E=50}=e;let{needsMask:P}=e,{preserveWhiteSpace:R=!0}=e;if(M>=E)return Pc=!0,Ec||(Ec=!0,console.warn(`[rrweb-snapshot] DOM tree depth exceeded max depth of ${E}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`)),null;P||(P=Cc(t,o,a,void 0===P)),vh>0&&(gh.nodeCount+=1);const A=function(t,e){const{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:o,inlineStylesheet:a,maskInputOptions:l={},maskTextFn:u,maskInputFn:h,maskAllElementAttributes:c=!1,maskAttributeFn:d,dataURLOptions:v={},inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y=!1}=e,b=function(t,e){if(!e.hasNode(t))return;const i=e.getId(t);return 1===i?void 0:i}(i,n);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:Zu.Document,childNodes:[],compatMode:t.compatMode}:{type:Zu.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:Zu.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:b};case t.ELEMENT_NODE:return function(t,e){const{doc:i,blockClass:n,blockSelector:s,inlineStylesheet:r,maskInputOptions:o={},maskInputFn:a,maskAllElementAttributes:l=!1,maskAttributeFn:u,dataURLOptions:h={},inlineImages:c,recordCanvas:d,canvasMaskingConfigured:v,keepIframeSrcFn:f,newlyAddedElement:p=!1,rootId:g}=e,m=function(t,e,i){try{if("string"==typeof e){if(t.classList.contains(e))return!0}else for(let i=t.classList.length;i--;)if(e.test(t.classList[i]))return!0;if(i)return t.matches(i)}catch(t){}return!1}(t,n,s),y=function(t){if(t instanceof HTMLFormElement)return"form";const e=Xh(t.tagName);return dc.test(e)?"div":e}(t),b=new Set;let _={};const w=t.attributes.length;for(let e=0;w>e;e++){const n=t.attributes[e];kc(y,n.name)||(_[n.name]=wc(i,y,Xh(n.name),n.value,t,h))}if("link"===y&&r&&!m&&Sc(_.rel)){let e=t.sheet;if(!e){const n=function(t){return t.href}(t);n&&(e=Ic(i,n),!e&&n.includes(".css"))&&(e=Ic(i,window.location.origin+"/"+n.replace(window.location.href,"")))}let n=null;e&&(Eh(e)?vh>0&&(bh.push(t),_h+=1):n=Hh(e)),n&&(delete _.rel,delete _.href,_._cssText=n)}var k;if("style"===y&&t.sheet&&!(t.innerText||ah.textContent(t)||"").trim().length){const e=Ih(()=>Hh(t.sheet));e&&(_._cssText=e)}if("input"===y||"textarea"===y||"select"===y){const e=t.value,i=t.checked;"radio"!==_.type&&"checkbox"!==_.type&&"submit"!==_.type&&"button"!==_.type&&e?_.value=Kh({element:t,type:ic(t),tagName:y,value:e,maskInputOptions:o,maskInputFn:a}):i&&(_.checked=i)}if("option"===y&&(t.selected&&!o.select?_.selected=!0:delete _.selected),"dialog"===y&&t.open){try{_.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"}catch(t){_.rr_open_mode="modal",_.ph_rr_could_not_detect_modal=!0}b.add("rr_open_mode")}if("canvas"===y&&d&&!(null==v?void 0:v()))try{if("2d"===t.__context)(function(t){const e=t.getContext("2d");if(!e)return!0;for(let i=0;t.width>i;i+=50)for(let n=0;t.height>n;n+=50){const s=e.getImageData,r=ec in s?s[ec]:s;let o;try{o=r.call(e,i,n,Math.min(50,t.width-i),Math.min(50,t.height-n))}catch(t){return!1}if(new Uint32Array(o.data.buffer).some(t=>0!==t))return!1}return!0})(t)||(_.rr_dataURL=t.toDataURL(h.type,h.quality));else if(!("__context"in t)){const e=t.toDataURL(h.type,h.quality),n=i.createElement("canvas");n.width=t.width,n.height=t.height,e!==n.toDataURL(h.type,h.quality)&&(_.rr_dataURL=e)}}catch(t){"SecurityError"===(null==(k=t)?void 0:k.name)?fc||(fc=!0,console.warn("Cannot read canvas pixels, so this canvas is left out of the recording. A cross-origin image or video drawn into it taints it.",k)):console.warn("Cannot read canvas pixels, so this canvas is left out of the recording.",k)}let S,x=!1;if("img"===y&&c){lc||(lc=i.createElement("canvas"),uc=lc.getContext("2d"));const e=t,n=e.currentSrc||e.getAttribute("src")||"<unknown-src>",s=e.crossOrigin,r=(e,i)=>x?tc({element:t,name:e,value:i,maskAllElementAttributes:l,maskAttributeFn:u}):i,o=()=>{$c(e,"load",o);try{lc.width=e.naturalWidth,lc.height=e.naturalHeight,uc.drawImage(e,0,0);const t=lc.toDataURL(h.type,h.quality);_.rr_dataURL=r("rr_dataURL",t)}catch(t){if("anonymous"!==e.crossOrigin)return e.crossOrigin="anonymous",void(e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o));console.warn(`Cannot inline img src=${n}! Error: ${t}`)}"anonymous"===e.crossOrigin&&(s?_.crossOrigin=r("crossOrigin",s):e.removeAttribute("crossorigin"))};e.complete&&0!==e.naturalWidth?o():e.addEventListener("load",o)}if("audio"===y||"video"===y){const e=_;e.rr_mediaState=t.paused?"paused":"played",b.add("rr_mediaState"),e.rr_mediaCurrentTime=t.currentTime,e.rr_mediaPlaybackRate=t.playbackRate,e.rr_mediaMuted=t.muted,e.rr_mediaLoop=t.loop,e.rr_mediaVolume=t.volume}if(p||(t.scrollLeft&&(_.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(_.rr_scrollTop=t.scrollTop)),m){var C,T,I;const{width:e,height:n,left:s,top:r}=t.getBoundingClientRect(),o=null===(C=i.defaultView)||void 0===C?void 0:C.getComputedStyle(t);_={class:_.class,rr_width:`${e}px`,rr_height:`${n}px`,rr_left:`${Math.floor(s+((null===(T=i.defaultView)||void 0===T?void 0:T.scrollX)||0))}px`,rr_top:`${Math.floor(r+((null===(I=i.defaultView)||void 0===I?void 0:I.scrollY)||0))}px`},b.add("rr_width"),b.add("rr_height"),b.add("rr_left"),b.add("rr_top"),o&&(_.rr_position=o.position||"static",b.add("rr_position"),o.transform&&"none"!==o.transform&&(_.rr_transform=o.transform,b.add("rr_transform")),o.display&&o.display.startsWith("inline")&&(_.rr_display=o.display,b.add("rr_display")))}if("iframe"!==y||f(_.src)||(t.contentDocument||(_.rr_src=_.src),delete _.src),l||u)for(const[e,i]of Object.entries(_))"string"!=typeof i&&null!==i||(_[e]=tc({element:t,name:e,value:i,maskAllElementAttributes:l,maskAttributeFn:u,isGenerated:b.has(e)}));x=!0;try{customElements.get(y)&&(S=!0)}catch(t){}return{type:Zu.Element,tagName:y,attributes:_,childNodes:[],isSVG:(M=t,Boolean("svg"===M.tagName||M.ownerSVGElement)||void 0),needBlock:m,rootId:g,isCustom:S};var M}(t,{doc:i,blockClass:s,blockSelector:r,inlineStylesheet:a,maskInputOptions:l,maskInputFn:h,maskAllElementAttributes:c,maskAttributeFn:d,dataURLOptions:v,inlineImages:f,recordCanvas:p,canvasMaskingConfigured:g,keepIframeSrcFn:m,newlyAddedElement:y,rootId:b});case t.TEXT_NODE:return function(t,e){const{needsMask:i,maskTextFn:n,rootId:s}=e,r=ah.parentNode(t),o=r&&r.tagName;let a=ah.textContent(t);const l="STYLE"===o||void 0,u="SCRIPT"===o||void 0;if(l&&a){try{var h;if(t.nextSibling||t.previousSibling);else if(Eh(r.sheet));else if(null===(h=r.sheet)||void 0===h?void 0:h.cssRules){const t=Hh(r.sheet);t&&!/(?:^|[\s;{}])-?[a-zA-Z][\w-]*\s*:\s*;/.test(t)&&(a=t)}}catch(e){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${e}`,t)}a=ac(a,bc(e.doc))}return u&&(a="SCRIPT_PLACEHOLDER"),!l&&!u&&a&&i&&(a=n?n(a,ah.parentElement(t)):a.replace(/[\S]/g,"*")),{type:Zu.Text,textContent:a||"",isStyle:l,rootId:s}}(t,{doc:i,needsMask:o,maskTextFn:u,rootId:b});case t.CDATA_SECTION_NODE:return{type:Zu.CDATA,textContent:"",rootId:b};case t.COMMENT_NODE:return{type:Zu.Comment,textContent:ah.textContent(t)||"",rootId:b};default:return!1}}(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,keepIframeSrcFn:T,newlyAddedElement:I});if(!A)return console.warn(t,"not serialized"),null;let F;F=n.hasNode(t)?n.getId(t):function(t,e){if(e.comment&&t.type===Zu.Comment)return!0;if(t.type===Zu.Element){if(e.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel&&"script"===t.attributes.as||"modulepreload"===t.attributes.rel)||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===function(t){var e;let i;try{i=new URL(t,window.location.href)}catch(t){return null}const n=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(e=null==n?void 0:n[1])&&void 0!==e?e:null}(t.attributes.href)))return!0;if(e.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(Mc(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===Mc(t.attributes.name)||["icon","apple-touch-icon","shortcut icon"].includes(Mc(t.attributes.rel)))))return!0;if("meta"===t.tagName){if(e.headMetaDescKeywords&&Mc(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Mc(t.attributes.property).match(/^(og|twitter|fb):/)||Mc(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===Mc(t.attributes.name)))return!0;if(e.headMetaRobots&&["robots","googlebot","bingbot"].includes(Mc(t.attributes.name)))return!0;if(e.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(e.headMetaAuthorship&&(["author","generator","framework","publisher","progid"].includes(Mc(t.attributes.name))||Mc(t.attributes.property).match(/^article:/)||Mc(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&["google-site-verification","yandex-verification","csrf-token","p:domain_verify","verify-v1","verification","shopify-checkout-api-token"].includes(Mc(t.attributes.name)))return!0}}return!1}(A,p)||!R&&A.type===Zu.Text&&!A.isStyle&&!A.textContent.replace(/^\s+|\s+$/gm,"").length?-2:vc();const O=Object.assign(A,{id:F});if(n.add(t,O),-2===F)return null;_&&_(t);let D=!l;if(O.type===Zu.Element){D=D&&!O.needBlock,delete O.needBlock;const e=ah.shadowRoot(t);e&&Nh(e)&&(O.isShadowHost=!0)}if((O.type===Zu.Document||O.type===Zu.Element)&&D){p.headWhitespace&&O.type===Zu.Element&&"head"===O.tagName&&(R=!1);const e={doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:l,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:M+1,maxDepth:E};if(O.type===Zu.Element&&"textarea"===O.tagName&&void 0!==O.attributes.value);else for(const i of Array.from(ah.childNodes(t))){const t=Rc(i,e);t&&O.childNodes.push(t)}let I=null;if(Dh(t)&&(I=ah.shadowRoot(t)))for(const t of Array.from(ah.childNodes(I))){const i=Rc(t,e);i&&(Nh(I)&&(i.isShadow=!0),O.childNodes.push(i))}}const L=ah.parentNode(t);if(L&&Lh(L)&&Nh(L)&&(O.isShadow=!0),O.type===Zu.Element&&"iframe"===O.tagName){const e=function(t,e,i){const n=()=>{},s=t.contentWindow;if(!s)return n;let r;try{r=s.document.readyState}catch(t){return n}const o=()=>e();if("complete"!==r){let n=!1,s=null;const r=()=>{n||(n=!0,null!==s&&(clearTimeout(s),s=null),$c(t,"load",a),t.addEventListener("load",o),e())},a=()=>r();return s=setTimeout(r,i),t.addEventListener("load",a),()=>{null!==s&&(clearTimeout(s),s=null),n?$c(t,"load",o):(n=!0,$c(t,"load",a))}}const a="about:blank";let l;try{l=s.location.href}catch(t){return n}if(l!==a||t.src===a||""===t.src){const i=setTimeout(e,0);return t.addEventListener("load",o),()=>{clearTimeout(i),$c(t,"load",o)}}return t.addEventListener("load",o),()=>{$c(t,"load",o)}}(t,()=>{const e=t.contentDocument;if(e&&w){const i=Rc(e,{doc:e,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onIframeListenerRegistered:S,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:M+1,maxDepth:E});i&&w(t,i)}},k);null==S||S(t,e)}return O.type===Zu.Element&&"link"===O.tagName&&Sc(O.attributes.rel)&&function(e,l,S){if(Tc.has(e))return;let I;try{I=e.sheet}catch(t){return}if(I)return;const A=new AbortController;let F=!1;const O=()=>{if(!F){F=!0;try{(()=>{if(x){const e=Rc(t,{doc:i,mirror:n,blockClass:s,blockSelector:r,needsMask:P,maskTextClass:o,maskTextSelector:a,skipChild:!1,inlineStylesheet:u,maskInputOptions:h,maskTextFn:c,maskInputFn:d,maskAllElementAttributes:v,maskAttributeFn:f,slimDOMOptions:p,dataURLOptions:g,inlineImages:m,recordCanvas:y,canvasMaskingConfigured:b,preserveWhiteSpace:R,onSerialize:_,onIframeLoad:w,iframeLoadTimeout:k,onStylesheetLoad:x,stylesheetLoadTimeout:C,keepIframeSrcFn:T,depth:M,maxDepth:E});e&&x(t,e)}})()}finally{Tc.delete(e),A.abort()}}},D=setTimeout(O,S);A.signal.addEventListener("abort",()=>clearTimeout(D),{once:!0}),e.addEventListener("load",O,{signal:A.signal,once:!0}),Tc.set(e,A)}(t,0,C),O}function Ac(t){return!0===t||"all"===t?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===t,headMetaDescKeywords:"all"===t,headTitleMutations:"all"===t}:!1===t?{}:t}var Fc=class t{constructor(...t){Oh(this,"parentElement",null),Oh(this,"parentNode",null),Oh(this,"ownerDocument",void 0),Oh(this,"firstChild",null),Oh(this,"lastChild",null),Oh(this,"previousSibling",null),Oh(this,"nextSibling",null),Oh(this,"ELEMENT_NODE",1),Oh(this,"TEXT_NODE",3),Oh(this,"nodeType",void 0),Oh(this,"nodeName",void 0),Oh(this,"RRNodeType",void 0)}get childNodes(){const t=[];let e=this.firstChild;for(;e;)t.push(e),e=e.nextSibling;return t}contains(e){if(!(e instanceof t))return!1;if(e.ownerDocument!==this.ownerDocument)return!1;if(e===this)return!0;for(;e.parentNode;){if(e.parentNode===this)return!0;e=e.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,e){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function Oc(t,e,i=document){const n={capture:!0,passive:!0};return i.addEventListener(t,e,n),()=>Dc(i,t,e,n)}function Dc(t,e,i,n){Lc(()=>{const s=t.removeEventListener;"function"==typeof s&&(void 0!==n?s.call(t,e,i,n):s.call(t,e,i))})}function Lc(t){try{t()}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name))throw t}}function Nc(t){t.forEach(t=>{if("function"==typeof t)try{t()}catch(t){}})}var qc="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.",jc={map:{},getId(){return console.warn(qc),-1},getNode(){return console.warn(qc),null},removeNodeFromMap(){console.warn(qc)},has(){return console.warn(qc),!1},reset(){console.warn(qc)}};function Bc(t,e,i={}){let n=null,s=0;return function(...r){const o=Date.now();s||!1!==i.leading||(s=o);const a=e-(o-s),l=this;0>=a||a>e?(n&&(clearTimeout(n),n=null),s=o,t.apply(l,r)):n||!1===i.trailing||(n=setTimeout(()=>{s=!1===i.leading?0:Date.now(),n=null,t.apply(l,r)},a))}}function Hc(t,e,i,n,s=window){const r=s.Object.getOwnPropertyDescriptor(t,e),o=()=>Hc(t,e,r||{},!0);if(n)return s.Object.defineProperty(t,e,i),o;const a=function(t){let e="function"==typeof t.setTimeout?t.setTimeout:void 0;try{var i,n;const s=null===(i=t.Zone)||void 0===i||null===(n=i.__symbol__)||void 0===n?void 0:n.call(i,"setTimeout"),r=s?t[s]:void 0;"function"==typeof r&&(e=r)}catch(t){}if(!e)return()=>{};const s=e;return e=>{try{s.call(t,e,0)}catch(t){}}}(s);return s.Object.defineProperty(t,e,{set(t){if(a(()=>{try{i.set.call(this,t)}catch(t){}}),r&&r.set){if(r.get)try{r.get.call(this)}catch(t){return}r.set.call(this,t)}}}),o}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(jc=new Proxy(jc,{get(t,e,i){return"map"===e&&console.warn(qc),Reflect.get(t,e,i)}}));var zc=Date.now;function Uc(t){var e,i,n,s;const r=t.document;return{left:r.scrollingElement?r.scrollingElement.scrollLeft:void 0!==t.pageXOffset?t.pageXOffset:r.documentElement.scrollLeft||(null==r?void 0:r.body)&&(null===(e=ah.parentElement(r.body))||void 0===e?void 0:e.scrollLeft)||(null==r||null===(i=r.body)||void 0===i?void 0:i.scrollLeft)||0,top:r.scrollingElement?r.scrollingElement.scrollTop:void 0!==t.pageYOffset?t.pageYOffset:(null==r?void 0:r.documentElement.scrollTop)||(null==r?void 0:r.body)&&(null===(n=ah.parentElement(r.body))||void 0===n?void 0:n.scrollTop)||(null==r||null===(s=r.body)||void 0===s?void 0:s.scrollTop)||0}}function Wc(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Vc(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Gc(t){return t?t.nodeType===t.ELEMENT_NODE?t:ah.parentElement(t):null}function Zc(t,e,i,n){if(!t)return!1;const s=Gc(t);if(!s)return!1;try{if("string"==typeof e){if(s.classList.contains(e))return!0;if(n&&null!==s.closest("."+e))return!0}else if(xc(s,e,n))return!0}catch(t){}if(i){if(s.matches(i))return!0;if(n&&null!==s.closest(i))return!0}return!1}function Qc(t,e,i){return!("TITLE"!==t.tagName||!i.headTitleMutations)||-2===e.getId(t)}function Jc(t,e){if(Lh(t))return!1;const i=e.getId(t);if(!e.has(i))return!0;const n=ah.parentNode(t);return(!n||n.nodeType!==t.DOCUMENT_NODE)&&(!n||Jc(n,e))}function Kc(t){return Boolean(t.changedTouches)}function Xc(t,e){return Boolean("IFRAME"===t.nodeName&&e.getMeta(t))}function Yc(t,e){return Boolean("LINK"===t.nodeName&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&"stylesheet"===t.getAttribute("rel")&&e.getMeta(t))}function td(t){return!!t&&(t instanceof Fc&&"shadowRoot"in t?Boolean(t.shadowRoot):Boolean(ah.shadowRoot(t)))}/[1-9][0-9]{12}/.test(Date.now().toString())||(zc=()=>(new Date).getTime());var ed=class{constructor(){Oh(this,"id",1),Oh(this,"styleIDMap",new WeakMap),Oh(this,"idStyleMap",new Map)}getId(t){var e;return null!==(e=this.styleIDMap.get(t))&&void 0!==e?e:-1}has(t){return this.styleIDMap.has(t)}add(t,e){if(this.has(t))return this.getId(t);let i;return i=void 0===e?this.id++:e,this.styleIDMap.set(t,i),this.idStyleMap.set(i,t),i}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function id(t){var e;let i=null;return"getRootNode"in t&&(null===(e=ah.getRootNode(t))||void 0===e?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&ah.host(ah.getRootNode(t))&&(i=ah.host(ah.getRootNode(t))),i}function nd(t){const e=t.ownerDocument;if(!e)return!1;if(ah.contains(e,t))return!0;const i=ah.isConnected(t);return"boolean"==typeof i?i:function(t){const e=t.ownerDocument;if(!e)return!1;const i=function(t){let e,i=t;for(;e=id(i);)i=e;return i}(t);return ah.contains(e,i)}(t)}function sd(t){return"__ln"in t}var rd,od=class{constructor(){Oh(this,"length",0),Oh(this,"head",null),Oh(this,"tail",null)}get(t){if(t>=this.length)throw new Error("Position outside of list range");let e=this.head;for(let i=0;t>i;i++)e=(null==e?void 0:e.next)||null;return e}addNode(t){const e={value:t,previous:null,next:null};if(t.__ln=e,t.previousSibling&&sd(t.previousSibling)){const i=t.previousSibling.__ln.next;e.next=i,e.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=e,i&&(i.previous=e)}else if(t.nextSibling&&sd(t.nextSibling)&&t.nextSibling.__ln.previous){const i=t.nextSibling.__ln.previous;e.previous=i,e.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=e,i&&(i.next=e)}else this.head&&(this.head.previous=e),e.next=this.head,this.head=e;null===e.next&&(this.tail=e),this.length++}removeNode(t){const e=t.__ln;this.head&&(e.previous?(e.previous.next=e.next,e.next?e.next.previous=e.previous:this.tail=e.previous):(this.head=e.next,this.head?this.head.previous=null:this.tail=null),t.__ln&&delete t.__ln,this.length--)}},ad=(t,e)=>`${t}@${e}`,ld=class{constructor(){Oh(this,"frozen",!1),Oh(this,"locked",!1),Oh(this,"texts",[]),Oh(this,"attributes",[]),Oh(this,"attributeMap",new WeakMap),Oh(this,"generatedAttributes",new WeakMap),Oh(this,"removes",[]),Oh(this,"mapRemoves",new Set),Oh(this,"movedMap",{}),Oh(this,"addedSet",new Set),Oh(this,"movedSet",new Set),Oh(this,"droppedSet",new Set),Oh(this,"removesSubTreeCache",new Set),Oh(this,"mutationCb",void 0),Oh(this,"blockClass",void 0),Oh(this,"blockSelector",void 0),Oh(this,"maskTextClass",void 0),Oh(this,"maskTextSelector",void 0),Oh(this,"inlineStylesheet",void 0),Oh(this,"maskInputOptions",void 0),Oh(this,"maskTextFn",void 0),Oh(this,"maskInputFn",void 0),Oh(this,"maskAllElementAttributes",void 0),Oh(this,"maskAttributeFn",void 0),Oh(this,"keepIframeSrcFn",void 0),Oh(this,"recordCanvas",void 0),Oh(this,"canvasMaskingConfigured",void 0),Oh(this,"inlineImages",void 0),Oh(this,"slimDOMOptions",void 0),Oh(this,"dataURLOptions",void 0),Oh(this,"doc",void 0),Oh(this,"mirror",void 0),Oh(this,"iframeManager",void 0),Oh(this,"stylesheetManager",void 0),Oh(this,"shadowDomManager",void 0),Oh(this,"canvasManager",void 0),Oh(this,"processedNodeManager",void 0),Oh(this,"unattachedDoc",void 0),Oh(this,"canvasManagerReleased",!1),Oh(this,"processMutations",t=>{t.forEach(this.processMutation),this.emit()}),Oh(this,"emit",()=>{if(this.frozen||this.locked)return;const t=lh(),e=ch();try{this.processBufferedMutations()}finally{i=lh()-t,n=e,vh>0||dh(i,null!=n?n:uh)||i>kh.slowestBatchMs&&(kh.slowestBatchMs=i)}var i,n}),Oh(this,"processBufferedMutations",()=>{const t=[],e=new Set,i=new od,n=t=>{let e=t,i=-2;for(;-2===i;)e=e&&e.nextSibling,i=e&&this.mirror.getId(e);return i};let s;const r=r=>{var o;const a=ah.parentNode(r);if(!a||!nd(r)||"TEXTAREA"===a.tagName)return;if(this.isBlockedAtEmission(a))return;const l=Lh(a)?this.mirror.getId(id(r)):this.mirror.getId(a),u=n(r);if(-1===l||-1===u)return i.addNode(r);null!==(o=s)&&void 0!==o||(s={doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,canvasMaskingConfigured:this.canvasMaskingConfigured,inlineImages:this.inlineImages,onSerialize:t=>{Xc(t,this.mirror)&&this.iframeManager.addIframe(t),Yc(t,this.mirror)&&this.stylesheetManager.trackLinkElement(t),td(t)&&!Zc(t,this.blockClass,this.blockSelector,!0)&&this.shadowDomManager.addShadowRoot(ah.shadowRoot(t),this.doc)},onIframeLoad:(t,e)=>{this.iframeManager.attachIframe(t,e),this.shadowDomManager.observeAttachShadow(t)},onIframeListenerRegistered:(t,e)=>{this.iframeManager.registerLoadListenerDisposer(t,e)},onStylesheetLoad:(t,e)=>{this.stylesheetManager.attachLinkElement(t,e)}});const h=Rc(r,s);h&&(t.push({parentId:l,nextId:u,node:h}),e.add(h.id))};for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t);for(const t of this.movedSet)hd(this.removesSubTreeCache,t)&&!this.movedSet.has(ah.parentNode(t))||r(t);for(const t of this.addedSet)cd(this.droppedSet,t)||hd(this.removesSubTreeCache,t)?cd(this.movedSet,t)?r(t):this.droppedSet.add(t):r(t);let o=null;for(;i.length;){let t=null;if(o){const e=this.mirror.getId(ah.parentNode(o.value)),i=n(o.value);-1!==e&&-1!==i&&(t=o)}if(!t){let e=i.tail;for(;e;){const i=e;if(e=e.previous,i){const e=this.mirror.getId(ah.parentNode(i.value));if(-1===n(i.value))continue;if(-1!==e){t=i;break}{const e=ah.parentNode(i.value);if(e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const n=ah.host(e);if(-1!==this.mirror.getId(n)){t=i;break}}}}}}if(!t){for(;i.head;)i.removeNode(i.head.value);break}o=t.previous,i.removeNode(t.value),r(t.value)}const a={texts:this.texts.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const e=t.node,i=ah.parentNode(e);return i&&"TEXTAREA"===i.tagName&&this.genTextAreaValueMutation(i),{id:this.mirror.getId(e),value:t.value}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),attributes:this.attributes.filter(t=>!this.isBlockedAtEmission(t.node)).map(t=>{const{attributes:e}=t;if(!this.maskAllElementAttributes&&!this.maskAttributeFn&&"string"==typeof e.style){const i=JSON.stringify(t.styleDiff),n=JSON.stringify(t._unchangedStyles);e.style.length>i.length&&(i+n).split("var(").length===e.style.split("var(").length&&(e.style=t.styleDiff)}if(this.maskAllElementAttributes||this.maskAttributeFn)for(const[n,s]of Object.entries(e))if("string"==typeof s||null===s){var i;e[n]=tc({element:t.node,name:n,value:s,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn,isGenerated:null===(i=this.generatedAttributes.get(t.node))||void 0===i?void 0:i.has(n)})}return{id:this.mirror.getId(t.node),attributes:e}}).filter(t=>!e.has(t.id)).filter(t=>this.mirror.has(t.id)),removes:this.removes,adds:t};this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.generatedAttributes=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&this.mutationCb(a)}),Oh(this,"bufferBelongsToIframe",t=>this.doc===t.contentDocument),Oh(this,"genTextAreaValueMutation",t=>{let e=this.attributeMap.get(t);e||(e={node:t,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(e),this.attributeMap.set(t,e));const i=Array.from(ah.childNodes(t),t=>ah.textContent(t)||"").join("");e.attributes.value=Kh({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:ic(t),value:i,maskInputFn:this.maskInputFn})}),Oh(this,"processMutation",t=>{if(!Qc(t.target,this.mirror,this.slimDOMOptions))switch(t.type){case"characterData":{const e=ah.textContent(t.target);Zc(t.target,this.blockClass,this.blockSelector,!1)||e===t.oldValue||this.texts.push({value:Cc(t.target,this.maskTextClass,this.maskTextSelector,!0)&&e?this.maskTextFn?this.maskTextFn(e,Gc(t.target)):e.replace(/[\S]/g,"*"):e,node:t.target});break}case"attributes":{var e;const n=t.target,s=Xh(n.tagName),r=t.attributeName,o=null!==(e=t.attributeNamespace)&&void 0!==e?e:null;let a=function(t,e,i){if(!i)return e;const n=t.getAttributeNodeNS(i,e);if(n)return n.name;if("http://www.w3.org/1999/xlink"===i)return`xlink:${e}`;if("http://www.w3.org/XML/1998/namespace"===i)return`xml:${e}`;if("http://www.w3.org/2000/xmlns/"===i)return"xmlns"===e?e:`xmlns:${e}`;const s=t.lookupPrefix(i);return s?`${s}:${e}`:e}(n,r,o),l=o?n.getAttributeNS(o,r):t.target.getAttribute(r);if("value"===a){const t=n,e=ic(t);l=Kh({element:t,maskInputOptions:this.maskInputOptions,tagName:n.tagName,type:e,value:l,maskInputFn:this.maskInputFn})}if(Zc(t.target,this.blockClass,this.blockSelector,!1)||l===t.oldValue)return;let u=this.attributeMap.get(t.target);const h="iframe"===s&&"src"===a;if(h&&!this.keepIframeSrcFn(l)&&n.contentDocument)return;if("type"===a&&"input"===s&&"password"===(t.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!kc(s,a)){var i;u||(u={node:t.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(u),this.attributeMap.set(t.target,u));const e=wc(this.doc,s,Xh(a),l,n,this.dataURLOptions);if(h&&!this.keepIframeSrcFn(l)&&(a="rr_src"),u.attributes[a]=e,null===(i=this.generatedAttributes.get(t.target))||void 0===i||i.delete(a),"style"===a){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const e=this.unattachedDoc.createElement("span"),i=n.style;t.oldValue&&(e.style.cssText=t.oldValue);for(const t of Array.from(i)){const n=i.getPropertyValue(t),s=i.getPropertyPriority(t);n!==e.style.getPropertyValue(t)||s!==e.style.getPropertyPriority(t)?u.styleDiff[t]=""===s?n:[n,s]:u._unchangedStyles[t]=[n,s]}for(const t of Array.from(e.style))""===i.getPropertyValue(t)&&(u.styleDiff[t]=!1)}else if("open"===a&&"dialog"===s){u.attributes.rr_open_mode=n.matches("dialog:modal")?"modal":"non-modal";let e=this.generatedAttributes.get(t.target);e||(e=new Set,this.generatedAttributes.set(t.target,e)),e.add("rr_open_mode")}}break}case"childList":if(Zc(t.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===t.target.tagName)return void this.genTextAreaValueMutation(t.target);t.addedNodes.forEach(e=>this.genAdds(e,t.target)),t.removedNodes.forEach(e=>{const i=this.mirror.getId(e),n=Lh(t.target)?this.mirror.getId(ah.host(t.target)):this.mirror.getId(t.target);Zc(t.target,this.blockClass,this.blockSelector,!1)||Qc(e,this.mirror,this.slimDOMOptions)||!function(t,e){return-1!==e.getId(t)}(e,this.mirror)||(this.addedSet.has(e)?(ud(this.addedSet,e),this.droppedSet.add(e)):this.addedSet.has(t.target)&&-1===i||Jc(t.target,this.mirror)||(this.movedSet.has(e)&&this.movedMap[ad(i,n)]?ud(this.movedSet,e):(this.removes.push({parentId:n,id:i,isShadow:!(!Lh(t.target)||!Nh(t.target))||void 0}),function(t,e){const i=[t];for(;i.length;){const t=i.pop();e.has(t)||(e.add(t),ah.childNodes(t).forEach(t=>i.push(t)))}}(e,this.removesSubTreeCache))),this.mapRemoves.add(e))})}}),Oh(this,"genAdds",(t,e)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)){if(this.addedSet.has(t))return this.addedSet.delete(t),void this.addedSet.add(t);if(!this.movedSet.has(t)){if(this.mirror.hasNode(t)){if(Qc(t,this.mirror,this.slimDOMOptions))return;this.movedSet.add(t);let i=null;e&&this.mirror.hasNode(e)&&(i=this.mirror.getId(e)),i&&-1!==i&&(this.movedMap[ad(this.mirror.getId(t),i)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);if(!Zc(t,this.blockClass,this.blockSelector,!1)){if(t.nodeType===t.TEXT_NODE)return;const e=ah.childNodes(t);for(let t=0,i=e.length;i>t;t++){const i=e[t];i&&this.genAdds(i)}if(td(t)){const e=ah.childNodes(ah.shadowRoot(t));for(let i=0,n=e.length;n>i;i++){const n=e[i];n&&(this.processedNodeManager.add(n,this),this.genAdds(n,t))}}}}}})}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","maskAllElementAttributes","maskAttributeFn","keepIframeSrcFn","recordCanvas","canvasMaskingConfigured","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(e=>{this[e]=t[e]}),this.canvasManager.acquire()}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.releaseCanvasManager()}releaseCanvasManager(){this.canvasManagerReleased||(this.canvasManagerReleased=!0,this.canvasManager.reset())}bufferDoc(){return this.doc}destroy(){for(const t of this.mapRemoves)this.mapRemoves.delete(t),this.mirror.removeNodeFromMap(t)}isBlockedAtEmission(t){const e=this.blockClass,i=e&&"string"!=typeof e&&(e.global||e.sticky)?new RegExp(e):null;for(;t;){if(i&&(i.lastIndex=0),Zc(t,i||e,this.blockSelector,!0))return!0;const n="getRootNode"in t?ah.getRootNode(t):null;t=(null==n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE?ah.host(n):null}return!1}};function ud(t,e){const i=[e];for(;i.length;){const e=i.pop();if(t.delete(e),e.nodeType===e.TEXT_NODE)continue;const n=ah.childNodes(e);for(let t=0,e=n.length;e>t;t++){const e=n[t];e&&i.push(e)}}}function hd(t,e,i){return 0!==t.size&&function(t,e){const i=ah.parentNode(e);return!!i&&t.has(i)}(t,e)}function cd(t,e){if(0===t.size)return!1;let i=ah.parentNode(e);for(;i;){if(t.has(i))return!0;i=ah.parentNode(i)}return!1}function dd(t){rd=t}function vd(){rd=void 0}var fd=(t,e="rrweb")=>rd?(...i)=>{try{return t(...i)}catch(t){if(rd&&!0===rd(t,e))return;throw t}}:t,pd=[];function gd(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(t){}return t&&t.target}function md(t,e){const i=new ld;let n;i.init(t);try{n=new(rh())(fd(i.processMutations.bind(i)));const s={attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};return t.attributeFilter&&t.attributeFilter.length>0&&(s.attributeFilter=t.attributeFilter),n.observe(e,s),pd.push(i),{observer:n,buffer:i}}catch(t){try{null==n||n.disconnect(),i.destroy(),i.reset()}catch(t){}throw t}}function yd({scrollCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){const o=new Map,a=r=>{const a=gd(r);if(!a||Zc(a,n,s,!0))return;const l=i.getId(a);let u,h;if(a===e&&e.defaultView){const t=Uc(e.defaultView);u=t.left,h=t.top}else u=a.scrollLeft,h=a.scrollTop;const c=`${u},${h}`;o.get(l)!==c&&(o.set(l,c),t({id:l,x:u,y:h}))},l=[Oc("scroll",fd(Bc(fd(t=>a(t)),r.scroll||100)),e)];return"onscrollend"in e&&l.push(Oc("scrollend",fd(a),e)),()=>l.forEach(t=>t())}function bd(t,e){for(let i=pd.length-1;i>=0;i--){const n=pd[i];if(!n)continue;let s=n.bufferBelongsToIframe(t);!s&&e&&e.has(n.bufferDoc())&&(s=!0),s&&(n.reset(),pd.splice(i,1))}}var _d=["INPUT","TEXTAREA","SELECT"],wd=new WeakMap;function kd(t){return function t(e,i){if(Td("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||Td("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||Td("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||Td("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const n=Array.from(e.parentRule.cssRules).indexOf(e);return i.unshift(n),t(e.parentRule,i)}if(e.parentStyleSheet){const t=Array.from(e.parentStyleSheet.cssRules).indexOf(e);i.unshift(t)}return i}(t,[])}function Sd(t,e,i){let n,s;return t?(t.ownerNode?n=e.getId(t.ownerNode):s=i.getId(t),{styleId:s,id:n}):{}}function xd({mirror:t,stylesheetManager:e},i){var n,s;let r=null;r=t.getId("#document"===i.nodeName?i:ah.host(i));const o="#document"===i.nodeName?null===(n=i.defaultView)||void 0===n?void 0:n.Document:null===(s=i.ownerDocument)||void 0===s||null===(s=s.defaultView)||void 0===s?void 0:s.ShadowRoot,a=(null==o?void 0:o.prototype)?Object.getOwnPropertyDescriptor(null==o?void 0:o.prototype,"adoptedStyleSheets"):void 0;return null!==r&&-1!==r&&o&&a?(Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get(){var t;return null===(t=a.get)||void 0===t?void 0:t.call(this)},set(t){let i;try{var n;i=null===(n=a.set)||void 0===n?void 0:n.call(this,t)}catch(t){if(t&&"object"==typeof t&&"NotAllowedError"===t.name)return;throw t}if(null!==r&&-1!==r)try{e.adoptStyleSheets(t,r)}catch(t){}return i}}),fd(()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:a.set})})):()=>{}}var Cd=new Set;function $d(t,e={}){const i=t.doc.defaultView;if(!i)return()=>{};let n,s;!function(t,e){const{mutationCb:i,mousemoveCb:n,mouseInteractionCb:s,scrollCb:r,viewportResizeCb:o,inputCb:a,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:h,canvasMutationCb:c,fontCb:d,selectionCb:v,customElementCb:f}=t;t.mutationCb=(...t)=>{e.mutation&&e.mutation(...t),i(...t)},t.mousemoveCb=(...t)=>{e.mousemove&&e.mousemove(...t),n(...t)},t.mouseInteractionCb=(...t)=>{e.mouseInteraction&&e.mouseInteraction(...t),s(...t)},t.scrollCb=(...t)=>{e.scroll&&e.scroll(...t),r(...t)},t.viewportResizeCb=(...t)=>{e.viewportResize&&e.viewportResize(...t),o(...t)},t.inputCb=(...t)=>{e.input&&e.input(...t),a(...t)},t.mediaInteractionCb=(...t)=>{e.mediaInteaction&&e.mediaInteaction(...t),l(...t)},t.styleSheetRuleCb=(...t)=>{e.styleSheetRule&&e.styleSheetRule(...t),u(...t)},t.styleDeclarationCb=(...t)=>{e.styleDeclaration&&e.styleDeclaration(...t),h(...t)},t.canvasMutationCb=(...t)=>{e.canvasMutation&&e.canvasMutation(...t),c(...t)},t.fontCb=(...t)=>{e.font&&e.font(...t),d(...t)},t.selectionCb=(...t)=>{e.selection&&e.selection(...t),v(...t)},t.customElementCb=(...t)=>{e.customElement&&e.customElement(...t),f(...t)}}(t,e);const r=[],o=fd(()=>{try{if(s)try{s.destroy(),s.reset()}finally{const t=pd.indexOf(s);-1!==t&&pd.splice(t,1)}t.shadowDomManager.resetForDoc(t.doc),null==n||n.disconnect()}finally{Nc(r)}}),a=(t,e)=>{const i=fd(()=>{try{return e()}catch(e){throw Cd.add(t),e}})();"function"==typeof i&&r.push(i)};try{if(t.recordDOM&&a("mutation",()=>{const e=md(t,t.doc);n=e.observer,s=e.buffer}),a("move",()=>function({mousemoveCb:t,sampling:e,doc:i,mirror:n}){if(!1===e.mousemove)return()=>{};const s="number"==typeof e.mousemove?e.mousemove:50,r="number"==typeof e.mousemoveCallback?e.mousemoveCallback:500;let o,a=[];const l=Bc(fd(e=>{const i=Date.now()-o;t(a.map(t=>(t.timeOffset-=i,t)),e),a=[],o=null}),r),u=fd(Bc(fd(t=>{const e=gd(t),{clientX:i,clientY:s}=Kc(t)?t.changedTouches[0]:t;o||(o=zc()),a.push({x:i,y:s,id:n.getId(e),timeOffset:zc()-o}),l("undefined"!=typeof DragEvent&&t instanceof DragEvent?zu.Drag:t instanceof MouseEvent?zu.MouseMove:zu.TouchMove)}),s,{trailing:!1})),h=[Oc("mousemove",u,i),Oc("touchmove",u,i),Oc("drag",u,i)];return fd(()=>{h.forEach(t=>t())})}(t)),a("mouseInteraction",()=>function({mouseInteractionCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,sampling:r}){if(!1===r.mouseInteraction)return()=>{};const o=!0===r.mouseInteraction||void 0===r.mouseInteraction?{}:r.mouseInteraction,a=[];let l=null;return Object.keys(Uu).filter(t=>Number.isNaN(Number(t))&&!t.endsWith("_Departed")&&!1!==o[t]).forEach(r=>{let o=Xh(r);const u=(e=>r=>{const o=gd(r);if(Zc(o,n,s,!0))return;let a=null,u=e;if("pointerType"in r){switch(r.pointerType){case"mouse":a=Wu.Mouse;break;case"touch":a=Wu.Touch;break;case"pen":a=Wu.Pen}a===Wu.Touch&&(Uu[e]===Uu.MouseDown?u="TouchStart":Uu[e]===Uu.MouseUp&&(u="TouchEnd"))}else Kc(r)&&(a=Wu.Touch);null!==a?(l=a,(u.startsWith("Touch")&&a===Wu.Touch||u.startsWith("Mouse")&&a===Wu.Mouse)&&(a=null)):Uu[e]===Uu.Click&&(a=l,l=null);const h=Kc(r)?r.changedTouches[0]:r;if(!h)return;const c=i.getId(o),{clientX:d,clientY:v}=h;fd(t)(he({type:Uu[u],id:c,x:d,y:v},null!==a&&{pointerType:a}))})(r);if(window.PointerEvent)switch(Uu[r]){case Uu.MouseDown:case Uu.MouseUp:o=o.replace("mouse","pointer");break;case Uu.TouchStart:case Uu.TouchEnd:return}a.push(Oc(o,u,e))}),fd(()=>{a.forEach(t=>t())})}(t)),a("scroll",()=>yd(t)),a("viewportResize",()=>function({viewportResizeCb:t},{win:e}){let i=-1,n=-1;return Oc("resize",fd(Bc(fd(()=>{const e=Wc(),s=Vc();i===e&&n===s||(t({width:Number(s),height:Number(e)}),i=e,n=s)}),200)),e)}(t,{win:i})),a("input",()=>function({inputCb:t,doc:e,mirror:i,blockClass:n,blockSelector:s,ignoreClass:r,ignoreSelector:o,maskInputOptions:a,maskInputFn:l,sampling:u,userTriggeredOnInput:h}){function c(t){let i=gd(t);const u=t.isTrusted,c=e.defaultView;if(i&&c&&!(i instanceof c.HTMLElement))return;const v=i&&i.tagName;if(i&&"OPTION"===v&&(i=ah.parentElement(i)),!i||!v||0>_d.indexOf(v)||Zc(i,n,s,!0))return;if(i.classList.contains(r)||o&&i.matches(o))return;let f=i.value,p=!1;const g=ic(i)||"";"radio"===g||"checkbox"===g?p=i.checked:(a[v.toLowerCase()]||a[g])&&(f=Kh({element:i,maskInputOptions:a,tagName:v,type:g,value:f,maskInputFn:l})),d(i,h?{text:f,isChecked:p,userTriggered:u}:{text:f,isChecked:p});const m=i.name;"radio"===g&&m&&p&&e.querySelectorAll(`input[type="radio"][name="${m}"]`).forEach(t=>{if(t!==i){const e=t.value;d(t,h?{text:e,isChecked:!p,userTriggered:!1}:{text:e,isChecked:!p})}})}function d(e,n){const s=wd.get(e);if(!s||s.text!==n.text||s.isChecked!==n.isChecked){wd.set(e,n);const s=i.getId(e);fd(t)(he(he({},n),{},{id:s}))}}const v=("last"===u.input?["change"]:["input","change"]).map(t=>Oc(t,fd(c),e)),f=e.defaultView;if(!f)return()=>{v.forEach(t=>t())};const p=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value");return p&&p.set&&v.push(...[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]].map(t=>Hc(t[0],t[1],{set(){fd(c)({target:this,isTrusted:!1})}},!1,f))),fd(()=>{Nc(v)})}(t)),a("mediaInteraction",()=>function({mediaInteractionCb:t,blockClass:e,blockSelector:i,mirror:n,sampling:s,doc:r}){const o=fd(r=>Bc(fd(s=>{const o=gd(s);if(!o||Zc(o,e,i,!0))return;const{currentTime:a,volume:l,muted:u,playbackRate:h,loop:c}=o;t({type:r,id:n.getId(o),currentTime:a,volume:l,muted:u,playbackRate:h,loop:c})}),s.media||500)),a=[Oc("play",o(Gu.Play),r),Oc("pause",o(Gu.Pause),r),Oc("seeked",o(Gu.Seeked),r),Oc("volumechange",o(Gu.VolumeChange),r),Oc("ratechange",o(Gu.RateChange),r)];return fd(()=>{a.forEach(t=>t())})}(t)),t.recordDOM){const e=function(t){const e=new Map,i=new Set;let n=!0;const s=t=>{if(n)try{t()}catch(t){}},r=t=>{var i;const n=e.get(t);if(n){for(;null===(i=n[0])||void 0===i?void 0:i.ready;){const t=n.shift();(null==t?void 0:t.emit)&&s(t.emit)}0===n.length&&e.delete(t)}};return{queueMutation(t,i){if(!t)return void s(i);const n=e.get(t);n?(n.push({emit:i,ready:!0}),r(t)):s(i)},queuePendingMutation(o,a,l){if(!n)return()=>{};let u=e.get(o);u||(u=[],e.set(o,u));const h={emit:a,ready:!1};u.push(h);let c,d=!1,v=!1;const f=()=>{d||v||(d=!0,void 0!==c&&i.delete(c),h.ready=!0,h.emit=void 0,r(o))};try{c=t.setTimeout(f,5e3),d||v?t.clearTimeout(c):i.add(c)}catch(t){f()}return e=>{!v&&n&&(v=!0,void 0!==c&&(t.clearTimeout(c),i.delete(c)),d?e&&s(l):(h.ready=!0,e||(h.emit=void 0),r(o)))}},reset(){n=!1,i.forEach(e=>t.clearTimeout(e)),i.clear(),e.clear()}}}(i);r.push(e.reset),a("styleSheet",()=>function({styleSheetRuleCb:t,mirror:e,stylesheetManager:i},{win:n,mutationQueue:s}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(r,{apply:fd((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=Sd(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,adds:[{rule:a,index:l}]})),l},"host")}),n.CSSStyleSheet.prototype.addRule=function(t,e,i=this.cssRules.length){return n.CSSStyleSheet.prototype.insertRule.apply(this,[`${t} { ${e} }`,i])};const o=n.CSSStyleSheet.prototype.deleteRule;let a,l;n.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:fd((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=Sd(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,removes:[{index:a}]})),l},"host")}),n.CSSStyleSheet.prototype.removeRule=function(t){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[t])},n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:fd((n,r,o)=>{const[a]=o,l=n.apply(r,o);try{const n=null==l?void 0:l.then;if(r.ownerNode||!l||"function"!=typeof n)return l;i.onCssomSheetMutation(r);const{id:o,styleId:u}=Sd(r,e,i.styleMirror);if(!(o&&-1!==o||u&&-1!==u))return l;const h=s.queuePendingMutation(r,()=>t({id:o,styleId:u,replace:a}),()=>{const e=Hh(r);null!==e&&t({id:o,styleId:u,replace:e})});try{n.call(l,()=>h(!0),()=>h(!1))}catch(t){h(!1)}}catch(t){}return l},"host")})),n.CSSStyleSheet.prototype.replaceSync&&(l=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:fd((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r);const{id:u,styleId:h}=Sd(r,e,i.styleMirror);return(u&&-1!==u||h&&-1!==h)&&s.queueMutation(r,()=>t({id:u,styleId:h,replaceSync:a})),l},"host")}));const u={};Id("CSSGroupingRule")?u.CSSGroupingRule=n.CSSGroupingRule:(Id("CSSMediaRule")&&(u.CSSMediaRule=n.CSSMediaRule),Id("CSSConditionRule")&&(u.CSSConditionRule=n.CSSConditionRule),Id("CSSSupportsRule")&&(u.CSSSupportsRule=n.CSSSupportsRule));const h={};return Object.entries(u).forEach(([n,r])=>{h[n]={insertRule:r.prototype.insertRule,deleteRule:r.prototype.deleteRule},r.prototype.insertRule=new Proxy(h[n].insertRule,{apply:fd((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=Sd(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...kd(r),l];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,adds:[{rule:a,index:e}]}))}return l},"host")}),r.prototype.deleteRule=new Proxy(h[n].deleteRule,{apply:fd((n,r,o)=>{const[a]=o,l=n.apply(r,o);i.onCssomSheetMutation(r.parentStyleSheet);const{id:u,styleId:h}=Sd(r.parentStyleSheet,e,i.styleMirror);if(r.parentStyleSheet&&(u&&-1!==u||h&&-1!==h)){const e=[...kd(r),a];s.queueMutation(r.parentStyleSheet,()=>t({id:u,styleId:h,removes:[{index:e}]}))}return l},"host")})}),fd(()=>{n.CSSStyleSheet.prototype.insertRule=r,n.CSSStyleSheet.prototype.deleteRule=o,a&&(n.CSSStyleSheet.prototype.replace=a),l&&(n.CSSStyleSheet.prototype.replaceSync=l),Object.entries(u).forEach(([t,e])=>{e.prototype.insertRule=h[t].insertRule,e.prototype.deleteRule=h[t].deleteRule})})}(t,{win:i,mutationQueue:e})),a("adoptedStyleSheet",()=>xd(t,t.doc)),a("styleDeclaration",()=>function({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:i,stylesheetManager:n},{win:s,mutationQueue:r}){const o=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:fd((s,o,a)=>{var l;const[u,h,c]=a,d=s.apply(o,a);if(i.has(u))return d;const v=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(v);const{id:f,styleId:p}=Sd(v,e,n.styleMirror);if(f&&-1!==f||p&&-1!==p){const e=kd(o.parentRule);r.queueMutation(v,()=>t({id:f,styleId:p,set:{property:u,value:h,priority:c},index:e}))}return d},"host")});const a=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:fd((s,o,a)=>{var l;const[u]=a,h=s.apply(o,a);if(i.has(u))return h;const c=null===(l=o.parentRule)||void 0===l?void 0:l.parentStyleSheet;n.onCssomSheetMutation(c);const{id:d,styleId:v}=Sd(c,e,n.styleMirror);if(d&&-1!==d||v&&-1!==v){const e=kd(o.parentRule);r.queueMutation(c,()=>t({id:d,styleId:v,remove:{property:u},index:e}))}return h},"host")}),fd(()=>{s.CSSStyleDeclaration.prototype.setProperty=o,s.CSSStyleDeclaration.prototype.removeProperty=a})}(t,{win:i,mutationQueue:e})),t.collectFonts&&a("font",()=>function({fontCb:t,doc:e}){const i=e.defaultView;if(!i)return()=>{};const n=[],s=new WeakMap,r=i.FontFace;i.FontFace=function(t,e,i){const n=new r(t,e,i);return s.set(n,{family:t,buffer:"string"!=typeof e,descriptors:i,fontSource:"string"==typeof e?e:JSON.stringify(Array.from(new Uint8Array(e)))}),n};const o=oh(e.fonts,"add",function(e){return function(i){return setTimeout(fd(()=>{const e=s.get(i);e&&(t(e),s.delete(i))}),0),e.apply(this,[i])}});return n.push(()=>{i.FontFace=r}),n.push(o),fd(()=>{n.forEach(t=>t())})}(t))}a("selection",()=>function(t){const{doc:e,mirror:i,blockClass:n,blockSelector:s,selectionCb:r}=t;let o=!0;const a=fd(()=>{const t=e.getSelection();if(!t||o&&(null==t?void 0:t.isCollapsed))return;o=t.isCollapsed||!1;const a=[],l=t.rangeCount||0;for(let e=0;l>e;e++){const{startContainer:r,startOffset:o,endContainer:l,endOffset:u}=t.getRangeAt(e);Zc(r,n,s,!0)||Zc(l,n,s,!0)||a.push({start:i.getId(r),startOffset:o,end:i.getId(l),endOffset:u})}r({ranges:a})});return a(),Oc("selectionchange",a)}(t)),a("customElement",()=>function({doc:t,customElementCb:e}){const i=t.defaultView;return i&&i.customElements?oh(i.customElements,"define",function(t){return function(i,n,s){try{e({define:{name:i}})}catch(t){console.warn(`Custom element callback failed for ${i}`)}return t.apply(this,[i,n,s])}}):()=>{}}(t));for(const e of t.plugins)a(`plugin:${e.name}`,()=>e.observer(e.callback,i,e.options))}catch(t){try{o()}catch(t){}throw t}return o}function Td(t){return void 0!==window[t]}function Id(t){return Boolean(void 0!==window[t]&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var Md=class{constructor(t){Oh(this,"generateIdFn",void 0),Oh(this,"iframeRemoteIdToLocalIdMap",new WeakMap),Oh(this,"iframeLocalIdToRemoteIdMap",new WeakMap),this.generateIdFn=t}getId(t,e,i,n){if(0>e)return e;const s=i||this.getRemoteIdToLocalIdMap(t),r=n||this.getLocalIdToRemoteIdMap(t);let o=s.get(e);return void 0===o&&(o=this.generateIdFn(),s.set(e,o),r.set(o,e)),o}getIds(t,e){const i=this.getRemoteIdToLocalIdMap(t),n=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getId(t,e,i,n))}getRemoteId(t,e,i){var n;return"number"!=typeof e||0>e?e:null!==(n=(i||this.getLocalIdToRemoteIdMap(t)).get(e))&&void 0!==n?n:-1}getRemoteIds(t,e){const i=this.getLocalIdToRemoteIdMap(t);return e.map(e=>this.getRemoteId(t,e,i))}reset(t){if(!t)return this.iframeRemoteIdToLocalIdMap=new WeakMap,void(this.iframeLocalIdToRemoteIdMap=new WeakMap);this.iframeRemoteIdToLocalIdMap.delete(t),this.iframeLocalIdToRemoteIdMap.delete(t)}getRemoteIdToLocalIdMap(t){let e=this.iframeRemoteIdToLocalIdMap.get(t);return e||(e=new Map,this.iframeRemoteIdToLocalIdMap.set(t,e)),e}getLocalIdToRemoteIdMap(t){let e=this.iframeLocalIdToRemoteIdMap.get(t);return e||(e=new Map,this.iframeLocalIdToRemoteIdMap.set(t,e)),e}},Ed=class{constructor(t){Oh(this,"iframes",new WeakMap),Oh(this,"crossOriginIframeMap",new WeakMap),Oh(this,"crossOriginIframeMirror",new Md(vc)),Oh(this,"crossOriginIframeStyleMirror",void 0),Oh(this,"crossOriginIframeRootIdMap",new WeakMap),Oh(this,"mirror",void 0),Oh(this,"mutationCb",void 0),Oh(this,"wrappedEmit",void 0),Oh(this,"loadListener",void 0),Oh(this,"pageHideListener",void 0),Oh(this,"stylesheetManager",void 0),Oh(this,"recordCrossOriginIframes",void 0),Oh(this,"messageHandler",void 0),Oh(this,"nestedIframeListeners",new Map),Oh(this,"attachedWindows",new WeakMap),Oh(this,"attachedDocuments",new WeakMap),Oh(this,"attachedIframes",new Map),Oh(this,"loadListenerDisposers",new WeakMap),Oh(this,"iframeElementsById",new Map),Oh(this,"pageHideHandlers",new WeakMap),this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new Md(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.messageHandler=this.handleMessage.bind(this),this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}registerLoadListenerDisposer(t,e){let i=this.loadListenerDisposers.get(t);i||(i=new Set,this.loadListenerDisposers.set(t,i)),i.add(e);const n=this.mirror.getId(t);-1!==n&&this.iframeElementsById.set(n,t)}getIframeElementById(t){var e,i,n;return null!==(e=null!==(i=null===(n=this.attachedIframes.get(t))||void 0===n?void 0:n.element)&&void 0!==i?i:this.iframeElementsById.get(t))&&void 0!==e?e:null}forgetIframeId(t){this.attachedIframes.delete(t),this.iframeElementsById.delete(t)}disposeLoadListeners(t){const e=this.loadListenerDisposers.get(t);e&&(e.forEach(t=>Lc(t)),this.loadListenerDisposers.delete(t))}removePageHideListener(t){const e=this.pageHideHandlers.get(t);e&&(e.forEach(({win:t,handler:e})=>{Dc(t,"pagehide",e)}),this.pageHideHandlers.delete(t))}addLoadListener(t){this.loadListener=t}addPageHideListener(t){this.pageHideListener=t}removeLoadListener(){this.loadListener=void 0}trackIframeContent(t,e){const i=this.mirror.getId(t);return this.attachedIframes.set(i,{element:t,content:e}),i}attachIframe(t,e){var i;const n=this.trackIframeContent(t,e);if(t.contentDocument){let e=this.attachedDocuments.get(t);e||(e=new Set,this.attachedDocuments.set(t,e)),e.add(t.contentDocument)}this.mutationCb({adds:[{parentId:n,nextId:null,node:e}],removes:[],texts:[],attributes:[],isAttachIframe:!0});const s=t.contentWindow;if(this.recordCrossOriginIframes&&s&&!this.nestedIframeListeners.has(s)){const e=this.handleMessage.bind(this);Lc(()=>{s.addEventListener("message",e),this.nestedIframeListeners.set(s,e);let i=this.attachedWindows.get(t);i||(i=new Set,this.attachedWindows.set(t,i)),i.add(s)})}Lc(()=>{const e=t.contentWindow;if(!e)return;let i=this.pageHideHandlers.get(t);if(i)for(const t of i)if(t.win===e)return;const n=()=>{var e;null===(e=this.pageHideListener)||void 0===e||e.call(this,t),t.contentDocument&&this.mirror.removeNodeFromMap(t.contentDocument)};e.addEventListener("pagehide",n),i||(i=new Set,this.pageHideHandlers.set(t,i)),i.add({win:e,handler:n})}),null===(i=this.loadListener)||void 0===i||i.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const e=t;if("rrweb"!==e.data.type||e.origin!==e.data.origin)return;if(!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const n=this.transformCrossOriginEvent(i,e.data.event);n&&this.wrappedEmit(n,e.data.isCheckout)}transformCrossOriginEvent(t,e){switch(e.type){case Hu.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(e.data.node,t);const i=e.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(e.data.node,i),this.trackIframeContent(t,e.data.node),{timestamp:e.timestamp,type:Hu.IncrementalSnapshot,data:{source:zu.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:e.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Hu.Meta:case Hu.Load:case Hu.DomContentLoaded:return!1;case Hu.Plugin:return e;case Hu.Custom:return this.replaceIds(e.data.payload,t,["id","parentId","previousId","nextId"]),e;case Hu.IncrementalSnapshot:switch(e.data.source){case zu.Mutation:return e.data.adds.forEach(e=>{this.replaceIds(e,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(e.node,t);const i=this.crossOriginIframeRootIdMap.get(t);i&&this.patchRootIdOnNode(e.node,i)}),e.data.removes.forEach(e=>{this.replaceIds(e,t,["parentId","id"])}),e.data.attributes.forEach(e=>{this.replaceIds(e,t,["id"])}),e.data.texts.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case zu.Drag:case zu.TouchMove:case zu.MouseMove:return e.data.positions.forEach(e=>{this.replaceIds(e,t,["id"])}),e;case zu.ViewportResize:return!1;case zu.MediaInteraction:case zu.MouseInteraction:case zu.Scroll:case zu.CanvasMutation:case zu.Input:return this.replaceIds(e.data,t,["id"]),e;case zu.StyleSheetRule:case zu.StyleDeclaration:return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleId"]),e;case zu.Font:return e;case zu.Selection:return e.data.ranges.forEach(e=>{this.replaceIds(e,t,["start","end"])}),e;case zu.AdoptedStyleSheet:var i;return this.replaceIds(e.data,t,["id"]),this.replaceStyleIds(e.data,t,["styleIds"]),null===(i=e.data.styles)||void 0===i||i.forEach(e=>{this.replaceStyleIds(e,t,["styleId"])}),e}}return!1}replace(t,e,i,n){for(const s of n)(Array.isArray(e[s])||"number"==typeof e[s])&&(e[s]=Array.isArray(e[s])?t.getIds(i,e[s]):t.getId(i,e[s]));return e}replaceIds(t,e,i){return this.replace(this.crossOriginIframeMirror,t,e,i)}replaceStyleIds(t,e,i){return this.replace(this.crossOriginIframeStyleMirror,t,e,i)}replaceIdOnNode(t,e){this.replaceIds(t,e,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(t=>{this.replaceIdOnNode(t,e)})}patchRootIdOnNode(t,e){t.type===Zu.Document||t.rootId||(t.rootId=e),"childNodes"in t&&t.childNodes.forEach(t=>{this.patchRootIdOnNode(t,e)})}removeIframeById(t){const e=this.attachedIframes.get(t),i=(null==e?void 0:e.element)||this.iframeElementsById.get(t)||this.mirror.getNode(t);if(this.iframeElementsById.delete(t),i){const t=i.contentWindow,e=this.attachedWindows.get(i);e&&(e.forEach(t=>{const e=this.nestedIframeListeners.get(t);e&&(Dc(t,"message",e),this.nestedIframeListeners.delete(t)),this.crossOriginIframeMap.delete(t)}),this.attachedWindows.delete(i)),t&&this.nestedIframeListeners.has(t)&&(Dc(t,"message",this.nestedIframeListeners.get(t)),this.nestedIframeListeners.delete(t)),t&&this.crossOriginIframeMap.delete(t),this.iframes.delete(i),this.disposeLoadListeners(i),this.removePageHideListener(i);const n=this.attachedDocuments.get(i);n&&(n.forEach(t=>{Lc(()=>this.mirror.removeNodeFromMap(t))}),Lc(()=>bd(i,n)),this.attachedDocuments.delete(i))}e&&this.attachedIframes.delete(t)}cleanupDetachedIframes(){if(0===this.attachedIframes.size)return;const t=[];this.attachedIframes.forEach((e,i)=>{this.mirror.has(i)||t.push(i)}),t.forEach(t=>this.removeIframeById(t))}reattachIframes(){this.attachedIframes.forEach(({content:t},e)=>{this.mirror.has(e)?this.mutationCb({adds:[{parentId:e,nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}):this.attachedIframes.delete(e)})}destroy(){this.recordCrossOriginIframes&&Dc(window,"message",this.messageHandler),this.nestedIframeListeners.forEach((t,e)=>{Dc(e,"message",t)}),this.nestedIframeListeners.clear();const t=new Set;this.iframeElementsById.forEach(e=>t.add(e)),this.attachedIframes.forEach(({element:e})=>t.add(e)),t.forEach(t=>{this.disposeLoadListeners(t),this.removePageHideListener(t)}),this.crossOriginIframeMirror.reset(),this.crossOriginIframeStyleMirror.reset(),this.attachedIframes.clear(),this.crossOriginIframeMap=new WeakMap,this.iframes=new WeakMap,this.crossOriginIframeRootIdMap=new WeakMap,this.loadListenerDisposers=new WeakMap,this.pageHideHandlers=new WeakMap,this.attachedDocuments=new WeakMap,this.attachedWindows=new WeakMap,this.iframeElementsById=new Map}},Pd=class{constructor(t){Oh(this,"shadowDoms",new WeakSet),Oh(this,"mutationCb",void 0),Oh(this,"scrollCb",void 0),Oh(this,"bypassOptions",void 0),Oh(this,"mirror",void 0),Oh(this,"restoreHandlers",[]),this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,e){var i,n;if(!Nh(t))return;if(this.shadowDoms.has(t))return;this.shadowDoms.add(t);const s=null!==(i=null===(n=ah.host(t))||void 0===n?void 0:n.ownerDocument)&&void 0!==i?i:e,{observer:r,buffer:o}=md(he(he({},this.bypassOptions),{},{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push({doc:s,handler(){r.disconnect(),o.destroy(),o.releaseCanvasManager();const t=pd.indexOf(o);-1!==t&&pd.splice(t,1)}}),this.restoreHandlers.push({doc:s,handler:yd(he(he({},this.bypassOptions),{},{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))}),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(ah.host(t))),this.restoreHandlers.push({doc:s,handler:xd({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t)})},0)}observeAttachShadow(t){t.contentWindow&&t.contentDocument&&this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,e){const i=this;this.restoreHandlers.push({doc:e,handler:oh(t.prototype,"attachShadow",function(t){return function(n){const s=t.call(this,n),r=ah.shadowRoot(this);return r&&nd(this)&&i.addShadowRoot(r,e),s}})})}reset(){this.restoreHandlers.forEach(({handler:t})=>{try{t()}catch(t){}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}resetForDoc(t){const e=[];for(const i of this.restoreHandlers)if(i.doc===t)try{i.handler()}catch(t){}else e.push(i);this.restoreHandlers=e}},Rd="skip-frame";function Ad(t){if("object"!=typeof t||null===t)return!1;const{x:e,y:i,width:n,height:s}=t;return Number.isFinite(e)&&Number.isFinite(i)&&Number.isFinite(n)&&Number.isFinite(s)&&n>=0&&s>=0}for(var Fd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Od="undefined"==typeof Uint8Array?[]:new Uint8Array(256),Dd=0;64>Dd;Dd++)Od[Fd.charCodeAt(Dd)]=Dd;var Ld=function(t){var e,i=new Uint8Array(t),n=i.length,s="";for(e=0;n>e;e+=3)s+=Fd[i[e]>>2],s+=Fd[(3&i[e])<<4|i[e+1]>>4],s+=Fd[(15&i[e+1])<<2|i[e+2]>>6],s+=Fd[63&i[e+2]];return n%3==2?s=s.substring(0,s.length-1)+"=":n%3==1&&(s=s.substring(0,s.length-2)+"=="),s},Nd=!1,qd=new Map,jd=(t,e,i)=>{if(!t||!zd(t,e)&&"object"!=typeof t)return;const n=function(t,e){let i=qd.get(t);return i||(i=new Map,qd.set(t,i)),i.has(e)||i.set(e,[]),i.get(e)}(i,t.constructor.name);let s=n.indexOf(t);return-1===s&&(s=n.length,n.push(t)),s};function Bd(t,e,i,n){if(t instanceof Array)return t.map(t=>Bd(t,e,i,n));if(null===t)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer)return{rr_type:t.constructor.name,base64:Ld(t)};if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Bd(t.buffer,e,i,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const e=t.constructor.name,{src:i}=t;return{rr_type:e,src:i}}if(t instanceof HTMLCanvasElement){const e="HTMLImageElement";let i;try{i=t.toDataURL(n.type,n.quality)}catch(t){throw function(t){"SecurityError"===(null==t?void 0:t.name)?Nd||(Nd=!0,console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read. A cross-origin image or video drawn into it taints it.",t)):console.warn("[replay] canvas capture: skipping a canvas draw because its pixels cannot be read.",t)}(t),t}return{rr_type:e,src:i}}return t instanceof ImageData?{rr_type:t.constructor.name,args:[Bd(t.data,e,i,n),t.width,t.height]}:zd(t,e)||"object"==typeof t?{rr_type:t.constructor.name,index:jd(t,e,i)}:t}var Hd=(t,e,i,n)=>t.map(t=>Bd(t,e,i,n)),zd=(t,e)=>{const i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(t=>"function"==typeof e[t]);return Boolean(i.find(i=>t instanceof e[i]))},Ud=["webgl","webgl2"];function Wd(t){return"nodeType"in t}function Vd(t,e,i,n){const s=[];try{if(n){const n=function(t,e,i){const n=t.GPUCanvasContext;if((null==n?void 0:n.prototype)&&"function"==typeof n.prototype.configure)return oh(n.prototype,"configure",function(n){return function(s){const r=function(t){const{canvas:e}=t;return e&&"object"==typeof e?e:null}(this);if(!r||Wd(r)&&Zc(r,e,i,!0))return n.call(this,s);Wd(r)&&!("__context"in r)&&(r.__context="webgpu");const o=function(t){const e=t.GPUTextureUsage;return e?e.COPY_SRC|e.RENDER_ATTACHMENT:null}(t);return n.call(this,null!==o&&s?he(he({},s),{},{usage:"number"==typeof s.usage?s.usage|o:o}):s)}})}(t,e,i);n&&s.push(n)}const r=oh(t.HTMLCanvasElement.prototype,"getContext",function(t){return function(s,...r){const o=function(t){return"experimental-webgl"===t?"webgl":t}(s);if(!Zc(this,e,i,!0)&&("__context"in this||(this.__context=o),n&&Ud.includes(o)))if(r[0]&&"object"==typeof r[0]){const t=r[0];t.preserveDrawingBuffer||(t.preserveDrawingBuffer=!0)}else r.splice(0,1,{preserveDrawingBuffer:!0});return t.apply(this,[s,...r])}});s.push(r)}catch(t){console.warn("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach(t=>t())}}function Gd(t,e,i,n,s,r,o){const a=[],l=Object.getOwnPropertyNames(t);for(const u of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if("function"!=typeof t[u])continue;const l=oh(t,u,function(t){return function(...a){const l=t.apply(this,a);if(jd(l,r,this),this.canvas&&"tagName"in this.canvas&&!Zc(this.canvas,n,s,!0)){let t;try{t=Hd(a,r,this,o)}catch(t){}t&&i(this.canvas,{type:e,property:u,args:t})}return l}});a.push(l)}catch(r){const o=Hc(t,u,{set(t){this.canvas&&"tagName"in this.canvas&&!Zc(this.canvas,n,s,!0)&&i(this.canvas,{type:e,property:u,args:[t],setter:!0})}});a.push(o)}return a}var Zd='(function() {\n\t//#region ../../../../../../setup-pnpm/node_modules/.bin/store/v11/links/@/base64-arraybuffer/1.0.2/f63fa6b5c318cf1c9f6bdd1d4292ad2f15f76f2ec78475025a2d44070e896fe9/node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js\n\tvar chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";\n\tvar lookup = typeof Uint8Array === "undefined" ? [] : /* @__PURE__ */ new Uint8Array(256);\n\tfor (var i = 0; i < chars.length; i++) lookup[chars.charCodeAt(i)] = i;\n\tvar encode = function(arraybuffer) {\n\t\tvar bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";\n\t\tfor (i = 0; i < len; i += 3) {\n\t\t\tbase64 += chars[bytes[i] >> 2];\n\t\t\tbase64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];\n\t\t\tbase64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];\n\t\t\tbase64 += chars[bytes[i + 2] & 63];\n\t\t}\n\t\tif (len % 3 === 2) base64 = base64.substring(0, base64.length - 1) + "=";\n\t\telse if (len % 3 === 1) base64 = base64.substring(0, base64.length - 2) + "==";\n\t\treturn base64;\n\t};\n\t//#endregion\n\t//#region ../rrweb/src/record/workers/image-bitmap-data-url-worker.ts\n\tconst lastFingerprintMap = /* @__PURE__ */ new Map();\n\tconst transparentFingerprintMap = /* @__PURE__ */ new Map();\n\tconst lastSentAtMap = /* @__PURE__ */ new Map();\n\tconst PROVIDER_KEYFRAME_INTERVAL_MS = 3e4;\n\tfunction hashPixels(data) {\n\t\tconst view = new Uint32Array(data.buffer, data.byteOffset, data.byteLength >>> 2);\n\t\tlet primaryHash = 2166136261;\n\t\tlet secondaryHash = 2654435769;\n\t\tfor (let i = 0; i < view.length; i++) {\n\t\t\tprimaryHash ^= view[i];\n\t\t\tprimaryHash = Math.imul(primaryHash, 16777619);\n\t\t\tsecondaryHash ^= view[i];\n\t\t\tsecondaryHash = Math.imul(secondaryHash, 2246822507);\n\t\t}\n\t\treturn `${(primaryHash >>> 0).toString(16)}:${(secondaryHash >>> 0).toString(16)}`;\n\t}\n\tfunction frameFingerprint(width, height, data) {\n\t\treturn `${width}x${height}:${hashPixels(data)}`;\n\t}\n\tfunction transparentFingerprint(width, height) {\n\t\tconst pixelCount = width * height;\n\t\tlet hash = transparentFingerprintMap.get(pixelCount);\n\t\tif (hash === void 0) {\n\t\t\thash = hashPixels(new Uint8ClampedArray(pixelCount * 4));\n\t\t\ttransparentFingerprintMap.set(pixelCount, hash);\n\t\t}\n\t\treturn `${width}x${height}:${hash}`;\n\t}\n\tconst worker = self;\n\tlet reusableCanvas = null;\n\tlet reusableCtx = null;\n\tworker.onmessage = async function(e) {\n\t\tif ("resetFrameDedup" in e.data) {\n\t\t\tlastFingerprintMap.clear();\n\t\t\treturn;\n\t\t}\n\t\tif ("OffscreenCanvas" in globalThis) {\n\t\t\tconst { id, bitmap, width, height, displayWidth, displayHeight, dataURLOptions, maskRegions } = e.data;\n\t\t\ttry {\n\t\t\t\tif (!reusableCanvas || reusableCanvas.width !== width || reusableCanvas.height !== height) {\n\t\t\t\t\treusableCanvas = new OffscreenCanvas(width, height);\n\t\t\t\t\treusableCtx = reusableCanvas.getContext("2d", { willReadFrequently: true });\n\t\t\t\t}\n\t\t\t\tconst ctx = reusableCtx;\n\t\t\t\tctx.clearRect(0, 0, width, height);\n\t\t\t\tctx.drawImage(bitmap, 0, 0);\n\t\t\t\tbitmap.close();\n\t\t\t\tif (maskRegions) {\n\t\t\t\t\tctx.fillStyle = "black";\n\t\t\t\t\tfor (const region of maskRegions) ctx.fillRect(region.x, region.y, region.width, region.height);\n\t\t\t\t}\n\t\t\t\tconst fingerprint = frameFingerprint(width, height, ctx.getImageData(0, 0, width, height).data);\n\t\t\t\tif (fingerprint === (lastFingerprintMap.get(id) ?? transparentFingerprint(width, height))) {\n\t\t\t\t\tconst lastSentAt = lastSentAtMap.get(id);\n\t\t\t\t\tif (!(maskRegions !== void 0 && lastSentAt !== void 0 && Date.now() - lastSentAt >= PROVIDER_KEYFRAME_INTERVAL_MS)) return worker.postMessage({ id });\n\t\t\t\t}\n\t\t\t\tconst blob = await reusableCanvas.convertToBlob(dataURLOptions);\n\t\t\t\tconst arrayBuffer = await blob.arrayBuffer();\n\t\t\t\tworker.postMessage({\n\t\t\t\t\tid,\n\t\t\t\t\ttype: blob.type,\n\t\t\t\t\tbase64: encode(arrayBuffer),\n\t\t\t\t\tdisplayWidth,\n\t\t\t\t\tdisplayHeight\n\t\t\t\t});\n\t\t\t\tlastFingerprintMap.set(id, fingerprint);\n\t\t\t\tlastSentAtMap.set(id, Date.now());\n\t\t\t} catch {\n\t\t\t\tworker.postMessage({ id });\n\t\t\t}\n\t\t} else {\n\t\t\te.data.bitmap.close();\n\t\t\treturn worker.postMessage({ id: e.data.id });\n\t\t}\n\t};\n\t//#endregion\n})();\n',Qd="undefined"!=typeof self&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",Zd],{type:"text/javascript;charset=utf-8"});function Jd(t){let e;try{if(e=Qd&&(self.URL||self.webkitURL).createObjectURL(Qd),!e)throw"";const i=new Worker(e,{name:null==t?void 0:t.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),i}catch(e){return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(Zd),{name:null==t?void 0:t.name})}}var Kd="A page CSP that omits blob: from worker-src or script-src blocks it";function Xd(t,...e){console.warn(`[replay] canvas capture: ${t}`,...e)}var Yd,tv,ev,iv=class{onFullSnapshot(){var t;null===(t=this.resetFrameDedup)||void 0===t||t.call(this)}acquire(){this.refCount+=1}reset(){this.refCount>0&&(this.refCount-=1),this.refCount>0||this.teardown()}teardown(){this.torndown||(this.torndown=!0,this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers(),null!==this.rafIdTimestamp&&(cancelAnimationFrame(this.rafIdTimestamp),this.rafIdTimestamp=null),null!==this.rafIdFlush&&(cancelAnimationFrame(this.rafIdFlush),this.rafIdFlush=null))}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(t){Oh(this,"pendingCanvasMutations",new Map),Oh(this,"rafStamps",{latestId:0,invokeId:null}),Oh(this,"mirror",void 0),Oh(this,"mutationCb",void 0),Oh(this,"resetObservers",void 0),Oh(this,"frozen",!1),Oh(this,"locked",!1),Oh(this,"rafIdTimestamp",null),Oh(this,"rafIdFlush",null),Oh(this,"refCount",0),Oh(this,"torndown",!1),Oh(this,"resetFrameDedup",null),Oh(this,"processMutation",(t,e)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(t)||this.pendingCanvasMutations.set(t,[]),this.pendingCanvasMutations.get(t).push(e)});const{sampling:e="all",win:i,blockClass:n,blockSelector:s,recordCanvas:r,dataURLOptions:o,resolutionScale:a,canvasMasking:l}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,r&&"all"===e&&this.initCanvasMutationObserver(i,n,s,o),r&&"number"==typeof e&&this.initCanvasFPSObserver(e,i,n,s,{dataURLOptions:o,resolutionScale:a,canvasMasking:l})}initCanvasFPSObserver(t,e,i,n,s){var r=this;if(!("OffscreenCanvas"in e))return void Xd("disabled because this browser does not support OffscreenCanvas");const o="number"==typeof s.resolutionScale&&Number.isFinite(s.resolutionScale)?Math.min(1,Math.max(.1,s.resolutionScale)):1,a=Vd(e,i,n,!0),l=new Map;let u;try{u=new Jd}catch(t){return Xd(`disabled because the encode worker did not start. ${Kd}`,t),void a()}let h=!1;u.onerror=t=>{var e;h=!0,Xd(`stopped because the encode worker failed. ${Kd}`,t),cancelAnimationFrame(f),null===(e=u.terminate)||void 0===e||e.call(u),this.resetFrameDedup=null},this.resetFrameDedup=()=>{u.postMessage({resetFrameDedup:!0})},u.onmessage=t=>{const{id:e}=t.data;if(l.set(e,!1),!("base64"in t.data))return;const{base64:i,type:n,displayWidth:s,displayHeight:r}=t.data;this.mutationCb({id:e,type:Vu["2D"],commands:[{property:"clearRect",args:[0,0,s,r]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:n}]},0,0,s,r]}],displayWidth:s,displayHeight:r})};let c=!1,d=!1;const v=1e3/t;let f,p=0;const g=t=>{var a;h||(p&&v>t-p||(p=t,(()=>{const t=[],s=e=>{try{e.querySelectorAll("canvas").forEach(e=>{Zc(e,i,n,!0)||t.push(e)}),e.querySelectorAll("*").forEach(t=>{t.shadowRoot&&s(t.shadowRoot)})}catch(t){}};return s(e.document),t})().forEach((a=oe(function*(t){const e=r.mirror.getId(t);if(-1!==e&&!l.get(e)&&0!==t.width&&0!==t.height){l.set(e,!0);try{if(["webgl","webgl2"].includes(t.__context)){var i,n;const s=t.getContext(t.__context);if(null==s||null===(i=s.isContextLost)||void 0===i?void 0:i.call(s))return void l.set(e,!1);!1===(null==s||null===(n=s.getContextAttributes())||void 0===n?void 0:n.preserveDrawingBuffer)&&s.clear(s.COLOR_BUFFER_BIT)}const r=t.clientWidth||t.width,a=t.clientHeight||t.height,h=Math.max(1,Math.round(r*o)),d=Math.max(1,Math.round(a*o)),v=function(t,e,i,n,s,r){if(!t||"function"!=typeof t.regionsFn)return;let o;try{o=t.regionsFn(e)}catch(t){return Rd}if(void 0===o)return;if(!Array.isArray(o)||!o.every(Ad))return Rd;const a=i/s,l=n/r;return o.filter(t=>t.width>0&&t.height>0).map(t=>{const e=Math.floor(t.x*a),i=Math.floor(t.y*l);return{x:e,y:i,width:Math.ceil((t.x+t.width)*a)-e,height:Math.ceil((t.y+t.height)*l)-i}})}(s.canvasMasking,t,h,d,r,a);if("skip-frame"===v)return c||(c=!0,Xd("dropped a frame because the mask provider did not return valid regions. A provider that always fails records no canvas frames at all")),void l.set(e,!1);const f=yield createImageBitmap(t,1>o?{resizeWidth:h,resizeHeight:d,resizeQuality:"medium"}:{resizeWidth:h,resizeHeight:d});u.postMessage({id:e,bitmap:f,width:h,height:d,displayWidth:r,displayHeight:a,dataURLOptions:s.dataURLOptions,maskRegions:v},[f])}catch(t){d||(d=!0,Xd("dropped a frame because the snapshot failed. A canvas that fails every frame records no canvas frames at all",t)),l.set(e,!1)}}}),function(t){return a.apply(this,arguments)}))),f=requestAnimationFrame(g))};f=requestAnimationFrame(g),this.resetObservers=()=>{var t;a(),cancelAnimationFrame(f),null===(t=u.terminate)||void 0===t||t.call(u),this.resetFrameDedup=null}}initCanvasMutationObserver(t,e,i,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=Vd(t,e,i,!1),r=function(t,e,i,n,s){const r=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const a of o)try{if("function"!=typeof e.CanvasRenderingContext2D.prototype[a])continue;const o=oh(e.CanvasRenderingContext2D.prototype,a,function(r){return function(...o){return Zc(this.canvas,i,n,!0)||setTimeout(()=>{let i;try{i=Hd(o,e,this,s)}catch(t){return}t(this.canvas,{type:Vu["2D"],property:a,args:i})},0),r.apply(this,o)}});r.push(o)}catch(s){const o=Hc(e.CanvasRenderingContext2D.prototype,a,{set(e){Zc(this.canvas,i,n,!0)||t(this.canvas,{type:Vu["2D"],property:a,args:[e],setter:!0})}});r.push(o)}return()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n),o=function(t,e,i,n,s){const r=[];return void 0!==e.WebGLRenderingContext&&r.push(...Gd(e.WebGLRenderingContext.prototype,Vu.WebGL,t,i,n,e,s)),void 0!==e.WebGL2RenderingContext&&r.push(...Gd(e.WebGL2RenderingContext.prototype,Vu.WebGL2,t,i,n,e,s)),()=>{r.forEach(t=>t())}}(this.processMutation.bind(this),t,e,i,n);this.resetObservers=()=>{s(),r(),o()}}startPendingCanvasMutationFlusher(){this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=e=>{this.rafStamps.latestId=e,this.rafIdTimestamp=requestAnimationFrame(t)};this.rafIdTimestamp=requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,e)=>{const i=this.mirror.getId(e);this.flushPendingCanvasMutationFor(e,i)}),this.rafIdFlush=requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,e){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(t);if(!i||-1===e)return;const n=i.map(t=>bs(t,Bu)),{type:s}=i[0];this.mutationCb({id:e,type:s,commands:n}),this.pendingCanvasMutations.delete(t)}},nv=class{constructor(t){var e;Oh(this,"trackedLinkElements",new WeakSet),Oh(this,"pendingDeferredSheets",new Set),Oh(this,"mutationCb",void 0),Oh(this,"adoptedStyleSheetCb",void 0),Oh(this,"maskAllElementAttributes",void 0),Oh(this,"maskAttributeFn",void 0),Oh(this,"styleMirror",new ed),this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb,this.maskAllElementAttributes=null!==(e=t.maskAllElementAttributes)&&void 0!==e&&e,this.maskAttributeFn=t.maskAttributeFn}attachLinkElement(t,e){"_cssText"in e.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e.id,attributes:e.attributes}]}),this.trackLinkElement(t)}beginDeferredLinkInlining(t,e){if(-1===e||!t.isConnected)return null;let i=null,n=null;try{n=t.sheet,n&&(i=Qh(n))}catch(t){}if(!i||!n)return Rh(),null;const s=i;let r=!1;const o={sheet:n,invalidate(){r=!0}};this.pendingDeferredSheets.add(o);let a=!1;return{advance:i=>{if(a)return!0;const l=lh(),u=ch();let h=!0;try{if(r)return a=!0,Rh(),!0;if(!s.advance(i))return h=!1,!1;a=!0;const o=s.text();if(!t.isConnected)return!0;let l=null;try{l=t.sheet}catch(t){}return l!==n?(Rh(),!0):o?(this.emitCssTextMutation(t,e,o),!0):(Rh(),!0)}finally{h&&this.pendingDeferredSheets.delete(o),dh(c=lh()-l,null!=(d=u)?d:uh)||(Sh.totalMs+=c,c>Sh.slowestSliceMs&&(Sh.slowestSliceMs=c))}var c,d},remainingRules:()=>s.remainingRules(),discard:()=>{this.pendingDeferredSheets.delete(o)}}}onCssomSheetMutation(t){if(t&&0!==this.pendingDeferredSheets.size)for(const e of this.pendingDeferredSheets)e.sheet===t&&(this.pendingDeferredSheets.delete(e),e.invalidate())}inlineDeferredLinkElement(t,e){var i;null===(i=this.beginDeferredLinkInlining(t,e))||void 0===i||i.advance(1/0)}emitCssTextMutation(t,e,i){this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:e,attributes:{_cssText:tc({element:t,name:"_cssText",value:i,maskAllElementAttributes:this.maskAllElementAttributes,maskAttributeFn:this.maskAttributeFn})}}]})}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,e){if(0===t.length)return;const i={id:e,styleIds:[]},n=[];for(const e of t){let t;if(this.styleMirror.has(e))t=this.styleMirror.getId(e);else{const i=this.styleMirror.add(e);t=i;const s=lh();try{Ih(()=>{try{const t=e.rules||e.cssRules;t&&Th(t)}catch(t){}n.push({styleId:i,rules:Array.from(e.rules||CSSRule,(t,i)=>({rule:zh(t,e.href),index:i}))})})}finally{Mh(lh()-s)}}i.styleIds.push(t)}n.length>0&&(i.styles=n),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet,this.pendingDeferredSheets.clear(),Tc.forEach(t=>t.abort()),Tc.clear()}trackStylesheetInLinkElement(t){}},sv=class{constructor(){Oh(this,"nodeMap",new WeakMap),Oh(this,"active",!1)}inOtherBuffer(t,e){const i=this.nodeMap.get(t);return i&&Array.from(i).some(t=>t!==e)}add(t,e){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(e))}destroy(){}},rv=!1;try{if(2!==Array.from([1],t=>2*t)[0]){var ov;const t=document.createElement("iframe");document.body.appendChild(t),Array.from=(null===(ov=t.contentWindow)||void 0===ov?void 0:ov.Array.from)||Array.from,document.body.removeChild(t)}}catch(t){console.debug("Unable to override Array.from",t)}var av=new Jh,lv=new Set([zu.Mutation,zu.MediaInteraction,zu.StyleSheetRule,zu.CanvasMutation,zu.Font,zu.Log,zu.StyleDeclaration,zu.AdoptedStyleSheet]);function uv(t){const e=window;if("function"==typeof e.requestIdleCallback){const i=e.requestIdleCallback(t,{timeout:2e3});return{cancel(){var t;return null===(t=e.cancelIdleCallback)||void 0===t?void 0:t.call(e,i)}}}const i=setTimeout(t,250);return{cancel:()=>clearTimeout(i)}}function hv(t={}){let e;const{emit:i,checkoutEveryNms:n,checkoutEveryNth:s,blockClass:r="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:u="rr-mask",maskTextSelector:h=null,inlineStylesheet:c=!0,inlineStylesheetBudgetRules:d,maskAllInputs:v,maskInputOptions:f,slimDOMOptions:p,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y=!1,maskAttributeFn:b,hooks:_,packFn:w,sampling:k={},dataURLOptions:S={},canvasResolutionScale:x,canvasMasking:C,mousemoveWait:T,recordDOM:I=!0,recordCanvas:M=!1,recordCrossOriginIframes:E=!1,recordAfter:P=("DOMContentLoaded"===t.recordAfter?t.recordAfter:"load"),userTriggeredOnInput:R=!1,collectFonts:A=!1,inlineImages:F=!1,plugins:O,keepIframeSrcFn:D=()=>!1,ignoreCSSAttributes:L=new Set([]),attributeFilter:N,errorHandler:q}=t;dd(q);const j=he({type:"image/webp",quality:.4,maxBase64ImageLength:1048576},S),B=!E||window.parent===window;let H=!1;if(!B)try{window.parent.document&&(H=!1)}catch(t){H=!0}if(B&&!i)throw new Error("emit function is required");if(!B&&!H)return()=>{};void 0!==T&&void 0===k.mousemove&&(k.mousemove=T),av.reset();const z=!0===v?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==f?f:{password:!0},U=Ac(void 0!==p&&p);let W;!function(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=[].forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=[].forEach)}();let V=0;const G=new Map;let Z,Q;const J=t=>{for(const e of O||[])e.eventProcessor&&(t=e.eventProcessor(t));return w&&!H&&(t=w(t)),t};Yd=(t,e)=>{var r;const o=t;if(o.timestamp=zc(),!(null===(r=pd[0])||void 0===r?void 0:r.isFrozen())||o.type===Hu.FullSnapshot||o.type===Hu.IncrementalSnapshot&&lv.has(o.data.source)||pd.forEach(t=>t.unfreeze()),B)null==i||i(J(o),e);else if(H){const t={type:"rrweb",event:J(o),origin:window.location.origin,isCheckout:e};window.parent.postMessage(t,"*")}if(o.type===Hu.FullSnapshot)W=o,V=0;else if(o.type===Hu.IncrementalSnapshot){if(o.data.source===zu.Mutation&&o.data.isAttachIframe)return;V++,(s&&V>=s||n&&o.timestamp-W.timestamp>n)&&tv(!0)}};const K=t=>{if(t.removes&&t.removes.length>0){const e=t.adds.length>0?new Set(t.adds.map(t=>t.node.id)):null,i=new Set;if(t.adds.length>0)for(const e of t.adds){const t=av.getNode(e.node.id);t&&"IFRAME"===t.nodeName&&i.add(t)}t.removes.forEach(({id:t})=>{if(e&&e.has(t))return;const n=et.getIframeElementById(t);n&&i.has(n)?et.forgetIframeId(t):(null==Z||Z(t),et.removeIframeById(t))}),null==Q||Q(),et.cleanupDetachedIframes()}Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.Mutation},t)})},X=t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.Scroll},t)}),Y=t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.CanvasMutation},t)}),tt=new nv({mutationCb:K,adoptedStyleSheetCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.AdoptedStyleSheet},t)}),maskAllElementAttributes:y,maskAttributeFn:b}),et=new Ed({mirror:av,mutationCb:K,stylesheetManager:tt,recordCrossOriginIframes:E,wrappedEmit:Yd});for(const t of O||[])t.getMirror&&t.getMirror({nodeMirror:av,crossOriginIframeMirror:et.crossOriginIframeMirror,crossOriginIframeStyleMirror:et.crossOriginIframeStyleMirror});const it=new sv,nt=null==C?void 0:C.configured;ev=new iv({recordCanvas:M,mutationCb:Y,win:window,blockClass:r,blockSelector:o,mirror:av,sampling:k.canvas,dataURLOptions:j,resolutionScale:x,canvasMasking:C});const st=new Pd({mutationCb:K,scrollCb:X,bypassOptions:{blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskInputOptions:z,dataURLOptions:j,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:b,recordCanvas:M,canvasMaskingConfigured:nt,inlineImages:F,sampling:k,slimDOMOptions:U,iframeManager:et,stylesheetManager:tt,canvasManager:ev,keepIframeSrcFn:D,processedNodeManager:it,attributeFilter:N},mirror:av});tv=(t=!1)=>{if(I){xh(d);try{Yd({type:Hu.Meta,data:{href:window.location.href,width:Vc(),height:Wc()}},t),null==e||e.cancel(),e=void 0,tt.reset(),st.init(),pd.forEach(t=>t.lock());let i=null,n=[];try{i=function(t,e){const{mirror:i=new Jh,blockClass:n="rr-block",blockSelector:s=null,maskTextClass:r="rr-mask",maskTextSelector:o=null,inlineStylesheet:a=!0,inlineImages:l=!1,recordCanvas:u=!1,canvasMaskingConfigured:h,maskAllInputs:c=!1,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f=!1,maskAttributeFn:p,slimDOM:g=!1,dataURLOptions:m,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:_,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C=()=>!1,maxDepth:T,inlineStylesheetBudgetRules:I}=e||{},M=!0===c?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===c?{password:!0}:c,E=Ac(g);xh(I);try{return Rc(t,{doc:t,mirror:i,blockClass:n,blockSelector:s,maskTextClass:r,maskTextSelector:o,skipChild:!1,inlineStylesheet:a,maskInputOptions:M,maskTextFn:d,maskInputFn:v,maskAllElementAttributes:f,maskAttributeFn:p,slimDOMOptions:E,dataURLOptions:m,inlineImages:l,recordCanvas:u,canvasMaskingConfigured:h,preserveWhiteSpace:y,onSerialize:b,onIframeLoad:_,iframeLoadTimeout:w,onIframeListenerRegistered:k,onStylesheetLoad:S,stylesheetLoadTimeout:x,keepIframeSrcFn:C,newlyAddedElement:!1,maxDepth:T})}finally{Ch()}}(document,{mirror:av,blockClass:r,blockSelector:o,maskTextClass:u,maskTextSelector:h,inlineStylesheet:c,maskAllInputs:z,inlineStylesheetBudgetRules:d,maskTextFn:m,maskInputFn:g,maskAllElementAttributes:y,maskAttributeFn:b,slimDOM:U,dataURLOptions:j,recordCanvas:M,canvasMaskingConfigured:nt,inlineImages:F,onSerialize(t){Xc(t,av)&&et.addIframe(t),Yc(t,av)&&tt.trackLinkElement(t),td(t)&&st.addShadowRoot(ah.shadowRoot(t),document)},onIframeLoad(t,e){et.attachIframe(t,e),st.observeAttachShadow(t)},onIframeListenerRegistered(t,e){et.registerLoadListenerDisposer(t,e)},onStylesheetLoad(t,e){tt.attachLinkElement(t,e)},keepIframeSrcFn:D})}finally{n=Ph()}if(!i)return console.warn("Failed to snapshot the document");if(Yd({type:Hu.FullSnapshot,data:{node:i,initialOffset:Uc(window)}},t),pd.forEach(t=>t.unlock()),ev.onFullSnapshot(),n.length){const t=function(t,e,i){let n=!1,s=null,r=0,o=null;const a=()=>null!==o||t.length>r,l=()=>{const i=t[r];t[r]=null,r+=1,i&&Lc(()=>{o=e.beginDeferredLinkInlining(i,av.getId(i))})},u=()=>{if(!o)return;const t=o;let e=!0;Lc(()=>{e=t.advance(200)}),e&&(o=null)},h=()=>{o||l(),u()},c=t=>{if(s=null,n)return;let e=0;do{try{h()}catch(t){null==o||o.discard(),o=null,Ah(1)}e+=1}while(!n&&a()&&(t?!t.didTimeout&&t.timeRemaining()>5:10>e));n||(a()?s=uv(c):i())};return s=uv(c),{cancel(){n=!0,null==o||o.discard(),o=null,null==s||s.cancel(),s=null},flush(){if(n)return;n=!0,null==s||s.cancel(),s=null;let e=0,h=0;for(;a()&&50>e;){o||l();const t=o;if(t)if(Math.floor(t.remainingRules()/200)+1>50-e)t.discard(),o=null,h+=1;else{try{u()}catch(t){null==o||o.discard(),o=null,h+=1}e+=1}}if(a()||h>0){let e=h+(null!==o?1:0);for(let i=r;t.length>i;i++)null!==t[i]&&(e+=1);Ah(e),null==o||o.discard(),o=null}i()}}}(n,tt,()=>{e===t&&(e=void 0)});e=t}E&&et.reattachIframes(),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&tt.adoptStyleSheets(document.adoptedStyleSheets,av.getId(document))}finally{Ch()}}};try{const t=[];t.push(Oc("pagehide",()=>{try{null==e||e.flush()}catch(t){}e=void 0},window));for(const e of["visibilitychange","freeze","resume"])t.push(Oc(e,hh,document));Z=e=>{const i=G.get(e);i&&(i.forEach(e=>{Lc(e);const i=t.indexOf(e);-1!==i&&t.splice(i,1)}),G.delete(e))},Q=()=>{for(const[t]of G){const e=av.getNode(t);if(e)try{e.contentDocument&&e.contentDocument.defaultView||null==Z||Z(t)}catch(e){null==Z||Z(t)}else null==Z||Z(t)}};const i=t=>{var e;return fd($d)({mutationCb:K,mousemoveCb:(t,e)=>Yd({type:Hu.IncrementalSnapshot,data:{source:e,positions:t}}),mouseInteractionCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.MouseInteraction},t)}),scrollCb:X,viewportResizeCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.ViewportResize},t)}),inputCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.Input},t)}),mediaInteractionCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.MediaInteraction},t)}),styleSheetRuleCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.StyleSheetRule},t)}),styleDeclarationCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.StyleDeclaration},t)}),canvasMutationCb:Y,fontCb:t=>Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.Font},t)}),selectionCb(t){Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.Selection},t)})},customElementCb(t){Yd({type:Hu.IncrementalSnapshot,data:he({source:zu.CustomElement},t)})},blockClass:r,ignoreClass:a,ignoreSelector:l,maskTextClass:u,maskTextSelector:h,maskInputOptions:z,inlineStylesheet:c,sampling:k,recordDOM:I,recordCanvas:M,canvasMaskingConfigured:nt,inlineImages:F,userTriggeredOnInput:R,collectFonts:A,doc:t,maskInputFn:g,maskTextFn:m,maskAllElementAttributes:y,maskAttributeFn:b,keepIframeSrcFn:D,blockSelector:o,slimDOMOptions:U,dataURLOptions:j,mirror:av,iframeManager:et,stylesheetManager:tt,shadowDomManager:st,processedNodeManager:it,canvasManager:ev,ignoreCSSAttributes:L,attributeFilter:N,plugins:(null==O||null===(e=O.filter(t=>t.observer))||void 0===e?void 0:e.map(t=>({name:t.name,observer:t.observer,options:t.options,callback:e=>Yd({type:Hu.Plugin,data:{plugin:t.name,payload:e}})})))||[]},_)};et.addLoadListener(e=>{try{const n=av.getId(e),s=i(e.contentDocument);if("function"==typeof s&&(t.push(s),-1!==n)){let t=G.get(n);t||(t=new Set,G.set(n,t)),t.add(s)}}catch(t){console.warn(t)}}),et.addPageHideListener(t=>{const e=av.getId(t);null==Z||Z(e),bd(t)});let n=-1;const s=t=>Yd({type:Hu.Custom,data:{tag:"rrweb/fullscreen",payload:t}}),d=()=>{var t,e,i,r;const o=document,a=null!==(t=null!==(e=null!==(i=null!==(r=o.fullscreenElement)&&void 0!==r?r:o.webkitFullscreenElement)&&void 0!==i?i:o.mozFullScreenElement)&&void 0!==e?e:o.msFullscreenElement)&&void 0!==t?t:null,l=a?av.getId(a):-1;l!==n&&(-1!==n&&s({id:n,enter:!1}),n=l,-1!==l&&s({id:l,enter:!0}))},v=()=>{tv();const e=i(document);"function"==typeof e&&t.push(e),t.push(Oc("fullscreenchange",d)),t.push(Oc("webkitfullscreenchange",d)),t.push(Oc("mozfullscreenchange",d)),t.push(Oc("MSFullscreenChange",d)),rv=!0};return["interactive","complete"].includes(document.readyState)?v():(t.push(Oc("DOMContentLoaded",()=>{Yd({type:Hu.DomContentLoaded,data:{}}),"DOMContentLoaded"===P&&v()})),t.push(Oc("load",()=>{Yd({type:Hu.Load,data:{}}),"load"===P&&v()},window))),()=>{try{null==e||e.flush()}catch(t){}e=void 0,Nc(t),it.destroy(),et.removeLoadListener(),et.destroy(),G.clear(),st.reset(),av.reset(),rv=!1,vd()}}catch(t){console.warn(t)}}hv.addCustomEvent=(t,e)=>{if(!rv)throw new Error("please add custom event after start recording");Yd({type:Hu.Custom,data:{tag:t,payload:e}})},hv.freezePage=()=>{pd.forEach(t=>t.freeze())},hv.takeFullSnapshot=t=>{if(!rv)throw new Error("please take full snapshot after start recording");tv(t)},hv.mirror=av,"Mobile".toLowerCase(),"Tablet".toLowerCase(),new RegExp("Xbox","i"),new RegExp("Nintendo","i"),new RegExp("PlayStation","i"),new RegExp("Windows","i"),Date,Date,"0".repeat(32),"0".repeat(16);var cv=Object.create(null);function dv(t){return dv="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},dv(t)}function vv(t,e,i){return(e=function(t){var e=function(t){if("object"!=dv(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,"string");if("object"!=dv(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dv(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}cv.Node=Object.create(null),cv.ShadowRoot=Object.create(null),cv.MutationObserver=Object.create(null),cv.Element=Object.create(null);var fv=class{constructor(t){vv(this,"fileName",void 0),vv(this,"functionName",void 0),vv(this,"lineNumber",void 0),vv(this,"columnNumber",void 0),this.fileName=t.fileName||"",this.functionName=t.functionName||"",this.lineNumber=t.lineNumber,this.columnNumber=t.columnNumber}toString(){const t=this.lineNumber||"",e=this.columnNumber||"";return this.functionName?`${this.functionName} (${this.fileName}:${t}:${e})`:`${this.fileName}:${t}:${e}`}},pv=/(^|@)\S+:\d+/,gv=/^\s*at .*(\S+:\d+|\(native\))/m,mv=/^(eval@)?(\[native code])?$/,yv={parse(t){return t?void 0!==t.stacktrace||void 0!==t["opera#sourceloc"]?this.parseOpera(t):t.stack&&t.stack.match(gv)?this.parseV8OrIE(t):t.stack?this.parseFFOrSafari(t):[]:[]},extractLocation(t){if(-1===t.indexOf(":"))return[t];const e=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));if(!e)throw new Error(`Cannot parse given url: ${t}`);return[e[1],e[2]||void 0,e[3]||void 0]},parseV8OrIE(t){return t.stack.split("\n").filter(function(t){return!!t.match(gv)},this).map(function(t){t.indexOf("(eval ")>-1&&(t=t.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let e=t.replace(/^\s+/,"").replace(/\(eval code/g,"(");const i=e.match(/ (\((.+):(\d+):(\d+)\)$)/);e=i?e.replace(i[0],""):e;const n=e.split(/\s+/).slice(1),s=this.extractLocation(i?i[1]:n.pop());return new fv({functionName:n.join(" ")||void 0,fileName:["eval","<anonymous>"].indexOf(s[0])>-1?void 0:s[0],lineNumber:s[1],columnNumber:s[2]})},this)},parseFFOrSafari(t){return t.stack.split("\n").filter(function(t){return!t.match(mv)},this).map(function(t){if(t.indexOf(" > eval")>-1&&(t=t.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),-1===t.indexOf("@")&&-1===t.indexOf(":"))return new fv({functionName:t});{const e=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=t.match(e),n=i&&i[1]?i[1]:void 0,s=this.extractLocation(t.replace(e,""));return new fv({functionName:n,fileName:s[0],lineNumber:s[1],columnNumber:s[2]})}},this)},parseOpera(t){return!t.stacktrace||t.message.indexOf("\n")>-1&&t.message.split("\n").length>t.stacktrace.split("\n").length?this.parseOpera9(t):t.stack?this.parseOpera11(t):this.parseOpera10(t)},parseOpera9(t){const e=/Line (\d+).*script (?:in )?(\S+)/i,i=t.message.split("\n"),n=[];for(let t=2,s=i.length;s>t;t+=2){const s=e.exec(i[t]);s&&n.push(new fv({fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera10(t){const e=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,i=t.stacktrace.split("\n"),n=[];for(let t=0,s=i.length;s>t;t+=2){const s=e.exec(i[t]);s&&n.push(new fv({functionName:s[3]||void 0,fileName:s[2],lineNumber:parseFloat(s[1])}))}return n},parseOpera11(t){return t.stack.split("\n").filter(function(t){return!!t.match(pv)&&!t.match(/^Error created at/)},this).map(function(t){const e=t.split("@"),i=this.extractLocation(e.pop());return new fv({functionName:(e.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function bv(t){if(!t||!t.outerHTML)return"";let e="";for(;t.parentElement;){let i=t.localName;if(!i)break;i=i.toLowerCase();const n=t.parentElement,s=[];if(n.children&&n.children.length>0)for(let t=0;n.children.length>t;t++){const e=n.children[t];e.localName&&e.localName.toLowerCase&&e.localName.toLowerCase()===i&&s.push(e)}s.length>1&&(i+=`:eq(${s.indexOf(t)})`),e=i+(e?">"+e:""),t=n}return e}function _v(t){return Array.isArray(t)}function wv(t){return"object"==typeof t&&null!==t&&!_v(t)}function kv(t,e){if(0===e)return!0;const i=Object.keys(t);for(const n of i)if(wv(t[n])&&kv(t[n],e-1))return!0;return!1}function Sv(t,e){const i={numOfKeysLimit:50,depthOfLimit:4};Object.assign(i,e);const n=[],s=[];return JSON.stringify(t,function(t,e){if(n.length>0){const i=n.indexOf(this);~i?n.splice(i+1):n.push(this),~i?s.splice(i,1/0,t):s.push(t),~n.indexOf(e)&&(e=n[0]===e?"[Circular ~]":"[Circular ~."+s.slice(0,n.indexOf(e)).join(".")+"]")}else n.push(e);if(null===e)return e;if(void 0===e)return"undefined";if(wv(r=e)&&Object.keys(r).length>i.numOfKeysLimit||"function"==typeof r||wv(r)&&kv(r,i.depthOfLimit))return function(t){let e=t.toString();return i.stringLengthLimit&&e.length>i.stringLengthLimit&&(e=`${e.slice(0,i.stringLengthLimit)}...`),e}(e);var r;if("bigint"==typeof e)return e.toString()+"n";if(e instanceof Event){const t={};for(const i in e){const n=e[i];t[i]=_v(n)?bv(n.length?n[0]:null):n}return t}return e instanceof Node?e instanceof HTMLElement?e?e.outerHTML:"":e.nodeName:e instanceof Error?e.stack?e.stack+"\nEnd of stack for Error object":e.name+": "+e.message:e})}var xv={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function Cv(t,e,i){const n=i?Object.assign({},xv,i):xv,s=n.logger;if(!s)return()=>{};let r;r="string"==typeof s?e[s]:s;let o=0,a=!1,l=!0;const u=[];if(n.level.includes("error")){const i=e=>{const i=e.message;t({level:"error",trace:yv.parse(e.error).map(t=>t.toString()),payload:[Sv(i,n.stringifyOptions)]})};e.addEventListener("error",i),u.push(()=>{e.removeEventListener("error",i)});const s=e=>{let i,s;e.reason instanceof Error?(i=e.reason,s=[Sv(`Uncaught (in promise) ${i.name}: ${i.message}`,n.stringifyOptions)]):(i=new Error,s=[Sv("Uncaught (in promise)",n.stringifyOptions),Sv(e.reason,n.stringifyOptions)]),t({level:"error",trace:yv.parse(i).map(t=>t.toString()),payload:s})};e.addEventListener("unhandledrejection",s),u.push(()=>{e.removeEventListener("unhandledrejection",s)})}for(const t of n.level)u.push(h(r,t));return()=>{l=!1,u.forEach(t=>t())};function h(e,i){return e[i]?function(s,r){try{if(!(r in s))return()=>{};const u=s[r],h={next:u},c=(s=>(...r)=>{if(s.apply(e,r),l&&!("assert"===i&&r[0]||a)){a=!0;try{const e=yv.parse(new Error).map(t=>t.toString()).splice(1),s=("assert"===i?r.slice(1):r).map(t=>Sv(t,n.stringifyOptions));o++,n.lengthThreshold>o?t({level:i,trace:e,payload:s}):o===n.lengthThreshold&&t({level:"warn",trace:[],payload:[Sv("The number of log records reached the threshold.")]})}catch(t){s.apply(e,["rrweb logger error:",t,...r])}finally{a=!1}}})(function(...t){return h.next.apply(this,t)});return"function"==typeof c&&(c.prototype=c.prototype||{},Object.defineProperties(c,{__rrweb_original__:{enumerable:!1,value:u},__rrweb_layer__:{enumerable:!1,value:h}})),s[r]=c,()=>{if(s[r]===c)return void(s[r]=h.next);const t=t=>{var e;return"function"==typeof t?null!==(e=t.__rrweb_layer__)&&void 0!==e?e:t.__posthog_layer__:void 0};let e=s[r],i=t(e);for(;i;){if(i.next===c)return void(i.next=h.next);e=i.next,i=t(e)}}}catch(t){return()=>{}}}(e,i):()=>{}}}var $v=t=>({name:"rrweb/console@1",observer:Cv,options:t});const Tv=()=>{},Iv=t=>{var e;if(Ce(t))return null!==(e=t.__posthog_layer__)&&void 0!==e?e:t.__rrweb_layer__};function Mv(t,e,i){try{if(!(e in t))return Tv;const n={next:t[e]},s=i(function(...t){return n.next.apply(this,t)});return Ce(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:n}})),t[e]=s,()=>{if(t[e]===s)return void(t[e]=n.next);let i=t[e],r=Iv(i);for(;r;){if(r.next===s)return void(r.next=n.next);i=r.next,r=Iv(i)}}}catch(t){return Tv}}function Ev(t,e){var i;const n=function(t){try{return"string"==typeof t?new URL(t).hostname:"url"in t?new URL(t.url).hostname:t.hostname}catch(t){return null}}(t),s={hostname:n,isHostDenied:!1};if(!(null===(i=e.payloadHostDenyList)||void 0===i?void 0:i.length)||!(null==n?void 0:n.trim().length))return s;for(const t of e.payloadHostDenyList)if(n.endsWith(t))return{hostname:n,isHostDenied:!0};return s}const Pv=Zs("[Recorder]"),Rv=t=>"navigation"===t.entryType,Av=t=>"resource"===t.entryType,Fv=()=>{};function Ov(t,e){var i;return Rv(e)&&"complete"===(null===(i=t.document)||void 0===i?void 0:i.readyState)&&e.loadEventEnd>0}function Dv(t,e){return e.recordInitialRequests?t.performance.getEntries().filter(i=>Ov(t,i)||Av(i)&&e.initiatorTypes.includes(i.initiatorType)):e.performanceEntryTypeToObserve.includes("navigation")?function(t){var e;return"complete"!==(null===(e=t.document)||void 0===e?void 0:e.readyState)?[]:t.performance.getEntriesByType("navigation").filter(e=>Ov(t,e))}(t):[]}function Lv(t,e){return!!e&&(Oe(e)||e[t])}function Nv(t){if("undefined"==typeof Request)return!1;if(t instanceof Request)return!0;try{return"[object Request]"==={}.toString.call(t)}catch(t){return!1}}const qv=["image/","video/","audio/","font/","application/octet-stream","application/pdf","application/zip","application/wasm"];function jv({type:t,recordBody:e,headers:i,url:n}){function s(t){const e=Object.keys(i).find(t=>"content-type"===t.toLowerCase()),n=e&&i[e];return t.some(t=>null==n?void 0:n.toLowerCase().includes(t))}if(!e)return!1;if(function t(e){try{return"string"==typeof e?e.startsWith("blob:"):e instanceof URL?"blob:"===e.protocol:!!Nv(e)&&t(e.url)}catch(t){return!1}}(n))return!1;if(s(qv))return!1;if(Oe(e))return!0;if(xe(e))return s(e);const r=e[t];return Oe(r)?r:s(r)}function Bv(t,e,i,n,s){return Hv.apply(this,arguments)}function Hv(){return Hv=oe(function*(t,e,i,n,s,r=0){if(r>10)return Pv.warn("Failed to get performance entry for request",{url:i,initiatorType:e}),null;const o=function(t,e){for(let i=t.length-1;i>=0;i-=1)if(e(t[i]))return t[i]}(t.performance.getEntriesByName(i),t=>Av(t)&&t.initiatorType===e&&(Ie(n)||t.startTime>=n)&&(Ie(s)||s>=t.startTime));return o||(yield new Promise(t=>setTimeout(t,50*r)),Bv(t,e,i,n,s,r+1))}),Hv.apply(this,arguments)}function zv({body:t,options:e,url:i}){if(Re(t))return null;const{hostname:n,isHostDenied:s}=Ev(i,e);if(s)return n+" is in deny list";if(Me(t))return t;if((t=>"u">typeof Document&&t instanceof Document)(t))return t.textContent;if(De(t))return ur(t);if($e(t))try{return JSON.stringify(t)}catch(t){return"[SessionReplay] Failed to stringify response object"}return"[SessionReplay] Cannot read body of type "+toString.call(t)}const Uv=t=>!Pe(t)&&("navigation"===t.entryType||"resource"===t.entryType);function Wv(t,{entry:e,method:i,status:n,networkRequest:s,isInitial:r,start:o,end:a,url:l,initiatorType:u}){o=e?e.startTime:o,a=e?e.responseEnd:a;const h=Math.floor(Date.now()-t.performance.now()),c=Math.floor(h+(o||0)),d=[he(he({},e?e.toJSON():{name:l}),{},{startTime:Ie(o)?void 0:Math.round(o),endTime:Ie(a)?void 0:Math.round(a),timeOrigin:h,timestamp:c,method:i,initiatorType:u||(e?e.initiatorType:void 0),status:n,requestHeaders:s.requestHeaders,requestBody:s.requestBody,responseHeaders:s.responseHeaders,responseBody:s.responseBody,isInitial:r})];if(Uv(e))for(const t of e.serverTiming||[])d.push({timeOrigin:h,timestamp:c,startTime:Math.round(e.startTime),name:t.name,duration:t.duration,entryType:"serverTiming"});return d}const Vv=["video/","audio/"];function Gv(t){return $e(t)&&Ce(t.getReader)&&Ce(t.tee)}const Zv="[SessionReplay] Timeout while trying to read body",Qv="[SessionReplay] Failed to read body";function Jv(t){return`${Qv}: ${t}`}function Kv(t){return`[SessionReplay] Body too large to record (> ${t} bytes)`}function Xv(t,e){if(!e.streamNetworkBody)return function(t){return new Promise(e=>{const i=setTimeout(()=>e(Zv),500);try{t.clone().text().then(t=>e(t),t=>e(Jv(t))).finally(()=>clearTimeout(i))}catch(t){clearTimeout(i),e(Qv)}})}(t);const i=so(e);return function(t,e){try{var i,n;const s=null===(i=t.headers)||void 0===i||null===(n=i.get)||void 0===n?void 0:n.call(i,"content-length");if(!s)return!1;const r=parseInt(s,10);return Number.isFinite(r)&&r>e}catch(t){return!1}}(t,i)?Promise.resolve(Kv(i)):function(t,e){return new Promise(i=>{let n,s=!1;function r(){try{null==n||n.cancel().catch(()=>{})}catch(t){}}function o(t){s||(s=!0,clearTimeout(a),r(),i(t))}const a=setTimeout(()=>o(Zv),500);let l;try{l=t.clone()}catch(t){return void o(Qv)}const u=l.body;if(!Gv(u)||"undefined"==typeof TextDecoder){try{l.text().then(t=>o(t),t=>o(Jv(t)))}catch(t){o(Qv)}return}try{n=u.getReader()}catch(t){return void o(Qv)}const h=[];let c=0;!function t(){n.read().then(({done:i,value:n})=>{if(s)r();else if(i)o((new TextDecoder).decode(function(t,e){const i=new Uint8Array(e);let n=0;for(const e of t)i.set(e,n),n+=e.byteLength;return i}(h,c)));else{if(n){if(c+n.byteLength>e)return void o(Kv(e));c+=n.byteLength,h.push(n)}t()}},t=>o(Jv(t)))}()})}(t,i)}function Yv(){return Yv=oe(function*({r:t,options:e,url:i}){const{hostname:n,isHostDenied:s}=Ev(i,e);return s?Promise.resolve(n+" is in deny list"):Xv(t,e)}),Yv.apply(this,arguments)}function tf(){return tf=oe(function*({r:t,options:e,url:i}){const n=function({r:t,options:e,url:i}){var n;if("chunked"===t.headers.get("Transfer-Encoding"))return"Chunked Transfer-Encoding is not supported";const s=null===(n=t.headers.get("Content-Type"))||void 0===n?void 0:n.toLowerCase(),r=Vv.some(t=>null==s?void 0:s.startsWith(t));if(s&&r)return`Content-Type ${s} is not supported`;const{hostname:o,isHostDenied:a}=Ev(i,e);return a?o+" is in deny list":null}({r:t,options:e,url:i});return Pe(n)?Xv(t,e):Promise.resolve(n)}),tf.apply(this,arguments)}let ef=null;function nf(t,e,i){if(!("performance"in e))return()=>{};if(ef)return Pv.warn("Network observer already initialised, doing nothing"),()=>{};const n=i?Object.assign({},ro,i):ro;let s=!0;const r=e=>{if(!s)return;const i=[];let r=!1;e.requests.forEach(t=>{const e="serverTiming"===t.entryType;if(e&&r)return;const s=n.maskRequestFn(t);e||(r=!s||(t=>!!t&&fo.has(t))(s)),s&&i.push(s)}),i.length>0&&t(he(he({},e),{},{requests:i}))},o=function(t,e,i){try{t({requests:Dv(e,i).flatMap(t=>Wv(e,{entry:t,method:void 0,status:void 0,networkRequest:{},isInitial:!0})),isInitial:!0})}catch(t){Pv.error("Failed to capture initial performance entries for network capture",t)}const n=e.PerformanceObserver,s=null==n?void 0:n.supportedEntryTypes;if(!n||!xe(s))return;const r=s.filter(t=>i.performanceEntryTypeToObserve.includes(t));if(!r.length)return;const o=new n(n=>{t({requests:n.getEntries().filter(t=>Rv(t)||Av(t)&&i.initiatorTypes.includes(t.initiatorType)&&(t=>!i.recordBody&&!i.recordHeaders||"xmlhttprequest"!==t.initiatorType&&"fetch"!==t.initiatorType)(t)).flatMap(t=>Wv(e,{entry:t,method:void 0,status:void 0,networkRequest:{}}))})});return o.observe({entryTypes:r}),()=>{o.disconnect()}}(r,e,n),a=n.recordHeaders||n.recordBody;if(!o&&!a)return s=!1,Fv;let l=()=>{},u=()=>{};return a&&(l=function(t,e,i){if(!i.initiatorTypes.includes("xmlhttprequest"))return()=>{};const n=Lv("request",i.recordHeaders),s=Lv("response",i.recordHeaders),r=Mv(e.XMLHttpRequest.prototype,"open",r=>function(o,a,l=!0,u,h){const c=this;try{const r=new Request(a),l={};let u,h;const d={},v=c.setRequestHeader.bind(c);c.setRequestHeader=(t,e)=>(d[t]=e,v(t,e)),n&&(l.requestHeaders=d);const f=c.send.bind(c);c.send=t=>(jv({type:"request",headers:d,url:a,recordBody:i.recordBody})&&(l.requestBody=zv({body:t,options:i,url:a})),u=e.performance.now(),f(t));const p=()=>{c.removeEventListener("readystatechange",g),c.removeEventListener("error",p),c.removeEventListener("abort",p),c.removeEventListener("timeout",p)},g=()=>{if(c.readyState!==c.DONE)return;p(),h=e.performance.now();const n={};c.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(t=>{const e=t.split(": "),i=e.shift(),s=e.join(": ");i&&(n[i]=s)}),s&&(l.responseHeaders=n),jv({type:"response",headers:n,url:a,recordBody:i.recordBody})&&(l.responseBody=zv({body:c.response,options:i,url:a})),Bv(e,"xmlhttprequest",r.url,u,h).then(i=>{t({requests:Wv(e,{entry:i,method:o,status:null==c?void 0:c.status,networkRequest:l,start:u,end:h,url:a.toString(),initiatorType:"xmlhttprequest"})})}).catch(()=>{})};c.addEventListener("readystatechange",g),c.addEventListener("error",p),c.addEventListener("abort",p),c.addEventListener("timeout",p)}catch(t){Pv.error("Failed to instrument XHR for network capture",t)}r.call(c,o,a.toString(),l,u,h)});return()=>{r()}}(r,e,n),u=function(t,e,i){if(!i.initiatorTypes.includes("fetch"))return()=>{};const n=Lv("request",i.recordHeaders),s=Lv("response",i.recordHeaders),r=Mv(e,"fetch",r=>function(){var o=oe(function*(o,a){let l,u;try{l=new Request(o,a)}catch(t){return Pv.error("Failed to instrument fetch for network capture",t),r(o,a)}const h={};let c,d;try{try{const t={};l.headers.forEach((e,i)=>{t[i]=e}),n&&(h.requestHeaders=t),!Gv(null==a?void 0:a.body)&&jv({type:"request",headers:t,url:o,recordBody:i.recordBody})&&(h.requestBody=yield function(t){return Yv.apply(this,arguments)}({r:l,options:i,url:o}))}catch(t){Pv.error("Failed to record fetch request for network capture",t)}c=e.performance.now(),u=Nv(o)?yield r(l):yield r(o,a),d=e.performance.now();try{const t={};u.headers.forEach((e,i)=>{t[i]=e}),s&&(h.responseHeaders=t),jv({type:"response",headers:t,url:o,recordBody:i.recordBody})&&(h.responseBody=yield function(t){return tf.apply(this,arguments)}({r:u,options:i,url:o}))}catch(t){Pv.error("Failed to record fetch response for network capture",t)}return u}finally{Bv(e,"fetch",l.url,c,d).then(i=>{t({requests:Wv(e,{entry:i,method:l.method,status:null==u?void 0:u.status,networkRequest:h,start:c,end:d,url:l.url,initiatorType:"fetch"})})}).catch(()=>{})}});return function(t,e){return o.apply(this,arguments)}}());return()=>{r()}}(r,e,n)),ef=()=>{s=!1,null==o||o(),l(),u(),ef=null},ef}const sf=t=>({name:"rrweb/network@1",observer:nf,options:t});var rf,of,af,lf,uf,hf,cf,df,vf,ff,pf,gf,mf,yf,bf;d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.rrwebPlugins={getRecordConsolePlugin:$v,getRecordNetworkPlugin:sf},d.__PosthogExtensions__.rrweb={record:hv,version:"v2",wasMaxDepthReached:()=>Pc,resetMaxDepthState(){Pc=!1,Ec=!1},getLastSnapshotCost:()=>mh,getMutationCost:()=>he({},kh),getObserverInitFailures:()=>Cd.size?Array.from(Cd):void 0,resetSnapshotCostState(){vh=0,fh=0,ph=0,uh=0,gh={durationMs:0,stylesheetMs:0,nodeCount:0,cssRuleCount:0,nonDeferrableCssRuleCount:0,deferredStylesheetCount:0},mh=null,yh=null,bh=[],_h=0,wh=0,kh={slowestBatchMs:0},Sh={deferredCount:0,failedCount:0,abandonedCount:0,totalMs:0,slowestSliceMs:0}}},d.rrweb={record:hv,version:"v2"},d.rrwebConsoleRecord={getRecordConsolePlugin:$v},d.getRecordNetworkPlugin=sf,d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initSessionRecording=(t,e)=>new ju(t,e);var _f,wf,kf,Sf,xf={},Cf=[],$f=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Tf=Array.isArray;function If(t,e){for(var i in e)t[i]=e[i];return t}function Mf(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Ef(t,e,i){var n,s,r,o={};for(r in e)"key"==r?n=e[r]:"ref"==r?s=e[r]:o[r]=e[r];if(arguments.length>2&&(o.children=arguments.length>3?rf.call(arguments,2):i),"function"==typeof t&&null!=t.defaultProps)for(r in t.defaultProps)void 0===o[r]&&(o[r]=t.defaultProps[r]);return Pf(t,o,n,s,null)}function Pf(t,e,i,n,s){var r={type:t,props:e,key:i,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==s?++af:s,__i:-1,__u:0};return null==s&&null!=of.vnode&&of.vnode(r),r}function Rf(t){return t.children}function Af(t,e){this.props=t,this.context=e}function Ff(t,e){if(null==e)return t.__?Ff(t.__,t.__i+1):null;for(var i;t.__k.length>e;e++)if(null!=(i=t.__k[e])&&null!=i.__e)return i.__e;return"function"==typeof t.type?Ff(t):null}function Of(t){if(t.__P&&t.__d){var e=t.__v,i=e.__e,n=[],s=[],r=If({},e);r.__v=e.__v+1,of.vnode&&of.vnode(r),Wf(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[i]:null,n,null==i?Ff(e):i,!!(32&e.__u),s),r.__v=e.__v,r.__.__k[r.__i]=r,Gf(n,r,s),e.__e=e.__=null,r.__e!=i&&Df(r)}}function Df(t){if(null!=(t=t.__)&&null!=t.__c)return t.__e=t.__c.base=null,t.__k.some(function(e){if(null!=e&&null!=e.__e)return t.__e=t.__c.base=e.__e}),Df(t)}function Lf(t){(!t.__d&&(t.__d=!0)&&lf.push(t)&&!Nf.__r++||uf!=of.debounceRendering)&&((uf=of.debounceRendering)||hf)(Nf)}function Nf(){try{for(var t,e=1;lf.length;)lf.length>e&&lf.sort(cf),t=lf.shift(),e=lf.length,Of(t)}finally{lf.length=Nf.__r=0}}function qf(t,e,i,n,s,r,o,a,l,u,h){var c,d,v,f,p,g,m,y=n&&n.__k||Cf,b=e.length;for(l=function(t,e,i,n,s){var r,o,a,l,u,h=i.length,c=h,d=0;for(t.__k=new Array(s),r=0;s>r;r++)null!=(o=e[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=t.__k[r]=Pf(null,o,null,null,null):Tf(o)?o=t.__k[r]=Pf(Rf,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=t.__k[r]=Pf(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[r]=o,l=r+d,o.__=t,o.__b=t.__b+1,a=null,-1!=(u=o.__i=Bf(o,i,l,c))&&(c--,(a=i[u])&&(a.__u|=2)),null==a||null==a.__v?(-1==u&&(s>h?d--:h>s&&d++),"function"!=typeof o.type&&(o.__u|=4)):u!=l&&(u==l-1?d--:u==l+1?d++:(u>l?d--:d++,o.__u|=4))):t.__k[r]=null;if(c)for(r=0;h>r;r++)null!=(a=i[r])&&!(2&a.__u)&&(a.__e==n&&(n=Ff(a)),Jf(a,a));return n}(i,e,y,l,b),c=0;b>c;c++)null!=(v=i.__k[c])&&(d=-1!=v.__i&&y[v.__i]||xf,v.__i=c,g=Wf(t,v,d,s,r,o,a,l,u,h),f=v.__e,v.ref&&d.ref!=v.ref&&(d.ref&&Qf(d.ref,null,v),h.push(v.ref,v.__c||f,v)),null==p&&null!=f&&(p=f),(m=!!(4&v.__u))||d.__k===v.__k?(l=jf(v,l,t,m),m&&d.__e&&(d.__e=null)):"function"==typeof v.type&&void 0!==g?l=g:f&&(l=f.nextSibling),v.__u&=-7);return i.__e=p,l}function jf(t,e,i,n){var s,r;if("function"==typeof t.type){for(s=t.__k,r=0;s&&s.length>r;r++)s[r]&&(s[r].__=t,e=jf(s[r],e,i,n));return e}t.__e!=e&&(n&&(e&&t.type&&!e.parentNode&&(e=Ff(t)),i.insertBefore(t.__e,e||null)),e=t.__e);do{e=e&&e.nextSibling}while(null!=e&&8==e.nodeType);return e}function Bf(t,e,i,n){var s,r,o,a=t.key,l=t.type,u=e[i],h=null!=u&&!(2&u.__u);if(null===u&&null==a||h&&a==u.key&&l==u.type)return i;if(n>(h?1:0))for(s=i-1,r=i+1;s>=0||e.length>r;)if(null!=(u=e[o=0>s?r++:s--])&&!(2&u.__u)&&a==u.key&&l==u.type)return o;return-1}function Hf(t,e,i){"-"==e[0]?t.setProperty(e,null==i?"":i):t[e]=null==i?"":"number"!=typeof i||$f.test(e)?i:i+"px"}function zf(t,e,i,n,s){var r,o;t:if("style"==e)if("string"==typeof i)t.style.cssText=i;else{if("string"==typeof n&&(t.style.cssText=n=""),n)for(e in n)i&&e in i||Hf(t.style,e,"");if(i)for(e in i)n&&i[e]==n[e]||Hf(t.style,e,i[e])}else if("o"==e[0]&&"n"==e[1])r=e!=(e=e.replace(pf,"$1")),o=e.toLowerCase(),e=o in t||"onFocusOut"==e||"onFocusIn"==e?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=i,i?n?i[ff]=n[ff]:(i[ff]=gf,t.addEventListener(e,r?yf:mf,r)):t.removeEventListener(e,r?yf:mf,r);else{if("http://www.w3.org/2000/svg"==s)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=e&&"height"!=e&&"href"!=e&&"list"!=e&&"form"!=e&&"tabIndex"!=e&&"download"!=e&&"rowSpan"!=e&&"colSpan"!=e&&"role"!=e&&"popover"!=e&&e in t)try{t[e]=null==i?"":i;break t}catch(t){}"function"==typeof i||(null==i||!1===i&&"-"!=e[4]?t.removeAttribute(e):t.setAttribute(e,"popover"==e&&1==i?"":i))}}function Uf(t){return function(e){if(this.l){var i=this.l[e.type+t];if(null==e[vf])e[vf]=gf++;else if(i[ff]>e[vf])return;return i(of.event?of.event(e):e)}}}function Wf(t,e,i,n,s,r,o,a,l,u){var h,c,d,v,f,p,g,m,y,b,$,_,w,k,S,x,C=e.type;if(void 0!==e.constructor)return null;128&i.__u&&(l=!!(32&i.__u),r=[a=e.__e=i.__e]),(h=of.__b)&&h(e);t:if("function"==typeof C){c=o.length;try{if(y=e.props,b=C.prototype&&C.prototype.render,$=(h=C.contextType)&&n[h.__c],_=h?$?$.props.value:h.__:n,i.__c?m=(d=e.__c=i.__c).__=d.__E:(b?e.__c=d=new C(y,_):(e.__c=d=new Af(y,_),d.constructor=C,d.render=Kf),$&&$.sub(d),d.state||(d.state={}),d.__n=n,v=d.__d=!0,d.__h=[],d._sb=[]),b&&null==d.__s&&(d.__s=d.state),b&&null!=C.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=If({},d.__s)),If(d.__s,C.getDerivedStateFromProps(y,d.__s))),f=d.props,p=d.state,d.__v=e,v)b&&null==C.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),b&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(b&&null==C.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,_),e.__v==i.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,_)){e.__v!=i.__v&&(d.props=y,d.state=d.__s,d.__d=!1),e.__e=i.__e,e.__k=i.__k,e.__k.some(function(t){t&&(t.__=e)}),Cf.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break t}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,_),b&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,p,g)})}if(d.context=_,d.props=y,d.__P=t,d.__e=!1,w=of.__r,k=0,b)d.state=d.__s,d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),Cf.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,w&&w(e),h=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&25>++k);d.state=d.__s,null!=d.getChildContext&&(n=If(If({},n),d.getChildContext())),b&&!v&&null!=d.getSnapshotBeforeUpdate&&(g=d.getSnapshotBeforeUpdate(f,p)),S=null!=h&&h.type===Rf&&null==h.key?Zf(h.props.children):h,a=qf(t,Tf(S)?S:[S],e,i,n,s,r,o,a,l,u),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),m&&(d.__E=d.__=null)}catch(t){if(o.length=c,e.__v=null,l||null!=r)if(t.then){for(e.__u|=l?160:128;a&&8==a.nodeType&&a.nextSibling;)a=a.nextSibling;null!=r&&(r[r.indexOf(a)]=null),e.__e=a}else{if(null!=r)for(x=r.length;x--;)Mf(r[x]);Vf(e)}else e.__e=i.__e,!e.__k&&i.__k&&(e.__k=i.__k),t.then||Vf(e);of.__e(t,e,i)}}else null==r&&e.__v==i.__v?(e.__k=i.__k,e.__e=i.__e):a=e.__e=function(t,e,i,n,s,r,o,a,l){var u,h,c,d,v,f,p,g=i.props||xf,m=e.props,y=e.type;if("svg"==y?s="http://www.w3.org/2000/svg":"math"==y?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),null!=r)for(u=0;r.length>u;u++)if((v=r[u])&&"setAttribute"in v==!!y&&(y?v.localName==y:3==v.nodeType)){t=v,r[u]=null;break}if(null==t){if(null==y)return document.createTextNode(m);t=document.createElementNS(s,y,m.is&&m),a&&(of.__m&&of.__m(e,r),a=!1),r=null}if(null==y)g===m||a&&t.data==m||(t.data=m);else{if(r="textarea"==y&&null!=m.defaultValue?null:r&&rf.call(t.childNodes),!a&&null!=r)for(g={},u=0;t.attributes.length>u;u++)g[(v=t.attributes[u]).name]=v.value;for(u in g)v=g[u],"dangerouslySetInnerHTML"==u?c=v:"children"==u||u in m||"value"==u&&"defaultValue"in m||"checked"==u&&"defaultChecked"in m||zf(t,u,null,v,s);for(u in m)v=m[u],"children"==u?d=v:"dangerouslySetInnerHTML"==u?h=v:"value"==u?f=v:"checked"==u?p=v:a&&"function"!=typeof v||g[u]===v||zf(t,u,v,g[u],s);if(h)a||c&&(h.__html==c.__html||h.__html==t.innerHTML)||(t.innerHTML=h.__html),e.__k=[];else if(c&&(t.innerHTML=""),qf("template"==e.type?t.content:t,Tf(d)?d:[d],e,i,n,"foreignObject"==y?"http://www.w3.org/1999/xhtml":s,r,o,r?r[0]:i.__k&&Ff(i,0),a,l),null!=r)for(u=r.length;u--;)Mf(r[u]);a&&"textarea"!=y||(u="value","progress"==y&&null==f?t.removeAttribute("value"):null!=f&&(f!==t[u]||"progress"==y&&!f||"option"==y&&f!=g[u])&&zf(t,u,f,g[u],s),u="checked",null!=p&&p!=t[u]&&zf(t,u,p,g[u],s))}return t}(i.__e,e,i,n,s,r,o,l,u);return(h=of.diffed)&&h(e),128&e.__u?void 0:a}function Vf(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Vf))}function Gf(t,e,i){for(var n=0;i.length>n;n++)Qf(i[n],i[++n],i[++n]);of.__c&&of.__c(e,t),t.some(function(e){try{t=e.__h,e.__h=[],t.some(function(t){t.call(e)})}catch(t){of.__e(t,e.__v)}})}function Zf(t){return"object"!=typeof t||null==t||t.__b>0?t:Tf(t)?t.map(Zf):void 0!==t.constructor?null:If({},t)}function Qf(t,e,i){try{if("function"==typeof t){var n="function"==typeof t.__u;n&&t.__u(),n&&null==e||(t.__u=t(e))}else t.current=e}catch(t){of.__e(t,i)}}function Jf(t,e,i){var n,s;if(of.unmount&&of.unmount(t),(n=t.ref)&&(n.current&&n.current!=t.__e||Qf(n,null,e)),null!=(n=t.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(t){of.__e(t,e)}n.base=n.__P=n.__n=null}if(n=t.__k)for(s=0;n.length>s;s++)n[s]&&Jf(n[s],e,i||"function"!=typeof t.type);i||Mf(t.__e),t.__c=t.__=t.__e=void 0}function Kf(t,e,i){return this.constructor(t,i)}function Xf(t,e,i){var n,s,r,o;e==document&&(e=document.documentElement),of.__&&of.__(t,e),s=(n="function"==typeof i)?null:i&&i.__k||e.__k,r=[],o=[],Wf(e,t=(!n&&i||e).__k=Ef(Rf,null,[t]),s||xf,xf,e.namespaceURI,!n&&i?[i]:s?null:e.firstChild?rf.call(e.childNodes):null,r,!n&&i?i:s?s.__e:e.firstChild,n,o),Gf(r,t,o),t.props.children=null}rf=Cf.slice,of={__e(t,e,i,n){for(var s,r,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((r=s.constructor)&&null!=r.getDerivedStateFromError&&(s.setState(r.getDerivedStateFromError(t)),o=s.__d),null!=s.componentDidCatch&&(s.componentDidCatch(t,n||{}),o=s.__d),o)return s.__E=s}catch(e){t=e}throw t}},af=0,Af.prototype.setState=function(t,e){var i=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=If({},this.state);"function"==typeof t&&(t=t(If({},i),this.props)),t&&If(i,t),null!=t&&this.__v&&(e&&this._sb.push(e),Lf(this))},Af.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),Lf(this))},Af.prototype.render=Rf,lf=[],hf="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,cf=function(t,e){return t.__v.__b-e.__v.__b},Nf.__r=0,df=Math.random().toString(8),vf="__d"+df,ff="__a"+df,pf=/(PointerCapture)$|Capture$/i,gf=0,mf=Uf(!1),yf=Uf(!0),bf=0;var Yf=0,tp=[],ep=of,ip=ep.__b,np=ep.__r,sp=ep.diffed,rp=ep.__c,op=ep.unmount,ap=ep.__;function lp(t,e){ep.__h&&ep.__h(wf,t,Yf||e),Yf=0;var i=wf.__H||(wf.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function up(t){return Yf=1,function(t,e){var i=lp(_f++,2);if(i.t=t,!i.__c&&(i.__=[_p(void 0,e),function(t){var e=i.__N?i.__N[0]:i.__[0],n=i.t(e,t);e!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=wf,!wf.__f)){var n=function(t,e,n){if(!i.__c.__H)return!0;var r=!1,o=i.__c.props!==t;if(i.__c.__H.__.some(function(t){if(t.__N){r=!0;var e=t.__[0];t.__=t.__N,t.__N=void 0,e!==t.__[0]&&(o=!0)}}),s){var a=s.call(this,t,e,n);return r?a||o:a}return!r||o};wf.__f=!0;var s=wf.shouldComponentUpdate,r=wf.componentWillUpdate;wf.componentWillUpdate=function(t,e,i){if(this.__e){var o=s;s=void 0,n(t,e,i),s=o}r&&r.call(this,t,e,i)},wf.shouldComponentUpdate=n}return i.__N||i.__}(_p,t)}function hp(t,e){var i=lp(_f++,3);!ep.__s&&bp(i.__H,e)&&(i.__=t,i.u=e,wf.__H.__h.push(i))}function cp(t){return Yf=5,dp(function(){return{current:t}},[])}function dp(t,e){var i=lp(_f++,7);return bp(i.__H,e)&&(i.__=t(),i.__H=e,i.__h=t),i.__}function vp(t){var e=wf.context[t.__c],i=lp(_f++,9);return i.c=t,e?(null==i.__&&(i.__=!0,e.sub(wf)),e.props.value):t.__}function fp(){for(var t;t=tp.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(mp),e.__h.some(yp),e.__h=[]}catch(i){e.__h=[],ep.__e(i,t.__v)}}}ep.__b=function(t){wf=null,ip&&ip(t)},ep.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),ap&&ap(t,e)},ep.__r=function(t){np&&np(t),_f=0;var e=(wf=t.__c).__H;e&&(kf===wf?(e.__h=[],wf.__h=[],e.__.some(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.length&&fp(),_f=0)),kf=wf},ep.diffed=function(t){sp&&sp(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(1!==tp.push(e)&&Sf===ep.requestAnimationFrame||((Sf=ep.requestAnimationFrame)||gp)(fp)),e.__H.__.some(function(t){t.u&&(t.__H=t.u,t.u=void 0)})),kf=wf=null},ep.__c=function(t,e){e.some(function(t){try{t.__h.some(mp),t.__h=t.__h.filter(function(t){return!t.__||yp(t)})}catch(i){e.some(function(t){t.__h&&(t.__h=[])}),e=[],ep.__e(i,t.__v)}}),rp&&rp(t,e)},ep.unmount=function(t){op&&op(t);var e,i=t.__c;i&&i.__H&&(i.__H.__.some(function(t){try{mp(t)}catch(t){e=t}}),i.__H=void 0,e&&ep.__e(e,i.__v))};var pp="function"==typeof requestAnimationFrame;function gp(t){var e,i=function(){clearTimeout(n),pp&&cancelAnimationFrame(e),setTimeout(t)},n=setTimeout(i,35);pp&&(e=requestAnimationFrame(i))}function mp(t){var e=wf,i=t.__c;"function"==typeof i&&(t.__c=void 0,i()),wf=e}function yp(t){var e=wf;t.__c=t.__(),wf=e}function bp(t,e){return!t||t.length!==e.length||e.some(function(e,i){return e!==t[i]})}function _p(t,e){return"function"==typeof e?e(t):e}const wp="gzip-js",kp="base64",Sp="events",xp="cancelEvents",Cp="tab",$p="left",Tp="center",Ip="right",Mp="next_to_trigger",Ep="popover",Pp="widget",Rp="external_survey",Ap="open",Fp="multiple_choice",Op="single_choice",Dp="rating",Lp="end",Np="always",qp="survey shown",jp="survey dismissed",Bp="survey sent",Hp="$survey_id",zp="$survey_name",Up="$survey_iteration",Wp="$survey_iteration_start_date",Vp="$survey_last_seen_date",Gp="$survey_language",Zp="popover";function Qp(t){let e=!0;return{dispose(){if(e){e=!1;const i=t();i&&Ce(i.then)&&i.then(void 0,()=>{})}}}}const Jp=Zs("[Surveys]"),Kp="PostHog is not capturing, so a survey response cannot be recorded";function Xp(t){return Ce(t.is_capturing)?t.is_capturing():!t.has_opted_out_capturing()}function Yp(t){return!(!t.start_date||t.end_date)}function tg(t){var e;return!!(null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length)}const eg=(t,e)=>`${t}${function(t){return t.current_iteration&&t.current_iteration>0?`${t.id}_${t.current_iteration}`:t.id}(e)}`,ig=t=>eg("seenSurvey_",t),ng=t=>{try{const e=ig(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Jp.error("Failed to persist survey seen state",t)}},sg=[Ep,Pp,"api"],rg={ignoreConditions:!1,ignoreDelay:!1,displayType:Zp},og="logs",ag=Zs("[Stylesheet Loader]"),lg=t,ug=n,hg="#020617",cg={fontFamily:"inherit",backgroundColor:"#eeeded",submitButtonColor:"black",submitButtonTextColor:"white",ratingButtonColor:"white",ratingButtonActiveColor:"black",borderColor:"#c9c6c6",whiteLabel:!1,displayThankYouMessage:!0,thankYouMessageHeader:"Thank you for your feedback!",position:Ip,widgetType:Cp,widgetLabel:"Feedback",widgetColor:"black",zIndex:String(2147483645),disabledButtonOpacity:"0.6",maxWidth:"300px",textSubtleColor:"#939393",boxPadding:"20px 24px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",borderRadius:"10px",shuffleQuestions:!1,surveyPopupDelaySeconds:void 0,outlineColor:"rgba(59, 130, 246, 0.8)",inputBackground:"white",inputTextColor:hg,scrollbarThumbColor:"var(--ph-survey-border-color)",scrollbarTrackColor:"var(--ph-survey-background-color)"},dg=[Tp,$p,Ip];function vg(t){if(t.startsWith("#")){let e=t.replace(/^#/,"");return/^[0-9A-Fa-f]{3}$/.test(e)&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),/^[0-9A-Fa-f]{6}$/.test(e)?`rgb(${parseInt(e.slice(0,2),16)},${parseInt(e.slice(2,4),16)},${parseInt(e.slice(4,6),16)})`:"rgb(255, 255, 255)"}return"rgb(255, 255, 255)"}function fg(t=cg.backgroundColor){let e;"#"===t[0]&&(e=vg(t)),t.startsWith("rgb")&&(e=t);const i={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}[t.toLowerCase()];if(i&&(e=vg(i)),!e)return hg;const n=e.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);if(n){const t=parseInt(n[1]),e=parseInt(n[2]),i=parseInt(n[3]);return Math.sqrt(t*t*.299+e*e*.587+i*i*.114)>127.5?hg:"white"}return hg}const pg=(t,e,i)=>{const n=Ag(t),s=ug.querySelector(`.${n}`);if(s&&s.shadowRoot)return{shadow:s.shadowRoot,isNewlyCreated:!1};const r=ug.createElement("div");((t,e,i)=>{const n=he(he({},cg),i),s=t.style,r=!dg.includes(n.position)||e===Pp&&(null==i?void 0:i.widgetType)===Cp;s.setProperty("--ph-survey-font-family",function(t){if("inherit"===t)return"inherit";const e='BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';return t?`${t}, ${e}`:`-apple-system, ${e}`}(n.fontFamily)),s.setProperty("--ph-survey-box-padding",n.boxPadding),s.setProperty("--ph-survey-max-width",n.maxWidth),s.setProperty("--ph-survey-z-index",n.zIndex),s.setProperty("--ph-survey-border-color",n.borderColor),r?(s.setProperty("--ph-survey-border-radius",n.borderRadius),s.setProperty("--ph-survey-border-bottom","1.5px solid var(--ph-survey-border-color)")):(s.setProperty("--ph-survey-border-bottom","none"),s.setProperty("--ph-survey-border-radius",`${n.borderRadius} ${n.borderRadius} 0 0`)),s.setProperty("--ph-survey-background-color",n.backgroundColor),s.setProperty("--ph-survey-box-shadow",n.boxShadow),s.setProperty("--ph-survey-disabled-button-opacity",n.disabledButtonOpacity),s.setProperty("--ph-survey-submit-button-color",n.submitButtonColor),s.setProperty("--ph-survey-submit-button-text-color",(null==i?void 0:i.submitButtonTextColor)||fg(n.submitButtonColor)),s.setProperty("--ph-survey-rating-bg-color",n.ratingButtonColor),s.setProperty("--ph-survey-rating-active-bg-color",n.ratingButtonActiveColor),s.setProperty("--ph-survey-rating-active-text-color",fg(n.ratingButtonActiveColor)),s.setProperty("--ph-survey-text-primary-color",(null==i?void 0:i.textColor)||fg(n.backgroundColor)),s.setProperty("--ph-survey-text-subtle-color",n.textSubtleColor),s.setProperty("--ph-widget-color",n.widgetColor),s.setProperty("--ph-widget-text-color",fg(n.widgetColor)),s.setProperty("--ph-widget-z-index",n.zIndex);const o=(null==i?void 0:i.inputBackground)||(null==i?void 0:i.inputBackgroundColor);let a=o||n.inputBackground;o||"white"!==n.backgroundColor||(a="#f8f8f8"),s.setProperty("--ph-survey-input-background",a);const l=(null==i?void 0:i.inputTextColor)||fg(a);s.setProperty("--ph-survey-input-text-color",l),s.setProperty("--ph-survey-rating-text-color",l),s.setProperty("--ph-survey-scrollbar-thumb-color",n.scrollbarThumbColor),s.setProperty("--ph-survey-scrollbar-track-color",n.scrollbarTrackColor),s.setProperty("--ph-survey-outline-color",n.outlineColor)})(r,t.type,t.appearance),r.className=n;const o=r.attachShadow({mode:"open"}),a=function(t){const e=((t,e,i)=>{let n=t.createElement("style");n.innerText=e;const s=(t=>{var e;return Ce(t)?t:null==t||null===(e=t.config)||void 0===e?void 0:e.prepare_external_dependency_stylesheet})(i);return s&&(n=s(n)),n||(ag.error("prepare_external_dependency_stylesheet returned null"),null)})(ug,':host{--ph-survey-font-family:-apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Roboto", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";--ph-survey-box-padding:20px 24px;--ph-survey-max-width:300px;--ph-survey-z-index:calc(2147480000 + 3645);--ph-survey-border-color:#dcdcdc;--ph-survey-border-bottom:1.5px solid var(--ph-survey-border-color);--ph-survey-border-radius:10px;--ph-survey-background-color:#eeeded;--ph-survey-box-shadow:0 4px 12px #00000026;--ph-survey-submit-button-color:black;--ph-survey-submit-button-text-color:white;--ph-survey-rating-bg-color:white;--ph-survey-rating-text-color:#020617;--ph-survey-rating-active-bg-color:black;--ph-survey-rating-active-text-color:white;--ph-survey-text-primary-color:#020617;--ph-survey-text-subtle-color:#939393;--ph-widget-color:#e0a045;--ph-widget-text-color:white;--ph-survey-scrollbar-thumb-color:var(--ph-survey-border-color);--ph-survey-scrollbar-track-color:var(--ph-survey-background-color);--ph-survey-outline-color:#3b82f6cc;--ph-survey-input-background:white;--ph-survey-input-text-color:#020617;--ph-survey-disabled-button-opacity:.6}.ph-survey{min-width:300px;width:var(--ph-survey-max-width);max-width:85%;z-index:var(--ph-survey-z-index);height:fit-content;margin:0;position:fixed;bottom:0}.ph-survey h3,.ph-survey p{margin:0}.ph-survey *{box-sizing:border-box;font-family:var(--ph-survey-font-family);color:var(--ph-survey-text-primary-color)}.ph-survey textarea,.ph-survey input[type=text],.ph-survey .multiple-choice-options label{color:var(--ph-survey-input-text-color);background:var(--ph-survey-input-background);border:1.5px solid var(--ph-survey-border-color);border-radius:4px;padding:10px;transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey textarea,.ph-survey input[type=text]{transition:border-color .2s ease-out,box-shadow .2s ease-out,transform .15s ease-out}.ph-survey input{margin:0}.ph-survey textarea:focus,.ph-survey textarea:focus-visible,.ph-survey input[type=text]:focus,.ph-survey input[type=text]:focus-visible,.ph-survey .form-submit:focus,.ph-survey .form-submit:focus-visible,.ph-survey input[type=checkbox]:focus,.ph-survey input[type=radio]:focus,.ph-survey input[type=checkbox]:focus-visible,.ph-survey input[type=radio]:focus-visible{outline:1.5px solid var(--ph-survey-outline-color);border-color:var(--ph-survey-rating-active-bg-color);outline-offset:2px}.ph-survey textarea:focus:not(:focus-visible),.ph-survey input[type=text]:focus:not(:focus-visible),.ph-survey button:focus:not(:focus-visible),.ph-survey input[type=checkbox]:focus:not(:focus-visible),.ph-survey input[type=radio]:focus:not(:focus-visible){outline:none}.ph-survey textarea:hover:not(:focus),.ph-survey input[type=text]:hover:not(:focus){border-color:var(--ph-survey-rating-active-bg-color)}@media (max-width:768px){.ph-survey textarea,.ph-survey input[type=text]{font-size:1rem}}.ph-survey .multiple-choice-options label,.ph-survey .rating-options-number,.ph-survey .form-cancel,.ph-survey input[type=checkbox],.ph-survey input[type=radio]{border:1.5px solid var(--ph-survey-border-color)}.ph-survey label,.ph-survey input[type=checkbox],.ph-survey input[type=radio],.ph-survey .ratings-emoji,.ph-survey .ratings-number,.ph-survey .footer-branding,.ph-survey .form-cancel,.ph-survey .form-submit{transition:all .2s ease-out}@media (prefers-reduced-motion:no-preference){.ph-survey button:active,.ph-survey input[type=checkbox]:active,.ph-survey input[type=radio]:active,.ph-survey label:active{transition-duration:.1s}}.ph-survey-widget-tab{background:var(--ph-widget-color);color:var(--ph-widget-text-color);text-align:center;cursor:pointer;z-index:var(--ph-survey-z-index);border:none;border-radius:3px 3px 0 0;padding:10px 12px;transition:padding .2s ease-out;position:fixed}.ph-survey-widget-tab:hover:not(.widget-tab-top){padding-bottom:16px}.ph-survey-widget-tab.widget-tab-top{border-radius:0 0 3px 3px}.ph-survey-widget-tab.widget-tab-top:hover{padding-top:16px}@keyframes ph-survey-fade-in{0%{opacity:0}to{opacity:1}}.survey-box{flex-direction:column;gap:16px;display:flex}.bottom-section{flex-direction:column;gap:8px;display:flex}.thank-you-message-header~.bottom-section,.intro-screen-header~.bottom-section{padding-top:16px}.question-container,.thank-you-message,.intro-screen{flex-direction:column;gap:8px;display:flex}.survey-question{font-size:14px;font-weight:500}.survey-question-description{opacity:.8;padding-top:4px;font-size:13px}.survey-question-description,.thank-you-message-body,.intro-screen-body{word-wrap:break-word;overflow-wrap:break-word}:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) img,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) video,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) iframe,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) embed,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) object,:is(.survey-question-description,.thank-you-message-body,.intro-screen-body) svg{max-width:100%;height:auto}.question-textarea-wrapper{flex-direction:column;display:flex}.survey-form{animation:.3s ease-out forwards ph-survey-fade-in}.survey-form,.thank-you-message,.intro-screen{text-align:left;width:100%;z-index:var(--ph-survey-z-index);border:1.5px solid var(--ph-survey-border-color);border-bottom:var(--ph-survey-border-bottom);background:var(--ph-survey-background-color);border-radius:var(--ph-survey-border-radius);box-shadow:var(--ph-survey-box-shadow);padding:var(--ph-survey-box-padding);margin:0;position:relative}.survey-form textarea,.survey-form input[type=text]{min-width:100%}.survey-form textarea:focus,.survey-form textarea:focus-visible{box-shadow:0 4px 12px #00000014}.survey-form textarea:focus:not(:focus-visible){box-shadow:none}.survey-box .question-header--empty~.multiple-choice-options,.survey-box .question-header--empty~textarea{margin-top:0}.multiple-choice-options{border:none;flex-direction:column;gap:8px;margin:0;padding:1px 0;font-size:14px;display:flex}.multiple-choice-options label,.multiple-choice-options .response-choice{color:inherit;align-items:center;gap:8px;display:flex}.multiple-choice-options label{cursor:pointer;font-size:13px}.multiple-choice-options label:hover:not(:has(input:checked)){border-color:var(--ph-survey-text-subtle-color);box-shadow:0 2px 8px #00000014}.multiple-choice-options label:has(input:checked){border-color:var(--ph-survey-rating-active-bg-color);box-shadow:0 1px 4px #0000000d}.multiple-choice-options label.choice-option-open{flex-wrap:wrap}.multiple-choice-options label span{color:inherit}.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:var(--ph-survey-input-background);cursor:pointer;z-index:1;border-radius:3px;flex-shrink:0;width:1rem;height:1rem;transition:all .2s cubic-bezier(.4,0,.2,1),transform .15s ease-out;position:relative}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):focus{transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):hover{border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1.05)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):active{transform:scale(.95)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked{background:var(--ph-survey-rating-active-bg-color);border-color:var(--ph-survey-rating-active-bg-color);transform:scale(1)}:is(.multiple-choice-options input[type=checkbox],.multiple-choice-options input[type=radio]):checked:hover{transform:scale(1.05)}.multiple-choice-options input[type=checkbox]:checked:after{border:solid var(--ph-survey-rating-active-text-color);border-width:0 2px 2px 0;width:4px;height:8px;animation:.2s ease-out .1s forwards ph-survey-checkmark-reveal;left:4px;transform:rotate(45deg)scale(0)}.multiple-choice-options input[type=radio]:checked:after{background:var(--ph-survey-rating-active-text-color);border-radius:50%;width:6px;height:6px;animation:.15s ease-out 50ms forwards ph-survey-radio-reveal;top:5px;left:5px;transform:scale(0)}.multiple-choice-options input[type=checkbox]:checked:after,.multiple-choice-options input[type=radio]:checked:after{content:"";box-sizing:content-box;position:absolute}.multiple-choice-options input[type=radio]{border-radius:50%}.multiple-choice-options input[type=radio]:checked{border:none}:is(.multiple-choice-options input[type=checkbox]:checked,.multiple-choice-options input[type=radio]:checked)~*{font-weight:700}.multiple-choice-options .choice-option-open input[type=text]::placeholder{color:var(--ph-survey-text-subtle-color);font-weight:400}.rating-options-emoji{justify-content:space-between;display:flex}.rating-options-emoji-2{justify-content:space-around}.ratings-emoji{opacity:.5;background-color:#0000;border:none;padding:0;font-size:16px}.ratings-emoji:hover{cursor:pointer;opacity:1;transform:scale(1.15)}.ratings-emoji.rating-active{opacity:1}.ratings-emoji svg{fill:var(--ph-survey-text-primary-color);transition:fill .2s ease-out}.rating-options-number{border-radius:6px;grid-auto-columns:1fr;grid-auto-flow:column;display:grid;overflow:hidden}.rating-options-number .ratings-number{border-right:1px solid var(--ph-survey-border-color);text-align:center;cursor:pointer;color:var(--ph-survey-rating-text-color);border-top:none;border-bottom:none;border-left:none;font-weight:700}.rating-options-number .ratings-number:last-of-type{border-right:0}.rating-options-number .ratings-number.rating-active{background:var(--ph-survey-rating-active-bg-color);color:var(--ph-survey-rating-active-text-color)}.ratings-number{background-color:var(--ph-survey-rating-bg-color);border:none;padding:8px 0}.ratings-number .rating-active{background-color:var(--ph-survey-rating-active-bg-color)}.ratings-number{cursor:pointer}@media (hover:hover) and (pointer:fine){.ratings-number:hover:not(.rating-active){background-color:color-mix(in srgb, var(--ph-survey-rating-active-bg-color) 14%, var(--ph-survey-rating-bg-color))}}.rating-text{opacity:.7;flex-direction:row;justify-content:space-between;font-size:11px;display:flex}.form-buttons{flex-direction:row;gap:8px;width:100%;display:flex}.form-buttons-with-back>.form-submit{flex:auto;min-width:0}.form-submit{text-align:center;cursor:pointer;user-select:none;background:var(--ph-survey-submit-button-color);color:var(--ph-survey-submit-button-text-color);border:none;border-radius:6px;min-width:100%;padding:12px;font-weight:700;box-shadow:0 2px #0000000b}.form-submit:not([disabled]):hover{transform:scale(1.02);box-shadow:0 4px 8px #0000001a}.form-submit:not([disabled]):active{transform:scale(.98);box-shadow:0 1px 2px #0000000d}.form-submit[disabled]{opacity:var(--ph-survey-disabled-button-opacity);cursor:not-allowed}.form-back{text-align:center;cursor:pointer;user-select:none;color:var(--ph-survey-text-primary-color);border:1.5px solid var(--ph-survey-border-color);background:0 0;border-radius:6px;flex:none;padding:12px 16px;font-weight:600}.form-back:hover{transform:scale(1.02)}.form-back:active{transform:scale(.98)}.validation-hint{opacity:.7;margin-top:4px;font-size:12px}.form-cancel{cursor:pointer;background:#fff;border-radius:100%;padding:12px;line-height:0;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.form-cancel:hover{opacity:.7;transform:translate(50%,-50%)scale(1.1)}.footer-branding{opacity:.6;justify-content:center;align-items:center;gap:4px;font-size:11px;font-weight:500;text-decoration:none;display:flex}.footer-branding:hover{opacity:1}.footer-branding a{text-decoration:none}.thank-you-message{text-align:center}.thank-you-message-header{margin:10px 0 0}.thank-you-message-body{opacity:.8;font-size:14px}.intro-screen{text-align:center;animation:.3s ease-out forwards ph-survey-fade-in}.intro-screen-header{margin:10px 0 0}.intro-screen-body{opacity:.8;font-size:14px}.limit-height{scrollbar-width:thin;scrollbar-color:var(--ph-survey-scrollbar-thumb-color) var(--ph-survey-scrollbar-track-color);max-height:256px;overflow:hidden auto}.limit-height::-webkit-scrollbar{width:8px}.limit-height::-webkit-scrollbar-track{background:var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb{background-color:var(--ph-survey-scrollbar-thumb-color);border:2px solid var(--ph-survey-scrollbar-track-color);border-radius:4px}.limit-height::-webkit-scrollbar-thumb:hover{background-color:var(--ph-survey-text-subtle-color)}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}@media (prefers-reduced-motion:reduce){.ph-survey *{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes ph-survey-checkmark-reveal{0%{opacity:0;transform:rotate(45deg)scale(0)}50%{opacity:1;transform:rotate(45deg)scale(1.2)}to{opacity:1;transform:rotate(45deg)scale(1)}}@keyframes ph-survey-radio-reveal{0%{opacity:0;transform:scale(0)}50%{opacity:1;transform:scale(1.3)}to{opacity:1;transform:scale(1)}}',t);return null==e||e.setAttribute("data-ph-survey-style","true"),e}(e);if(a){const t=o.querySelector("style");t&&o.removeChild(t),o.appendChild(a)}return(i||ug.body).appendChild(r),{shadow:o,isNewlyCreated:!0}},gg=({responses:t,survey:e,surveySubmissionId:i,posthog:n,isSurveyCompleted:s,properties:r,surveyLanguage:o,questionSnapshots:a})=>{var l;n?Xp(n)&&(ng(e),n.capture(Bp,he(he(he({[zp]:e.name,[Hp]:e.id,[Up]:e.current_iteration,[Wp]:e.current_iteration_start_date,sessionRecordingUrl:null===(l=n.get_session_replay_url)||void 0===l?void 0:l.call(n)},sl({event:"sent",survey:e,responses:t,submissionId:i,completed:s,surveyLanguage:o,questionSnapshots:a})),r),{},{$set:{[ol(e,"responded")]:!0}})),s&&(lg.dispatchEvent(new CustomEvent("PHSurveySent",{detail:{surveyId:e.id}})),Rg(e),n.reloadFeatureFlags())):Jp.error("[survey sent] event not captured, PostHog instance not found.")},mg=(t,e,i,n)=>{var s;return he({[zp]:e.name,[Hp]:e.id,[Up]:e.current_iteration,[Wp]:e.current_iteration_start_date,sessionRecordingUrl:null===(s=n.get_session_replay_url)||void 0===s?void 0:s.call(n)},sl({event:t,survey:e,responses:null==i?void 0:i.responses,submissionId:null==i?void 0:i.surveySubmissionId,surveyLanguage:null==i?void 0:i.surveyLanguage,questionSnapshots:null==i?void 0:i.questionSnapshots}))},yg=(t,e,i,n)=>{if(!e)return void Jp.error("[survey dismissed] event not captured, PostHog instance not found.");if(i)return;const s=Eg(t),r=s?s.surveyLanguage:n;e.capture(jp,he(he(he({},mg("dismissed",t,s,e)),r&&{[Gp]:r}),{},{$set:{[ol(t,"dismissed")]:!0}})),Rg(t),ng(t),lg.dispatchEvent(new CustomEvent("PHSurveyClosed",{detail:{surveyId:t.id}}))},bg=(t,e)=>{if(!e)return void Jp.error("[survey abandoned] event not captured, PostHog instance not found.");const i=(t=>eg("abandonedSurvey_",t))(t);try{if("true"===localStorage.getItem(i))return}catch(t){return}const n=Eg(t);if(n){try{localStorage.setItem(i,"true")}catch(t){}e.capture("survey abandoned",mg("abandoned",t,n,e),{transport:"sendBeacon"})}},_g=t=>{const e=t.map(t=>t.id);return e.every(t=>!!t)?e:void 0},wg=(t,e)=>{return(t=>t.questions.some(t=>{var e;return!!(null===(e=t.branching)||void 0===e?void 0:e.type)}))(t)?t.questions:e?null!==(i=((t,e)=>{if(!e||e.length!==t.questions.length)return null;const i=new Map(t.questions.map(t=>[t.id,t])),n=[];for(const t of e){const e=i.get(t);if(!e)return null;n.push(e)}return n})(t,e.questionOrder))&&void 0!==i?i:t.questions:t.appearance&&t.appearance.shuffleQuestions&&!t.enable_partial_responses?(n=t.questions,s=yl(t.questions),n.length===s.length&&n.every((t,e)=>t===s[e])?s.reverse():s):t.questions;var i,n,s},kg=t=>vl(t)||Pg(t),Sg=function(t){function e(t){var i,n;return this.getChildContext||(i=new Set,(n={})[e.__c]=this,this.getChildContext=function(){return n},this.componentWillUnmount=function(){i=null},this.shouldComponentUpdate=function(t){this.props.value!=t.value&&i.forEach(function(t){t.__e=!0,Lf(t)})},this.sub=function(t){i.add(t);var e=t.componentWillUnmount;t.componentWillUnmount=function(){i&&i.delete(t),e&&e.call(t)}}),t.children}return e.__c="__cC"+bf++,e.__=t,e.Provider=e.__l=(e.Consumer=function(t,e){return t.children(e)}).contextType=e,e}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed(){},isPopup:!0,onPreviewSubmit(){},onPreviewBack(){},surveySubmissionId:"",properties:void 0,surveyLanguage:null}),xg=()=>vp(Sg),Cg=({component:t,children:e,renderAsHtml:i,style:n})=>function(t,e,i){var n,s,r,o,a=If({},t.props);for(r in t.type&&t.type.defaultProps&&(o=t.type.defaultProps),e)"key"==r?n=e[r]:"ref"==r?s=e[r]:a[r]=void 0===e[r]&&null!=o?o[r]:e[r];return arguments.length>2&&(a.children=arguments.length>3?rf.call(arguments,2):i),Pf(t.type,a,n||t.key,s||t.ref,null)}(t,i?{dangerouslySetInnerHTML:{__html:e},style:n}:{children:e,style:n});function $g(t,e){var i,n;if(!(null===(i=t.conditions)||void 0===i?void 0:i.url))return!0;const s=gr(e);if(!s)return!1;const r=[t.conditions.url],o=function(t){return null!=t?t:"icontains"}(null===(n=t.conditions)||void 0===n?void 0:n.urlMatchType);return gl[o](r,[s])}const Tg=t=>eg("inProgressSurvey_",t),Ig={},Mg=(t,e)=>{const i=Tg(t);try{localStorage.setItem(i,JSON.stringify(e)),delete Ig[i]}catch(t){Jp.error("Error setting in-progress survey state in localStorage",t),Ig[i]=e}},Eg=t=>{const e=Tg(t),i=Ig[e];if(i)return i;try{const t=localStorage.getItem(e);if(t)return JSON.parse(t)}catch(t){Jp.error("Error getting in-progress survey state from localStorage",t)}return null},Pg=t=>{const e=Eg(t);return!Re(null==e?void 0:e.surveySubmissionId)},Rg=t=>{const e=Tg(t);delete Ig[e];try{localStorage.removeItem(e)}catch(t){Jp.error("Error clearing in-progress survey state from localStorage",t)}};function Ag(t,e=!1){const i=`PostHogSurvey-${t.id}`;return e?`.${i}`:i}function Fg(t,e=Ip,i){if(t===Rp)return{};switch(e){case"top_left":return{top:"0",left:"0",transform:"translate(30px, 30px)"};case"top_right":return{top:"0",right:"0",transform:"translate(-30px, 30px)"};case"top_center":return{top:"0",left:"50%",transform:"translate(-50%, 30px)"};case"middle_left":return{top:"50%",left:"0",transform:"translate(30px, -50%)"};case"middle_right":return{top:"50%",right:"0",transform:"translate(-30px, -50%)"};case"middle_center":return{top:"50%",left:"50%",transform:"translate(-50%, -50%)"};case $p:return{left:"30px"};case Tp:return{left:"50%",transform:"translateX(-50%)"};default:return{right:t===Pp&&i===Cp?"60px":"30px"}}}var Og=0;function Dg(t,e,i,n,s,r){e||(e={});var o,a,l=e;if("ref"in l)for(a in l={},e)"ref"==a?o=e[a]:l[a]=e[a];var u={type:t,props:l,key:i,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Og,__i:-1,__u:0,__source:s,__self:r};if("function"==typeof t&&(o=t.defaultProps))for(a in o)void 0===l[a]&&(l[a]=o[a]);return of.vnode&&of.vnode(u),u}const Lg=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Dg("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146 272q66 0 121.5-35.5T682-393h-52q-23 40-63 61.5T480.5-310q-46.5 0-87-21T331-393h-53q26 61 81 96.5T480-261Zm0 181q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Ng=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Dg("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm20 194h253v-49H354v49ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),qg=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Dg("path",{d:"M626-533q22.5 0 38.25-15.75T680-587q0-22.5-15.75-38.25T626-641q-22.5 0-38.25 15.75T572-587q0 22.5 15.75 38.25T626-533Zm-292 0q22.5 0 38.25-15.75T388-587q0-22.5-15.75-38.25T334-641q-22.5 0-38.25 15.75T280-587q0 22.5 15.75 38.25T334-533Zm146.174 116Q413-417 358.5-379.5T278-280h53q22-42 62.173-65t87.5-23Q528-368 567.5-344.5T630-280h52q-25-63-79.826-100-54.826-37-122-37ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),jg=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Dg("path",{d:"M480-417q-67 0-121.5 37.5T278-280h404q-25-63-80-100t-122-37Zm-183-72 50-45 45 45 31-36-45-45 45-45-31-36-45 45-50-45-31 36 45 45-45 45 31 36Zm272 0 44-45 51 45 31-36-45-45 45-45-31-36-51 45-44-45-31 36 44 45-44 45 31 36ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142 0 241-99t99-241q0-142-99-241t-241-99q-142 0-241 99t-99 241q0 142 99 241t241 99Z"})}),Bg=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 -960 960 960",width:"48",children:Dg("path",{d:"M479.504-261Q537-261 585.5-287q48.5-26 78.5-72.4 6-11.6-.75-22.6-6.75-11-20.25-11H316.918Q303-393 296.5-382t-.5 22.6q30 46.4 78.5 72.4 48.5 26 105.004 26ZM347-578l27 27q7.636 8 17.818 8Q402-543 410-551q8-8 8-18t-8-18l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.636-8 17.818Q276-559 284-551q8 8 18 8t18-8l27-27Zm267 0 27 27q7.714 8 18 8t18-8q8-7.636 8-17.818Q685-579 677-587l-42-42q-8.8-9-20.9-9-12.1 0-21.1 9l-42 42q-8 7.714-8 18t8 18q7.636 8 17.818 8Q579-543 587-551l27-27ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-400Zm0 340q142.375 0 241.188-98.812Q820-337.625 820-480t-98.812-241.188Q622.375-820 480-820t-241.188 98.812Q140-622.375 140-480t98.812 241.188Q337.625-140 480-140Z"})}),Hg=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Dg("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})}),zg=Dg("svg",{className:"emoji-svg",xmlns:"http://www.w3.org/2000/svg",height:"48",viewBox:"0 0 24 24",width:"48",children:Dg("path",{d:"M22 4h-2c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h2V4zM2.17 11.12c-.11.25-.17.52-.17.8V13c0 1.1.9 2 2 2h5.5l-.92 4.65c-.05.22-.02.46.08.66.23.45.52.86.88 1.22L10 22l6.41-6.41c.38-.38.59-.89.59-1.42V6.34C17 5.05 15.95 4 14.66 4H6.55c-.7 0-1.36.37-1.72.97l-2.66 6.15z"})}),Ug=({fill:t="currentColor"}={})=>Dg("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:t,xmlns:"http://www.w3.org/2000/svg","aria-labelledby":"close-survey-title-adam",children:[Dg("title",{id:"close-survey-title",className:"adam-testing",children:"Close survey"}),Dg("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.164752 0.164752C0.384422 -0.0549175 0.740578 -0.0549175 0.960248 0.164752L6 5.20451L11.0398 0.164752C11.2594 -0.0549175 11.6156 -0.0549175 11.8352 0.164752C12.0549 0.384422 12.0549 0.740578 11.8352 0.960248L6.79549 6L11.8352 11.0398C12.0549 11.2594 12.0549 11.6156 11.8352 11.8352C11.6156 12.0549 11.2594 12.0549 11.0398 11.8352L6 6.79549L0.960248 11.8352C0.740578 12.0549 0.384422 12.0549 0.164752 11.8352C-0.0549175 11.6156 -0.0549175 11.2594 0.164752 11.0398L5.20451 6L0.164752 0.960248C-0.0549175 0.740578 -0.0549175 0.384422 0.164752 0.164752Z",fill:t})]}),Wg=Dg("svg",{width:"77",height:"14",viewBox:"0 0 77 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Dg("g",{"clip-path":"url(#clip0_2415_6911)",children:[Dg("mask",{id:"mask0_2415_6911",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"77",height:"14",children:Dg("path",{d:"M0.5 0H76.5V14H0.5V0Z",fill:"white"})}),Dg("g",{mask:"url(#mask0_2415_6911)",children:[Dg("path",{d:"M5.77226 8.02931C5.59388 8.37329 5.08474 8.37329 4.90634 8.02931L4.4797 7.20672C4.41155 7.07535 4.41155 6.9207 4.4797 6.78933L4.90634 5.96669C5.08474 5.62276 5.59388 5.62276 5.77226 5.96669L6.19893 6.78933C6.26709 6.9207 6.26709 7.07535 6.19893 7.20672L5.77226 8.02931ZM5.77226 12.6946C5.59388 13.0386 5.08474 13.0386 4.90634 12.6946L4.4797 11.872C4.41155 11.7406 4.41155 11.586 4.4797 11.4546L4.90634 10.632C5.08474 10.288 5.59388 10.288 5.77226 10.632L6.19893 11.4546C6.26709 11.586 6.26709 11.7406 6.19893 11.872L5.77226 12.6946Z",fill:"#1D4AFF"}),Dg("path",{d:"M0.5 10.9238C0.5 10.508 1.02142 10.2998 1.32637 10.5938L3.54508 12.7327C3.85003 13.0267 3.63405 13.5294 3.20279 13.5294H0.984076C0.716728 13.5294 0.5 13.3205 0.5 13.0627V10.9238ZM0.5 8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.19753 13.3927C5.28831 13.4802 5.41144 13.5294 5.53982 13.5294H8.0421C8.47337 13.5294 8.68936 13.0267 8.3844 12.7327L1.32637 5.92856C1.02142 5.63456 0.5 5.84278 0.5 6.25854V8.67083ZM0.5 4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L10.0368 13.3927C10.1276 13.4802 10.2508 13.5294 10.3791 13.5294H12.8814C13.3127 13.5294 13.5287 13.0267 13.2237 12.7327L1.32637 1.26329C1.02142 0.969312 0.5 1.17752 0.5 1.59327V4.00556ZM5.33931 4.00556C5.33931 4.12932 5.39033 4.24802 5.4811 4.33554L14.1916 12.7327C14.4965 13.0267 15.0179 12.8185 15.0179 12.4028V9.99047C15.0179 9.86671 14.9669 9.74799 14.8762 9.66049L6.16568 1.26329C5.86071 0.969307 5.33931 1.17752 5.33931 1.59327V4.00556ZM11.005 1.26329C10.7 0.969307 10.1786 1.17752 10.1786 1.59327V4.00556C10.1786 4.12932 10.2296 4.24802 10.3204 4.33554L14.1916 8.06748C14.4965 8.36148 15.0179 8.15325 15.0179 7.7375V5.3252C15.0179 5.20144 14.9669 5.08272 14.8762 4.99522L11.005 1.26329Z",fill:"#F9BD2B"}),Dg("path",{d:"M21.0852 10.981L16.5288 6.58843C16.2238 6.29443 15.7024 6.50266 15.7024 6.91841V13.0627C15.7024 13.3205 15.9191 13.5294 16.1865 13.5294H23.2446C23.5119 13.5294 23.7287 13.3205 23.7287 13.0627V12.5032C23.7287 12.2455 23.511 12.0396 23.2459 12.0063C22.4323 11.9042 21.6713 11.546 21.0852 10.981ZM18.0252 12.0365C17.5978 12.0365 17.251 11.7021 17.251 11.2901C17.251 10.878 17.5978 10.5436 18.0252 10.5436C18.4527 10.5436 18.7996 10.878 18.7996 11.2901C18.7996 11.7021 18.4527 12.0365 18.0252 12.0365Z",fill:"currentColor"}),Dg("path",{d:"M0.5 13.0627C0.5 13.3205 0.716728 13.5294 0.984076 13.5294H3.20279C3.63405 13.5294 3.85003 13.0267 3.54508 12.7327L1.32637 10.5938C1.02142 10.2998 0.5 10.508 0.5 10.9238V13.0627ZM5.33931 5.13191L1.32637 1.26329C1.02142 0.969306 0.5 1.17752 0.5 1.59327V4.00556C0.5 4.12932 0.551001 4.24802 0.641783 4.33554L5.33931 8.86412V5.13191ZM1.32637 5.92855C1.02142 5.63455 0.5 5.84278 0.5 6.25853V8.67083C0.5 8.79459 0.551001 8.91331 0.641783 9.00081L5.33931 13.5294V9.79717L1.32637 5.92855Z",fill:"#1D4AFF"}),Dg("path",{d:"M10.1787 5.3252C10.1787 5.20144 10.1277 5.08272 10.0369 4.99522L6.16572 1.26329C5.8608 0.969306 5.33936 1.17752 5.33936 1.59327V4.00556C5.33936 4.12932 5.39037 4.24802 5.48114 4.33554L10.1787 8.86412V5.3252ZM5.33936 13.5294H8.04214C8.47341 13.5294 8.6894 13.0267 8.38443 12.7327L5.33936 9.79717V13.5294ZM5.33936 5.13191V8.67083C5.33936 8.79459 5.39037 8.91331 5.48114 9.00081L10.1787 13.5294V9.99047C10.1787 9.86671 10.1277 9.74803 10.0369 9.66049L5.33936 5.13191Z",fill:"#F54E00"}),Dg("path",{d:"M29.375 11.6667H31.3636V8.48772H33.0249C34.8499 8.48772 36.0204 7.4443 36.0204 5.83052C36.0204 4.21681 34.8499 3.17334 33.0249 3.17334H29.375V11.6667ZM31.3636 6.84972V4.81136H32.8236C33.5787 4.81136 34.0318 5.19958 34.0318 5.83052C34.0318 6.4615 33.5787 6.84972 32.8236 6.84972H31.3636ZM39.618 11.7637C41.5563 11.7637 42.9659 10.429 42.9659 8.60905C42.9659 6.78905 41.5563 5.45438 39.618 5.45438C37.6546 5.45438 36.2701 6.78905 36.2701 8.60905C36.2701 10.429 37.6546 11.7637 39.618 11.7637ZM38.1077 8.60905C38.1077 7.63838 38.7118 6.97105 39.618 6.97105C40.5116 6.97105 41.1157 7.63838 41.1157 8.60905C41.1157 9.57972 40.5116 10.2471 39.618 10.2471C38.7118 10.2471 38.1077 9.57972 38.1077 8.60905ZM46.1482 11.7637C47.6333 11.7637 48.6402 10.8658 48.6402 9.81025C48.6402 7.33505 45.2294 8.13585 45.2294 7.16518C45.2294 6.8983 45.5189 6.72843 45.9342 6.72843C46.3622 6.72843 46.8782 6.98318 47.0418 7.54132L48.527 6.94678C48.2375 6.06105 47.1677 5.45438 45.8713 5.45438C44.4743 5.45438 43.6058 6.25518 43.6058 7.21372C43.6058 9.53118 46.9663 8.88812 46.9663 9.84665C46.9663 10.1864 46.6391 10.417 46.1482 10.417C45.4434 10.417 44.9525 9.94376 44.8015 9.3735L43.3164 9.93158C43.6436 10.8537 44.6001 11.7637 46.1482 11.7637ZM53.4241 11.606L53.2982 10.0651C53.0843 10.1743 52.8074 10.2106 52.5808 10.2106C52.1278 10.2106 51.8257 9.89523 51.8257 9.34918V7.03172H53.3612V5.55145H51.8257V3.78001H49.9755V5.55145H48.9687V7.03172H49.9755V9.57972C49.9755 11.06 51.0202 11.7637 52.3921 11.7637C52.7696 11.7637 53.122 11.7031 53.4241 11.606ZM59.8749 3.17334V6.47358H56.376V3.17334H54.3874V11.6667H56.376V8.11158H59.8749V11.6667H61.8761V3.17334H59.8749ZM66.2899 11.7637C68.2281 11.7637 69.6378 10.429 69.6378 8.60905C69.6378 6.78905 68.2281 5.45438 66.2899 5.45438C64.3265 5.45438 62.942 6.78905 62.942 8.60905C62.942 10.429 64.3265 11.7637 66.2899 11.7637ZM64.7796 8.60905C64.7796 7.63838 65.3837 6.97105 66.2899 6.97105C67.1835 6.97105 67.7876 7.63838 67.7876 8.60905C67.7876 9.57972 67.1835 10.2471 66.2899 10.2471C65.3837 10.2471 64.7796 9.57972 64.7796 8.60905ZM73.2088 11.4725C73.901 11.4725 74.5177 11.242 74.845 10.8416V11.424C74.845 12.1034 74.2786 12.5767 73.4102 12.5767C72.7935 12.5767 72.2523 12.2854 72.1642 11.788L70.4776 12.0428C70.7042 13.1955 71.925 13.972 73.4102 13.972C75.361 13.972 76.6574 12.8679 76.6574 11.2298V5.55145H74.8324V6.07318C74.4926 5.69705 73.9136 5.45438 73.171 5.45438C71.409 5.45438 70.3014 6.61918 70.3014 8.46345C70.3014 10.3077 71.409 11.4725 73.2088 11.4725ZM72.1012 8.46345C72.1012 7.55345 72.655 6.97105 73.5109 6.97105C74.3793 6.97105 74.9331 7.55345 74.9331 8.46345C74.9331 9.37345 74.3793 9.95585 73.5109 9.95585C72.655 9.95585 72.1012 9.37345 72.1012 8.46345Z",fill:"currentColor"})]})]}),Dg("defs",{children:Dg("clipPath",{id:"clip0_2415_6911",children:Dg("rect",{width:"76",height:"14",fill:"white",transform:"translate(0.5)"})})})]});function Vg({urlParams:t}){const e=t?Object.entries(t).map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(e)}`).join("&"):"";return Dg("a",{href:"https://posthog.com/surveys"+(e?`?${e}`:""),target:"_blank",rel:"noopener",className:"footer-branding",children:["Survey by ",Wg]})}function Gg({text:e,submitDisabled:i,appearance:n,onSubmit:s,link:r,onPreviewSubmit:o,skipSubmitButton:a,canGoBack:l,onBack:u}){const{isPreviewMode:h}=vp(Sg),c=!!l&&!!u,d=!a&&Dg("button",{className:"form-submit",disabled:i,"aria-label":"Submit survey",type:"button",onClick(){r&&(null==t||t.open(r)),h?null==o||o():s()},children:e});return Dg("div",{className:"bottom-section",children:[c?Dg("div",{className:"form-buttons form-buttons-with-back",children:[Dg("button",{className:"form-back",type:"button","aria-label":"Go to previous question",onClick:u,children:n.backButtonText||"Back"}),d]}):d,!n.whiteLabel&&Dg(Vg,{urlParams:{utm_source:"survey-footer"}})]})}function Zg({question:t,forceDisableHtml:e,htmlFor:i}){return Dg("div",{class:t.question||t.description?"question-header":"question-header question-header--empty",children:[Dg(t.type===Ap?"label":"h3",{className:"survey-question",htmlFor:i,children:t.question}),t.description&&Cg({component:Ef("p",{className:"survey-question-description"}),children:t.description,renderAsHtml:!e&&"text"!==t.descriptionContentType})]})}function Qg({onClick:t}){const{isPreviewMode:e}=vp(Sg);return Dg("button",{className:"form-cancel",onClick:t,disabled:e,"aria-label":"Close survey",type:"button",children:Ug({fill:"black"})})}const Jg=t;function Kg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onClose:r}){const{isPopup:o}=vp(Sg);return hp(()=>{const t=t=>{"Enter"!==t.key&&"Escape"!==t.key||(t.preventDefault(),r())};return sr(Jg,"keydown",t),()=>{Jg.removeEventListener("keydown",t)}},[r]),Dg("div",{className:"thank-you-message",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&Dg(Qg,{onClick:()=>r()}),Dg("h3",{className:"thank-you-message-header",children:t}),e&&Cg({component:Ef("p",{className:"thank-you-message-body"}),children:e,renderAsHtml:!n&&"text"!==i}),o&&Dg(Gg,{text:s.thankYouMessageCloseButtonText||"Close",submitDisabled:!1,appearance:s,onSubmit:()=>r()})]})}function Xg({header:t,description:e,contentType:i,forceDisableHtml:n,appearance:s,onStart:r}){const{isPopup:o,onPreviewSubmit:a,onPopupSurveyDismissed:l}=vp(Sg);return Dg("div",{className:"intro-screen",role:"status",tabIndex:0,"aria-atomic":"true",children:[o&&!0!==s.hideCancelButton&&Dg(Qg,{onClick:()=>l()}),t&&Dg("h3",{className:"intro-screen-header",children:t}),e&&Cg({component:Ef("p",{className:"intro-screen-body"}),children:e,renderAsHtml:!n&&"text"!==i}),Dg(Gg,{text:s.introScreenButtonText||"Get started",submitDisabled:!1,appearance:s,onSubmit:r,onPreviewSubmit:()=>a(null)})]})}const Yg=t=>xe(t)&&t.every(t=>Me(t));function tm({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,displayQuestionIndex:r,initialValue:o,canGoBack:a,onBack:l}){const{isPreviewMode:u}=xg(),h=cp(null),[c,d]=up(()=>Me(o)?o:""),v=null==i?void 0:i.disableAutofocus;hp(()=>{v||setTimeout(()=>{var t;u||null===(t=h.current)||void 0===t||t.focus()},100)},[u,v]);const f=`surveyQuestion${r}`,p=dp(()=>function(t,e,i){const n=t.trim();if(!i&&""===n)return"This field is required";if(""===n)return!1;if(e&&e.length>0)for(const t of e)switch(t.type){case ve:var s;if(void 0!==t.value&&t.value>n.length)return null!==(s=t.errorMessage)&&void 0!==s?s:`Please enter at least ${t.value} characters`;break;case fe:var r;if(void 0!==t.value&&n.length>t.value)return null!==(r=t.errorMessage)&&void 0!==r?r:`Please enter no more than ${t.value} characters`}return!1}(c,t.validation,t.optional),[c,t.validation,t.optional]),g=zs(t.validation,ve),m=zs(t.validation,fe),y=dp(()=>function(t,e){const i=1===t?void 0:t;return i&&e?`Enter ${i}-${e} characters`:i?`Enter at least ${i} ${1===i?"character":"characters"}`:e?`Maximum ${e} ${1===e?"character":"characters"}`:void 0}(g,m),[g,m]),b=()=>{p||n(c.trim())},_=()=>{p||s(c.trim())};return Dg(Rf,{children:[Dg("div",{className:"question-container",children:[Dg(Zg,{question:t,forceDisableHtml:e,htmlFor:f}),Dg("textarea",{ref:h,id:f,rows:4,placeholder:null==i?void 0:i.placeholder,minLength:g,maxLength:m,onInput(t){d(t.currentTarget.value),t.stopPropagation()},onKeyDown(t){t.stopPropagation(),"Enter"!==t.key||!t.metaKey&&!t.ctrlKey||p||(t.preventDefault(),u?_():b())},value:c}),y&&Dg("div",{className:"validation-hint",children:y})]}),Dg(Gg,{text:t.buttonText||"Submit",submitDisabled:!!p,appearance:i,onSubmit:b,onPreviewSubmit:_,canGoBack:a,onBack:l})]})}function em({question:t,forceDisableHtml:e,appearance:i,onSubmit:n,onPreviewSubmit:s,canGoBack:r,onBack:o}){return Dg(Rf,{children:[Dg("div",{className:"question-container",children:Dg(Zg,{question:t,forceDisableHtml:e})}),Dg(Gg,{text:t.buttonText||"Submit",submitDisabled:!1,link:t.link,appearance:i,onSubmit:()=>n("link clicked"),onPreviewSubmit:()=>s("link clicked"),canGoBack:r,onBack:o})]})}function im({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){var u;const h=t.scale,c=10===t.scale?0:1,[d,v]=up(()=>Ae(o)?o:xe(o)&&o.length>0&&Ae(parseInt(o[0]))?parseInt(o[0]):Me(o)&&Ae(parseInt(o))?parseInt(o):null),f="emoji"===t.display&&2===t.scale,{isPreviewMode:p}=xg(),g=t=>p?r(t):s(t);return Dg(Rf,{children:[Dg("div",{className:"question-container",children:[Dg(Zg,{question:t,forceDisableHtml:e}),Dg("div",{className:"rating-section",children:[Dg("div",{className:"rating-options",children:["emoji"===t.display&&Dg("div",{className:"rating-options-emoji"+(f?" rating-options-emoji-2":""),children:null===(u=lm[t.scale])||void 0===u?void 0:u.map((e,n)=>Dg("button",{"aria-label":`Rate ${n+1}`,className:`ratings-emoji question-${i}-rating-${n} ${n+1===d?"rating-active":""}`,value:n+1,type:"button",onClick(){const e=n+1;v(e),t.skipSubmitButton&&g(e)},children:e},n))}),"number"===t.display&&Dg("div",{className:"rating-options-number",style:{gridTemplateColumns:`repeat(${h-c+1}, minmax(0, 1fr))`},children:um(t.scale).map((e,s)=>Dg(nm,{displayQuestionIndex:i,active:d===e,appearance:n,num:e,setActiveNumber(e){v(e),t.skipSubmitButton&&g(e)}},s))})]}),!f&&Dg("div",{className:"rating-text",children:[Dg("div",{children:t.lowerBoundLabel}),Dg("div",{children:t.upperBoundLabel})]})]})]}),Dg(Gg,{text:t.buttonText||(null==n?void 0:n.submitButtonText)||"Submit",submitDisabled:Pe(d)&&!t.optional,appearance:n,onSubmit:()=>s(d),onPreviewSubmit:()=>r(d),skipSubmitButton:t.skipSubmitButton,canGoBack:a,onBack:l})]})}function nm({num:t,active:e,displayQuestionIndex:i,setActiveNumber:n}){return Dg("button",{"aria-label":`Rate ${t}`,className:`ratings-number question-${i}-rating-${t} ${e?"rating-active":""}`,type:"button",onClick(){n(t)},children:t})}function sm({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l}){const u=cp(null),h=dp(()=>(t=>{var e;if(!t.shuffleOptions)return t.choices;const i=[...t.choices],n=t.hasOpenChoice&&null!==(e=i.pop())&&void 0!==e?e:null,s=(r=i,(o=yl(i)).length>1&&r.every((t,e)=>t===o[e])?o.reverse():o);var r,o;return Pe(n)||s.push(n),s})(t),[t]),[c,d]=up(()=>((t,e)=>Me(t)||Yg(t)?t:e===Op?null:[])(o,t.type)),[v,f]=up(()=>((t,e)=>{if(Me(t)&&!e.includes(t))return{isSelected:!0,inputValue:t};if(Yg(t)){const i=t.find(t=>!e.includes(t));if(i)return{isSelected:!0,inputValue:i}}return{isSelected:!1,inputValue:""}})(o,h)),{isPreviewMode:p}=xg(),g=t.type===Op,m=t.type===Fp,y=t.skipSubmitButton&&g&&!t.hasOpenChoice,b=(t,e)=>{if(e){const t=!v.isSelected;return f(e=>he(he({},e),{},{isSelected:t,inputValue:t?e.inputValue:""})),g&&d(""),void(t&&setTimeout(()=>{var t;return null===(t=u.current)||void 0===t?void 0:t.focus()},75))}if(g)return d(t),f(t=>he(he({},t),{},{isSelected:!1,inputValue:""})),void(y&&(s(t),p&&r(t)));m&&xe(c)&&(c.includes(t)?d(c.filter(e=>e!==t)):d([...c,t]))},_=t=>{t.stopPropagation();const e=t.currentTarget.value;f(t=>he(he({},t),{},{inputValue:e})),g&&d(e)},w=t=>{t.stopPropagation(),"Enter"!==t.key||k()||(t.preventDefault(),S()),"Escape"===t.key&&(t.preventDefault(),f(t=>he(he({},t),{},{isSelected:!1,inputValue:""})),g&&d(null))},k=()=>!(t.optional||!Pe(c)&&(!xe(c)||v.isSelected||0!==c.length)&&(!v.isSelected||""!==v.inputValue.trim())),S=()=>{v.isSelected&&m?xe(c)&&(p?r([...c,v.inputValue]):s([...c,v.inputValue])):p?r(c):s(c)};return Dg(Rf,{children:[Dg("div",{className:"question-container",children:[Dg(Zg,{question:t,forceDisableHtml:e}),Dg("fieldset",{className:"multiple-choice-options limit-height",children:[Dg("legend",{className:"sr-only",children:m?" Select all that apply":" Select one"}),h.map((e,n)=>{const s=!!t.hasOpenChoice&&n===t.choices.length-1,r=`surveyQuestion${i}Choice${n}`,o=`${r}Open`,a=s?v.isSelected:g?c===e:xe(c)&&c.includes(e);return Dg("label",{className:s?"choice-option-open":"",children:[Dg("div",{className:"response-choice",children:[Dg("input",{type:g?"radio":"checkbox",name:r,checked:a,onChange:()=>b(e,s),id:r,"aria-controls":o}),Dg("span",{children:s?`${e}:`:e})]}),s&&Dg("input",{type:"text",ref:u,id:o,name:`question${i}Open`,value:v.inputValue,onKeyDown:w,onInput:_,onClick(t){v.isSelected||b(e,!0),t.stopPropagation()},"aria-label":`${e} - please specify`})]},n)})]})]}),Dg(Gg,{text:t.buttonText||"Submit",submitDisabled:k(),appearance:n,onSubmit:S,onPreviewSubmit:S,skipSubmitButton:y,canGoBack:a,onBack:l})]})}const rm=[1,2,3,4,5],om=[1,2,3,4,5,6,7],am=[0,1,2,3,4,5,6,7,8,9,10],lm={2:[Hg,zg],3:[qg,Ng,Lg],5:[jg,qg,Ng,Lg,Bg]};function um(t){switch(t){case 5:default:return rm;case 7:return om;case 10:return am}}const hm=Zs("[Surveys]");function cm(t,e,i){var n;const s=t.questions[e],r=e+1;if(!(null===(n=s.branching)||void 0===n?void 0:n.type))return e===t.questions.length-1?Lp:r;if(s.branching.type===Lp)return Lp;if("specific_question"===s.branching.type){if(Number.isInteger(s.branching.index))return s.branching.index}else if("response_based"===s.branching.type){if(s.type===Op){var o;let t=s.choices.indexOf(`${i}`);if(-1===t&&s.hasOpenChoice&&(t=s.choices.length-1),null===(o=s.branching)||void 0===o||null===(o=o.responseValues)||void 0===o?void 0:o.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===Lp?Lp:r}}else if(s.type===Dp){var a;if("number"!=typeof i||!Number.isInteger(i))throw new Error("The response type must be an integer");const t=function(t,e){if(2===e){if(1>t||t>2)throw new Error("The response must be in range 1-2");return 1===t?"positive":"negative"}if(3===e){if(1>t||t>3)throw new Error("The response must be in range 1-3");return 1===t?"negative":2===t?"neutral":"positive"}if(5===e){if(1>t||t>5)throw new Error("The response must be in range 1-5");return t>2?3===t?"neutral":"positive":"negative"}if(7===e){if(1>t||t>7)throw new Error("The response must be in range 1-7");return t>3?4===t?"neutral":"positive":"negative"}if(10===e){if(0>t||t>10)throw new Error("The response must be in range 0-10");return t>6?t>8?"promoters":"passives":"detractors"}throw new Error("The scale must be one of: 2, 3, 5, 7, 10")}(i,s.scale);if(null===(a=s.branching)||void 0===a||null===(a=a.responseValues)||void 0===a?void 0:a.hasOwnProperty(t)){const e=s.branching.responseValues[t];return Number.isInteger(e)?e:e===Lp?Lp:r}}return r}return hm.warn("Falling back to next question index due to unexpected branching type"),r}const dm=Zs("[SurveyTranslations]");function vm(t,e){const i=function(t){return function({overrideLanguage:t,storedPersonProperties:e,locale:i},n){const s=al(t);if(s)return null==n||n.info(`Using override display language: ${s}`),s;const r=function(t){return t&&"object"==typeof t&&"language"in t?al(t.language):null}(e);if(r)return null==n||n.info(`Using person property language: ${r}`),r;const o=al(i);return o?(null==n||n.info(`Using detected locale: ${o}`),o):(null==n||n.info("No user language detected"),null)}({overrideLanguage:t.config.override_display_language,storedPersonProperties:Ce(t.get_property)?t.get_property(at):void 0,locale:Fl()},dm)}(e);if(!i)return dm.info("No user language detected"),{survey:t,language:null};const n=cl(t,i,dm);return{survey:n.survey,language:n.matchedKey}}const fm=t,pm=n,gm="ph:show_survey_widget",mm="PHWidgetSurveyClickListener";function ym(t,e){try{const i=t.getBoundingClientRect(),n=fm.innerHeight,s=fm.innerWidth;let r=i.left+i.width/2-e/2;r+e>s-20&&(r=s-e-20),20>r&&(r=20);const o=n-i.bottom,a=250>o&&i.top>o;return{position:"fixed",top:a?"auto":`${i.bottom+12}px`,left:`${r}px`,right:"auto",bottom:a?n-i.top+12+"px":"auto",zIndex:cg.zIndex}}catch(t){return Jp.warn("Failed to calculate trigger position:",t),null}}var bm=class{constructor(t){this.ki=new Map,this.Si=new Map,this.xi=new Map,this.Ci=new Map,this.Mi=new Set,this.Ii=null,this.Ti=!1,this.Ri=null,this.$i=null,this.Ei=null,this.Ai=!1,this.handlePageUnload=()=>{const t=this._posthog.get_property(ht);if(t)for(const e of t)Pg(e)&&bg(e,this._posthog)},this.handlePopoverSurvey=(t,e,{resumeDelayFromActivation:i=!1}={})=>{var n,s,r,o,a,l;if(!Xp(this._posthog))return;const{survey:u,language:h}=this.Oi(t);this.Ii=h,this.Ei=null,this.Li=e;const c=this.Pi(u,e);this.Di(c.id);const{properties:d,initialResponses:v}=null!=e?e:{},f=!(!v||0>=Object.keys(v).length)&&this.Fi(c,v,d,h);if(f&&!(null===(n=c.appearance)||void 0===n?void 0:n.displayThankYouMessage))return;this.Ni(c);let p={};if((null===(s=c.appearance)||void 0===s?void 0:s.position)===Mp&&(null===(r=c.appearance)||void 0===r?void 0:r.widgetSelector)){const t=pm.querySelector(c.appearance.widgetSelector);var g;t&&(p=ym(t,parseInt((null===(g=c.appearance)||void 0===g?void 0:g.maxWidth)||cg.maxWidth))||{})}const m=(null===(o=c.appearance)||void 0===o?void 0:o.surveyPopupDelaySeconds)||0,{shadow:y}=pg(c,this._posthog);this.Ci.set(y,y.host);const b={posthog:this._posthog,survey:c,removeSurveyFromFocus:this.qi,properties:d,style:p,isSurveyCompleted:f,skipShownEvent:null==e?void 0:e.skipShownEvent,surveyLanguage:h};if(this.Ei=b,0>=m)return this.Ti=!0,Xf(Dg(xm,he({},b)),y);const _=()=>{this.Ti=!0;const{survey:i,language:n}=this.Oi(t);this.Ii=n;const s=this.Pi(i,e),r=he(he({},b),{},{survey:s,surveyLanguage:n});this.Ei=r,Xf(Dg(xm,he(he({},r),{},{survey:he(he({},s),{},{appearance:he(he({},s.appearance),{},{surveyPopupDelaySeconds:0})})})),y)},w=()=>{if(!Xp(this._posthog)||!this.ji(c))return Jp.info(`Survey ${c.id} no longer eligible when its display delay elapsed; not displaying`),this.qi(c);_()},k=i?null===(a=this._posthog.surveys)||void 0===a||null===(a=a._surveyEventReceiver)||void 0===a||null===(l=a.getActivationTimestamp)||void 0===l?void 0:l.call(a,c.id):void 0,S=Ae(k)?Math.max(0,Date.now()-k):0,x=Math.max(0,1e3*m-S);if(0>=x)return w();const C=fm.setTimeout(()=>{this.ki.delete(c.id),w()},x);this.ki.set(c.id,C)},this.Bi=t=>{var e;const{survey:i,language:n}=this.Oi(t),{shadow:s,isNewlyCreated:r}=pg(i,this._posthog);this.Ci.set(s,s.host),(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===Cp&&this.xi.set(t.id,t),r&&Xf(Dg($m,{posthog:this._posthog,survey:i,surveyLanguage:n},t.id),s)},this.Hi=t=>{const e=this.Si.get(t);e&&(e.element.removeEventListener("click",e.listener),e.element.removeAttribute(mm),this.Si.delete(t),Jp.info(`Removed click listener for survey ${t}`))},this.zi=t=>{this.Ui(t)||(this.Wi(t),this.Hi(t.id))},this.Vi=t=>{this.Ui(t)||(this.Wi(t),this.xi.delete(t.id))},this.Ui=t=>{try{var e;const i=pm.querySelector(Ag(t,!0));return!!(null==i||null===(e=i.shadowRoot)||void 0===e?void 0:e.querySelector(".ph-survey"))}catch(t){return!1}},this.Zi=(t,e)=>{const i=pm.querySelector(e),n=this.Si.get(t.id);if(i){if(this.Bi(t),n){if(i===n.element)return;Jp.info(`Selector element changed for survey ${t.id}. Re-attaching listener.`),this.Hi(t.id)}if(!i.hasAttribute(mm)){const e=e=>{var i,n;e.stopPropagation();const s=(null===(i=t.appearance)||void 0===i?void 0:i.position)===Mp?ym(e.currentTarget,parseInt((null===(n=t.appearance)||void 0===n?void 0:n.maxWidth)||cg.maxWidth)):{};fm.dispatchEvent(new CustomEvent(gm,{detail:{surveyId:t.id,position:s}}))};sr(i,"click",e),i.setAttribute(mm,"true"),this.Si.set(t.id,{element:i,listener:e,survey:t}),Jp.info(`Attached click listener for feedback button survey ${t.id}`)}}else n&&this.zi(t)},this.renderPopover=t=>{if(!Xp(this._posthog))return;const{survey:e,language:i}=this.Oi(t),{shadow:n}=pg(e,this._posthog);this.Ci.set(n,n.host),Xf(Dg(xm,{posthog:this._posthog,survey:e,removeSurveyFromFocus:this.qi,surveyLanguage:i}),n)},this.renderSurvey=(t,e,i)=>{var n;if(!Xp(this._posthog))return;const{survey:s,language:r}=this.Oi(t);let o=!1;(null===(n=this._posthog.config)||void 0===n||null===(n=n.surveys)||void 0===n?void 0:n.prefillFromUrl)&&(o=this.Gi(s,r,i)),Xf(Dg(xm,{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.qi,isPopup:!1,properties:i,isSurveyCompleted:o,surveyLanguage:r}),e)},this.getActiveMatchingSurveys=(t,e=!1)=>{var i;null===(i=this._posthog)||void 0===i||null===(i=i.surveys)||void 0===i||i.getSurveys(e=>{t(e.filter(t=>this.ji(t)))},e)},this.callSurveysAndEvaluateDisplayLogic=(t=!1)=>{this.getActiveMatchingSurveys(t=>{const e=Xp(this._posthog),i=t.filter(t=>e&&(t.type===Ep||t.type===Pp)),n=new Set(i.map(t=>t.id));for(const t of Array.from(this.ki.keys()))n.has(t)||this.cancelSurvey(t);const s=this.Qi(i),r=new Set,o=new Set;s.forEach(t=>{if(t.type===Pp){var e,i,n,s;if((null===(e=t.appearance)||void 0===e?void 0:e.widgetType)===Cp)return o.add(t.id),void this.Bi(t);"selector"===(null===(i=t.appearance)||void 0===i?void 0:i.widgetType)&&(null===(n=t.appearance)||void 0===n?void 0:n.widgetSelector)&&(r.add(t.id),this.Zi(t,null===(s=t.appearance)||void 0===s?void 0:s.widgetSelector))}Pe(this.Ji)&&t.type===Ep&&this.handlePopoverSurvey(t,void 0,{resumeDelayFromActivation:!0})}),this.Si.forEach(({survey:t})=>{r.has(t.id)||this.zi(t)}),this.xi.forEach((t,e)=>{o.has(e)||this.Vi(t)})},t)},this.Ni=t=>{Pe(this.Ji)||Jp.error(`Survey ${this.Ji} already in focus. Cannot add survey ${t.id}.`),this.Ji=t.id},this.qi=t=>{this.Ji!==t.id&&Jp.error(`Survey ${t.id} is not in focus. Cannot remove survey ${t.id}.`),this.Di(t.id),this.Ji=null,this.Ii=null,this.Ti=!1,this.Ei=null,this.Li=void 0,this.Wi(t)},this._posthog=t,this.Ji=null,this.Ri=()=>this.Ki(),sr(fm,"languagechange",this.Ri),this.$i=t.onFeatureFlags(()=>this.Ki())}Ki(){if(Pe(this.Ji))return;const t=this._posthog.get_property(ht),e=null==t?void 0:t.find(t=>t.id===this.Ji);if(!e)return;const{survey:i,language:n}=this.Oi(e);if(n===this.Ii)return;if(this.Ii=n,!this.Ti)return;const s=this.Pi(i,this.Li),{shadow:r}=pg(s,this._posthog);Xf(Dg(xm,he(he({},this.Ei),{},{posthog:this._posthog,survey:s,removeSurveyFromFocus:this.qi,surveyLanguage:n})),r)}get Xi(){var t,e,i;return null!==(t=null===(e=(i=this._posthog).getExtension)||void 0===e?void 0:e.call(i,"featureFlags"))&&void 0!==t?t:this._posthog.featureFlags}Pi(t,e){return(null==e?void 0:e.position)||(null==e?void 0:e.selector)?he(he({},t),{},{appearance:he(he(he({},t.appearance),e.position&&{position:e.position}),e.selector&&{widgetSelector:e.selector})}):t}Di(t){const e=this.ki.get(t);e&&(clearTimeout(e),this.ki.delete(t))}cancelSurvey(t){this.ki.has(t)&&(Jp.info(`Cancelled pending survey ${t}`),this.Di(t),this.Ji===t&&(this.Ji=null,this.Ii=null,this.Ti=!1,this.Ei=null,this.Li=void 0))}clearInMemoryInProgressSurveyState(){(()=>{for(const t of Object.keys(Ig))delete Ig[t]})()}setAutomaticDisplayDispose(t){this.Yi=t}dispose(){var t;null===(t=this.Yi)||void 0===t||t.call(this),this.Yi=void 0,this.Ri&&(fm.removeEventListener("languagechange",this.Ri),this.Ri=null),this.$i&&(this.$i(),this.$i=null),this.ki.forEach((t,e)=>this.Di(e)),this.Si.forEach((t,e)=>this.Hi(e)),this.Ci.forEach((t,e)=>{Xf(null,e),null==t||t.remove()}),this.Ci.clear(),this.xi.clear(),this.Ji=null}Qi(t){return t.sort((t,e)=>{var i,n;const s=Pg(t),r=Pg(e);if(s&&!r)return-1;if(!s&&r)return 1;const o=t.schedule===Np,a=e.schedule===Np;return o&&!a?1:!o&&a?-1:((null===(i=t.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)||0)-((null===(n=e.appearance)||void 0===n?void 0:n.surveyPopupDelaySeconds)||0)})}Oi(t){return vm(t,this._posthog)}Gi(t,e,i){if(this.Mi.has(t.id))return!1;const{params:n}=function(t){const e={};let i=!1;const n=t.replace(/^\?/,"");if(!n)return{params:e,autoSubmit:i};const s=n.split("&");for(const t of s){const[n,s]=t.split("=");if(!n||Ie(s))continue;const r=decodeURIComponent(n),o=decodeURIComponent(s);if("auto_submit"===r&&"true"===o){i=!0;continue}const a=r.match(/^q(\d+)$/);if(a){const t=parseInt(a[1],10);e[t]||(e[t]=[]),e[t].push(o)}}return{params:e,autoSubmit:i}}(fm.location.search);if(0===Object.keys(n).length)return!1;Jp.info("[Survey Prefill] Detected URL prefill parameters");const s=this.tr(t,n,e);return!!s&&(this.er(t,s,i,e),this.Mi.add(t.id),s.isSurveyCompleted)}er(t,e,i,n){const{responses:s,submissionId:r,isSurveyCompleted:o,skippedResponses:a}=e;(Object.keys(a).length>0&&t.enable_partial_responses||o)&&gg({responses:o?s:a,survey:t,surveySubmissionId:r,posthog:this._posthog,isSurveyCompleted:o,properties:i,surveyLanguage:n})}Fi(t,e,i,n){const s={};for(const[t,i]of Object.entries(e))s[parseInt(t)]=xe(i)?i.map(String):[String(i)];Jp.info("[Survey] Processing initial responses");const r=this.tr(t,s,n);return!!r&&(this.er(t,r,i,n),r.isSurveyCompleted)}tr(t,e,i){try{const n=function(t,e){const i={};return t.questions.forEach((t,n)=>{if(!e[n]||!t.id)return;const s=e[n],r=il(t.id);try{switch(t.type){case Op:{if(!t.choices||0===t.choices.length)return void Gs.warn(`[Survey Prefill] Question ${n} has no choices`);const e=parseInt(s[0],10);if(isNaN(e)||0>e||e>=t.choices.length)return void Gs.warn(`[Survey Prefill] Invalid choice index for q${n}: ${s[0]}`);i[r]=t.choices[e];break}case Fp:{if(!t.choices||0===t.choices.length)return void Gs.warn(`[Survey Prefill] Question ${n} has no choices`);const e=s.map(t=>parseInt(t,10)).filter(e=>!isNaN(e)&&e>=0&&t.choices.length>e);if(0===e.length)return void Gs.warn(`[Survey Prefill] No valid choices for q${n}`);const o=[...new Set(e.map(e=>t.choices[e]))];e.length>o.length&&Gs.warn(`[Survey Prefill] Removed duplicate choices for q${n}`),i[r]=o;break}case Dp:{const e=parseInt(s[0],10),o=t.scale||10;if(isNaN(e)||0>e||e>o)return void Gs.warn(`[Survey Prefill] Invalid rating for q${n}: ${s[0]} (scale: 0-${o})`);i[r]=e;break}default:Gs.info(`[Survey Prefill] Question type ${t.type} does not support prefill`)}}catch(t){Gs.error(`[Survey Prefill] Error converting q${n}:`,t)}}),i}(t,e);if(0===Object.keys(n).length)return Jp.warn("[Survey Prefill] No valid responses after conversion"),null;const s=Pa(),{startQuestionIndex:r,skippedResponses:o,skippedIndices:a}=function(t,e,i){let n=0;const s={},r=[],o=t.questions.length+1;let a=0;for(;t.questions.length>n&&o>a&&(a++,e.includes(n));){const e=t.questions[n];if(!e||!("skipSubmitButton"in e)||!e.skipSubmitButton)break;if(e.id){const t=il(e.id);Ie(i[t])||(s[t]=i[t])}r.push(n);const o=cm(t,n,e.id?i[il(e.id)]:null);if(o===Lp)return{startQuestionIndex:t.questions.length,skippedResponses:s,skippedIndices:r};n=o}return{startQuestionIndex:n,skippedResponses:s,skippedIndices:r}}(t,Object.keys(e).map(t=>parseInt(t,10)),n),l=r>=t.questions.length;return Mg(t,{surveySubmissionId:s,responses:n,lastQuestionIndex:r,questionOrder:_g(t.questions),visitedIndices:a,surveyLanguage:i}),Jp.info("[Survey Prefill] Stored prefilled responses in localStorage"),{responses:n,submissionId:s,startQuestionIndex:r,isSurveyCompleted:l,skippedResponses:o}}catch(t){return Jp.error("[Survey Prefill] Error handling prefill:",t),null}}nr(t,e=void 0){if(!t)return!0;const i=this.Xi,n=!!(null==i?void 0:i.isFeatureEnabled(t,{send_event:!t.startsWith("survey-targeting-")}));let s=!0;e&&(s=(null==i?void 0:i.getFeatureFlag(t,{send_event:!1}))===e||"any"===e);const r=n&&s;return r||this.ir(t),r}ir(t){var e;!this.Ai&&(null===(e=this._posthog.config)||void 0===e?void 0:e.advanced_disable_feature_flags)&&(this.Ai=!0,Jp.warn(`Survey feature flag "${t}" evaluated to false because advanced_disable_feature_flags is set. PostHog creates an internal targeting flag for almost every survey, so no survey can display while flags are disabled. To keep surveys working, replace advanced_disable_feature_flags with advanced_only_evaluate_survey_feature_flags, which evaluates survey flags only.`))}rr(e){return!e.conditions||$g(e,this._posthog)&&function(e){var n,s;return function(e,n){var s,r,o;if(!e||0===e.length)return!0;if(!u)return!1;const a=Ki(u,{userAgentDataPlatform:null==i||null===(s=i.userAgentData)||void 0===s?void 0:s.platform,maxTouchPoints:null==i?void 0:i.maxTouchPoints,screenWidth:null==t||null===(r=t.screen)||void 0===r?void 0:r.width,screenHeight:null==t||null===(o=t.screen)||void 0===o?void 0:o.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio});return gl[null!=n?n:"icontains"](e,[a])}(null===(n=e.conditions)||void 0===n?void 0:n.deviceTypes,null===(s=e.conditions)||void 0===s?void 0:s.deviceTypesMatchType)}(e)&&function(t){var e;return!(null===(e=t.conditions)||void 0===e?void 0:e.selector)||!!(null==ug?void 0:ug.querySelector(t.conditions.selector))}(e)}sr(t){var e;return kg(t)?{satisfied:!0}:t.internal_targeting_flag_key&&function(t){var e;return"recurring"===t.schedule||(null!==(e=t.current_iteration)&&void 0!==e?e:0)>0}(t)&&!(null===(e=this.Xi)||void 0===e?void 0:e.hasLoadedFlags)?(this.ir(t.internal_targeting_flag_key),{satisfied:!1,reason:"Feature flags have not loaded yet; deferring internal targeting flag check"}):{satisfied:this.nr(t.internal_targeting_flag_key)}}checkSurveyEligibility(t){var e,i;const n={eligible:!0,reason:void 0};if(!Yp(t))return n.eligible=!1,n.reason=`Survey is not running. It was completed on ${t.end_date}`,n;if(!sg.includes(t.type))return n.eligible=!1,n.reason=`Surveys of type ${t.type} are never eligible to be shown in the app`,n;const s=null===(e=t.conditions)||void 0===e?void 0:e.linkedFlagVariant;if(!this.nr(t.linked_flag_key,s))return n.eligible=!1,n.reason=s?`Survey linked feature flag is not enabled for variant ${s}`:"Survey linked feature flag is not enabled",n;if(!this.nr(t.targeting_flag_key))return n.eligible=!1,n.reason="Survey targeting feature flag is not enabled",n;const r=this.sr(t);var o;return r.satisfied?function(t,e){if(!t||!e)return!0;const i="string"==typeof e?new Date(e):e,n=Math.abs((new Date).getTime()-i.getTime());return Math.ceil(n/864e5)>t}(null===(i=t.conditions)||void 0===i?void 0:i.seenSurveyWaitPeriodInDays,Na.Ot("lastSeenSurveyDate"))?(t=>!!Na.Ot(ig(t))&&!kg(t))(t)?(n.eligible=!1,n.reason="Survey has already been seen and it can't be activated again",n):n:(n.eligible=!1,n.reason="Survey wait period has not passed",n):(n.eligible=!1,n.reason=null!==(o=r.reason)&&void 0!==o?o:"Survey internal targeting flag is not enabled and survey cannot activate repeatedly and survey is not in progress",n)}checkSurveyCaptureEligibility(){return Xp(this._posthog)?{eligible:!0}:{eligible:!1,reason:Kp}}checkSurveyDisplayEligibility(t){const e=this.checkSurveyCaptureEligibility();return e.eligible?this.checkSurveyEligibility(t):e}checkSurveyRenderability(t){const e=this.checkSurveyDisplayEligibility(t);return e.eligible&&!this.ar(t)?{eligible:!1,reason:"Survey event/action trigger has not been fired yet"}:e}ar(t){var e;if(!dl(t)&&!tg(t))return!0;const i=null===(e=this._posthog.surveys)||void 0===e||null===(e=e._surveyEventReceiver)||void 0===e?void 0:e.getSurveys();return!!(null==i?void 0:i.includes(t.id))}lr(t){var e;return!(null===(e=t.feature_flag_keys)||void 0===e?void 0:e.length)||t.feature_flag_keys.every(({key:t,value:e})=>!t||!e||this.nr(e))}ji(t){return this.checkSurveyEligibility(t).eligible&&this.rr(t)&&this.ar(t)&&this.lr(t)}Wi(t){try{const e=pm.querySelector(Ag(t,!0));(null==e?void 0:e.shadowRoot)&&(Xf(null,e.shadowRoot),this.Ci.delete(e.shadowRoot)),null==e||e.remove()}catch(e){Jp.warn(`Failed to remove survey ${t.id} from DOM:`,e)}}getTestAPI(){return{addSurveyToFocus:this.Ni,removeSurveyFromFocus:this.qi,surveyInFocus:this.Ji,surveyTimeouts:this.ki,handleWidget:this.Bi,handlePopoverSurvey:this.handlePopoverSurvey,manageWidgetSelectorListener:this.Zi,sortSurveysByAppearanceDelay:this.Qi,checkFlags:this.lr.bind(this),isSurveyFeatureFlagEnabled:this.nr.bind(this),onLanguageChange:this.Ki.bind(this),currentLanguage:this.Ii,surveyIsRendered:this.Ti}}};function _m(t,e){if(!pm||!fm)return;const i=new bm(t);if(t.config.disable_surveys_automatic_display)return Jp.info("Surveys automatic display is disabled. Skipping call surveys and evaluate display logic."),i;if(!1===e)return Jp.info("There are no surveys to load or Surveys is disabled in the project settings."),i;let n;i.callSurveysAndEvaluateDisplayLogic(!0);const s=()=>{Ie(n)&&(n=setInterval(()=>{i.callSurveysAndEvaluateDisplayLogic(!1)},1e3))},r=()=>{Ie(n)||(clearInterval(n),n=void 0)};s();const o=()=>{pm.hidden?r():(i.callSurveysAndEvaluateDisplayLogic(!1),s())};return sr(pm,"visibilitychange",o),i.setAutomaticDisplayDispose(()=>{r(),pm.removeEventListener("visibilitychange",o)}),i}function wm({survey:t,removeSurveyFromFocus:e=()=>{},setSurveyVisible:i,isPreviewMode:n=!1,posthog:s}){hp(()=>{var r;if(n||!(null===(r=t.conditions)||void 0===r?void 0:r.url))return;const o=()=>{var n;const r=t.type===Pp,o=$g(t,s),a=(null===(n=t.appearance)||void 0===n?void 0:n.widgetType)===Cp&&r;if(!o)return Jp.info(`Hiding survey ${t.id} because URL does not match`),i(!1),e(t);a&&(Jp.info(`Showing survey ${t.id} because it is a feedback button tab and URL matches`),i(!0))};sr(fm,"popstate",o),sr(fm,"hashchange",o);const a=fm.history.pushState,l=fm.history.replaceState;return fm.history.pushState=function(...t){a.apply(this,t),o()},fm.history.replaceState=function(...t){l.apply(this,t),o()},()=>{fm.removeEventListener("popstate",o),fm.removeEventListener("hashchange",o),fm.history.pushState=a,fm.history.replaceState=l}},[n,t,e,i,s])}const km=200;function Sm(t="right"){switch(t){case"top":return{top:"0",left:"50%",transform:"translateX(-50%)"};case"left":return{top:"50%",left:"0",transform:"rotate(90deg) translateY(-100%)",transformOrigin:"left top"};case"bottom":return{bottom:"0",left:"50%",transform:"translateX(-50%)"};default:return{top:"50%",right:"0",transform:"rotate(-90deg) translateY(-100%)",transformOrigin:"right top"}}}function xm({survey:t,forceDisableHtml:e,posthog:i,style:n={},previewPageIndex:s,removeSurveyFromFocus:r=()=>{},isPopup:o=!0,onPreviewSubmit:a=()=>{},onPreviewBack:l=()=>{},onPopupSurveyDismissed:u=()=>{},onCloseConfirmationMessage:h=()=>{},properties:c,isSurveyCompleted:d,skipShownEvent:v,surveyLanguage:f}){var p,g,m,y,b,_,w,k,S,x,C,T;const I=cp(null),M=Number.isInteger(s),{isPopupVisible:E,isSurveySent:P,hidePopupWithAnimation:R}=function(t,e,i,n,s,r,o,a,l){const[u,h]=up(n||0===i||t.type===Rp),[c,d]=up(!1),v=cp(!1),f=()=>{const e=()=>{r&&s(t),h(!1)};if(v.current)return;const i=null==o?void 0:o.current;i?(v.current=!0,i.style.transition=`opacity ${km}ms ease-out`,i.style.opacity="0",setTimeout(()=>{v.current=!1,e()},250)):e()},p=e=>{e.detail.surveyId===t.id&&f()};return hp(()=>{if(!e)return void Jp.error("usePopupVisibility hook called without a PostHog instance.");if(n)return;let s;const r=e=>{var i,n;if(e.detail.surveyId===t.id){if(!(null===(i=t.appearance)||void 0===i?void 0:i.displayThankYouMessage))return f();d(!0),(null===(n=t.appearance)||void 0===n?void 0:n.autoDisappear)&&(s&&clearTimeout(s),s=setTimeout(f,5e3))}},o=()=>{if($g(t,e)){var i;h(!0),fm.dispatchEvent(new Event("PHSurveyShown")),a||e.capture(qp,he(he({[zp]:t.name,[Hp]:t.id,[Up]:t.current_iteration,[Wp]:t.current_iteration_start_date},l&&{[Gp]:l}),{},{sessionRecordingUrl:null===(i=e.get_session_replay_url)||void 0===i?void 0:i.call(e)}));try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}};sr(fm,"PHSurveyClosed",p),sr(fm,"PHSurveySent",r);const u=i>0?setTimeout(o,i):void 0;return Ie(u)&&o(),()=>{Ie(u)||clearTimeout(u),Ie(s)||clearTimeout(s),fm.removeEventListener("PHSurveyClosed",p),fm.removeEventListener("PHSurveySent",r)}},[]),wm({survey:t,removeSurveyFromFocus:s,setSurveyVisible:h,isPreviewMode:n,posthog:e}),{isPopupVisible:u,isSurveySent:c,setIsPopupVisible:h,hidePopupWithAnimation:f}}(t,i,(null===(p=t.appearance)||void 0===p?void 0:p.surveyPopupDelaySeconds)?1e3*t.appearance.surveyPopupDelaySeconds:0,M,r,o,I,v,f),A=P||s===t.questions.length||!0===d,[F,O]=up(!1),D=dp(()=>!!Eg(t),[t]),L=!(!(null===(g=t.appearance)||void 0===g?void 0:g.introScreenHeader)&&!(null===(m=t.appearance)||void 0===m?void 0:m.introScreenDescription)),N=M?-1===s:!!(null===(y=t.appearance)||void 0===y?void 0:y.displayIntroScreen)&&L&&!F&&!D,q=dp(()=>{const e=Eg(t),n=(null==e?void 0:e.surveySubmissionId)||Pa();return{isPreviewMode:M,previewPageIndex:s,onPopupSurveyDismissed(){f?yg(t,i,M,f):yg(t,i,M),u()},isPopup:o||!1,surveySubmissionId:n,onPreviewSubmit:a,onPreviewBack:l,posthog:i,properties:c,surveyLanguage:f}},[M,s,o,i,t,u,a,l,c,f]);return E?Dg(Sg.Provider,{value:q,children:Dg("div",{className:"ph-survey",style:he(he({},Fg(t.type,null===(b=t.appearance)||void 0===b?void 0:b.position,null===(_=t.appearance)||void 0===_?void 0:_.widgetType)),n),ref:I,children:A?Dg(Kg,{header:(null===(w=t.appearance)||void 0===w?void 0:w.thankYouMessageHeader)||"Thank you!",description:(null===(k=t.appearance)||void 0===k?void 0:k.thankYouMessageDescription)||"",forceDisableHtml:!!e,contentType:null===(S=t.appearance)||void 0===S?void 0:S.thankYouMessageDescriptionContentType,appearance:t.appearance||cg,onClose(){R(),h()}}):N?Dg(Xg,{header:(null===(x=t.appearance)||void 0===x?void 0:x.introScreenHeader)||"",description:(null===(C=t.appearance)||void 0===C?void 0:C.introScreenDescription)||"",forceDisableHtml:!!e,contentType:null===(T=t.appearance)||void 0===T?void 0:T.introScreenDescriptionContentType,appearance:t.appearance||cg,onStart:()=>O(!0)}):Dg(Cm,{survey:t,forceDisableHtml:!!e,posthog:i})})}):null}function Cm({survey:t,forceDisableHtml:e,posthog:i}){var n,s;const r=dp(()=>{const e=Eg(t);if(!e)return null;const i=Ae(e.lastQuestionIndex);return!i||i&&e.lastQuestionIndex>=0&&t.questions.length>e.lastQuestionIndex?e:(Rg(t),null)},[t]),[o,a]=up(()=>((null==r?void 0:r.responses)&&Jp.info("Survey is already in progress, filling in initial responses"),(null==r?void 0:r.responses)||{})),[l,u]=up(!1),{previewPageIndex:h,onPopupSurveyDismissed:c,isPopup:d,onPreviewSubmit:v,onPreviewBack:f,surveySubmissionId:p,isPreviewMode:g,properties:m,surveyLanguage:y}=vp(Sg),[b,_]=up(()=>{const e=null==r?void 0:r.lastQuestionIndex,i=Ae(e)&&e>=0&&t.questions.length>e?e:0;return Ae(h)&&h>=0?h:i}),[w,k]=up(()=>{var e;return(null!==(e=null==r?void 0:r.visitedIndices)&&void 0!==e?e:[]).filter(e=>e>=0&&t.questions.length>e)}),[S,x]=up(()=>{var e;const i=Eg(t);return null!==(e=null==i?void 0:i.questionSnapshots)&&void 0!==e?e:{}}),C=dp(()=>_g(wg(t,r)),[t.id,r]),T=dp(()=>{if(!C||new Set(C).size!==C.length)return wg(t,r);const e=new Map(t.questions.map(t=>[t.id,t])),i=C.map(t=>e.get(t)).filter(t=>!!t);return i.length===C.length?i:t.questions},[C,t.questions,t,r]);hp(()=>{!g||Ie(h)||0>h||_(h)},[h,g]);const I=!!(null===(n=t.appearance)||void 0===n?void 0:n.allowGoBack)&&(g?(null!=h?h:0)>0:w.length>0),M=T.at(b);return M?Dg("form",{className:"survey-form",name:"surveyForm",children:[d&&!0!==(null===(s=t.appearance)||void 0===s?void 0:s.hideCancelButton)&&Dg(Qg,{onClick(){c()}}),Dg("div",{className:"survey-box","data-question-index":b,children:[l&&Dg("p",{role:"alert",children:"Your response could not be sent. Please try again later."}),Tm({question:M,forceDisableHtml:e,displayQuestionIndex:b,appearance:t.appearance||cg,onSubmit:e=>(({res:e,displayQuestionIndex:n,questionId:s})=>{if(!i)return void Jp.error("onNextButtonClick called without a PostHog instance.");if(!Xp(i))return void u(!0);if(u(!1),!s)return void Jp.error("onNextButtonClick called without a questionId.");const{responses:r,questionSnapshots:l}=function({responses:t,questionSnapshots:e={}},i,n,s){return{responses:he(he({},t),{},{[il(i)]:n}),questionSnapshots:(null==s?void 0:s.id)?he(he({},e),{},{[s.id]:s.question}):e}}({responses:o,questionSnapshots:S},s,e,T[n]);a(r),x(l);const h=cm(t,n,e),c=h===Lp,d=[...w,n];if(c||(k(d),_(h),Mg(t,{surveySubmissionId:p,responses:r,lastQuestionIndex:h,questionOrder:_g(T),visitedIndices:d,surveyLanguage:y,questionSnapshots:l})),t.enable_partial_responses||c){const e=new Set(d.map(t=>{var e;return null===(e=T[t])||void 0===e?void 0:e.id}).filter(t=>!!t).map(t=>il(t))),n=Object.fromEntries(Object.entries(r).filter(([t])=>e.has(t)));gg({responses:n,survey:t,surveySubmissionId:p,isSurveyCompleted:c,posthog:i,properties:m,surveyLanguage:y,questionSnapshots:l})}})({res:e,displayQuestionIndex:b,questionId:M.id}),onPreviewSubmit:v,initialValue:M.id?o[il(M.id)]:void 0,canGoBack:I,onBack(){if(g)return void f();if(0===w.length)return;const e=w[w.length-1],i=w.slice(0,-1);k(i),_(e),Mg(t,{surveySubmissionId:p,responses:o,lastQuestionIndex:e,questionOrder:_g(T),visitedIndices:i,surveyLanguage:y,questionSnapshots:S})}})]})]}):null}function $m({survey:t,forceDisableHtml:e,posthog:i,readOnly:n,surveyLanguage:s}){var r,o,a,l,u,h,c;const[d,v]=up(!0),[f,p]=up(!1),[g,m]=up({}),y=cp(void 0),b=()=>{(f||!i||n||Xp(i))&&p(!f)};if(hp(()=>{var e;if(!i)return void Jp.error("FeedbackWidget called without a PostHog instance.");if(n)return;"tab"===(null===(e=t.appearance)||void 0===e?void 0:e.widgetType)&&m({top:"50%",bottom:"auto"});const s=e=>{var i;const n=e;(null===(i=n.detail)||void 0===i?void 0:i.surveyId)===t.id&&(Jp.info(`Received show event for feedback button survey ${t.id}`),m(n.detail.position||{}),b())};return sr(fm,gm,s),()=>{Ie(y.current)||(clearTimeout(y.current),y.current=void 0),fm.removeEventListener(gm,s)}},[i,n,t.id,null===(r=t.appearance)||void 0===r?void 0:r.widgetType,null===(o=t.appearance)||void 0===o?void 0:o.widgetSelector,null===(a=t.appearance)||void 0===a?void 0:a.borderColor]),wm({survey:t,setSurveyVisible:v,posthog:i}),!d)return null;const _=()=>{t.schedule!==Np&&v(!1),Ie(y.current)||clearTimeout(y.current),y.current=setTimeout(()=>{y.current=void 0,p(!1)},200)};return Dg(Rf,{children:["tab"===(null===(l=t.appearance)||void 0===l?void 0:l.widgetType)&&Dg("button",{className:"ph-survey-widget-tab "+("top"===(null===(u=t.appearance)||void 0===u?void 0:u.tabPosition)?"widget-tab-top":""),onClick:b,disabled:n,style:Sm(null===(h=t.appearance)||void 0===h?void 0:h.tabPosition),children:(null===(c=t.appearance)||void 0===c?void 0:c.widgetLabel)||""}),f&&Dg(xm,{posthog:i,survey:t,forceDisableHtml:e,style:g,onPopupSurveyDismissed:_,onCloseConfirmationMessage:_,surveyLanguage:s})]})}const Tm=({question:t,forceDisableHtml:e,displayQuestionIndex:i,appearance:n,onSubmit:s,onPreviewSubmit:r,initialValue:o,canGoBack:a,onBack:l})=>{const u={forceDisableHtml:e,appearance:n,onPreviewSubmit(t){r(t)},onSubmit(t){s(t)},initialValue:o,displayQuestionIndex:i,canGoBack:a,onBack:l};switch(t.type){case Ap:return Ef(tm,he(he({},u),{},{question:t,key:t.id}));case"link":return Ef(em,he(he({},u),{},{question:t,key:t.id}));case Dp:return Ef(im,he(he({},u),{},{question:t,key:t.id}));case Op:case Fp:return Ef(sm,he(he({},u),{},{question:t,key:t.id}));default:return Jp.error(`Unsupported question type: ${t.type}`),null}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.generateSurveys=_m,d.extendPostHogWithSurveys=_m;const Im=t=>{for(;null==t?void 0:t.__rrweb_original__;)t=t.__rrweb_original__;return t},Mm=1e4,Em=(t,e,i)=>i.remaining>0?e.length>i.remaining?(t.push(e.slice(0,i.remaining)),i.remaining=0,i.truncated=!0,!1):(t.push(e),i.remaining-=e.length,!0):(i.truncated=!0,!1),Pm=(t,e,i)=>{const n=JSON.stringify(t);if(i.remaining>=n.length)return Em(e,n,i);if(i.truncated=!0,2>i.remaining)return!1;let s=0,r=Math.min(t.length,i.remaining-2);for(;r>s;){const e=Math.ceil((s+r)/2);JSON.stringify(t.slice(0,e)).length>i.remaining?r=e-1:s=e}return Em(e,JSON.stringify(t.slice(0,s)),i)},Rm=t=>void 0!==t&&"function"!=typeof t&&"symbol"!=typeof t&&"bigint"!=typeof t,Am=(t,e,i)=>{if(!i.truncated){if(i.keysRemaining-=1,i.sizeRemaining-=String(e).length+t.length,0>=i.keysRemaining||0>=i.sizeRemaining)return i.truncated=!0,void(i.result.attributes_truncated=!0);i.result[t]=e}},Fm=(t,e,i)=>{if(!i.truncated)if($e(t)){if(i.seen.has(t))return void Am(e||"circular","[Circular]",i);i.seen.add(t);try{for(const n in t)try{if(!{}.hasOwnProperty.call(t,n))continue;if(Fm(t[n],e?`${e}.${n}`:n,i),i.truncated)return}catch(t){continue}}catch(t){}}else Am(e,t,i)},Om=(t,e,i,n,s=!1,r)=>{if(!Rm(t))return!s||Em(e,"null",i);if(Pe(t)||(t=>{try{return Ae(t)||Oe(t)}catch(t){return!1}})(t))return Em(e,JSON.stringify(t),i);if("string"==typeof t)return Pm(t,e,i);if(!$e(t)&&!xe(t))return Em(e,JSON.stringify(t),i);if(n.has(t))return Pm("[Circular]",e,i);n.add(t);try{const r=t.toJSON;if(Ce(r))return Om(r.call(t),e,i,n,s)}catch(t){}try{const n={}.toString.call(t);if("[object String]"===n)return Pm(String(t.valueOf()),e,i);if("[object Number]"===n||"[object Boolean]"===n)return Em(e,JSON.stringify(t.valueOf()),i)}catch(t){}if(t instanceof Error){const o={};try{for(const e in t)({}).hasOwnProperty.call(t,e)&&(o[e]=t[e])}catch(t){}try{o.name=t.name}catch(t){}try{o.message=t.message}catch(t){}try{o.stack=t.stack}catch(t){}return Om(o,e,i,n,s,r)}if(xe(t)){if(!Em(e,"[",i))return!1;for(let s=0;t.length>s;s++){if(s>0&&!Em(e,",",i))return!1;let r;try{r=t[s]}catch(t){r=void 0}if(!Om(r,e,i,n,!0))return!1}return Em(e,"]",i)}if(!Em(e,"{",i))return!1;let o=!0;try{for(const s in t){if(!{}.hasOwnProperty.call(t,s))continue;if(0>=i.remaining)return i.truncated=!0,!1;let a;try{a=t[s]}catch(t){continue}if(r)try{Fm(a,s,r)}catch(t){}if(!Rm(a))continue;const l=`${o?"":","}${JSON.stringify(s)}:`;if(l.length>=i.remaining)return i.truncated=!0,!1;const u=e.length,h=i.remaining,c=i.truncated;if(!Em(e,l,i))return!1;const d=e.length,v=Om(a,e,i,n,!1),f=i.truncated;if(e.length!==d){if(o=!1,!v)return!1}else if(e.length=u,i.remaining=h,i.truncated=v?c:f,!v)return!1}}catch(t){}return Em(e,"}",i)},Dm=(t,e)=>{const i=[],n={remaining:e,truncated:!1},s=$e(t[0])?{result:{},keysRemaining:50,sizeRemaining:Mm,truncated:!1,seen:new WeakSet([t[0]])}:void 0;for(let e=0;t.length>e&&(0>=e||Em(i," ",n))&&Om(t[e],i,n,new WeakSet,!1,0===e?s:void 0);e++);return{body:i.join("")+(n.truncated?"...":""),truncated:n.truncated,attributes:(null==s?void 0:s.result)||{}}},Lm={debug:"debug",log:"info",warn:"warn",error:"error",info:"info"},Nm=t=>"canCapture"in t,qm=t=>Nm(t)?t.canCapture?t.getExtension(og):void 0:t.is_capturing()?t.logs:void 0,jm=(t,e,i)=>{if(Nm(t))return void e.captureConsoleLog(i);const n=(t=>{const e=/^1\.(\d+)\.(\d+)$/.exec(t);if(!e)return;const i=Number(e[1]),n=Number(e[2]);return 392>i||i>419?void 0:410===i?n>4?n>10?void 0:"de":"le":418===i?n>3?n>10?n>14?n>17?void 0:"vi":"ci":"ui":"he":419===i?n>2?void 0:"vi":410>i?"le":"he"})(t.version),s=n?e[n]:void 0;Ce(s)&&s.call(e,i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.logs={initializeLogs(t){let e=t;const i=[],n={host:d.location.host};let s=!1;for(const t of Object.keys(Lm)){const r=i=>(...r)=>{let o=!1;try{const i=e;if(r.length>0&&!s&&i){const e=qm(i);if(e){s=!0,o=!0;const{body:a,truncated:l,attributes:u}=Dm(r,Mm),h=he(he({},n),l?{body_truncated:"true"}:{}),c={level:Lm[t],body:a,attributes:he(he({"log.source":`console.${t}`},h),u)};jm(i,e,c)}}}catch(t){}finally{o&&(s=!1),i.apply(d.console,r)}},o=d.console[t];i.push(Mv(d.console,t,t=>{const e=r(t);return e.__rrweb_original__=Im(o),e}))}return()=>{e=void 0,i.forEach(t=>t())}},replayConsoleBuffer(t,e){const i=qm(t);if(i)for(const t of e)try{var n;const{body:e,truncated:s,attributes:r}=Dm(t.args,Mm);null===(n=i.captureBufferedConsoleLog)||void 0===n||n.call(i,{level:Lm[t.level],body:e,attributes:he(he({"log.source":`console.${t.level}`,host:d.location.host},s?{body_truncated:"true"}:{}),r)},t.context,t.occurredAtMs)}catch(t){}}};const Bm=t=>Be(t)&&("RangeError"===t.name&&0===t.message.indexOf("Maximum call stack size exceeded")||"InternalError"===t.name&&"too much recursion"===t.message),Hm=Zs("[Error tracking]"),zm="webkit-masked-url:",Um=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Wm=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",zm],Vm=["__firefox__","__gCrWeb"];function Gm(){return new bn([new jn,new Jn,new Hn,new Bn,new Zn,new Gn,new Un,new Qn],function(t,...e){return(i,n=0)=>{const s=[],r=i.split("\n"),o=Math.min(r.length,n+1e3),a=[];for(let i=n;o>i;i++){const n=r[i];if(n.length>1024)continue;const o=Rn.test(n)?n.replace(Rn,"$1"):n;if(!o.match(/\S*Error: /)){for(const i of e){const e=i(o,t);if(e){s.push(e);const t=Fn(s);if(t){for(let e=a.length-1;e>=0;e--){const i=a[e];if(t.start>=i.start+i.length)break;a.pop()}a.push(t)}break}}if(Nn(s,a)>=50)break}}const l=[...a].sort((t,e)=>e.start-t.start),u=l[l.length-1];if(u){const t=Dn(s,u);s.splice(u.start-t,t);for(const e of l)e.start-=t}for(const t of l)On(s,t);return a.some(t=>0===t.start&&s.length===t.length)&&function(t){const e=t.map(t=>`${t.function}|${t.filename}|${t.lineno}|${t.colno}|${t.module}`);let i=0;for(let t=1;e.length>t;t++)qn(e,t,i)&&(i=t);t.push(...t.splice(0,i))}(s),function(t){if(!t.length)return[];const e=Array.from(t);return e.reverse(),e.slice(0,50).map(t=>{return he(he({},t),{},{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||"?"});var i})}(s)}}("web:javascript",In,Pn))}const Zm=Zs("[ExceptionAutocapture]"),Qm=Gm(),Jm=(t,e)=>{try{return t()}catch(t){return e}},Km=(t,e)=>Jm(()=>t(e()),void 0),Xm=t=>Jm(()=>Ce(t)&&Ce(t.call),!1),Ym=(t,e)=>Jm(()=>{t[e].__POSTHOG_INSTRUMENTED__=!0},void 0),ty=(t,e,i)=>{Jm(()=>{var i;null===(i=t[e])||void 0===i||delete i.__POSTHOG_INSTRUMENTED__},void 0),Jm(()=>{t[e]=i},void 0)},ey=e=>{const i=t;i||Zm.info("window not available, cannot wrap onerror");const n=Jm(()=>i.onerror,void 0);return i.onerror=function(...t){var i;return Km(e,()=>Qm.buildFromUnknown((([t,e,i,n,s])=>{if(null!=s)return s;if(Me(t)&&Me(e)&&e.length>0&&"undefined"!=typeof ErrorEvent)try{return new ErrorEvent("error",{message:t,filename:e,lineno:i,colno:n})}catch(e){return t}return t})(t),{mechanism:{handled:!1}})),!!Xm(n)&&null!==(i=n(...t))&&void 0!==i&&i},Ym(i,"onerror"),()=>ty(i,"onerror",n)},iy=(e,i=!1)=>{const n=t;n||Zm.info("window not available, cannot wrap onUnhandledRejection");const s=Jm(()=>n.onunhandledrejection,void 0);return n.onunhandledrejection=function(t){var n;return Km(e,()=>Qm.buildFromUnknown(t,{mechanism:{handled:!1}})),Xm(s)?null!==(n=s(t))&&void 0!==n&&n:i},Ym(n,"onunhandledrejection"),()=>ty(n,"onunhandledrejection",s)},ny={wrapOnError:ey,wrapUnhandledRejection:iy,wrapConsoleError(t){const e=console;e||Zm.info("console not available, cannot wrap console.error");const i=Jm(()=>e.error,void 0);return e.error=function(...e){Jm(()=>e.length>1&&Me(e[0])&&(/^\[PostHog\.js\](?: |$)/.test(e[0])||"rrweb logger error:"===e[0]),!1)||Km(t,()=>{let t;t=1==e.length?e[0]:e.join(" ");const i=e.find(t=>t instanceof Error);return Qm.buildFromUnknown(i||t,{mechanism:{handled:!0,type:"onconsole"},syntheticException:new Error("PostHog syntheticException"),skipFirstLines:2})}),Xm(i)&&i(...e)},Ym(e,"error"),()=>ty(e,"error",i)}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.errorWrappingFunctions=ny,d.posthogErrorWrappingFunctions=ny;const sy=(t,e)=>{if(!Ce(null==t?void 0:t.capture))return;const i=null==e?void 0:e.autocaptureExceptions,n=!Pe(i)&&"object"==typeof i&&xe(i.errors_to_ignore)?i.errors_to_ignore.reduce((t,e)=>{try{t.push(new RegExp(e))}catch(t){Zm.error("Ignoring invalid legacy exception exclusion rule",e,t)}return t},[]):[],s=e=>{try{var i;null===(i=t.capture)||void 0===i||i.call(t,"$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",_noHeatmaps:!0})}catch(t){Zm.error("Failed to capture exception for a legacy client",t)}};ey(t=>{n.some(e=>t.$exception_list.some(t=>e.test(t.value||"")))||s(t)}),iy(s,!0)};d.extendPostHogWithExceptionAutoCapture=sy,d.extendPostHogWithExceptionAutocapture=sy;const ry="X-POSTHOG-SESSION-ID",oy="X-POSTHOG-WINDOW-ID",ay="X-POSTHOG-DISTINCT-ID",ly=[ry,oy,ay],uy=["attributionReporting","body","browsingTopics","cache","credentials","dispatcher","duplex","integrity","keepalive","method","mode","priority","redirect","referrer","referrerPolicy","signal","window"],hy=(t,e)=>({}.hasOwnProperty.call(t,e)),cy=t=>"object"==typeof t&&!Pe(t)||Ce(t),dy=t=>"undefined"!=typeof Request&&(t instanceof Request||"[object Request]"==={}.toString.call(t)),vy=e=>{try{var i;return dy(e)?e.url:new URL(e instanceof URL?e.toString():String(e),null==t||null===(i=t.location)||void 0===i?void 0:i.href).toString()}catch(t){return}},fy=(t,e,i,n,s)=>{let r;try{r=new URL(n).hostname}catch(t){return!1}if(!t)return!1;if(xe(t)&&!t.includes(r))return!1;let o=!1;if(i){const{sessionId:t,windowId:e}=i.checkAndGetSessionAndWindowId(!0);s.set(ry,t),s.set(oy,e),o=!0}const a=(t=>Ce(t)?t():t)(e);return a&&"$posthog_cookieless"!==a&&(s.set(ay,a),o=!0),o};d.__PosthogExtensions__=d.__PosthogExtensions__||{};const py={_patchFetch:(e,i,n)=>Mv(t,"fetch",t=>function(s,r){const o=arguments.length>1?[s,r]:[s];let a=o;try{const t=vy(s);if(t)if(dy(s)){const t=new Request(s,r);fy(e,i,n,t.url,t.headers),a=[t]}else{const o=new Headers(cy(r)?r.headers:void 0);if(fy(e,i,n,t,o)){const t=((t,e)=>{if(Ie(t)||Pe(t))return{headers:e};if(!cy(t))return;const i=t;if("undefined"==typeof Proxy||"undefined"==typeof Reflect){const t=Object.create(i);return Object.defineProperty(t,"headers",{configurable:!0,enumerable:!0,value:e,writable:!0}),t}return new Proxy({headers:e},{get:(t,e)=>hy(t,e)?Reflect.get(t,e):Reflect.get(i,e,i),has:(t,e)=>hy(t,e)||e in i,ownKeys(t){const e=new Set(Reflect.ownKeys(t));return Reflect.ownKeys(i).forEach(t=>e.add(t)),uy.forEach(t=>{t in i&&e.add(t)}),Array.from(e)},getOwnPropertyDescriptor(t,e){const n=Reflect.getOwnPropertyDescriptor(t,e);if(n)return n;if("string"==typeof e&&uy.includes(e)&&e in i)return{configurable:!0,enumerable:!0,get(){return Reflect.get(i,e,i)}};const s=Reflect.getOwnPropertyDescriptor(i,e);return s?he(he({},s),{},{configurable:!0}):void 0},getPrototypeOf:()=>Object.getPrototypeOf(i)})})(r,o);t&&(a=[s,t])}}}catch(t){a=o}return t.apply(this,a)}),_patchXHR:(e,i,n)=>Mv(t.XMLHttpRequest.prototype,"open",t=>function(s,r,o=!0,a,l){const u=this,h=new Headers,c=vy(r);c&&fy(e,i,n,c,h);const d=t.call(u,s,r,o,a,l);return ly.forEach(t=>{const e=h.get(t);if(e)try{u.setRequestHeader(t,e)}catch(t){}}),d})};d.__PosthogExtensions__.tracingHeadersPatchFns=py,d.postHogTracingHeadersPatchFns=py,"function"!=typeof[].at&&Object.defineProperty(Array.prototype,"at",{value(t){const e=this.length;let i=Math.trunc(t)||0;return 0>i&&(i+=e),0>i||i>=e?void 0:this[i]},writable:!0,enumerable:!1,configurable:!0}),"function"!=typeof[].findLast&&Object.defineProperty(Array.prototype,"findLast",{value(t,e){for(let i=this.length-1;i>=0;i--){const n=this[i];if(t.call(e,n,i,this))return n}},writable:!0,enumerable:!1,configurable:!0});var gy=class{constructor(){this.t=void 0,this.o=0,this.i=[]}l(t){var e;if(t.hadRecentInput)return;const i=this.i[0],n=this.i.at(-1);this.o&&i&&n&&1e3>t.startTime-n.startTime&&5e3>t.startTime-i.startTime?(this.o+=t.value,this.i.push(t)):(this.o=t.value,this.i=[t]),null===(e=this.t)||void 0===e||e.call(this,t)}};const my=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},yy=t=>{if("loading"===document.readyState)return"loading";const e=my();if(e){if(e.domInteractive>t)return"loading";if(0===e.domContentLoadedEventStart||e.domContentLoadedEventStart>t)return"dom-interactive";if(0===e.domComplete||e.domComplete>t)return"dom-content-loaded"}return"complete"},by=t=>{const e=t.nodeName;return 1===t.nodeType?e.toLowerCase():e.toUpperCase().replace(/^#/,"")},_y=t=>{let e="";try{for(;9!==(null==t?void 0:t.nodeType);){var i;const n=t,s=n.id?"#"+n.id:[by(n),...Array.from(null!==(i=n.classList)&&void 0!==i?i:[]).sort()].join(".");if(e.length+s.length>99)return e||s;if(e=e?s+">"+e:s,n.id)break;t=n.parentNode}}catch(t){}return e},wy=new WeakMap;function ky(t,e){let i=wy.get(e);return i||(i=new WeakMap,wy.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}let Sy=-1;const xy=()=>Sy,Cy=t=>{addEventListener("pageshow",e=>{e.persisted&&(Sy=e.timeStamp,t(e))},!0)},$y=(t,e,i,n)=>{let s,r;return o=>{var a;e.value>=0&&(o||n)&&(r=e.value-(null!==(a=s)&&void 0!==a?a:0),(r||void 0===s)&&(s=e.value,e.delta=r,e.rating=((t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good")(e.value,i),t(e)))}},Ty=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},Iy=()=>{var t,e;return null!==(t=null===(e=my())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let My=-1;const Ey=new Set,Py=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Ry=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of Ey)t();isFinite(My)||(My="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",Ry,!0))}},Ay=(t=!1)=>{if(t&&(My=1/0),0>My){var e;const t=Iy(),i=document.prerendering||null===(e=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=t))||void 0===e?void 0:e.startTime;My=null!=i?i:Py(),addEventListener("visibilitychange",Ry,!0),addEventListener("prerenderingchange",Ry,!0),Cy(()=>{setTimeout(()=>{My=Py()})})}return{get firstHiddenTime(){return My},onHidden(t){Ey.add(t)}}},Fy=(t,e=-1,i,n=0,s,r,o)=>{const a=my(),l=(null==a?void 0:a.navigationId)||0;let u="navigate";return i?u=i:0>xy()?a&&(document.prerendering||Iy()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:t,value:e,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:n||l,navigationInteractionId:s,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},Oy=(t,e,i={})=>{try{const n=t.filter(t=>PerformanceObserver.supportedEntryTypes.includes(t));if(n.length>0){const t=new PerformanceObserver(t=>{queueMicrotask(()=>{const i=t.getEntries();n.length>1&&i.sort((t,e)=>t.startTime+t.duration-(e.startTime+e.duration)),e(i)})});for(const e of n)t.observe(he({type:e,buffered:!0},i));return t}}catch(t){}},Dy=t=>{var e,i;return(null===(e=globalThis.PerformanceObserver)||void 0===e||null===(e=e.supportedEntryTypes)||void 0===e?void 0:e.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&t&&t.reportSoftNavs},Ly=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},Ny=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var qy=class{constructor(){this.u=void 0}};const jy=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},By=[1800,3e3],Hy=(t,e={})=>{const i=Dy(e);jy(()=>{const n=ky(e,qy),s=Ay();let r,o=Fy("FCP");const a=Oy(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(a.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-Iy(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});a&&(r=$y(t,o,By,e.reportAllChanges),Cy(i=>{o=Fy("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,xy()),r=$y(t,o,By,e.reportAllChanges),Ty(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Oy(["soft-navigation"],i=>{i.forEach(i=>{n.u&&i.navigationId&&Ly(n.u,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=Fy("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=$y(t,o,By,e.reportAllChanges),r(!0)})},e)})},zy=[.1,.25],Uy=t=>t.find(t=>{var e;return 1===(null===(e=t.node)||void 0===e?void 0:e.nodeType)})||t[0],Wy=(t,e={})=>{const i=ky(e=Object.assign({},e),gy),n=new WeakMap;i.t=t=>{var i;if(null==t||null===(i=t.sources)||void 0===i?void 0:i.length){const i=Uy(t.sources),o=null==i?void 0:i.node;if(o){var s,r;const t=null!==(s=null===(r=e.generateTarget)||void 0===r?void 0:r.call(e,o))&&void 0!==s?s:_y(o);n.set(i,t)}}},((t,e={})=>{const i=Ay();Hy(Ny(()=>{let n,s=Fy("CLS",0);const r=ky(e,gy),o=(i,o,a,l,u)=>{s=Fy("CLS",0,i,o,a,l,u),r.o=0,n=$y(t,s,zy,e.reportAllChanges)},a=(t=!1)=>{r.o>s.value&&(s.value=r.o,s.entries=r.i),n(t)},l=t=>{a(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.l(e):l(e);a()},h=["layout-shift"];Dy(e)&&h.push("soft-navigation");const c=Oy(h,u);c&&(n=$y(t,s,zy,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),Cy(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,xy()),Ty(n)}),setTimeout(n))}))})(e=>{t((t=>{let e={};if(t.entries.length){var i;const s=t.entries.reduce((t,e)=>t.value>e.value?t:e);if(null==s||null===(i=s.sources)||void 0===i?void 0:i.length){const t=Uy(s.sources);t&&(e={largestShiftTarget:n.get(t),largestShiftTime:s.startTime,largestShiftValue:s.value,largestShiftSource:t,largestShiftEntry:s,loadState:yy(s.startTime)})}}return Object.assign(t,{attribution:e})})(e))},e)},Vy=(t,e={})=>{const i=ky(e=Object.assign({},e),qy);Dy(e)&&(i.u=new Map),Hy(e=>{t((t=>{let e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:yy(xy())};if("soft-navigation"!==t.navigationType){if(t.entries.length){const i=my(),n=t.entries.at(-1);if(i){const s=Math.max(0,i.responseStart-(i.activationStart||0));e={timeToFirstByte:s,firstByteToFCP:t.value-s,loadState:yy(t.entries[0].startTime),navigationEntry:i,fcpEntry:n}}}}else{var n;const s=null===(n=i.u)||void 0===n?void 0:n.get(t.navigationId);s&&(e={timeToFirstByte:0,firstByteToFCP:t.value,loadState:"complete",navigationEntry:s})}return Object.assign(t,{attribution:e})})(e))},e)};let Gy=0,Zy=1/0,Qy=0;const Jy=t=>{for(const e of t)e.interactionId&&(Zy=Math.min(Zy,e.interactionId),Qy=Math.max(Qy,e.interactionId),Gy=Qy?(Qy-Zy)/7+1:0)};let Ky;const Xy=()=>{var t;return Ky?Gy:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var Yy=class{constructor(){this.h=0,this.v=[],this.p=new Map,this.m=void 0,this.M=void 0}T(){return Xy()-this.h}D(){this.h=Xy(),this.v.length=0,this.p.clear()}S(t){const e=this.T(),i=Math.min(this.v.length-1,Math.floor(e/50));return!e||-1!==i||"soft-navigation"!==t&&"back-forward-cache"!==t?this.v[i]:{k:8,id:-1,entries:[]}}l(t){var e;if(null===(e=this.m)||void 0===e||e.call(this,t),!t.interactionId)return;const i=this.v.at(-1);let n=this.p.get(t.interactionId);if(n||10>this.v.length||t.duration>i.k){var s;if(n?t.duration>n.k?(n.entries=[t],n.k=t.duration):t.duration===n.k&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],k:t.duration},this.p.set(n.id,n),this.v.push(n)),this.v.sort((t,e)=>e.k-t.k),this.v.length>10){const t=this.v.splice(10);for(const e of t)this.p.delete(e.id)}null===(s=this.M)||void 0===s||s.call(this,n)}}};const tb=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=Ny(t);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:e})}},eb=[200,500],ib=(t,e={})=>{const i=ky(e=Object.assign({},e),Yy);let n=[],s=[],r=0;const o=new WeakMap,a=new WeakMap;let l=!1;const u=()=>{l||(tb(h),l=!0)},h=()=>{const t=new Set(i.v.map(t=>o.get(t.entries[0]))),e=s.length-10;s=s.filter((i,n)=>n>=e||t.has(i));const a=new Set;for(const t of s){const e=c(t.startTime,t.processingEnd);for(const t of e)a.add(t)}n=n.filter(t=>t.startTime>r||a.has(t)),l=!1};i.m=t=>{const i=t.startTime+t.duration;let n;r=Math.max(r,t.processingEnd);for(let r=s.length-1;r>=0;r--){const o=s[r];if(8>=Math.abs(i-o.renderTime)){n=o,n.startTime=Math.min(t.startTime,n.startTime),n.processingStart=Math.min(t.processingStart,n.processingStart),n.processingEnd=Math.max(t.processingEnd,n.processingEnd),e.includeProcessedEventEntries&&n.entries.push(t);break}}n||(n={startTime:t.startTime,processingStart:t.processingStart,processingEnd:t.processingEnd,renderTime:i,entries:e.includeProcessedEventEntries?[t]:[]},s.push(n)),t.interactionId&&o.set(t,n),u()},i.M=t=>{if(!a.get(t)){var i;const o=null===(i=t.entries.find(t=>t.target))||void 0===i?void 0:i.target;if(o){var n,s;const i=null!==(n=null===(s=e.generateTarget)||void 0===s?void 0:s.call(e,o))&&void 0!==n?n:_y(o);a.set(t,i)}else{var r;const e=null===(r=t.entries.find(t=>t.targetSelector))||void 0===r?void 0:r.targetSelector;e&&a.set(t,e)}}};const c=(t,e)=>{const i=[];for(const s of n)if(s.startTime+s.duration>=t){if(s.startTime>e)break;i.push(s)}return i};Oy(["long-animation-frame"],t=>{n=n.concat(t),u()},e),((t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=Ay();jy(()=>{var n;"interactionCount"in performance||Ky||(Ky=Oy(["event"],Jy,{durationThreshold:0}));let s,r=Fy("INP");const o=ky(e,Yy),a=(i,n,a,l,u)=>{o.D(),r=Fy("INP",-1,i,n,a,l,u),s=$y(t,r,eb,e.reportAllChanges)},l=()=>{const t=o.S(r.navigationType);t&&t.k!==r.value&&(r.value=t.k,r.entries=t.entries,s())},u=t=>{l(),s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},h=(t,e=!1)=>{tb(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.l(e):u(e);l(),e&&s(!0)})},c=["event","first-input"];Dy(e)&&c.push("soft-navigation");const d=Oy(c,h,he(he({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=$y(t,r,eb,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),Cy(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,xy())}))})})(e=>{t((t=>{if(0===t.entries.length){const e={processedEventEntries:[],longAnimationFrameEntries:[],inputDelay:0,processingDuration:0,presentationDelay:t.value,loadState:yy(t.navigationStartTime||0)};return Object.assign(t,{attribution:e})}const e=t.entries[0],n=o.get(e),s=Math.max(n.processingStart,e.startTime),r=Math.max(e.startTime+e.duration,s),l=Math.min(n.processingEnd,r),u=n.entries.sort((t,e)=>t.processingStart-e.processingStart),h=c(e.startTime,l),d=i.p.get(e.interactionId),v={interactionTarget:a.get(d),interactionType:e.name.startsWith("key")?"keyboard":"pointer",interactionTime:e.startTime,nextPaintTime:r,processedEventEntries:u,longAnimationFrameEntries:h,inputDelay:s-e.startTime,processingDuration:l-s,presentationDelay:r-l,loadState:yy(e.startTime),longestScript:void 0,totalScriptDuration:void 0,totalStyleAndLayoutDuration:void 0,totalPaintDuration:void 0,totalUnattributedDuration:void 0};return(t=>{var e;const i=t.interactionTime,n=t.nextPaintTime;if(!(null===(e=t.longAnimationFrameEntries)||void 0===e?void 0:e.length)||!i||!n)return;const s=t.inputDelay,r=t.processingDuration;let o,a,l=0,u=0,h=0,c=0;for(const e of t.longAnimationFrameEntries){u=u+e.startTime+e.duration-e.styleAndLayoutStart;for(const t of e.scripts){const e=t.startTime+t.duration;if(i>e)continue;const n=e-Math.max(i,t.startTime),h=t.duration?n/t.duration*t.forcedStyleAndLayoutDuration:0;l+=n-h,u+=h,n>c&&(a=i+s>t.startTime?"input-delay":i+s+r>t.startTime?"processing-duration":"presentation-delay",o=t,c=n)}}const d=t.longAnimationFrameEntries.at(-1),v=d?d.startTime+d.duration:0;v>=i+s+r&&(h=n-v),o&&a&&(t.longestScript={entry:o,subpart:a,intersectingDuration:c}),t.totalScriptDuration=l,t.totalStyleAndLayoutDuration=u,t.totalPaintDuration=h,t.totalUnattributedDuration=n-i-l-u-h})(v),Object.assign(t,{attribution:v})})(e))},e)};var nb=class{constructor(){this.m=void 0,this.u=void 0}l(t){var e;null===(e=this.m)||void 0===e||e.call(this,t)}};const $=[2500,4e3];let sb=50;const rb=[];Oy(["resource"],t=>{for(const e of t)rb.push(e),rb.length>sb&&rb.shift()});const ob=(t,e={})=>{null!=(e=Object.assign({},e)).resourceBufferSize&&(sb=e.resourceBufferSize);const i=ky(e,nb),n=new WeakMap;Dy(e)&&(i.u=new Map),i.m=t=>{const i=t.element;if(i){var s,r;const o=null!==(s=null===(r=e.generateTarget)||void 0===r?void 0:r.call(e,i))&&void 0!==s?s:_y(i);n.set(t,o)}else t.id&&n.set(t,`#${t.id}`)},((t,e={})=>{let i=!1;const n=Dy(e);jy(()=>{let s,r=Ay(),o=Fy("LCP");const a=ky(e,nb),l=(n,a,l,u,h)=>{o=Fy("LCP",-1,n,a,l,u,h),s=$y(t,o,$,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=Ay(!0))},u=t=>{var e;a.u&&t.navigationId&&Ly(a.u,t),i||s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&h([n])},h=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],l=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-Iy(),0),a.l(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;l=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(l-e.startTime,0),s.largestContentfulPaint&&(a.l(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=t,o.entries=n,s())}},c=["largest-contentful-paint"];n&&c.push("interaction-contentful-paint","soft-navigation");const d=Oy(c,h);if(d){s=$y(t,o,$,e.reportAllChanges);const r=["keydown","click","visibilitychange"],a=t=>{if(t.isTrusted&&!i){const t=o.id;tb(()=>{if(!i){if(!n){d.disconnect();for(const t of r)removeEventListener(t,a,{capture:!0})}t===o.id&&(i=!0,s(!0))}})}};for(const t of r)addEventListener(t,a,{capture:!0});Cy(n=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,xy()),s=$y(t,o,$,e.reportAllChanges),Ty(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})})(e=>{t((t=>{let e={timeToFirstByte:0,resourceLoadDelay:0,resourceLoadDuration:0,elementRenderDelay:t.value};if(t.entries.length){var s,r,o;const a=t.entries.at(-1),l=a.url&&(rb.findLast(t=>t.name===a.url)||performance.getEntriesByType("resource").findLast(t=>t.name===a.url));let u;e.target=n.get(a),e.lcpEntry=a,a.url&&(e.url=a.url),l&&(e.lcpResourceEntry=l);let h=0,c=0;if("soft-navigation"!==t.navigationType?(u=my(),h=null!==(s=null==u?void 0:u.activationStart)&&void 0!==s?s:0,c=null!==(r=null==u?void 0:u.responseStart)&&void 0!==r?r:0):(h=t.navigationStartTime||0,u=null===(o=i.u)||void 0===o?void 0:o.get(t.navigationId)),u){const i=Math.max(0,c-h),n=Math.max(i,l?(l.requestStart||l.startTime)-h:0),s=Math.min(t.value,Math.max(n,l?l.responseEnd-h:0));e=he(he({},e),{},{timeToFirstByte:i,resourceLoadDelay:n-i,resourceLoadDuration:s-n,elementRenderDelay:t.value-s,navigationEntry:u})}}return Object.assign(t,{attribution:e})})(e))},e)};let ab=-1;const lb=()=>ab,ub=t=>{addEventListener("pageshow",e=>{e.persisted&&(ab=e.timeStamp,t(e))},!0)},hb=(t,e,i,n)=>{let s,r;return o=>{var a;e.value>=0&&(o||n)&&(r=e.value-(null!==(a=s)&&void 0!==a?a:0),(r||void 0===s)&&(s=e.value,e.delta=r,e.rating=((t,e)=>t>e[1]?"poor":t>e[0]?"needs-improvement":"good")(e.value,i),t(e)))}},cb=t=>{requestAnimationFrame(()=>requestAnimationFrame(()=>t()))},db=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},vb=()=>{var t,e;return null!==(t=null===(e=db())||void 0===e?void 0:e.activationStart)&&void 0!==t?t:0};let fb=-1;const pb=new Set,gb=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,mb=t=>{if("hidden"===document.visibilityState){if("visibilitychange"===t.type)for(const t of pb)t();isFinite(fb)||(fb="visibilitychange"===t.type?t.timeStamp:0,removeEventListener("prerenderingchange",mb,!0))}},yb=(t=!1)=>{if(t&&(fb=1/0),0>fb){var e;const t=vb(),i=document.prerendering||null===(e=globalThis.performance.getEntriesByType("visibility-state").find(e=>"hidden"===e.name&&e.startTime>=t))||void 0===e?void 0:e.startTime;fb=null!=i?i:gb(),addEventListener("visibilitychange",mb,!0),addEventListener("prerenderingchange",mb,!0),ub(()=>{setTimeout(()=>{fb=gb()})})}return{get firstHiddenTime(){return fb},onHidden(t){pb.add(t)}}},bb=(t,e=-1,i,n=0,s,r,o)=>{const a=db(),l=(null==a?void 0:a.navigationId)||0;let u="navigate";return i?u=i:0>lb()?a&&(document.prerendering||vb()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))):u="back-forward-cache",{name:t,value:e,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:n||l,navigationInteractionId:s,navigationURL:r||(null==a?void 0:a.name),navigationStartTime:o||0}},_b=new WeakMap;function wb(t,e){let i=_b.get(e);return i||(i=new WeakMap,_b.set(e,i)),i.get(t)||i.set(t,new e),i.get(t)}var kb=class{constructor(){this.t=void 0,this.i=0,this.o=[]}h(t){var e;if(t.hadRecentInput)return;const i=this.o[0],n=this.o.at(-1);this.i&&i&&n&&1e3>t.startTime-n.startTime&&5e3>t.startTime-i.startTime?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),null===(e=this.t)||void 0===e||e.call(this,t)}};const Sb=(t,e,i={})=>{try{const n=t.filter(t=>PerformanceObserver.supportedEntryTypes.includes(t));if(n.length>0){const t=new PerformanceObserver(t=>{queueMicrotask(()=>{const i=t.getEntries();n.length>1&&i.sort((t,e)=>t.startTime+t.duration-(e.startTime+e.duration)),e(i)})});for(const e of n)t.observe(he({type:e,buffered:!0},i));return t}}catch(t){}},xb=t=>{var e,i;return(null===(e=globalThis.PerformanceObserver)||void 0===e||null===(e=e.supportedEntryTypes)||void 0===e?void 0:e.includes("soft-navigation"))&&"function"==typeof(null===(i=globalThis.PerformanceSoftNavigation)||void 0===i||null===(i=i.prototype)||void 0===i?void 0:i.getLargestInteractionContentfulPaint)&&t&&t.reportSoftNavs},Cb=(t,e)=>{if(t.set(e.navigationId,e),t.size>2){const e=t.keys().next().value;void 0!==e&&t.delete(e)}},$b=t=>{let e=!1;return()=>{e||(t(),e=!0)}};var Tb=class{constructor(){this.l=void 0}};const Ib=t=>{document.prerendering?addEventListener("prerenderingchange",t,!0):t()},Mb=[1800,3e3],Eb=(t,e={})=>{const i=xb(e);Ib(()=>{const n=wb(e,Tb),s=yb();let r,o=bb("FCP");const a=Sb(["paint"],t=>{for(const e of t)"first-contentful-paint"===e.name&&(a.disconnect(),s.firstHiddenTime>e.startTime&&(o.value=Math.max(e.startTime-vb(),0),o.entries.push(e),o.navigationId=e.navigationId||o.navigationId,r(!0)))});a&&(r=hb(t,o,Mb,e.reportAllChanges),ub(i=>{o=bb("FCP",-1,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,lb()),r=hb(t,o,Mb,e.reportAllChanges),cb(()=>{o.value=performance.now()-i.timeStamp,r(!0)})})),i&&Sb(["soft-navigation"],i=>{i.forEach(i=>{n.l&&i.navigationId&&Cb(n.l,i);const s=Math.max((i.presentationTime||i.paintTime||0)-i.startTime,0);o=bb("FCP",s,"soft-navigation",i.navigationId,i.interactionId,i.name,i.startTime),r=hb(t,o,Mb,e.reportAllChanges),r(!0)})},e)})},Pb=[.1,.25],Rb=(t,e={})=>{const i=yb();Eb($b(()=>{let n,s=bb("CLS",0);const r=wb(e,kb),o=(i,o,a,l,u)=>{s=bb("CLS",0,i,o,a,l,u),r.i=0,n=hb(t,s,Pb,e.reportAllChanges)},a=(t=!1)=>{r.i>s.value&&(s.value=r.i,s.entries=r.o),n(t)},l=t=>{a(!0),o("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},u=t=>{for(const e of t)"soft-navigation"!==e.entryType?r.h(e):l(e);a()},h=["layout-shift"];xb(e)&&h.push("soft-navigation");const c=Sb(h,u);c&&(n=hb(t,s,Pb,e.reportAllChanges),i.onHidden(()=>{u(c.takeRecords()),n(!0)}),ub(()=>{o("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,lb()),cb(n)}),setTimeout(n))}))};let Ab=0,Fb=1/0,Ob=0;const Db=t=>{for(const e of t)e.interactionId&&(Fb=Math.min(Fb,e.interactionId),Ob=Math.max(Ob,e.interactionId),Ab=Ob?(Ob-Fb)/7+1:0)};let Lb;const Nb=()=>{var t;return Lb?Ab:null!==(t=performance.interactionCount)&&void 0!==t?t:0};var qb=class{constructor(){this.u=0,this.v=[],this.m=new Map,this.p=void 0,this.T=void 0}_(){return Nb()-this.u}M(){this.u=Nb(),this.v.length=0,this.m.clear()}L(t){const e=this._(),i=Math.min(this.v.length-1,Math.floor(e/50));return!e||-1!==i||"soft-navigation"!==t&&"back-forward-cache"!==t?this.v[i]:{P:8,id:-1,entries:[]}}h(t){var e;if(null===(e=this.p)||void 0===e||e.call(this,t),!t.interactionId)return;const i=this.v.at(-1);let n=this.m.get(t.interactionId);if(n||10>this.v.length||t.duration>i.P){var s;if(n?t.duration>n.P?(n.entries=[t],n.P=t.duration):t.duration===n.P&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],P:t.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((t,e)=>e.P-t.P),this.v.length>10){const t=this.v.splice(10);for(const e of t)this.m.delete(e.id)}null===(s=this.T)||void 0===s||s.call(this,n)}}};const jb=t=>{const e="requestIdleCallback"in globalThis?1e3:0,i=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)t();else{const s=$b(t);let r=-1;const o=()=>{n(r),s()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=i(()=>{removeEventListener("visibilitychange",o,{capture:!0}),s()},{timeout:e})}},Bb=[200,500],Hb=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const i=yb();Ib(()=>{var n;"interactionCount"in performance||Lb||(Lb=Sb(["event"],Db,{durationThreshold:0}));let s,r=bb("INP");const o=wb(e,qb),a=(i,n,a,l,u)=>{o.M(),r=bb("INP",-1,i,n,a,l,u),s=hb(t,r,Bb,e.reportAllChanges)},l=()=>{const t=o.L(r.navigationType);t&&t.P!==r.value&&(r.value=t.P,r.entries=t.entries,s())},u=t=>{l(),s(!0),a("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime)},h=(t,e=!1)=>{jb(()=>{for(const e of t)"soft-navigation"!==e.entryType?o.h(e):u(e);l(),e&&s(!0)})},c=["event","first-input"];xb(e)&&c.push("soft-navigation");const d=Sb(c,h,he(he({},e),{},{durationThreshold:null!==(n=e.durationThreshold)&&void 0!==n?n:40}));s=hb(t,r,Bb,e.reportAllChanges),d&&(i.onHidden(()=>{h(d.takeRecords(),!0)}),ub(()=>{a("back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,lb())}))})};var zb=class{constructor(){this.p=void 0,this.l=void 0}h(t){var e;null===(e=this.p)||void 0===e||e.call(this,t)}};const Ub=[2500,4e3],Wb=(t,e={})=>{let i=!1;const n=xb(e);Ib(()=>{let s,r=yb(),o=bb("LCP");const a=wb(e,zb),l=(n,a,l,u,h)=>{o=bb("LCP",-1,n,a,l,u,h),s=hb(t,o,Ub,e.reportAllChanges),i=!1,"soft-navigation"===n&&(r=yb(!0))},u=t=>{var e;a.l&&t.navigationId&&Cb(a.l,t),i||s(!0),l("soft-navigation",t.navigationId,t.interactionId,t.name,t.startTime);const n=null===(e=t.getLargestInteractionContentfulPaint)||void 0===e?void 0:e.call(t);n&&h([n])},h=t=>{e.reportAllChanges||n||(t=t.slice(-1));for(const e of t){if(!e)continue;if("soft-navigation"===e.entryType){u(e);continue}let t=0,n=[],l=e.startTime;if("largest-contentful-paint"===e.entryType)t=Math.max(e.startTime-vb(),0),a.h(e),n=[e];else if("interaction-contentful-paint"===e.entryType){var i;const s=e;if(!o.navigationId)continue;if("interactionId"in s&&s.interactionId!=o.navigationInteractionId)continue;l=(null===(i=s.largestContentfulPaint)||void 0===i?void 0:i.renderTime)||0,t=Math.max(l-e.startTime,0),s.largestContentfulPaint&&(a.h(s.largestContentfulPaint),n=[s.largestContentfulPaint])}r.firstHiddenTime>l&&(o.value=t,o.entries=n,s())}},c=["largest-contentful-paint"];n&&c.push("interaction-contentful-paint","soft-navigation");const d=Sb(c,h);if(d){s=hb(t,o,Ub,e.reportAllChanges);const r=["keydown","click","visibilitychange"],a=t=>{if(t.isTrusted&&!i){const t=o.id;jb(()=>{if(!i){if(!n){d.disconnect();for(const t of r)removeEventListener(t,a,{capture:!0})}t===o.id&&(i=!0,s(!0))}})}};for(const t of r)addEventListener(t,a,{capture:!0});ub(n=>{l("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,lb()),s=hb(t,o,Ub,e.reportAllChanges),cb(()=>{o.value=performance.now()-n.timeStamp,i=!0,s(!0)})})}})},Vb={onLCP:ob,onCLS:Wy,onFCP:Vy,onINP:ib,withoutAttribution:{onLCP:Wb,onCLS:Rb,onFCP:Eb,onINP:Hb}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution-soft-navs"]=Vb,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Vb,d.postHogWebVitalsCallbacks=Vb;const Gb={onLCP:Wb,onCLS:Rb,onFCP:Eb,onINP:Hb};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-soft-navs"]=Gb,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Gb,d.postHogWebVitalsCallbacks=Gb,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Gb;const Zb={onLCP:ob,onCLS:Wy,onFCP:Vy,onINP:ib,withoutAttribution:{onLCP:Wb,onCLS:Rb,onFCP:Eb,onINP:Hb}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals-with-attribution"]=Zb,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Zb,d.postHogWebVitalsCallbacks=Zb;const Qb={onLCP:Wb,onCLS:Rb,onFCP:Eb,onINP:Hb};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor=d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor||{},d.__PosthogExtensions__.postHogWebVitalsCallbacksByFlavor["web-vitals"]=Qb,d.__PosthogExtensions__.postHogWebVitalsCallbacks=Qb,d.postHogWebVitalsCallbacks=Qb,d.__PosthogExtensions__.loadWebVitalsCallbacks=()=>Qb;var Jb=class{constructor(t){this.disabled=!1===t;const e=$e(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;const n=this.clicks[this.clicks.length-1];if(n&&Math.abs(t-n.x)+Math.abs(e-n.y)<this.thresholdPx&&this.timeoutMs>i-n.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}};const Kb="$copy_autocapture",Xb=Zs("[AutoCapture]");function Yb(t,e){return e.length>t?e.slice(0,t)+"...":e}function t_(t){if(t.previousElementSibling)return t.previousElementSibling;let e=t;do{e=e.previousSibling}while(e&&!yr(e));return e}function e_(e,{e:i,maskAllElementAttributes:n,maskAllText:s,elementAttributeIgnoreList:r,elementsChainAsString:o,disableCaptureUrlHashes:a}){var l,u;if(!yr(e))return{props:{}};const h=[e],c=new Set([e]);let d=e;for(;d.parentNode&&!br(d,"body")&&1e3>h.length;){if(wr(d.parentNode)){const t=d.parentNode.host;if(c.has(t))break;c.add(t),h.push(t),d=t;continue}if(!yr(d.parentNode))break;if(c.has(d.parentNode))break;c.add(d.parentNode),h.push(d.parentNode),d=d.parentNode}const v="click"===i.type&&"http://www.w3.org/2000/svg"===e.namespaceURI?h.findIndex(t=>br(t,"button")||br(t,"a")):-1;v>0&&(s=s||h.slice(0,v+1).some(t=>!zr(t)||Ur(t)));const f=[],p={};let g,m=!1,y=!1;if(Js(h,t=>{const e=zr(t);if(br(t,"a")&&!n&&!(null==r?void 0:r.includes("href"))){const i=t.getAttribute("href");m=!!(e&&i&&Xr(i))&&(a?hn(i):i)}me(xr(t),"ph-no-capture")&&(y=!0),f.push(function(t,e,i,n,s=!1){const r=t.tagName.toLowerCase(),o={tag_name:r};Ir.indexOf(r)>-1&&!i&&(o.$el_text="a"===r.toLowerCase()||"button"===r.toLowerCase()?Yb(1024,Yr(t)):Yb(1024,$r(t)));const a=xr(t);e||(null==n?void 0:n.includes("class"))||0>=a.length||(o.classes=a.filter(function(t){return""!==t})),Js(t.attributes,function(i){var r;if((!Ur(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&!(null==n?void 0:n.includes(i.name))&&!e&&Xr(i.value)&&(!Me(r=i.name)||"_ngcontent"!==r.substring(0,10)&&"_nghost"!==r.substring(0,7))){let t=i.value;"class"===i.name&&(t=kr(t).join(" ")),o["attr__"+i.name]=Yb(1024,"href"===i.name&&s?hn(t):t)}});let l=1,u=1,h=t;for(;h=t_(h);)l++,h.tagName===t.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(t,n,s,r,a)),Js(function(t){if(!zr(t))return{};const e={};return Js(t.attributes,function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){const i=t.name.replace("data-ph-capture-attribute-",""),n=t.value;i&&n&&Xr(n)&&(e[i]=n)}}),e}(t),(t,e)=>{({}).hasOwnProperty.call(p,e)||(p[e]=t)})}),y)return{props:{},explicitNoCapture:y};if(v>0&&(e=h[v],f.splice(0,v)),s||(f[0].$el_text=br(e,"a")||br(e,"button")?Yr(e):$r(e)),m){var b,_;f[0].attr__href=m;const e=null===(b=lr(m))||void 0===b?void 0:b.host,i=null==t||null===(_=t.location)||void 0===_?void 0:_.host;e&&i&&e!==i&&(g=m)}return{props:Ks((k=i.type,{$event_type:k,$ce_version:1}),o?{}:{$elements:f},{$elements_chain:(w=f,xe(w)?function(t){return t.map(t=>{var e,i;let n="";if(t.tag_name&&(n+=t.tag_name),t.attr_class){t.attr_class.sort();for(const e of t.attr_class)n+=`.${e.replace(/"/g,"")}`}const s=he(he(he(he({},t.text?{text:t.text}:{}),{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{}),t.attr_id?{attr_id:t.attr_id}:{}),t.attributes),r={};return Xs(s).sort(([t],[e])=>function(t,e){return e>t?-1:t>e?1:0}(t,e)).forEach(([t,e])=>r[eo(t.toString())]=eo(e.toString())),n+=":",n+=Xs(r).map(([t,e])=>`${t}="${e}"`).join(""),n}).join(";")}(function(t){return t.map(t=>{var e,i;const n={text:null===(e=t.$el_text)||void 0===e?void 0:e.slice(0,400),tag_name:t.tag_name,href:null===(i=t.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:io(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Xs(t).filter(([t])=>0===t.indexOf("attr__")).forEach(([t,e])=>n.attributes[t]=e),n})}(w)):"")},(null===(l=f[0])||void 0===l?void 0:l.$el_text)?{$el_text:null===(u=f[0])||void 0===u?void 0:u.$el_text}:{},g&&"click"===i.type?{$external_click_url:g}:{},p),target:e};var w,k}var i_=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(t){var e;if(!zr(t))return!0;const i=null!==(e=this.bo().css_selector_ignorelist)&&void 0!==e?e:Rr,n=new Set;let s=t;for(;s;){if(n.size>=1e3||n.has(s))return!0;n.add(s);const t=s,e=xr(t);if(me(e,"ph-no-capture")||me(e,"ph-sensitive")||Ur(t)||i.some(e=>Mr(t,e)))return!0;const r=s.parentNode;s=wr(r)?r.host:r&&yr(r)?r:null}return!1}_o(t){if(!this.isEnabled||"pointercancel"===t.type)return void this.fo();if("pointerdown"===t.type){this.fo();const i=Tr(t);var e;return void(t.isPrimary&&0===t.button&&!t.ctrlKey&&i&&yr(i)&&(this.po={target:i,excluded:this.yo(i),id:t.pointerId,x:t.clientX,y:t.clientY,released:!1,distinctId:null===(e=this.wo)||void 0===e?void 0:e.distinctId}))}const i=this.po;i&&(t.pointerId!==i.id||Math.abs(t.clientX-i.x)>5||Math.abs(t.clientY-i.y)>5?this.fo():"pointerup"===t.type&&(i.released=!0,this.mo=setTimeout(()=>this.fo(),0)))}ko(t){var e;const i=this.po;this.fo();const s=Tr(t);if((null==i?void 0:i.released)&&i.target.isConnected&&i.distinctId===(null===(e=this.wo)||void 0===e?void 0:e.distinctId)&&t.pointerId===i.id&&(t.detail>0||"touch"===t.pointerType||"pen"===t.pointerType)&&0===t.button&&5>=Math.abs(t.clientX-i.x)&&5>=Math.abs(t.clientY-i.y)&&s&&(br(s,"html")||br(s,"body"))){var r;if(i.excluded)return null;const t=null!==(r=this.bo().css_selector_ignorelist)&&void 0!==r?r:Rr;return[s,null==n?void 0:n.documentElement,null==n?void 0:n.body].some(e=>{if(!e)return!1;const i=xr(e);return me(i,"ph-no-capture")||me(i,"ph-sensitive")||!zr(e)||Ur(e)||t.some(t=>Mr(e,t))})?null:i.target}}constructor(t){this.So=t,this.name="autocapture",this.xo=!1,this.Co=null,this.$o=!1,this.To=!1,this.Rr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Io=!1,this.So.refresh(this.Rr),this.rageclicks=new Jb(this.Rr.rageclick),this.Mo=null}setup(t){this.Eo(),this.wo=t;const e=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Io?e.dispose():(this.Po=e,this.startIfEnabled())}dispose(){var t;this.Io||(this.Io=!0,this.wo=void 0,null===(t=this.Po)||void 0===t||t.dispose(),this.Po=void 0,this.Ro())}bo(){return this.So.refresh(this.Rr),this.Rr}Eo(){var t,e;return this.bo(),this.Rr.url_allowlist=null===(t=this.Rr.url_allowlist)||void 0===t?void 0:t.map(t=>new RegExp(t)),this.Rr.url_ignorelist=null===(e=this.Rr.url_ignorelist)||void 0===e?void 0:e.map(t=>new RegExp(t)),this.Rr}Ao(){if(!this.isBrowserSupported())return void Xb.info("Disabling Automatic Event Collection because this browser is not supported");if(!t||!n)return;const e=this.Fo=e=>{e=e||(null==t?void 0:t.event);try{if("blur"===e.type)return void this.fo();if(0===e.type.indexOf("pointer"))return void this._o(e);const t="click"===e.type?this.ko(e):void 0;if(Pe(t))return;this.Oo(e,"$autocapture",t)}catch(t){Xb.error("Failed to capture event",t)}};if(sr(t,"blur",e),sr(n,"submit",e,{capture:!0}),sr(n,"change",e,{capture:!0}),sr(n,"click",e,{capture:!0}),Js(["pointerdown","pointermove","pointerup","pointercancel"],t=>{sr(n,t,e,{capture:!0})}),this.bo().capture_copied_text){const e=this.Do=e=>{e=e||(null==t?void 0:t.event);try{this.Oo(e,Kb)}catch(t){Xb.error("Failed to capture clipboard event",t)}};sr(n,"copy",e,{capture:!0}),sr(n,"cut",e,{capture:!0}),sr(n,"paste",e,{capture:!0})}}Ro(){this.fo(),this.Fo&&(null==t||t.removeEventListener("blur",this.Fo),Js(["pointerdown","pointermove","pointerup","pointercancel"],t=>{null==n||n.removeEventListener(t,this.Fo,!0)}),null==n||n.removeEventListener("submit",this.Fo,!0),null==n||n.removeEventListener("change",this.Fo,!0),null==n||n.removeEventListener("click",this.Fo,!0),this.Fo=void 0),this.Do&&(null==n||n.removeEventListener("copy",this.Do,!0),null==n||n.removeEventListener("cut",this.Do,!0),null==n||n.removeEventListener("paste",this.Do,!0),this.Do=void 0),this.xo=!1}startIfEnabled(){this.isEnabled||this.fo(),!this.Io&&this.wo&&this.isEnabled&&!this.xo&&(this.Ao(),this.xo=!0)}onRemoteConfig(t){if(this.Io)return;if(this.$o=!0,!t.ok)return void this.startIfEnabled();const e=t.config;e.elementsChainAsString&&(this.To=e.elementsChainAsString);const i=e.autocapture_opt_out;var n;Oe(i)&&(null===(n=this.wo)||void 0===n||n.kv.set("$autocapture_disabled_server_side",i),this.Co=i),this.startIfEnabled()}setElementSelectors(t){this.Mo=t}getElementSelectors(t,e){var i;const s=[];return null===(i=this.Mo)||void 0===i||i.forEach(i=>{const r=null==n?void 0:n.querySelectorAll(i);null==r||r.forEach(n=>{t!==n&&e!==n||me(s,i)||s.push(i)})}),s}get isEnabled(){var t,e;if(this.Io)return!1;const i=null===(t=this.wo)||void 0===t?void 0:t.kv.get(x),n=this.Co,s=this.bo();if(!s.remoteRequestsDisabled&&!this.$o)return!1;const r=s.remoteRequestsDisabled&&!this.$o;if(Pe(n)&&!Oe(i)&&!r)return!1;const o=null!==(e=this.Co)&&void 0!==e?e:!!i;return!!s.enabled&&!o}Oo(e,i="$autocapture",n){if(!this.isEnabled)return void this.fo();let s=n||Tr(e);_r(s)&&(s=s.parentNode||null);const r=this.Eo();var o;"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&r.rageclick&&(null===(o=this.rageclicks)||void 0===o?void 0:o.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime()))&&jr(s,r.rageclick)&&this.Oo(e,"$rageclick",n);const a=i===Kb,l=a?he(he({},r),{},{dom_event_allowlist:void 0}):r;if(s&&function(e,i,n,s,r,o){var a;if(!t||Br(e))return!1;if((null==n?void 0:n.url_allowlist)&&!Sr(n.url_allowlist,o))return!1;if((null==n?void 0:n.url_ignorelist)&&Sr(n.url_ignorelist,o))return!1;if(null==n?void 0:n.dom_event_allowlist){const t=n.dom_event_allowlist;if(t&&!t.some(t=>i.type===t))return!1}const{parentIsUsefulElement:l,targetElementList:u}=Hr(e,s);if(!function(t,e){const i=null==e?void 0:e.element_allowlist;if(Ie(i))return!0;for(const e of t)if(i.some(t=>e.tagName.toLowerCase()===t))return!0;return!1}(u,n))return!1;if(!Er(u,null==n?void 0:n.css_selector_allowlist))return!1;if(Er(u,null!==(a=null==n?void 0:n.css_selector_ignorelist)&&void 0!==a?a:Rr))return!1;try{const n=t.getComputedStyle(e);if(n&&"pointer"===n.getPropertyValue("cursor")&&"click"===i.type)return!0}catch(t){}const h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(r||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(i.type)>=0;default:return l?(r||["click"]).indexOf(i.type)>=0:(r||["click"]).indexOf(i.type)>=0&&(Ir.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,l,a,a?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var u;const{props:n,explicitNoCapture:o,target:a}=e_(s,{e:e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(o)return!1;const l=this.getElementSelectors(s,a);if(l&&l.length>0&&(n.$element_selectors=l),i===Kb){const i=e.type||"clipboard";if("paste"!==i){var h,c;const e=null==t||null===(h=t.getSelection())||void 0===h?void 0:h.toString(),i=Cr(e);if(!i)return!1;n.$selected_content=i,n.$clipboard_text_length=null!==(c=null==e?void 0:e.length)&&void 0!==c?c:0}n.$copy_type=i}return null===(u=this.wo)||void 0===u||u.capture(i,n),!0}}isBrowserSupported(){return Ce(null==n?void 0:n.querySelectorAll)}};const n_={};function s_(t,e){const i=Tr(t);return i?he({node:i,originalEvent:t,timestamp:Date.now()},e):null}function r_(t){return!!cn(()=>yr(t))}function o_(t,e){return Math.abs(t)<Math.abs(e)?0>e?"up":"down":0>t?"left":"right"}function a_(t){return"swipe"===t.type?"$dead_swipe":"$dead_click"}const l_="canvas,video,audio,embed,object";function u_(t,e){return Ae(t)&&t>=e}function h_(t,e=1e3){return t>=0&&e>t?t:void 0}function c_(t,e,i=1e3){return Ae(e)?h_(t-e,i):void 0}var d_=class{dr(t){var e,i,n,s,r,o,a,l;const u=this.hr((null==t?void 0:t.__onCapture)||this.vr.bind(this));return{element_attribute_ignorelist:null!==(e=null==t?void 0:t.element_attribute_ignorelist)&&void 0!==e?e:u.element_attribute_ignorelist,scroll_threshold_ms:null!==(i=null==t?void 0:t.scroll_threshold_ms)&&void 0!==i?i:u.scroll_threshold_ms,selection_change_threshold_ms:null!==(n=null==t?void 0:t.selection_change_threshold_ms)&&void 0!==n?n:u.selection_change_threshold_ms,mutation_threshold_ms:null!==(s=null==t?void 0:t.mutation_threshold_ms)&&void 0!==s?s:u.mutation_threshold_ms,capture_clicks_with_modifier_keys:null!==(r=null==t?void 0:t.capture_clicks_with_modifier_keys)&&void 0!==r?r:u.capture_clicks_with_modifier_keys,capture_dead_swipes:null!==(o=null==t?void 0:t.capture_dead_swipes)&&void 0!==o?o:u.capture_dead_swipes,swipe_threshold_px:null!==(a=null==t?void 0:t.swipe_threshold_px)&&void 0!==a?a:u.swipe_threshold_px,max_dead_swipes_per_page_load:null!==(l=null==t?void 0:t.max_dead_swipes_per_page_load)&&void 0!==l?l:u.max_dead_swipes_per_page_load,css_selector_ignorelist:null==t?void 0:t.css_selector_ignorelist,__onCapture:u.__onCapture}}constructor(t,e){this.instance=t,this.pr=new WeakSet,this.mr=!1,this.gr=[],this.yr=0,this.hr=t=>({element_attribute_ignorelist:[],scroll_threshold_ms:100,selection_change_threshold_ms:100,mutation_threshold_ms:2500,capture_clicks_with_modifier_keys:!1,capture_dead_swipes:!0,swipe_threshold_px:30,max_dead_swipes_per_page_load:10,__onCapture:t}),this.br=()=>{clearTimeout(this.wr),this.wr=void 0,this.kr=void 0},this._r=t=>{if(this.Sr(t),this.br(),0===t.button){const e={path:t.composedPath(),trusted:t.isTrusted,selectionChanged:!1,selectionInitiallyRelated:!1},i=null==n?void 0:n.getSelection();e.selectionInitiallyRelated="Range"===(null==i?void 0:i.type)&&this.Cr(i,e),this.kr=e}},this.Mr=t=>{Pe(t.relatedTarget)&&this.br()},this.Ir=t=>{const e=this.kr,i=t;if(!e||0!==i.button||t.isTrusted!==e.trusted)return;const n=t.composedPath();for(const t of e.path)if(r_(t)&&-1!==n.indexOf(t)){e.clickTarget=t;break}e.clickDetail=i.detail,this.wr=d.setTimeout(this.br,0)},this.Tr=t=>{this.Sr(t);const e=t,i=s_(e,{type:"click"}),n=this.kr;i&&n&&0===e.button&&e.detail>0&&e.detail===n.clickDetail&&t.isTrusted===n.trusted&&i.node===n.clickTarget&&(i.selectionChangedDuringGesture=n.selectionChanged&&this.Rr.selection_change_threshold_ms>0,this.br()),Pe(i)||this.$r(i)||this.Er(i),this.Ar()},this.Or=()=>{const t=Date.now();this.Lr=t,t%50==0&&this.gr.forEach(e=>{Ie(e.scrollDelayMs)&&(e.scrollDelayMs=t-e.timestamp)})},this.Pr=t=>{var e,i;const s=null==n?void 0:n.getSelection(),r=this.mr;this.mr="Range"===(null==s?void 0:s.type);const o=null==s?void 0:s.focusNode,a=o&&(yr(o)?o:o.parentElement),l=null==n?void 0:n.activeElement;let u=l;for(;null==u||null===(e=u.shadowRoot)||void 0===e?void 0:e.activeElement;)u=u.shadowRoot.activeElement;const h=qr(Tr(t))||qr(null!=a?a:null)||qr(null!==(i=u)&&void 0!==i?i:null),c="Caret"===(null==s?void 0:s.type)&&u&&!u.shadowRoot&&o&&o!==l&&o.contains(null!=l?l:null);if(!(r||this.mr||h||c))return;const d=Date.now();this.Dr=d;const v=this.kr;if(v&&(r||this.mr||h)){const e=Tr(t);let i;if(qr(e))i=e;else if("Caret"===(null==s?void 0:s.type)){var f;qr(null!==(f=u)&&void 0!==f?f:null)||c?i=u:h&&(i=a)}const n=i?this.Fr(i,v):s&&(o||s.anchorNode)?this.Cr(s,v):r&&!this.mr&&v.selectionInitiallyRelated;v.selectionChanged=v.selectionChanged||n}this.gr.forEach(t=>{const e=d-t.timestamp;0>e||!Ie(t.selectionChangedDelayMs)&&e>=t.selectionChangedDelayMs||(t.selectionChangedDelayMs=e)})},this.ln=()=>{"hidden"===(null==n?void 0:n.visibilityState)&&this.br();const t=Date.now();this.Nr=t,this.qr("visibilityChangedDelayMs",t)},this.jr=()=>{const t=Date.now();this.Br=t,this.qr("focusChangedDelayMs",t)},this.Hr=t=>{this.Sr(t);const e=t.touches,i=1===(null==e?void 0:e.length)?e[0]:void 0;this.zr=i?{x:i.clientX,y:i.clientY,timestamp:Date.now()}:void 0},this.Ur=()=>{this.zr=void 0},this.Wr=t=>{var e;const i=this.zr;if(this.zr=void 0,Ie(i)||this.yr>=this.Rr.max_dead_swipes_per_page_load)return;const s=t,r=null===(e=s.changedTouches)||void 0===e?void 0:e[0];if(!r)return;const o=r.clientX-i.x,a=r.clientY-i.y,l=o*o+a*a,u=this.Rr.swipe_threshold_px;if(u*u>l)return;if([this.Lr,this.Vr,this.Dr].some(t=>Ae(t)&&t>=i.timestamp))return;var h,c;if(this.Zr()&&(null!==(h=null==n||null===(c=n.elementsFromPoint)||void 0===c?void 0:c.call(n,i.x,i.y))&&void 0!==h?h:[]).some(t=>{var e;return null===(e=t.matches)||void 0===e?void 0:e.call(t,l_)}))return;const d=s_(s,{type:"swipe",swipeDirection:o_(o,a),swipeDistancePx:Math.round(Math.sqrt(l))});Pe(d)||this.$r(d)||this.Er(d),this.Ar()},this.Rr=this.dr(e),this._onCapture=this.Rr.__onCapture}start(t){this.Gr(),this.Qr(),this.Jr(),this.Kr(),this.Xr(),this.Yr(t),this.Rr.capture_dead_swipes&&this.eo()}Yr(e){if(!this.no){const i=function(e){return function(e,i){const n=n_[e];if(n)return n;let s=i[e];if((t=>Ce(t)&&-1!==t.toString().indexOf("[native code]"))(s)&&!(null==t?void 0:t.Zone))return n_[e]=s.bind(i);const r=i.document;if(r&&Ce(r.createElement)){let t,n=!1;try{t=r.createElement("iframe"),t.hidden=!0,r.head.appendChild(t);const l=t.contentWindow;var o,a;l&&l[e]&&(s=l[e],"MutationObserver"===e&&function(t){return me(t,"AppleWebKit")&&!me(t,"Chrome")}(null!==(o=null===(a=i.navigator)||void 0===a?void 0:a.userAgent)&&void 0!==o?o:"")&&(t.classList.add("rr-block","ph-no-capture"),n=!0))}catch(t){Gs.warn(`Could not create sandbox iframe for ${e} check, bailing to assignableWindow.${e}: `,t)}finally{!n&&(null==t?void 0:t.parentNode)&&t.parentNode.removeChild(t)}}return s&&Ce(s)?n_[e]=s.bind(i):s}("MutationObserver",e)}(d);this.no=new i(t=>{this.io(t)}),this.ro(e)}}ro(t){t&&this.no&&(this.pr.has(t)||(this.no.observe(t,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),this.pr.add(t),this.oo(t)))}oo(t,e){var i,n;yr(t)&&t.shadowRoot&&this.ro(t.shadowRoot);const s=null!==(i=null===(n=t.querySelectorAll)||void 0===n?void 0:n.call(t,"*"))&&void 0!==i?i:[];for(let t=0;s.length>t;t++)null==e||e.add(s[t]),this.ro(s[t].shadowRoot)}Sr(t){var e,i;const n=null!==(e=null===(i=t.composedPath)||void 0===i?void 0:i.call(t))&&void 0!==e?e:[];for(let t=0;n.length>t;t++){const e=n[t];r_(e)&&this.ro(e.shadowRoot)}}stop(){var t;null===(t=this.no)||void 0===t||t.disconnect(),this.no=void 0,this.pr=new WeakSet,d.removeEventListener("click",this.Tr,{capture:!0}),d.removeEventListener("mousedown",this._r,{capture:!0}),d.removeEventListener("mouseup",this.Ir,{capture:!0}),d.removeEventListener("mouseout",this.Mr,{capture:!0}),d.removeEventListener("dragstart",this.br,{capture:!0}),d.removeEventListener("pointercancel",this.br,{capture:!0}),d.removeEventListener("blur",this.br),this.br(),d.removeEventListener("scroll",this.Or,{capture:!0}),null==n||n.removeEventListener("selectionchange",this.Pr),d.removeEventListener("touchstart",this.Hr,{capture:!0}),d.removeEventListener("touchend",this.Wr,{capture:!0}),d.removeEventListener("touchcancel",this.Ur,{capture:!0}),null==n||n.removeEventListener("visibilitychange",this.ln),d.removeEventListener("blur",this.jr),d.removeEventListener("focus",this.jr),this.zr=void 0}io(t){const e=new Set;for(const n of t)try{var i;if(!1===(null===(i=n.target)||void 0===i?void 0:i.isConnected))continue;this.Vr=Date.now();const t=n.addedNodes;for(let i=0;t.length>i;i++){const n=t[i];r_(n)&&!e.has(n)&&this.oo(n,e)}}catch(t){}}Gr(){sr(d,"click",this.Tr,{capture:!0}),sr(d,"mousedown",this._r,{capture:!0}),sr(d,"mouseup",this.Ir,{capture:!0}),sr(d,"mouseout",this.Mr,{capture:!0}),sr(d,"dragstart",this.br,{capture:!0}),sr(d,"pointercancel",this.br,{capture:!0}),sr(d,"blur",this.br)}Er(t){t.selectionChangedDelayMs=c_(t.timestamp,this.Dr,this.Rr.selection_change_threshold_ms),t.visibilityChangedDelayMs=c_(t.timestamp,this.Nr),t.focusChangedDelayMs=c_(t.timestamp,this.Br),this.gr.push(t)}Ar(){this.gr.length&&Ie(this.so)&&(this.so=d.setTimeout(()=>{this.ao()},1e3))}Qr(){sr(d,"scroll",this.Or,{capture:!0})}Jr(){var t;this.mr="Range"===(null==n||null===(t=n.getSelection())||void 0===t?void 0:t.type),sr(n,"selectionchange",this.Pr)}Fr(t,e){const i=e.path[0];try{for(;t;){if(-1!==e.path.indexOf(t)||yr(i)&&i.contains(t))return!0;t=t.getRootNode().host}}catch(t){}return!1}Cr(t,e){const i=e.path[0],n=t.rangeCount>0?t.getRangeAt(0):void 0,s=!!n&&cn(()=>n.startContainer.getRootNode()===i.getRootNode());if(n&&s&&yr(i)){var r;if(!n.collapsed)return n.intersectsNode(i);const t=yr(n.startContainer)&&null!==(r=n.startContainer.childNodes[n.startOffset])&&void 0!==r?r:n.startContainer;return this.Fr(t,e)}return this.Fr(t.focusNode,e)||this.Fr(t.anchorNode,e)}Kr(){sr(n,"visibilitychange",this.ln)}Xr(){sr(d,"blur",this.jr),sr(d,"focus",this.jr)}qr(t,e){this.gr.forEach(i=>{const n=h_(e-i.timestamp);Ae(n)&&(Ie(i[t])||i[t]>n)&&(i[t]=n)})}eo(){sr(d,"touchstart",this.Hr,{capture:!0,passive:!0}),sr(d,"touchend",this.Wr,{capture:!0,passive:!0}),sr(d,"touchcancel",this.Ur,{capture:!0,passive:!0})}Zr(){const t=Ie(this.lo)||Ae(this.Vr)&&this.Vr>this.lo;return(Ie(this.uo)||t)&&(this.lo=Date.now(),this.uo=!!(null==n?void 0:n.querySelector(l_))),!!this.uo}$r(t){return!t||("swipe"===t.type?this.co(t):this.do(t))}co(e){return!(!mr(e.node)&&!this.gr.some(t=>t.type===e.type&&t.node===e.node&&1e3>Math.abs(t.timestamp-e.timestamp))&&!br(e.node,"html")&&yr(e.node)&&function(e,i){var n;if(!t||Br(e))return!1;const s=Oe(i)?Dr:null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:Dr,{targetElementList:r}=Hr(e,!1);return!Er(r,s)}(e.node,{css_selector_ignorelist:this.Rr.css_selector_ignorelist}))}do(e){return!(this.Rr.capture_clicks_with_modifier_keys||(i=e.originalEvent,!(i.ctrlKey||i.metaKey||i.altKey||i.shiftKey)))||!!this.co(e)||function(e){if(!t||Br(e))return!1;const{targetElementList:i}=Hr(e,!1);return i.some(t=>br(t,"a"))}(e.node);var i}ao(){if(!this.gr.length)return;clearTimeout(this.so),this.so=void 0;const t=this.gr;this.gr=[];for(const i of t){var e;i.mutationDelayMs=null!==(e=i.mutationDelayMs)&&void 0!==e?e:this.Vr&&this.Vr>=i.timestamp?this.Vr-i.timestamp:void 0,i.absoluteDelayMs=Date.now()-i.timestamp;const t=u_(i.scrollDelayMs,this.Rr.scroll_threshold_ms),n=u_(i.selectionChangedDelayMs,this.Rr.selection_change_threshold_ms),s=u_(i.mutationDelayMs,this.Rr.mutation_threshold_ms),r=u_(i.absoluteDelayMs,1.1*this.Rr.mutation_threshold_ms),o=Ae(i.scrollDelayMs)&&this.Rr.scroll_threshold_ms>i.scrollDelayMs,a=Ae(i.mutationDelayMs)&&this.Rr.mutation_threshold_ms>i.mutationDelayMs,l=i.selectionChangedDuringGesture||Ae(i.selectionChangedDelayMs)&&this.Rr.selection_change_threshold_ms>i.selectionChangedDelayMs,u=Ae(i.visibilityChangedDelayMs),h=Ae(i.focusChangedDelayMs);if(!(o||a||l||u||h))if(t||s||r||n){const e=a_(i);if("$dead_swipe"===e){if(this.yr>=this.Rr.max_dead_swipes_per_page_load)continue;this.yr++}this._onCapture(i,{[`${e}_last_mutation_timestamp`]:this.Vr,[`${e}_event_timestamp`]:i.timestamp,[`${e}_scroll_timeout`]:t,[`${e}_mutation_timeout`]:s,[`${e}_absolute_timeout`]:r,[`${e}_selection_changed_timeout`]:n,[`${e}_visibility_changed_timeout`]:!1})}else this.Rr.mutation_threshold_ms>i.absoluteDelayMs&&this.gr.push(i)}this.Ar()}vr(t,e){const i=a_(t);this.instance.capture(i,he(he(he({},e),e_(t.node,{e:t.originalEvent,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rr.element_attribute_ignorelist,elementsChainAsString:!1,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}).props),{},{[`${i}_scroll_delay_ms`]:t.scrollDelayMs,[`${i}_mutation_delay_ms`]:t.mutationDelayMs,[`${i}_absolute_delay_ms`]:t.absoluteDelayMs,[`${i}_selection_changed_delay_ms`]:t.selectionChangedDelayMs,[`${i}_visibility_changed_delay_ms`]:t.visibilityChangedDelayMs,[`${i}_focus_changed_delay_ms`]:t.focusChangedDelayMs,$dead_swipe_direction:t.swipeDirection,$dead_swipe_distance_px:t.swipeDistancePx}),{timestamp:new Date(t.timestamp)})}};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.initDeadClicksAutocapture=(t,e)=>new d_(t,e);const v_=Zs("[ExternalScriptsLoader]"),f_=t=>{const e=null==n?void 0:n.querySelectorAll("script");if(e)for(let i=0;e.length>i;i++)if(e[i].src===t||e[i].getAttribute("src")===t)return e[i]},p_=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return v_.warn(`${e} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=f_(e);if(s){if(s.__posthog_loading_callback_fired)return i();const t=s.__posthog_loading_error;return t?i(t):(s.addEventListener("load",t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)}),void s.addEventListener("error",t=>{s.__posthog_loading_error=t,i(t)}))}const r=()=>{if(!n)return i("document not found");if(f_(e))return p_(t,e,i);let s=n.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,i(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)n.head.appendChild(s);else{const t=n.querySelectorAll("body > script");var r;t.length>0?null===(r=t[0].parentNode)||void 0===r||r.insertBefore(s,t[0]):n.body.appendChild(s)}};(null==n?void 0:n.body)?r():null==n||n.addEventListener("DOMContentLoaded",r)},g_={},m_=(t,e)=>{let i=`/static/${e}.js?v=${t.version}`;if("toolbar"===e){const t=3e5;i=`${i}&t=${Math.floor(Date.now()/t)*t}`}return t.requestRouter.endpointFor("assets",i)};d.__PosthogExtensions__=d.__PosthogExtensions__||{},d.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"===e){const e=t.requestRouter.endpointFor("assets",`/array/${t.config.token}/config.js`);return void p_(t,e,i)}const n=t.config.strict_script_versioning;if(n){const s=t.requestRouter.endpointFor("assets",`/static/${t.version}/${e}.js`),r=g_[s];if("fallback"===n&&r){if(f_(r))return void p_(t,r,i);delete g_[s]}return void p_(t,s,"fallback"===n?(n,r)=>{if(n)if("string"==typeof n)i(n);else{var o;const n=m_(t,e);g_[s]=n;const r=f_(s);null==r||null===(o=r.parentNode)||void 0===o||o.removeChild(r),p_(t,n,i)}else i(void 0,r)}:i)}p_(t,m_(t,e),i)},d.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{const n=t.requestRouter.endpointFor("api",e);p_(t,n,i)};var y_=class{constructor(t){this._instance=t}get Rr(){return this._instance.config}get consent(){return this.Lo()?0:this.No}isOptedOut(){return"always"===this.Rr.cookieless_mode||this.isRejected()||-1===this.consent&&"on_reject"===this.Rr.cookieless_mode}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Rr.opt_out_capturing_by_default}optInOut(t){this.qo.At(this.jo,t?1:0,this.Rr.cookie_expiration,this.Rr.cross_subdomain_cookie,this.Rr.secure_cookie)}reset(){this.qo.Lt(this.jo,this.Rr.cross_subdomain_cookie)}get jo(){const{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get No(){const t=this.qo.Ot(this.jo);return We(t)?1:me(Ve,t)?0:-1}get qo(){const t=this.Rr.opt_out_capturing_persistence_type,e="localStorage"===t?Na:Da,i=e.Et()?e:Ja;if(!this.Bo||this.Bo!==i){this.Bo=i;const e="localStorage"===t?Da:Na;e.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(We(e.Ot(this.jo))),e.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,d.doNotTrack,null==i?void 0:i.globalPrivacyControl].some(t=>We(t))}};const b_=Zs("[Dead Clicks]"),__=()=>!0,w_=t=>{var e;const i=!!(null===(e=t.instance.persistence)||void 0===e?void 0:e.get_property(P)),n=t.instance.config.capture_dead_clicks;return Oe(n)?n:!!$e(n)||i};var k_=class{get lazyLoadedDeadClicksAutocapture(){return this.Ho}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[P]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initDeadClicksAutocapture)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this.instance,"dead-clicks-autocapture",e=>{e?b_.error("failed to load script",e):t()})}Uo(){var t;if(n){if(!this.Ho&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.initDeadClicksAutocapture)){const t=$e(this.instance.config.capture_dead_clicks)?he({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Ho=d.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Ho.start(n),b_.info("starting...")}}else b_.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,b_.info("stopping..."))}};const S_=Zs("[SegmentIntegration]");function x_(t,e,i=!0){const n=t.config.segment;if(!n)return e();const{analytics:s,filterProperties:r}=(t=>Ce(t.register))(o=n)?{analytics:o}:o;var o;!function(t,e,i,n){const s=e=>{const s=()=>e.anonymousId()||Pa();t.config.get_device_id=s,n&&e.id()&&(t.register({distinct_id:e.id(),$device_id:s()}),t.persistence.set_property($t,Kt)),i(n?void 0:e.anonymousId()||void 0)},r=e.user();"then"in r&&Ce(r.then)?r.then(s):s(r)}(t,s,i=>{s.register(((t,e,{filterProperties:i}={})=>{"undefined"!=typeof Promise&&Promise.resolve||S_.warn("This browser does not have Promise support, and can not use the segment integration");const n=(n,s)=>{if(!s)return n;const r=!!e&&n.event.anonymousId===e&&!n.event.userId;r||n.event.userId||n.event.anonymousId===t.get_distinct_id()||(S_.info("No userId set, resetting PostHog"),t.reset()),r||(e=void 0),n.event.userId&&n.event.userId!==t.get_distinct_id()&&(S_.info("UserId set, identifying with PostHog"),t.identify(n.event.userId));let o=t.calculateEventProperties(s,n.event.properties);if(!Re(i)){const t=n.event.properties||{},e={};for(const i of Object.keys(o))ke.call(t,i)||(e[i]=o[i]);const s=((t,e)=>{const i=xe(t)?t:[t];let n=he({},e);for(const t of i)try{if(n=t(n),Re(n))return null}catch(t){return S_.error("Error in Segment filterProperties:",t),null}return n})(i,e);if(Re(s))return n;o=s}return n.event.properties=Object.assign({},o,n.event.properties),n};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(t){return n(t,t.event.event)},page(t){return n(t,ee)},identify(t){return n(t,ne)},screen(t){return n(t,"$screen")}}})(t,i,{filterProperties:r})).then(()=>{e()},t=>{S_.error("Failed to register the Segment integration",t),e()})},i)}const C_="posthog-js";function $_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s=["error"],sendExceptionsToPostHog:r=!0}={}){return o=>{var a,l,u,h,c;if("*"!==s&&!s.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===(a=o.exception)||void 0===a?void 0:a.values)||[],f=v.map(t=>he(he({},t),{},{stacktrace:t.stacktrace?he(he({},t.stacktrace),{},{type:"raw",frames:(t.stacktrace.frames||[]).map(t=>he(he({},t),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:(null===(l=v[0])||void 0===l?void 0:l.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 e&&i&&(p.$sentry_url=(n||"https://sentry.io/organizations/")+e+"/issues/?project="+i+"&query="+o.event_id),r&&(null===(g=t.exceptions)||void 0===g||g.sendExceptionEvent(p)),o}}var T_=class{constructor(t,e,i,n,s,r){this.name=C_,this.setupOnce=function(o){o($_(t,{organization:e,projectId:i,prefix:n,severityAllowList:s,sendExceptionsToPostHog:null==r||r}))}}},I_=class{constructor(t){this.Wo=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(Gs.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Vo=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Go()}Go(){var t;this.Zo=null===(t=this._instance.sessionManager)||void 0===t?void 0:t.onSessionId(this.Wo)}destroy(){var t;null===(t=this.Zo)||void 0===t||t.call(this),this.Zo=void 0}doPageView(e,i){var n;const s=this.Qo(e,i);return this.Vo={pathname:null!==(n=null==t?void 0:t.location.pathname)&&void 0!==n?n:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.Qo(t,null===(e=this.Vo)||void 0===e?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null===(t=this.Vo)||void 0===t?void 0:t.pageViewId}}Qo(t,e){const i=this.Vo;if(!i)return{$pageview_id:e};let n={$pageview_id:e,$prev_pageview_id:i.pageViewId};const s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:t,lastScrollY:e,maxScrollY:i,maxContentHeight:r,lastContentY:o,maxContentY:a}=s;if(!(Ie(t)||Ie(e)||Ie(i)||Ie(r)||Ie(o)||Ie(a))){t=Math.ceil(t),e=Math.ceil(e),i=Math.ceil(i),r=Math.ceil(r),o=Math.ceil(o),a=Math.ceil(a);const s=t>1?Qe(e/t,0,1,Gs):1,l=t>1?Qe(i/t,0,1,Gs):1,u=r>1?Qe(o/r,0,1,Gs):1,h=r>1?Qe(a/r,0,1,Gs):1;n=Ks(n,{$prev_pageview_last_scroll:e,$prev_pageview_last_scroll_percentage:s,$prev_pageview_max_scroll:i,$prev_pageview_max_scroll_percentage:l,$prev_pageview_last_content:o,$prev_pageview_last_content_percentage:u,$prev_pageview_max_content:a,$prev_pageview_max_content_percentage:h})}}return i.pathname&&(n.$prev_pageview_pathname=i.pathname),i.timestamp&&(n.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),n}};const M_=["flags","surveys"],E_={[v]:{exposure:"hidden"},[m]:{exposure:"hidden"},[y]:{exposure:"hidden"},[S]:{exposure:"hidden"},[_]:{exposure:"hidden"},[k]:{exposure:"hidden"},[x]:{exposure:"event"},[C]:{exposure:"hidden"},[A]:{exposure:"hidden"},[T]:{exposure:"event"},[I]:{exposure:"hidden"},[M]:{exposure:"event"},[E]:{exposure:"event"},[P]:{exposure:"event"},[R]:{exposure:"hidden"},[F]:{exposure:"event"},[O]:{exposure:"hidden"},[D]:{exposure:"hidden"},[H]:{exposure:"hidden"},[z]:{exposure:"event"},[L]:{exposure:"event",shouldSkipFromEventProperties:t=>Pe(t)},[U]:{exposure:"event"},[W]:{exposure:"event"},[V]:{exposure:"event"},[J]:{exposure:"event"},[K]:{exposure:"hidden"},[X]:{exposure:"hidden",storageGroup:"flags"},[Y]:{exposure:"hidden",storageGroup:"flags"},[tt]:{exposure:"hidden"},[et]:{exposure:"hidden",storageGroup:"flags"},[it]:{exposure:"hidden",storageGroup:"flags"},[nt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[st]:{exposure:"hidden",storageGroup:"flags"},[rt]:{exposure:"hidden"},[ot]:{exposure:"hidden"},[at]:{exposure:"hidden"},[lt]:{exposure:"hidden"},[ht]:{exposure:"hidden",storageGroup:"surveys"},[ct]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[dt]:{exposure:"event"},[vt]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[pt]:{exposure:"hidden"},[gt]:{exposure:"hidden"},[mt]:{exposure:"hidden"},[yt]:{exposure:"event"},[bt]:{exposure:"event"},[_t]:{exposure:"event"},[wt]:{exposure:"event"},[kt]:{exposure:"hidden"},[St]:{exposure:"hidden"},[ut]:{exposure:"event"},[xt]:{exposure:"hidden"},[Ct]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[$t]:{exposure:"hidden"},[Tt]:{exposure:"hidden"},[It]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},[Et]:{exposure:"hidden"},[Pt]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[N]:{exposure:"event"},[q]:{exposure:"event"},[j]:{exposure:"event"},[B]:{exposure:"event"},[Ot]:{exposure:"event"},[Dt]:{exposure:"event"},[Lt]:{exposure:"event"},[Nt]:{exposure:"event"},[qt]:{exposure:"event"},[jt]:{exposure:"event"},[Bt]:{exposure:"event"},[Ht]:{exposure:"event"},[zt]:{exposure:"event"},[Ut]:{exposure:"event"},[Wt]:{exposure:"event"},[Zt]:{exposure:"event"}},P_=[[G,{exposure:"hidden"}],[Z,{exposure:"hidden"}],[Q,{exposure:"hidden"}]],R_=t=>{const e=E_[t];if(e)return e;for(const[e,i]of P_)if(0===t.indexOf(e))return i},A_={flags:Ct,surveys:ct},F_=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],O_=t=>`${t}_cookie_identity_change_pending`,D_=t=>{let e="",i=0;for(const n of t){const t=encodeURIComponent(JSON.stringify(n).slice(1,-1)).length;if(i+t>1e3)break;e+=n,i+=t}return e},L_="main",N_=[X,Y,et,it,nt,Ct,st,at],q_=t=>-1!==N_.indexOf(t),j_=[_,k],B_=t=>-1!==j_.indexOf(t),H_=(t,e)=>{try{return JSON.stringify(t)===JSON.stringify(e)}catch(i){return t===e}},z_=t=>{if(!t)return{};const e=JSON.parse(t);return $e(e)?e:{}},U_=(t,e)=>{Js(t,(i,n)=>{const s=R_(n);s&&"event"!==s.exposure||{}.hasOwnProperty.call(e,n)||delete t[n]})};var W_=class{constructor(e,i,n=!0){if(this.Jo={},this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=new Map,this.na=!1,this.sa=!1,this.ra=!1,this.oa=new Set,this.aa=new Set,this.Rr=e,this.la=n,this.props={},this.ua=void 0,this.ha=(t=>{let e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(e),this.qo=this.ca(e),this.Yo=this.da(e),this.load(),this.va(),e.debug&&Gs.info("Persistence loaded",e.persistence,he({},this.props)),this.update_config(e,e,i),this.save(),t){const e=()=>this.flush();sr(t,"beforeunload",e,{capture:!1}),sr(t,"pagehide",e,{capture:!1}),this.fa=e=>{if(this.Ko&&(!e.storageArea||e.storageArea===(null==t?void 0:t.localStorage))&&e.key)if(e.key!==this.ha){if(this.Yo){const t=M_.find(t=>e.key===this.pa(t));t&&this.ga(e.key,t)}}else this.ga(e.key,L_)},sr(t,"storage",this.fa)}}markCrossTabFeatureFlagChanges(t){Object.entries(t).forEach(([t,e])=>{const i=this.ia.get(t);if(!q_(t)||!0===i)return;if(!0===e)return void this.ma(t,!0);const n=new Set(i||[]);e.forEach(t=>n.add(t)),n.size&&this.ma(t,n)})}onCrossTabFeatureFlagChange(t){return this.aa.add(t),()=>this.aa.delete(t)}destroy(){this.fa&&t&&(t.removeEventListener("storage",this.fa),this.fa=void 0),this.aa.clear()}ga(t,e,i=!0){if(this.mi)return!1;let n,s;try{if(s=Na.Ot(t),Pe(s)){const t=this.ya(e);return t.storageValue=null,e!==L_&&(t.persisted=!1),!1}n=z_(s)}catch(t){return!1}const r=e===L_?n:Na.Dt(this.ha);if(r&&this.ba(r))return!1;const o=this._a(n,e,i);return e===L_&&this.Yo&&!H_(this.wa().main,n)||this.ka(n,e,!0,s),o}ba(t){const e=this.props[f],i=t[f];return!Ie(e)&&!Ie(i)&&e!==i}ka(t,e,i,n){const s=this.ya(e);s.storageValue=n,e!==L_&&(s.persisted=i);try{s.fingerprint=this.Sa(t,e)}catch(t){s.fingerprint=void 0}}_a(t,e,i){let n=!1;return N_.forEach(i=>{var s;const r=null===(s=R_(i))||void 0===s?void 0:s.storageGroup;if(e===L_&&this.Yo&&r||e!==L_&&r!==e)return;const o=i in t,a=this.xa(i,o?t[i]:void 0),l=this.ia.has(i)?i in this.props:o;l===i in this.props&&H_(a,this.props[i])||(l?this.Ca(i,a,!1):this.$a(i,!1),n=!0)}),n&&i&&this.aa.forEach(t=>t()),n}Ta(){if(!this.Ko)return!1;try{this.ra=!1;const t=Na.Ot(this.ha),e=this.ya(L_);let i,n=!1,s=!1;if(t!==e.storageValue)if(Pe(t))e.storageValue=null;else{if(i=z_(t),this.ra=!this.sa&&this.ba(i),this.ra)return!1;s=this._a(i,L_,!1),!this.Yo||H_(this.wa().main,i)?this.ka(i,L_,!0,t):e.storageValue=t,n=!0}return this.Yo&&M_.forEach(t=>{const e=Na.Ot(this.pa(t)),r=this.ya(t),o=i||{},a=n&&N_.some(e=>{var i;return(null===(i=R_(e))||void 0===i?void 0:i.storageGroup)===t&&e in o});if(e===r.storageValue&&!a)return;if(Pe(e))return r.storageValue=null,r.persisted=!1,void(a&&(s=this._a(o,t,!1)||s));const l=z_(e);s=this._a(l,t,!1)||s,this.ka(l,t,!0,e)}),s}catch(t){return!1}}ma(t,e){this.ia.set(t,e);const i=R_(t);(null==i?void 0:i.volatile)||(this.ya((this.Yo?null==i?void 0:i.storageGroup:void 0)||L_).fingerprint=void 0,this.Ia(t))}Ma(){N_.forEach(t=>this.ia.set(t,!0))}va(){if(this.Ko)try{const t=Na.Ot(this.ha),e=z_(t);this.ya(L_).storageValue=t,N_.forEach(t=>{var i;const n=this.Yo?null===(i=R_(t))||void 0===i?void 0:i.storageGroup:void 0,s=n?Na.Ot(this.pa(n)):null;if(n){const t=this.ya(n);t.storageValue=s,t.persisted=!Pe(s)}const r=n&&!Pe(s)?z_(s):e;t in this.props?this.Ea(t,r[t],this.props[t]):t in r&&this.ma(t,!0)})}catch(t){}}xa(t,e){const i=this.ia.get(t);if(!i)return e;if(!0===i)return this.props[t];if("$active_feature_flags"===t){const n=new Set(xe(e)?e:[]),s=new Set(xe(this.props[t])?this.props[t]:[]);return i.forEach(t=>s.has(t)?n.add(t):n.delete(t)),Array.from(n)}const n=$e(e)?he({},e):{},s=$e(this.props[t])?this.props[t]:{};return i.forEach(t=>{t in s?n[t]=s[t]:delete n[t]}),n}Ea(t,e,i){if(!q_(t))return;const n=this.ia.get(t);if(!0===n)return;let s=e;if(this.Ko)try{var r;const e=this.Yo?null===(r=R_(t))||void 0===r?void 0:r.storageGroup:void 0,i=e?this.pa(e):this.ha;s=z_(Na.Ot(i))[t]}catch(t){}const o=new Set(n||[]);if("$active_feature_flags"===t){if(!Ie(e)&&!xe(e)||!Ie(s)&&!xe(s)||!xe(i))return void this.ma(t,!0);const n=new Set(e||[]),r=new Set(s||[]),a=new Set(i);new Set([...n,...a]).forEach(t=>{n.has(t)!==a.has(t)&&o.add(t)}),o.forEach(t=>{r.has(t)===a.has(t)&&o.delete(t)})}else{if(!$e(i))return void(H_(s,i)?this.ia.delete(t):this.ma(t,!0));{if(!Ie(e)&&!$e(e)||Ie(e)&&Te(i)&&Ie(s))return void this.ma(t,!0);const n=$e(e)?e:{},r=$e(s)?s:{};new Set([...Object.keys(n),...Object.keys(i)]).forEach(t=>{t in n==t in i&&H_(n[t],i[t])||o.add(t)}),o.forEach(t=>{t in r==t in i&&H_(r[t],i[t])&&o.delete(t)})}}o.size?this.ma(t,o):this.ia.delete(t)}Pa(){var t;const e=null===(t=this.Rr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Ae(e)&&e>0?e:0}Ra(t){if(this.Rr.cookieWinsOnConflict&&"localstorage+cookie"===this.Rr.persistence.toLowerCase())if(t)try{const e=Ua(t,this.Rr.cookie_persisted_properties||[]),i=Va(e,this.Rr.cookie_persisted_properties||[]),n=JSON.stringify(e)+"|"+JSON.stringify(i),s=Da.Ot(this.ha)||void 0;s&&Za(this.ha,s)===n&&(this.Aa=n,this.Fa=s)}catch(t){}else try{const t=Da.Ot(this.ha)||void 0;this.Aa=t?Za(this.ha,t):void 0,this.Fa=t}catch(t){}}syncCookieProperties(){return this.Oa(this.Rr)}Oa(t,e=!1){if(this.mi&&!e||this.ea||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;let i;try{i=Da.Ot(this.ha)||void 0}catch(t){}if(!i||i===this.Fa)return!1;const n=Za(this.ha,i);let s;try{s=za(JSON.parse(i))}catch(t){return!1}if((Da.Ot(this.ha)||void 0)!==i)return!1;this.Aa=n,this.Fa=i;const r=Ga(this.ha,i),o=[...ja,...r.properties],a={};if(Object.keys(s).forEach(t=>{const e=s[t];(Ie(e)||Pe(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e)&&(a[t]=!0,delete s[t])}),Te(s))return!1;const l="distinct_id"in s||"anonymous"===s.$user_state||"identified"===s.$user_state,u=this.props,h=u[f],c=u[$t],d=Ks({},u);[...ja,...t.cookie_persisted_properties||[]].forEach(t=>{if(-1!==o.indexOf(t)&&!(t in s)&&!a[t]&&(l||"distinct_id"!==t&&"$user_state"!==t)){const e=d[t];(r.isValid||-1===ja.indexOf(t)||!1!==e&&0!==e)&&delete d[t]}}),this.props=Ks(d,s),N_.forEach(t=>{const e=t in this.props;t in u===e&&H_(u[t],this.props[t])||(e?this.Ea(t,u[t],this.props[t]):this.ma(t,!0))}),!l||"$user_state"in s||"$user_state"in this.props||this.Ca($t,Jt);const v=this.props[f],p=this.props[$t];return!l||v===h&&p===c||(this.sa=!0,this.ta=!0,Xa.At(O_(this.ha),!0),this.$a(at),this.$a(Y),this.$a(X),this.$a(et),this.$a(it),this.$a(nt),this.$a(Ct),this.$a(xt),this.$a(kt),"anonymous"!==p||"identified"!==c&&"anonymous"!==s.$user_state&&(Ie(h)||v===h)||(U_(this.props,s),this.$a(lt)),"identified"===p?this.props.$user_id=v:delete this.props.$user_id,this.$a(m)),!0}consumeCookieIdentityChange(){const t=O_(this.ha),e=this.ta||!!Xa.Ot(t);return this.ta=!1,e&&Xa.Lt(t),e}Da(t=!1){return!(this.ea||this.mi&&!t||!this.Rr.cookieWinsOnConflict||"localstorage+cookie"!==this.Rr.persistence.toLowerCase()||(this.ea=!0,0))}La(){this.ea&&(Ie(this.Na)||(clearTimeout(this.Na),this.Na=void 0),delete this.Jo[L_],this.qa(!0))}ja(t=!0){if(this.ea)try{t?this.La():Ie(this.Na)||(clearTimeout(this.Na),this.Na=void 0)}finally{this.ea=!1}}isDisabled(){return!!this.mi}ca(e){-1===F_.indexOf(e.persistence.toLowerCase())&&(Gs.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const i=((e=[],i=!1)=>{const n=[...ja,...e];return he(he({},Na),{},{Dt(t){try{let s,r={};try{s=Da.Ot(t)||void 0,r=s?za(JSON.parse(s)):{}}catch(t){}const o=JSON.parse(Na.Ot(t)||"{}");let a;if(i){const i=Ga(t,s),l=[...ja,...i.properties],u={};Object.keys(r).forEach(t=>{const e=r[t];Pe(e)||""===e||"$user_state"===t&&"anonymous"!==e&&"identified"!==e||(u[t]=e)});const h="distinct_id"in u||"anonymous"===u.$user_state||"identified"===u.$user_state;if(Object.keys(u).length>0){var e;const t=o[f],s=null!==(e=o.$user_state)&&void 0!==e?e:Jt;n.forEach(t=>{if(-1!==l.indexOf(t)&&!(t in r)&&(h||"distinct_id"!==t&&"$user_state"!==t)){const e=o[t];(i.isValid||-1===ja.indexOf(t)||!1!==e&&0!==e)&&delete o[t]}}),!h||"$user_state"in r||"$user_state"in o||(o[$t]=Jt),!h||("distinct_id"in u?u[f]:o[f])===t&&("$user_state"in u?u[$t]:o[$t])===s||(qa.forEach(t=>delete o[t]),"identified"===u.$user_state&&"distinct_id"in u?o.$user_id=u[f]:delete o.$user_id,"identified"!==u.$user_state&&(delete o[ut],delete o[lt]),delete o.__alias)}a=Ks(o,u)}else a=Ks(r,o);return Na.At(t,a),a}catch(t){}return null},At(t,n,s,r,o,a){const l=Na.At(t,n,void 0,void 0,a);try{const u=Ua(n,e);if(Object.keys(u).length){if(i){const i=Ba(t),h=Va(u,e);if(Da.At(i,h,s,r,o,a),Da.Ot(i)!==JSON.stringify(h)){Da.Lt(i,r);const e=Ua(n);return Da.At(t,e,s,r,o,a),l}}Da.At(t,u,s,r,o,a)}}catch(t){Na.Pt(t)}return l},Lt(e,i){try{null==t||t.localStorage.removeItem(e),Da.Lt(e,i),Da.Lt(Ba(e),i)}catch(t){Na.Pt(t)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let n,s=!1,r=!1;const o=e.persistence.toLowerCase();return"localstorage"===o&&Na.Et()?(n=Na,r=!0):"localstorage+cookie"===o&&i.Et()?(n=i,r=!0,s=!0):"sessionstorage"===o&&Xa.Et()?n=Xa:"memory"===o?n=Ja:"cookie"===o&&Da.Et()?(n=Da,s=!0):i.Et()?(n=i,r=!0,s=!0):Da.Et()?(n=Da,s=!0):n=Ja,this.Ko=r,this.Xo=s,n}pa(t){return`${this.ha}__${t}`}da(t){return this.Ko&&!!t.split_storage}properties(){const t={};return Js(this.props,(e,i)=>{const n=R_(i);if(!n||"event"===n.exposure){var s;if(null==n||null===(s=n.shouldSkipFromEventProperties)||void 0===s?void 0:s.call(n,e))return;t[i]=e}}),t}load(t=!1){if(this.mi&&!t)return;const e=this.Rr.cookieWinsOnConflict&&"localstorage+cookie"===this.Rr.persistence.toLowerCase(),i=e?Na.Dt(this.ha):null;let n={};if(e)try{n=za(Da.Dt(this.ha)),Js(n,(t,e)=>{(Ie(t)||Pe(t)||""===t)&&delete n[e]})}catch(t){}const s=this.qo.Dt(this.ha);if(s&&(this.props=Ks({},s)),this.Yo&&this.Ba(),e&&s){var r,o;const t=null==i?void 0:i[f],e=null!==(r=null==i?void 0:i.$user_state)&&void 0!==r?r:Jt,a=s[f],l=null!==(o=s.$user_state)&&void 0!==o?o:Jt;if(a!==t||l!==e){this.ta=!0,Xa.At(O_(this.ha),!0);const i=Ks({},this.props);qa.forEach(t=>delete i[t]),"anonymous"!==l||"identified"!==e&&"anonymous"!==n.$user_state&&(Ie(t)||a===t)||(U_(i,n),delete i[lt]),this.props=i;const s=new Set;qa.forEach(t=>{var e;const i=null===(e=R_(t))||void 0===e?void 0:e.storageGroup;i&&s.add(i)}),s.forEach(t=>{const e={};Js(this.props,(i,n)=>{var s;(null===(s=R_(n))||void 0===s?void 0:s.storageGroup)===t&&(e[n]=i)}),Te(e)?(Na.Lt(this.pa(t)),this.Jo[t]={}):Na.At(this.pa(t),e)&&(this.Jo[t]={persisted:!0,fingerprint:this.Sa(e,t)})})}}Xa.Ot(O_(this.ha))&&(this.ta=!0)}Ba(){for(const t of M_){const e=Na.Dt(this.pa(t));if(e&&!Te(e)){const i=this.ya(t);i.persisted=!0,this.Ha(t)||(i.fingerprint=this.Sa(e,t)),this.za(t,e)||Ks(this.props,e)}}}Ha(t){return Object.keys(this.props).some(e=>{var i;return(null===(i=R_(e))||void 0===i?void 0:i.storageGroup)===t})}za(t,e){const i=A_[t];if(!i)return!1;const n=e[i],s=this.props[i];return Ae(n)&&Ae(s)&&s>n}refreshKey(t){var e;if(this.mi)return;if(this.oa.has(t))return;const i=this.Yo?null===(e=R_(t))||void 0===e?void 0:e.storageGroup:void 0,n=i?Na.Dt(this.pa(i)):this.qo.Dt(this.ha);if(n&&t in n)this.Ca(t,n[t],!1);else{if(i){const e=this.qo.Dt(this.ha);if(e&&t in e)return void this.Ca(t,e[t],!1)}this.$a(t,!1)}}save(){if(this.mi)return;const t=this.Pa();t>0?Ie(this.Na)&&(this.Na=setTimeout(()=>{this.Na=void 0,this.qa()},t)):this.qa()}flush(){Ie(this.Na)||(clearTimeout(this.Na),this.Na=void 0,this.qa())}qa(t=!1){if(this.mi||this.ea&&!t)return;t||(this.syncCookieProperties(),this.Rr.cookieWinsOnConflict&&"localstorage+cookie"===this.Rr.persistence.toLowerCase()||j_.forEach(t=>this.refreshKey(t)));const e=!t&&!this.na;e||(this.ra=!1);const i=!!e&&this.Ta();if(this.ra)return void(this.Rr.debug&&Gs.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Yo)return this.Ua(),void(i&&this.aa.forEach(t=>t()));const n=this.Wa(this.qo,this.ha,this.props,L_);"written"===n&&this.Ra(this.props),"failed"!==n&&(this.ia.clear(),this.sa=!1,this.oa.clear()),i&&this.aa.forEach(t=>t())}Ua(){const{main:t,groups:e}=this.wa(),i=this.Wa(this.qo,this.ha,t,L_);"written"===i&&this.Ra(t),"failed"!==i&&(this.sa=!1,this.oa.clear(),N_.forEach(t=>{var e;(null===(e=R_(t))||void 0===e?void 0:e.storageGroup)||this.ia.delete(t)}));for(const t of M_){var n;const i=e[t];if(Te(i)&&!(null===(n=this.Jo[t])||void 0===n?void 0:n.persisted)){N_.forEach(e=>{var i;(null===(i=R_(e))||void 0===i?void 0:i.storageGroup)===t&&this.ia.delete(e)});continue}const s=this.Wa(Na,this.pa(t),i,t);"failed"!==s&&N_.forEach(e=>{const i=R_(e);(null==i?void 0:i.storageGroup)!==t||"written"!==s&&i.volatile||this.ia.delete(e)})}}wa(){const t={},e={flags:{},surveys:{}};return Js(this.props,(i,n)=>{var s;const r=null===(s=R_(n))||void 0===s?void 0:s.storageGroup;r?e[r][n]=i:t[n]=i}),{main:t,groups:e}}Sa(t,e){if(e===L_)return JSON.stringify(t)+"|"+this.Va+"|"+this.Ga+"|"+this.Za;const i={};return Js(t,(t,e)=>{var n;i[e]=(null===(n=R_(e))||void 0===n?void 0:n.volatile)?"__volatile__":t}),JSON.stringify(i)}Wa(t,e,i,n){const s=this.ya(n);if(n!==L_&&!s.dirty&&!Ie(s.fingerprint))return"skipped";let r;try{if(r=this.Sa(i,n),r===s.fingerprint)return s.dirty=!1,"skipped"}catch(t){r=void 0}return t.At(e,i,this.Va,this.Ga,this.Za,this.Rr.debug)?(s.dirty=!1,n!==L_&&(s.persisted=!0),Ie(r)||(s.fingerprint=r),this.Ko&&(s.storageValue=Na.Ot(e)),"written"):(this.Rr.debug&&Gs.warn(`failed to persist storage entry "${e}"; will retry on next save`),"failed")}remove({keepGroupEntries:t=!1}={}){if(this.Ma(),Ie(this.Na)||(clearTimeout(this.Na),this.Na=void 0),this.qo.Lt(this.ha,!1),this.qo.Lt(this.ha,!0),!t&&this.la)for(const t of M_)Na.Lt(this.pa(t));t?delete this.Jo[L_]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(t,e,i){if($e(t)){this.syncCookieProperties(),Ie(e)&&(e="None"),this.Va=Ie(i)?this.Qa:i;let n=!1;if(Js(t,(t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Ca(i,t),n=!0)}),n)return this.save(),!0}return!1}register(t,e){if($e(t)){this.syncCookieProperties(),this.Va=Ie(e)?this.Qa:e;let i=!1;if(Js(t,(e,n)=>{t.hasOwnProperty(n)&&(this.props[n]!==e||$e(e)||xe(e))&&(this.Ca(n,e),i=!0)}),i)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();const e="string"==typeof t?[t]:t;let i=!1;for(const t of e)t in this.props&&(this.$a(t),i=!0);i&&this.save()}update_campaign_params(){const t=null==n?void 0:n.URL;if(t===this.ua)return;const e=Pl(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),i=!Te(tr(e));return i&&this.register(e),this.ua=t,i?e:void 0}update_search_keyword(){this.register(function(){const t=null==n?void 0:n.referrer;return t?Al(t):{}}())}update_referrer_info(){var t;this.register_once({$referrer:Ll(),$referring_domain:(null==n?void 0:n.referrer)&&(null===(t=lr(n.referrer))||void 0===t?void 0:t.host)||Dl},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const t=Nl(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[Pt]:this.Xo?{r:D_(t.r),u:t.u?D_(t.u):void 0}:t},void 0)}get_initial_props(){const t={};Js([Et,Mt],e=>{const i=this.props[e];i&&Js(i,function(e,i){t["$initial_"+be(i)]=e})});const e=this.props[Pt];if(e){const i=function(t,e=!1){const i=ql(t,e),n={};return Js(i,function(t,e){n[`$initial_${be(e)}`]=t}),n}(e,this.Rr.disable_capture_url_hashes);Ks(t,i)}return t}safe_merge(t){return Js(this.props,function(e,i){i in t||(t[i]=e)}),t}update_config(t,e,i){const n=t.persistence!==e.persistence,s=!((t,e)=>{if(t.length!==e.length)return!1;const i=[...t].sort(),n=[...e].sort();return i.every((t,e)=>t===n[e])})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[]),r=n||s,o=t.cookieWinsOnConflict!==e.cookieWinsOnConflict,a=t.disable_persistence||!!i,l=!!this.mi&&!a;a||this.Oa(e,l),this.Rr=t,!a&&(n||s||o)&&(this.Aa=void 0,this.Fa=void 0,this.Oa(he(he({},t),{},{cookie_persisted_properties:e.cookie_persisted_properties}),l));const u=r||o?this.ca(t):this.qo;this.Ja();const h=this.da(t),c=r||h!==this.Yo,d=!a&&(c||t.cross_subdomain_cookie!==this.Ga||t.secure_cookie!==this.Za)&&this.Da(l);this.na=c;try{if(this.Qa=this.Va=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),c){const t=this.props;this.clear(),this.qo=u,this.Yo=h,this.props=t,this.save()}else o&&(this.qo=u,a||(delete this.Jo[L_],this.qa()))}finally{this.na=!1,d&&this.ja()}}Ja(){const t=this.props[Pt];if(!this.Xo||!$e(t)||"string"!=typeof t.r)return;const e=D_(t.r),i="string"==typeof t.u?D_(t.u):t.u;e===t.r&&i===t.u||this.Ca(Pt,he(he({},t),{},{r:e,u:i}))}set_disabled(t){this.mi=t,this.mi?this.remove():this.save()}set_cross_subdomain(t){t!==this.Ga&&(this.Ga=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.Za&&(this.Za=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){const i=this.props.__timers||{};i[t]=e,this.Ca(S,i),this.save()}remove_event_timer(t){const e=this.props.__timers||{},i=e[t];return Ie(i)||(delete e[t],this.Ca(S,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Ca(t,e),this.save()}Ca(t,e,i=!0){var n;const s=this.props[t];this.props[t]=e,i&&("distinct_id"!==t&&"$user_state"!==t||s===e||(this.sa=!0),B_(t)&&!H_(s,e)&&this.oa.add(t),this.Ea(t,s,e),(null===(n=R_(t))||void 0===n?void 0:n.volatile)||this.Ia(t))}$a(t,e=!0){delete this.props[t],e&&(q_(t)&&this.ma(t,!0),B_(t)&&this.oa.add(t),this.Ia(t))}Ia(t){var e;const i=null===(e=R_(t))||void 0===e?void 0:e.storageGroup;i&&(this.ya(i).dirty=!0)}ya(t){return this.Jo[t]||(this.Jo[t]={})}};const V_=Zs("[RateLimiter]");var G_=class{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach(t=>{V_.info(`${t||"events"} is quota limited.`),this.serverLimits[t]=(new Date).getTime()+6e4})}catch(t){return void V_.warn(`could not rate limit - continuing. Error: "${null==t?void 0:t.message}"`,{text:e})}},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 e,i,n;const{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,o=(new Date).getTime(),a=null!==(e=null===(i=this.instance.persistence)||void 0===i?void 0:i.get_property("$capture_rate_limit"))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*r,a.last=o,a.tokens>s&&(a.tokens=s);const l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){const t=(Ae(a.dropped)?a.dropped:0)+1;a.dropped=t,!this.lastEventRateLimited&&this.Ka(t)&&(a.dropped=0)}return this.lastEventRateLimited=l,null===(n=this.instance.persistence)||void 0===n||n.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Xa(t){const e=this.instance.config.property_denylist;return!xe(e)||!e.includes(t)}Ya(){var t;if(this.Xa("$current_url")&&this.Xa("$pathname")&&(null==s?void 0:s.pathname))return`${null!==(t=s.origin)&&void 0!==t?t:""}${s.pathname}`}Ka(t){var e,i;const{captureEventsBurstLimit:n,captureEventsPerSecond:s}=this,r=this.Ya(),o=this.Xa("$session_id")?null===(e=(i=this.instance).get_session_id)||void 0===e?void 0:e.call(i):void 0,a=[`${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: ${a}. Config is set to ${s} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(t){const e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}};const Z_=Zs("[RemoteConfig]");var Q_=class{constructor(t){this._instance=t}get remoteConfig(){var t;return null===(t=d._POSTHOG_REMOTE_CONFIG)||void 0===t||null===(t=t[this._instance.config.token])||void 0===t?void 0:t.config}tl(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.loadExternalDependency)?null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"remote-config",()=>t(this.remoteConfig)):t()}el(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 Z_.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void Z_.warn("Remote config is disabled. Falling back to local config.");this.tl(t=>{if(!t)return Z_.info("No config found after loading remote JS config. Falling back to JSON."),void this.el(t=>{this.il(t.json,t)});this.il(t)})}catch(t){Z_.error("Error loading remote config",t),this.il()}}il(t,e){!t&&e&&(0===e.statusCode?e.error||Z_.warn("Failed to fetch remote config from PostHog."):Z_.error("Failed to fetch remote config from PostHog."));try{this._instance.il(t?{ok:!0,config:t}:{ok:!1})}catch(t){Z_.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 i;null===(i=this._instance.featureFlags)||void 0===i||i.ensureFlagsLoaded()}catch(t){Z_.error("Error loading feature flags",t)}}};const J_=!!o||!!r,K_=new WeakMap,X_="text/plain";let Y_=0,tw=!1;const ew=(t,e)=>{const[i,n]=t.split("#"),[s,r]=i.split("?");if(!r)return t;const o=r.split("&").filter(t=>t.split("=")[0]!==e).join("&");return`${s}${o?`?${o}`:""}${n?`#${n}`:""}`},iw=(t,e,i=!0)=>{var n;const[s,r]=t.split("?"),o=he({},e),a=null!==(n=null==r?void 0:r.split("&").map(t=>{var e;const[n,s]=t.split("="),r=i&&null!==(e=o[n])&&void 0!==e?e:s;return delete o[n],`${n}=${r}`}))&&void 0!==n?n:[],l=ur(o);return l&&a.push(l),a.length>0?`${s}?${a.join("&")}`:s},nw=t=>{if(t.sl)return t.sl;const{data:e,compression:i}=t;if(!e)return;if(i===wp){const t=wa(ka(ar(e)),{mtime:0});return{contentType:X_,body:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength),estimatedSize:t.byteLength}}if(i===kp){const t=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(t,e)=>String.fromCharCode(parseInt(e,16)))):t}(ar(e)),i=(t=>"data="+encodeURIComponent("string"==typeof t?t:ar(t)))(t);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=ar(e);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},sw=t=>{const e=()=>"sendBeacon"===t.transport?{url:iw(t.url,{compression:kp}),encodedBody:nw(he(he({},t),{},{compression:kp,sl:void 0}))}:{url:ew(t.url,"compression"),encodedBody:nw(he(he({},t),{},{compression:void 0,sl:void 0}))};let i;try{i=nw(t)}catch(i){if(hs(t.compression,hr(t.url,"compression")))return Gs.error("Failed to gzip request body, sending uncompressed payload",i),e();throw i}return i&&hs(t.compression,hr(t.url,"compression"))&&!((n=i.body)instanceof ArrayBuffer?us(new Uint8Array(n)):ArrayBuffer.isView(n)&&us(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(tw=!0,e()):{url:t.url,encodedBody:i};var n},rw=t=>{try{return sw(t)}catch(i){var e;return Gs.error(i),void(null===(e=t.callback)||void 0===e||e.call(t,{statusCode:0,error:i}))}},ow=function(){var t=oe(function*(t){const e=yield ms(ar(t.data),Ya.DEBUG,{rethrow:!0});if(!e)return t;const i=yield e.arrayBuffer();return he(he({},t),{},{sl:{contentType:X_,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),aw=/Failed to fetch|NetworkError|Load failed/i,lw=t=>"TypeError"===(null==t?void 0:t.name)&&aw.test((null==t?void 0:t.message)||""),uw=t=>{try{const e=function(t,e=Date.now()){if("string"!=typeof t||!t)return;const i=t.trim(),n=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(n)){const t=1e3*Math.min(Number(n),300);return t>0?t:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const s=/^\w{3} \w{3} /.test(n)?n+" GMT":n,r=Date.parse(s)-e;return Number.isFinite(r)&&r>0?Math.min(r,rn):void 0}(t());return Ie(e)?void 0:Math.min(e,3e4)}catch(t){return}},hw=t=>{const e=rw(t);if(!e)return;const i=new o;K_.set(i,!0);const{url:n,encodedBody:s}=e;i.open(t.method||"GET",n,!0);const{contentType:r,body:a}=null!=s?s:{};Js(t.headers,function(t,e){i.setRequestHeader(e,t)}),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var e;const n={statusCode:i.status,text:i.responseText};if(200===i.status)try{n.json=JSON.parse(i.responseText)}catch(t){}null===(e=t.callback)||void 0===e||e.call(t,n,uw(()=>i.getResponseHeader("Retry-After")))}},i.send(a)},cw=t=>{const e=rw(t);if(!e)return;const{url:i,encodedBody:n}=e,{contentType:s,body:o,estimatedSize:l}=null!=n?n:{},u=new Headers;Js(t.headers,function(t,e){u.append(e,t)}),s&&u.append("Content-Type",s);let h=null,c=!1;if(a){const e=new a;h={signal:e.signal,timeout:setTimeout(()=>{c=!0;try{e.abort(un("AbortError","PostHog request timed out"+((i=t.timeout)?` after ${i}ms`:"")))}catch(t){v(t)}var i},t.timeout)}}let d=!1;const v=e=>{var i;d||(d=!0,c&&"AbortError"===(null==e?void 0:e.name)||lw(e)?Gs.warn(e):Gs.error(e),null===(i=t.callback)||void 0===i||i.call(t,{statusCode:0,error:e}))};let f=0;const p=()=>{Y_-=f,f=0,h&&clearTimeout(h.timeout)};try{const e=he({method:(null==t?void 0:t.method)||"GET",headers:u,referrerPolicy:"strict-origin",body:o,signal:null==h?void 0:h.signal},t.fetchOptions),n=null!=l?l:Ie(o)?0:void 0;e.keepalive="POST"===e.method&&!t.rl&&!1!==e.keepalive&&e.body===o&&!Ie(n)&&n>=0&&52428.8>Y_+n,e.keepalive&&(f=n,Y_+=f),r(i,e).then(e=>e.text().then(i=>{var n;if(d)return;const s={statusCode:e.status,text:i};if(200===e.status)try{s.json=JSON.parse(i)}catch(t){Gs.error(t)}d=!0,p(),null===(n=t.callback)||void 0===n||n.call(t,s,uw(()=>e.headers.get("Retry-After")))})).catch(t=>{p(),v(t)}).finally(p)}catch(t){p(),v(t)}},dw=t=>{try{var e;const{url:n,encodedBody:s}=sw(t),{contentType:o,body:a,estimatedSize:l}=null!=s?s:{};if(!a)return;const u=a instanceof Blob?a:new Blob([a],{type:o});if(i.sendBeacon(n,u))return;const h=xe(t.data)?t.data:null===(e=t.data)||void 0===e?void 0:e.batch;if(xe(h)&&h.length>1&&(null!=l?l:0)>16384){const e=Math.ceil(h.length/2),i=e=>xe(t.data)?e:he(he({},t.data),{},{batch:e});return dw(he(he({},t),{},{data:i(h.slice(0,e))})),void dw(he(he({},t),{},{data:i(h.slice(e))}))}Gs.warn(`Beacon of ~${null!=l?l:0} bytes was rejected by the browser, falling back to ${r?"fetch":"XHR"}`),r?cw(he(he({},t),{},{rl:!0})):hw(t)}catch(t){Gs.warn("Beacon send failed",t)}},vw=(t,e,i,n)=>{const s="query"===n?"POST"===e?"sent_at":"_":void 0;return iw(i===wp?ew(t,"compression"):t,he(he({},s?{[s]:Date.now().toString()}:{}),i===wp?{}:{compression:i}))},fw=(()=>{const t=[];return r&&t.push({transport:"fetch",method:cw}),o&&t.push({transport:"XHR",method:hw}),(null==i?void 0:i.sendBeacon)&&t.push({transport:"sendBeacon",method:dw}),t})();let pw=!J_&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla"));function gw(t,e,i){var n,s,r;i&&(e=he(he({},e),{},{callback:t=>i(t)})),t.__loaded?pw?t.__request_queue.push(e):t.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null===(s=e.callback)||void 0===s||s.call(e,{statusCode:429})):(e.transport=e.transport||t.config.api_transport,e.headers=he(he({},t.config.request_headers),e.headers),e.compression="best-available"===e.compression?null!==(n=t.compression)&&void 0!==n?n:e.compressionFallback:e.compression,(Ie(t.config.disable_beacon)?t.config.__preview_disable_beacon:t.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||t.config.fetch_options,((t,e)=>{var i,n,s;const r=he(he({},t),{},{callback:null!=e?e:e=>{var i;return null===(i=t.callback)||void 0===i?void 0:i.call(t,e)}});r.timeout=r.timeout||6e4;const o=null!==(i=r.transport)&&void 0!==i?i:"fetch";"sendBeacon"===o&&Ie(r.compression)&&r.data&&(r.compression=kp),"POST"===r.method&&r.data&&("capture-body"===r.timestampMode?r.data=(t=>{var e,i;const n=(xe(t)?t:[t]).map(t=>he(he({},t),t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{})),s=n[0];return{api_key:null!==(e=null==s||null===(i=s.properties)||void 0===i?void 0:i.token)&&void 0!==e?e:null==s?void 0:s.token,batch:n,sent_at:(new Date).toISOString()}})(r.data):"body"===r.timestampMode&&(r.data=((t,e=(new Date).toISOString())=>xe(t)?t.map(t=>he(he({},t),{},{sent_at:e})):he(he({},t),{},{sent_at:e}))(r.data))),r.url=vw(r.url,r.method,r.compression,r.timestampMode);const a=fw.filter(t=>!r.disableTransport||!t.transport||!r.disableTransport.includes(t.transport)),u=null!==(n=null===(s=function(t,e){for(let i=0;t.length>i;i++)if(e(t[i]))return t[i]}(a,t=>t.transport===o))||void 0===s?void 0:s.method)&&void 0!==n?n:a[0].method;if(!u)throw new Error("No available transport method");const h=t=>{try{u(t)}catch(t){var e;lw(t)?Gs.warn(t):Gs.error(t),null===(e=r.callback)||void 0===e||e.call(r,{statusCode:0,error:t})}};"sendBeacon"!==o&&!r.preferSyncCompression&&r.data&&r.compression===wp&&l&&"undefined"!=typeof Promise&&!tw?ow(r).then(t=>{h(t)}).catch(e=>{if(cs(e))return tw=!0,void h(he(he({},r),{},{compression:void 0,url:vw(t.url,t.method,void 0,t.timestampMode)}));ds(e)&&(tw=!0),h(r)}):h(r)})(e,(n,s)=>{var r,o,a;t.rateLimiter.checkForLimiting(n),400>n.statusCode||null===(r=(o=t.config).on_request_error)||void 0===r||r.call(o,n),i?i(n,s):null===(a=e.callback)||void 0===a||a.call(e,n)})):e.fireCallbackOnDrop&&(null===(r=e.callback)||void 0===r||r.call(e,{statusCode:0}))}var mw=class{constructor(t,e){this.ol=!0,this.al=[],this.ll=Qe((null==e?void 0:e.flush_interval_ms)||3e3,250,5e3,Gs.createLogger("flush interval"),3e3),this.ul=t}enqueue(t){this.al.push(t),this.hl||this.cl()}unload(){this.dl();const t=this.al.length>0?this.vl():{},e=Object.values(t);[...e.filter(t=>0===t.url.indexOf("/e")),...e.filter(t=>0!==t.url.indexOf("/e"))].map(t=>{this.fl(t,"sendBeacon")})}enable(){this.ol=!1,this.cl()}cl(){this.ol||(this.hl=setTimeout(()=>{if(this.dl(),this.al.length>0){const t=this.vl();for(const e in t)this.fl(t[e])}},this.ll))}fl(t,e){try{this.ul(t,e)}catch(t){Gs.error(t)}}dl(){clearTimeout(this.hl),this.hl=void 0}vl(){const t={};return Js(this.al,e=>{var i;const n=e,s=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");Ie(t[s])&&(t[s]=he(he({},n),{},{data:[]})),null===(i=t[s].data)||void 0===i||i.push(n.data)}),this.al=[],t}};const yw=["retriesPerformedSoFar"];var bw=class{constructor(t){this._instance=t,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}resume(){if(!Ie(t)&&"onLine"in t.navigator){if(this.ml=t.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},sr(t,"online",this.yl),sr(t,"offline",this._l)}}get length(){return this.al.length}retriableRequest(t,e){let{retriesPerformedSoFar:i}=t,n=bs(t,yw);Fe(i)&&(n.url=iw(n.url,{retry_count:i})),gw(this._instance,e?he(he({},n),{},{transport:e}):n,(t,e)=>{var s;if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.Ls(he({retriesPerformedSoFar:i},n),e);0===t.statusCode&&Gs.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!=i?i:0} retries.`)}null===(s=n.callback)||void 0===s||s.call(n,t)})}Ls(t,e){const i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;const n=Math.max(function(t){const e=3e3*Math.pow(2,t),i=e/2,n=Math.min(18e5,e),s=(Math.random()-.5)*(n-i);return Math.ceil(n+s)}(i),null!=e?e:0),s=Date.now()+n;this.al.push({retryAt:s,requestOptions:t});let r=`Enqueued failed request for retry in ${n}`;navigator.onLine||(r+=" (Browser is offline)"),Gs.warn(r),this.pl||(this.pl=!0,this.wl())}wl(){if(this.kl&&clearTimeout(this.kl),0===this.al.length)return this.pl=!1,void(this.kl=void 0);this.kl=setTimeout(()=>{this.ml&&this.al.length>0&&this.bl(),this.wl()},this.gl)}bl(){const t=Date.now(),e=[],i=this.al.filter(i=>t>i.retryAt||(e.push(i),!1));if(this.al=e,i.length>0)for(const{requestOptions:t}of i)this.retriableRequest(t)}unload(){this.kl&&(clearTimeout(this.kl),this.kl=void 0),this.pl=!1,Ie(t)||(this.yl&&(t.removeEventListener("online",this.yl),this.yl=void 0),this._l&&(t.removeEventListener("offline",this._l),this._l=void 0));for(const{requestOptions:t}of this.al)try{this._instance._send_request(he(he({},t),{},{transport:"sendBeacon"}))}catch(t){Gs.error(t)}this.al=[]}},_w=class{constructor(t){this._instance=t,this.Sl=()=>{var t,e,i,n;this.xl||(this.xl={});const s=this.scrollElement(),r=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=r+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.xl.lastScrollY=Math.ceil(r),this.xl.maxScrollY=Math.max(r,null!==(t=this.xl.maxScrollY)&&void 0!==t?t:0),this.xl.maxScrollHeight=Math.max(o,null!==(e=this.xl.maxScrollHeight)&&void 0!==e?e:0),this.xl.lastContentY=a,this.xl.maxContentY=Math.max(a,null!==(i=this.xl.maxContentY)&&void 0!==i?i:0),this.xl.maxContentHeight=Math.max(l,null!==(n=this.xl.maxContentHeight)&&void 0!==n?n:0)}}get Cl(){return this._instance.config.scroll_root_selector}getContext(){return this.xl}resetContext(){const t=this.xl;return this.xl=void 0,setTimeout(this.Sl,0),t}startMeasuringScrollPosition(){sr(t,"scroll",this.Sl,{capture:!0}),sr(t,"scrollend",this.Sl,{capture:!0}),sr(t,"resize",this.Sl)}scrollElement(){if(this.Cl){const i=xe(this.Cl)?this.Cl:[this.Cl];for(const n of i){var e;const i=null==t||null===(e=t.document)||void 0===e?void 0:e.querySelector(n);if(i)return i}return}var i;return null==t||null===(i=t.document)||void 0===i?void 0:i.documentElement}$l(e){var i,n;const s="y"===e?"scrollTop":"scrollLeft";if(this.Cl){const t=this.scrollElement();return t&&t[s]||0}return t?"y"===e?t.scrollY||t.pageYOffset||(null===(i=t.document)||void 0===i||null===(i=i.documentElement)||void 0===i?void 0:i.scrollTop)||0:t.scrollX||t.pageXOffset||(null===(n=t.document)||void 0===n||null===(n=n.documentElement)||void 0===n?void 0:n.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}};const ww=t=>Nl(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 kw=class{constructor(t,e,i,n){this.Be=t=>{const e=this.Tl();if(e&&e.sessionId===t)return;const i={sessionId:t,props:this.Il(this._instance)};this.Ml.register({[Tt]:i})},this._instance=t,this.El=e,this.Ml=i,this.Il=n||ww,this.El.onSessionId(this.Be)}Tl(){return this.Ml.props[Tt]}getSetOnceProps(){var t;const e=null===(t=this.Tl())||void 0===t?void 0:t.props;return e?"r"in e?ql(e,this._instance.config.disable_capture_url_hashes):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){const t={};return Js(tr(this.getSetOnceProps()),(e,i)=>{"$current_url"===i&&(i="url"),t[`$session_entry_${be(i)}`]=e}),t}},Sw=class{on(t,e){return this.Pl[t]||(this.Pl[t]=[]),this.Pl[t].push(e),()=>{this.Pl[t]=this.Pl[t].filter(t=>t!==e)}}emit(t,e){for(const i of this.Pl[t]||[])i(e);for(const i of this.Pl["*"]||[])i(t,e)}constructor(){this.Pl={}}};const xw=Zs("[SessionId]"),Cw=864e5;var $w=class{on(t,e){return this.Rl.on(t,e)}constructor(t,e,i){var n;if(this.Al=null,this.Fl=null,this.Ol=[],this.Dl=void 0,this.Ll=!1,this.Rl=new Sw,this.Nl=(t,e)=>!(!Fe(t)||!Fe(e))&&Math.abs(t-e)>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.Rr=t.config,this.Ml=t.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.ql=void 0,this._sessionActivityTimestamp=null,this.jl=e||Pa,this.Bl=i||Pa;const s=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*Qe(this.Rr.session_idle_timeout_seconds||1800,60,36e3,xw.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hl(),this.zl="ph_"+s+"_window_id",this.Ul="ph_"+s+"_primary_window_exists",this.Wl()){const t=Xa.Dt(this.zl),e=Xa.Dt(this.Ul);t&&!e?this.He=t:Xa.Lt(this.zl),Xa.At(this.Ul,!0)}(null===(n=this.Rr.bootstrap)||void 0===n?void 0:n.sessionID)&&this.setBootstrapSessionId(this.Rr.bootstrap.sessionID),this.Vl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Ie(this.Ol)&&(this.Ol=[]),this.Ol.push(t),this.Xt&&t(this.Xt,this.He),()=>{this.Ol=this.Ol.filter(e=>e!==t)}}Wl(){return"memory"!==this.Rr.persistence&&!this.Ml.mi&&Xa.Et()}Gl(t){t!==this.He&&(this.He=t,this.Wl()&&Xa.At(this.zl,t))}Zl(){return this.He?this.He:this.Wl()?Xa.Dt(this.zl):null}Ql(t){const e=this.Al;return!Pe(e)&&!Pe(t)&&5e3>Math.abs(t-e)}Jl(t,e,i){const n=e!==this._sessionActivityTimestamp,s=!(t!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xt=t,s&&!n||s&&this.Ql(e)||(this.Al=e,this.Ml.register({[H]:[e,t,i]}))}Kl(){var t;const e=null===(t=this.Rr)||void 0===t?void 0:t.persistence_save_debounce_ms;return Fe(e)&&e>0}Xl(){this.Kl()?this.Ml.refreshKey(H):(this.Ml.flush(),this.Ml.load())}Yl(){var t;if(Pe(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Al)return;this.Xl();const[,e,i]=this.tu();e===this.Xt&&i===this._sessionStartTimestamp&&(this.Al=this._sessionActivityTimestamp,this.Ml.register({[H]:[this._sessionActivityTimestamp,null!==(t=this.Xt)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){const[t]=this.tu(),e=Fe(t)?t:0,i=Fe(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}iu(t){return this.Xl(),this.Nl(t,this.eu())}tu(){const t=this.Ml.props[H];return xe(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Al=null,this.ql=void 0,clearTimeout(this.nu),this.nu=void 0,this.Jl(null,null,null)}setBootstrapSessionId(t,e=!1){const i=((t,e=(new Date).getTime())=>{try{const i=(t=>{const e=t.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})(t);return i>e+6e4?void xw.error("Bootstrap sessionID cannot be in the future"):i}catch(t){return void xw.error("Invalid sessionID in bootstrap",t)}})(t);return!Ie(i)&&(e?this.ql={sessionId:t,sessionStartTimestamp:i}:this.Jl(t,(new Date).getTime(),i),!0)}destroy(){this.Ll=!0,this.Yl(),clearTimeout(this.nu),this.nu=void 0,this.Dl&&t&&(t.removeEventListener(te,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&Xa.Lt(this.Ul)},sr(t,te,this.Dl,{capture:!1})}checkAndGetSessionAndWindowId(t=!1,e=null,i=!1){if("always"===this.Rr.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const n=e||(new Date).getTime(),s=this.Xt;if(i)this.Fl=n;else if(Pe(this.Fl)||this.Fl>n||n-this.Fl>=1e3){var r,o;null===(r=(o=this.Ml).syncCookieProperties)||void 0===r||r.call(o),this.Fl=n}let[,a,l]=this.tu();const u=!Ie(s)&&a!==s,h=this.eu();let c=this.Zl();const d=this.ql,v=!!d&&(d.sessionStartTimestamp>n+6e4||n-d.sessionStartTimestamp>Cw),f=d?v:Fe(l)&&Math.abs(n-l)>Cw;let p=!1,g=u,m=!a||!!d;const y=a;let b=!m&&!t&&this.Nl(n,h);if(b&&(b=this.iu(n),b||xw.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.tu(),b||(m=!a||!!d)),m||b||f){g=!1;const t=d&&!v;a=t?d.sessionId:this.jl(),c=this.Bl(),xw.info("new session ID assigned",{sessionId:a,windowId:c,bootstrapped:!!t,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f}}),l=t?d.sessionStartTimestamp:n,this.ql=void 0,p=!0}else c||(c=this.Bl(),p=!0),g=g||a!==y,g&&(xw.info("adopted cross-tab session id",{sessionId:a,windowId:c}),p=!0);const _=Fe(h)&&t&&!f?h:n,w=Fe(l)?l:(new Date).getTime();this.Gl(c),this.Jl(a,_,w),t||this.Hl();const k={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:f,crossTabAdoption:g};return p&&this.Ol.forEach(t=>t(a,c,k)),{sessionId:a,windowId:c,sessionStartTimestamp:w,changeReason:p?k:void 0,lastActivityTimestamp:h}}Hl(){this.Ll||(clearTimeout(this.nu),this.nu=setTimeout(()=>{if(!this.Ll)if(this.iu((new Date).getTime())){const t=this.Xt;this.resetSessionId(),this.Rl.emit("forcedIdleReset",{idleSessionId:t})}else this.Hl()},1.1*this.sessionTimeoutMs))}};const Tw=function(t,e){if(!t)return!1;const i=t.userAgent;if(i&&Ze(i,e))return!0;try{const i=null==t?void 0:t.userAgentData;if((null==i?void 0:i.brands)&&i.brands.some(t=>Ze(null==t?void 0:t.brand,e)))return!0}catch(t){}return!!t.webdriver};function Iw(){return Iw=oe(function*(){const t=null==i?void 0:i.userAgentData;if(null==t?void 0:t.getHighEntropyValues)try{const e=yield t.getHighEntropyValues(["model"]),i=null==e?void 0:e.model;return Me(i)&&i.length>0?i:void 0}catch(t){return void Gs.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}),Iw.apply(this,arguments)}const Mw="custom",Ew="i.posthog.com",Pw=/^\/static\//,Rw=["/s/","/e/","/i/"];var Aw=class{constructor(t){this.su={},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 e=null===(t=this.instance.config.ui_host)||void 0===t?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace(`.${Ew}`,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.su[this.apiHost]||(this.su[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":Mw),this.su[this.apiHost]}ru(t){if(!Pw.test(t))return;const e=this.instance.config.asset_host;return"string"==typeof e&&e.trim().replace(/\/$/,"")||void 0}ou(t){const e=lr(t);return e?e.protocol+"//"+e.host+e.pathname:void 0}au(t,e,i){if("ui"===t)return i;let n=i;const s=this.instance.config.rewriteRequestPath;if(s){var r;const t=(null===(r=lr(i))||void 0===r?void 0:r.href)||i;n=s(new URL(t)).toString()}if(s&&"api"===t&&Rw.some(t=>0===e.indexOf(t))){const t=this.ou(n);if(t){const e=this.apiHost;let i=this.lu;(null==i?void 0:i.apiHost)===e&&i.rewriteRequestPath===s||(i={apiHost:e,rewriteRequestPath:s,urls:new Set},this.lu=i),i.urls.add(t)}}return n}isIngestionEndpoint(t){const e=this.lu,i=this.ou(t);return(null==e?void 0:e.apiHost)===this.apiHost&&e.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&e.urls.has(i)}endpointFor(t,e=""){if(e&&(e="/"===e[0]?e:`/${e}`),"ui"===t)return this.au(t,e,this.uiHost+e);if("flags"===t)return this.au(t,e,this.flagsApiHost+e);if("assets"===t){const i=this.ru(e);if(i)return this.au(t,e,`${i}${e}`)}if(this.region===Mw)return this.au(t,e,this.apiHost+e);const i=Ew+e;switch(t){case"assets":return this.au(t,e,`https://${this.region}-assets.${i}`);case"api":return this.au(t,e,`https://${this.region}.${i}`)}}};const Fw=Zs("[PostHog ExternalIntegrations]"),Ow={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var Dw=class{constructor(t){this._instance=t}zo(t,e){var i,n;null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,t,t=>{if(t)return Fw.error("failed to load script",t);e()})}startIfEnabledOrStop(){var t;for(const[s,r]of Object.entries(null!==(t=this._instance.config.integrations)&&void 0!==t?t:{})){var e,i,n;r&&!(null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.integrations)||void 0===e?void 0:e[s])&&this.zo(Ow[s],()=>{var t;null===(t=d.__PosthogExtensions__)||void 0===t||null===(t=t.integrations)||void 0===t||null===(t=t[s])||void 0===t||t.start(this._instance)}),!r&&(null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.integrations)||void 0===i?void 0:i[s])&&(null===(n=d.__PosthogExtensions__)||void 0===n||null===(n=n.integrations)||void 0===n||null===(n=n[s])||void 0===n||n.stop())}}},Lw=class{constructor(t,e){this.$=t,this.wo=e,this.uu=new Map,this.Io=!1}add(t){var e=this;return oe(function*(){if(e.Io)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(e.uu.has(t.name))throw new Error(`Browser extension "${t.name}" is already registered`);e.uu.set(t.name,t);try{const i=t.setup(e.wo);i&&(yield i)}catch(i){const n=e.uu.get(t.name)===t;n&&e.uu.delete(t.name),e.$.error(`Failed to set up browser extension "${t.name}"`,i),n&&e.hu(t)}})()}getExtension(t){return this.uu.get(t)}dispose(){if(this.Io)return;this.Io=!0;const t=Array.from(this.uu.values()).reverse();this.uu.clear();for(const e of t)this.hu(e)}hu(t){try{var e;const i=null===(e=t.dispose)||void 0===e?void 0:e.call(t);i&&Ce(i.then)&&i.then(void 0,e=>{this.$.error(`Failed to dispose browser extension "${t.name}"`,e)})}catch(e){this.$.error(`Failed to dispose browser extension "${t.name}"`,e)}}},Nw=class{constructor(t){this._instance=t}initialize(){}get(t){const e=this._instance.persistence;if("string"==typeof t)return null==e?void 0:e.get_property(t);const i={};for(const n of t){const t=null==e?void 0:e.get_property(n);Ie(t)||(i[n]=t)}return i}set(t,e){var i;null===(i=this._instance.persistence)||void 0===i||i.register("string"==typeof t?{[t]:e}:t)}remove(t){var e;null===(e=this._instance.persistence)||void 0===e||e.unregister(t)}};const qw="extensionsRemoteConfig";var jw=class{constructor(t){this.instance=t,this.Io=!1,this.$=Gs,this.cu=t.du,this.kv=new Nw(t),this.onEvent=t=>Qp(this.instance.on("eventCaptured",e=>{try{t({event:e.event,properties:e.properties})}catch(t){this.$.error("Browser extension event listener failed",t)}})),this.onRemoteConfig=t=>{if(this.Io)return Qp(()=>{});const e=e=>{try{t(e)}catch(t){this.$.error("Browser extension remote config listener failed",t)}},i=this.instance.vu.on(qw,e);return this.cu&&e(this.cu),Qp(i)},this.fu=new Lw(Gs.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}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(p);return"string"==typeof t?t:void 0}get library(){return{name:Ya.LIB_NAME,version:Ya.LIB_VERSION}}get initialPersonProperties(){var t,e;return null!==(t=null===(e=this.instance.persistence)||void 0===e?void 0:e.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,e,i,n;const s=null===(t=this.instance.sessionManager)||void 0===t?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(e=null==s?void 0:s.sessionId)&&void 0!==e?e:"",windowId:null!==(i=null==s?void 0:s.windowId)&&void 0!==i?i:"",sessionStartTimestamp:null!==(n=null==s?void 0:s.sessionStartTimestamp)&&void 0!==n?n:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(t){return this.fu.add(t)}getExtension(t){return this.fu.getExtension(t)}capture(t,e,i){i?this.instance.capture(t,e,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):this.instance.capture(t,e)}registerDynamicEventProperties(t){return Qp(this.instance.pu(t))}handleRemoteConfig(t){this.Io||(this.cu=t,this.instance.vu.emit(qw,t))}sendRequest(t){var e=this;return oe(function*(t,i={}){var n;const s=e.instance.requestRouter.endpointFor(null!==(n=i.target)&&void 0!==n?n:"api",t),r={method:i.method,url:i.query?iw(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,compressionFallback:"flags"===i.target&&"best-available"===i.compression?de.Base64:void 0,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(e.instance._send_request(r),{statusCode:202}):new Promise(t=>{r.callback=t,e.instance._send_request(r)})}).apply(this,arguments)}dispose(){this.Io||(this.Io=!0,this.fu.dispose())}};const Bw={};let Hw=0;const zw=()=>{},Uw='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ww="Surveys module not available",Vw="sanitize_properties is deprecated. Use before_send instead",Gw="Invalid value for property_denylist config: ",Zw=/^[A-Za-z0-9_-]{1,400}$/,Qw=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Jw=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,Kw=["token","distinct_id",Ft],Xw="posthog",Yw=t=>{const e={};return t&&"unset"!==t?("2025-11-30">t||(e.strictMinimumDuration=!0),"2026-05-30">t||(e.canvasCapture={resolutionScale:.6}),"2026-06-25">t||(e.streamNetworkBody=!0),"2026-08-30">t||(e.captureJsonLd=!0),e):e},tk=e=>{var i;return he({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==n?void 0:n.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:zw,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&Me(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null===(i=t.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){Gs.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:Xt,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:zw},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Fr,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:Yw(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)}))(e))},ek=[["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"]],ik=t=>{const e={};for(const[i,n]of ek)Ie(t[i])||(e[n]=t[i]);const i=Ks({},e,t),n=t.__preview_external_dependency_versioned_paths;return Ie(n)||(Ie(t.strict_script_versioning)&&(i.strict_script_versioning=!!n),Me(n)&&Ie(t.asset_host)&&(i.asset_host=n)),xe(t.property_blacklist)&&(Ie(t.property_denylist)?i.property_denylist=t.property_blacklist:xe(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:Gs.error(Gw+t.property_denylist)),i};var nk=class{constructor(){this.__forceAllowLocalhost=!1}get gu(){return this.__forceAllowLocalhost}set gu(t){Gs.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}},sk=class e{mu(t){if(!t)return;const e=this.uu.indexOf(t);-1!==e&&this.uu.splice(e,1)}yu(t,e){var i;return this.mu(t),this.uu.push(e),null===(i=e.initialize)||void 0===i||i.call(e),e}bu(){return"always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isRejected()}_u(){if(this.wu)return;if(this.config.reuseAnonymousId)return;if(this.config.segment)return;if(this.bu())return;const t="memory"===this.config.persistence||"sessionStorage"===this.config.persistence;if(!t&&!this.config.disable_persistence)return;if(this.ku)return;let e,i,n;t?(e=`persistence is set to '${this.config.persistence}'`,i="memory"===this.config.persistence?"on every page load":"for every new browser tab or window",n="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(e="persistence is disabled (disable_persistence is true)",i="on every page load",n="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.wu=!0,console.warn("[PostHog.js]",`${e} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${i}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${n}`)}Su(){if(this.bu()||"$posthog_cookieless"!==this.get_distinct_id())return;const t=this.persistence;if(!t)return;this.xu()||t.load(!0);const e=this.get_distinct_id();if(!e||"$posthog_cookieless"===e){const e=this.config.get_device_id(Pa());this.register({distinct_id:e,$device_id:e}),t.set_property($t,Jt)}this.Cu()}get decideEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.$u=!1,this.Tu=!1,this.webPerformance=new nk,this.Iu=!1,this.version=Ya.LIB_VERSION,this.Mu=new Set,this.Eu="",this.vu=new Sw,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=tk(),this.SentryIntegration=T_,this.sentryIntegration=t=>function(t,e){const i=$_(t,e);return{name:C_,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new _w(this),this.pageViewManager=new I_(this),this.rateLimiter=new G_(this),this.requestRouter=new Aw(this),this.consent=new y_(this),this.externalIntegrations=new Dw(this);const i=null!==(t=e.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,e,i)=>{const n=Me(t)?{[t]:e}:t;this.setPersonProperties(n),null==i||i({})},set_once:(t,e,i)=>{const n=Me(t)?{[t]:e}:t;this.setPersonProperties(void 0,n),null==i||i({})}},this.on("eventCaptured",t=>Gs.info(`send "${null==t?void 0:t.event}"`,t))}init(t,i,n){if(n&&n!==Xw){var s;const r=null!==(s=Bw[n])&&void 0!==s?s:new e;return r._init(t,i,n),Bw[n]=r,Bw[Xw][n]=r,r}return this._init(t,i,n)}_init(e,i={},n){var s,r,o;const a=Me(e)?e.trim():"";if(!a)return Gs.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==(null===(l=this.config)||void 0===l?void 0:l.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=tk(i.defaults),i.debug=this.Du(i.debug),this.Lu=i,this.Nu=[],i.person_profiles?this.Fu=i.person_profiles:i.process_person&&(this.Fu=i.process_person);const u=tk(i.defaults),h=ik(i),c=Ks({},u,h,{name:n,token:a});$e(u.rageclick)&&$e(h.rageclick)&&(c.rageclick=Ks({},u.rageclick,h.rageclick)),$e(u.session_recording)&&$e(h.session_recording)&&(c.session_recording=Ks({},u.session_recording,h.session_recording)),this.set_config(c),this.config.on_xhr_error&&Gs.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:wp;const d=this.xu();if(this.persistence=new W_(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new W_(he(he({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.Eu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Xa.Et()){const t=Xa.Dt(this.Eu);xe(t)&&t.forEach(t=>{Me(t)&&this.Mu.add(t)})}else Xa.Lt(this.Eu);const v=he({},this.persistence.props),f=he({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.qu=new mw((t,e)=>this.ju(t,e),this.config.request_queue_config),this.Bu=new bw(this),this.__request_queue=[];const p=this.bu();p||(this.sessionManager=new $w(this),this.sessionPropsManager=new kw(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((t,e,i)=>{((null==i?void 0:i.activityTimeout)||(null==i?void 0:i.sessionPastMaximumLength)||(null==i?void 0:i.crossTabAdoption))&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(Gs.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(p)},0)):(Gs.info("Initializing extensions synchronously"),this.Uu(p)),Ya.DEBUG=Ya.DEBUG||this.config.debug,Ya.DEBUG&&Gs.info("Starting in debug mode",{this:this,config:i,thisC:he({},this.config),p:v,s:f}),this.config.identity_distinct_id&&!(null===(s=i.bootstrap)||void 0===s?void 0:s.distinctID)&&(i.bootstrap=he(he({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=null===(r=i.bootstrap)||void 0===r?void 0:r.distinctID;if(this.ku=!!m&&!Ee(m),null===(o=i.bootstrap)||void 0===o?void 0:o.distinctID){const t=i.bootstrap.distinctID,e=this.get_distinct_id(),n=this.persistence.get_property($t);if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"anonymous"===n)this.identify(t);else if(i.bootstrap.isIdentifiedID&&null!=e&&e!==t&&"identified"===n)Gs.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(Pa()),n=i.bootstrap.isIdentifiedID?e:t;this.persistence.set_property($t,i.bootstrap.isIdentifiedID?Kt:Jt),this.register({distinct_id:t,$device_id:n})}}if(p)this.register_once({distinct_id:At,$device_id:null},"");else if(!this.get_distinct_id()){const t=this.config.get_device_id(Pa());this.register_once({distinct_id:t,$device_id:t},""),this.persistence.set_property($t,Jt)}return sr(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),sr(t,"pageshow",()=>{var t;this.$u=!1,this.Tu||null===(t=this.Bu)||void 0===t||t.resume()}),i.segment?x_(this,()=>this.Wu()):this.Wu(),Ce(this.config._onCapture)&&this.config._onCapture!==zw&&(Gs.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",t=>this.config._onCapture(t.event,t))),this.config.ip&&Gs.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 Iw.apply(this,arguments)}().then(t=>{t&&this.register({[g]:t})}).catch(zw),this}Vu(t){const e=t;return Me(e.name)&&Ce(e.setup)}Gu(t,e){this.Vu(t)?e.push(()=>{this.Zu().add(t).catch(()=>{var e;return null===(e=t.dispose)||void 0===e?void 0:e.call(t)}).catch(e=>{Gs.error(`Failed to dispose browser extension "${t.name}"`,e)})}):this.uu.push(t)}zu(){var t,i,n;const s=null!==(t=null===(i=this.config.__extensionClasses)||void 0===i?void 0:i.featureFlags)&&void 0!==t?t:null===(n=e.__defaultExtensionClasses)||void 0===n?void 0:n.featureFlags;var r,o,a;s&&(this.featureFlags&&this.featureFlags instanceof s||(null===(r=this.Qu)||void 0===r||r.call(this),this.Qu=void 0,this.featureFlags=new s(this)),Ce(this.featureFlags.onReloading)&&Ce(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.vu.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):null===(o=(a=this.featureFlags).initialize)||void 0===o||o.call(a))}Uu(t){const i=performance.now(),n=he(he({},e.__defaultExtensionClasses),this.config.__extensionClasses),s=[];var r,o,a,l,u,h,c;n.exceptions&&this.uu.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new n.exceptions(this)),n.historyAutocapture&&this.uu.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this.uu.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.uu.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!t&&this.uu.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||s.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this.Gu(this.autocapture=new n.autocapture(this),s),n.surveys&&this.Gu(this.surveys=null!==(o=this.surveys)&&void 0!==o?o:new n.surveys(this),s),n.logs&&this.Gu(this.logs=null!==(a=this.logs)&&void 0!==a?a:new n.logs(this),s),n.metrics&&this.uu.push(this.metrics=null!==(l=this.metrics)&&void 0!==l?l:new n.metrics(this)),n.conversations&&this.uu.push(this.conversations=null!==(u=this.conversations)&&void 0!==u?u:new n.conversations(this)),n.productTours&&this.uu.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.uu.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.uu.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.uu.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.uu.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,w_)),n.toolbar&&this.uu.push(this.toolbar=null!==(h=this.toolbar)&&void 0!==h?h:new n.toolbar(this)),n.experiments&&this.uu.push(this.experiments=null!==(c=this.experiments)&&void 0!==c?c:new n.experiments(this)),this.uu.forEach(t=>{t.initialize&&s.push(()=>{var e;null===(e=t.initialize)||void 0===e||e.call(t)})}),s.push(()=>{if(this.Ju){const t=this.Ju;this.Ju=void 0,this.uu.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}}),this.Ku(s,i)}Ku(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout(()=>{this.Ku(t,e)},0);const i=t.shift();if(i)try{i()}catch(t){Gs.error("Error initializing extension:",t)}}const i=Math.round(performance.now()-e);this.register_for_session({[Ot]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Dt]:i}),this.config.__preview_deferred_init_extensions&&Gs.info(`PostHog extensions initialized (${i}ms)`)}il(t){var e;if(!n||!n.body)return Gs.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.il(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=t),this.du=t,this.compression=void 0,t.ok){var i;const e=t.config;e.supportedCompression&&!this.config.disable_compression&&(this.compression=me(e.supportedCompression,wp)?wp:me(e.supportedCompression,kp)?kp:void 0),(null===(i=e.analytics)||void 0===i?void 0:i.endpoint)&&(this.analyticsDefaultEndpoint=e.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:Xt}),null===(e=this.Xu)||void 0===e||e.handleRemoteConfig(t),this.uu.forEach(e=>{var i;return null===(i=e.onRemoteConfig)||void 0===i?void 0:i.call(e,t)})}Wu(){try{this.config.loaded(this)}catch(t){Gs.critical("`loaded` function failed",t)}if(this.Yu(),this.config.internal_or_test_user_hostname&&(null==s?void 0:s.hostname)){const t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.bu())&&this.th()},1),this.eh=new Q_(this),this.eh.load()}Yu(){var t;this.is_capturing()&&this.config.request_batching&&(null===(t=this.qu)||void 0===t||t.enable())}_dom_loaded(){this.is_capturing()&&Qs(this.__request_queue,t=>this.ju(t)),this.__request_queue=[],this.Yu()}_handle_unload(){var t,e,i,n,s,r;this.$u=!0,null===(t=this.surveys)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t),null===(i=this.metrics)||void 0===i||i.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(ie),null===(n=this.logs)||void 0===n||n.flushLogs("sendBeacon"),null===(s=this.qu)||void 0===s||s.unload(),null===(r=this.Bu)||void 0===r||r.unload()):this.ih()&&this.capture(ie,null,{transport:"sendBeacon"})}_send_request(t){gw(this,t)}ju(t,e){this.Bu?this.Bu.retriableRequest(t,e):this._send_request(e?he(he({},t),{},{transport:e}):t)}_execute_array(t){Hw++;try{let e;const i=[],n=[],s=[];Qs(t,t=>{if(t)if(e=t[0],xe(e))s.push(t);else if(Ce(t))try{t.call(this)}catch(e){Gs.error("Error executing queued PostHog call",t,e)}else xe(t)&&"alias"===e?i.push(t):xe(t)&&-1!==e.indexOf("capture")&&Ce(this[e])?s.push(t):n.push(t)});const r=function(t,e){Qs(t,function(t){try{if(xe(t[0])){let i=e;Js(t,function(t){i=i[t[0]].apply(i,t.slice(1))})}else e[t[0]].apply(e,t.slice(1))}catch(e){Gs.error("Error executing queued PostHog call",t,e)}})};r(i,this),r(n,this),r(s,this)}finally{Hw--}}push(t){if(Hw>0&&xe(t)&&Me(t[0])){const i=e.prototype[t[0]];return void(Ce(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}get nh(){return{property:b,persistenceKey:_,cookieName:"_fbc",pattern:Qw,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[_]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(_)}}}get sh(){return{property:w,persistenceKey:k,cookieName:"_fbp",pattern:Jw,register:(t,e)=>{var i;return null===(i=this.persistence)||void 0===i?void 0:i.register({[k]:{value:t,delivered:e}})},unregister:()=>{var t;return null===(t=this.persistence)||void 0===t?void 0:t.unregister(k)}}}rh(t){var e;const i=null===(e=this.persistence)||void 0===e?void 0:e.get_property(t.persistenceKey);return Me(i)&&t.pattern.test(i)?{value:i,delivered:!1}:$e(i)&&Me(i.value)&&t.pattern.test(i.value)?{value:i.value,delivered:!0===i.delivered}:void 0}oh(t,e,i){return e===(null==i?void 0:i.value)?{value:e,pending:!i.delivered}:(t.register(e,!1),{value:e,pending:!0})}ah(t){if(!this.config.save_campaign_params||this.bu())return;const e=Ca(t.cookieName);return Me(e)&&t.pattern.test(e)?e:void 0}uh(t,e,i,n){if(!this.persistence)return;const s=this.nh;this.persistence.refreshKey(s.persistenceKey);const r=this.rh(s);if(n)return void s.unregister();if(i)return Me(e)&&Qw.test(e)?this.oh(s,e,r):void s.unregister();const o=Me(t)&&Zw.test(t)?t:void 0,a=this.ah(s);return a&&((t,e,i)=>{const n=t.split(".");if(e)return n[3]===e;if(!i)return!0;const s=i.value.split(".");return n[3]===s[3]||Number(n[2])>Number(s[2])})(a,o,r)?this.oh(s,a,r):o?(null==r?void 0:r.value.split(".")[3])===o?{value:r.value,pending:!r.delivered}:this.oh(s,`fb.1.${Date.now()}.${o}`,r):r?{value:r.value,pending:!r.delivered}:void 0}hh(t,e,i){if(!this.persistence)return;const n=this.sh;this.persistence.refreshKey(n.persistenceKey);const s=this.rh(n);if(i)return void n.unregister();if(e)return Me(t)&&Jw.test(t)?this.oh(n,t,s):void n.unregister();const r=this.ah(n);return r?this.oh(n,r,s):s?{value:s.value,pending:!s.delivered}:void 0}dh(t,e){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const i=this.rh(t);(null==i?void 0:i.value)!==e||i.delivered||t.register(e,!0)}capture(t,e,i){var n,s;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void Gs.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(Ie(t)||!Me(t))return void Gs.error("No event name provided to posthog.capture");this.Su();const r=!this.config.opt_out_useragent_filter&&this._is_bot();if(r&&!this.config.__preview_capture_bot_pageviews)return;const o=(null==i?void 0:i.skip_client_rate_limiting)?void 0:this.rateLimiter.clientRateLimitContext();if(null==o?void 0:o.isRateLimited)return void Gs.critical("This capture call is ignored due to client rate limiting.");let a;(null==e?void 0:e.$current_url)&&!Me(null==e?void 0:e.$current_url)&&(Gs.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||(null==i?void 0:i.fh)||Gs.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(a=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const l=new Date,u=(null==i?void 0:i.timestamp)||l,h=ln(null==i?void 0:i.uuid,Pa);let c={uuid:h,event:t,properties:this.calculateEventProperties(t,e||{},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==i?void 0:i.$set)&&!d&&(c.$set=null==i?void 0:i.$set);const v=$e(null==e?void 0:e.$set)?e.$set:void 0,f=xe(null==e?void 0:e.$unset)?e.$unset:[],p=(null==i?void 0:i.$unset)||[],g=t=>{var e;const n=!!(null==i?void 0:i.$set)&&t in i.$set;return{hasProvided:n||!!v&&t in v,provided:n?null==i||null===(e=i.$set)||void 0===e?void 0:e[t]:null==v?void 0:v[t],unset:-1!==f.indexOf(t)||-1!==p.indexOf(t)}},m=g(b),y=g(w),_=[{channel:this.nh,hasProvided:m.hasProvided,update:this.uh(null==a?void 0:a.fbclid,m.provided,m.hasProvided,m.unset)},{channel:this.sh,hasProvided:y.hasProvided,update:this.hh(y.provided,y.hasProvided,y.unset)}];for(const{channel:t,hasProvided:e,update:i}of _)i&&!0===c.properties.$process_person_profile&&i.pending&&!e&&!d&&(c.$set=he({[t.property]:i.value},c.$set));const k=null==i?void 0:i.$unset;k&&(c.$unset=k);const S=d?void 0:this.ph(null==i?void 0:i.$set_once,t!==se,t===ne);if(S&&(c.$set_once=S),(null==i?void 0:i._noTruncate)||(x=this.config.properties_string_max_length,c=function(t,e){const i=new Set;return function t(n,s){if(n!==Object(n))return e?e(n):n;if(i.has(n))return;let r;if(i.add(n),xe(n))r=[],Qs(n,e=>{r.push(t(e))});else{const e={};Js(Be(n)?er(n):n,(n,s)=>{i.has(n)||(e[s]=t(n,s))}),r=e}return r}(t)}(c,t=>Me(t)?t.slice(0,x):t)),c.timestamp=u,Ie(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=l),d&&(c.properties=((t,e=[])=>{const i={},n=e=>{void 0!==t[e]&&(i[e]=t[e])};return as.forEach(n),e.forEach(n),i})(c.properties,Kw)),t===jp||t===Bp){const i=null==e?void 0:e[Hp],n=null==e?void 0:e[Up];ng({id:i,current_iteration:n}),c.$set=he(he({},c.$set),{},{[ol({id:i,current_iteration:n},t===Bp?"responded":"dismissed")]:!0})}else t===qp&&(c.$set=he(he({},c.$set),{},{[Vp]:(new Date).toISOString()}));var x;if("product tour shown"===t){const t=null==e?void 0:e.$product_tour_type;t&&(c.$set=he(he({},c.$set),{},{[`$product_tour_last_seen_date/${t}`]:(new Date).toISOString()}))}const C=he(he({},c.properties.$set),c.$set);if(Te(C)||this.setPersonPropertiesForFlags(C),!Re(this.config.before_send)){const t=this.Os(c);if(!t)return;c=t,c.uuid=ln(c.uuid,Pa)}const T=_.filter(({channel:t,update:e})=>{var i,n,s;const r=null!==(i=null===(n=c.$set)||void 0===n?void 0:n[t.property])&&void 0!==i?i:$e(null===(s=c.properties)||void 0===s?void 0:s.$set)?c.properties.$set[t.property]:void 0;return(null==e?void 0:e.pending)&&r===e.value});this.vu.emit("eventCaptured",c);const I=null!==(n=null==i?void 0:i._url)&&void 0!==n?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),M="recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(I),E=he(he(he({method:"POST",url:I,data:c,compression:"best-available",preferSyncCompression:null==i?void 0:i.send_instantly,timestampMode:M?"body":"capture-body",batchKey:null==i?void 0:i._batchKey},M&&(null===(s=c.properties)||void 0===s?void 0:s.$session_id)?{batchGroup:c.properties.$session_id+(c.properties.$window_id?`-${c.properties.$window_id}`:"")}:{}),(null==i?void 0:i.transport)?{transport:i.transport}:{}),T.length?{fireCallbackOnDrop:!0,callback:t=>{if(t.statusCode>=200&&300>t.statusCode)for(const{channel:t,update:e}of T)this.dh(t,e.value)}}:{});if(!this.config.request_batching||i&&!(null==i?void 0:i._batchKey)||(null==i?void 0:i.send_instantly)||T.length){var P;let t;!E.transport&&!E.callback&&Te(null!==(P=this.config.request_headers)&&void 0!==P?P:{})&&this.$u&&(t="sendBeacon"),this.ju(E,t)}else this.qu.enqueue(E);return c}_addCaptureHook(t){return this.on("eventCaptured",e=>t(e.event,e))}getExtension(t){var e;return null===(e=this.Xu)||void 0===e?void 0:e.getExtension(t)}Zu(){var t;return null!==(t=this.Xu)&&void 0!==t?t:this.Xu=new jw(this)}pu(t){this.Pu.push(t);let e=!0;return()=>{if(!e)return;e=!1;const i=this.Pu.indexOf(t);-1!==i&&this.Pu.splice(i,1)}}gh(t=!0){var e,i,n;return!!(null===(e=this.persistence)||void 0===e?void 0:e.consumeCookieIdentityChange())&&(this.Ou=null,"anonymous"===this.persistence.get_property("$user_state")&&(null===(n=this.sessionPersistence)||void 0===n||n.clear(),this.Mu.clear(),this.mh()),null===(i=this.featureFlags)||void 0===i||i.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(e,i,r,o,a){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.gh();const l=a?void 0:this.persistence.remove_event_timer(e);let h=he({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.bu()&&(h[Ft]=!0),"$snapshot"===e){const t=he(he({},this.persistence.properties()),this.sessionPersistence.properties());return h.distinct_id=t.distinct_id,(!Me(h.distinct_id)&&!Ae(h.distinct_id)||Ee(h.distinct_id))&&Gs.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}const c=function(e,i,n,r=!1){var o,a,l,h;if(!u)return{};const c=e?[...Tl,...i||[]]:[],[d,v]=Qi(u),[f,p]=function(t){for(let e=0;Yi.length>e;e++){const[i,n,s]=Yi[e],r=t.match(i);if(r){const e=s&&t.match(s)||r;return[n,(null==e?void 0:e[1])||""]}}return["",""]}(u),g=function(){const t="u">typeof navigator?navigator:void 0;return(null==t?void 0:t.brave)?{brave:!0}:{}}(),m={};Ie(n)||(m.detectGoogleSearchApp=n);const y={},b=null===(o=navigator)||void 0===o||null===(o=o.userAgentData)||void 0===o?void 0:o.platform,_=null===(a=navigator)||void 0===a?void 0:a.maxTouchPoints,w=null==t||null===(l=t.screen)||void 0===l?void 0:l.width,k=null==t||null===(h=t.screen)||void 0===h?void 0:h.height,S=null==t?void 0:t.devicePixelRatio;Ie(b)||(y.userAgentDataPlatform=b),Ie(_)||(y.maxTouchPoints=_),Ie(w)||(y.screenWidth=w),Ie(k)||(y.screenHeight=k),Ie(S)||(y.devicePixelRatio=S);const x=Ks(tr({$os:d,$os_version:v,$browser:Wi(u,navigator.vendor,g,m),$webview_app:f,$webview_app_version:p,$device:Ji(u),$device_type:Ki(u,y),$timezone:jl(),$timezone_offset:Bl()}),{$current_url:cr(r?hn(null==s?void 0:s.href):null==s?void 0:s.href,c,Ml),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Gi(u,navigator.vendor,g,m),$browser_language:Fl(),$browser_language_prefix:Ol(),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:Ws.LIB_NAME,$lib_version:Ws.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Ws.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=Ws.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:e}=this.sessionManager.checkAndGetSessionAndWindowId(a,r.getTime(),!0);h.$session_id=t,h.$window_id=e}this.sessionPropsManager&&Ks(h,this.sessionPropsManager.getSessionProps());try{var d;this.sessionRecording&&Ks(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null===(d=this.Bu)||void 0===d?void 0:d.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}let v;if(this.requestRouter.region===Mw&&(h.$lib_custom_api_host=this.config.api_host),v="$pageview"!==e||a?"$pageleave"!==e||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,o),h=Ks(h,v),"$pageview"===e&&n&&(h.title=n.title),!Ie(l)){const t=r.getTime()-l;h.$duration=parseFloat((t/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser");const f=this.persistence.properties(),p=this.sessionPersistence.properties(),g=h.$groups,m=f.$groups;$e(g)&&!Te(g)&&(h.$groups=he(he({},$e(m)?m:{}),g)),Js(["$referrer","$referring_domain"],t=>{t in f&&delete p[t]});const y={};if(this.Pu.length>0)for(const t of this.Pu.slice())try{Ks(y,t())}catch(t){Gs.error("Failed to produce browser extension event properties",t)}h=Ks({},c,f,p,he(he({},y),h)),h.$is_identified=this._isIdentified(),xe(this.config.property_denylist)?Js(this.config.property_denylist,function(t){delete h[t]}):Gs.error(Gw+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const b=this.config.sanitize_properties;b&&(Gs.error(Vw),h=b(h,e));const _=this.yh();return h.$process_person_profile=_,_&&!a&&this.bh("_calculate_event_properties"),h}ph(t,e=!0,i=!1){var n;if(!this.persistence||!this.yh())return t;if(this.Iu&&!i)return t;const s=this.persistence.get_initial_props(),r=null===(n=this.sessionPropsManager)||void 0===n?void 0:n.getSetOnceProps();let o=Ks({},s,r||{},t||{});const a=this.config.sanitize_properties;return a&&(Gs.error(Vw),o=a(o,"$set_once")),e&&(this.Iu=!0),Te(o)?void 0:o}register(t,e){var i;null===(i=this.persistence)||void 0===i||i.register(t,e)}register_once(t,e,i){var n;null===(n=this.persistence)||void 0===n||n.register_once(t,e,i)}register_for_session(t){var e,i;null===(e=this.persistence)||void 0===e||e.syncCookieProperties(),this.gh(),null===(i=this.sessionPersistence)||void 0===i||i.register(t),Object.keys(t).forEach(t=>this.Mu.add(t)),this.mh()}unregister(t){var e;null===(e=this.persistence)||void 0===e||e.unregister(t)}unregister_for_session(t){var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t),this.Mu.delete(t),this.mh()}_h(t,e){this.register({[t]:e})}Hu(){this.Mu.forEach(t=>{var e;null===(e=this.sessionPersistence)||void 0===e||e.unregister(t)}),this.Mu.clear(),this.mh()}mh(){var t;if(!this.Eu)return;if("memory"===this.config.persistence||(null===(t=this.sessionPersistence)||void 0===t?void 0:t.mi)||!Xa.Et())return void Xa.Lt(this.Eu);const e=[];this.Mu.forEach(t=>e.push(t)),e.length>0?Xa.At(this.Eu,e):Xa.Lt(this.Eu)}getFeatureFlag(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null===(e=this.featureFlags)||void 0===e?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null===(i=this.featureFlags)||void 0===i?void 0:i.getFeatureFlagResult(t,e)}getAllFeatureFlags(){var t,e;return null!==(t=null===(e=this.featureFlags)||void 0===e?void 0:e.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,e){var i,n;return null!==(i=null===(n=this.featureFlags)||void 0===n?void 0:n.isFeatureEnabled(t,e))&&void 0!==i?i:null==e?void 0:e.defaultValue}reloadFeatureFlags(){var t;null===(t=this.featureFlags)||void 0===t||t.reloadFeatureFlags()}updateFlags(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;null===(n=this.featureFlags)||void 0===n||n.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e=!1,i){var n;return null===(n=this.featureFlags)||void 0===n?void 0:n.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.vu.on(t,e)}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:Ww}),()=>{})}onSessionId(t){var e,i;return null!==(e=null===(i=this.sessionManager)||void 0===i?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e=!1){this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:Ww})}getActiveMatchingSurveys(t,e=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Ww})}renderSurvey(t,e){var i;null===(i=this.surveys)||void 0===i||i.renderSurvey(t,e)}displaySurvey(t,e=rg){var i;null===(i=this.surveys)||void 0===i||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null===(e=this.surveys)||void 0===e||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null===(i=this.surveys)||void 0===i?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:Ww}}canRenderSurveyAsync(t,e=!1){var i,n;return null!==(i=null===(n=this.surveys)||void 0===n?void 0:n.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Ww})}wh(t){return!t||Ee(t)?(Gs.critical("Unique user id has not been set in posthog.identify"),!1):"$posthog_cookieless"===t?(Gs.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())||(Gs.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,e,i){if(!this.__loaded||!this.persistence)return Gs.uninitializedWarning("posthog.identify");if(Ae(t)&&(t=t.toString(),Gs.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(t))return;if(!this.bh("posthog.identify"))return;this.Su();const n=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==n,r=this.gh(!1),o=this.persistence.Da();let a=!1;try{const n=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),t!==n&&t!==this.get_property("__alias")&&(this.unregister(m),this.register({distinct_id:t}));const o=(this.persistence.get_property("$user_state")||"anonymous")===Jt,u=t!==n,h=!u&&o;if(u&&o){var l;const s=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:n};this.persistence.set_property($t,Kt),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$identify",s,{$set:e||{},$set_once:i||{}})&&(this.Ou=bl(t,e,i)),null===(l=this.featureFlags)||void 0===l||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:n)}else if(h){this.persistence.set_property($t,Kt);const n=e||{},s=i||{};this.setPersonPropertiesForFlags({$set:n,$set_once:s},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$set",{$set:n,$set_once:s})&&(this.Ou=bl(t,e,i))}else(e||i)&&this.setPersonProperties(e,i);u||s||r?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(kt)):h&&(e||i)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.ja(a)}}setPersonProperties(t,e){if(!t&&!e)return;if(!this.bh("posthog.setPersonProperties"))return;const i=bl(this.get_distinct_id(),t,e);this.Ou!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}})&&(this.Ou=i)):Gs.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var e;const i=(xe(t)?t:[t]).filter(t=>Me(t)&&t.length>0);0!==i.length&&this.bh("posthog.unsetPersonProperties")&&(null===(e=this.featureFlags)||void 0===e||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Ou=null)}group(t,e,i){var n;if(!t||!e)return void Gs.error("posthog.group requires a group type and group key");null===(n=this.persistence)||void 0===n||n.syncCookieProperties(),this.gh();const s=this.getGroups(),r=s[t]!==e;if(r&&this.resetGroupPropertiesForFlags(t),this.register({$groups:he(he({},s),{},{[t]:e})}),(r||i)&&this.yh()){const n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(se,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),r&&!i&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e=!0){var i;null===(i=this.featureFlags)||void 0===i||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(t=!0){var e;null===(e=this.featureFlags)||void 0===e||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e=!0){var i;this.bh("posthog.setGroupPropertiesForFlags")&&(null===(i=this.featureFlags)||void 0===i||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null===(e=this.featureFlags)||void 0===e||e.resetGroupPropertiesForFlags(t)}reset(t){const e=Oe(t)?t:null==t?void 0:t.resetDeviceID,i=Oe(t)||null==t?void 0:t.bootstrap;this.kh(e,!1,i)}kh(t,e=!1,i){var n,s,r,o,a,l;if(Gs.info("reset"),!this.__loaded)return Gs.uninitializedWarning("posthog.reset");const u=null==i?void 0:i.sessionID;this.config.bootstrap=i||(null===(n=this.Lu)||void 0===n?void 0:n.bootstrap)||{},null===(s=this.featureFlags)||void 0===s||null===(r=s.updateConfig)||void 0===r||r.call(s,this.config,this.nl());const h=this.get_property(p),c=this.get_property(g),d=this.get_property(O);null===(o=this.sessionRecording)||void 0===o||o.flushBeforeIdentityReset();const v=this.is_capturing();this.consent.reset(),e||!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===(a=this.persistence)||void 0===a||null===(l=a.Da)||void 0===l?void 0:l.call(a);let m=!1;try{var y,b,_,w,k,S,x,C,T,I,M,E,P;if(null===(y=this.persistence)||void 0===y||y.clear(),null===(b=this.sessionPersistence)||void 0===b||b.clear(),this.Mu.clear(),this.mh(),Ie(d)||null===(I=this.persistence)||void 0===I||I.register({$session_recording_remote_config:d}),null===(_=this.surveys)||void 0===_||_.reset(),null===(w=this.featureFlags)||void 0===w||w.reset(),null===(k=this.conversations)||void 0===k||k.reset(),null===(S=this.logs)||void 0===S||S.reset(),null===(x=this.metrics)||void 0===x||x.reset(),null===(C=this.persistence)||void 0===C||C.set_property("$user_state","anonymous"),null===(T=this.sessionManager)||void 0===T||T.resetSessionId(),this.Ou=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:At,$device_id:null},"");else{const e=this.config.get_device_id(Pa());this.register_once({distinct_id:e,$device_id:t?e:h},""),t||Ie(c)||this.register({[g]:c})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),i)if(i.distinctID&&!this.bu()&&(null===(P=this.persistence)||void 0===P||P.set_property("$user_state",i.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.distinctID})),null===(M=this.featureFlags)||void 0===M||M.initialize(),!Re(u)&&!(null===(E=this.sessionManager)||void 0===E?void 0:E.setBootstrapSessionId(u,!0))){const t=he({},i);delete t.sessionID,this.config.bootstrap=t}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var R,A;f&&(null===(R=this.persistence)||void 0===R||null===(A=R.ja)||void 0===A||A.call(R,m))}this.reloadFeatureFlags()}shutdown(t){var e=this;return oe(function*(){var t,i,n,s,r,o,a,l;if(e.__loaded){e.Tu=!0,e.Zu().dispose(),null===(t=e.sessionRecording)||void 0===t||t.dispose(),null===(i=e.logs)||void 0===i||i.flushLogs("sendBeacon"),null===(n=e.metrics)||void 0===n||n.flush("sendBeacon"),null===(s=e.metrics)||void 0===s||s.dispose(),null===(r=e.qu)||void 0===r||r.unload(),null===(o=e.Bu)||void 0===o||o.unload();try{var u;null===(u=e.featureFlags)||void 0===u||u.destroy()}catch(t){Gs.error("Error while destroying feature flags",t)}null===(a=e.persistence)||void 0===a||a.destroy(),null===(l=e.sessionPersistence)||void 0===l||l.destroy()}else Gs.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,e){var i;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null===(i=this.conversations)||void 0===i||i.Sh()}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.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null===(e=this.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let n=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${e}`);if((null==t?void 0:t.withTimestamp)&&i){var s;const e=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return n;n+=`?t=${Math.max(Math.floor(((new Date).getTime()-i)/1e3)-e,0)}`}return n}alias(t,e){return t===this.get_property("$people_distinct_id")?(Gs.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(Ie(e)&&(e=this.get_distinct_id()),t!==e?(this._h(m,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Gs.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const e=he({},this.config);if($e(t)){var i,n,s,r,o,a,l,u,h,c,d,v,f,p;Ks(this.config,ik(t));const m=this.xu();null===(i=this.persistence)||void 0===i||i.update_config(this.config,e,m),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new W_(he(he({},this.config),{},{persistence:"sessionStorage"}),m,!1);const y=this.Du(this.config.debug);var g;Oe(y)&&(this.config.debug=y),Oe(this.config.debug)&&(this.config.debug?(Ya.DEBUG=!0,Na.Et()&&Na.At("ph_debug",!0),Gs.info("set_config",{config:t,oldConfig:e,newConfig:he({},this.config)})):(Ya.DEBUG=!1,Na.Et()&&Na.Lt("ph_debug"))),null===(n=this.featureFlags)||void 0===n||null===(s=n.updateConfig)||void 0===s||s.call(n,this.config,this.nl()),null===(r=this.exceptionObserver)||void 0===r||r.onConfigChange(),null===(o=this.exceptions)||void 0===o||o.onConfigChange(),null===(a=this.metrics)||void 0===a||a.onConfigChange(),null===(l=this.sessionRecording)||void 0===l||l.startIfEnabledOrStop(),null===(u=this.tracingHeaders)||void 0===u||u.startIfEnabledOrStop(),null===(h=this.autocapture)||void 0===h||h.startIfEnabled(),null===(c=this.heatmaps)||void 0===c||c.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null===(g=this.historyAutocapture)||void 0===g||g.startIfEnabledOrStop()),null===(d=this.exceptionObserver)||void 0===d||d.startIfEnabledOrStop(),null===(v=this.deadClicksAutocapture)||void 0===v||v.startIfEnabledOrStop(),null===(f=this.surveys)||void 0===f||f.loadIfEnabled(),this.Cu(),null===(p=this.externalIntegrations)||void 0===p||p.startIfEnabledOrStop(),!e.segment&&this.config.segment&&this.persistence&&x_(this,zw,!1)}}_overrideSDKInfo(t,e){Ya.LIB_NAME=t,Ya.LIB_VERSION=e}startSessionRecording(t){const e=!0===t,i={sampling:e||!!(null==t?void 0:t.sampling),linked_flag:e||!!(null==t?void 0:t.linked_flag),url_trigger:e||!!(null==t?void 0:t.url_trigger),event_trigger:e||!!(null==t?void 0:t.event_trigger)};var n,s,r,o,a;Object.values(i).some(Boolean)&&(null===(n=this.sessionManager)||void 0===n||n.checkAndGetSessionAndWindowId(),i.sampling&&(null===(s=this.sessionRecording)||void 0===s||s.overrideSampling()),i.linked_flag&&(null===(r=this.sessionRecording)||void 0===r||r.overrideLinkedFlag()),i.url_trigger&&(null===(o=this.sessionRecording)||void 0===o||o.overrideTrigger("url")),i.event_trigger&&(null===(a=this.sessionRecording)||void 0===a||a.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,e){try{if(!this.exceptions)return;const i=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(he(he({},i),e))}catch(t){return}}addExceptionStep(t,e){var i;null===(i=this.exceptions)||void 0===i||i.addExceptionStep(t,e)}captureLog(t){var e;null===(e=this.logs)||void 0===e||e.captureLog(t)}get logger(){var t,i;return null!==(t=null===(i=this.logs)||void 0===i?void 0:i.logger)&&void 0!==t?t:e.Ch}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null===(i=this.toolbar)||void 0===i?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null===(e=this.persistence)||void 0===e?void 0:e.props[t]}getSessionProperty(t){var e;return null===(e=this.sessionPersistence)||void 0===e?void 0:e.props[t]}toString(){var t;let e=null!==(t=this.config.name)&&void 0!==t?t:Xw;return e!==Xw&&(e="posthog."+e),e}_isIdentified(){var t,e;return"identified"===(null===(t=this.persistence)||void 0===t?void 0:t.get_property("$user_state"))||"identified"===(null===(e=this.sessionPersistence)||void 0===e?void 0:e.get_property("$user_state"))}yh(){var t,e;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&Te(this.getGroups())&&!(null===(t=this.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t.__alias)&&!(null===(e=this.persistence)||void 0===e||null===(e=e.props)||void 0===e?void 0:e.$epp))}ih(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(t){return"never"===this.config.person_profiles?(Gs.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._u(),this._h(Rt,!0),!0)}xu(){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)}Cu(){var t,e;const i=this.xu();var n,s,r;return this.is_capturing()||null===(n=this.logs)||void 0===n||n.$h(),(null===(t=this.persistence)||void 0===t?void 0:t.mi)!==i&&(null===(s=this.persistence)||void 0===s||s.set_disabled(i)),(null===(e=this.sessionPersistence)||void 0===e?void 0:e.mi)!==i&&(null===(r=this.sessionPersistence)||void 0===r||r.set_disabled(i)),i&&(this.Mu.clear(),this.mh()),i}opt_in_capturing(t){var i;if("always"!==this.config.cookieless_mode){if(this.bu()){var n,s,r,o,a,l;null===(n=this.sessionRecording)||void 0===n||n.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),null===(s=this.sessionManager)||void 0===s||s.destroy(),null===(r=this.pageViewManager)||void 0===r||r.destroy(),this.sessionManager=new $w(this),this.pageViewManager=new I_(this),this.persistence&&(this.sessionPropsManager=new kw(this,this.sessionManager,this.persistence));const t=null!==(o=null===(a=this.config.__extensionClasses)||void 0===a?void 0:a.sessionRecording)&&void 0!==o?o:null===(l=e.__defaultExtensionClasses)||void 0===l?void 0:l.sessionRecording;var u,h;t&&(this.sessionRecording=this.yu(this.sessionRecording,new t(this)),this.du&&(null===(u=this.sessionRecording)||void 0===u||null===(h=u.onRemoteConfig)||void 0===h||h.call(u,this.du)))}var c,d;this.consent.optInOut(!0),this.Cu(),this.Yu(),null===(i=this.sessionRecording)||void 0===i||i.startIfEnabledOrStop(),"on_reject"==this.config.cookieless_mode&&(null===(c=this.surveys)||void 0===c||c.loadIfEnabled()),(Ie(null==t?void 0:t.captureEventName)||(null==t?void 0:t.captureEventName))&&this.capture(null!==(d=null==t?void 0:t.captureEventName)&&void 0!==d?d:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else Gs.warn(Uw)}opt_out_capturing(){if("always"===this.config.cookieless_mode)return void Gs.warn(Uw);const t="on_reject"===this.config.cookieless_mode?this.sessionRecording:void 0;var e,i;null==t||t.dispose({discardBufferedEvents:!0}),"on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.Cu(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:At,$device_id:null}),this.mu(t),this.sessionRecording=void 0,null===(e=this.sessionManager)||void 0===e||e.destroy(),null===(i=this.pageViewManager)||void 0===i||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}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"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.Cu()}_is_bot(){return i?Tw(i,this.config.custom_blocked_useragents):void 0}th(){n&&("visible"===n.visibilityState?this.Ru||(this.Ru=!0,this.capture(ee,{title:n.title},{send_instantly:!0}),this.Au&&(n.removeEventListener(Yt,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),sr(n,Yt,this.Au)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}nl(){const t=this.Lu||{};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?(Gs.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,e,i,n,s){const r=e in t&&!Re(t[e]),o=i in t&&!Re(t[i]);return r?t[e]:!!o&&(s&&s.warn(`Config field '${i}' is deprecated. Please use '${e}' instead. The old field will be removed in a future major version.`),t[i])}(t,"advanced_disable_flags","advanced_disable_decide",0,Gs)}Os(t){var e;if(Re(this.config.before_send))return t;const i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(Ne),n=xe(this.config.before_send)?this.config.before_send:[this.config.before_send];let s=t;for(const e of n)try{if(s=e(s),Re(s)){const e=`Event '${t.event}' was rejected in beforeSend function`;return Le(t.event)?Gs.warn(`${e}. This can cause unexpected behavior.`):Gs.info(e),null}s.properties&&!Te(s.properties)||Gs.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(e){return Gs.error(`Error in beforeSend function for event '${t.event}':`,e),null}for(const e of i)if(s.properties&&Re(s.properties[e]))return Gs.warn(`Event '${t.event}' had its '${e}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return s}getPageViewId(){var t;return null===(t=this.pageViewManager.Vo)||void 0===t?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Du(t){const e=Oe(t)&&!t,i=Na.Et()&&"true"===Na.Ot("ph_debug");return!e&&(!!i||t)}};sk.__defaultExtensionClasses={},sk.Ch=(()=>{const t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,e){for(let i=0;e.length>i;i++)t.prototype[e[i]]=Ys(t.prototype[e[i]])}(sk,["identify"]);var rk=class{constructor(t){this._instance=t}refresh(t){const e=this._instance.config,i=$e(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.nl(),t.url_allowlist=null==i?void 0:i.url_allowlist,t.url_ignorelist=null==i?void 0:i.url_ignorelist,t.dom_event_allowlist=null==i?void 0:i.dom_event_allowlist,t.element_allowlist=null==i?void 0:i.element_allowlist,t.css_selector_allowlist=null==i?void 0:i.css_selector_allowlist,t.css_selector_ignorelist=null==i?void 0:i.css_selector_ignorelist,t.element_attribute_ignorelist=null==i?void 0:i.element_attribute_ignorelist,t.capture_copied_text=null==i?void 0:i.capture_copied_text}};const ok=Zs("[ExceptionAutocapture]"),ak=Zs("[TracingHeaders]"),lk=Zs("[Web Vitals]"),uk=9e5,hk=["CLS","FCP","INP","LCP"],ck=["INP","LCP"],dk=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],vk=Zs("[SessionRecording]"),fk=Zs("[Heatmaps]");function pk(t){return $e(t)&&"clientX"in t&&"clientY"in t&&Ae(t.clientX)&&Ae(t.clientY)}const gk=Zs("[Product Tours]"),mk=t=>{var e;return!t.config.disable_product_tours&&!!(null===(e=t.persistence)||void 0===e?void 0:e.get_property(R))},yk=["$set_once","$set"],bk=Zs("[SiteApps]"),_k="Error while initializing PostHog app with config id ",wk=(t,e)=>(null==t?void 0:t.then)?t.then(e):e(t),kk="SDK is not enabled or survey functionality is not yet loaded",Sk="Disabled. Not loading surveys.";var xk=class{constructor(t,e){this.So=t,this.Th=e,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=[],this.Eh=null,this.Ph=null,this.Io=!1,this.Rh=new Set,this.onRemoteConfig=t=>{if(this.Io)return;if(this.Rr.disableSurveys)return;if(!t.ok)return Jp.warn("Remote config unavailable. Not loading surveys.");const e=t.config.surveys;if(Re(e))return Jp.warn("Flags not loaded yet. Not loading surveys.");this.Ah=Oe(e)?e:e.length>0,Jp.info(`flags response received, isSurveysEnabled: ${this.Ah}`),this.loadIfEnabled()}}setup(t){if(!this.Io)return this.Fh=t,wk(t.kv.initialize(),()=>{if(this.Fh!==t||this.Io)return;this.Fh=void 0,this.wo=t;const e=t.onRemoteConfig(this.onRemoteConfig);this.Io?e.dispose():(this.Po=e,this.loadIfEnabled())})}dispose(){var t,e,i,n;this.Io||(this.Io=!0,this.Fh=void 0,this.wo=void 0,null===(t=this.Po)||void 0===t||t.dispose(),this.Po=void 0,null===(e=this._surveyEventReceiver)||void 0===e||e.dispose(),this._surveyEventReceiver=null,null===(i=this._surveyManager)||void 0===i||null===(n=i.dispose)||void 0===n||n.call(i),this._surveyManager=null,this.Mh=[],this.Eh=null,this.Rh.forEach(t=>clearTimeout(t)),this.Rh.clear())}get Rr(){return this.So.get()}initialize(){this.loadIfEnabled()}reset(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.clearInMemoryInProgressSurveyState)||void 0===e||e.call(t);try{var i;null===(i=this._surveyEventReceiver)||void 0===i||i.reset(),localStorage.removeItem("lastSeenSurveyDate");const t=[];for(let e=0;e<localStorage.length;e++){const i=localStorage.key(e);((null==i?void 0:i.startsWith("seenSurvey_"))||(null==i?void 0:i.startsWith("inProgressSurvey_")))&&t.push(i)}t.forEach(t=>localStorage.removeItem(t))}catch(t){}}loadIfEnabled(){if(this.Io||!this.wo)return;const t=this.Rr;if(this._surveyManager)return;if(this.Ih)return void Jp.info("Already initializing surveys, skipping...");if(t.disableSurveys)return void Jp.info(Sk);if(t.cookielessMode&&this.So.isOptedOut())return void Jp.info("Not loading surveys in cookieless mode without consent.");const e=this.So.getExtensions();if(!e)return void Jp.error("PostHog Extensions not found.");if(Ie(this.Ah)&&!t.advancedEnableSurveys)return;const i=this.Ah||t.advancedEnableSurveys;this.Ih=!0;try{const t=e.generateSurveys;if(t)return this.Oh(t,i),void(this.Ih=!1);const n=e.loadExternalDependency;if(!n)return this.Dh(Qt),void(this.Ih=!1);n(t=>{try{if(this.Io)return;const e=this.So.getExtensions();t||!(null==e?void 0:e.generateSurveys)?this.Dh("Could not load surveys script",t):this.Oh(e.generateSurveys,i)}finally{this.Ih=!1}})}catch(t){throw this.Ih=!1,this.Dh("Error initializing surveys",t),t}}Oh(t,e){this.Io||(this._surveyManager=t(e),this._surveyEventReceiver=this.So.createEventReceiver(),Jp.info("Surveys loaded successfully"),this.Lh({isLoaded:!0}))}Dh(t,e){Jp.error(t,e),this.Lh({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Mh.push(t),this._surveyManager&&this.Lh({isLoaded:!0}),()=>{this.Mh=this.Mh.filter(e=>e!==t)}}getSurveys(t,e=!1){var i;const n=null!==(i=this.wo)&&void 0!==i?i:this.Th;if(!n||this.Io)return;if(this.Rr.disableSurveys)return Jp.info(Sk),t([]);const s=n.kv.get(ht);if(s&&!e)return t(s,{isLoaded:!0}),void(this.Nh()&&this.getSurveys(()=>{},!0));if(this.Eh)return void this.Eh.then(({surveys:e,context:i})=>{this.Io||t(e,i)}).catch(t=>Jp.error("Error in survey callback",t));const r=this.qh("/api/surveys/",{method:"GET",query:{token:n.projectToken},sentAt:"query",timeoutMs:this.Rr.requestTimeoutMs}).then(t=>{try{return this.jh(n,t)}catch(t){return Jp.error("Error processing surveys response",t),this.jh(n,{statusCode:0,error:t})}},t=>this.jh(n,{statusCode:0,error:t}));this.Eh=r;const o=()=>{this.Eh===r&&(this.Eh=null)};r.then(e=>{o(),this.Io||t(e.surveys,e.context)},o).catch(t=>Jp.error("Error in survey callback",t))}qh(t,e){const i=this.wo;return i?i.sendRequest(t,e):new Promise(t=>t({statusCode:0,error:new Error(kk)}))}jh(t,e){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:kk}};const i=e.statusCode;if(200!==i||!e.json){const t=`Surveys API could not be loaded, status: ${i}`;return 0!==i?Jp.error(t):e.error||Jp.warn(t),this.Ph=Date.now(),{surveys:[],context:{isLoaded:!1,error:t}}}this.Ph=null;const n=e.json.surveys||[],s=n.filter(t=>Yp(t)&&(dl(t)||tg(t)));var r;return s.length>0&&(null===(r=this._surveyEventReceiver)||void 0===r||r.register(s)),t.kv.set({[ht]:n,[ct]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Nh(){return this.Bh()&&!this.Eh&&!this.Hh()}Bh(){var t,e;const i=null===(t=null!==(e=this.wo)&&void 0!==e?e:this.Th)||void 0===t?void 0:t.kv.get(ct);return Ae(i)&&Date.now()-i>3e5}Hh(){return Ae(this.Ph)&&3e5>Date.now()-this.Ph}markSurveyAsSeen(t,e){var i;const n={id:t,current_iteration:null!==(i=null==e?void 0:e.iteration)&&void 0!==i?i:null};ng(n);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Lh(t){for(const e of this.Mh)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Jp.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e=!1){if(!Re(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Jp.warn("init was not called")}zh(t){let e=null;return this.getSurveys(i=>{var n;e=null!==(n=i.find(e=>e.id===t))&&void 0!==n?n:null}),e}Uh(t){if(Re(this._surveyManager))return{eligible:!1,reason:kk};const e="string"==typeof t?this.zh(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}Wh(t){if(!this.So.isCapturing())return{eligible:!1,reason:Kp};if(Re(this._surveyManager))return{eligible:!1,reason:kk};const e="string"==typeof t?this.zh(t):t;return e?this._surveyManager.checkSurveyRenderability(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Re(this._surveyManager))return Jp.warn("init was not called"),{visible:!1,disabledReason:kk};const e=this.Wh(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Re(this._surveyManager)?(Jp.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:kk})):new Promise(i=>{this.getSurveys(e=>{var n;const s=null!==(n=e.find(e=>e.id===t))&&void 0!==n?n:null;if(s){const t=this.Wh(s);i({visible:t.eligible,disabledReason:t.reason})}else i({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,i){var s;if(!this.So.isCapturing())return;if(Re(this._surveyManager))return void Jp.warn("init was not called");const r="string"==typeof t?this.zh(t):t;if(!(null==r?void 0:r.id))return void Jp.warn("Survey not found");if(!sg.includes(r.type))return void Jp.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const o=null==n?void 0:n.querySelector(e);if(o){if(null===(s=r.appearance)||void 0===s?void 0:s.surveyPopupDelaySeconds){Jp.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const t=setTimeout(()=>{var e,n;this.Rh.delete(t),!this.Io&&this.So.isCapturing()&&(Jp.info(`Rendering survey ${r.id} with delay of ${null===(e=r.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds} seconds`),null===(n=this._surveyManager)||void 0===n||n.renderSurvey(r,o,i),Jp.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Rh.add(t)}this._surveyManager.renderSurvey(r,o,i)}else Jp.warn("Survey element not found")}displaySurvey(t,e){var i;if(!this.So.isCapturing())return;if(Re(this._surveyManager))return void Jp.warn("init was not called");const n=this.zh(t);if(!n)return void Jp.warn("Survey not found");let s=n;if((null===(i=n.appearance)||void 0===i?void 0:i.surveyPopupDelaySeconds)&&e.ignoreDelay&&(s=he(he({},n),{},{appearance:he(he({},n.appearance),{},{surveyPopupDelaySeconds:0})})),e.displayType!==Zp&&e.initialResponses&&Jp.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){const t=this.Uh(n);if(!t.eligible)return void Jp.warn("Survey is not eligible to be displayed: ",t.reason)}"inline"!==e.displayType?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}cancelPendingSurvey(t){Re(this._surveyManager)?Jp.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t,e;null===(t=this._surveyManager)||void 0===t||null===(e=t.handlePageUnload)||void 0===e||e.call(t)}};function Ck(t,e,i){if(Re(t))return!1;switch(i){case"exact":return t===e;case"contains":{const i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(i,"i").test(t)}case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}var $k=class{constructor(t){this._instance=t,this.Vh=new Set,this.Gh=new Set,this.Zh=new Sw,this.Qh=(t,e)=>this.Jh(t,e)&&this.Kh(t,e)&&this.Xh(t,e)&&this.Yh(t,e),this.Jh=(t,e)=>!(null==e?void 0:e.event)||(null==t?void 0:t.event)===(null==e?void 0:e.event)}init(){var t,e;Ie(null===(t=this._instance)||void 0===t?void 0:t._addCaptureHook)||(this.tc=null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook((t,e)=>{this.on(t,e)}))}dispose(){var t;null===(t=this.tc)||void 0===t||t.call(this),this.tc=void 0,this.Zh=new Sw}register(t){var e,i;if(!Ie(null===(e=this._instance)||void 0===e?void 0:e._addCaptureHook)&&(t.forEach(t=>{var e;this.Vh.add(t),null===(e=t.steps)||void 0===e||e.forEach(t=>{this.Gh.add((null==t?void 0:t.event)||"")})}),null===(i=this._instance)||void 0===i?void 0:i.autocapture)){const t=new Set;this.Vh.forEach(e=>{var i;null===(i=e.steps)||void 0===i||i.forEach(e=>{(null==e?void 0:e.selector)&&t.add(e.selector)})}),this._instance.autocapture.setElementSelectors(t)}}replace(t){this.Vh.clear(),this.Gh.clear(),this.register(t)}on(t,e){null!=e&&0!=t.length&&(this.Gh.has(t)||this.Gh.has(e.event))&&this.Vh.forEach(t=>{this.ec(e,t)&&this.Zh.emit("actionCaptured",t.name)})}nc(t){this.onAction("actionCaptured",e=>t(e))}ec(t,e){if(null==(null==e?void 0:e.steps))return!1;for(const i of e.steps)if(this.Qh(t,i))return!0;return!1}onAction(t,e){return this.Zh.on(t,e)}Kh(t,e){if(null==e?void 0:e.url){var i;const n=null==t||null===(i=t.properties)||void 0===i?void 0:i.$current_url;if(!n||"string"!=typeof n)return!1;if(!Ck(n,e.url,e.url_matching||"contains"))return!1}return!0}Xh(t,e){return!!this.sc(t,e)&&!!this.rc(t,e)&&!!this.oc(t,e)}sc(t,e){var i;if(!(null==e?void 0:e.href))return!0;const n=this.ac(t);if(n.length>0)return n.some(t=>Ck(t.href,e.href,e.href_matching||"exact"));const s=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&Ck(function(t){const e=t.match(/(?::|")href="(.*?)"/);return e?e[1]:""}(s),e.href,e.href_matching||"exact")}rc(t,e){var i;if(!(null==e?void 0:e.text))return!0;const n=this.ac(t);if(n.length>0)return n.some(t=>Ck(t.text,e.text,e.text_matching||"exact")||Ck(t.$el_text,e.text,e.text_matching||"exact"));const s=(null==t||null===(i=t.properties)||void 0===i?void 0:i.$elements_chain)||"";return!!s&&(r=function(t){const e=[],i=/(?::|")text="(.*?)"/g;let n;for(;!Re(n=i.exec(t));)e.includes(n[1])||e.push(n[1]);return e}(s),o=e.text,a=e.text_matching||"exact",r.some(t=>Ck(t,o,a)));var r,o,a}oc(t,e){var i,n;if(!(null==e?void 0:e.selector))return!0;const s=null==t||null===(i=t.properties)||void 0===i?void 0:i.$element_selectors;if(null==s?void 0:s.includes(e.selector))return!0;const r=(null==t||null===(n=t.properties)||void 0===n?void 0:n.$elements_chain)||"";if(e.selector_regex&&r)try{return new RegExp(e.selector_regex).test(r)}catch(t){return!1}return!1}ac(t){var e;return null==(null==t||null===(e=t.properties)||void 0===e?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}Yh(t,e){return!(null==e?void 0:e.properties)||0===e.properties.length||ml(e.properties.reduce((t,e)=>{const i=xe(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t},{}),null==t?void 0:t.properties)}},Tk=class{constructor(t){var e,i;this.lc=[],this._instance=t,this.uc=new Map,this.hc=new Map,this.cc=new Map,this.dc=null===(e=this._instance)||void 0===e||null===(i=e.onSessionId)||void 0===i?void 0:i.call(e,t=>this.vc(t))}fc(t){return!1}gc(){return null}mc(t){}yc(){}bc(t,e){return!!t&&ml(t.propertyFilters,null==e?void 0:e.properties)}_c(t,e){const i=new Map;return t.forEach(t=>{var n;null===(n=t.conditions)||void 0===n||null===(n=n[e])||void 0===n||null===(n=n.values)||void 0===n||n.forEach(e=>{if(null==e?void 0:e.name){const n=i.get(e.name)||[];n.push(t.id),i.set(e.name,n)}})}),i}wc(t,e,i){const n=(i===Sp?this.uc:this.hc).get(t);let s=[];return this.kc(t=>{s=t.filter(t=>null==n?void 0:n.includes(t.id))}),s.filter(n=>{var s;const r=null===(s=n.conditions)||void 0===s||null===(s=s[i])||void 0===s||null===(s=s.values)||void 0===s?void 0:s.find(e=>e.name===t);return this.bc(r,e)})}register(t){this.Sc(t,!1)}replace(t){this.Sc(t,!0)}Sc(t,e){var i;Ie(null===(i=this._instance)||void 0===i?void 0:i._addCaptureHook)||(this.xc(t,e),this.Cc(t,e))}Cc(t,e){const i=t.filter(t=>{var e;return null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||null===(e=e.values)||void 0===e?void 0:e.length});var n;if(e&&this.cc.clear(),0===i.length)return void(e&&(null===(n=this.$c)||void 0===n||n.replace([])));this.$c||(this.$c=new $k(this._instance),this.$c.init(),this.$c.nc(t=>this.onAction(t)));const s=[];i.forEach(t=>{var e;null===(e=t.conditions)||void 0===e||null===(e=e.actions)||void 0===e||e.values.forEach(e=>{if(s.push(e),e.name){var i;const n=null!==(i=this.cc.get(e.name))&&void 0!==i?i:[];n.includes(t.id)||n.push(t.id),this.cc.set(e.name,n)}})}),e?this.$c.replace(s):this.$c.register(s)}Tc(t,e){e.forEach((e,i)=>{var n;const s=null!==(n=t.get(i))&&void 0!==n?n:[];e.forEach(t=>{s.includes(t)||s.push(t)}),t.set(i,s)})}xc(t,e){var i,n;const s=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.events)&&(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)>0}),r=t.filter(t=>{var e,i;return(null===(e=t.conditions)||void 0===e?void 0:e.cancelEvents)&&(null===(i=t.conditions)||void 0===i||null===(i=i.cancelEvents)||void 0===i||null===(i=i.values)||void 0===i?void 0:i.length)>0}),o=this._c(t,Sp),a=this._c(t,xp);e?(this.uc=o,this.hc=a):(this.Tc(this.uc,o),this.Tc(this.hc,a)),(0!==s.length||0!==r.length)&&(null!==(i=this.tc)&&void 0!==i||(this.tc=null===(n=this._instance)||void 0===n?void 0:n._addCaptureHook((t,e)=>{this.onEvent(t,e)})))}onEvent(t,e){var i,n;const s=this.Ic(),r=(null==e||null===(i=e.properties)||void 0===i?void 0:i.$survey_id)||(null==e||null===(n=e.properties)||void 0===n?void 0:n.$product_tour_id);if(r&&this.getActivatedIds().includes(r)){const e=this.Mc(t,r);if("consume"===e)return s.info("event consumed activated item, removing it",{event:t,itemId:r}),void this.Ec([r]);if("persist"===e)return s.info("shown item promoted to persisted activation",{event:t,itemId:r}),this.Pc(r),void this.Rc([r])}if(this.hc.has(t)){const i=this.wc(t,e,xp);i.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:i.map(t=>t.id)}),this.Ec(i.map(t=>t.id)),i.forEach(t=>this.Ac(t.id)))}if(!this.uc.has(t))return;s.info("event name matched",{event:t,eventPayload:e,items:this.uc.get(t)});const o=this.wc(t,e,Sp);this.Fc(o.map(t=>t.id))}onAction(t){this.cc.has(t)&&this.Fc(this.cc.get(t)||[])}Fc(t){var e,i;if(0===t.length)return;const n=!!(null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e)),s=[];for(const e of t)n&&this.fc(e)?this.Pc(e)&&this.Oc(e):s.push(e);s.length>0&&(this.lc=[...new Set([...this.lc,...s])]),this.Ic().info("updating activated items",{activatedItems:this.getActivatedIds()})}Pc(t){this.lc=this.lc.filter(e=>e!==t);const e=this.Dc();return!e.includes(t)&&(this.Lc([...e,t]),this.Nc(),!0)}Ec(t){const e=new Set(t);this.lc=this.lc.filter(t=>!e.has(t));const i=this.qc(),n=i.filter(t=>!e.has(t));n.length!==i.length&&(this.Lc(n),0===n.length&&this.jc()),this.Rc(t)}Bc(){var t;const e=this.gc();if(!e)return{};const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e];return i&&"object"==typeof i?i:{}}Oc(t){if(!this.gc())return;const e=this.Bc();this.mc(he(he({},e),{},{[t]:Date.now()}))}Rc(t){if(!this.gc())return;const e=this.Bc(),i={};let n=!1;for(const[s,r]of Object.entries(e))t.includes(s)?n=!0:i[s]=r;n&&(Te(i)?this.yc():this.mc(i))}Hc(){this.gc()&&this.yc()}getActivationTimestamp(t){if(!this.Dc().includes(t))return;const e=this.Bc()[t];return Ae(e)?e:void 0}qc(){var t;const e=this.zc();return(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[e])||[]}Dc(){var t,e,i;const n=this.qc();if(0===n.length)return[];const s=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.props[this.Uc()],r=null===(e=this._instance)||void 0===e||null===(i=e.get_session_id)||void 0===i?void 0:i.call(e);return r&&s===r?n:[]}Nc(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(e=t.get_session_id)||void 0===e?void 0:e.call(t);i&&this.Wc(i)}jc(){this.Vc()}vc(t){var e;const i=null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e?void 0:e.props[this.Uc()];if(i&&i!==t){const t=this.qc(),e=this.Bc();t.length>0&&(this.Lc([]),t.filter(t=>Ae(e[t])).forEach(t=>this.Ac(t))),this.jc(),this.Hc()}}getActivatedIds(){return[...new Set([...this.Dc(),...this.lc])].filter(t=>!this.Gc(t))}dispose(){var t,e,i;null===(t=this.dc)||void 0===t||t.call(this),this.dc=void 0,null===(e=this.tc)||void 0===e||e.call(this),this.tc=void 0,null===(i=this.$c)||void 0===i||i.dispose(),this.$c=void 0}reset(){this.lc=[],this.qc().length>0&&this.Lc([]),this.jc(),this.Hc()}getEventToItemsMap(){return this.uc}Zc(){return this.$c}},Ik=class extends Tk{constructor(t){super(t)}zc(){return dt}Uc(){return vt}gc(){return ft}mc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_timestamps:t})}yc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_timestamps")}fc(t){var e;let i;this.kc(e=>{i=e.find(e=>e.id===t)});const n=null==i||null===(e=i.appearance)||void 0===e?void 0:e.surveyPopupDelaySeconds;return Ae(n)&&n>0}Qc(){return qp}kc(t){var e;null===(e=this._instance)||void 0===e||e.getSurveys(t)}Ac(t){var e;null===(e=this._instance)||void 0===e||e.cancelPendingSurvey(t)}Ic(){return Jp}Lc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated:t})}Wc(t){var e;null===(e=this._instance)||void 0===e||null===(e=e.persistence)||void 0===e||e.register({$surveys_activated_session:t})}Vc(){var t;null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||t.unregister("$surveys_activated_session")}Gc(){return!1}Mc(t,e){let i;return this.kc(t=>{i=t.find(t=>t.id===e)}),!i||vl(i)?t===qp?"consume":"ignore":t===qp?"persist":t===jp||t===Bp?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},Mk=class{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);const e={};for(const i of t){const t=this._instance.get_property(i);Ie(t)||(e[i]=t)}return e}set(t,e){this._instance.register("string"==typeof t?{[t]:e}:t)}remove(t){"string"!=typeof t?t.forEach(t=>this._instance.unregister(t)):this._instance.unregister(t)}},Ek=class{constructor(t){this._instance=t}get(){const t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return;const{generateSurveys:e,loadExternalDependency:i}=t;return{generateSurveys:e?t=>e(this._instance,t):void 0,loadExternalDependency:i?t=>i(this._instance,"surveys",t):void 0}}createEventReceiver(){return new Ik(this._instance)}};const Pk=(null==t?void 0:t.location)?dr(t.location.hash,"__posthog")||dr(location.hash,"state"):null,Rk="_postHogToolbarParams",Ak=Zs("[Toolbar]"),Fk=Zs("[FeatureFlags]");var Ok=class{constructor(t,e=!1){this.Jc=!1,this.update(t,e)}update(t,e){this.Kc=((t,e)=>{var i,n,s,r,o,a,l,u;return{bootstrap:{featureFlags:null!==(i=null===(n=t.bootstrap)||void 0===n?void 0:n.featureFlags)&&void 0!==i?i:void 0,featureFlagPayloads:null!==(s=null===(r=t.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:void 0},remoteRequestsDisabled:e,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:Ie(t.remote_config_refresh_interval_ms),requestTimeoutMs:t.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,null!==(a=t.feature_flag_request_max_retries)&&void 0!==a?a:1),compression:t.disable_compression?void 0:"best-available",evaluationContexts:null!==(l=null!==(u=t.evaluation_contexts)&&void 0!==u?u:t.evaluation_environments)&&void 0!==l?l:[],flagKeys:xe(t.flag_keys)?t.flag_keys:void 0}})(t,e),!t.evaluation_environments||t.evaluation_contexts||this.Jc||(Fk.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Jc=!0),Ie(t.flag_keys)||xe(t.flag_keys)||Fk.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Kc}};const Dk=Zs("[FeatureFlags]"),Lk=Zs("[FeatureFlags]",{debugEnabled:!0}),Nk="\" failed. Feature flags didn't load in time.",qk=[502,504],jk=["click","keydown","wheel","touchstart","pointerdown"],Bk="connection_error",Hk=t=>{const e={};for(let i=0;t.length>i;i++)e[t[i]]=!0;return e},zk=t=>{const e={};for(const[i,n]of Xs(t||{}))n&&(e[i]=n);return e},Uk="Refusing to render web experiment since the viewer is a likely bot",Wk={icontains:(t,e)=>e.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>-1===e.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>fl(e,t),not_regex:(t,e)=>!fl(e,t),exact:(t,e)=>e===t,is_not:(t,e)=>e!==t},Vk=Zs("[Conversations]"),Gk="Conversations not available yet.";function Zk(t,e){var n,s,r,o,a,l,u;const h=null!==(n=null==t?void 0:t.flushIntervalMs)&&void 0!==n?n:3e3,c=null!==(s=null==t?void 0:t.maxBufferSize)&&void 0!==s?s:100,d=(null==e?void 0:e.consoleCapture)?void 0:null!==(r=null==t?void 0:t.maxLogsPerInterval)&&void 0!==r?r:1e3,v=Ie(d)?Math.max(c,2048):Math.max(c,d),f=he(he({},function(){let t="",e="";try{const n=null==i?void 0:i.userAgent;n&&([t,e]=Qi(n))}catch(t){}return function(t,e){const i=function(t){if(t)return{}.hasOwnProperty.call(Is,t)?Is[t]:t}(t);return he(he({},i?{"os.name":i}:{}),e?{"os.version":e}:{})}(t,e)}()),null==t?void 0:t.resourceAttributes);return{serviceName:null!==(o=null!==(a=null==f?void 0:f["service.name"])&&void 0!==a?a:null==t?void 0:t.serviceName)&&void 0!==o?o:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(l=null==f?void 0:f["service.version"])&&void 0!==l?l:null==t?void 0:t.serviceVersion,environment:null!==(u=null==f?void 0:f["deployment.environment"])&&void 0!==u?u:null==t?void 0:t.environment,resourceAttributes:f,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:h,maxBufferSize:c,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}const Qk=["debug","log","warn","error","info"],Jk="console",Kk="__posthogHandledLogsRequestError",Xk=(t,e)=>{const i=t instanceof Error?t:new Error(e);return i[Kk]=!0,i},Yk=t=>!!t&&"object"==typeof t&&!0===t[Kk],tS=Zs("[NetworkMetrics]"),eS=()=>{var e;return(null==t||null===(e=t.performance)||void 0===e?void 0:e.now)?t.performance.now():Date.now()},iS={"http:":80,"https:":443},nS=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),sS=(t,e)=>{var i;const n=String(e);return{method:String(t).toUpperCase(),url:(null===(i=lr(n))||void 0===i?void 0:i.href)||n}},rS=(t,e,i,n,s,r,o=!1)=>{try{var a,l;const u=s();if(!u)return;const h=i||void 0,c=eS()-n,d=lr(e.url);if(d&&"http:"!==d.protocol&&"https:"!==d.protocol)return;const v={url:(null==d?void 0:d.href)||e.url,method:e.method},f=Ce(u.name)?u.name(v):Me(u.name)?u.name:"http.client.request.duration";if(!f)return;const p=o&&!h?void 0:((t,e)=>t?400>t?void 0:String(t):(null==e?void 0:e.name)||"_OTHER")(h,r),g=he(he(he(he(he({},(t=>{const e=nS.has(t)?t:"_OTHER";return he({"http.request.method":e},"_OTHER"===e&&t!==e?{"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)||iS[t.protocol],"url.scheme":t.protocol.slice(0,-1),"url.template":(e=t.pathname,e.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 e})(d):{}),h?{"http.response.status_code":h}:{}),p?{"error.type":p}:{}),null===(a=u.attributes)||void 0===a?void 0:a.call(u,v,{status:h,durationMs:c}));null===(l=t.metrics)||void 0===l||l.histogram(f,c,{unit:"ms",attributes:g})}catch(t){tS.error("Failed to record network metric",t)}},oS=()=>{},aS=(e,i)=>Ce(null==t?void 0:t.fetch)?Mv(t,"fetch",t=>function(...n){const s=eS(),r=t.apply(this,n);if(!i())return r;try{var o,a,l;const[t,u]=n,h=sS(null!==(o=null!==(a=null==u?void 0:u.method)&&void 0!==a?a:null==t?void 0:t.method)&&void 0!==o?o:"GET",null!==(l=null==t?void 0:t.url)&&void 0!==l?l:t);return r.then(t=>(rS(e,h,null==t?void 0:t.status,s,i,void 0,!0),t),t=>{throw rS(e,h,void 0,s,i,t),t})}catch(t){return tS.error("Failed to observe fetch",t),r}}):oS,lS=(e,i)=>{var n;const s=null==t||null===(n=t.XMLHttpRequest)||void 0===n?void 0:n.prototype;if(!s)return oS;const r=new WeakMap,o=Mv(s,"open",t=>function(...e){try{(()=>K_.has(this))()||r.set(this,sS(e[0],e[1]))}catch(t){tS.error("Failed to observe XHR open",t)}return t.apply(this,e)}),a=Mv(s,"send",t=>function(...n){let s;try{const t=r.get(this);if(t&&i()){const n=eS();s=()=>{this.removeEventListener("loadend",s),rS(e,t,this.status,n,i)},sr(this,"loadend",s)}}catch(t){tS.error("Failed to observe XHR send",t)}try{return t.apply(this,n)}catch(t){throw s&&this.removeEventListener("loadend",s),t}});return()=>{o(),a()}},uS={featureFlags:class{constructor(t){this.name="featureFlags",this.Xc=!1,this.featureFlagEventHandlers=[],this.$=Dk,this.Yc={},this.td={},this.ed=[],this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.ad=!1,this.ld=!1,this.ud=!1,this.hd=0,this.dd=!1,this.an=()=>{const t=this.vd();this.hd=0,t&&this.reloadFeatureFlags()},this.fd=()=>{var t,e;const i=this.pd,s=null!==(t=this.gd)&&void 0!==t?t:i;Ie(i)||Ie(s)||this.Rr.remoteRequestsDisabled||!n||"hidden"===n.visibilityState||Date.now()-(null!==(e=this.md)&&void 0!==e?e:0)<s||(this.gd=this.dd||!this.Rr.idleRefreshBackoff?i:Math.min(2*s,36e5),this.dd=!1,this.reloadFeatureFlags(),this.yd())},this.bd=()=>{this.dd&&this.gd===this.pd||this._d()},this.ln=()=>{"visible"===(null==n?void 0:n.visibilityState)&&this._d()},"get"in t?this.So=t:(this._instance=t,this.wd=new Ok(t.config,t.nl()),this.So=this.wd)}updateConfig(t,e){var i;null===(i=this.wd)||void 0===i||i.update(t,e),this.wo&&this.kd()}setup(t){return this.Fh=t,this.$=t.logger.createLogger("[FeatureFlags]"),wk(t.kv.initialize(),()=>{this.Fh===t&&(this.Fh=void 0,this.wo=t,this.Sd(t))})}Sd(e){var i;if(this.wo===e)return t&&sr(t,"online",this.an),this.kd(),this.xd=e.registerDynamicEventProperties(()=>this.Cd()?this.Yc:this.td),this.$d=null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i?void 0:i.onCrossTabFeatureFlagChange(()=>{this.Td(),this.Id(),this.Md()}),this.Id(),this.initialize()}_d(){this.dd=!0,this.gd=this.pd,this.fd()}kd(){const t=this.Rr.refreshIntervalMs,e=!this.Rr.remoteRequestsDisabled&&n&&!Ie(t)&&t>0?t:void 0;this.Rr.idleRefreshBackoff||(this.gd=e),e!==this.pd&&(this.Ed(),Ie(e)||(this.pd=e,this.gd=e,this.yd(),(null==n?void 0:n.addEventListener)&&(sr(n,Yt,this.ln),Qs(jk,t=>{sr(n,t,this.bd,{capture:!0})}))))}yd(){Ie(this.pd)||(Ie(this.Pd)||clearInterval(this.Pd),this.md=Date.now(),this.Pd=setInterval(this.fd,this.pd))}Ed(){var t;Ie(this.Pd)||(clearInterval(this.Pd),this.Pd=void 0,null==n||null===(t=n.removeEventListener)||void 0===t||t.call(n,"visibilitychange",this.ln),Qs(jk,t=>{var e;null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,t,this.bd,{capture:!0})})),this.pd=void 0,this.gd=void 0,this.dd=!1,this.md=void 0}destroy(){this.Rd()}dispose(){this.Rd()}Rd(){var e,i;this.Ed(),this.rd++,this.ad=!1,this.Fh=void 0,this.wo&&(this.Ad(),null===(e=this.xd)||void 0===e||e.dispose(),this.xd=void 0,null===(i=this.$d)||void 0===i||i.call(this),this.$d=void 0,this.ed=[],null==t||t.removeEventListener("online",this.an),this.wo=void 0)}get Rr(){return this.So.get()}Fd(t){var e;return this.Od&&t in this.Od?this.Od[t]:null===(e=this.wo)||void 0===e?void 0:e.kv.get(t)}Td(){return!!this.Od&&(this.Od=void 0,!0)}Dd(){var t;return!Ie(null===(t=this.wo)||void 0===t?void 0:t.kv.get("$enabled_feature_flags"))&&this.Td()}At(t){this.Ld(()=>{var e;return null===(e=this.wo)||void 0===e?void 0:e.kv.set(t)})}Nd(t,e,i){var n;if(!(null===(n=this._instance)||void 0===n?void 0:n.persistence)||!t.$enabled_feature_flags)return;const s=this.Fd("$enabled_feature_flags")||{},r=t.$enabled_feature_flags||{},o=e.flags||e.featureFlags,a=e.flags?Object.entries(e.flags).filter(([,t])=>!(null==t?void 0:t.failed)).map(([t])=>t):[],l=!!e.errorsWhileComputingFlags&&!!e.flags,u=l?a:i&&!xe(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(s),...Object.keys(r)])),h=this.Fd("$feature_flag_payloads")||{},c=t.$feature_flag_payloads||{},d=l||i?u:Array.from(new Set([...Object.keys(h),...Object.keys(c)])),v=!l&&!i,f=!!v||u,p=!!v||d,g={[Y]:f,[X]:f,[it]:p};t.$feature_flag_details&&(g[et]=f);for(const e of[nt,Ct,st])Ie(t[e])||(g[e]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(g)}Lt(t){this.Ld(()=>{var e;return null===(e=this.wo)||void 0===e?void 0:e.kv.remove(t)})}Ld(t){try{t()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}Id(){const t={};for(const e of[Y,it,nt,rt]){const i=this.Fd(e);Ie(i)||(t[e]=i)}this.Yc=t;const e=he({},t),i=this.Fd(X);if(i)for(const[t,n]of Object.entries(i))e[`$feature/${t}`]=n;this.td=e}Cd(){const t=this.Rr.cacheTtlMs;if(!t||0>=t)return!1;const e=this.Fd(Ct);return"number"!=typeof e||Date.now()-e>t}qd(){return!!this.Cd()&&(this.ud||this.sd||(this.ud=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}jd(){const t=this.Rr.evaluationContexts;return(null==t?void 0:t.length)?t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),e}):[]}Bd(){const t=this.Rr.flagKeys;if(!Ie(t))return t.filter(t=>{const e=t&&"string"==typeof t&&t.trim().length>0;return e||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),e})}initialize(){var t,e;const i=this.Rr,n=null!==(t=null===(e=i.bootstrap)||void 0===e?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(n).length){var s,r;const t=null!==(s=null===(r=i.bootstrap)||void 0===r?void 0:r.featureFlagPayloads)&&void 0!==s?s:{},e=Object.keys(n).filter(t=>!Ie(n[t])).reduce((t,e)=>(t[e]=n[e],t),{}),o=Object.keys(t).filter(t=>e[t]).reduce((e,i)=>(e[i]=t[i],e),{});return this.Hd({featureFlags:e,featureFlagPayloads:o},void 0,{persist:!1})}}updateFlags(t,e,i){var n,s;const r=(null==i?void 0:i.merge)&&null!==(n=this.Fd("$enabled_feature_flags"))&&void 0!==n?n:{},o=(null==i?void 0:i.merge)&&null!==(s=this.Fd("$feature_flag_payloads"))&&void 0!==s?s:{},a=he(he({},r),t),l=he(he({},o),e),u={};for(const[t,e]of Object.entries(a))u[t]={key:t,enabled:rs(e),variant:os(e),reason:void 0,metadata:Ie(null==l?void 0:l[t])?void 0:{id:0,version:void 0,description:void 0,payload:l[t]}};this.Hd({flags:u})}get hasLoadedFlags(){return this.nd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const t=this.Fd(et),e=this.Fd(rt),i=this.Fd(ot);if(!i&&!e)return t||{};const n=Ks({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(const t of s){var r;const s=n[t],a=null==e?void 0:e[t],l=Ie(a)?null!==(r=null==s?void 0:s.enabled)&&void 0!==r&&r:!!a,u=Ie(a)?null==s?void 0:s.variant:"string"==typeof a?a:void 0,h=null==i?void 0:i[t],c=he(he({},s),{},{enabled:l,variant:l?null!=u?u:null==s?void 0:s.variant:void 0});var o;l!==(null==s?void 0:s.enabled)&&(c.original_enabled=null==s?void 0:s.enabled),u!==(null==s?void 0:s.variant)&&(c.original_variant=null==s?void 0:s.variant),h&&(c.metadata=he(he({},null==s?void 0:s.metadata),{},{payload:h,original_payload:null==s||null===(o=s.metadata)||void 0===o?void 0:o.payload})),n[t]=c}return this.Xc||(this.$.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:n}),this.Xc=!0),n}getAllFeatureFlags(){const t=this.getFlagVariants(),e=this.getFlagPayloads();return Object.keys(t).map(i=>{const n=t[i];return{key:i,enabled:rs(n),variant:os(n),payload:ss(e[i])}})}getFlagVariants(){const t=this.Fd(X),e=this.Fd(rt);if(!e)return t||{};const i=Ks({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Xc||(this.$.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Xc=!0),i}getFlagPayloads(){const t=this.Fd(it),e=this.Fd(ot);if(!e)return t||{};const i=Ks({},t||{}),n=Object.keys(e);for(let t=0;n.length>t;t++)i[n[t]]=e[n[t]];return this.Xc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Xc=!0),i}reloadFeatureFlags(){this.od||this.Rr.featureFlagsDisabled||this.vd()||(this.sd&&(this.ad=!0),this.zd||(this.ed.slice().forEach(t=>{try{t()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.zd=setTimeout(()=>{this.Ud()},5)))}Ad(){clearTimeout(this.zd),this.zd=void 0}onReloading(t){return this.ed.push(t),()=>{this.ed=this.ed.filter(e=>e!==t)}}ensureFlagsLoaded(){this.nd||this.sd||this.zd||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.od=t}resetFlagCallReported(){this.Lt(kt)}Ud(t){this.Ad();const e=this.wo;if(!e||this.Rr.remoteRequestsDisabled||this.vd())return;if(this.sd)return void(this.ad=!0);const i={token:e.projectToken,distinct_id:e.distinctId,groups:e.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:he(he(he({},e.initialPersonProperties),this.Fd("$stored_person_properties")||{}),{},{$lib:e.library.name,$lib_version:e.library.version}),group_properties:this.Fd(lt),timezone:jl()};Ie(e.deviceId)||(i.$device_id=e.deviceId),((null==t?void 0:t.disableFlags)||this.Rr.featureFlagsDisabled)&&(i.disable_flags=!0);const n=this.jd();n.length&&(i.evaluation_contexts=n);const s=this.Bd();Ie(s)||(i.flag_keys=s);const r=this.Rr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(r?"&only_evaluate_survey_feature_flags=true":""),a=this.rd;this.sd=!0;const l=()=>{this.ad&&(this.ad=!1,this.Ud())},u=t=>{var e,n;const s=null!==(e=t.json)&&void 0!==e?e:{},o=200!==t.statusCode;if(this.sd=!1,a!==this.rd)return void l();if(this.Wd(t.statusCode),o||this.ad||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.ad)return;this.ld=!o;const u=[];t.error?u.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?Bk:"unknown_error"):200!==t.statusCode&&u.push(`api_error_${t.statusCode}`),s.errorsWhileComputingFlags&&u.push("errors_while_computing_flags");const h=!!(null===(n=s.quotaLimited)||void 0===n?void 0:n.includes("feature_flags"));h&&u.push("quota_limited"),this.At({[xt]:u}),h?this.$.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."):i.disable_flags||this.Hd(s,o,{partialResponse:r}),l()},h=t=>{this.sd=!1,a===this.rd?(this.At({[xt]:[Bk]}),this.$.error("Feature flag request failed",t),this.Dd()&&this.Md(!0),l()):l()};let c=this.Rr.requestMaxRetries;const d=()=>c>0&&a===this.rd,v=()=>{if(a!==this.rd||!this.wo||this.Rr.remoteRequestsDisabled)return this.sd=!1,void l();try{e.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this.Rr.compression,sentAt:"body",timeoutMs:this.Rr.requestTimeoutMs}).then(t=>{if((t=>qk.includes(t.statusCode)||(t=>0===t.statusCode&&t.error instanceof Error&&"AbortError"===t.error.name)(t))(t)&&d())return c--,void setTimeout(v,500);u(t)}).catch(h)}catch(t){h(t)}};v()}vd(){return vr(this.hd,3)}Wd(t){this.hd=fr(t,this.hd,3,()=>this.$.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,e={}){var i;if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+t+Nk);if(this.qd())return;const n=this.getFeatureFlagResult(t,e);return null!==(i=null==n?void 0:n.variant)&&void 0!==i?i:null==n?void 0:n.enabled}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){const e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e={}){if(e.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+t+Nk);if(this.qd())return;const i=this.getFlagVariants(),n=t in i,s=i[t],r=this.getFlagPayloads()[t],o=String(s),a=this.Fd("$feature_flag_request_id")||void 0,l=this.Fd("$feature_flag_evaluated_at")||void 0;let u,h=this.Fd("$flag_call_reported")||{};if(this.Rr.deduplicateCallsPerSession){var c;const t=null===(c=this.wo)||void 0===c?void 0:c.session.sessionId,e=this.Fd(St);t&&t!==e&&(h={},u=t)}if(e.send_event||!("send_event"in e))if(t in h&&h[t].includes(o))u&&this.At({[kt]:h,[St]:u});else{var d,v,f,p,g,m,y,b,_,w,k,S;xe(h[t])?h[t].push(o):h[t]=[o],this.At(he({[kt]:h},u?{[St]:u}:{}));const e=this.getFeatureFlagDetails(t),i=[...null!==(d=this.Fd("$feature_flag_errors"))&&void 0!==d?d:[]];Ie(s)&&i.push("flag_missing");const n={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:null!=r?r:null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:null!==(v=null===(f=this.Rr.bootstrap)||void 0===f||null===(f=f.featureFlags)||void 0===f?void 0:f[t])&&void 0!==v?v:null,$feature_flag_bootstrapped_payload:null!==(p=null===(g=this.Rr.bootstrap)||void 0===g||null===(g=g.featureFlagPayloads)||void 0===g?void 0:g[t])&&void 0!==p?p:null,$used_bootstrap_value:!this.ld};Ie(null==e||null===(m=e.metadata)||void 0===m?void 0:m.has_experiment)||(n.$feature_flag_has_experiment=e.metadata.has_experiment),Ie(null==e||null===(y=e.metadata)||void 0===y?void 0:y.version)||(n.$feature_flag_version=e.metadata.version);const c=null!==(b=null==e||null===(_=e.reason)||void 0===_?void 0:_.description)&&void 0!==b?b:null==e||null===(w=e.reason)||void 0===w?void 0:w.code;var x;c&&(n.$feature_flag_reason=c),(null==e||null===(k=e.metadata)||void 0===k?void 0:k.id)&&(n.$feature_flag_id=e.metadata.id),Ie(null==e?void 0:e.original_variant)&&Ie(null==e?void 0:e.original_enabled)||(n.$feature_flag_original_response=Ie(e.original_variant)?e.original_enabled:e.original_variant),(null==e||null===(S=e.metadata)||void 0===S?void 0:S.original_payload)&&(n.$feature_flag_original_payload=null==e||null===(x=e.metadata)||void 0===x?void 0:x.original_payload),i.length&&(n.$feature_flag_error=i.join(",")),this.Vd(n)}else u&&this.At({[kt]:h,[St]:u});return n?{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:ss(r)}:void 0}Vd(t){try{var e;null===(e=this.wo)||void 0===e||e.capture("$feature_flag_called",t)}catch(t){this.$.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,e){this.Gd(t,e)}Gd(t,e){var i=this;return oe(function*(){const n=i.wo;if(!n)return;const s={distinct_id:n.distinctId,token:n.projectToken,person_properties:{$lib:n.library.name,$lib_version:n.library.version}},r=i.jd();r.length&&(s.evaluation_contexts=r);const o=i.Bd();let a;Ie(o)||(s.flag_keys=o);try{var l;const e=null===(l=(yield n.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:i.Rr.compression,sentAt:"body",timeoutMs:i.Rr.requestTimeoutMs})).json)||void 0===l?void 0:l.featureFlagPayloads;a=(null==e?void 0:e[t])||void 0}catch(t){return void i.$.error("Remote config feature flag request failed",t)}try{e(a)}catch(t){i.$.error("Remote config feature flag callback failed",t)}})()}isFeatureEnabled(t,e={}){if(e.fresh&&!this.ld)return e.defaultValue;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+t+Nk),e.defaultValue;const i=this.getFeatureFlag(t,e);return Ie(i)?e.defaultValue:!!i}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,i){this.Hd(t,e,i)}Hd(t,e,i){if(!this.wo)return;this.nd=!0;const n=((t,e={},i={},n={},s,r=Dk)=>{const o=((t,e)=>{const i=t.flags;if(i){const e=Object.fromEntries(Object.keys(i).map(t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]})),n=Object.fromEntries(Object.keys(i).filter(t=>i[t].enabled).filter(t=>{var e;return!Ie(null===(e=i[t].metadata)||void 0===e?void 0:e.payload)}).map(t=>{var e;return[t,null===(e=i[t].metadata)||void 0===e?void 0:e.payload]}));return he(he({},t),{},{featureFlags:e,featureFlagPayloads:n})}return t.featureFlags&&e.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t,r),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(!l)return;const h=t.requestId,c=t.evaluatedAt;if(xe(l)){r.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const t={};if(l)for(let e=0;l.length>e;e++)t[l[e]]=!0;return{[Y]:l,[X]:t,[st]:!1}}let d=l,v=u,f=a;if(null==s?void 0:s.partialResponse){const t=Object.keys(d),s=v||{};d=he(he({},e),d),v=he(he({},i),s),t.forEach(t=>{t in s||null==v||delete v[t]}),f=he(he({},n),f)}else if(t.errorsWhileComputingFlags)if(a){const t=new Set(Object.keys(a).filter(t=>{var e;return!(null===(e=a[t])||void 0===e?void 0:e.failed)}));d=he(he({},e),Object.fromEntries(Object.entries(d).filter(([e])=>t.has(e))));const s=Object.fromEntries(Object.entries(v||{}).filter(([e])=>t.has(e)));v=he(he({},i),s),t.forEach(t=>{t in s||null==v||delete v[t]}),f=he(he({},n),Object.fromEntries(Object.entries(f||{}).filter(([e])=>t.has(e))))}else d=he(he({},e),d),v=he(he({},i),v),f=he(he({},n),f);return he(he({[Y]:Object.keys(zk(d)),[X]:d||{},[it]:v||{},[et]:f||{},[st]:!0===t.minimalFlagCalledEvents},h?{[nt]:h}:{}),c?{[Ct]:c}:{})})(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.$);if(n)if(!1===(null==i?void 0:i.persist)){const t=!Ie(this.wo.kv.get(X));this.Od=n,t||this.At(n)}else this.Td(),this.Nd(n,t,!!(null==i?void 0:i.partialResponse)),this.At(n);else e&&this.Dd();e||(this.ud=!1),this.Md(e)}override(t,e=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){this.Zd(t)}Zd(t){if(this.wo){if(!1===t)return this.Lt([rt,ot]),this.Md(),void Lk.info("All overrides cleared");if(xe(t))return this.At({[rt]:Hk(t)}),this.Md(),void Lk.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e;const i=t;this.Xc=Boolean(null!==(e=i.suppressWarning)&&void 0!==e&&e);const n={},s=i.flags,r=i.payloads;return s&&(n[rt]=xe(s)?Hk(s):s),r&&(n[ot]=r),Object.keys(n).length&&this.At(n),!1===s&&!1===r?this.Lt([rt,ot]):!1===s?this.Lt(rt):!1===r&&this.Lt(ot),this.Md(),!1===s?Lk.info("Flag overrides cleared"):s&&Lk.info("Flag overrides set",{flags:s}),void(!1===r?Lk.info("Payload overrides cleared"):r&&Lk.info("Payload overrides set",{payloads:r}))}if(t&&"object"==typeof t)return this.At({[rt]:t}),this.Md(),void Lk.info("Flag overrides set",{flags:t});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.nd){const{flags:e,flagVariants:i}=this.Qd();try{t(e,i)}catch(t){this.$.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var n;const s=(this.Fd("$early_access_features")||[]).find(e=>e.flagKey===t),r={[`$feature_enrollment/${t}`]:e},o={$feature_flag:t,$feature_enrollment:e,$set:r};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i);const a=he(he({},this.getFlagVariants()),{},{[t]:e});null===(n=this._instance)||void 0===n||null===(n=n.persistence)||void 0===n||n.markCrossTabFeatureFlagChanges({$active_feature_flags:[t],$enabled_feature_flags:[t],$stored_person_properties:Object.keys(r)}),this.At({[Y]:Object.keys(zk(a)),[X]:a,[at]:he(he({},this.Fd("$stored_person_properties")||{}),r)}),this.Md();try{var l;null===(l=this.wo)||void 0===l||l.capture("$feature_enrollment_update",o)}catch(t){this.$.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,e=!1,i){const n=this.Fd(tt);!n||e?this.Jd(t,i):t(n)}Jd(t,e){var i=this;return oe(function*(){const n=i.wo;if(!n)return;const s=e?`&${e.map(t=>`stage=${t}`).join("&")}`:"";let r;try{const t=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${s}`,{target:"api",method:"GET",sentAt:"query"});if(!t.json)return;r=t.json.earlyAccessFeatures,i.At({[tt]:r})}catch(t){return void i.$.error("Early access feature request failed",t)}try{t(r)}catch(t){i.$.error("Early access feature callback failed",t)}})()}Qd(){const t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(t=>e[t]),flagVariants:Object.keys(e).filter(t=>e[t]).reduce((t,i)=>(t[i]=e[i],t),{})}}Md(t){this.Id();const{flags:e,flagVariants:i}=this.Qd();this.featureFlagEventHandlers.forEach(n=>{try{n(e,i,{errorsLoading:t})}catch(t){this.$.error("Error while running feature flags callback",t)}})}setPersonPropertiesForFlags(t,e=!0){this.Kd(t,e)}Kd(t,e=!0){const i=this.Fd("$stored_person_properties")||{},n=(null==t?void 0:t.$set)||((null==t?void 0:t.$set_once)?{}:t),s=null==t?void 0:t.$set_once,r={};if(s)for(const t in s)({}).hasOwnProperty.call(s,t)&&(t in i||(r[t]=s[t]));this.At({[at]:he(he(he({},i),r),n)}),e&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e=!0){const i=he({},this.Fd("$stored_person_properties")||{});t.forEach(t=>{delete i[t]}),this.At({[at]:i}),e&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t=!0){this.Lt(at),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e=!0){const i=this.Fd("$stored_group_properties")||{},n=he({},i);for(const e of Object.keys(t))n[e]=he(he({},i[e]),t[e]);this.At({[lt]:n}),e&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){const e=this.Fd("$stored_group_properties")||{};this.At({[lt]:he(he({},e),{},{[t]:{}})})}else this.Lt(lt)}reset(){this.rd++,this.ad=!1,this.Yc={},this.td={},this.Od=void 0,this.nd=!1,this.od=!1,this.ld=!1,this.$anon_distinct_id=void 0,this.Ad(),this.Xc=!1,this.hd=0}}},hS={sessionRecording:class{get Rr(){return this._instance.config}get Ml(){return this._instance.persistence}get started(){var t;return!!(null===(t=this.Xd)||void 0===t?void 0:t.isStarted)}get status(){var t,e;return"awaiting_config"===this.Yd||"missing_config"===this.Yd?this.Yd:null!==(t=null===(e=this.Xd)||void 0===e?void 0:e.status)&&void 0!==t?t:this.Yd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Yd=po,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var e,i;if(!(null==n?void 0:n.visibilityState)||"visible"===n.visibilityState)return!0;const s=null==t||null===(e=t.performance)||void 0===e||null===(i=e.getEntriesByType)||void 0===i?void 0:i.call(e,"visibility-state");return!(null==s?void 0:s.length)||s.some(t=>"visible"===t.name)})(),this.ln=()=>{var t,e;"visible"===(null==n?void 0:n.visibilityState)&&(this.Xe=!0,null===(t=this.Xd)||void 0===t||null===(e=t.setDocumentWasEverVisible)||void 0===e||e.call(t,!0))},!this._instance.sessionManager)throw vk.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if("always"===this.Rr.cookieless_mode)throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');(null==n?void 0:n.addEventListener)&&sr(n,"visibilitychange",this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:t=!1}={}){var e;this.ev=!0,null==n||null===(e=n.removeEventListener)||void 0===e||e.call(n,"visibilitychange",this.ln),t?this.iv(!0):this.stopRecording()}get nv(){var e;const i=!!(null===(e=this._instance.get_property("$session_recording_remote_config"))||void 0===e?void 0:e.enabled),n=!this.Rr.disable_session_recording,s=this.Rr.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&n&&!s}startIfEnabledOrStop(t){var e;if(this.ev)return;if(this.nv&&(null===(e=this.Xd)||void 0===e?void 0:e.isStarted))return;const i=!Ie(Object.assign)&&!Ie(Array.from);this.nv&&i?(this.sv(t),vk.info("starting")):(this.Yd=po,this.stopRecording())}sv(t){var e,i;if(this.nv)if("awaiting_config"!==this.Yd&&"missing_config"!==this.Yd&&(this.Yd=_o),(null==d||null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.rrweb)||void 0===e?void 0:e.record)&&(null===(i=d.__PosthogExtensions__)||void 0===i?void 0:i.initSessionRecording))this.rv(t);else{var n,s;const e=this._instance.sessionManager;null===(n=d.__PosthogExtensions__)||void 0===n||null===(s=n.loadExternalDependency)||void 0===s||s.call(n,this._instance,this.ov,i=>{if(!this.ev&&this.nv&&this._instance.sessionManager===e)return i?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),vk.error("could not load recorder",i)):void this.rv(t);this.Yd="disabled"})}}stopRecording(){var t,e;null===(t=this.tv)||void 0===t||t.call(this),this.tv=void 0,null===(e=this.Xd)||void 0===e||e.stop()}iv(t=!1){var e,i;null===(e=this.tv)||void 0===e||e.call(this),this.tv=void 0,null===(i=this.Xd)||void 0===i||i.discard({discardProducerEvents:t})}av(){var t,e;null===(t=this.Ml)||void 0===t||t.unregister("$session_is_sampled"),null===(e=this.Ml)||void 0===e||e.unregister("$replay_sample_rate")}lv(t,e){if(Re(t))return null;const i=Ae(t)?t:parseFloat(t);return"number"!=typeof(n=i)||!Number.isFinite(n)||0>n||n>1?(vk.warn(`${e} must be between 0 and 1. Ignoring invalid value:`,t),null):i;var n}uv(t){if(this.Ml){var e,i;const n=this.Ml,s=()=>{var e;const i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.lv(null===(e=this.Rr.session_recording)||void 0===e?void 0:e.sampleRate,"session_recording.sampleRate"),r=this.lv(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:r;Re(o)&&this.av();const a=null==i?void 0:i.minimumDurationMilliseconds;n.register({[O]:he(he({cache_timestamp:Date.now(),enabled:!!i},i),{},{networkPayloadCapture:he({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:Ie(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null===(e=this.tv)||void 0===e||e.call(this),this.tv=null===(i=this._instance.sessionManager)||void 0===i?void 0:i.onSessionId(s)}}onRemoteConfig(t){const e=t.ok?t.config:void 0;return e&&"sessionRecording"in e?!1===e.sessionRecording?(this.uv(e),void this.iv()):(this.uv(e),void this.startIfEnabledOrStop()):("awaiting_config"===this.Yd&&(this.Yd="missing_config",this._instance.register_for_session({[Nt]:!0}),vk.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e="log"){var i;(null===(i=this.Xd)||void 0===i?void 0:i.log)?this.Xd.log(t,e):vk.warn("log called before recorder was ready")}get ov(){var t,e;const i=null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t?void 0:t.get_property(O);return(null==i||null===(e=i.scriptConfig)||void 0===e?void 0:e.script)||"lazy-recorder"}hv(){const t=this._instance.get_property(O);if(!t)return!1;let e;try{e="object"==typeof t?t:JSON.parse(t)}catch(t){return vk.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!Re(e.cache_timestamp)&&36e5>=Date.now()-e.cache_timestamp}rv(t){var e,i,n;if(!this.ev&&this.nv&&this._instance.sessionManager){if(!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.initSessionRecording))return vk.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Lt]:!0});var s;if(this.Xd||(this.Xd=null===(s=d.__PosthogExtensions__)||void 0===s?void 0:s.initSessionRecording(this._instance,this.Xe),this.Xd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hv()){if("missing_config"===this.Yd||"awaiting_config"===this.Yd)return;return this.Yd="awaiting_config",vk.info("persisted remote config is stale, requesting fresh config before starting"),void new Q_(this._instance).load()}this.Yd=_o,null===(i=(n=this.Xd).setDocumentWasEverVisible)||void 0===i||i.call(n,this.Xe),this.Xd.start(t)}else this.Yd=po}onRRwebEmit(t){var e,i;null===(e=this.Xd)||void 0===e||null===(i=e.onRRwebEmit)||void 0===i||i.call(e,t)}overrideLinkedFlag(){var t,e;this.Xd||null===(e=this.Ml)||void 0===e||e.register({$replay_override_linked_flag:!0}),null===(t=this.Xd)||void 0===t||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Xd||null===(e=this.Ml)||void 0===e||e.register({$replay_override_sampling:!0}),null===(t=this.Xd)||void 0===t||t.overrideSampling()}overrideTrigger(t){var e,i;this.Xd||null===(i=this.Ml)||void 0===i||i.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null===(e=this.Xd)||void 0===e||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null===(t=this.Xd)||void 0===t?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!!(null===(i=this.Xd)||void 0===i?void 0:i.tryAddCustomEvent(t,e))}flushBeforeIdentityReset(){var t,e;null===(t=this.Xd)||void 0===t||null===(e=t.flushBeforeIdentityReset)||void 0===e||e.call(t)}}},cS={autocapture:class extends i_{constructor(t){super(new rk(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.dv=this.vv()}initialize(){this.startIfEnabled()}get isEnabled(){const t=this.fv();return!!(t.path||t.search||this.pv(t))}startIfEnabled(){this.isEnabled&&(Gs.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.dv=this.vv(),this.startIfEnabled()}stop(){this.gv&&this.gv(),this.gv=void 0,this.mv&&this.mv(),this.mv=void 0,Gs.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.yv("pushState"),this.yv("replaceState"),this.bv(),this.pv()&&this._v())}yv(e){var i;if(!t||(null===(i=t.history[e])||void 0===i?void 0:i.__posthog_wrapped__))return;const n=this;Mv(t.history,e,t=>function(i,s,r){t.call(this,i,s,r),n.wv(e)})}vv(){const e=null==t?void 0:t.location;if(null==e?void 0:e.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}fv(){const t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:$e(t)?t:{}}pv(t=this.fv()){return!!t.hash&&!this._instance.config.disable_capture_url_hashes}Sv(t){const e=this.fv(),i=this.dv;return!(!i||!(e.path&&t.pathname!==i.pathname||e.search&&t.search!==i.search||this.pv(e)&&t.hash!==i.hash))}wv(t){try{const e=this.vv();if(!e)return;this.Sv(e)&&this._instance.capture(ee,{navigation_type:t}),this.dv=e}catch(e){Gs.error(`Error capturing ${t} pageview`,e)}}bv(){if(this.gv)return;const e=()=>{this.wv("popstate")};sr(t,"popstate",e),this.gv=()=>{t&&t.removeEventListener("popstate",e)}}_v(){if(this.mv)return;const e=()=>{this.wv("hashchange")};sr(t,"hashchange",e),this.mv=()=>{t&&t.removeEventListener("hashchange",e)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(t){var e;this.xv=!1,this.xo=!1,this.Cv=null,this.instance=t,this.xv=!!(null===(e=this.instance.persistence)||void 0===e?void 0:e.props[C]),this.rageclicks=new Jb(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let t=5e3;return $e(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rr.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Re(this.Rr.capture_heatmaps)?Re(this.Rr.enable_heatmaps)?this.xv:this.Rr.enable_heatmaps:!1!==this.Rr.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.xo)return;fk.info("starting..."),this.$v(),this.ln()}else{var t;clearInterval(null!==(t=this.Cv)&&void 0!==t?t:void 0),this.Tv(),this.getAndClearBuffer()}}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("heatmaps"in e))return;const i=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[C]:i}),this.xv=i,this.startIfEnabled()}getAndClearBuffer(){const t=this.Rt;return this.Rt=void 0,t}Iv(t){pk(t.originalEvent)&&this.Tr(t.originalEvent,"deadclick")}ln(){this.Cv&&clearInterval(this.Cv),this.Cv=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(n)?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}$v(){t&&n&&(this.Mv=this.bl.bind(this),sr(t,te,this.Mv),this.Ev=e=>this.Tr(e||(null==t?void 0:t.event)),sr(n,"click",this.Ev,{capture:!0}),this.Pv=e=>this.Rv(e||(null==t?void 0:t.event)),sr(n,"mousemove",this.Pv,{capture:!0}),this.Av=new k_(this.instance,__,this.Iv.bind(this)),this.Av.startIfEnabledOrStop(),this.Fv=this.ln.bind(this),sr(n,Yt,this.Fv),this.xo=!0)}Tv(){var e;t&&n&&(this.Mv&&t.removeEventListener(te,this.Mv),this.Ev&&n.removeEventListener("click",this.Ev,{capture:!0}),this.Pv&&n.removeEventListener("mousemove",this.Pv,{capture:!0}),this.Fv&&n.removeEventListener(Yt,this.Fv),clearTimeout(this.Ov),null===(e=this.Av)||void 0===e||e.stop(),this.xo=!1)}Dv(e,i){const n=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),o=function(e,i,n){let s=e;for(;s&&yr(s)&&!br(s,"body");){if(s===n)return!1;let e;try{var r,o,a;e=null===(r=null!==(o=null===(a=s.ownerDocument)||void 0===a?void 0:a.defaultView)&&void 0!==o?o:t)||void 0===r?void 0:r.getComputedStyle(s).position}catch(t){return!1}if(me(i,e))return!0;s=Pr(s)}return!1}(Tr(e),["fixed","sticky"],r);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:n),target_fixed:o,type:i}}Tr(t,e="click"){var i;if(mr(t.target)||!pk(t))return;const n=this.Dv(t,e);(null===(i=this.rageclicks)||void 0===i?void 0:i.isRageClick(t.clientX,t.clientY,(new Date).getTime()))&&jr(Tr(t),this.instance.config.rageclick)&&this.Zs(he(he({},n),{},{type:"rageclick"})),this.Zs(n)}Rv(t){!mr(t.target)&&pk(t)&&(clearTimeout(this.Ov),this.Ov=setTimeout(()=>{this.Zs(this.Dv(t,"mousemove"))},500))}Zs(e){if(!t)return;const i=this.Rr.disable_capture_url_hashes?hn(t.location.href):t.location.href,n=this.Rr.custom_personal_data_properties,s=this.Rr.mask_personal_data_properties?[...Tl,...n||[]]:[],r=cr(i,s,Ml);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}bl(){this.Rt&&!Te(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:k_,webVitalsAutocapture:class{constructor(t){var e;this._instance=t,this.xv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Lv=()=>{clearTimeout(this.Nv),this.Nv=void 0,0!==this.Rt.metrics.length&&(this._instance.capture("$web_vitals",he({$current_url:this.Rt.url},this.Rt.metrics.reduce((t,e)=>he(he({},t),{},{[`$web_vitals_${e.name}_event`]:he({},e),[`$web_vitals_${e.name}_value`]:e.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.qv=t=>{var e;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},Re(null==t?void 0:t.name)||Re(null==t?void 0:t.value))return void lk.error("Invalid metric received",t);const i="string"==typeof t.navigationURL?t.navigationURL:void 0,n=this.jv(i);if(Ie(n))return;const s=Ae(t.navigationId)||"string"==typeof t.navigationId?`navigation:${t.navigationId}`:`url:${n}`;if(this.Bv&&t.value>=this.Bv)return void lk.error("Ignoring metric with value >= "+this.Bv,t);this.Rt.navigationKey!==s&&(this.Lv(),this.Nv=setTimeout(this.Lv,this.flushToCaptureTimeoutMs)),Ie(this.Rt.navigationKey)&&(this.Rt.navigationKey=s,this.Rt.url=n),this.Rt.firstMetricTimestamp=Ie(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const r=null===(e=this._instance.sessionManager)||void 0===e?void 0:e.checkAndGetSessionAndWindowId(!0),o=he(he(he({},t),i?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete o.entries,$e(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){const e={};for(const i of dk){const n="url"===i&&"string"==typeof t.attribution[i]?this.jv(t.attribution[i]):t.attribution[i];Ie(n)||(e[i]=n)}o.attribution=e}else delete o.attribution;Ie(r)||(o.$session_id=r.sessionId,o.$window_id=r.windowId),this.Rt.metrics.push(o),this.Rt.metrics.length===this.allowedMetrics.length&&this.Lv()},this.Hv=()=>{if(this.xo)return;let t,e,i,n,s=!1;const r=d.__PosthogExtensions__,o=null==r?void 0:r.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this.zv])||("web-vitals"===this.zv&&Ie(o)?null==r?void 0:r.postHogWebVitalsCallbacks:void 0);if(!Ie(a)){const r=a.withoutAttribution,o=this.attributionMetrics;s=!Ie(r),t=o.indexOf("LCP")>-1?a.onLCP:(null==r?void 0:r.onLCP)||a.onLCP,e=o.indexOf("CLS")>-1?a.onCLS:(null==r?void 0:r.onCLS)||a.onCLS,i=o.indexOf("FCP")>-1?a.onFCP:(null==r?void 0:r.onFCP)||a.onFCP,n=o.indexOf("INP")>-1?a.onINP:(null==r?void 0:r.onINP)||a.onINP}if(!(t&&e&&i&&n))return void lk.error("web vitals callbacks not loaded - not starting");const l={reportSoftNavs:this.useSoftNavs},u=s&&this.attributionMetrics.indexOf("INP")>-1?he(he({},l),{},{includeProcessedEventEntries:!1}):l;this.allowedMetrics.indexOf("LCP")>-1&&t(this.qv.bind(this),l),this.allowedMetrics.indexOf("CLS")>-1&&e(this.qv.bind(this),l),this.allowedMetrics.indexOf("FCP")>-1&&i(this.qv.bind(this),l),this.allowedMetrics.indexOf("INP")>-1&&n(this.qv.bind(this),u),this.xo=!0},this.xv=!!(null===(e=this._instance.persistence)||void 0===e?void 0:e.props[E]),this.startIfEnabled()}get Uv(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e;const i=$e(this.Uv)?null===(t=this.Uv)||void 0===t?void 0:t.web_vitals_allowed_metrics:void 0;return Re(i)?(null===(e=this._instance.persistence)||void 0===e?void 0:e.props.$web_vitals_allowed_metrics)||hk:i}get flushToCaptureTimeoutMs(){return($e(this.Uv)?this.Uv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const t=$e(this.Uv)?this.Uv.web_vitals_attribution:void 0;return Oe(t)?t?hk:[]:xe(t)?t:ck}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const t=$e(this.Uv)?this.Uv.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Bv(){const t=$e(this.Uv)&&Ae(this.Uv.__web_vitals_max_value)?this.Uv.__web_vitals_max_value:uk;return t>0&&6e4>=t?uk:t}get isEnabled(){const t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return lk.info("Web Vitals are disabled on non-http/https protocols"),!1;const e=$e(this.Uv)?this.Uv.web_vitals:Oe(this.Uv)?this.Uv:void 0;return Oe(e)?e:this.xv}startIfEnabled(){this.isEnabled&&!this.xo&&(lk.info("enabled, starting..."),this.zo(this.Hv))}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if(!("capturePerformance"in e))return;const i=$e(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=$e(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[E]:i}),this._instance.persistence.register({[F]:n})),this.xv=i,this.startIfEnabled()}get zv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(t){var e;const i=d.__PosthogExtensions__,n=this.zv,s=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;(null==s?void 0:s[n])||"web-vitals"===n&&Ie(s)&&(null==i?void 0:i.postHogWebVitalsCallbacks)?t():null==i||null===(e=i.loadExternalDependency)||void 0===e||e.call(i,this._instance,n,e=>{e?lk.error("failed to load script",e):t()})}jv(e){const i=e||(null==t?void 0:t.location.href);if(!i)return void lk.error("Could not determine current URL");const n=this._instance.config.disable_capture_url_hashes?hn(i):i,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Tl,...s||[]]:[];return cr(n,r,Ml)}}},dS={exceptionObserver:class{constructor(e){var i;this.Hv=()=>{var e;if(!t||!this.isEnabled||!(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions))return;const i=d.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,n=d.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=d.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Wv&&this.Rr.capture_unhandled_errors&&(this.Wv=i(this.captureException.bind(this))),!this.Vv&&this.Rr.capture_unhandled_rejections&&(this.Vv=n(this.captureException.bind(this))),!this.Gv&&this.Rr.capture_console_errors&&(this.Gv=s(this.captureException.bind(this)))}catch(t){ok.error("failed to start",t),this.Zv()}},this._instance=e,this.Qv=!!(null===(i=this._instance.persistence)||void 0===i?void 0:i.props[T]),this.wt=new Je(he(he({},function(t={}){var e,i,n,s;return{refillRate:null!==(e=null!==(i=t.exceptionRateLimiterRefillRate)&&void 0!==i?i:t.__exceptionRateLimiterRefillRate)&&void 0!==e?e:1,bucketSize:null!==(n=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==n?n:10}}(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:ok})),this.Rr=this.Jv(),this.startIfEnabledOrStop()}Jv(){const t=this._instance.config.capture_exceptions;let e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return $e(t)?e=he(he({},e),t):(Ie(t)?this.Qv:t)&&(e=he(he({},e),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Rr.capture_console_errors||this.Rr.capture_unhandled_errors||this.Rr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ok.info("enabled"),this.Zv(),this.zo(this.Hv)):this.Zv()}zo(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.errorWrappingFunctions)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"exception-autocapture",e=>{if(e)return ok.error("failed to load script",e);t()})}Zv(){var t,e,i;null===(t=this.Wv)||void 0===t||t.call(this),this.Wv=void 0,null===(e=this.Vv)||void 0===e||e.call(this),this.Vv=void 0,null===(i=this.Gv)||void 0===i||i.call(this),this.Gv=void 0}onRemoteConfig(t){if(!t.ok)return;const e=t.config;"autocaptureExceptions"in e&&(this.Qv=!!e.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[T]:this.Qv}),this.Rr=this.Jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.Jv()}captureException(t){try{var e,i,n;const s=null!==(e=null==t||null===(i=t.$exception_list)||void 0===i||null===(i=i[0])||void 0===i?void 0:i.type)&&void 0!==e?e:"Exception";if(this.wt.consumeRateLimit(s))return void ok.info("Skipping exception capture because of client rate limiting.",{exception:s});null===(n=this._instance.exceptions)||void 0===n||n.sendExceptionEvent(t)}catch(t){}}},exceptions:class{constructor(t){var e,i;this.Kv=[],this.Xv=Gm(),this._instance=t,this.Kv=null!==(e=null===(i=this._instance.persistence)||void 0===i?void 0:i.get_property("$error_tracking_suppression_rules"))&&void 0!==e?e:[],this.Yv=es(this.tf()),this.ef=new is(this.Yv)}onConfigChange(){this.Yv=es(this.tf()),this.ef.setConfig(this.Yv)}onRemoteConfig(t){var e,i,n;if(!t.ok)return;const s=t.config;if(!("errorTracking"in s))return;const r=null!==(e=null===(i=s.errorTracking)||void 0===i?void 0:i.suppressionRules)&&void 0!==e?e:[],o=null===(n=s.errorTracking)||void 0===n?void 0:n.captureExtensionExceptions;this.Kv=r,this._instance.persistence&&this._instance.persistence.register({[I]:this.Kv,[M]:o})}get if(){var t;const e=!!this._instance.get_property(M),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.Xv.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.Yv.enabled)try{if(!Me(t)||0===t.trim().length)return void Hm.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};const e=[];return{sanitizedProperties:Object.keys(t).reduce((i,n)=>Yn.has(n)?(e.push(n),i):(i[n]=t[n],i),{}),droppedKeys:e}}(this.nf(e));n.length>0&&Hm.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.ef.add(he({[Kn]:t,[Xn]:(new Date).toISOString()},i))}catch(t){Hm.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{const e=t.$exception_list;if(this.sf(e)){if(this.rf(e))return this.af("Exception dropped: matched a suppression rule"),void Hm.info("Skipping exception capture because a suppression rule matched");if(!this.if&&this.lf(e))return this.af("Exception dropped: thrown by a browser extension"),void Hm.info("Skipping exception capture because it was thrown by an extension");if(!this.if&&this.uf(e))return this.af("Exception dropped: thrown by an injected browser script"),void Hm.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.hf(e))return this.af("Exception dropped: thrown by the PostHog SDK"),void Hm.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.Yv.enabled&&Re(t.$exception_steps)?this.cf(t):t,n=function(){const t=globalThis._posthogReleaseId;return"string"==typeof t&&t.length>0?t:void 0}();n&&(i.$release_id=n);try{const t=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return t&&this.ef.clear(),t}catch(t){return Bm(t)||Hm.error("Failed to capture exception event. Dropping this exception.",t),void this.ef.clear()}}catch(t){return void(Bm(t)||Hm.error("Failed to process exception event. Ignoring this exception.",t))}}cf(t){try{const e=this.ef.getAttachable();return 0===e.length?t:he(he({},t),{},{$exception_steps:e})}catch(e){return Hm.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}af(t){this.Yv.enabled&&this.ef.add({[Kn]:t,[Xn]:(new Date).toISOString()})}nf(t){return $e(t)?he({},t):{}}tf(){var t,e;return null!==(t=null===(e=this._instance.config.error_tracking)||void 0===e?void 0:e.exception_steps)&&void 0!==t?t:{}}rf(t){if(0===t.length)return!1;try{const e=t.reduce((t,{type:e,value:i})=>(Me(e)&&e.length>0&&t.$exception_types.push(e),Me(i)&&i.length>0&&t.$exception_values.push(i),t),{$exception_types:[],$exception_values:[]});return this.Kv.some(t=>{const i=t.values.map(t=>{const i=gl[t.operator],n=e[t.key];if(!i||!n)return!1;const s=xe(t.value)?t.value:[t.value];return s.length>0&&i(s,n)});return"OR"===t.type?i.some(Boolean):i.every(Boolean)})}catch(t){return Hm.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}lf(t){const e=t.flatMap(t=>{var e,i;return null!==(e=null===(i=t.stacktrace)||void 0===i?void 0:i.frames)&&void 0!==e?e:[]}),i=e.filter(({filename:t})=>!!t&&Wm.some(e=>t.startsWith(e)));return 0!==i.length&&(!i.every(({filename:t})=>!!t&&t.startsWith(zm))||t.some(({type:t,value:e})=>"NoResponse"===t||Me(e)&&Um.some(({value:t,exact:i})=>i?e===t:e.includes(t)))&&!e.some(({in_app:t,filename:e})=>t&&!(null==e?void 0:e.startsWith(zm))))}uf(t){return t.some(({value:t})=>Me(t)&&Vm.some(e=>t.includes(e)))}hf(t){if(t.length>0){var e,i,n,s;const r=null!==(e=null===(i=t[0].stacktrace)||void 0===i?void 0:i.frames)&&void 0!==e?e:[],o=r[r.length-1];return null!==(n=null==o||null===(s=o.filename)||void 0===s?void 0:s.includes("posthog.com/static"))&&void 0!==n&&n}return!1}sf(t){return!Re(t)&&xe(t)}}},vS=he({productTours:class{get Ml(){return this._instance.persistence}constructor(t){this.df=null,this.vf=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!t.ok)return;const e=t.config;if("productTours"in e){var i,n;if(this.Ml&&this.Ml.register({[R]:!!e.productTours}),!mk(this._instance))return!this.df&&Re(null===(i=this.Ml)||void 0===i?void 0:i.props.ph_product_tours)||gk.info("product tours disabled; stopping and clearing cached tours"),null===(n=this.df)||void 0===n||n.stop(),this.df=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.df&&mk(this._instance)&&this.zo(()=>this.ff())}zo(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.generateProductTours)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"product-tours",e=>{e?gk.error("Could not load product tours script",e):t()})}ff(){var t;!this.df&&(null===(t=d.__PosthogExtensions__)||void 0===t?void 0:t.generateProductTours)&&(this.df=d.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e=!1){if(xe(this.vf)&&!e)return void t(this.vf,{isLoaded:!0});const i=this.Ml;if(i){const n=i.props[pt];if(xe(n)&&!e)return this.vf=n,void t(n,{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:e=>{if(!mk(this._instance))return void t([],{isLoaded:!0});const n=e.statusCode;if(200!==n||!e.json){const i=`Product Tours API could not be loaded, status: ${n}`;return 0===n?e.error||gk.warn(i):gk.error(i),void t([],{isLoaded:!1,error:i})}const s=xe(e.json.product_tours)?e.json.product_tours:[];this.vf=s,i&&i.register({[pt]:s}),t(s,{isLoaded:!0})}})}getActiveProductTours(t){Re(this.df)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.df.getActiveProductTours(t)}showProductTour(t){var e;null===(e=this.df)||void 0===e||e.showTourById(t)}previewTour(t){this.df?this.df.previewTour(t):this.zo(()=>{var e;this.ff(),null===(e=this.df)||void 0===e||e.previewTour(t)})}dismissProductTour(){var t;null===(t=this.df)||void 0===t||t.dismissTour("user_clicked_skip")}nextStep(){var t;null===(t=this.df)||void 0===t||t.nextStep()}previousStep(){var t;null===(t=this.df)||void 0===t||t.previousStep()}clearCache(){var t;this.vf=null,null===(t=this.Ml)||void 0===t||t.unregister("ph_product_tours")}resetTour(t){var e;null===(e=this.df)||void 0===e||e.resetTour(t)}resetAllTours(){var t;null===(t=this.df)||void 0===t||t.resetAllTours()}cancelPendingTour(t){var e;null===(e=this.df)||void 0===e||e.cancelPendingTour(t)}}},uS),fS={siteApps:class{constructor(t){this._instance=t,this.pf=0,this.gf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}mf(t,e){if(!e)return;const i=this.globalsForEvent(e);this.gf.push(i),this.gf.length>1e3&&(this.gf=this.gf.slice(10))}get siteAppLoaders(){var t;return null===(t=d._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.mf.bind(this));this.yf=()=>{t(),this.gf=[],this.yf=void 0}}}globalsForEvent(t){var e,i,n,s,r,o,a;if(!t)throw new Error("Event payload is required");const l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(const[t,e]of Object.entries(h))l[t]={id:u[t],type:t,properties:e};const{$set_once:c,$set:d}=t;return{event:he(he({},bs(t,yk)),{},{properties:he(he(he({},t.properties),d?{$set:he(he({},null!==(e=null===(i=t.properties)||void 0===i?void 0:i.$set)&&void 0!==e?e:{}),d)}:{}),c?{$set_once:he(he({},null!==(n=null===(s=t.properties)||void 0===s?void 0:s.$set_once)&&void 0!==n?n:{}),c)}:{}),elements_chain:null!==(r=null===(o=t.properties)||void 0===o?void 0:o.$elements_chain)&&void 0!==r?r:"",distinct_id:null===(a=t.properties)||void 0===a?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}bf(t){var e;const i=null===(e=t.tagName)||void 0===e?void 0:e.toLowerCase();if("style"===i&&this._instance.config.prepare_external_dependency_stylesheet){return this._instance.config.prepare_external_dependency_stylesheet(t)||(bk.error("prepare_external_dependency_stylesheet returned null"),null)}if("script"===i&&this._instance.config.prepare_external_dependency_script){return this._instance.config.prepare_external_dependency_script(t)||(bk.error("prepare_external_dependency_script returned null"),null)}return t}_f(){var t,e,i,s,r,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const u=null==n?void 0:n.defaultView,h=null==u||null===(t=u.Node)||void 0===t?void 0:t.prototype;if(!u||!h)return()=>{};if(this.pf++,this.wf)return this.kf();const c=[],d=this,v=new WeakSet,f=(t,e,i)=>{if(!(null==t?void 0:t[e]))return;const n=t[e];t[e]=i(n),c.push(()=>{t[e]=n})},p=t=>{if(v.has(t))return t;const e=d.bf(t);return e&&v.add(e),e},g=t=>t.map(t=>"string"==typeof t?t:p(t)).filter(t=>!Pe(t));return f(h,"appendChild",t=>function(e){const i=p(e);return i?t.call(this,i):e}),f(h,"insertBefore",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):e}),f(h,"replaceChild",t=>function(e,i){const n=p(e);return n?t.call(this,n,i):i}),[null===(e=u.Element)||void 0===e?void 0:e.prototype,null===(i=u.Document)||void 0===i?void 0:i.prototype,null===(s=u.DocumentFragment)||void 0===s?void 0:s.prototype].forEach(t=>{f(t,"append",t=>function(...e){return t.apply(this,g(e))}),f(t,"prepend",t=>function(...e){return t.apply(this,g(e))})}),[null===(r=u.Element)||void 0===r?void 0:r.prototype,null===(o=u.CharacterData)||void 0===o?void 0:o.prototype,null===(a=u.DocumentType)||void 0===a?void 0:a.prototype].forEach(t=>{f(t,"before",t=>function(...e){return t.apply(this,g(e))}),f(t,"after",t=>function(...e){return t.apply(this,g(e))}),f(t,"replaceWith",t=>function(...e){const i=g(e);return e.length&&!i.length?void 0:t.apply(this,i)})}),f(null===(l=u.Element)||void 0===l?void 0:l.prototype,"insertAdjacentElement",t=>function(e,i){const n=p(i);return n?t.call(this,e,n):null}),this.wf=()=>{c.forEach(t=>t()),this.wf=void 0},this.kf()}kf(){let t=!1;return()=>{var e;t||(t=!0,this.pf--,0===this.pf&&(null===(e=this.wf)||void 0===e||e.call(this)))}}Sf(t,e=!0){const i=this._f();try{const n=t(i);return e&&i(),n}catch(t){throw i(),t}}setupSiteApp(t){const e=this.apps[t.id],i=()=>{var i;!e.errored&&this.gf.length&&(bk.info(`Processing ${this.gf.length} events for site app with id ${t.id}`),this.gf.forEach(t=>this.Sf(()=>{var i;return null===(i=e.processEvent)||void 0===i?void 0:i.call(e,t)})),e.processedBuffer=!0),Object.values(this.apps).every(t=>t.processedBuffer||t.errored)&&(null===(i=this.yf)||void 0===i||i.call(this))};let n=!1;const s=s=>{e.errored=!s,e.loaded=!0,bk.info(`Site app with id ${t.id} ${s?"loaded":"errored"}`),n&&i()};try{const{processEvent:i}=this.Sf(e=>t.init({posthog:this._instance,callback(t){e(),s(t)}}),!1);i&&(e.processEvent=i),n=!0}catch(e){bk.error(_k+t.id,e),s(!1)}if(n&&e.loaded)try{i()}catch(i){bk.error(`Error while processing buffered events PostHog app with config id ${t.id}`,i),e.errored=!0}}xf(){const t=this.siteAppLoaders||[];for(const e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(const e of t)this.setupSiteApp(e)}Cf(t){if(0===Object.keys(this.apps).length)return;const e=this.globalsForEvent(t);for(const i of Object.values(this.apps))try{this.Sf(()=>{var t;return null===(t=i.processEvent)||void 0===t?void 0:t.call(i,e)})}catch(e){bk.error(`Error while processing event ${t.event} for site app ${i.id}`,e)}}onRemoteConfig(t){var e,i,n;if(null===(e=this.siteAppLoaders)||void 0===e?void 0:e.length)return this.isEnabled?(this.xf(),void this._instance.on("eventCaptured",t=>this.Cf(t))):void bk.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null===(i=this.yf)||void 0===i||i.call(this),!t.ok)return;const s=t.config;if(null===(n=s.siteApps)||void 0===n?void 0:n.length)if(this.isEnabled)for(const{id:t,url:e}of s.siteApps){var r,o;d[`__$$ph_site_app_${t}`]=this._instance,null===(r=d.__PosthogExtensions__)||void 0===r||null===(o=r.loadSiteApp)||void 0===o||o.call(r,this._instance,e,e=>{if(e)return bk.error(_k+t,e)})}else bk.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},pS={tracingHeaders:class{constructor(t){this._instance=t,this.$f=void 0,this.Tf=void 0,this.If=void 0,this.Hv=()=>{const t=this.Mf();var e,i;t?(Ie(this.$f)&&(this.$f=null===(e=d.__PosthogExtensions__)||void 0===e||null===(e=e.tracingHeadersPatchFns)||void 0===e?void 0:e._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),Ie(this.Tf)&&(this.Tf=null===(i=d.__PosthogExtensions__)||void 0===i||null===(i=i.tracingHeadersPatchFns)||void 0===i?void 0:i._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Zv()}}initialize(){this.startIfEnabledOrStop()}zo(t){var e,i,n;(null===(e=d.__PosthogExtensions__)||void 0===e?void 0:e.tracingHeadersPatchFns)?t():null===(i=d.__PosthogExtensions__)||void 0===i||null===(n=i.loadExternalDependency)||void 0===n||n.call(i,this._instance,"tracing-headers",e=>{if(e)return ak.error("failed to load script",e);t()})}Ef(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Mf(){const t=this.Ef();return xe(t)?(xe(this.If)?this.If.splice(0,this.If.length,...t):this.If=[...t],t.length>0?this.If:void 0):(xe(this.If)&&this.If.splice(0),this.If=t||void 0,this.If)}Zv(){var t,e;null===(t=this.$f)||void 0===t||t.call(this),null===(e=this.Tf)||void 0===e||e.call(this),this.$f=void 0,this.Tf=void 0}startIfEnabledOrStop(){this.Mf()?this.zo(this.Hv):this.Zv()}}},gS=he({surveys:class extends xk{constructor(t){var e;super(new Ek(t),(e=t,{get projectToken(){return e.config.token},kv:new Mk(e)})),this._instance=t}qh(t,e){const i=e.query?iw(t,e.query):t;return new Promise(t=>{var n;this._instance._send_request({method:e.method,url:this._instance.requestRouter.endpointFor(null!==(n=e.target)&&void 0!==n?n:"api",i),data:e.body,headers:e.headers,timeout:e.timeoutMs,fireCallbackOnDrop:!0,transport:e.transport,compression:e.compression,timestampMode:e.sentAt,callback:t})})}}},uS),mS={toolbar:class{constructor(t){this.instance=t}Pf(t){d.ph_toolbar_state=t}Rf(){var t;return null!==(t=d.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,i=void 0,s=void 0){var r,o;if(rr(this.instance.config))return!1;if(!t||!n)return!1;e=null!==(r=e)&&void 0!==r?r:t.location,s=null!==(o=s)&&void 0!==o?o:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}i=null==t?void 0:t.localStorage}const n=Pk||dr(e.hash,"__posthog")||dr(e.hash,"state");let r;const o=n?cn(()=>JSON.parse(atob(decodeURIComponent(n))))||cn(()=>JSON.parse(decodeURIComponent(n))):null;return o&&"ph_authorize"===o.action?(r=o,r.source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):(r=JSON.parse(i.getItem(Rk)||"{}"),r.source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Af(t){const e=d.ph_load_toolbar||d.ph_load_editor;!Re(e)&&Ce(e)?e(t,this.instance):Ak.warn("No toolbar load function found")}loadToolbar(e){const i=!!(null==n?void 0:n.getElementById("__POSTHOG_TOOLBAR__"));if(!t||i)return!1;const s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=he(he({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(Rk,JSON.stringify(he(he({},r),{},{source:void 0}))),2===this.Rf())this.Af(r);else if(0===this.Rf()){var o,a;this.Pf(1),null===(o=d.__PosthogExtensions__)||void 0===o||null===(a=o.loadExternalDependency)||void 0===a||a.call(o,this.instance,"toolbar",t=>{if(t)return Ak.error("[Toolbar] Failed to load",t),void this.Pf(0);this.Pf(2),this.Af(r)}),sr(t,"turbolinks:load",()=>{this.Pf(0),this.loadToolbar(r)})}return!0}Ff(t){return this.loadToolbar(t)}maybeLoadEditor(t=void 0,e=void 0,i=void 0){return this.maybeLoadToolbar(t,e,i)}}},yS=he({experiments:class e{get Rr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(t=!1)=>{this.getWebExperiments(t=>{e.Of("retrieved web experiments from the server"),this.Df=new Map,t.forEach(t=>{if(t.feature_flag_key){var i;this.Df&&(e.Of("setting flag key ",t.feature_flag_key," to web experiment ",t),null===(i=this.Df)||void 0===i||i.set(t.feature_flag_key,t));const n=this._instance.getFeatureFlag(t.feature_flag_key);Me(n)&&t.variants[n]&&this.Lf(t.name,n,t.variants[n].transforms)}else if(t.variants)for(const i in t.variants){const n=t.variants[i];e.Nf(n,this._instance)&&this.Lf(t.name,i,n.transforms)}})},t)},this._instance.onFeatureFlags(t=>{this.onFeatureFlags(t)})}initialize(){}onFeatureFlags(t){if(this._is_bot())e.Of(Uk);else if(!this.Rr.disable_web_experiments){if(Re(this.Df))return this.Df=new Map,this.loadIfEnabled(),void this.previewWebExperiment();e.Of("applying feature flags",t),t.forEach(t=>{var e;if(this.Df&&(null===(e=this.Df)||void 0===e?void 0:e.has(t))){var i;const e=this._instance.getFeatureFlag(t),n=null===(i=this.Df)||void 0===i?void 0:i.get(t);e&&(null==n?void 0:n.variants[e])&&this.Lf(n.name,e,n.variants[e].transforms)}})}}previewWebExperiment(){const t=e.getWindowLocation();if(null==t?void 0:t.search){const i=hr(null==t?void 0:t.search,"__experiment_id"),n=hr(null==t?void 0:t.search,"__experiment_variant");i&&n&&(e.Of(`previewing web experiments ${i} && ${n}`),this.getWebExperiments(t=>{this.qf(parseInt(i),n,t)},!1,!0))}}loadIfEnabled(){this.Rr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Rr.disable_web_experiments&&!i)return t([]);const n=this._instance.get_property("$web_experiments");if(n&&!e)return t(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Rr.token}`),method:"GET",timestampMode:"query",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}qf(t,i,n){const s=n.filter(e=>e.id===t);s&&s.length>0&&(e.Of(`Previewing web experiment [${s[0].name}] with variant [${i}]`),this.Lf(s[0].name,i,s[0].variants[i].transforms))}static Nf(t,i){return!Re(t.conditions)&&e.jf(t,i)&&e.Bf(t)}static jf(t,i){var n;if(Re(t.conditions)||Re(null===(n=t.conditions)||void 0===n?void 0:n.url))return!0;const s=e.getWindowLocation();if(s){var r,o,a;const e=pr(i,s.href);return!(null===(r=t.conditions)||void 0===r?void 0:r.url)||Wk[null!==(o=null===(a=t.conditions)||void 0===a?void 0:a.urlMatchType)&&void 0!==o?o:"icontains"](t.conditions.url,e)}return!1}static getWindowLocation(){return null==t?void 0:t.location}static Bf(t){var e;if(Re(t.conditions)||Re(null===(e=t.conditions)||void 0===e?void 0:e.utm))return!0;const i=Pl();if(i.utm_source){var n,s,r,o,a,l,u,h;const e=!(null===(n=t.conditions)||void 0===n||null===(n=n.utm)||void 0===n?void 0:n.utm_campaign)||(null===(s=t.conditions)||void 0===s||null===(s=s.utm)||void 0===s?void 0:s.utm_campaign)==i.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)==i.utm_source,d=!(null===(a=t.conditions)||void 0===a||null===(a=a.utm)||void 0===a?void 0:a.utm_medium)||(null===(l=t.conditions)||void 0===l||null===(l=l.utm)||void 0===l?void 0:l.utm_medium)==i.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)==i.utm_term;return e&&d&&v&&c}return!1}static Of(t,...e){Gs.info(`[WebExperiments] ${t}`,e)}Lf(t,i,n){this._is_bot()?e.Of(Uk):"control"!==i?n.forEach(n=>{if(n.selector){var s;e.Of(`applying transform of variant ${i} for experiment ${t} `,n);const r=null===(s=document)||void 0===s?void 0:s.querySelectorAll(n.selector);null==r||r.forEach(t=>{const e=t;n.html&&(e.innerHTML=n.html),n.css&&e.setAttribute("style",n.css)})}}):e.Of("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?Tw(i,this.Rr.custom_blocked_useragents):void 0}}},uS),bS={conversations:class{constructor(t){this._instance=t,this.Hf=void 0,this._conversationsManager=null,this.zf=!1,this.ne=null,this.Uf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(this._instance.config.disable_conversations)return;if(this.Wf=t.ok,!t.ok)return;const e=t.config.conversations;Re(e)||(Oe(e)?this.Hf=e:(this.Hf=e.enabled,this.ne=e),this.loadIfEnabled())}reset(){var t;null===(t=this._conversationsManager)||void 0===t||t.reset(),this._conversationsManager=null,this.Hf=void 0,this.ne=null,this.Wf=void 0,this.Uf=!1}loadIfEnabled(){if(this._conversationsManager)return;if(this.zf)return;if(this._instance.config.disable_conversations)return;if(rr(this._instance.config))return;if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const t=null==d?void 0:d.__PosthogExtensions__;if(t&&!Ie(this.Hf)&&this.Hf)if(this.ne&&this.ne.token){this.zf=!0;try{const e=t.initConversations;if(e)return this.Vf(e),void(this.zf=!1);const i=t.loadExternalDependency;if(!i)return void this.Gf(Qt);i(this._instance,"conversations",e=>{e||!t.initConversations?this.Gf("Could not load conversations script",e):this.Vf(t.initConversations),this.zf=!1})}catch(t){this.Gf("Error initializing conversations",t),this.zf=!1}}else Vk.error("Conversations enabled but missing token in remote config.")}Vf(t){if(this.ne)try{this._conversationsManager=t(this.ne,this._instance),this.Uf=!1,Vk.info("Conversations loaded successfully")}catch(t){this.Gf("Error completing conversations initialization",t)}else Vk.error("Cannot complete initialization: remote config is null")}Gf(t,e){Vk.error(t,e),this._conversationsManager=null,this.zf=!1,this.Uf=!0}show(){this._conversationsManager?this._conversationsManager.show():Vk.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Hf&&!Pe(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":rr(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Wf?"remote_config_failed":Ie(this.Hf)?this.Wf?"disabled_in_project":"remote_config_pending":this.Hf?Re(this.ne)||!this.ne.token?"missing_token":(null==d?void 0:d.__PosthogExtensions__)?this.zf?"initializing":this.Uf?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,e,i){var n=this;return oe(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(t,e,i):(Vk.warn(Gk),null)})()}getMessages(t,e){var i=this;return oe(function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(Vk.warn(Gk),null)})()}markAsRead(t){var e=this;return oe(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Vk.warn(Gk),null)})()}getTickets(t){var e=this;return oe(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Vk.warn(Gk),null)})()}requestRestoreLink(t){var e=this;return oe(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Vk.warn(Gk),null)})()}restoreFromToken(t){var e=this;return oe(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Vk.warn(Gk),null)})()}restoreFromUrlToken(){var t=this;return oe(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Vk.warn(Gk),null)})()}getCurrentTicketId(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null===(e=this._conversationsManager)||void 0===e?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}Sh(){var t;null===(t=this._conversationsManager)||void 0===t||t.setIdentity()}xh(){var t;null===(t=this._conversationsManager)||void 0===t||t.clearIdentity()}}},_S={logs:class{constructor(e){var i;this._instance=e,this.name=og,this.Zf=!1,this.Qf=!1,this.Jf=!1,this.$=Zs("[logs]"),this.Kf=he(he({},this.$),{},{error:(...t)=>{t.some(Yk)||this.$.error(...t)}}),this.al=[],this.Xf=[],this.hd=0,this.Io=!1,this.Yf=[],this.tp=[],this.ep=!1,this.np=!1,this.sp=()=>{var t,e;this.Io||(this.hd=0,null===(t=this.rp)||void 0===t||t.onReconnect(),null===(e=this.op)||void 0===e||e.onReconnect())},this._instance&&(null===(i=this._instance.config.logs)||void 0===i?void 0:i.captureConsoleLogs)&&(this.Zf=!0),t&&sr(t,"online",this.sp)}ap(t,e,i,n){var s;const r=Zk(null===(s=this._instance)||void 0===s||null===(s=s.config)||void 0===s?void 0:s.logs,i);return[new Ns(this.lp(t,e),r,this.Kf,()=>this.up(),t=>t(),void 0,n),r]}hp(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var i;return this.rp&&this.cp===e||(null===(i=this.rp)||void 0===i||i.reset(),this.cp=e,[this.rp,this.dp]=this.ap(()=>this.al,t=>{this.al=t})),this.rp}vp(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs;var i;return this.op&&this.fp===e||(null===(i=this.op)||void 0===i||i.reset(),this.fp=e,[this.op,this.pp]=this.ap(()=>this.Xf,t=>{this.Xf=t},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Jk)),this.op}setup(t){var e;if(this.Io)return;this.wo=t,(null===(e=this._instance)||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.logs)||void 0===e?void 0:e.captureConsoleLogs)&&(this.Zf=!0),(this.Zf||this.gp()&&this.mp())&&this.yp();let i=!1;const n=t.onRemoteConfig(t=>{var e;i=t.ok&&!0===(null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs),this.onRemoteConfig(t)});this.Io?n.dispose():(this.Po=n,i||this.loadIfEnabled())}dispose(){var e,i,n,s;this.Io||(this.Io=!0,this.bp(),null===(e=this.Po)||void 0===e||e.dispose(),this.Po=void 0,this.wo=void 0,this.Jf=!1,null==t||t.removeEventListener("online",this.sp),null===(i=this._p)||void 0===i||i.call(this),this._p=void 0,null===(n=this.rp)||void 0===n||n.reset(),null===(s=this.op)||void 0===s||s.reset())}onRemoteConfig(t){var e,i;if(this.Io)return;const n=t.ok?null===(e=t.config.logs)||void 0===e?void 0:e.captureConsoleLogs:void 0;Re(n)?this.wp():(null===(i=this._instance)||void 0===i||null===(i=i.persistence)||void 0===i||i.register({$logs_capture_enabled_server_side:!!n}),n?(this.Zf=!0,this.Qf||this.yp(),this.loadIfEnabled()):this.wp())}reset(){var t,e,i,n;this.bp(),null===(t=this.rp)||void 0===t||t.clearQueue(),this.al=[],null===(e=this.rp)||void 0===e||e.reset(),null===(i=this.op)||void 0===i||i.clearQueue(),this.Xf=[],null===(n=this.op)||void 0===n||n.reset(),this.hd=0}captureLog(t){this.Io||this.hp().captureLog(t)}captureConsoleLog(t){this.Io||this.vp().captureLog(t)}captureBufferedConsoleLog(t,e,i){this.Io||this.vp().captureLog(t,{context:e,occurredAtMs:i})}mp(){var t;return!!(null===(t=this._instance)||void 0===t||null===(t=t.persistence)||void 0===t||null===(t=t.props)||void 0===t?void 0:t[A])}gp(){var t,e,i;return!(null===(t=this._instance)||void 0===t||null===(e=t.nl)||void 0===e?void 0:e.call(t))||!!(null===(i=d._POSTHOG_REMOTE_CONFIG)||void 0===i||null===(i=i[this._instance.config.token])||void 0===i?void 0:i.config)}$h(){var t;this.bp(),null===(t=this.op)||void 0===t||t.clearQueue(),this.Xf=[]}wp(){this.Zf||this.bp()}yp(){var t;if(this.ep||!(null==d?void 0:d.console))return;const e=Zk(null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.logs).maxBufferSize;let i=!0;this.tp.push(()=>{i=!1});for(const t of Qk){let n;try{n=Im(d.console[t])}catch(t){continue}n&&this.tp.push(Mv(d.console,t,s=>{const r=(...n)=>{try{i&&this.kp(t,n,e)}catch(t){}return s.apply(d.console,n)};return r.__rrweb_original__=n,r}))}this.ep=!0,this.Sp=setTimeout(()=>{this.bp()},3e4)}kp(t,e,i){var n;if(this.ep&&!this.np&&0!==e.length)if(null===(n=this._instance)||void 0===n?void 0:n.is_capturing()){if(i>this.Yf.length){this.np=!0;try{this.Yf.push({level:t,args:e,occurredAtMs:Date.now(),context:this.up()})}finally{this.np=!1}}}else this.bp()}bp(){if(this.Yf=[],this.ep){this.ep=!1,this.Sp&&(clearTimeout(this.Sp),this.Sp=void 0);for(const t of this.tp)t();this.tp=[]}}xp(){const t=this.Yf;return this.bp(),t}get logger(){return this.Cp||(this.Cp={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.Cp}flushLogs(t){t?this.$p(t):(this.rp&&this.rp.flush().catch(t=>this.Tp(t)),this.op&&this.op.flush().catch(t=>this.Tp(t)))}Tp(t){Yk(t)||this.$.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Io||!this.Zf||this.Qf||this.Jf)return;const t=null==d?void 0:d.__PosthogExtensions__;if(!t)return this.$.error("PostHog Extensions not found."),void this.bp();const e=t.loadExternalDependency;if(!e)return this.$.error(Qt),void this.bp();this.Jf=!0;try{e(this._instance,"logs",e=>{if(this.Jf=!1,this.Io||!this.Zf)return;const i=t.logs;if(e||!(null==i?void 0:i.initializeLogs))this.$.error("Could not load logs script",e),this.bp();else{var n;const t=this.xp();var s,r;this._p=i.initializeLogs(null!==(n=this.wo)&&void 0!==n?n:this._instance),this.Qf=!0,t.length>0&&(null===(s=i.replayConsoleBuffer)||void 0===s||s.call(i,null!==(r=this.wo)&&void 0!==r?r:this._instance,t))}})}catch(t){throw this.Jf=!1,t}}lp(t,e){const i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===ce.LogsQueue?t():void 0,setPersistedProperty(t,i){var n;t===ce.LogsQueue&&e(null!==(n=i)&&void 0!==n?n:[])},js:t=>this.js(t),getLibraryId:()=>Ya.LIB_NAME,getLibraryVersion:()=>Ya.LIB_VERSION}}js(t){return new Promise(e=>{if(vr(this.hd,3))return void e({kind:"fatal",error:Xk(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const n=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:Xk(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Ip(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{const e=t.statusCode;if(this.Mp(e),e>=200&&300>e)n({kind:"ok"});else if(413===e)n({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)n({kind:"fatal",error:new Error(`logs request failed with status ${e}`)});else{var i;0===e?(t.error||this.$.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:Xk(t.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`logs request failed with status ${e}`)})}}})})}Mp(t){(0!==t||this._instance.__loaded)&&(this.hd=fr(t,this.hd,3,()=>this.$.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.")))}$p(t){this.al.length>0&&this.Ep(t,this.al,this.dp,Ya.LIB_NAME,t=>{this.al=t}),this.Xf.length>0&&this.Ep(t,this.Xf,this.pp,Jk,t=>{this.Xf=t})}Ep(t,e,i,n,s){if(0===e.length)return;const r=e.map(t=>t.record);s([]);const o=Fs(r,As(i,Ya.LIB_NAME,Ya.LIB_VERSION),n,Ya.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ip(),data:o,compression:"best-available",batchKey:"logs",transport:t})}Ip(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}up(){var t;const e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:t,windowId:i,sessionStartTimestamp:n,lastActivityTimestamp:s}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=t,e.windowId=i,Re(n)||(e.sessionStartTimestamp=n),Re(s)||(e.lastActivityTimestamp=s)}if((null==d||null===(t=d.location)||void 0===t?void 0:t.href)&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?hn(d.location.href):d.location.href),this._instance.featureFlags){const t=this._instance.featureFlags.getFlags();t&&t.length>0&&(e.activeFeatureFlags=t)}return e}}},wS={metrics:class{constructor(t){this._instance=t,this.$=Zs("[metrics]"),this.Io=!1}initialize(){this.onConfigChange()}onConfigChange(){var t;if(this.Io)return;const e=!!(null===(t=this._instance.config.metrics)||void 0===t?void 0:t.network);e&&!this.Pp?this.Pp=(t=>{let e=!0;const i=()=>e?(t=>{var e;const i=null===(e=t.config.metrics)||void 0===e?void 0:e.network;return!0===i?{}:i||void 0})(t):void 0,n=aS(t,i),s=lS(t,i);return()=>{e=!1,n(),s()}})(this._instance):!e&&this.Pp&&(this.Pp(),this.Pp=void 0)}hp(){var t;const e=null===(t=this._instance)||void 0===t||null===(t=t.config)||void 0===t?void 0:t.metrics;var i;return this.rp&&this.cp===e||(null===(i=this.rp)||void 0===i||i.reset(),this.cp=e,this.rp=new Hs(this.lp(),function(t){var e,i,n,s,r;const o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(e=null==o?void 0:o["service.name"])&&void 0!==e?e:null==t?void 0:t.serviceName,serviceVersion:null!==(i=null==o?void 0:o["service.version"])&&void 0!==i?i:null==t?void 0:t.serviceVersion,environment:null!==(n=null==o?void 0:o["deployment.environment"])&&void 0!==n?n:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(r=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==r?r:1e3}}(e),this.$)),this.rp}count(t,e=1,i){this.hp().count(t,e,i)}gauge(t,e,i){this.hp().gauge(t,e,i)}histogram(t,e,i){this.hp().histogram(t,e,i)}flush(t){if(!this.rp)return Promise.resolve();if(t){const e=this.rp.drainWindow();return e&&this.Ys(e,t),Promise.resolve()}return this.rp.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var t;null===(t=this.rp)||void 0===t||t.reset()}dispose(){var t,e;this.Io=!0,null===(t=this.Pp)||void 0===t||t.call(this),this.Pp=void 0,null===(e=this.rp)||void 0===e||e.reset()}lp(){const t=this._instance,e=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Ys:t=>e.Ys(t),getLibraryId:()=>Ya.LIB_NAME,getLibraryVersion:()=>Ya.LIB_VERSION}}Ys(t,e){return new Promise(i=>{let n=!1;const s=t=>{n||(n=!0,clearTimeout(r),i(t))},r=setTimeout(()=>s({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(he(he({method:"POST",url:this.Rp(),data:t,compression:"best-available",batchKey:"metrics"},e&&{transport:e}),{},{fireCallbackOnDrop:!0,callback(t){const e=t.statusCode;if(e>=200&&300>e)s({kind:"ok"});else if(413===e)s({kind:"too-large"});else if(0!==e&&408!==e&&429!==e&&500>e)s({kind:"fatal",error:new Error(`metrics request failed with status ${e}`)});else{var i;s({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error(`metrics request failed with status ${e}`)})}}}))})}Rp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};sk.__defaultExtensionClasses=he({},he(he(he(he(he(he(he(he(he(he(he(he(he({},uS),hS),cS),dS),vS),fS),gS),pS),mS),yS),bS),_S),wS)),function(){Ya.SDK_DIST_CHANNEL="cdn";const e=d.posthog;if(e&&!xe(e._i)&&Ce(e.init))return;const i=Bw[Xw]=new sk;if(e){const t=[];Js(e._i,function(n){if(n&&xe(n)){const s=i.init(n[0],n[1],n[2]),r=e[n[2]]||e;s.__loaded&&-1===t.indexOf(r)&&(t.push(r),s._execute_array.call(s.people,r.people),s._execute_array(r))}})}i.__SV=1,d.posthog=i,function(){function e(){e.done||(e.done=!0,pw=!1,Js(Bw,function(t){t._dom_loaded()}))}(null==n?void 0:n.addEventListener)?"complete"===n.readyState?e():sr(n,"DOMContentLoaded",e,{capture:!1}):t&&Gs.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
2
2
  //# sourceMappingURL=array.full.js.map